:root {
  --primary: #1e40af;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --surface: #ffffff;
  --background: #f8fafc;
  --border: #e2e8f0;
  --border-subtle: #cbd5e1;
  --text-main: #0f172a;
  --text-muted: #526875;
  --text-sub: #334155;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 8px -2px rgba(0, 0, 0, 0.08);
}

* { box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang TC", sans-serif; }
body { background: var(--background); color: var(--text-main); padding: 24px 16px 64px; line-height: 1.5; }
.container { max-width: 1280px; margin: 0 auto; }

/* Header */
.header { margin-bottom: 20px; }
.header-badge { display: inline-block; padding: 4px 12px; background: var(--primary-light); color: var(--primary); font-size: 0.8rem; font-weight: 700; border-radius: 999px; margin-bottom: 8px; }
.header-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.5px; }
.header-subtitle { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }

/* 30秒條件速配橫幅 (Wizard Banner) */
.wizard-card {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  color: #ffffff;
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wizard-top { display: flex; justify-content: space-between; align-items: center; }
.wizard-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }
.wizard-search-btn { min-height: 46px; background: #047857; color: #fff; border: 1px solid rgba(255,255,255,.45); border-radius: 8px; padding: 9px 14px; font-weight: 700; cursor: pointer; }
.wizard-search-btn:hover { background: #065f46; }
.wizard-title { font-size: 1.15rem; font-weight: 700; }
.wizard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  background: rgba(255, 255, 255, 0.12);
  padding: 14px;
  border-radius: 8px;
}
.wizard-field label { display: block; font-size: 0.8rem; margin-bottom: 4px; opacity: 0.9; }
.wizard-select { width: 100%; padding: 8px; border-radius: 6px; border: none; font-size: 0.88rem; outline: none; background: #fff; color: #333; }
.wizard-multi-select { min-height: 126px; }
.wizard-multi-hint { margin: 0; font-size: .78rem; opacity: .9; }
.wizard-selection-count { margin: 0; min-height: 46px; display: flex; align-items: center; padding: 9px 12px; border: 2px solid rgba(216,255,95,.72); border-radius: 10px; background: rgba(8,35,31,.72); color: #fff; font-size: 1rem; font-weight: 800; line-height: 1.5; }
.wizard-choice-list { display: grid; grid-template-columns: 1fr; gap: 6px; max-height: 210px; overflow-y: auto; padding: 8px; border: 2px solid rgba(255,255,255,.3); border-radius: 10px; background: rgba(255,255,255,.1); scrollbar-gutter: stable; }
.wizard-choice { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 7px 9px; border-radius: 8px; background: #fff; color: #16332d; font-size: 1rem; font-weight: 700; line-height: 1.35; cursor: pointer; }
.wizard-choice:hover { background: #f1f8dc; }
.wizard-choice:has(input:checked) { background: #d8ff5f; color: #16332d; box-shadow: inset 0 0 0 2px #759b25; }
.wizard-choice input { flex: 0 0 auto; width: 22px; height: 22px; margin: 0; accent-color: #16332d; }
.wizard-choice input:focus-visible { outline: 3px solid #f2cf8a; outline-offset: 2px; }

/* 頂層國中以下 vs 國中以上切換列 */
.stage-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.stage-btn { background: #fff; border: 2px solid var(--border); border-radius: var(--radius); padding: 12px; cursor: pointer; text-align: left; transition: all 0.2s; }
.stage-btn.active { border-color: var(--primary); background: var(--primary-light); }
.stage-btn-title { font-weight: 700; font-size: 0.95rem; display: block; color: var(--text-main); }
.stage-btn-desc { font-size: 0.78rem; color: var(--text-muted); }

/* 主雙欄佈局 */
.layout { display: flex; flex-direction: column; gap: 24px; }
@media (min-width: 960px) { .layout { flex-direction: row; align-items: flex-start; } }

/* 左側進階篩選 */
.sidebar { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; width: 100%; box-shadow: var(--shadow-sm); }
@media (min-width: 960px) { .sidebar { width: 320px; position: sticky; top: 20px; max-height: 88vh; overflow-y: auto; } }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 1px solid var(--border); }
.btn-text { background: none; border: none; color: var(--primary); font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.filter-group { margin-bottom: 18px; }
.filter-title { font-size: 0.82rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; }
.custom-check { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; font-size: 0.88rem; cursor: pointer; }
.custom-check input { accent-color: var(--primary); width: 16px; height: 16px; }

/* 右側主視圖 */
.content { flex: 1; min-width: 0; }
.view-tabs { display: flex; border-bottom: 1px solid var(--border); margin-bottom: 16px; gap: 8px; }
.tab-btn { background: none; border: none; padding: 10px 14px; font-size: 0.92rem; font-weight: 600; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.badge { font-size: 0.75rem; background: #f1f5f9; padding: 2px 6px; border-radius: 999px; }

/* 清單控制與匯出按鈕 */
.action-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.btn-export { background: #047857; color: #fff; border: none; padding: 6px 14px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn-export:hover { background: #065f46; }
.deadline-quick-filter { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 12px; margin: 0 0 14px; padding: 12px 14px; border: 2px solid #d4573f; border-radius: 12px; background: #fff8f6; color: var(--text-main); }
.deadline-toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-size: 1rem; font-weight: 800; cursor: pointer; }
.deadline-toggle input { width: 20px; height: 20px; accent-color: #a33c2e; }
.deadline-range-label { font-size: .9rem; font-weight: 700; }
.deadline-range { min-height: 44px; padding: 8px 34px 8px 11px; border: 1px solid var(--border-subtle); border-radius: 9px; background: #fff; color: var(--text-main); font-size: 1rem; }
.deadline-range:disabled { background: #eeeae2; color: #68746f; cursor: not-allowed; }
.deadline-quick-hint { flex: 1 1 220px; color: var(--text-sub); font-size: .88rem; line-height: 1.5; }
.filter-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: -2px 0 14px; min-height: 30px; color: var(--text-muted); font-size: 0.86rem; }
.filter-summary-label { font-weight: 700; color: var(--text-sub); }
.filter-chip { display: inline-flex; align-items: center; padding: 4px 9px; border: 1px solid #c9dce5; border-radius: 999px; background: #f3f8fa; color: #245b8f; }
.filter-summary-clear { border: 0; padding: 4px 7px; background: transparent; color: #8a5a16; font-weight: 700; cursor: pointer; text-decoration: underline; }
.filter-summary-empty { color: var(--text-muted); }
.status-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0 0 14px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: #fff; color: var(--text-sub); font-size: 0.84rem; line-height: 1.5; }
.status-legend-item { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.status-badge { display: inline-flex; align-items: center; min-height: 30px; padding: 5px 10px; border-radius: 999px; color: #fff; font-size: 0.88rem; font-weight: 800; line-height: 1.25; white-space: nowrap; }
.status-deadline { background: #a33c2e; }
.status-updated { background: #146c43; }

/* 卡片設計 */
.card-list { display: flex; flex-direction: column; gap: 14px; }
.card { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.card-status-area { display: flex; align-items: flex-start; justify-content: flex-end; gap: 8px; }
.card-status-badges { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
.card-title { font-size: 1.15rem; font-weight: 700; color: #0f172a; }
.card-sub { font-size: 0.85rem; color: var(--text-muted); }
.card-pill { display: inline-flex; align-items: center; min-height: 30px; font-size: 0.82rem; padding: 4px 9px; border-radius: 999px; font-weight: 700; }
.pill-urgent { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.pill-normal { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

.card-box { background: #f8fafc; border-radius: 6px; padding: 10px 12px; font-size: 0.86rem; display: flex; flex-direction: column; gap: 4px; }
.warning-school { color: #b45309; font-size: 0.8rem; font-weight: 600; }

.card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 0.72rem; padding: 2px 7px; border-radius: 4px; font-weight: 600; }
.tag-stage { background: #e0f2fe; color: #0369a1; }
.tag-src { background: #f1f5f9; color: #475569; }

.card-foot { display: flex; justify-content: space-between; align-items: center; padding-top: 8px; border-top: 1px dashed var(--border); }
.btn-fav { background: #fff; border: 1px solid var(--border); padding: 5px 10px; border-radius: 6px; font-size: 0.8rem; cursor: pointer; }
.btn-fav.active { background: #fffbeb; border-color: #fde68a; color: #b45309; font-weight: 700; }
.btn-link { background: var(--primary); color: #fff; text-decoration: none; padding: 6px 14px; border-radius: 6px; font-size: 0.82rem; font-weight: 600; }

/* 列印與查核清單 Modal */
.checklist-modal { display: flex; position: fixed; inset: 0; background: rgba(0,0,0,0); z-index: 1000; justify-content: center; align-items: center; padding: 16px; visibility: hidden; opacity: 0; pointer-events: none; transition: opacity .2s ease, visibility .2s ease, background-color .2s ease; }
.checklist-modal.active { visibility: visible; opacity: 1; pointer-events: auto; background: rgba(0,0,0,0.5); }
.checklist-window { background: #fff; border-radius: var(--radius); max-width: 650px; width: 100%; padding: 24px; max-height: 90vh; overflow-y: auto; transform: translateY(10px) scale(.985); opacity: 0; transition: transform .22s ease, opacity .18s ease; }
.checklist-modal.active .checklist-window { transform: none; opacity: 1; }
.check-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem; }

@media print {
  body * { visibility: hidden; }
  body { padding: 0 !important; background: #fff !important; }
  body > .container { display: none !important; }
  .checklist-modal.active { position: static; display: block; padding: 0; background: none; }
  .checklist-window { max-height: none !important; overflow: visible !important; max-width: none; box-shadow: none; }
  .check-item { break-inside: avoid; }
  .printable-area, .printable-area * { visibility: visible; }
  .printable-area { position: absolute; left: 0; top: 0; width: 100%; }
  .no-print, .no-print * { display: none !important; }
}
/* 響應式與溫暖化視覺優化：不改變原有功能與資料結構 */
:root {
  --primary: #245b8f;
  --primary-hover: #1d4b76;
  --primary-light: #eaf3f8;
  --background: #f7f5f1;
  --border: #d9e1e5;
  --border-subtle: #c8d3d9;
  --text-main: #20313d;
  --text-muted: #526875;
  --text-sub: #3d505b;
  --radius: 14px;
  --shadow-sm: 0 2px 8px rgba(35, 55, 66, 0.06);
  --shadow-md: 0 10px 26px rgba(35, 55, 66, 0.10);
}

html { scroll-behavior: smooth; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
body {
  padding: clamp(16px, 3vw, 34px) clamp(12px, 3vw, 28px) 64px;
  background:
    radial-gradient(circle at 8% 0%, rgba(226, 188, 117, 0.16), transparent 28rem),
    var(--background);
}
.container { max-width: 1320px; }
.header { margin-bottom: clamp(18px, 3vw, 28px); }
.header-badge { background: #fff4d9; color: #8a5a16; border: 1px solid #f1d99f; }
.header-title { font-size: clamp(1.55rem, 3vw, 2.25rem); line-height: 1.25; letter-spacing: -0.3px; }
.header-subtitle { max-width: 760px; line-height: 1.7; }
.pwa-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.pwa-btn { min-height: 40px; padding: 8px 13px; border: 1px solid #c8d3d9; border-radius: 8px; background: #fff; color: #245b8f; font-weight: 700; cursor: pointer; }
.pwa-btn:hover { background: #eaf3f8; }
.pwa-btn[hidden] { display: none; }
.connection-status { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 5px 10px; border-radius: 999px; background: #e9f7ef; color: #27734a; font-size: 0.8rem; font-weight: 700; }
.connection-status.offline { background: #fff4d9; color: #8a5a16; }
.data-scope-note { margin: 12px 0 0; padding: 10px 12px; border: 1px solid #ead7a9; border-radius: 10px; background: #fff9e9; color: #63491c; font-size: 0.86rem; line-height: 1.6; }
.update-frequency { min-height: 32px; padding: 5px 9px; border: 1px solid #c8d3d9; border-radius: 8px; background: #fff; color: #3d505b; font-size: 0.8rem; }

.wizard-card {
  background: linear-gradient(135deg, #245b8f 0%, #3c7ea2 100%);
  border: 1px solid rgba(255,255,255,0.18);
  padding: clamp(16px, 3vw, 24px);
  box-shadow: var(--shadow-md);
}
.wizard-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; padding: clamp(12px, 2vw, 16px); }
.wizard-select, #kwInput, #sortSel { min-height: 42px; }
.wizard-select, #kwInput, #sortSel, .update-frequency { font-size: 1rem !important; }
.card-box { font-size: 1rem; }
.card-pill, .warning-school { font-size: .875rem; }
.update-status { color: var(--text-muted); font-size: .875rem; margin-top: 8px; min-height: 3em; }
#installAppBtn[hidden] { display: inline-flex; visibility: hidden; }
#dataScopeNotice { min-height: 4.8em; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; }
}
.wizard-select:focus, #kwInput:focus, #sortSel:focus { box-shadow: 0 0 0 3px rgba(255,255,255,0.35); }

.stage-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stage-btn { min-height: 78px; padding: 15px; box-shadow: var(--shadow-sm); }
.stage-btn:hover, .stage-btn:focus-visible { border-color: #8db5ca; transform: translateY(-1px); }
.stage-btn:focus-visible, .btn-text:focus-visible, .tab-btn:focus-visible, button:focus-visible, .btn-link:focus-visible {
  outline: 3px solid rgba(214, 157, 54, 0.45); outline-offset: 2px;
}

.layout { gap: clamp(16px, 2.5vw, 28px); }
.sidebar, .card { box-shadow: var(--shadow-sm); }
.sidebar { padding: clamp(16px, 2.5vw, 22px); }
.sidebar-actions { display: flex; align-items: center; gap: 8px; }
.filter-toggle { display: none; }
.custom-check { min-height: 32px; margin-bottom: 3px; }
.custom-check input { flex: 0 0 auto; }
.card { padding: clamp(15px, 2.2vw, 21px); gap: 12px; }
.card-title { font-size: clamp(1.02rem, 1.8vw, 1.2rem); line-height: 1.45; }
.card-box { background: #fbfaf7; border: 1px solid #eee8dc; padding: 12px 14px; line-height: 1.65; }
.warning-school { background: #fff7e7; border-radius: 8px; padding: 7px 9px; line-height: 1.55; }
.btn-fav, .btn-link, .btn-export { min-height: 40px; }
.btn-fav { padding-inline: 12px; }
.btn-link { display: inline-flex; align-items: center; justify-content: center; }
.btn-export { background: #8b641f; }
.btn-export:hover { background: #704f18; }
.card-foot { gap: 12px; line-height: 1.5; }

@media (max-width: 700px) {
  .action-bar > div:last-child { width: 100%; display: flex !important; }
  .action-bar > div:last-child .btn-export, .action-bar > div:last-child #sortSel { flex: 1; }
  .deadline-quick-filter { align-items: stretch; }
  .deadline-toggle, .deadline-range-label, .deadline-quick-hint { flex-basis: 100%; }
  .deadline-range { width: 100%; }
  .filter-summary { margin-top: 2px; }
}

@media (min-width: 960px) {
  .layout { flex-direction: row; }
  .sidebar { width: 310px; }
}

@media (max-width: 959px) {
  .wizard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sidebar { position: static; }
  .filter-toggle { display: inline-flex; }
  .advanced-filter-body { display: none; }
  .sidebar.filters-expanded .advanced-filter-body { display: block; }
  .sidebar.filters-expanded .sidebar-header { margin-bottom: 16px; }
  .sidebar:not(.filters-expanded) .sidebar-header { margin-bottom: 0; padding-bottom: 0; border-bottom: 0; }
}

@media (max-width: 700px) {
  body { padding-inline: 12px; }
  .wizard-top { align-items: flex-start; gap: 12px; }
  .wizard-title { line-height: 1.4; }
  .wizard-grid { grid-template-columns: 1fr; }
  .stage-tabs { display: flex; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 5px; }
  .stage-btn { min-height: 0; flex: 0 0 min(78vw, 280px); scroll-snap-align: start; }
  .action-bar { align-items: stretch; }
  .action-bar > div:last-child { width: 100%; flex-direction: column; align-items: stretch !important; }
  #sortSel, .btn-export { width: 100%; }
  .view-tabs { overflow-x: auto; }
  .tab-btn { white-space: nowrap; min-height: 44px; }
  .card-head, .card-foot { flex-direction: column; align-items: stretch; }
  .card-status-area { width: 100%; flex-direction: column; align-items: stretch; }
  .card-status-badges { justify-content: flex-start; }
  .btn-fav, .btn-link { width: 100%; }
  .checklist-window { padding: 18px; }
}

@media (min-width: 701px) and (max-width: 1100px) {
  .stage-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stage-btn { padding: 12px; }
  .stage-btn-desc { line-height: 1.45; }
}
/* 獨立資源區，不影響既有卡片與列印清單。 */
.resource-hub { margin-top: 28px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.resource-hub summary { padding: 18px; min-height: 48px; cursor: pointer; font-weight: 700; color: var(--primary); }
.resource-hub summary span { display: inline-block; font-weight: 400; font-size: .875rem; color: var(--text-sub); }
.resource-hub summary:focus-visible, .resource-card a:focus-visible, .resource-entry:focus-visible { outline: 3px solid #a36b16; outline-offset: 3px; }
.resource-entry { text-decoration: none; display: inline-flex; align-items: center; }
.resource-body { padding: 0 18px 18px; line-height: 1.75; }
.resource-body > p { margin-bottom: 12px; }
.resource-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.resource-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 18px 0; }
.resource-controls label { flex: 1 1 220px; min-width: 0; }
.resource-controls input, .resource-controls select { display: block; width: 100%; min-height: 44px; padding: 10px; border: 1px solid var(--border-subtle); border-radius: 8px; font-size: 1rem; }
.resource-card[hidden], #resourceEmpty[hidden] { display: none; }
#resourceEmpty { padding: 18px; background: #fff4d9; border-radius: 10px; }
.resource-card { padding: 18px; border: 1px solid var(--border); border-radius: 10px; overflow-wrap: anywhere; background: #fbfaf7; }
.resource-card h3 { font-size: 1.05rem; margin: 6px 0; }
.resource-card a { color: var(--primary); text-underline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after, *::details-content { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .checklist-window { transform: none !important; }
  .skeleton-card::after { animation: none !important; background: rgba(220,232,236,.28); transform: none; }
}
.resource-card p { margin: 6px 0; font-size: 1rem; }
.resource-category, .resource-card small, #resourceStatus { color: var(--text-sub); font-size: .82rem; }
.resource-note { color: #775118; }
@media (max-width: 700px) { .resource-grid { grid-template-columns: 1fr; } }

/* 介面升級：以「先理解、再篩選、最後行動」重新整理視覺層級。 */
:root {
  --ink: #20313d;
  --ink-soft: #526875;
  --brand-deep: #174766;
  --brand: #245b8f;
  --brand-soft: #eaf3f8;
  --warm: #c4872f;
  --warm-soft: #fff6e2;
  --line: #d7e0e4;
  --surface-raised: #ffffff;
  --focus-ring: 0 0 0 4px rgba(196, 135, 47, .24);
}

body { color: var(--ink); }
.container { width: min(100%, 1380px); }
.header {
  position: relative;
  padding: clamp(18px, 3vw, 30px);
  border: 1px solid rgba(215, 224, 228, .92);
  border-radius: 20px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 10px 30px rgba(35, 55, 66, .07);
  overflow: hidden;
}
.header::after {
  content: "";
  position: absolute;
  width: 220px; height: 220px;
  right: -86px; top: -116px;
  border-radius: 50%;
  background: rgba(226, 188, 117, .18);
  pointer-events: none;
}
.header-title, .header-subtitle, .pwa-tools, .update-status, .data-scope-note, .header-badge { position: relative; z-index: 1; }
.header-title { color: var(--brand-deep); font-weight: 850; }
.header-subtitle { font-size: clamp(.95rem, 1.6vw, 1.08rem); color: var(--ink-soft); }
.header-badge { letter-spacing: .04em; }
.pwa-tools { gap: 10px; }
.pwa-tools > label { min-height: 44px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.pwa-btn, .update-frequency { min-height: 44px; }
.pwa-btn { border-radius: 10px; transition: background .18s ease, border-color .18s ease, transform .18s ease; }
.pwa-btn:hover { transform: translateY(-1px); }
.update-status { margin-bottom: 0; }

.wizard-card {
  position: relative;
  border-radius: 20px;
  margin-bottom: 20px;
  background: linear-gradient(135deg, #174766 0%, #286b91 66%, #3e839d 100%);
  box-shadow: 0 14px 30px rgba(23, 71, 102, .18);
  overflow: hidden;
}
.wizard-card::before {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  right: -110px; bottom: -160px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 50%;
  box-shadow: 0 0 0 24px rgba(255,255,255,.04), 0 0 0 48px rgba(255,255,255,.025);
  pointer-events: none;
}
.wizard-top, .wizard-grid { position: relative; z-index: 1; }
.wizard-title { font-size: clamp(1.05rem, 2vw, 1.25rem); letter-spacing: .01em; }
.wizard-grid { background: rgba(9, 42, 62, .24); border: 1px solid rgba(255,255,255,.14); border-radius: 12px; }
.wizard-field label { font-weight: 700; letter-spacing: .02em; }
.wizard-select { min-height: 48px; padding-inline: 12px; border: 2px solid transparent; }
.wizard-select:focus { box-shadow: var(--focus-ring); border-color: #f2cf8a; }

.stage-tabs { gap: 14px; margin-bottom: 22px; }
.stage-btn { min-height: 92px; border-width: 1px; padding: 17px; background: rgba(255,255,255,.8); transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease; }
.stage-btn.active { border: 2px solid var(--brand); box-shadow: 0 8px 20px rgba(36, 91, 143, .12); }
.stage-btn-title { color: var(--brand-deep); font-size: 1rem; }
.stage-btn-desc { display: block; margin-top: 5px; line-height: 1.55; }

.layout { gap: 22px; }
.sidebar, .content, .resource-hub { border-color: var(--line); }
.sidebar { background: rgba(255,255,255,.88); border-radius: 16px; }
.sidebar-header { min-height: 42px; }
.sidebar-header strong { color: var(--brand-deep); letter-spacing: .03em; }
.btn-text { min-height: 40px; padding: 7px 9px; border-radius: 8px; }
.btn-text:hover { background: var(--brand-soft); }
.filter-title { color: var(--brand); letter-spacing: .06em; }
.custom-check { min-height: 40px; margin: 0 -6px 2px; padding: 6px; border-radius: 8px; line-height: 1.45; }
.custom-check:hover { background: #f4f8fa; }
.custom-check input { width: 19px; height: 19px; }

.content { min-width: 0; }
.view-tabs { align-items: end; gap: 4px; }
.tab-btn { min-height: 46px; padding: 10px 14px; border-radius: 10px 10px 0 0; }
.tab-btn:hover { color: var(--brand); background: var(--brand-soft); }
.tab-btn.active { border-bottom-width: 3px; }
.badge { color: var(--brand-deep); background: #eef4f7; border: 1px solid #d4e1e6; }
.action-bar { padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.68); }
#resultCount { color: var(--brand-deep); }
#sortSel { min-height: 44px; background: #fff; }
.btn-export { min-height: 44px; padding-inline: 15px; border-radius: 10px; background: #8b641f; }

.card-list { gap: 16px; }
.card-list.results-entering { animation: resultsEnter .18s cubic-bezier(.2,.75,.3,1); }
@keyframes resultsEnter { from { opacity: .72; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.results-loading { display: grid; gap: 16px; }
.skeleton-card { position: relative; min-height: 250px; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: #fff; padding: clamp(17px, 2.4vw, 23px); }
.skeleton-card::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(220,232,236,.62), transparent); animation: skeletonShimmer 1.15s ease-in-out infinite; }
.skeleton-line { height: 15px; margin-bottom: 12px; border-radius: 999px; background: #e6edef; }
.skeleton-line.title { width: 68%; height: 22px; }
.skeleton-line.short { width: 38%; }
.skeleton-box { height: 120px; margin: 22px 0 16px; border-radius: 12px; background: #f0f4f5; }
@keyframes skeletonShimmer { to { transform: translateX(100%); } }
.card { contain: layout paint; content-visibility: auto; contain-intrinsic-size: auto 430px; border-radius: 16px; background: var(--surface-raised); padding: clamp(17px, 2.4vw, 23px); box-shadow: 0 4px 14px rgba(35,55,66,.055); transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease; }
.card:hover { border-color: #aac4d0; box-shadow: 0 10px 24px rgba(35,55,66,.09); transform: translateY(-1px); }
.card-title { color: var(--brand-deep); }
.card-sub { line-height: 1.6; }
.card-box { border-left: 3px solid #c6dbe5; background: #f8fbfc; }
.card-tags { gap: 7px; }
.tag { padding: 4px 9px; border-radius: 999px; }
.tag-stage { background: var(--brand-soft); color: var(--brand-deep); }
.tag-src { background: #f2f1ed; color: #625b4d; }
.card-foot { align-items: center; }
.btn-fav, .btn-link { min-height: 44px; border-radius: 10px; }
.btn-link { background: var(--brand); }
.btn-link:hover { background: var(--primary-hover); }

.resource-hub { border-radius: 16px; overflow: hidden; box-shadow: 0 4px 14px rgba(35,55,66,.045); }
.resource-hub summary { min-height: 58px; padding: 18px 20px; background: rgba(255,255,255,.72); }
.resource-hub summary::marker { color: var(--warm); }
.resource-hub summary span { margin-left: 6px; }
.resource-body { padding: 0 clamp(16px, 2.5vw, 24px) 24px; }
.resource-controls { align-items: stretch; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #fafcfc; }
.resource-controls label { flex: 1 1 190px; font-size: .85rem; font-weight: 700; color: var(--brand-deep); }
.resource-controls input, .resource-controls select { margin-top: 6px; min-height: 46px; border-radius: 10px; background: #fff; }
.resource-controls .pwa-btn { align-self: end; }
.resource-card { border-radius: 14px; background: #fff; box-shadow: 0 3px 10px rgba(35,55,66,.045); transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.resource-card:hover { transform: translateY(-1px); border-color: #aac4d0; box-shadow: 0 8px 18px rgba(35,55,66,.08); }
.resource-card h3 { color: var(--brand-deep); line-height: 1.45; }

:focus-visible { outline: 3px solid rgba(196,135,47,.72); outline-offset: 3px; box-shadow: var(--focus-ring); }
.wizard-search-btn, .btn-export, .btn-fav, .btn-link, .btn-text, .tab-btn, .pwa-btn, summary, select {
  transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease, transform .12s ease;
}
.wizard-search-btn:active, .btn-export:active, .btn-fav:active, .btn-link:active, .btn-text:active, .tab-btn:active, .pwa-btn:active { transform: scale(.98); }
@supports (interpolate-size: allow-keywords) {
  html { interpolate-size: allow-keywords; }
  .data-tools::details-content, .support-guide-details::details-content, .resource-hub::details-content {
    block-size: 0; opacity: 0; overflow: hidden;
    transition: block-size .24s ease, opacity .18s ease, content-visibility .24s allow-discrete;
  }
  .data-tools[open]::details-content, .support-guide-details[open]::details-content, .resource-hub[open]::details-content { block-size: auto; opacity: 1; }
}
@media (min-width: 960px) {
  .layout { align-items: flex-start; }
  .sidebar { width: 300px; top: 16px; }
  .content { padding-top: 1px; }
}
@media (min-width: 701px) and (max-width: 1100px) {
  .wizard-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  body { padding-top: 10px; padding-bottom: 36px; }
  .header { padding: 17px 15px; border-radius: 16px; }
  .header-title { font-size: 1.48rem; }
  .pwa-tools { align-items: stretch; }
  .pwa-tools > * { flex: 1 1 100%; }
  .pwa-tools > label { justify-content: space-between; }
  .pwa-tools .update-frequency { width: auto; flex: 0 1 auto; }
  .wizard-card { border-radius: 16px; padding: 16px; }
  .wizard-top { align-items: flex-start; }
  .wizard-title { max-width: 75%; }
  .wizard-grid { padding: 12px; gap: 10px; }
  .stage-tabs { gap: 9px; }
  .stage-btn { min-height: 82px; flex-basis: min(82vw, 300px); padding: 14px; }
  .action-bar { padding: 10px; }
  .card { border-radius: 14px; }
  .card-status-area { gap: 8px; }
  .resource-hub summary { padding: 16px; }
  .resource-controls { padding: 11px; }
  .resource-controls label, .resource-controls .pwa-btn { flex-basis: 100%; width: 100%; }
  .resource-controls .pwa-btn { margin-top: 2px; }
}

/* 取自「網站排版美化套件」的產品化主題：編輯風 × 苔綠 × 暖紙白。 */
:root {
  --primary: #16332d;
  --primary-hover: #24463f;
  --primary-light: #edf0df;
  --background: #f4f1e9;
  --surface: #ffffff;
  --border: rgba(22, 51, 45, .16);
  --border-subtle: rgba(22, 51, 45, .24);
  --text-main: #16332d;
  --text-muted: #60716b;
  --text-sub: #50645d;
  --radius: 20px;
  --shadow-sm: 0 4px 14px rgba(22, 51, 45, .07);
  --shadow-md: 0 18px 44px rgba(22, 51, 45, .13);
}
body {
  background:
    radial-gradient(circle at 92% 2%, rgba(216,255,95,.16), transparent 19rem),
    var(--background);
}
.header { border-color: rgba(22,51,45,.15); background: rgba(251,250,246,.9); box-shadow: 0 14px 34px rgba(22,51,45,.08); }
.header::after { background: rgba(216,255,95,.2); }
.header-badge { background: #edf0df; color: #16332d; border-color: rgba(22,51,45,.16); }
.header-title { color: #16332d; letter-spacing: -.055em; }
.header-subtitle, .update-status { color: #60716b; }
.pwa-tools > label, .pwa-btn, .update-frequency { border-color: rgba(22,51,45,.18); color: #16332d; }
.pwa-btn:hover { background: #edf0df; border-color: rgba(22,51,45,.3); }
.connection-status { background: #edf0df; color: #32634e; }
.connection-status.offline { background: #fff0e8; color: #a33c2e; }
.data-scope-note { background: #fff8e7; border-color: #edcf8c; color: #6b4c19; }
.support-guide { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0 22px; }
.guide-card { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.82); box-shadow: 0 4px 14px rgba(35,55,66,.04); }
.guide-card strong { display: block; margin-bottom: 6px; color: var(--brand-deep); font-size: .96rem; }
.guide-card p { margin: 0; color: var(--text-sub); font-size: .86rem; line-height: 1.65; }
.guide-icon { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-bottom: 8px; border-radius: 9px; background: #edf0df; color: var(--brand-deep); }
@media (max-width: 900px) { .support-guide { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) { .support-guide { grid-template-columns: 1fr; gap: 10px; } .guide-card { padding: 14px; } }

.wizard-card { background: linear-gradient(135deg, #16332d 0%, #24463f 70%, #356358 100%); box-shadow: 0 18px 44px rgba(22,51,45,.22); }
.wizard-card::before { border-color: rgba(216,255,95,.3); box-shadow: 0 0 0 24px rgba(216,255,95,.06), 0 0 0 48px rgba(216,255,95,.03); }
.wizard-grid { background: rgba(216,255,95,.09); border-color: rgba(216,255,95,.18); }
.wizard-select:focus { border-color: #d8ff5f; box-shadow: 0 0 0 4px rgba(216,255,95,.22); }
.wizard-card .btn-text { color: #d8ff5f !important; }

.stage-btn.active { border-color: #16332d; background: #edf0df; box-shadow: 0 10px 24px rgba(22,51,45,.13); }
.stage-btn:hover, .stage-btn:focus-visible { border-color: #759b25; }
.stage-btn-title, .card-title, .resource-card h3, .sidebar-header strong { color: #16332d; }
.filter-title { color: #32634e; }
.btn-text, .tab-btn.active, .resource-hub summary, .resource-card a { color: #16332d; }
.btn-text:hover, .tab-btn:hover { background: #edf0df; }
.badge { background: #edf0df; color: #16332d; border-color: rgba(22,51,45,.16); }
.action-bar { border-color: rgba(22,51,45,.14); background: rgba(255,255,255,.68); }
.btn-export { background: #d4573f; }
.btn-export:hover { background: #b64532; }
.card-box { border-left-color: #759b25; background: #f7f8ef; }
.tag-stage { background: #edf0df; color: #245341; }
.tag-src { background: #f1ece3; color: #625444; }
.pill-urgent { background: #fff0e8; color: #a33c2e; border-color: #f3b8a8; }
.pill-normal { background: #fff8e7; color: #8a5f1b; border-color: #edcf8c; }
.btn-fav.active { background: #fff8e7; border-color: #edcf8c; color: #8a5f1b; }
.btn-link { background: #16332d; }
.btn-link:hover { background: #24463f; }
.resource-hub summary { background: rgba(255,255,255,.74); }
.resource-controls { border-color: rgba(22,51,45,.13); background: #f9f7f0; }
.resource-controls label { color: #245341; }
#resourceEmpty { background: #fff8e7; }
.resource-note { color: #775118; }
:focus-visible { outline-color: #d4573f; box-shadow: 0 0 0 4px rgba(212,87,63,.2); }
::selection { background: #d8ff5f; color: #16332d; }
@media (max-width: 700px) {
  .header-title { letter-spacing: -.045em; }
  .wizard-card { box-shadow: 0 12px 28px rgba(22,51,45,.2); }
}
.site-credit { max-width: 1280px; margin: 18px auto 0; padding: 0 4px; color: var(--text-muted); font-size: .78rem; text-align: right; }
@media (max-width: 520px) { .site-credit { padding-inline: 2px; text-align: center; } }
/* 首頁框架收尾：統一內容寬度、閱讀間距與錯誤狀態，不改變資料或互動流程。 */
.container { width: min(100%, 1380px); }
.layout { gap: clamp(18px, 2.2vw, 30px); }
.content { min-width: 0; }
.wizard-field label, .resource-controls label { line-height: 1.4; }
#cardList > [role="alert"] { border-color: #e2a49a; background: #fff8f6; color: #7d2e24; }
button, select, input, a { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline-width: 3px; outline-offset: 3px; }
@media (max-width: 700px) {
  .layout { gap: 16px; }
  .filter-summary { line-height: 1.55; }
  .site-credit { margin-top: 16px; }
}

/* 易讀模式：先完成查找，再展開次要工具與說明。 */
.skip-link { position: fixed; left: 12px; top: 10px; z-index: 2000; padding: 10px 14px; border-radius: 10px; background: #16332d; color: #fff; font-weight: 800; transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }
.header { padding-block: clamp(18px, 2.4vw, 26px); }
.header-badge { font-size: .9rem; }
.header-subtitle { font-size: 1.05rem; }
.header-primary-actions { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 14px; }
.start-search-link, .text-size-toggle { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 16px; border-radius: 12px; font-size: 1rem; font-weight: 800; }
.start-search-link { background: #16332d; color: #fff; text-decoration: none; }
.text-size-toggle { border: 2px solid #16332d; background: #fff; color: #16332d; cursor: pointer; }
.data-tools { position: relative; z-index: 2; margin-top: 12px; border: 1px solid rgba(22,51,45,.18); border-radius: 12px; background: rgba(255,255,255,.66); }
.data-tools > summary { min-height: 48px; display: flex; align-items: center; padding: 10px 14px; color: #245341; font-weight: 800; cursor: pointer; }
.data-tools > summary::before { content: '＋'; margin-right: 8px; font-size: 1.2rem; }
.data-tools[open] > summary::before { content: '－'; }
.data-tools-body { padding: 0 14px 14px; }
.data-tools .pwa-tools { margin-top: 0; }
.data-tools .update-status { min-height: 0; }
#dataScopeNotice { min-height: 0; font-size: .95rem; }

.support-guide-details { margin: 0 0 20px; border: 1px solid rgba(22,51,45,.16); border-radius: 14px; background: rgba(255,255,255,.72); overflow: hidden; }
.support-guide-details > summary { min-height: 52px; display: flex; align-items: center; padding: 12px 16px; color: #16332d; font-size: 1rem; font-weight: 800; cursor: pointer; }
.support-guide-details .support-guide { margin: 0; padding: 0 14px 14px; }

.wizard-card { scroll-margin-top: 12px; }
.wizard-title-wrap { display: flex; flex-direction: column; gap: 4px; }
.wizard-title { font-size: 1.3rem; }
.wizard-intro { color: rgba(255,255,255,.9); font-size: .95rem; line-height: 1.55; }
.wizard-field > label { min-height: 32px; display: flex; align-items: center; gap: 7px; margin-bottom: 7px; font-size: 1rem; opacity: 1; }
.step-number { flex: 0 0 auto; display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #d8ff5f; color: #16332d; font-size: .85rem; font-weight: 900; }
.wizard-search-btn { min-height: 48px; border: 2px solid #d8ff5f; background: #d8ff5f; color: #16332d; font-size: 1rem; box-shadow: 0 5px 14px rgba(0,0,0,.15); }
.wizard-search-btn:hover { background: #e4ff8a; }
.wizard-multi-hint { font-size: .9rem; line-height: 1.55; }
.wizard-bottom-actions { display: none; position: relative; z-index: 3; gap: 8px; }
.wizard-bottom-actions .wizard-search-btn { width: 100%; }

#resultCount { font-size: 1.08rem; }
.card { border-width: 1.5px; }
.card-sub { margin-top: 4px; font-size: .95rem; }
.card-detail-row { padding: 8px 0; border-bottom: 1px solid rgba(22,51,45,.1); }
.card-detail-row:last-child { border-bottom: 0; }
.detail-label { display: inline-block; min-width: 5.4em; color: #34584d; font-weight: 800; }
.card-amount { color: #146c43; font-size: 1.08rem; }
.tag { font-size: .875rem; }
.card-foot > span { font-size: .92rem !important; }
.btn-link, .btn-fav, .btn-export { min-height: 48px; font-size: .95rem; }

html.large-text { font-size: 112.5%; }
html.large-text .container { max-width: 1240px; }
html.large-text .wizard-choice, html.large-text .custom-check { min-height: 50px; }

@media (max-width: 700px) {
  .header { margin-bottom: 14px; }
  .header-title { font-size: 1.55rem; line-height: 1.35; }
  .header-subtitle { font-size: 1rem; line-height: 1.65; }
  .header-primary-actions > * { flex: 1 1 calc(50% - 5px); }
  .connection-status { flex-basis: 100%; justify-content: center; min-height: 40px; font-size: .9rem; }
  .data-scope-note { margin-top: 10px; }
  .wizard-top { flex-direction: column; }
  .wizard-title { max-width: none; }
  .wizard-actions { width: 100%; justify-content: space-between; }
  .wizard-actions .wizard-search-btn { flex: 1; }
  .wizard-choice-list { max-height: 230px; }
  .wizard-bottom-actions { position: sticky; bottom: 8px; display: flex; margin-top: 2px; padding: 8px; border-radius: 13px; background: rgba(8,35,31,.94); box-shadow: 0 8px 24px rgba(0,0,0,.24); }
  .support-guide-details .support-guide { grid-template-columns: 1fr; }
  .stage-tabs { display: grid; grid-template-columns: 1fr; overflow: visible; }
  .stage-btn { min-height: 72px; width: 100%; flex-basis: auto; }
  .card-title { font-size: 1.12rem; }
  .card-box { padding: 10px 12px; }
  .detail-label { display: block; min-width: 0; margin-bottom: 3px; }
  html.large-text { font-size: 106.25%; }
}

/* ===== 2026-09-24 稽核修正 ===== */
/* 快速篩選複選清單：.wizard-field label 的 display:block 權重較高，導致勾選框與文字錯位 */
.wizard-field .wizard-choice { display: flex; margin-bottom: 0; opacity: 1; font-size: 1rem; }
/* 對比度（WCAG AA 4.5:1） */
.stage-btn-desc { color: #4d5d57; }
.btn-export { background: #b8432d; }
.btn-export:hover { background: #9e3825; }
/* 行事曆提醒按鈕與空收藏提示 */
.checklist-empty { padding: 18px; border: 1px dashed #cbd5e1; border-radius: 10px; background: #f8fafc; color: #334155; line-height: 1.7; }


/* ===== 由 inline style 移出（CSP style-src 不再允許 unsafe-inline） ===== */
.noscript-note { margin:16px }
.wizard-clear-btn { color: #fff; opacity: 0.8; }
.text-095 { font-size: 0.95rem; }
.kw-input { width:100%; padding:8px; border:1px solid var(--border-subtle); border-radius:6px; font-size:0.88rem; }
#resultCount.results-count-text { font-weight: 700; font-size: 0.95rem; }
.row-center-gap { display:flex; gap:10px; align-items:center; }
.sort-select { padding:6px 10px; border-radius:6px; border:1px solid var(--border-subtle); font-size:0.85rem; }
.checklist-title { font-size: 1.3rem; margin-bottom: 8px; }
.checklist-intro { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 16px; }
.checklist-progress { margin:0 0 12px; color:var(--brand-deep); font-weight:700; }
.checklist-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 10px; }
.tag-channel { background:#fef3c7; color:#92400e; }
.tag-grade { background:#fff; border:1px solid #e2e8f0; color:#475569; }
.card-deadline-note { font-size:0.82rem; color:var(--text-muted); }
.empty-state { text-align:center; padding:50px; background:#fff; border-radius:12px; border:1px dashed #cbd5e1; color:#64748b; }
.empty-state-icon { font-size:2rem; margin-bottom:8px; }
.empty-state-hint { font-size:0.85rem; margin-top:4px; }
.mt-12 { margin-top:12px; }
.check-item-box { width:18px; height:18px; accent-color:var(--primary); }
.check-item-label { flex:1; cursor:pointer; }
.check-item-name { font-size:0.95rem; color:#0f172a; }
.check-item-projects { font-size:0.8rem; color:#64748b; margin-top:2px; }
.frame-warning { position: sticky; top: 0; z-index: 1000; padding: 10px 16px; background: #fff4d6; color: #5c3b00; border-bottom: 2px solid #d4a017; font-weight: 700; }
.frame-warning a { color: #7a2e0e; }
.diagnostics-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line, #d7ddd3); }
.diagnostics-note { flex: 1 1 100%; margin: 0; font-size: .9rem; color: #4d5d57; }
