/* ========================================================================
   偉騰環保查詢系統 — 設計系統 v3「紙本與墨 Paper & Ink」（2026-10）
   定位：專業顧問公司的文書質感，不是一般 SaaS 儀表板。
     - 紙：溫暖米白底、白色卡紙、髮絲線分隔；幾乎不用陰影，層次靠線與留白。
     - 墨：深墨綠（取自偉騰商標的青綠）當主色與按鈕；標題用明體（Noto Serif TC）；數字用 IBM Plex Sans 等寬數字。
     - 黃銅：只拿來劃重點（章節標記、重點底線、首頁抬頭的一條線），不當底色。
     - 狀態色一律降飽和、用描邊＋小圓點表示，不做滿版彩色泡泡。
   規則：寫新樣式一律用 token，不要寫死色碼；深色模式才會自動跟上。
   ======================================================================== */
:root {
  --font: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei UI', 'Microsoft JhengHei', system-ui, -apple-system, sans-serif;
  --font-display: 'Noto Serif TC', 'Songti TC', 'PMingLiU', 'Microsoft JhengHei UI', Georgia, serif;
  --font-num: 'IBM Plex Sans', 'Noto Sans TC', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-mono: var(--mono);

  --bg: #f4f1ea;
  --surface: #fffdf9;
  --surface-2: #f8f5ee;
  --surface-3: #ece7dc;
  --input-bg: #ffffff;
  --border: #e4ded1;
  --border-2: #d2cab9;
  --border-strong: #b3a992;
  --text: #1c201f;
  --text-2: #4b5351;
  --text-3: #767e7a;

  --ink-900: #0f1c1b; --ink-800: #15302d; --ink-700: #1c3f3b; --ink-600: #24504b;
  --on-ink: #f6f2e9; --on-ink-2: #c9d3cd; --on-ink-3: #93a39c;
  --ink-grad: var(--ink-800);

  /* 主色：偉騰商標的青綠壓深成墨綠；白底上當文字 6.0:1 */
  --primary: #0f6a64;
  --primary-hover: #0c5a55;
  --primary-strong: #0a4b47;
  --primary-deep: #0a4b47;
  --primary-bright: #4fb3ab;
  --on-primary: #f6f2e9;
  --primary-soft: #e3efec;
  --primary-tint: rgba(15, 106, 100, 0.14);
  --ring: rgba(15, 106, 100, 0.22);
  --primary-grad: var(--ink-800);
  --primary-glow: none;

  --brass: #a8853a; --brass-line: #c9ab6b; --brass-soft: #f6efdf; --brass-deep: #7d5f22;
  --hl: linear-gradient(transparent 60%, rgba(201, 171, 107, 0.45) 60%);
  --link: #0f6a64;

  --red: #a33a32; --red-soft: #f7e9e6; --red-solid: #9a352e; --red-deep: #8a2f28;
  --orange: #a8571b; --orange-soft: #f8ece1; --orange-solid: #9a4f17; --orange-deep: #8a4614;
  --amber: #8f6a1c; --amber-soft: #f7efdc; --amber-solid: #815f18; --amber-deep: #725415;
  --green: #2f6f4a; --green-soft: #e6f0e9; --green-solid: #2a6342; --green-deep: #245639;
  --blue: #2f5f9e; --blue-soft: #e7edf6; --blue-solid: #2a558d; --blue-deep: #244b7d;
  --purple: #6a4fa0; --purple-soft: #eeeaf6; --purple-solid: #5e4690; --purple-deep: #523d7f;
  --gray: #6d7572; --gray-soft: #ebe8e1; --gray-solid: #5f6764; --gray-deep: #4b5351;
  --teal: #0f6a64; --teal-soft: #e3efec; --teal-solid: #0c5a55; --teal-deep: #0a4b47;
  --brown: #80582e; --brown-soft: #f4ece2; --brown-deep: #6b4824;
  --on-tone: #ffffff;

  /* 五類環保類別色（chip 的點、磚的頂線、時間軸的節點） */
  --cat-air: var(--blue); --cat-air-soft: var(--blue-soft); --cat-air-deep: var(--blue-deep);
  --cat-water: var(--teal); --cat-water-soft: var(--teal-soft); --cat-water-deep: var(--teal-deep);
  --cat-waste: var(--brown); --cat-waste-soft: var(--brown-soft); --cat-waste-deep: var(--brown-deep);
  --cat-toxic: var(--purple); --cat-toxic-soft: var(--purple-soft); --cat-toxic-deep: var(--purple-deep);
  --cat-soil: var(--amber); --cat-soil-soft: var(--amber-soft); --cat-soil-deep: var(--amber-deep);
  --cat-eia: var(--green); --cat-eia-soft: var(--green-soft); --cat-eia-deep: var(--green-deep);
  --cat-penalty: var(--red); --cat-penalty-soft: var(--red-soft); --cat-penalty-deep: var(--red-deep);
  --cat-entity: var(--gray); --cat-entity-soft: var(--gray-soft); --cat-entity-deep: var(--gray-deep);

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;
  --radius-xs: 3px; --radius-sm: 5px; --radius: 8px; --radius-lg: 10px; --radius-xl: 12px; --radius-pill: 999px;
  --fs-display: 30px; --fs-title: 24px; --fs-h2: 17px; --fs-body: 15px; --fs-aux: 13.5px; --fs-min: 12.5px;

  --shadow-xs: none;
  --shadow-sm: 0 1px 2px rgba(28, 32, 31, 0.04);
  --shadow-card: none;
  --shadow: 0 2px 4px rgba(28, 32, 31, 0.06), 0 14px 32px -16px rgba(28, 32, 31, 0.22);
  --shadow-lg: 0 24px 60px -24px rgba(28, 32, 31, 0.4), 0 2px 8px rgba(28, 32, 31, 0.08);

  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: 160ms; --dur-slow: 260ms;
  --rail-w: 92px; --tabbar-h: 62px; --topbar-h: 56px;
  color-scheme: light;
}
[data-theme='dark'] {
  --bg: #101716; --surface: #161f1e; --surface-2: #1b2524; --surface-3: #233030; --input-bg: #121a19;
  --border: #2a3634; --border-2: #364541; --border-strong: #4a5c57;
  --text: #ebe6da; --text-2: #b9c1bc; --text-3: #8b948f;
  --ink-900: #0a1211; --ink-800: #0f1c1b; --ink-700: #15302d; --ink-600: #1c3f3b;
  --on-ink: #f6f2e9; --on-ink-2: #c9d3cd; --on-ink-3: #93a39c;
  --primary: #4fb3ab; --primary-hover: #6cc3bb; --primary-strong: #2f9a92; --primary-deep: #6cc3bb; --primary-bright: #8ad3cc; --on-primary: #0a1211;
  --primary-soft: rgba(79, 179, 171, 0.14); --primary-tint: rgba(79, 179, 171, 0.22); --ring: rgba(79, 179, 171, 0.35);
  --primary-grad: #2f9a92;
  --brass: #d1b06f; --brass-line: #b89750; --brass-soft: rgba(209, 176, 111, 0.14); --brass-deep: #d1b06f;
  --hl: linear-gradient(transparent 60%, rgba(209, 176, 111, 0.3) 60%);
  --link: #6cc3bb;
  --red: #e07c73; --red-soft: rgba(224, 124, 115, 0.14); --red-solid: #e07c73; --red-deep: #ec9b94;
  --orange: #e39a5f; --orange-soft: rgba(227, 154, 95, 0.14); --orange-solid: #e39a5f; --orange-deep: #ecb17f;
  --amber: #d9b45f; --amber-soft: rgba(217, 180, 95, 0.14); --amber-solid: #d9b45f; --amber-deep: #e5c781;
  --green: #7fbf96; --green-soft: rgba(127, 191, 150, 0.14); --green-solid: #7fbf96; --green-deep: #9bd0ad;
  --blue: #8fb0e3; --blue-soft: rgba(143, 176, 227, 0.14); --blue-solid: #8fb0e3; --blue-deep: #a9c3ec;
  --purple: #b7a3e3; --purple-soft: rgba(183, 163, 227, 0.14); --purple-solid: #b7a3e3; --purple-deep: #c9bbec;
  --gray: #9aa39f; --gray-soft: rgba(154, 163, 159, 0.14); --gray-solid: #9aa39f; --gray-deep: #b3bbb7;
  --teal: #4fb3ab; --teal-soft: rgba(79, 179, 171, 0.14); --teal-solid: #4fb3ab; --teal-deep: #6cc3bb;
  --brown: #cfa377; --brown-soft: rgba(207, 163, 119, 0.14); --brown-deep: #dcb893;
  --on-tone: #0a1211;
  --shadow-sm: 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow: 0 0 0 1px rgba(255, 255, 255, 0.03), 0 16px 40px -18px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 30px 80px -30px rgba(0, 0, 0, 0.9);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
body { margin: 0; min-height: 100%; font-family: var(--font); font-size: var(--fs-body); line-height: 1.7; letter-spacing: .01em; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; font-variant-numeric: tabular-nums; }
a { color: var(--link); text-decoration: none; } a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: 0; line-height: 1.35; text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: var(--fs-title); font-weight: 700; }
h2 { font-family: var(--font-display); font-size: var(--fs-h2); font-weight: 700; }
h3 { font-size: 15.5px; } h4 { font-size: 14px; }
.display { font-family: var(--font-display); font-size: var(--fs-display); font-weight: 700; line-height: 1.25; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .18em; color: var(--brass-deep); text-transform: uppercase; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }
code, .mono { font-family: var(--mono); font-size: 13px; letter-spacing: 0; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: var(--fs-aux); } .xs { font-size: var(--fs-min); } .bold { font-weight: 700; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 8px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1 1 auto; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 8px; }
/* 直排容器裡的標籤不要被拉成滿欄寬 */
.col > .chip, .col > .pill { align-self: flex-start; }
.gap-s { gap: 4px; } .gap-l { gap: 16px; }
.mt { margin-top: 16px; } .mt-l { margin-top: 24px; } .mb { margin-bottom: 16px; }
.hidden, [hidden] { display: none !important; }
.no-print { position: relative; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; }
.num { font-family: var(--font-num); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.lead { font-size: 15.5px; line-height: 1.8; color: var(--text-2); max-width: 72ch; }
.lead p + p { margin-top: 10px; }
.note { font-size: 13.5px; line-height: 1.7; color: var(--text-2); }
.note b, .lead b { color: var(--text); font-weight: 700; }
.hl, mark { font-weight: 700; color: inherit; background: var(--hl); padding: 0 2px; border-radius: 2px; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; vertical-align: -3px; }
.icon.sm { width: 15px; height: 15px; } .icon.lg { width: 22px; height: 22px; } .icon.xl { width: 28px; height: 28px; stroke-width: 1.6; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 3px; }
::selection { background: var(--primary-tint); }
::placeholder { color: var(--text-3); opacity: 1; }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- shell：左側紙色導覽列、頂欄髮絲線 ---------- */
#app { min-height: 100dvh; }
.shell { display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); min-height: 100dvh; }
.rail { position: sticky; top: 0; height: 100dvh; background: var(--surface); color: var(--text-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; align-items: center; padding: 16px 10px 12px; gap: 2px; z-index: 21; overflow: hidden auto; scrollbar-width: none; }
.rail > * { position: relative; }
.rail .brand { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 2px 0 16px; margin-bottom: 8px; border-bottom: 1px solid var(--border); color: var(--text); }
.rail .brand img { width: 40px; height: 40px; border-radius: 50%; transition: transform var(--dur-slow) var(--ease); }
.rail .brand:hover { text-decoration: none; } .rail .brand:hover img { transform: translateY(-1px) scale(1.03); }
.rail .brand-name { font-family: var(--font-display); font-size: 13px; font-weight: 700; letter-spacing: .22em; margin-right: -.22em; white-space: nowrap; line-height: 1; color: var(--text); }
.rail a.nav { width: 72px; height: 58px; border-radius: var(--radius-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--text-3); font-size: var(--fs-min); font-weight: 600; letter-spacing: .04em; position: relative; transition: color var(--dur), background var(--dur); }
.rail a.nav .icon { width: 21px; height: 21px; stroke-width: 1.7; padding: 0; box-sizing: content-box; border-radius: 0; transition: color var(--dur), transform var(--dur); }
.rail a.nav:hover { color: var(--text); text-decoration: none; background: var(--surface-2); }
.rail a.nav.active { color: var(--primary-deep); font-weight: 700; background: var(--primary-soft); }
.rail a.nav.active::before { content: ''; position: absolute; left: -10px; top: 12px; bottom: 12px; width: 3px; background: var(--primary); border-radius: 0 2px 2px 0; }
.rail a.nav.active .icon { stroke-width: 2; }
.rail .spacer { flex: 1; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--brass); color: #fff; font-family: var(--font-num); font-size: 11.5px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.badge.red { background: var(--red-solid); color: #fff; }
.rail .badge-dot { position: absolute; top: 6px; right: 12px; box-shadow: 0 0 0 2px var(--surface); }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--border); }
.topbar h1 { font-size: 17px; }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: var(--fs-aux); min-width: 0; }
.topbar .crumbs a { color: var(--text-2); font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.topbar .crumbs .sep { opacity: .5; flex: 0 0 auto; }
.topbar .crumbs b { font-family: var(--font-display); color: var(--text); font-weight: 700; font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 auto; min-width: 0; }
.topbar .quick { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.topbar .quick input { width: 320px; max-width: 40vw; height: 36px; border-radius: var(--radius-sm); padding-left: 36px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23767e7a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px 50% / 16px no-repeat; border-color: var(--border-2); box-shadow: none; }
.topbar .quick input:focus { box-shadow: 0 0 0 3px var(--ring); }
.content { padding: 28px 28px 40px; max-width: 1240px; width: 100%; margin: 0 auto; }
.content.narrow { max-width: 820px; }
.tabbar { display: none; }

/* ---------- 元件 ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card.pad { padding: 22px 24px; }
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 22px; border-bottom: 1px solid var(--border); }
.card-h h2 { flex: 1; min-width: 0; font-size: 16px; }
.card-h .count { color: var(--text-3); font-weight: 600; font-size: var(--fs-min); background: transparent; padding: 0; border-radius: 0; font-family: var(--font-num); letter-spacing: .04em; }
.card-b { padding: 18px 22px; }
.section { margin-top: 26px; }
.section-title { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; min-height: 28px; }
.section-title h2 { font-size: 16.5px; min-width: 0; display: flex; align-items: center; gap: 10px; }
.section-title h2::before { content: ''; width: 14px; height: 2px; background: var(--brass); flex: 0 0 auto; }
.section-title .count, .card-h .count { color: var(--text-3); font-size: var(--fs-min); font-weight: 600; background: transparent; padding: 0; border-radius: 0; font-family: var(--font-num); white-space: nowrap; flex: 0 0 auto; letter-spacing: .04em; }
.section-title .actions { margin-left: auto; display: flex; gap: 8px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-2); background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; white-space: nowrap; box-shadow: none; transition: background var(--dur), border-color var(--dur), transform var(--dur), color var(--dur); text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--ink-800); color: var(--on-ink); border-color: var(--ink-800); }
.btn.primary:hover { background: var(--ink-700); border-color: var(--ink-700); }
[data-theme='dark'] .btn.primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
[data-theme='dark'] .btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--text-2); } .btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.danger { color: var(--red-deep); border-color: color-mix(in srgb, var(--red) 40%, transparent); } .btn.danger:hover { background: var(--red-soft); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: var(--radius-xs); }
.btn.lg { height: 48px; padding: 0 22px; font-size: 16px; border-radius: var(--radius); }
.btn.icon-only { width: 36px; padding: 0; } .btn.sm.icon-only { width: 30px; }
input[type='text'], input[type='search'], input[type='password'], input[type='url'], input[type='number'], select, textarea { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--border-2); border-radius: var(--radius-sm); background: var(--input-bg); color: var(--text); transition: border-color var(--dur), box-shadow var(--dur); }
textarea { height: auto; padding: 10px 12px; min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--ring); }
label.field { display: flex; flex-direction: column; justify-content: flex-end; gap: 6px; font-size: var(--fs-aux); color: var(--text-2); font-weight: 600; letter-spacing: .02em; }
label.field > input, label.field > select, label.field > textarea { font-weight: 400; font-size: 15px; color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; align-items: end; }
/* 類別標籤：描邊＋彩色小點，不做滿版泡泡 */
.chip { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: transparent; border: 1px solid var(--border-2); color: var(--text-2); white-space: nowrap; line-height: 1; letter-spacing: .02em; }
.chip::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--gray); flex: 0 0 auto; }
.chip.lg { height: 28px; padding: 0 12px 0 10px; font-size: 13.5px; }
.chip.air { color: var(--cat-air-deep); border-color: color-mix(in srgb, var(--cat-air) 35%, transparent); } .chip.air::before { background: var(--cat-air); }
.chip.water { color: var(--cat-water-deep); border-color: color-mix(in srgb, var(--cat-water) 35%, transparent); } .chip.water::before { background: var(--cat-water); }
.chip.waste { color: var(--cat-waste-deep); border-color: color-mix(in srgb, var(--cat-waste) 35%, transparent); } .chip.waste::before { background: var(--cat-waste); }
.chip.toxic { color: var(--cat-toxic-deep); border-color: color-mix(in srgb, var(--cat-toxic) 35%, transparent); } .chip.toxic::before { background: var(--cat-toxic); }
.chip.soil { color: var(--cat-soil-deep); border-color: color-mix(in srgb, var(--cat-soil) 35%, transparent); } .chip.soil::before { background: var(--cat-soil); }
.chip.eia { color: var(--cat-eia-deep); border-color: color-mix(in srgb, var(--cat-eia) 35%, transparent); } .chip.eia::before { background: var(--cat-eia); }
.chip.penalty { color: var(--cat-penalty-deep); border-color: color-mix(in srgb, var(--cat-penalty) 35%, transparent); } .chip.penalty::before { background: var(--cat-penalty); }
.chip.entity { color: var(--cat-entity-deep); } .chip.entity::before { background: var(--cat-entity); }
.chip.off { border-style: dashed; color: var(--text-3); font-weight: 500; text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--text-3) 60%, transparent); } .chip.off::before { background: var(--border-strong); }
.chip.primary { color: var(--primary-deep); border-color: color-mix(in srgb, var(--primary) 40%, transparent); background: var(--primary-soft); } .chip.primary::before { background: var(--primary); }
.chip.brass { color: var(--brass-deep); border-color: color-mix(in srgb, var(--brass) 45%, transparent); background: var(--brass-soft); } .chip.brass::before { background: var(--brass); }
/* 狀態：描邊＋圓點，顏色降飽和 */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px 0 8px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: transparent; border: 1px solid color-mix(in srgb, currentColor 35%, transparent); letter-spacing: .02em; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.pill.valid, .pill.ok { color: var(--green-deep); }
.pill.expiring, .pill.stale { color: var(--amber-deep); }
.pill.expired, .pill.error { color: var(--red-deep); background: var(--red-soft); }
.pill.unknown, .pill.skipped { color: var(--gray-deep); }
.pill.pending { color: var(--blue-deep); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 14.5px; }
.kv dt { color: var(--text-3); font-weight: 600; white-space: nowrap; letter-spacing: .02em; }
.kv dd { margin: 0; color: var(--text); word-break: break-word; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.table-wrap.cards { position: relative; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .1em; color: var(--text-3); font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--border-strong); background: var(--surface); white-space: nowrap; position: sticky; top: 0; z-index: 1; }
table.tbl td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background var(--dur); }
table.tbl tbody tr:hover td { background: var(--surface-2); }
table.tbl td.num, table.tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
/* 日期、字號、類別、狀態不得斷行；「展開」不得直排 */
table.tbl td.nowrap, table.tbl td .num, table.tbl td .mono, table.tbl td .chip, table.tbl td .pill { white-space: nowrap; }
table.tbl .fold summary { white-space: nowrap; }
@media (min-width: 761px) {
  /* 桌機表格放得下就不要變成捲動容器（否則表頭 sticky 失效）；真的超寬的加 .scroll */
  .table-wrap:not(.scroll) { overflow: visible; }
  table.tbl th { top: calc(var(--topbar-h) + 52px); }
  .table-wrap:first-child table.tbl th { border-radius: 0; }
}
.section-title, .table-wrap, .analysis, .timeline { scroll-margin-top: calc(var(--topbar-h) + 64px); }
.fold.facts { border: 0; background: transparent; margin-top: 4px; }
.fold.facts summary { padding: 2px 0; font-size: 13px; font-weight: 600; color: var(--link); }
.fold.facts .fold-b { padding: 6px 0 0; }
.empty { padding: 34px 20px; text-align: center; color: var(--text-2); border: 1px dashed var(--border-2); border-radius: var(--radius); background: transparent; }
.empty .icon { width: 28px; height: 28px; color: var(--text-3); margin-bottom: 8px; stroke-width: 1.4; }
.empty b { font-family: var(--font-display); color: var(--text); font-size: 15.5px; }
.skel { position: relative; overflow: hidden; background: var(--surface-3); border-radius: 4px; min-height: 14px; }
.skel::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent); animation: shimmer 1.4s infinite; }
[data-theme='dark'] .skel::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-card { padding: 22px; display: grid; gap: 12px; }
.skel.h1 { height: 26px; width: 55%; } .skel.line { height: 14px; } .skel.line.w60 { width: 60%; } .skel.line.w40 { width: 40%; } .skel.block { height: 90px; }
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink-800); color: var(--on-ink); padding: 10px 16px; border-radius: var(--radius); box-shadow: var(--shadow); font-size: 14px; font-weight: 600; display: flex; gap: 10px; align-items: center; animation: toast-in var(--dur-slow) var(--ease); max-width: min(92vw, 560px); }
.toast.err { background: var(--red-solid); } .toast.ok { background: var(--green-solid); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid; font-size: 14.5px; line-height: 1.6; }
.alert .icon { margin-top: 3px; }
.alert.danger { background: var(--red-soft); color: var(--red-deep); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.alert.warn { background: var(--amber-soft); color: var(--amber-deep); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.alert.ok { background: var(--green-soft); color: var(--green-deep); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert.info { background: var(--primary-soft); color: var(--primary-deep); border-color: color-mix(in srgb, var(--primary) 30%, transparent); }
.alert b { font-weight: 700; }
/* 分頁：文件目錄式的底線分頁，黏在頂欄下；桌機放不下就換行，手機橫向捲動＋右側漸層提示 */
.tabs { display: flex; flex-wrap: wrap; gap: 2px 8px; margin: 18px 0 14px; position: sticky; top: var(--topbar-h); z-index: 5; padding: 0; background: var(--bg); border: 0; border-bottom: 1px solid var(--border-2); border-radius: 0; box-shadow: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 0 0 auto; height: 42px; padding: 0 10px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: transparent; color: var(--text-2); font-weight: 600; font-size: 14.5px; border-radius: 0; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; transition: color var(--dur), border-color var(--dur); }
.tabs button:hover { color: var(--text); background: transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--ink-800); font-weight: 700; background: transparent; }
[data-theme='dark'] .tabs button.active { border-bottom-color: var(--primary); }
.tabs button .n { font-size: 11.5px; background: transparent; color: var(--text-3); padding: 0; border-radius: 0; font-weight: 600; font-family: var(--font-num); }
.tabs button.active .n { background: transparent; color: var(--text-2); }
details.fold { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); }
details.fold summary { cursor: pointer; padding: 10px 14px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::before { content: '▸'; color: var(--text-3); transition: transform var(--dur); }
details.fold[open] summary::before { transform: rotate(90deg); }
details.fold .fold-b { padding: 0 14px 14px; }
.copy { font-family: var(--mono); font-size: 13px; background: var(--surface-3); padding: 8px 10px; border-radius: var(--radius-sm); word-break: break-all; display: flex; gap: 8px; align-items: center; }
.copy code { flex: 1; min-width: 0; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 18px; box-shadow: none; }
.stat .k { font-size: var(--fs-min); color: var(--text-3); font-weight: 600; letter-spacing: .06em; }
.stat .v { font-size: 28px; font-weight: 700; font-family: var(--font-display); line-height: 1.2; margin-top: 4px; letter-spacing: 0; }
.stat .s { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.stat.danger .v { color: var(--red-deep); } .stat.warn .v { color: var(--amber-deep); } .stat.ok .v { color: var(--green-deep); }

/* ---------- 首頁：信頭式抬頭，不是黑色大 banner ---------- */
.hero { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-top: 3px solid var(--ink-800); border-radius: var(--radius-lg); padding: 44px 44px 36px; position: relative; overflow: hidden; box-shadow: none; }
.hero::before { content: none; }
.hero::after { content: ''; position: absolute; left: 44px; width: 56px; top: 36px; height: 2px; background: var(--brass); }
.hero > * { position: relative; }
.hero .eyebrow { color: var(--brass-deep); margin-top: 10px; }
.hero h1 { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: 0; margin-top: 10px; line-height: 1.3; }
.hero .lead { color: var(--text-2); max-width: 64ch; margin-top: 10px; }
.searchbox { margin-top: 26px; display: flex; gap: 10px; align-items: stretch; background: var(--input-bg); border: 1.5px solid var(--ink-800); border-radius: var(--radius); padding: 6px; transition: border-color var(--dur), box-shadow var(--dur); }
.searchbox:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--ring); }
.searchbox input { flex: 1; height: 50px; border: 0; background: transparent; color: var(--text); font-size: 18px; padding: 0 12px; }
.searchbox input:focus { box-shadow: none; }
.searchbox input::placeholder { color: var(--text-3); }
.searchbox .btn { height: 50px; border-radius: var(--radius-sm); padding: 0 22px; font-size: 15px; }
.examples { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--text-3); font-size: 13.5px; }
.examples button { height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; transition: background var(--dur), border-color var(--dur), color var(--dur); }
.examples button:hover { background: var(--surface-2); border-color: var(--border-strong); color: var(--text); }
.examples button b { color: var(--brass-deep); font-weight: 700; margin-right: 4px; letter-spacing: .04em; }
[data-theme='dark'] .hero { border-top-color: var(--primary); } [data-theme='dark'] .searchbox { border-color: var(--border-strong); }
.home-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; margin-top: 20px; align-items: start; }
.home-grid .card { overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--border); color: inherit; transition: background var(--dur); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .t { font-weight: 600; } .list-item .s { color: var(--text-3); font-size: 13px; margin-top: 1px; }
.list-item .right { margin-left: auto; text-align: right; flex: 0 0 auto; }
.list-item.unseen { background: color-mix(in srgb, var(--primary-soft) 55%, transparent); }
.list-item.unseen .t::after { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--primary); margin-left: 6px; vertical-align: middle; }
.source-list .list-item { padding: 10px 22px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: 0 0 auto; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.dot.off { background: var(--text-3); box-shadow: none; } .dot.warn { background: var(--amber); box-shadow: 0 0 0 3px color-mix(in srgb, var(--amber) 18%, transparent); }
.dot.red { background: var(--red); box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 18%, transparent); }
.alerts { border-bottom: 1px solid var(--border); }
.alerts-h { display: flex; align-items: center; gap: 8px; padding: 10px 22px 6px; font-size: 14px; }
.alerts.card { border-bottom: 1px solid var(--border); overflow: hidden; }

/* ---------- 搜尋結果 ---------- */
.summary-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; }
.summary-bar .big { font-family: var(--font-display); font-size: 18px; font-weight: 700; }
.summary-bar .big b { color: var(--primary-deep); }
.summary-bar .q { font-family: var(--mono); background: var(--surface-3); padding: 2px 8px; border-radius: var(--radius-xs); }
.result-list { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 1080px) { .result-list { grid-template-columns: 1fr 1fr; } }
.ent-card { display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); color: inherit; box-shadow: none; transition: border-color var(--dur), background var(--dur); }
.ent-card:hover { text-decoration: none; border-color: var(--border-strong); background: var(--surface-2); transform: none; }
.ent-card .name { font-family: var(--font-display); font-weight: 700; font-size: 15.5px; }
.ent-card .meta { color: var(--text-2); font-size: 13.5px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.ent-card .meta .mono { color: var(--text); }
.ent-card .flags { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.ent-card .local { grid-column: 1 / -1; display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--text-2); padding-top: 6px; border-top: 1px dashed var(--border); }
.ent-card .local b { color: var(--text); }
.notes { display: grid; gap: 8px; margin-top: 14px; }

/* ---------- 事業總覽：信頭式抬頭 ---------- */
.ent-head { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: start; padding: 26px 28px 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: none; position: relative; overflow: hidden; }
.ent-head::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ink-800); }
[data-theme='dark'] .ent-head::before { background: var(--primary); }
.ent-head h1 { font-family: var(--font-display); font-size: 28px; letter-spacing: 0; line-height: 1.3; }
.ent-head .ids { display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--text-2); margin-top: 10px; font-size: 14px; align-items: center; }
.ent-head .ids .mono { color: var(--text); font-weight: 500; }
.ent-head .ids.addr { color: var(--text-2); }
.ent-head .reg-strip { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.ent-head .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.glance { margin-top: 16px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.glance .headline { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 24px; box-shadow: none; position: relative; }
.glance .headline::before { content: none; }
.glance .headline .eyebrow { margin-bottom: 10px; }
.glance .headline li { font-size: 16px; font-weight: 500; padding: 6px 0; display: flex; gap: 12px; align-items: baseline; line-height: 1.55; border-bottom: 1px solid var(--border); }
.glance .headline li:last-child { border-bottom: 0; }
.glance .headline li:first-child { font-family: var(--font-display); font-size: 17.5px; font-weight: 700; }
.glance .headline li::before { content: ''; width: 8px; height: 2px; background: var(--brass); flex: 0 0 auto; position: relative; top: -5px; }
.glance .attention { display: grid; gap: 8px; align-content: start; }
.attention-link { display: block; color: inherit; }
.attention-link:hover { text-decoration: none; } .attention-link:hover .alert { filter: brightness(.97); }
.attention-link .alert::after { content: '›'; margin-left: auto; font-weight: 700; opacity: .6; align-self: center; }
.glance:has(.attention > :only-child) { grid-template-columns: 1fr; }
.glance:has(.attention > :only-child) .attention { order: 2; }
/* 更多動作（⋯）下拉 */
details.more-menu { position: relative; }
details.more-menu > summary { list-style: none; cursor: pointer; }
details.more-menu > summary::-webkit-details-marker { display: none; }
details.more-menu .menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 190px; background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 30; display: grid; gap: 2px; }
details.more-menu .menu > * { justify-content: flex-start; border: 0; box-shadow: none; height: 36px; width: 100%; }
details.more-menu .menu a { text-decoration: none !important; }
.cat-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-top: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px 14px; display: flex; flex-direction: column; gap: 6px; cursor: pointer; box-shadow: none; position: relative; overflow: hidden; transition: border-color var(--dur), background var(--dur); text-align: left; }
.tile::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--gray); }
.tile:hover { border-color: var(--border-strong); background: var(--surface-2); transform: none; box-shadow: none; }
.tile .k { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.tile .k b { font-size: 15px; font-weight: 600; }
.tile .v { font-size: 28px; font-weight: 700; font-family: var(--font-display); line-height: 1.1; letter-spacing: 0; }
.tile .v small { font-size: 12.5px; color: var(--text-3); font-weight: 500; margin-left: 4px; font-family: var(--font); letter-spacing: 0; }
.tile .s { font-size: 12.5px; color: var(--text-3); }
.tile.off { background: transparent; } .tile.off .v { color: var(--text-3); } .tile.off::before { opacity: .35; }
.tile.air::before { background: var(--cat-air); } .tile.water::before { background: var(--cat-water); } .tile.waste::before { background: var(--cat-waste); } .tile.toxic::before { background: var(--cat-toxic); } .tile.soil::before { background: var(--cat-soil); }
.doc-row .title { font-weight: 600; }
.doc-row a.title { color: var(--text); } .doc-row a.title:hover { color: var(--primary-deep); text-decoration: underline; text-underline-offset: 3px; }
.doc-row .sub { color: var(--text-3); font-size: 12.5px; margin-top: 2px; }
.doc-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; white-space: nowrap; }
.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--border-2); }
.tl-today { position: relative; margin: 8px 0 8px -22px; padding-left: 22px; font-size: 12.5px; font-weight: 700; color: var(--brass-deep); display: flex; align-items: center; gap: 10px; letter-spacing: .04em; }
.tl-today::after { content: ''; flex: 1; border-top: 1px dashed var(--brass); opacity: .7; }
.tl-more { margin: 6px 0 6px -22px; }
.tl-item { position: relative; padding: 6px 0 10px; display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.tl-item::before { content: ''; position: absolute; left: -20px; top: 12px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 1.5px solid var(--gray); }
.tl-item.permit::before { border-color: var(--green); } .tl-item.expiry::before { border-color: var(--amber); } .tl-item.expired::before { border-color: var(--red); background: var(--red); } .tl-item.penalty::before { border-color: var(--red); } .tl-item.announcement::before { border-color: var(--cat-soil); }
.tl-item.application::before { border-color: var(--blue); } .tl-item.report::before { border-color: var(--teal); } .tl-item.eia::before { border-color: var(--cat-eia); } .tl-item.inspection::before { border-color: var(--teal); } .tl-item.change::before { border-color: var(--purple); }
.tl-item .d { font-family: var(--font-num); color: var(--text-2); font-weight: 500; } .tl-item .d.future { color: var(--amber-deep); }
.tl-item .t { font-weight: 500; }
.pen-facts { color: var(--text-2); font-size: 13.5px; line-height: 1.65; margin-top: 4px; }
.amount { font-family: var(--font-num); font-weight: 700; }
.src-status { display: grid; gap: 8px; }
.src-status .list-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.permit-card .kv { grid-template-columns: 6em 1fr; }
.permit-card.old { opacity: .8; }

/* ---------- 智能分析 ---------- */
.analysis { display: grid; gap: 16px; }
.an-hero { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 26px; box-shadow: none; position: relative; overflow: hidden; }
.an-hero::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--gray); }
.an-hero.danger::before { background: var(--red); } .an-hero.warn::before { background: var(--amber); } .an-hero.ok::before { background: var(--green); }
.an-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.an-overview { font-family: var(--font-display); font-size: 18px; font-weight: 700; line-height: 1.65; margin-top: 14px; max-width: 70ch; }
.an-basis { color: var(--text-3); font-size: 12.5px; margin-top: 10px; letter-spacing: .02em; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.an-grid.three { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.an-grid .card { min-width: 0; }
.an-list { display: flex; flex-direction: column; }
.an-risk { display: flex; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.an-risk:last-child { border-bottom: 0; }
.an-risk .lv { flex: 0 0 auto; width: 26px; height: 26px; border-radius: var(--radius-xs); display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: transparent; border: 1px solid var(--border-strong); color: var(--gray-deep); margin-top: 1px; }
.an-risk.high .lv { border-color: var(--red); color: var(--red-deep); background: var(--red-soft); } .an-risk.medium .lv { border-color: var(--amber); color: var(--amber-deep); background: var(--amber-soft); } .an-risk.low .lv { border-color: var(--green); color: var(--green-deep); }
.an-risk .t { font-weight: 700; font-size: 15px; } .an-risk .d { color: var(--text-2); font-size: 14px; margin-top: 2px; line-height: 1.65; }
.an-step { display: flex; gap: 12px; padding: 12px 22px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.an-step:last-child { border-bottom: 0; }
.an-step .n { flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-800); color: var(--on-ink); font-family: var(--font-num); font-weight: 700; font-size: 13px; margin-top: 1px; }
[data-theme='dark'] .an-step .n { background: var(--primary); color: var(--on-primary); }
.an-step .chip { margin-right: 8px; vertical-align: middle; }
.an-step .txt { font-size: 14.5px; line-height: 1.65; }
.an-ul li { position: relative; padding: 5px 0 5px 18px; font-size: 14.5px; line-height: 1.65; }
.an-ul li::before { content: ''; position: absolute; left: 0; top: 15px; width: 8px; height: 2px; background: var(--brass); }

/* ---------- 文件檢視（閱讀器：滿版文件，文字內容是可收合側欄） ---------- */
.content.doc-page { padding: 12px 16px 16px; max-width: none; }
.doc-view { display: flex; flex-direction: column; gap: 10px; height: calc(100dvh - var(--topbar-h) - 28px); min-height: 520px; }
.doc-toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; }
.doc-title { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; padding: 0 4px; font-weight: 600; }
.doc-title .ellipsis { min-width: 0; }
.doc-tools { display: flex; gap: 6px; flex: 0 0 auto; }
.doc-stage { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 0px; gap: 0; transition: grid-template-columns var(--dur-slow) var(--ease), gap var(--dur-slow) var(--ease); }
.drawer-open .doc-stage { grid-template-columns: minmax(0, 1fr) minmax(360px, 34%); gap: 12px; }
.doc-frame { background: #3b4044; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; display: flex; min-height: 0; box-shadow: none; }
.doc-frame iframe { flex: 1; width: 100%; height: 100%; border: 0; background: #525659; }
.doc-drawer { min-width: 0; overflow: hidden; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease), visibility 0s linear var(--dur); }
.drawer-open .doc-drawer { opacity: 1; visibility: visible; transition-delay: 0s; }
.drawer-h { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); }
.drawer-h h2 { font-size: 15px; }
.drawer-status { padding: 10px 16px 0; }
.drawer-status:empty { display: none; }
.drawer-body { flex: 1; overflow: auto; padding: 14px 16px 20px; font-size: 14.5px; line-height: 1.8; }
.drawer-body h2 { font-size: 15px; margin: 14px 0 6px; color: var(--primary-deep); }
.drawer-body table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 13.5px; }
.drawer-body table td, .drawer-body table th { border: 1px solid var(--border-2); padding: 5px 8px; vertical-align: top; }
.drawer-body table th { background: var(--surface-2); }
.drawer-empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 36px 12px; }
.drawer-empty .icon { color: var(--primary); width: 32px; height: 32px; }
.drawer-empty b { font-family: var(--font-display); font-size: 16px; }
.drawer-empty .note { max-width: 36ch; }
.dot-state { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); margin-left: 2px; flex: 0 0 auto; }
.dot-state.ready { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.dot-state.running { background: var(--amber); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.fields { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13.5px; padding: 12px 16px; background: var(--primary-soft); border-radius: var(--radius-sm); margin-bottom: 12px; }
.fields dt { color: var(--primary-deep); font-weight: 700; } .fields dd { margin: 0; }

/* ---------- 登入／設定頁 ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .brand-panel { background: var(--ink-800); color: var(--on-ink); padding: 56px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth .brand-panel::before { content: ''; position: absolute; left: 56px; top: 44px; width: 56px; height: 2px; background: var(--brass-line); }
.auth .brand-panel > * { position: relative; }
.auth .brand-panel img { width: 64px; height: 64px; border-radius: 50%; margin-top: 18px; }
.auth .brand-panel h1 { font-family: var(--font-display); font-size: 36px; font-weight: 700; margin-top: 14px; letter-spacing: .02em; }
.auth .brand-panel .lead { color: var(--on-ink-2); margin-top: 12px; }
.auth .brand-panel ul li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; color: var(--on-ink-2); font-size: 15px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.auth .brand-panel ul li:last-child { border-bottom: 0; }
.auth .brand-panel ul li .icon { color: var(--brass-line); margin-top: 4px; }
.auth .form-panel { display: grid; place-items: center; padding: 40px 24px; }
.auth .form-panel form { width: 100%; max-width: 400px; display: grid; gap: 14px; }
.auth .form-panel h2 { font-size: 22px; }
.setup-steps { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12.5px; font-weight: 600; color: var(--text-3); letter-spacing: .04em; }
.setup-steps span { padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border-2); }
.setup-steps span.on { background: var(--primary-soft); color: var(--primary-deep); border-color: color-mix(in srgb, var(--primary) 40%, transparent); }
.setup-more summary { font-size: 14px; }
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.admin-grid .card { min-width: 0; }
.agent-row .dot { margin-right: 4px; }

/* ---------- 響應式 ---------- */
@media (max-width: 1080px) {
  .home-grid, .glance, .admin-grid, .an-grid { grid-template-columns: 1fr; }
  .cat-tiles { grid-template-columns: repeat(3, 1fr); }
  .drawer-open .doc-stage { grid-template-columns: minmax(0, 1fr) minmax(320px, 42%); }
}
@media (max-width: 760px) {
  :root { --fs-body: 15px; }
  .shell { grid-template-columns: 1fr; }
  .rail { display: none; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); border-top: 1px solid var(--border-2); z-index: 30; }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--text-3); position: relative; letter-spacing: .04em; }
  .tabbar a .icon { width: 22px; height: 22px; stroke-width: 1.7; }
  .tabbar a.active { color: var(--primary-deep); font-weight: 700; }
  .tabbar a.active::before { content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 2px; background: var(--primary); }
  .content { padding: 16px 14px calc(var(--tabbar-h) + 24px); }
  .topbar { padding: 0 14px; } .topbar .quick { display: none; }
  .hero { padding: 28px 18px 24px; border-radius: var(--radius); } .hero h1 { font-size: 25px; } .hero::after { left: 18px; top: 22px; }
  .searchbox { flex-direction: column; } .searchbox .btn { width: 100%; }
  .ent-head { grid-template-columns: 1fr; padding: 16px 16px 14px; } .ent-head .actions { justify-content: flex-start; } .ent-head h1 { font-size: 21px; }
  .ent-head .ids { font-size: 13px; gap: 2px 12px; margin-top: 6px; }
  .ent-head .ids.addr span:first-of-type { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  .cat-tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ent-card { grid-template-columns: 1fr; } .ent-card .flags { justify-content: flex-start; }
  .filter-row { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
  .filter-row::-webkit-scrollbar { display: none; }
  .filter-row .fchip, .filter-row .filter-k { flex: 0 0 auto; }
  .tabs { top: var(--topbar-h); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  /* 表格一列一卡（欄名用 data-label） */
  .table-wrap.cards { border: 0; background: transparent; box-shadow: none; overflow: visible; }
  .table-wrap.cards table.tbl, .table-wrap.cards tbody, .table-wrap.cards tr, .table-wrap.cards td { display: block; }
  .table-wrap.cards thead { display: none; }
  .table-wrap.cards tr { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 14px; margin-bottom: 10px; background: var(--surface); box-shadow: none; }
  .table-wrap.cards td { display: grid; grid-template-columns: 5.5em 1fr; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--border); text-align: left; white-space: normal; }
  .table-wrap.cards td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; font-weight: 600; padding-top: 2px; letter-spacing: .04em; }
  .table-wrap.cards td:last-child { border-bottom: 0; }
  .table-wrap.cards td:empty { display: none; }
  .table-wrap.cards td[data-label=''] { display: flex; justify-content: flex-end; gap: 8px; padding-top: 10px; }
  .table-wrap.cards td[data-label='']::before { display: none; }
  .table-wrap.cards td .doc-actions { justify-content: flex-end; }
  .table-wrap.cards tbody tr:hover td { background: transparent; }
  .tl-item { grid-template-columns: 1fr; gap: 2px; }
  .auth { grid-template-columns: 1fr; } .auth .brand-panel { padding: 30px 22px; } .auth .brand-panel::before { left: 22px; top: 22px; } .auth .brand-panel ul { display: none; } .auth .brand-panel h1 { font-size: 26px; }
  table.tbl { font-size: 13.5px; } table.tbl th, table.tbl td { padding: 9px 10px; }
  .stat .v { font-size: 22px; }
  .an-overview { font-size: 16px; }
  /* 文件閱讀器：文件滿版，文字內容改成由下往上的抽屜 */
  .content.doc-page { padding: 10px 10px calc(var(--tabbar-h) + 16px); }
  .doc-view { height: auto; min-height: 0; }
  .doc-toolbar { flex-wrap: wrap; }
  .doc-title { flex-basis: 100%; order: 3; padding: 2px 4px 0; }
  .doc-stage { display: block; }
  .doc-frame { height: calc(100dvh - var(--topbar-h) - var(--tabbar-h) - 120px); min-height: 420px; }
  .doc-drawer { position: fixed; left: 0; right: 0; bottom: 0; top: 16vh; z-index: 40; border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-lg); transform: translateY(100%); transition: transform var(--dur-slow) var(--ease), opacity var(--dur), visibility 0s linear var(--dur-slow); }
  .drawer-open .doc-drawer { transform: none; }
}
/* ---------- 載入進度（逐來源） ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pp-indeterminate { 0% { transform: translateX(-100%); } 100% { transform: translateX(400%); } }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--primary); animation: spin .8s linear infinite; flex: 0 0 auto; }
.spinner.lg { width: 22px; height: 22px; border-width: 2.5px; }
.progress-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; padding: 20px 22px; }
.progress-panel .pp-head { display: flex; align-items: center; gap: 12px; }
.progress-panel .pp-head h2 { font-size: 16px; flex: 1; min-width: 0; }
.progress-panel .pp-count { font-family: var(--font-num); font-weight: 700; color: var(--primary-deep); white-space: nowrap; }
.progress-panel .pp-sub { color: var(--text-2); font-size: 13.5px; margin-top: 4px; }
.pp-bar { position: relative; height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin: 14px 0 14px; }
.pp-bar > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: var(--primary); transition: width var(--dur-slow) var(--ease); }
.pp-bar.indeterminate > i { width: 25%; animation: pp-indeterminate 1.4s var(--ease) infinite; }
.pp-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 6px 16px; }
.pp-step { display: flex; align-items: flex-start; gap: 10px; padding: 7px 10px; border-radius: var(--radius-sm); font-size: 14px; transition: background var(--dur); }
.pp-step .mark { width: 18px; height: 18px; display: grid; place-items: center; flex: 0 0 auto; margin-top: 2px; }
.pp-step .mark .icon { width: 16px; height: 16px; }
.pp-step .t { font-weight: 600; }
.pp-step .s { color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.pp-step.wait { color: var(--text-3); } .pp-step.wait .t { font-weight: 500; }
.pp-step.run { background: var(--primary-soft); }
.pp-step.ok .mark { color: var(--green); } .pp-step.stale .mark { color: var(--amber); } .pp-step.pending .mark { color: var(--blue); }
.pp-step.error .mark { color: var(--red); } .pp-step.error .s { color: var(--red-deep); }
.pp-foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; color: var(--text-3); font-size: 12.5px; flex-wrap: wrap; }
.pp-foot .elapsed { font-family: var(--font-num); font-weight: 600; color: var(--text-2); }
.loading-line { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; color: var(--text-2); }
.loading-line .elapsed { margin-left: auto; font-family: var(--font-num); color: var(--text-3); }

/* ---------- 懸浮回頂端 ---------- */
.to-top { position: fixed; right: 20px; bottom: 22px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--ink-700); background: var(--ink-800); color: var(--on-ink); display: grid; place-items: center; box-shadow: var(--shadow); z-index: 60; opacity: 0; transform: translateY(12px) scale(.9); pointer-events: none; transition: opacity var(--dur-slow) var(--ease), transform var(--dur-slow) var(--ease), background var(--dur); }
.to-top.show { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--ink-700); }
.to-top .icon { width: 20px; height: 20px; transform: rotate(-90deg); stroke-width: 2; }
@media (max-width: 760px) { .to-top { right: 14px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); width: 40px; height: 40px; } }
@media print { .to-top { display: none !important; } }

/* ---------- 搜尋結果篩選 ---------- */
.filter-bar { display: grid; gap: 6px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; box-shadow: none; }
.filter-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-k { font-size: 12px; font-weight: 700; color: var(--text-3); letter-spacing: .08em; min-width: 32px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border-2); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; transition: background var(--dur), border-color var(--dur), color var(--dur); }
.fchip:hover { border-color: var(--border-strong); color: var(--text); background: var(--surface-2); }
.fchip.on { background: var(--ink-800); color: var(--on-ink); border-color: var(--ink-800); box-shadow: none; }
[data-theme='dark'] .fchip.on { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.fchip.clear { border-style: dashed; color: var(--text-3); }

/* ---------- 法源提示／報告模式／分享／批次 ---------- */
.law-note { margin-bottom: 12px; background: var(--surface-2); }
.law-note summary { color: var(--primary-deep); }
.report-page { max-width: 1000px; margin: 0 auto; padding: 20px 24px 60px; }
.report-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.report-brand { display: flex; align-items: center; gap: 16px; padding: 20px 28px; background: var(--ink-800); color: var(--on-ink); border-radius: var(--radius-lg) var(--radius-lg) 0 0; margin: -36px -40px 28px; position: relative; overflow: hidden; }
.report-brand::after { content: ''; position: absolute; left: 28px; right: 28px; bottom: 0; height: 2px; background: var(--brass-line); opacity: .9; }
.report-brand .brand-logo { width: 48px; height: 48px; border-radius: 50%; background: #fff; flex: 0 0 auto; }

/* ---- 表格預設折疊：超過 limit 筆只先顯示前幾筆，想看再點開 ---- */
.table-more { display: flex; justify-content: center; padding: 8px 12px 10px; border-top: 1px dashed var(--border); }
.table-more .btn { color: var(--link); }
/* 監測：每支煙道／放流口一個可收合區塊，有超標的預設攤開 */
details.stack-fold summary { gap: 10px; flex-wrap: wrap; }
details.stack-fold summary .count { color: var(--text-3); font-size: var(--fs-min); font-weight: 600; background: transparent; padding: 0; border-radius: 0; font-family: var(--font-num); letter-spacing: .04em; }
details.stack-fold summary .pill { margin-left: auto; }
details.stack-fold .fold-b { padding: 0; }
details.stack-fold .table-wrap { border: 0; border-radius: 0; }

/* ---- 智能分析：現況環保意見、許可展延準備 ---- */
.an-opinion { font-size: 15.5px; line-height: 1.85; max-width: 78ch; }
.an-opinion p { margin: 0 0 8px; }
.an-opinion p:last-child { margin-bottom: 0; }
.an-opinion p:first-child { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; }
.renew-note { color: var(--text-3); font-size: 12.5px; font-weight: 600; white-space: nowrap; letter-spacing: .02em; }

/* ---- 管理：AI 模型 ---- */
.ai-form .field.span2 { grid-column: span 2; }
.ai-models { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ai-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ai-col input { width: 100%; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); letter-spacing: .02em; }
.chip-x { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 0; background: color-mix(in srgb, currentColor 14%, transparent); color: inherit; cursor: pointer; padding: 0; margin-left: 2px; }
.chip-x:hover { background: color-mix(in srgb, currentColor 26%, transparent); }
.model-list { display: flex; flex-direction: column; gap: 14px; }
.model-group h4 { margin: 0 0 8px; font-size: 13px; font-weight: 700; color: var(--text-2); display: flex; align-items: center; gap: 8px; letter-spacing: .04em; }
.model-group h4 .count { color: var(--text-3); font-size: var(--fs-min); font-weight: 600; background: transparent; padding: 0; border-radius: 0; font-family: var(--font-num); }
.mchip { display: inline-flex; align-items: center; gap: 4px; height: 30px; padding: 0 6px 0 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); font-size: 13px; font-family: var(--mono); }
.mchip .name { border: 0; background: none; color: var(--text); font: inherit; cursor: pointer; padding: 0; }
.mchip .name:hover { color: var(--link); text-decoration: underline; }
.mchip .add { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--surface-3); color: var(--text-2); cursor: pointer; padding: 0; }
.mchip .add:hover { background: var(--primary-soft); color: var(--primary-deep); }
.mchip .tag { font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); font-family: var(--font); }
.mchip.primary { border-color: var(--primary); background: var(--primary-soft); }
.mchip.primary .tag { background: var(--primary); color: var(--on-primary); }
.mchip.fb { border-color: var(--brass); background: var(--brass-soft); }
.mchip.fb .tag { background: var(--brass); color: #fff; }
.ai-test-out:empty { display: none; }
@media (max-width: 760px) {
  .ai-models { grid-template-columns: 1fr; }
  .ai-form .field.span2 { grid-column: auto; }
  /* 卡片標題列：手機上說明文字換到第二行，標題不能被擠成一字一行 */
  .card-h { flex-wrap: wrap; }
  .card-h h2 { flex: 1 1 auto; }
  .renew-note { white-space: normal; flex-basis: 100%; }
}
.report-brand .co { font-family: var(--font-display); font-size: 21px; font-weight: 700; letter-spacing: .04em; }
.report-brand .tag { font-size: 12.5px; color: var(--on-ink-3); margin-top: 3px; letter-spacing: .12em; }
.report-brand .right { margin-left: auto; text-align: right; font-size: 12.5px; color: var(--on-ink-2); letter-spacing: .04em; }
.report-brand .right b { display: block; color: var(--on-ink); font-size: 14px; font-family: var(--font-display); }
.report { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 36px 40px; box-shadow: none; font-size: 14px; overflow: hidden; }
.report-head { border-bottom: 1.5px solid var(--ink-800); padding-bottom: 16px; margin-bottom: 20px; }
[data-theme='dark'] .report-head { border-bottom-color: var(--primary); }
.report-head h1 { font-size: 27px; margin-top: 6px; }
.report-ids { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--text-2); margin-top: 10px; }
.report-ids b { color: var(--text); font-weight: 600; }
.report-meta { margin-top: 6px; color: var(--text-3); font-size: 13px; }
.report section { margin-top: 26px; break-inside: avoid-page; }
.report h2 { font-size: 16.5px; color: var(--text); margin-bottom: 10px; padding-left: 12px; border-left: 2px solid var(--brass); }
.report-list li { padding: 4px 0 4px 16px; position: relative; font-size: 14.5px; }
.report-list li::before { content: ''; position: absolute; left: 0; top: 14px; width: 8px; height: 2px; background: var(--brass); }
.report-list.attention { margin-top: 8px; }
.report-list.attention li.danger { color: var(--red-deep); font-weight: 700; }
.report-list.attention li.warn { color: var(--amber-deep); font-weight: 700; }
.report-list.attention li.ok { color: var(--green-deep); }
.report-list.attention li.info { color: var(--primary-deep); }
.report .table-wrap { box-shadow: none; }
.report table.tbl th { position: static; }
.report .table-wrap:not(.scroll) { overflow: visible; }
.report-url { font-family: var(--mono); font-size: 11.5px; word-break: break-all; color: var(--text-3); }
.report-foot { margin-top: 30px; padding-top: 14px; border-top: 1px solid var(--border); color: var(--text-3); font-size: 12.5px; line-height: 1.75; display: flex; gap: 16px; justify-content: space-between; flex-wrap: wrap; }
.share-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 14px; box-shadow: none; }
.share-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.share-h .icon { color: var(--primary); }
.share-form { display: grid; grid-template-columns: 160px 1fr auto; gap: 12px; align-items: end; }
.share-result { margin-top: 12px; }
@media (max-width: 760px) { .report { padding: 20px 16px; } .report-page { padding: 12px 12px 40px; } .report-brand { margin: -20px -16px 18px; padding: 14px 16px; } .report-brand .right { display: none; } .share-form { grid-template-columns: 1fr; } }
@media print {
  .rail, .tabbar, .topbar, .doc-actions, .btn, .no-print, .toasts, .share-panel { display: none !important; }
  .content, .report-page { padding: 0; max-width: none; }
  body { background: #fff; color: #000; font-size: 11.5pt; }
  .report { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .report-brand { margin: 0 0 18px; border-radius: 0; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .report table.tbl { font-size: 10.5pt; }
  .report table.tbl th, .report table.tbl td { padding: 5px 7px; }
  .report table.tbl tr:hover td { background: transparent; }
  a { color: inherit; text-decoration: none; }
  @page { size: A4; margin: 16mm 14mm; }
}

/* ============================================================ 品牌圖示動態版（1.5.1）＋ 數字磚進場 ============================================================ */
/* 與 public/icon.svg 同一組幾何：墨綠磚、紙色山形、黃銅弧環、黃銅點。動態只在 .animate：山形升起 → 弧環轉入 → 黃銅點彈出並微光；兩圈漣漪、一道掃光循環。 */
.wd-mark { display: block; overflow: visible; flex: 0 0 auto; }
.wd-mark .m-tile, .wd-mark .m-mountain, .wd-mark .m-arc, .wd-mark .m-arc-gap, .wd-mark .m-dot, .wd-mark .m-ring, .wd-mark .m-sheen { transform-box: fill-box; }
.wd-mark .m-mountain { transform-origin: 50% 100%; }
.wd-mark .m-arc, .wd-mark .m-arc-gap { transform-origin: 50% 50%; }
.wd-mark .m-dot, .wd-mark .m-ring { transform-origin: 50% 50%; }
.wd-mark .m-ring, .wd-mark .m-sheen { opacity: 0; }
.wd-mark:not(.animate) .m-ring, .wd-mark:not(.animate) .m-sheen { display: none; }
.wd-mark.animate .m-mountain { animation: mark-rise .9s var(--ease) both; }
.wd-mark.animate .m-arc, .wd-mark.animate .m-arc-gap { animation: mark-arc 1.1s .25s cubic-bezier(.2, .8, .2, 1) both; }
.wd-mark.animate .m-dot { animation: mark-pop .6s .85s var(--ease) both, mark-glow 3.2s 1.6s ease-in-out infinite; }
.wd-mark.animate .m-ring { animation: mark-ring 3.2s 1.5s ease-out infinite; }
.wd-mark.animate .m-ring.two { animation-delay: 2.4s; }
.wd-mark.animate .m-sheen { animation: mark-sheen 7s 2.2s ease-in-out infinite; }
@keyframes mark-rise { from { opacity: 0; transform: translateY(16%) scaleY(.86); } to { opacity: 1; transform: none; } }
@keyframes mark-arc { from { opacity: 0; transform: rotate(-26deg) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes mark-pop { from { opacity: 0; transform: scale(0); } 70% { opacity: 1; transform: scale(1.3); } to { opacity: 1; transform: scale(1); } }
@keyframes mark-glow { 0%, 100% { filter: drop-shadow(0 0 0 rgba(217, 184, 106, 0)); } 50% { filter: drop-shadow(0 0 3px rgba(217, 184, 106, .95)); } }
@keyframes mark-ring { 0% { opacity: .6; transform: scale(.7); } 100% { opacity: 0; transform: scale(3.4); } }
@keyframes mark-sheen { 0%, 55% { opacity: .12; transform: translateX(-20px) rotate(18deg); } 100% { opacity: .12; transform: translateX(118px) rotate(18deg); } }
/* 登入頁：圖示下方一圈緩慢呼吸的黃銅光暈；側欄商標 hover 一圈黃銅光環 */
.mark-wrap { position: relative; display: inline-block; margin-top: 18px; }
.mark-wrap::before { content: ''; position: absolute; inset: -30px; border-radius: 50%; background: radial-gradient(closest-side, rgba(217, 184, 106, .26), transparent 72%); animation: mark-ambient 6s ease-in-out infinite; pointer-events: none; }
.mark-wrap .wd-mark { position: relative; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, .35)); }
@keyframes mark-ambient { 0%, 100% { transform: scale(.9); opacity: .7; } 50% { transform: scale(1.12); opacity: 1; } }
.rail .brand img { box-shadow: 0 0 0 0 rgba(168, 133, 58, 0); transition: transform var(--dur-slow) var(--ease), box-shadow var(--dur-slow) var(--ease); }
.rail .brand:hover img { box-shadow: 0 0 0 4px rgba(168, 133, 58, .22); }
.pp-head .pp-mark { border-radius: 7px; }
.an-mark { border-radius: 9px; }
/* 數字磚與類別磚進場：依序淡入上浮（搭配 ui.js animateNumbers 的數字跑動） */
.stat-row .stat, .cat-tiles .tile { animation: rise-in .5s var(--ease) both; }
.stat-row .stat:nth-child(2), .cat-tiles .tile:nth-child(2) { animation-delay: 45ms; }
.stat-row .stat:nth-child(3), .cat-tiles .tile:nth-child(3) { animation-delay: 90ms; }
.stat-row .stat:nth-child(4), .cat-tiles .tile:nth-child(4) { animation-delay: 135ms; }
.stat-row .stat:nth-child(5), .cat-tiles .tile:nth-child(5) { animation-delay: 180ms; }
.stat-row .stat:nth-child(n+6) { animation-delay: 225ms; }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.stat { transition: border-color var(--dur), transform var(--dur-slow) var(--ease); }
.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
@media (prefers-reduced-motion: reduce) {
  .wd-mark .m-ring, .wd-mark .m-sheen, .mark-wrap::before { animation: none !important; opacity: 0 !important; }
  .wd-mark.animate .m-dot { animation: none !important; }
  .stat-row .stat, .cat-tiles .tile { animation: none !important; }
}

/* ============================================================ AI 智能分析：獨立按鍵＋面板（1.6.0） ============================================================ */
.ai-btn { gap: 8px; padding: 0 16px 0 12px; background: linear-gradient(135deg, #127a71, #0a4843); border-color: #0a4843; color: #f4f1ea; position: relative; overflow: hidden; }
.ai-btn::after { content: ''; position: absolute; top: -40%; bottom: -40%; width: 18px; left: -30px; background: rgba(255, 255, 255, .18); transform: rotate(18deg); transition: left .7s var(--ease); pointer-events: none; }
.ai-btn:hover { background: linear-gradient(135deg, #15887e, #0b524c); border-color: #0b524c; color: #fff; }
.ai-btn:hover::after { left: calc(100% + 30px); }
.ai-btn.open { box-shadow: 0 0 0 3px rgba(168, 133, 58, .28); }
.ai-btn .ai-mark { border-radius: 5px; flex: 0 0 auto; }
.an-panel { border-top: 3px solid var(--ink-800); padding-top: 18px; }
.an-panel-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.an-panel-head .an-panel-mark { border-radius: 10px; filter: drop-shadow(0 4px 10px rgba(10, 72, 67, .25)); }
.an-panel-head h2 { font-family: var(--font-display); font-size: 22px; line-height: 1.3; margin-top: 2px; }
.an-panel-head .eyebrow { color: var(--brass); letter-spacing: .18em; font-size: 12px; font-weight: 700; }
.an-ops p { font-size: 15.5px; line-height: 1.85; margin: 0 0 8px; max-width: 80ch; }
.an-ops p:last-child { margin-bottom: 0; }
.an-ops p.lead { font-family: var(--font-display); font-weight: 700; font-size: 16.5px; }
.an-site { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.an-topic { padding: 14px 16px; }
.an-topic .card-h { padding: 0 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.an-topic-b p { font-size: 14.5px; line-height: 1.75; margin: 0 0 6px; color: var(--text); }
.an-topic-b p:last-child { margin-bottom: 0; }
.an-advice { display: flex; flex-direction: column; }
.an-advice-row { display: flex; gap: 14px; align-items: flex-start; padding: 12px 22px; border-bottom: 1px solid var(--border); }
.an-advice-row:last-child { border-bottom: 0; }
.an-advice-row .chip { flex: 0 0 auto; margin-top: 2px; }
.an-advice-row .txt p { font-size: 14.5px; line-height: 1.75; margin: 0 0 4px; }
.an-advice-row .txt p:last-child { margin-bottom: 0; }
@media (max-width: 720px) {
  .ai-btn span { display: inline; }
  .an-panel-head { gap: 12px; }
  .an-panel-head h2 { font-size: 18px; }
  .an-advice-row { padding: 12px 14px; flex-direction: column; gap: 6px; }
}

/* ============================================================ 文件彈窗（1.6.1） ============================================================ */
/* 底板淡入＋對話框由下往上浮起、微放大；關閉反向 220 毫秒。桌機留 18px 邊、手機滿版。 */
.doc-modal { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 18px; }
.doc-modal .doc-backdrop { position: absolute; inset: 0; background: rgba(21, 48, 45, .58); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s var(--ease); }
.doc-modal .doc-dialog { position: relative; width: min(1480px, 100%); height: min(92dvh, 1040px); background: var(--bg); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 30px 80px rgba(10, 30, 28, .38), 0 2px 0 rgba(255, 255, 255, .4) inset; overflow: hidden; display: flex; flex-direction: column; opacity: 0; transform: translateY(26px) scale(.972); transition: opacity .32s var(--ease), transform .38s cubic-bezier(.2, .9, .25, 1.12); }
.doc-modal .doc-dialog::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--ink-800); z-index: 1; }
.doc-modal.show .doc-backdrop { opacity: 1; }
.doc-modal.show .doc-dialog { opacity: 1; transform: none; }
.doc-modal.closing .doc-backdrop { opacity: 0; transition-duration: .22s; }
.doc-modal.closing .doc-dialog { opacity: 0; transform: translateY(16px) scale(.985); transition: opacity .2s var(--ease), transform .22s var(--ease); }
.doc-modal .doc-view { height: 100%; min-height: 0; padding: 12px; }
.doc-title .doc-ent { flex: 0 1 auto; max-width: 32%; }
.doc-title .doc-ent::after { content: '›'; margin-left: 8px; color: var(--text-3); }
.doc-close { margin-left: 4px; }
.doc-close:hover { background: var(--red-soft); border-color: var(--red); color: var(--red-deep); }
/* 手機瀏覽器不能在頁面內顯示 PDF（navigator.pdfViewerEnabled=false）：給一張說明卡，不要讓人看到瀏覽器的破圖 */
.doc-fallback { flex: 1; display: grid; place-items: center; text-align: center; padding: 28px 20px; background: var(--surface); color: var(--text-2); }
.doc-fallback .icon.xl { width: 44px; height: 44px; color: var(--text-3); }
.doc-fallback b { display: block; font-size: 16px; color: var(--text); margin: 10px 0 6px; }
.doc-fallback .row { justify-content: center; margin-top: 14px; }
body.modal-open { overflow: hidden; }
@media (max-width: 720px) {
  .doc-modal { padding: 0; }
  .doc-modal .doc-dialog { width: 100%; height: 100dvh; border-radius: 0; transform: translateY(100%); }
  .doc-modal.show .doc-dialog { transform: none; }
  .doc-modal.closing .doc-dialog { transform: translateY(40px); }
  .doc-modal .doc-view { padding: 8px; }
  .doc-modal .doc-frame { height: calc(100dvh - 128px); min-height: 0; }
  .doc-title .doc-ent { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .doc-modal .doc-backdrop, .doc-modal .doc-dialog { transition: none !important; }
}

/* 分頁內容容器（切分頁只換這一塊，不重畫整頁） */
.tab-body { display: block; min-width: 0; }

/* 分享表單：附意見的勾選列佔滿一列 */
.share-form .check { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.share-form .check input { width: 18px; height: 18px; accent-color: var(--primary); }
.share-form .check span { font-size: 14px; }
.share-form .share-opinion { margin-top: 2px; }

/* ---------------- AI 智能分析：紀錄保存狀態列（抬頭下一整列） ---------------- */
.an-panel-head .an-panel-actions { align-self: flex-start; }
.an-saved { flex: 1 1 100%; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.an-saved .icon { width: 17px; height: 17px; flex: none; }
.an-saved .txt { flex: 1 1 240px; min-width: 0; }
.an-saved b { font-weight: 700; color: var(--text); }
.an-saved.fresh { border-color: color-mix(in srgb, var(--green) 38%, transparent); background: var(--green-soft); color: var(--text); }
.an-saved.fresh .icon { color: var(--green); }
.an-saved.changed { border-color: color-mix(in srgb, var(--amber) 55%, transparent); background: var(--amber-soft); color: var(--text); }
.an-saved.changed .icon { color: var(--amber); }
.an-saved.changed b { color: var(--amber-deep); }
.an-saved.past { border-style: dashed; }
.an-saved.past .icon { color: var(--text-3); }
.an-saved.failed { border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.an-saved.failed .icon { color: var(--red); }
.an-hist-l { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.an-history { font: inherit; font-size: 12.5px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); max-width: min(100%, 300px); }
.an-history:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (max-width: 640px) {
  .an-saved { padding: 8px 12px; font-size: 13px; }
  .an-saved .txt { flex-basis: 100%; }
  .an-hist-l { width: 100%; }
  .an-history { flex: 1; max-width: none; }
}

/* ---------------- 毒化物分頁：一句話摘要、運作場所籤、同統編管編籤 ---------------- */
.tox-sum { padding: 12px 16px; border: 1px solid var(--border); border-left: 4px solid var(--cat-toxic); border-radius: var(--radius-lg); background: var(--surface); font-size: 14.5px; line-height: 1.7; margin-bottom: 14px; color: var(--text); }
.tox-sum b { color: var(--cat-toxic-deep); }
.tox-sum .tox-sum-site .link { font-weight: 600; }
.chip.tox-site { color: var(--cat-toxic-deep); border-color: color-mix(in srgb, var(--cat-toxic) 35%, transparent); text-decoration: none; }
.chip.tox-site::before { background: var(--cat-toxic); }
.chip.tox-site:hover { background: color-mix(in srgb, var(--cat-toxic) 10%, var(--surface)); }
.chip.sib-chip { text-decoration: none; cursor: pointer; }
.chip.sib-chip:hover { background: color-mix(in srgb, var(--cat-entity) 12%, var(--surface)); }

/* ---------------- 狀態卡（廢清書等「沒有公開來源、用訊號判斷」的一句話卡） ---------------- */
.state-card { margin-top: 14px; padding: 14px 18px; border: 1px solid var(--border); border-left: 4px solid var(--gray); border-radius: var(--radius-lg); background: var(--surface); }
.state-card .state-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.state-card .state-h b { font-size: 15.5px; color: var(--text); }
.state-card p { margin: 4px 0 0; font-size: 14px; line-height: 1.7; color: var(--text-2); }
.state-card .state-note { font-size: 13px; color: var(--text-3); border-top: 1px dashed var(--border); padding-top: 8px; margin-top: 10px; }
.state-card.ok { border-left-color: var(--green); }
.state-card.ok .state-h b { color: var(--green-deep); }
.state-card.warn { border-left-color: var(--amber); background: var(--amber-soft); }
.state-card.warn .state-h b { color: var(--amber-deep); }
.state-card.off { border-left-color: var(--border-strong); }
.state-card.off .state-h b { color: var(--text-2); }

/* ---- 法規異動提醒彈窗與管理頁異動卡（laws.js） ---- */
.law-modal { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 18px; }
.law-modal .law-backdrop { position: absolute; inset: 0; background: rgba(21, 48, 45, .58); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); opacity: 0; transition: opacity .3s var(--ease); }
.law-modal .law-dialog { position: relative; width: min(860px, 100%); max-height: min(90dvh, 980px); background: var(--bg); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 30px 80px rgba(10, 30, 28, .38), 0 2px 0 rgba(255, 255, 255, .4) inset; display: flex; flex-direction: column; overflow: hidden; opacity: 0; transform: translateY(26px) scale(.972); transition: opacity .32s var(--ease), transform .38s cubic-bezier(.2, .9, .25, 1.12); }
.law-modal .law-dialog::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: var(--amber-deep); z-index: 1; }
.law-modal.show .law-backdrop { opacity: 1; }
.law-modal.show .law-dialog { opacity: 1; transform: none; }
.law-modal.closing .law-backdrop { opacity: 0; transition-duration: .22s; }
.law-modal.closing .law-dialog { opacity: 0; transform: translateY(16px) scale(.985); transition: opacity .2s var(--ease), transform .22s var(--ease); }
.law-h { display: flex; gap: 14px; align-items: flex-start; padding: 22px 22px 14px; border-bottom: 1px solid var(--border); }
.law-h > .icon { width: 28px; height: 28px; color: var(--amber-deep); flex: none; margin-top: 2px; }
.law-h > div { flex: 1; min-width: 0; }
.law-h h2 { margin: 0 0 4px; font-size: 20px; }
.law-h p { margin: 0; }
.law-body { overflow: auto; padding: 14px 22px; display: flex; flex-direction: column; gap: 12px; }
.law-f { display: flex; gap: 10px; align-items: center; padding: 14px 22px 18px; border-top: 1px solid var(--border); background: var(--surface-2); }
.law-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.law-item.applied { border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.law-item.danger { border-color: color-mix(in srgb, var(--red) 45%, transparent); }
.law-item-h { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.law-item-t { margin: 0; font-size: 15px; line-height: 1.65; color: var(--text); }
.law-impact { display: flex; gap: 8px; align-items: flex-start; padding: 9px 12px; border-radius: 10px; font-size: 13.5px; line-height: 1.55; }
.law-impact .icon { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.law-impact.ok { background: var(--green-soft); color: var(--text); }
.law-impact.ok .icon { color: var(--green); }
.law-impact.warn { background: var(--amber-soft); color: var(--text); }
.law-impact.warn .icon { color: var(--amber-deep); }
.law-diff summary { cursor: pointer; font-size: 13px; color: var(--text-2); }
.law-diff-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
.law-diff-k { font-size: 12px; font-weight: 700; color: var(--text-3); margin-bottom: 4px; letter-spacing: .04em; }
.law-old, .law-new { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; line-height: 1.7; }
.law-old p, .law-new p { margin: 0; white-space: pre-wrap; }
.law-new { background: color-mix(in srgb, var(--green-soft) 70%, var(--surface-2)); }
@media (max-width: 720px) {
  .law-diff-cols { grid-template-columns: 1fr; }
  .law-h, .law-body, .law-f { padding-left: 14px; padding-right: 14px; }
  .law-modal { padding: 10px; }
}
