/* 色票真源：三案視覺設計白皮書內嵌的色票（戰情室 repo 提交 3417492f，2026-10-14）。
   下面整段照抄環境部三案視覺設計白皮書內嵌的 tokens，不另改值；改色票要三案同一輪一起改。 */
:root{color-scheme:light dark} /* 預設跟著系統；開頁的 boot 會在 <html data-theme> 寫上實際套用的深或淺（承緯 2026-10-16）；色票值不動 */
[data-theme="light"]{color-scheme:light}
[data-theme="dark"]{color-scheme:dark}
:root{
  --bg:light-dark(#e8f2f4,#0a1c31);
  --surface:light-dark(#ffffff,#1a435d);
  --surface-2:light-dark(#fffffff7,#08243af2);
  --surface-sunken:light-dark(#dbe8eb,#051726);
  --shadow-color:light-dark(#22505421,#02101daa);
  --text:light-dark(#0f272c,#ecf8ff);
  --text-muted:light-dark(#4f696e,#b0ccd9);
  --line:light-dark(#2e75792e,#70b5cc55);
  --accent:light-dark(#017b73,#53efe2);
  --accent-2:light-dark(#0f68e1,#73aaff);
  --warn:light-dark(#916601,#ffd185);
  --danger:light-dark(#b4233f,#ff8fa3);
  --accent-display:light-dark(#00a399,#53efe2);
  --accent-2-display:light-dark(#4790ff,#73aaff);
  --warn-display:light-dark(#c08700,#ffd185);
  --data-1:light-dark(#09a59b,#53efe2);
  --data-2:light-dark(#4d92fb,#73aaff);
  --data-3:light-dark(#c6870e,#ffd185);
  --data-4:light-dark(#f65c80,#ff8fa3);
  --data-5:light-dark(#9581f8,#a99bff);
  --data-6:light-dark(#4ca650,#7ee081);
  --chart-label:light-dark(#2c454a,#b8d6e4);
  --chart-axis:light-dark(#5a747a,#7fa8bd);
  --chart-grid:light-dark(#8aa6ac,#43839d);
  --chart-hole:light-dark(#ffffff,#061626);
}
/* 資料湖主控台 app.css
 * 只用 tokens.css 的色票名字；字級、間距、圓角、陰影、動態照白皮書第七節的名字。
 * 不用任何 CSS 框架；頁面與元件都不寫行內 style 屬性（CSP 的 style-src 是 'self'）。
 * 色票沒有的顏色，一行寫兩值 light-dark(淺, 深)；半透明用 color-mix()。 */

:root {
  /* 間距 */
  --space-1: 4px;
  --space-2: 6px;
  --space-3: 8px;
  --space-4: 12px;
  --space-5: 16px;
  --space-6: 24px;
  /* 圓角 */
  --radius-sm: 7px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --radius-pill: 999px;
  /* 陰影、動態 */
  --shadow-pop: 0 14px 30px var(--shadow-color);
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-emph: cubic-bezier(.16, 1, .3, 1);
  --dur-fast: .15s;
  --dur-base: .2s;
  /* 層級 */
  --z-top: 12;
  --z-float: 20;
  --z-side: 38;
  --z-input: 40;
  --z-popup: 60;
  /* 字體（不載入網頁字型，離線與環境部內網都能正常顯示） */
  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang TC", "Microsoft JhengHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --sidebar-w: 264px;
}

/* ---- 基礎 ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: calc(15px * var(--text-scale, 1))/1.65 var(--font-sans);
  font-variant-numeric: tabular-nums;
  transition: background-color var(--dur-base), color var(--dur-base);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
a { color: var(--accent-2); }
code, pre, .mono { font-family: var(--font-mono); }
h1, h2, h3, h4, h5 { margin: 0; }
p { margin: var(--space-3) 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, textarea:focus-visible,
summary:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }
.wrap-anywhere { overflow-wrap: anywhere; }
.min-w-16 { min-width: 4rem; }
.min-w-32 { min-width: 8rem; }
.min-w-40 { min-width: 10rem; }
.min-w-44 { min-width: 11rem; }
.min-w-52 { min-width: 13rem; }
.mono { font-size: calc(14px * var(--text-scale, 1)); }

/* 語意色（只給字上色） */
.tone-ok { color: var(--accent); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--danger); }
.tone-acc { color: var(--accent-2); }
.tone-mute { color: var(--text-muted); }
.tone-plain { color: var(--text); }

/* ---- 外框 ---- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.main { min-width: 0; display: flex; flex-direction: column; }
.content { padding: var(--space-6) 32px 96px; max-width: 1480px; width: 100%; margin: 0 auto; display: grid; gap: var(--space-5); align-content: start; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: var(--space-3);
  background: var(--surface-sunken);
  border-right: 1px solid var(--line);
  z-index: var(--z-side);
  padding: var(--space-5) var(--space-4);
}
.sidebar__head { display: flex; align-items: center; gap: var(--space-4); padding: 0 var(--space-3) var(--space-3); border-bottom: 1px solid var(--line); }
.sidebar__head b { display: block; font-size: calc(15px * var(--ui-scale, 1)); font-weight: 600; }
.sidebar__head small { display: block; color: var(--text-muted); font-size: calc(11px * var(--ui-scale, 1)); }
.sidebar__dot { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 60%, transparent); flex: none; }
.sidebar__nav { display: grid; gap: var(--space-2); flex: 1; align-content: start; }
.sidebar__foot { display: grid; gap: var(--space-3); padding-top: var(--space-4); border-top: 1px solid var(--line); font-size: calc(12px * var(--ui-scale, 1)); }
.sidebar__platform { margin: 0; color: var(--text-muted); }
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: 6px 10px; border-radius: var(--radius-md);
  color: var(--text-muted); text-decoration: none; font-size: calc(13px * var(--ui-scale, 1));
  transition: background var(--dur-fast), color var(--dur-fast);
}
.nav-link:hover { color: var(--text); background: color-mix(in srgb, var(--accent) 11%, transparent); }
.nav-link[aria-current="page"] { color: var(--text); background: color-mix(in srgb, var(--accent) 16%, transparent); font-weight: 600; }
.nav-link--foot { padding-left: 10px; }
.nav-group__btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between;
  background: none; border: 0; border-radius: var(--radius-md); cursor: pointer;
  padding: 6px 10px; color: var(--text); font-size: calc(12px * var(--ui-scale, 1)); letter-spacing: .06em;
}
.nav-group__btn:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.nav-group__btn .icon { transition: transform var(--dur-fast); }
.nav-group__btn[aria-expanded="false"] .icon { transform: rotate(-90deg); }
.nav-group .nav-list { padding-left: var(--space-3); }
.ident { color: var(--text-muted); }
.ident p { margin: 0; }
.ident__sub { font-size: calc(11px * var(--ui-scale, 1)); opacity: .85; overflow-wrap: anywhere; }
.actor { display: grid; gap: var(--space-1); color: var(--text-muted); }

.topbar {
  position: sticky; top: 0; z-index: var(--z-top);
  display: flex; align-items: center; gap: var(--space-5);
  min-height: 56px; padding: 0 32px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.4);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}
.topbar__title { font-size: calc(30px * var(--ui-scale, 1)); font-weight: 400; line-height: 1.2; white-space: nowrap; }
.topbar__spacer { flex: 1; }
.topbar__clock { color: var(--text-muted); font-size: calc(12px * var(--ui-scale, 1)); white-space: nowrap; }
.topbar__menu { display: inline-grid; flex: none; }
.chain-pill {
  display: inline-flex; flex-wrap: wrap; gap: 0 2px; align-items: center;
  font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted);
  padding: 2px 10px; border: 1px solid var(--line); border-radius: var(--radius-pill);
}
.update-notice {
  display: inline-flex; align-items: center; gap: var(--space-3);
  padding: 2px 4px 2px 12px; border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  font-size: calc(13px * var(--text-scale, 1)); font-weight: 600;
}
.load-state { color: var(--text-muted); margin: 0; }
.load-state--error { color: var(--danger); }
.loading { color: var(--text-muted); margin: 0; }
.error-banner { color: var(--danger); margin: 0; overflow-wrap: anywhere; }

.login-backdrop {
  position: fixed; inset: 0; z-index: var(--z-popup);
  display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
}
.login-card {
  width: min(24rem, calc(100vw - 32px)); display: grid; gap: var(--space-4);
  padding: var(--space-6); border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-pop);
}
.login-card h2 { font-size: calc(18px * var(--text-scale, 1)); font-weight: 600; }
.login-card p { margin: 0; }
.login-card__links { font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }

/* 桌面收合側欄（窄螢幕另有抽屜樣式，不受這個 class 影響） */
@media (min-width: 769px) {
  .app--collapsed { grid-template-columns: minmax(0, 1fr); }
  .app--collapsed .sidebar { display: none; }
}

@media (max-width: 768px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(var(--sidebar-w), 86vw);
    transform: translateX(-100%); transition: transform var(--dur-base) var(--ease-out);
    z-index: var(--z-input);
  }
  .sidebar--open { transform: translateX(0); box-shadow: var(--shadow-pop); }
  .topbar { padding: 0 var(--space-4); gap: var(--space-3); }
  .topbar__clock, .chain-pill { display: none; }
  .content { padding: var(--space-5) var(--space-4) 72px; }
}

/* ---- 圖示 ---- */
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- 按鈕 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 36px; padding: 7px 12px;
  background: light-dark(#e4f1f480, #173b5380);
  color: var(--text);
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; text-decoration: none; font-size: calc(13px * var(--ui-scale, 1)); line-height: 1.3;
  transition: background var(--dur-fast), border-color var(--dur-fast), scale .22s cubic-bezier(.3, 1.7, .5, 1);
}
.btn:hover { background: light-dark(#dde9ec, #23536a); border-color: var(--accent); }
.btn:active:not(:disabled) { scale: .96; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary {
  background: var(--accent); color: var(--bg); border-color: transparent; font-weight: 600;
  box-shadow: 0 6px 16px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}
.btn--primary:hover { background: var(--accent); filter: brightness(1.08); border-color: transparent; }
.btn--danger { background: var(--danger); color: var(--bg); border-color: transparent; font-weight: 600; }
.btn--danger:hover { background: var(--danger); filter: brightness(1.08); border-color: transparent; }
/* 兩段式刪除鈕按了第一下：外圈加一圈紅光，4 秒內再按才執行 */
.btn--armed { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 35%, transparent); }
/* 兩段式鈕右邊那行小字（白皮書第七節「說明 12px」）：待確認時倒數「N 秒內再按一次」，自動收回時「已取消，沒有送出」 */
.two-step__hint {
  display: inline-block; align-self: center; margin-inline-start: var(--space-2);
  font-size: calc(13px * var(--text-scale, 1)); line-height: 1.3; color: var(--text-muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.two-step__hint[data-state="armed"] { color: var(--text); font-weight: 600; }
.btn--ghost { background: transparent; border-color: transparent; }
/* 白皮書第八節：按鈕一律高 36px；小按鈕只差在左右內距較窄 */
.btn--sm { min-height: 36px; padding: 7px 10px; font-size: calc(13px * var(--ui-scale, 1)); }
.btn--block { width: 100%; }
.btn--icon { width: 40px; height: 40px; min-height: 40px; padding: 0; border-radius: var(--radius-md); color: light-dark(#1c353a, #cfe9f5); }

/* ---- 徽章 ---- */
.badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 0 8px; border-radius: var(--radius-pill);
  font-size: calc(12px * var(--ui-scale, 1)); font-weight: 700; line-height: 1.55; white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--text-muted) 45%, transparent);
  background: color-mix(in srgb, var(--text-muted) 10%, transparent);
  color: var(--text-muted);
}
.badge--wrap { white-space: normal; text-align: left; }
/* 徽章字色混 25% 主文色：白皮書第八節的混色比例直接用狀態色當字，淺色「正常／警示」、深色「錯誤」對比只有 4.2～4.3，
   混 25% 後四種狀態、深淺兩色、四種底（頁底、卡片、面板、凹槽）實算最低 4.53 */
.badge.tone-ok { border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: color-mix(in srgb, var(--accent) 75%, var(--text)); }
.badge.tone-warn { border-color: color-mix(in srgb, var(--warn) 55%, transparent); background: color-mix(in srgb, var(--warn) 14%, transparent); color: color-mix(in srgb, var(--warn) 75%, var(--text)); }
.badge.tone-bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 12%, transparent); color: color-mix(in srgb, var(--danger) 75%, var(--text)); }
.badge.tone-acc { border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); background: color-mix(in srgb, var(--accent-2) 12%, transparent); color: color-mix(in srgb, var(--accent-2) 75%, var(--text)); }
.badge.tone-plain { border-color: var(--line); background: transparent; color: var(--text); }
.code {
  font-size: calc(14px * var(--text-scale, 1)); padding: 1px 5px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--text) 7%, transparent);
  overflow-wrap: anywhere;
}
.code[data-nowrap="true"] { white-space: nowrap; overflow-wrap: normal; }
.code--inherit { color: inherit; }

/* ---- 資料卡、大數字、統計卡 ---- */
.board, .card {
  background: linear-gradient(140deg, light-dark(#fdfefef2, #16445ae8), light-dark(#f6fafbf5, #0a2035ed) 65%);
  border: 1px solid light-dark(#4d7a7f64, #5fa6c264);
  border-radius: var(--radius-lg);
  padding: 15px 18px 14px;
  box-shadow: 0 25px 40px light-dark(#15515726, #020a19aa), inset 0 1px light-dark(#06909f06, #a7f4ff1a), 8px 8px 0 light-dark(#1551570d, #0a253d88);
}
.board--bad, .tone-card--bad { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.board--warn, .tone-card--warn { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn); }
.tone-card { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); background: var(--surface); }
.board__title { font-size: calc(18px * var(--text-scale, 1)); font-weight: 500; line-height: 1.45; }
.board__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.board__action { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-left: auto; }
.board__sub { font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); margin: 2px 0 var(--space-4); }
.board__body { display: grid; gap: var(--space-4); }
.kpi { padding: var(--space-3) 0; }
.kpi__value { display: block; font-size: calc(30px * var(--text-scale, 1)); font-weight: 600; line-height: 1.1; letter-spacing: -.01em; white-space: nowrap; }
.kpi__value small { font-size: calc(16px * var(--text-scale, 1)); font-weight: 500; margin-left: 3px; }
.kpi__note { display: block; font-size: calc(13px * var(--text-scale, 1)); line-height: 1.5; margin-top: 7px; color: var(--text-muted); }
.kpi--warn .kpi__value { color: var(--warn-display); }
.kpi--ok .kpi__value { color: var(--accent-display); }
.kpi--acc .kpi__value { color: var(--accent-2-display); }
.kpi--bad .kpi__value { color: var(--danger); }
.kpi--mute .kpi__value, .kpi--plain .kpi__value { color: var(--text); }

.stats-wrap { container-type: inline-size; }
.stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
.stat {
  display: block; padding: 10px 12px; text-decoration: none; color: inherit;
  border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface);
}
.stat--link:hover { border-color: var(--text-muted); }
.stat__label { display: block; font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
/* 白皮書第三節：一張板最多 3 個大數字。3 張以內是大數字（30px／600）；4 張以上是數字帶（18px／600），不算大數字 */
.stat__value { display: block; font-size: calc(30px * var(--text-scale, 1)); line-height: 1.2; font-weight: 600; }
.stats:not([data-count="1"]):not([data-count="2"]):not([data-count="3"]) .stat__value { font-size: calc(18px * var(--text-scale, 1)); }
/* 每格角落寫資料日與出處（白皮書第二節第 06 條） */
.stat { position: relative; }
.stat__asof { display: block; font-size: calc(12px * var(--text-scale, 1)); color: var(--text-muted); text-align: right; margin-bottom: 2px; }
.stat__note { display: block; font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }

.progress { height: 6px; border-radius: var(--radius-pill); background: color-mix(in srgb, var(--text) 10%, transparent); overflow: hidden; margin: 4px 0; min-width: 4rem; }
.progress__bar { height: 100%; border-radius: var(--radius-pill); background: var(--accent); }

/* ---- 分頁、視角切換 ---- */
.tabs { display: flex; gap: 2px; background: var(--surface-sunken); padding: 6px 6px 0; border-radius: 10px 10px 0 0; overflow-x: auto; }
.tabs__tab { border: 0; background: transparent; color: var(--text-muted); padding: 8px 14px; border-radius: 10px 10px 0 0; cursor: pointer; font-size: calc(13px * var(--ui-scale, 1)); white-space: nowrap; transition: background var(--dur-fast); }
.tabs__tab:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
.tabs__tab[aria-selected="true"] { background: light-dark(#fff, #08243a); color: var(--text); }
.tabs__panel { background: light-dark(#fff, #08243a); border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; padding: 14px 16px; }

.view-switch {
  position: relative; display: inline-grid; padding: 4px; border-radius: var(--radius-pill); isolation: isolate;
  background: light-dark(#cfe1e5b3, #05172699);
  border: 1px solid light-dark(#ffffffb3, #70b5cc33);
  box-shadow: inset 0 1px 3px light-dark(#2250541f, #00000066), 0 1px 0 light-dark(#ffffffcc, #ffffff0d);
}
.view-switch--n2 { grid-template-columns: repeat(2, 1fr); }
.view-switch--n3 { grid-template-columns: repeat(3, 1fr); }
.view-switch--n4 { grid-template-columns: repeat(4, 1fr); }
.view-switch::before {
  content: ""; position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 4px;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 30% 15%, light-dark(#ffffff, #75d6ea73), light-dark(#f3fbf9, #08618bb3) 50%, light-dark(#ddf2ee, #0a2f4d));
  border: 1px solid light-dark(#00a39a80, #79e9ff8c);
  box-shadow: 0 3px 10px -3px light-dark(#22505452, transparent), 0 0 18px light-dark(#0eb4a938, #3ca9ee59), inset 0 1px 0 light-dark(#ffffff, #ffffff26);
  transition: transform .45s var(--ease-emph);
}
.view-switch--n2::before { width: calc((100% - 8px) / 2); }
.view-switch--n3::before { width: calc((100% - 8px) / 3); }
.view-switch--n4::before { width: calc((100% - 8px) / 4); }
.view-switch:has([data-i="1"][aria-selected="true"])::before { transform: translateX(100%); }
.view-switch:has([data-i="2"][aria-selected="true"])::before { transform: translateX(200%); }
.view-switch:has([data-i="3"][aria-selected="true"])::before { transform: translateX(300%); }
.view-switch button {
  position: relative; z-index: 1; height: 32px; min-width: 64px; padding: 0 16px;
  border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--text-muted);
  letter-spacing: .08em; cursor: pointer; transition: color .3s var(--ease-emph);
}
.view-switch button[aria-selected="true"] { color: light-dark(var(--accent), var(--text)); font-weight: 700; }

/* ---- 表格 ---- */
.table-wrap { overflow-x: auto; max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: calc(13px * var(--ui-scale, 1)); }
.table th {
  height: 40px; padding: 0 14px; text-align: left; font-size: calc(13px * var(--ui-scale, 1)); font-weight: 600; letter-spacing: .04em;
  color: var(--text-muted); white-space: nowrap;
  background: color-mix(in srgb, var(--surface-sunken) 45%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}
.table td { height: 48px; padding: 6px 14px; vertical-align: middle; border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.table--wrap td { white-space: normal; vertical-align: top; }
.table--wrap[data-valign="middle"] td { vertical-align: middle; }
.table tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.wrap-note { min-width: 6rem; white-space: normal; }
.wrap-text { min-width: 9rem; white-space: normal; }
.wrap-long { min-width: 14rem; white-space: normal; }
.th-sort { background: none; border: 0; cursor: pointer; font-weight: 600; letter-spacing: inherit; color: inherit; padding: 0; }
.th-sort__mark { margin-left: 4px; font-size: calc(10px * var(--ui-scale, 1)); }
.table td.actions { white-space: nowrap; }
.actions--pinned { position: sticky; right: 0; background: var(--surface); }
.row-expandable { cursor: pointer; }
.pager { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-3) 0; justify-content: flex-end; }
.pager__info { color: var(--text-muted); font-size: calc(12px * var(--ui-scale, 1)); }
.cell-empty { color: var(--text-muted); font-size: calc(14px * var(--text-scale, 1)); margin: var(--space-3) 0; }
.sub { font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
.sub--mono { font-family: var(--font-mono); }
.tags { display: inline-flex; flex-wrap: wrap; gap: var(--space-1); }
.key-values { margin: 0; display: grid; gap: var(--space-2); }
.key-values__row { display: flex; gap: var(--space-4); }
.key-values dt { width: 9rem; flex: none; color: var(--text-muted); }
.key-values dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.metrics-cell { min-width: 8rem; }
.event-summary { min-width: 16rem; font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); overflow-wrap: anywhere; }

/* ---- 事件列表（白皮書） ---- */
.event-list { list-style: none; margin: 0; padding: 0; width: 100%; }
.event-list li { display: grid; grid-template-columns: 4.2em 1fr; gap: var(--space-4); padding: 10px 0; border-bottom: 1px solid var(--line); }
.event-list time { color: var(--warn); font-size: calc(16px * var(--text-scale, 1)); font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.5; }
.event-list b { display: block; font-size: calc(16px * var(--text-scale, 1)); font-weight: 600; line-height: 1.5; }
.event-list em { display: block; font-style: normal; font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
.event-list p { margin: 2px 0; font-size: calc(14px * var(--text-scale, 1)); }
.event-list small { font-size: calc(12px * var(--text-scale, 1)); color: color-mix(in srgb, var(--text-muted) 80%, transparent); }

/* ---- 表單 ---- */
.field { display: grid; gap: var(--space-2); }
.field__label { color: var(--text-muted); font-size: calc(14px * var(--text-scale, 1)); }
.input {
  height: 42px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  width: 100%; min-width: 0;
}
.input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input:disabled { opacity: .55; }
.textarea { height: auto; min-height: 5rem; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.textarea--mono { font-family: var(--font-mono); font-size: calc(14px * var(--text-scale, 1)); }
.textarea--auto { max-height: 24rem; field-sizing: content; }
.textarea--tall { height: 420px; }
.select { cursor: pointer; }
.file-input { height: auto; padding: 8px 12px; }
.outcome { margin: 0; font-size: calc(14px * var(--text-scale, 1)); overflow-wrap: anywhere; }
.outcome--error { color: var(--danger); }
.outcome--ok { color: var(--accent); }
.hint { margin: 0; font-size: calc(14px * var(--text-scale, 1)); color: var(--text-muted); }
.hint--warn { color: var(--warn); }
.json-error { color: var(--danger); font-size: calc(14px * var(--text-scale, 1)); }
.json-error p { margin: 0; }
.json-error__detail { font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
.check { display: inline-flex; align-items: center; gap: var(--space-3); cursor: pointer; }
.radio-group { display: grid; gap: var(--space-3); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; background: none; border: 0; padding: 0; font-size: calc(14px * var(--text-scale, 1)); }
.switch:disabled { opacity: .55; cursor: not-allowed; }
.switch__track {
  position: relative; width: 48px; height: 22px; border-radius: var(--radius-pill);
  background: light-dark(#c9dbe0, #0c2a3f); box-shadow: inset 0 1px 3px light-dark(#2250541f, #00000066);
  transition: background var(--dur-base);
}
.switch__track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px var(--shadow-color);
  transition: transform var(--dur-base) var(--ease-out);
}
.switch[aria-checked="true"] .switch__track { background: var(--accent); }
.switch[aria-checked="true"] .switch__track::after { transform: translateX(26px); }

.combo { position: relative; width: 20rem; max-width: 100%; }
.combo__list {
  position: absolute; z-index: var(--z-popup); left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: var(--space-2); list-style: none; max-height: 16rem; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop);
}
.combo__opt, .combo__empty { padding: 7px 10px; border-radius: var(--radius-md); cursor: default; }
.combo__opt--hi, .combo__opt:hover { background: color-mix(in srgb, var(--accent) 11%, transparent); }
.combo__empty { color: var(--text-muted); }

/* ---- 對話框、彈出選單、toast ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: var(--z-popup);
  display: grid; place-items: center; padding: var(--space-5);
  background: color-mix(in srgb, var(--bg) 70%, #000 30%);
}
.modal {
  width: min(36rem, 100%); max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop);
}
.modal--wide { width: min(48rem, 100%); }
.modal:focus { outline: 0; }
.modal__head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-4); padding: var(--space-5) var(--space-5) var(--space-3); }
.modal__title { font-size: calc(18px * var(--text-scale, 1)); font-weight: 500; }
.modal__desc { margin: 2px 0 0; color: var(--text-muted); font-size: calc(14px * var(--text-scale, 1)); }
.modal__close { background: none; border: 0; font-size: calc(18px * var(--text-scale, 1)); line-height: 1; cursor: pointer; color: var(--text-muted); padding: 0 4px; }
.modal__body { padding: var(--space-3) var(--space-5) var(--space-5); overflow-y: auto; display: grid; gap: var(--space-4); min-height: 0; }
.modal__foot { display: flex; justify-content: flex-end; gap: var(--space-3); padding: var(--space-4) var(--space-5); border-top: 1px solid var(--line); }
.reason-form__row { display: flex; gap: var(--space-3); }
.reason-form__input { flex: 1; }

.popover-wrap { position: relative; display: inline-block; }
.menu {
  inset: auto; margin: 0; min-width: 220px; padding: var(--space-2);
  border-radius: var(--radius-xl); font-size: calc(13px * var(--ui-scale, 1)); color: var(--text);
  border: 1px solid light-dark(#4d7a7f66, #8fd3ea3d);
  background: light-dark(linear-gradient(145deg, #ffffffb8, #eaf4f78f 72%), linear-gradient(145deg, #1d4d66b8, #0a2035cc 72%));
  backdrop-filter: blur(22px) saturate(1.8);
  -webkit-backdrop-filter: blur(22px) saturate(1.8);
  box-shadow: 0 26px 48px -10px light-dark(#15515742, #020a19c7), 0 2px 8px light-dark(#15515714, #02101d66);
}
.menu__item {
  width: 100%; height: 36px; display: flex; align-items: center; gap: var(--space-3); padding: 0 10px;
  background: none; border: 0; border-radius: var(--radius-md); cursor: pointer; text-align: left; color: inherit;
}
.menu__item:hover { background: color-mix(in srgb, var(--accent) 11%, transparent); }
.menu__item--danger:hover { background: light-dark(#d22c4729, #4a1f2233); color: var(--danger); }
.menu__sep { border: 0; border-top: 1px solid var(--line); margin: 4px 2px; }

.toast-host { position: fixed; right: var(--space-5); bottom: var(--space-5); z-index: var(--z-popup); display: grid; gap: var(--space-3); max-width: min(26rem, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: flex-start; gap: var(--space-3); padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); font-size: calc(13px * var(--ui-scale, 1));
}
.toast[data-kind="ok"] { border-left-color: var(--accent); }
.toast[data-kind="err"] { border-left-color: var(--danger); }
.toast[data-kind="info"] { border-left-color: var(--accent-2); }
.toast__text { flex: 1; overflow-wrap: anywhere; max-height: 40vh; overflow-y: auto; }
.toast__close { background: none; border: 0; cursor: pointer; color: var(--text-muted); font-size: calc(18px * var(--ui-scale, 1)); line-height: 1; padding: 0; }

.empty-state { padding: var(--space-6) var(--space-4); text-align: center; color: var(--text-muted); }
.empty-state__title { margin: 0; font-size: calc(15px * var(--text-scale, 1)); }
.empty-state__hint { margin: var(--space-2) 0 0; font-size: calc(13px * var(--text-scale, 1)); }

.part-error { margin: 0; }
.part-error--block { font-size: calc(14px * var(--text-scale, 1)); }

/* ---- 摺疊、區塊 ---- */
.fold { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.fold__summary { cursor: pointer; padding: 10px 14px; font-size: calc(14px * var(--text-scale, 1)); font-weight: 500; }
.fold[open] > .fold__summary { border-bottom: 1px solid var(--line); }
.fold__note { font-weight: 400; color: var(--text-muted); }
.fold__body { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding: 8px 14px 12px; }
.peek { font-size: calc(14px * var(--text-scale, 1)); }
.peek__summary { cursor: pointer; color: var(--accent-2); }
.peek__note { color: var(--text-muted); margin-left: var(--space-3); }
.json-block, .md-pre {
  max-height: 24rem; overflow: auto; margin: 0; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunken);
  font-family: var(--font-mono); font-size: calc(14px * var(--text-scale, 1)); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere;
}
.json-peek { margin-top: 4px; min-width: 16rem; }
.audit-out { margin: 4px 0; padding-left: 1.2em; }
.diff__title { font-size: calc(14px * var(--text-scale, 1)); font-weight: 600; }
.diff__lines { font-family: var(--font-mono); font-size: calc(14px * var(--text-scale, 1)); white-space: pre-wrap; }
.diff__line--add { color: var(--accent); }
.diff__line--del { color: var(--danger); text-decoration: line-through; }

.text-link { color: var(--accent-2); text-underline-offset: 4px; }
.text-link:hover { text-decoration: underline; }
.text-link--mono { font-family: var(--font-mono); font-size: calc(14px * var(--text-scale, 1)); }
.page-heading { font-size: calc(18px * var(--text-scale, 1)); font-weight: 500; }
.page-heading__note { font-weight: 400; font-size: calc(14px * var(--text-scale, 1)); color: var(--text-muted); }
.page-heading__note--mono { font-family: var(--font-mono); font-size: calc(13px * var(--text-scale, 1)); }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; font-size: calc(14px * var(--text-scale, 1)); }
.breadcrumbs__sep { margin-left: var(--space-2); color: var(--text-muted); }
.prevnext { display: flex; gap: var(--space-4); }
.prevnext--spread .prevnext__slot { flex: 1; min-width: 0; }
.prevnext__slot--end { text-align: right; }
.prevnext__link { display: inline-flex; gap: var(--space-2); max-width: 100%; color: var(--accent-2); text-decoration: none; }
.prevnext__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secret-once { display: grid; gap: var(--space-3); }
.secret-once pre { margin: 0; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunken); font-family: var(--font-mono); font-size: calc(14px * var(--text-scale, 1)); overflow-wrap: anywhere; white-space: pre-wrap; }
.copy-action { display: inline-flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.copy-action__status { color: var(--text-muted, inherit); font-size: calc(14px * var(--text-scale, 1)); }
.token-result { display: grid; gap: var(--space-3); }
.dataset-table__bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; margin-bottom: var(--space-4); }
.dataset-table__filters { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.dataset-table__search { width: 15rem; }

/* ---- Markdown ---- */
.markdown { display: grid; gap: var(--space-4); font-size: calc(15px * var(--text-scale, 1)); line-height: 1.7; }
.markdown p, .markdown ul, .markdown ol { margin: 0; }
.md-h2 { font-size: calc(18px * var(--text-scale, 1)); font-weight: 600; }
.md-h3 { margin-top: var(--space-4); font-size: calc(13px * var(--text-scale, 1)); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--text-muted); }
.md-h4 { margin-top: var(--space-2); font-size: calc(16px * var(--text-scale, 1)); font-weight: 600; }
.md-h5 { font-size: calc(15px * var(--text-scale, 1)); font-weight: 600; }
.md-p { max-width: 42rem; }
.md-p--lead { max-width: 48rem; font-size: calc(18px * var(--text-scale, 1)); line-height: 1.7; }
.md-ul, .md-ol { padding-left: 1.5rem; display: grid; gap: var(--space-2); max-width: 42rem; }
.strong { font-weight: 600; }
/* 章節裡單獨一行的圖：寬度不超過內文欄，高度依比例；說明文字放圖下方 */
.md-figure { margin: var(--space-5) 0; }
.md-figure__img { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.md-figure__cap { margin-top: var(--space-2); color: var(--text-muted); font-size: calc(14px * var(--text-scale, 1)); }
.md-callout {
  display: grid; gap: var(--space-3); padding: 10px 16px;
  border-left: 4px solid var(--text-muted); border-radius: 0 var(--radius-md) var(--radius-md) 0;
  background: var(--surface-sunken);
}
.md-callout--warn { border-left-color: var(--warn); }
.md-callout--decide { border-left-color: var(--accent-2); }
.md-callout__title { font-size: calc(13px * var(--text-scale, 1)); letter-spacing: .12em; }
.md-callout--warn .md-callout__title { color: var(--warn); }
.md-callout--decide .md-callout__title { color: var(--accent-2); }
/* 名詞解釋 [[詞|解釋]]：詞下方細點狀底線；泡泡是原生 popover（在最上層，位置由程式量詞的位置設） */
.md-term {
  text-decoration: underline dotted; text-decoration-thickness: 1px; text-underline-offset: 4px;
  text-decoration-color: color-mix(in srgb, var(--accent) 75%, transparent);
  cursor: help; border-radius: var(--radius-sm);
}
.md-term:hover { text-decoration-color: var(--accent); }
.md-term__tip {
  position: fixed; inset: auto; margin: 0;
  width: max-content; max-width: min(20rem, calc(100vw - 16px));
  padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius-md);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
  font-size: 13px; font-weight: 400; line-height: 1.6; text-align: left;
  white-space: normal; overflow-wrap: anywhere;
}

/* ---- 架構圖 ---- */
.arch { width: 100%; max-width: 56rem; height: auto; color: var(--text-muted); }
.arch-box { fill: var(--surface); stroke: var(--text-muted); stroke-width: 1.2; }
.arch-box--dashed { stroke-dasharray: 5 4; fill: transparent; }
.arch-box--accent { fill: color-mix(in srgb, var(--accent) 10%, transparent); stroke: var(--accent-2); }
.arch a:hover .arch-box--link, .arch a:focus-visible .arch-box--link { stroke: var(--accent-2); stroke-width: 2; }
.arch-name { fill: var(--text); font-size: calc(14px * var(--text-scale, 1)); font-weight: 700; }
.arch a:hover .arch-name { fill: var(--accent-2); }
.arch-desc { fill: color-mix(in srgb, var(--text) 70%, transparent); font-size: calc(10px * var(--text-scale, 1)); }
.arch-line { fill: none; stroke: var(--text-muted); stroke-width: 1.4; }
.arch-line--dash { stroke-dasharray: 4 3; }
.arch-line--dot { stroke-dasharray: 1.5 3; stroke-linecap: round; }
.arch-legend { fill: var(--text-muted); font-size: calc(12px * var(--text-scale, 1)); }

/* ---- 設定頁 ---- */
.settings { display: grid; gap: var(--space-5); max-width: 48rem; }
.version-choices { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.version-choice { padding: var(--space-3) var(--space-4); border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.version-choice__ver { margin-left: var(--space-3); color: var(--text-muted); }
.version-choice__note { display: block; color: var(--text-muted); font-size: calc(13px * var(--text-scale, 1)); margin-left: 0; }
.settings__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); margin-top: var(--space-4); }
/* 功能開關（最高管理者）：一列一個開關，名稱、狀態、最後修改、切換鈕 */
.feature-flags { display: grid; gap: var(--space-4); }
.feature-flag { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4); }
.feature-flag__title { min-width: 12em; }

/* ---- 統計卡的欄數（容器查詢；由 components/board.rs 的 balanced_columns 算出，8 張 4+4、7 張 4+3） ---- */
@container (min-width: 320px) {
  .stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="3"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="5"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="6"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="7"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="8"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="9"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="10"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="11"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="12"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="13"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="14"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="15"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="16"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 512px) {
  .stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="4"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="7"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="8"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="10"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="11"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="12"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="13"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="14"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="15"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="16"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@container (min-width: 672px) {
  .stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="5"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="7"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="9"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="10"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="11"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="12"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="13"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="14"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="15"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="16"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (min-width: 896px) {
  .stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="7"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="9"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="11"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="12"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="13"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="14"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="15"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="16"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@container (min-width: 1024px) {
  .stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="7"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="9"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="11"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="12"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="13"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="14"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="15"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="16"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@container (min-width: 1152px) {
  .stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="7"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .stats[data-count="8"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="9"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="11"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="12"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="13"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .stats[data-count="14"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .stats[data-count="15"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="16"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@container (min-width: 1280px) {
  .stats[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats[data-count="4"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats[data-count="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="7"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .stats[data-count="8"] { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .stats[data-count="9"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="10"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .stats[data-count="11"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="12"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .stats[data-count="13"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .stats[data-count="14"] { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .stats[data-count="15"] { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .stats[data-count="16"] { grid-template-columns: repeat(8, minmax(0, 1fr)); }
}

/* ---- 進度條寬度（每 5% 一階；頁面禁止行內 style，所以用類別） ---- */
.pw-0 { width: 0%; }
.pw-1 { width: 5%; }
.pw-2 { width: 10%; }
.pw-3 { width: 15%; }
.pw-4 { width: 20%; }
.pw-5 { width: 25%; }
.pw-6 { width: 30%; }
.pw-7 { width: 35%; }
.pw-8 { width: 40%; }
.pw-9 { width: 45%; }
.pw-10 { width: 50%; }
.pw-11 { width: 55%; }
.pw-12 { width: 60%; }
.pw-13 { width: 65%; }
.pw-14 { width: 70%; }
.pw-15 { width: 75%; }
.pw-16 { width: 80%; }
.pw-17 { width: 85%; }
.pw-18 { width: 90%; }
.pw-19 { width: 95%; }
.pw-20 { width: 100%; }

/* ---- 頁面版面通用類別（lay- 開頭；兩頁以上共用的才放這裡，單頁專用的放 pages-<頁>.css） ---- */
.lay-page { display: grid; gap: var(--space-5); min-width: 0; grid-template-columns: minmax(0, 1fr); align-content: start; }
.lay-page > *, .lay-page .board, .lay-page .card, .lay-page .board__body { min-width: 0; }
.lay-page .board__body { grid-template-columns: minmax(0, 1fr); }
.lay-stack { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); }
.lay-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.lay-row--between { justify-content: space-between; }
.lay-row--end { justify-content: flex-end; }
.lay-h3 { font-size: calc(15px * var(--text-scale, 1)); font-weight: 600; margin: 0; }
.token-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--space-2); }
.token-codes__item { align-items: flex-start; }

/* Skill 市集詳情：SKILL.md 開頭 front matter 的名稱與說明 */
.skill-meta { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; margin: 0 0 12px; padding: 8px 12px; background: var(--surface-2, rgba(127,127,127,.08)); border-radius: 6px; }
.skill-meta dt { color: var(--muted, #888); }
.skill-meta dd { margin: 0; }

/* ---- 文字大小與閱讀字級（戰情室決策平台 2026-10-18 起的做法；白皮書第七章） ----
 * 內文與說明比最早的原型大一階；字級一律寫成 calc(Npx * var(--text-scale, 1))，
 * 選單、側欄、按鈕、頁首這類介面零件寫 var(--ui-scale, 1)，只放大一半。
 * 使用者在「設定」選文字大小，<html data-text> 換倍率，全站一起變。 */
:root {
  --text-scale: 1;
  --ui-scale: calc(1 + (var(--text-scale) - 1) * .5);
  --fs-xs: calc(13px * var(--text-scale));
  --fs-sm: calc(14px * var(--text-scale));
  --fs-body: calc(15px * var(--text-scale));
  --fs-md: calc(16px * var(--text-scale));
  --fs-lg: calc(17px * var(--text-scale));
  --fs-xl: calc(18px * var(--text-scale));
}
:root[data-text="large"] { --text-scale: 1.15; }
:root[data-text="larger"] { --text-scale: 1.3; }
:root[data-text="xlarge"] { --text-scale: 1.5; }

/* ---- 提醒的三種長相（白皮書第八章）----
 * 灰色 ✦＝AI 寫的字，只告訴來源、不用處理；黃色 ⚠＋短字＝用之前要小心（內參、待確認）；灰色虛線＝資料限制，是說明的一部分。 */
.ai-mark {
  position: relative; display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; margin-right: .3em;
  border-radius: 50%; color: color-mix(in oklab, var(--text-muted) 90%, transparent); font-weight: 400; line-height: 1; cursor: help;
  transition: color var(--dur-fast) ease-out, background-color var(--dur-fast) ease-out;
}
.ai-mark:hover, .ai-mark:focus-visible { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.ai-mark:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ai-mark::after, .hover-tip::after {
  content: attr(data-tip); position: absolute; z-index: var(--z-popup); left: 0; bottom: calc(100% + 6px);
  width: max-content; max-width: min(280px, calc(100vw - 32px)); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--surface); color: var(--text); font-size: calc(13px * var(--ui-scale, 1)); line-height: 1.55; text-align: left; pointer-events: none;
  box-shadow: 0 14px 30px -12px var(--shadow-color), 0 2px 6px -2px var(--shadow-color); opacity: 0; visibility: hidden;
}
.ai-mark:hover::after, .ai-mark:focus-visible::after, .hover-tip:hover::after, .hover-tip:focus-visible::after { opacity: 1; visibility: visible; }
@media (prefers-reduced-motion: no-preference) { .ai-mark::after, .hover-tip::after { transition: opacity var(--dur-fast) ease-out; } }
.ask-answer__who { display: flex; align-items: center; margin: var(--space-4) 0 var(--space-1); color: var(--text-muted); font-size: calc(13px * var(--text-scale, 1)); font-weight: 600; letter-spacing: .04em; }
.data-limit {
  margin: 14px 0 0; padding: 1px 0 1px 12px; border-left: 2px dashed color-mix(in oklab, var(--text-muted) 55%, transparent);
  color: var(--text-muted); font-size: calc(14px * var(--text-scale, 1)); line-height: 1.7;
}

/* ---- 對話框：圓角加大、背後蓋模糊（照戰情室個人設定視窗：圓角 18、遮罩模糊 6） ---- */
.modal-backdrop { background: color-mix(in oklab, var(--bg) 50%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal { border-radius: 18px; box-shadow: 0 40px 90px -30px var(--shadow-color), 0 2px 10px -4px var(--shadow-color); }

/* ⓘ：說明收在滑過才出現的小框，版面上不留說明文字 */
.hover-tip {
  position: relative; display: inline-grid; place-items: center; width: 1.3em; height: 1.3em; margin-left: .35em; vertical-align: middle;
  border-radius: 50%; color: var(--text-muted); font-size: calc(13px * var(--ui-scale, 1)); font-weight: 400; line-height: 1; cursor: help;
  transition: color var(--dur-fast) ease-out, background-color var(--dur-fast) ease-out;
}
.hover-tip:hover, .hover-tip:focus-visible { color: var(--accent); background: color-mix(in oklab, var(--accent) 12%, transparent); }
.hover-tip:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---- 摺疊：箭頭轉向、滑過有底色、展開時內容淡入（讓人一眼知道「這裡可以點開」） ---- */
.fold__summary { position: relative; display: flex; align-items: baseline; gap: 8px; list-style: none; border-radius: var(--radius-lg); transition: background-color var(--dur-fast) ease-out; }
.fold__summary::-webkit-details-marker { display: none; }
.fold__summary::before {
  content: ""; flex: none; align-self: center; width: 7px; height: 7px; border-right: 2px solid var(--text-muted); border-bottom: 2px solid var(--text-muted);
  transform: rotate(-45deg); transition: transform var(--dur-base) var(--ease-out), border-color var(--dur-fast);
}
.fold__summary:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.fold__summary:hover::before { border-color: var(--accent); }
.fold[open] > .fold__summary::before { transform: rotate(45deg); }
.fold[open] > .fold__summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
@media (prefers-reduced-motion: no-preference) { .fold[open] > .fold__body { animation: fold-in .22s var(--ease-out); } @keyframes fold-in { from { opacity: 0; translate: 0 -4px; } } }

/* ---- 大量留白與白（照戰情室的 .ambience 氛圍底）----
 * 淺色：近白的底、左上一團白光、右下一點淡薄荷，不是整片青灰綠；卡片、側欄、頁首都是白的或半透明白，強調青色只留給按鈕與選中的小記號。
 * 深色：深海軍藍底加一團青藍光暈。 */
body {
  background:
    radial-gradient(ellipse at 45% 12%, light-dark(#ffffffd9, #26647b66), transparent 63%),
    radial-gradient(ellipse at 90% 85%, light-dark(#c9efe84d, #1c477e44), transparent 55%),
    linear-gradient(135deg, light-dark(#f1f8f9, #0a1b2e), light-dark(#e8f2f4, #102d46));
  background-attachment: fixed;
}
.sidebar {
  background: light-dark(#ffffffb8, #08243a99);
  -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2);
}
.topbar { background: light-dark(#ffffff8c, #08243a8c); }
.nav-link:hover { background: light-dark(#ffffff99, #ffffff12); }
.nav-link[aria-current="page"] {
  background: light-dark(#ffffff, #ffffff1a); color: var(--text); font-weight: 600;
  box-shadow: 0 1px 3px var(--shadow-color), inset 3px 0 0 var(--accent);
}
.nav-group__btn:hover { background: light-dark(#ffffff99, #ffffff12); }

/* 分段鈕：中性軌道＋一顆白色滑塊（同戰情室個人設定），不再有青色發光框 */
.view-switch { background: color-mix(in oklab, var(--text-muted) 20%, transparent); border-color: transparent; box-shadow: none; }
.view-switch::before {
  background: light-dark(#ffffff, #ffffff26); border: 0;
  box-shadow: 0 1px 3px var(--shadow-color), 0 0 0 .5px color-mix(in oklab, var(--text) 10%, transparent);
  transition: transform .25s var(--ease-out);
}
.settings__row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-5); flex-wrap: wrap; }
.settings__row + .settings__row { margin-top: var(--space-4); }
.settings__label { font-size: calc(15px * var(--text-scale, 1)); font-weight: 500; }

/* ---- 驗測題庫（bank）類型分組與四欄卡樣式 ---- */
.bank-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  margin-bottom: var(--space-2);
}
.bank-filter-bar__type {
  min-width: 12rem;
  max-width: 18rem;
}
.bank-filter-bar__search {
  flex: 1;
  min-width: 14rem;
}

.bank-group {
  margin-bottom: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  overflow: hidden;
}
.bank-group__summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  cursor: pointer;
  user-select: none;
  font-weight: 500;
  border-bottom: 1px solid transparent;
  transition: background-color var(--dur-fast);
}
.bank-group[open] > .bank-group__summary {
  border-bottom-color: var(--line);
}
.bank-group__summary:hover {
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}
.bank-group__title {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.bank-group__name {
  font-weight: 600;
  font-size: var(--fs-md);
  color: var(--text);
}
.bank-group__desc {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  font-weight: normal;
}
.bank-group__badge {
  color: var(--text-muted);
  font-size: var(--fs-xs);
  margin-left: auto;
}
.bank-group__pass {
  color: var(--accent);
  font-weight: 600;
  margin-left: var(--space-2);
}

.bank-table__card-btn {
  margin-top: var(--space-2);
}

.bank-card-row {
  background: color-mix(in srgb, var(--accent) 2%, var(--surface));
}
.bank-card-cell {
  padding: var(--space-2) var(--space-3) var(--space-4);
}
.bank-card {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}
@media (max-width: 768px) {
  .bank-card {
    grid-template-columns: minmax(0, 1fr);
  }
}
.bank-card__part {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--text-muted) 3%, var(--surface));
  min-width: 0;
}
.bank-card__label {
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.bank-card__content {
  font-size: var(--fs-sm);
  line-height: 1.6;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.bank-card__gist {
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.6;
  color: var(--text);
  word-break: break-word;
}
.bank-card__ref-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.bank-card__empty-ref {
  margin: 0;
}
.bank-card__outline {
  margin: 0;
  padding-left: 1.25rem;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--text);
}
.bank-card__criteria-preview {
  margin: 0;
  font-size: var(--fs-xs);
  line-height: 1.6;
  color: var(--text-muted);
}

.bank-form__new-type {
  margin-top: var(--space-2);
  padding: var(--space-3);
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--accent) 3%, var(--surface));
  display: grid;
  gap: var(--space-2);
}

/* 提問頁（#/ask）專用版面。類別一律 ask- 開頭；顏色只拿 tokens.css 的變數 */
.ask-page { display: grid; gap: var(--space-5); min-width: 0; }
.ask-page > * { min-width: 0; }
.ask-page__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.ask-answer { display: grid; gap: var(--space-4); }
.ask-answer__text { line-height: 1.7; overflow-wrap: anywhere; white-space: pre-wrap; }
.ask-answer__section { display: grid; gap: var(--space-3); }
.ask-answer__title { font-size: calc(15px * var(--text-scale, 1)); font-weight: 500; }
.ask-page__scope { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); margin-top: var(--space-3); }
.ask-page__scope > p { flex-basis: 100%; margin: 0; font-size: calc(13px * var(--text-scale, 1)); }
.ask-page__zones { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin: 0; padding: 0; border: 0; }
.ask-page__zones > legend { float: left; margin-right: var(--space-3); padding: 0; font-weight: 600; }

/* 等答案：流動細線＋已等秒數 */
.ask-wait { display: grid; gap: var(--space-3); }
.ask-wait__bar { position: relative; display: block; height: 3px; border-radius: 3px; overflow: hidden; background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ask-wait__bar::after { content: ""; position: absolute; inset: 0 auto 0 -35%; width: 35%; border-radius: 3px; background: var(--accent); animation: ask-wait-flow 1.4s var(--ease-out) infinite; }
.ask-wait__secs { color: var(--text-muted); font-variant-numeric: tabular-nums; }
@keyframes ask-wait-flow { to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .ask-wait__bar::after { animation: none; inset: 0; width: 100%; opacity: .4; } }
/* 驗測題庫（#/bank）：給 PM 用的題庫頁 */
.bank-table__reason { display: block; margin-top: var(--space-1); }
.bank-table__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); min-width: 11rem; }
.bank-results { display: grid; gap: var(--space-4); }
.bank-result { border-top: 1px solid var(--line); padding-top: var(--space-4); display: grid; gap: var(--space-2); }
.bank-result:first-child { border-top: 0; padding-top: 0; }
.bank-result__head { margin: 0; font-size: calc(16px * var(--text-scale, 1)); font-weight: 600; }
.bank-result__question { font-weight: 400; }
.bank-result__reasons { margin: 0; padding-left: 1.2em; }
.bank-result__answer { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.bank-result__hits { margin: 0; padding-left: 1.4em; font-size: calc(14px * var(--text-scale, 1)); }
.bank-form { display: grid; gap: var(--space-2); }
.bank-form > .sub, .bank-form .fold__body > .sub { margin: 0 0 var(--space-3); }
.bank-form__find { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(10rem, 1fr) minmax(8rem, 1fr) auto; gap: var(--space-3); align-items: end; padding-bottom: var(--space-3); border-bottom: 1px solid var(--line); }
@media (max-width: 768px) {
  .bank-form__find { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .bank-table__actions { min-width: 0; }
  /* 窄視窗：表格改成一題一張卡，每格前面寫欄名 */
  .bank-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bank-table, .bank-table tbody, .bank-table tr, .bank-table td { display: block; width: 100%; }
  .bank-table tr { padding: var(--space-3) 0; border-bottom: 1px solid var(--line); }
  .bank-table td { height: auto; padding: var(--space-1) 0; border-bottom: 0; white-space: normal; }
  .bank-table td[data-label]::before { content: attr(data-label); display: block; font-size: calc(12px * var(--ui-scale, 1)); color: var(--text-muted); }
}
.bank-table__machine { display: block; margin-top: var(--space-1); }
.bank-result__hint { margin: 0; }
/* 儀表板頁（#/dashboard）專用版面。類別一律 dash- 開頭；顏色只拿 tokens.css 的變數 */
.dash-wrap { container-type: inline-size; }
.dash-grid { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
.dash-grid > * { min-width: 0; }
@container (min-width: 56rem) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-grid > :last-child { grid-column: span 2; }
}
/* 資料集頁（#/data/*）的版面。只給 src/pages/data 用，類別一律 data- 開頭；顏色只拿 tokens.css 的變數 */
.data-stack { display: grid; gap: var(--space-4); min-width: 0; }
.data-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); }
.data-bar__end { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.data-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.data-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.data-row--center { align-items: center; }
.data-grid2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
@media (min-width: 1024px) { .data-grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.data-w-24 { width: 6rem; }
.data-w-32 { width: 8rem; }
.data-w-36 { width: 9rem; }
.data-w-40 { width: 10rem; }
.data-w-48 { width: 12rem; }
.data-w-56 { width: 14rem; }
.data-w-64 { width: 16rem; }
.data-w-72 { width: 18rem; }
.data-w-80 { width: 20rem; }
.data-grow { flex: 1; min-width: 18rem; }
.data-flex1 { flex: 1; min-width: 0; }
.data-block { display: grid; gap: var(--space-3); min-width: 0; }
.data-note { font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
.data-summary { margin: 0; font-size: calc(15px * var(--text-scale, 1)); line-height: 1.6; overflow-wrap: anywhere; }
.data-pre {
  margin: 0; font-family: var(--font-mono, ui-monospace, monospace); font-size: calc(13px * var(--text-scale, 1)); line-height: 1.5;
  white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow: auto;
}
.data-edit-area { height: 24rem; font-family: var(--font-mono, ui-monospace, monospace); font-size: calc(13px * var(--text-scale, 1)); resize: vertical; width: 100%; }
.data-inline-list { margin: 0; padding-left: 1.2rem; }

/* 並排審閱（#/data/proof/<output_id>）：左原文件、右系統讀出來的文字；窄螢幕上下排 */
.proof-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.proof-key {
  margin-left: var(--space-2); padding: 0 5px; border: 1px solid currentColor; border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: calc(11px * var(--ui-scale, 1)); opacity: .75;
}
.proof-progress { font-weight: 600; font-variant-numeric: tabular-nums; }
.proof-hint { font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
.proof-jump { display: inline-flex; align-items: center; gap: var(--space-2); font-variant-numeric: tabular-nums; }
.proof-jump__input { width: 5rem; }
.proof-pages { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.proof-pages__btn {
  min-width: 36px; height: 30px; padding: 0 8px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-variant-numeric: tabular-nums; cursor: pointer;
}
.proof-pages__btn:hover { border-color: var(--accent); }
.proof-pages__btn[aria-current="page"] { border-color: var(--accent); font-weight: 700; box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 30%, transparent); }
.proof-pages__btn--seen { color: var(--text-muted); }
.proof-pages__seen { margin-left: 2px; color: color-mix(in srgb, var(--accent) 70%, var(--text-muted)); }
.proof-pages__btn { position: relative; }
.proof-pages__btn:disabled { cursor: not-allowed; opacity: .55; }
/* 有意見的頁：右上角一顆小圓點 */
.proof-pages__note {
  position: absolute; top: 3px; right: 3px; width: 6px; height: 6px; border-radius: 50%; background: var(--warn-display);
}
.proof-notes { display: grid; gap: var(--space-2); margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--line); }
.proof-notes__title { margin: 0; font-size: calc(15px * var(--text-scale, 1)); }
.proof-notes__list { display: grid; gap: var(--space-2); margin: 0; padding: 0; list-style: none; }
.proof-notes__list:empty { display: none; }
.proof-notes__item { padding: var(--space-2) var(--space-3); border-left: 3px solid var(--warn-display); background: color-mix(in srgb, var(--warn-display) 8%, transparent); }
.proof-notes__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.proof-notes__input { min-height: 4.5em; resize: vertical; }
.proof-edit { display: grid; gap: var(--space-3); }
/* 「審閱讀出來的內容」停用時，按鈕旁邊那一句 */
.proof-entry { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
/* 表格上方重複的數字收起來 */
.proof-echo { color: var(--text-muted); }
.proof-echo summary { cursor: pointer; font-size: calc(14px * var(--text-scale, 1)); }
.proof-edit__area { min-height: 16em; resize: vertical; }
.proof-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (min-width: 1024px) { .proof-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.proof-col {
  min-width: 0; padding: var(--space-4); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  max-height: 80vh; overflow: auto;
}
.proof-image { display: block; width: 100%; height: auto; border: 1px solid var(--line); }
.proof-note { margin: 0; color: var(--text-muted); font-size: calc(15px * var(--text-scale, 1)); line-height: 1.65; }
.proof-text { display: grid; gap: var(--space-3); font-size: calc(15px * var(--text-scale, 1)); line-height: 1.65; overflow-wrap: anywhere; }
.proof-table caption { caption-side: top; text-align: left; padding: var(--space-2) 0; color: var(--text-muted); }
.proof-table th, .proof-table td { height: auto; padding: 6px 10px; white-space: normal; vertical-align: top; font-size: calc(15px * var(--text-scale, 1)); }
.proof-table th { color: var(--text); letter-spacing: 0; }
.proof-table td + td, .proof-table th + td, .proof-table td + th, .proof-table th + th { border-left: 1px solid color-mix(in srgb, var(--line) 50%, transparent); }
/* 盤點清冊五個畫面的色：全部由白皮書色票換算，深淺色跟著色票走（2026-10-29 對齊戰情室）。
   對應：主色（綠）＝--accent、警示（橘）＝--warn、連結（藍）＝--accent-2、灰＝--text-muted；底色用同色票 12～14% 混透明。 */
:root{
  --inv-card:var(--surface);
  --inv-ink:var(--text);
  --inv-sub:var(--text-muted);
  --inv-line:var(--line);
  --inv-soft:var(--surface-sunken);
  --inv-g:var(--accent);
  --inv-gl:color-mix(in srgb,var(--accent) 12%,transparent);
  --inv-a:var(--warn);
  --inv-al:color-mix(in srgb,var(--warn) 14%,transparent);
  --inv-c:var(--text-muted);
  --inv-cl:color-mix(in srgb,var(--text-muted) 16%,transparent);
  --inv-c-ink:var(--text-muted);
  --inv-blue:var(--accent-2);
  --inv-bl:color-mix(in srgb,var(--accent-2) 12%,transparent);
  --inv-n:var(--surface-sunken);
  --inv-track:var(--surface-sunken);
  --inv-bar-soft:color-mix(in srgb,var(--text-muted) 40%,transparent);
  --inv-bar-muted:color-mix(in srgb,var(--accent) 45%,transparent);
  --inv-hi-sub:color-mix(in srgb,var(--bg) 78%,transparent);
  --inv-on:var(--bg);
}
/* 盤點清冊（客戶版）五個畫面：系統清單、資料集清單、盤點清冊總覽、管理單位、欄位說明，與清冊的系統詳情、項目詳情。
   檔名用 pages-data_inv：驗測選題（select_partial.py）照檔名對到這幾個畫面。
   版面照參考頁「盤點清冊儀表板」（10/20 上午版）的樣式照抄，class 全部加 iv- 前綴，色只用 tokens.css 的 --inv-* */
.iv{font-size: calc(15.5px * var(--text-scale, 1));line-height:1.55;color:var(--inv-ink);max-width:1280px;width:100%}
.iv a{color:var(--inv-g);text-decoration:none}
.iv a:hover{text-decoration:underline}
.iv-topbar{display:flex;align-items:center;gap:14px;margin-bottom:18px;flex-wrap:wrap}
.iv-crumb{font-size: calc(14px * var(--text-scale, 1));color:var(--inv-sub)}
.iv .iv-crumb a{color:var(--inv-sub)}
.iv-crumb b{color:var(--inv-ink);font-weight:600}
.iv-version{font-size: calc(12.5px * var(--text-scale, 1));color:var(--inv-sub)}
.iv-q{margin-left:auto;display:flex;gap:8px;align-items:center}
.iv-q input{font:inherit;padding:8px 12px 8px 34px;border:1px solid var(--inv-line);border-radius:10px;background-color:var(--inv-card);color:var(--inv-ink);width:300px;max-width:60vw;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6f6c' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M20 20l-3.5-3.5'/%3E%3C/svg%3E");background-repeat:no-repeat;background-size:16px;background-position:11px center}
.iv-h1{font-size: calc(22px * var(--text-scale, 1));font-weight:700;margin:0 0 4px;letter-spacing:-.01em}
.iv-sub{color:var(--inv-sub);font-size: calc(14.5px * var(--text-scale, 1));margin:0 0 18px}
.iv-headrow{display:flex;gap:14px;align-items:flex-start;flex-wrap:wrap;justify-content:space-between}
.iv-actions{display:flex;gap:8px;flex-wrap:wrap}
.iv .iv-btn{font:inherit;font-size: calc(13px * var(--ui-scale, 1));border:1px solid var(--inv-line);background:var(--inv-card);color:var(--inv-ink);border-radius:9px;padding:6px 12px;cursor:pointer;text-decoration:none;display:inline-block}
.iv .iv-btn:hover{border-color:var(--inv-g);text-decoration:none}
.iv-grid{display:grid;gap:14px}
.iv-g4{grid-template-columns:repeat(4,1fr)}.iv-g3{grid-template-columns:repeat(3,1fr)}.iv-g2{grid-template-columns:repeat(2,1fr)}.iv-g21{grid-template-columns:2fr 1fr}
.iv-rows2{grid-template-rows:1fr 1fr}.iv-mb{margin-bottom:14px}.iv-mt{margin-top:14px}
.iv-card{background:var(--inv-card);border:1px solid var(--inv-line);border-radius:14px;padding:18px 20px;display:block}
.iv-card h3{margin:0 0 12px;font-size: calc(15px * var(--text-scale, 1));color:var(--inv-sub);font-weight:600;display:flex;align-items:center;gap:8px}
.iv-r{margin-left:auto;font-weight:400;font-size: calc(13.5px * var(--text-scale, 1))}
.iv a.iv-card{color:inherit}
.iv a.iv-card:hover{text-decoration:none}
.iv-kpi__v{font-size: calc(34px * var(--text-scale, 1));font-weight:800;letter-spacing:-.02em;line-height:1.05}
.iv-kpi__v small{font-size: calc(14px * var(--text-scale, 1));font-weight:500;color:var(--inv-sub);margin-left:6px;letter-spacing:0}
.iv-kpi__l{font-size: calc(14px * var(--text-scale, 1));color:var(--inv-sub);margin-top:6px}
.iv-kpi--A .iv-kpi__v{color:var(--inv-a)}.iv-kpi--B .iv-kpi__v{color:var(--inv-g)}
.iv a.iv-hi{background:var(--inv-g);border-color:var(--inv-g);color:var(--inv-on)}
.iv-hi .iv-kpi__l,.iv-hi .iv-kpi__v small{color:var(--inv-hi-sub)}
.iv-lnk{cursor:pointer}.iv-lnk:hover{border-color:var(--inv-g)}
.iv-pill{display:inline-block;font-size: calc(13px * var(--text-scale, 1));font-weight:700;border-radius:999px;padding:1px 9px;line-height:1.6;text-align:center;min-width:34px}
.iv-pill--A{background:var(--inv-al);color:var(--inv-a)}.iv-pill--B{background:var(--inv-gl);color:var(--inv-g)}
.iv-pill--C{background:var(--inv-cl);color:var(--inv-c-ink)}.iv-pill--N{background:var(--inv-n);color:var(--inv-sub)}
.iv-pill--first{background:var(--inv-gl);color:var(--inv-g)}.iv-pill--next{background:var(--inv-bl);color:var(--inv-blue)}
.iv-pill--confirm{background:var(--inv-al);color:var(--inv-a)}.iv-pill--excluded{background:var(--inv-cl);color:var(--inv-c-ink)}
.iv-tag{display:inline-block;font-size: calc(13px * var(--text-scale, 1));border:1px solid var(--inv-line);border-radius:6px;padding:0 6px;background:var(--inv-card);white-space:nowrap;color:var(--inv-sub)}
.iv-gA{color:var(--inv-a)}.iv-gB{color:var(--inv-g)}.iv-gC{color:var(--inv-c-ink)}
/* 橫條：長條用 SVG（CSP 不准行內 style），寬度寫在 rect 的 width 屬性 */
.iv a.iv-hbar{display:grid;grid-template-columns:minmax(120px,200px) 1fr 56px;gap:10px;align-items:center;padding:6px 0;font-size: calc(14.5px * var(--text-scale, 1));cursor:pointer;border-radius:8px;color:inherit}
.iv a.iv-hbar:hover{background:var(--inv-soft);text-decoration:none}
.iv-hbar__n{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iv-hbar__v{text-align:right;font-weight:700}
.iv-bar{display:block;width:100%;height:12px;overflow:visible}
.iv-barcell{width:30%}
.iv-fill-g{fill:var(--inv-g)}.iv-fill-a{fill:var(--inv-a)}.iv-fill-c{fill:var(--inv-c)}
.iv-fill-soft{fill:var(--inv-bar-soft)}.iv-fill-muted{fill:var(--inv-bar-muted)}
.iv-stack{display:block;width:100%;height:14px;border-radius:7px;overflow:hidden;background:var(--inv-track);margin:6px 0 10px}
.iv-legend{display:flex;gap:14px;flex-wrap:wrap;font-size: calc(13.5px * var(--text-scale, 1));color:var(--inv-sub)}
.iv-sw{display:inline-block;width:10px;height:10px;border-radius:3px;margin-right:5px;vertical-align:middle}
.iv-sw--g{background:var(--inv-g)}.iv-sw--a{background:var(--inv-a)}.iv-sw--c{background:var(--inv-c)}
.iv-donut{display:flex;gap:18px;align-items:center}
.iv-donut__svg{width:130px;height:130px;flex:none}
.iv-stroke-A{stroke:var(--inv-a)}.iv-stroke-B{stroke:var(--inv-g)}.iv-stroke-C{stroke:var(--inv-c)}.iv-stroke-N{stroke:var(--inv-bar-soft)}
.iv-donut__total{font-size: calc(22px * var(--text-scale, 1));font-weight:800;fill:currentColor}
.iv-donut__unit{font-size: calc(12px * var(--text-scale, 1));fill:var(--inv-sub)}
.iv-donut__lg{display:grid;gap:6px;font-size: calc(14.5px * var(--text-scale, 1))}
.iv-donut__lg div,.iv .iv-donut__lg a{display:flex;gap:8px;align-items:center;white-space:nowrap}
.iv .iv-donut__lg a{color:inherit}
.iv-donut__lg b{margin-left:auto;font-variant-numeric:tabular-nums}
.iv-ministat{display:flex;gap:18px;flex-wrap:wrap;margin-top:16px}
.iv-ministat div{font-size: calc(14px * var(--text-scale, 1));color:var(--inv-sub)}
.iv-ministat b{display:block;font-size: calc(22px * var(--text-scale, 1));color:var(--inv-ink);letter-spacing:-.02em}
/* 工具列、膠囊、表格 */
.iv-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-bottom:12px}
.iv-tools select,.iv-tools input{font:inherit;padding:7px 10px;border:1px solid var(--inv-line);border-radius:9px;background:var(--inv-card);color:var(--inv-ink)}
.iv-tools input{min-width:240px}
.iv-chips{display:flex;gap:6px;flex-wrap:wrap}
.iv-chip{font:inherit;font-size: calc(13px * var(--ui-scale, 1));border:1px solid var(--inv-line);background:var(--inv-card);color:var(--inv-ink);border-radius:999px;padding:4px 11px;cursor:pointer;user-select:none}
.iv-chip.on{background:var(--inv-g);border-color:var(--inv-g);color:var(--inv-on)}
.iv-chip--A.on{background:var(--inv-a);border-color:var(--inv-a)}.iv-chip--C.on{background:var(--inv-c);border-color:var(--inv-c)}
.iv-cnt{font-size: calc(14px * var(--text-scale, 1));color:var(--inv-sub);margin-left:auto}
.iv-tablewrap{overflow-x:auto}
.iv-table{width:100%;border-collapse:collapse;font-size: calc(13.5px * var(--ui-scale, 1))}
.iv-table th{text-align:left;font-weight:600;color:var(--inv-sub);font-size: calc(12.5px * var(--ui-scale, 1));padding:8px 10px;border-bottom:1px solid var(--inv-line);white-space:nowrap}
.iv-table td{padding:9px 10px;border-bottom:1px solid var(--inv-soft);vertical-align:top}
.iv-th{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer;user-select:none}
.iv-th.on::after{content:" ▾";color:var(--inv-g)}.iv-th.on.asc::after{content:" ▴"}
.iv-row{cursor:pointer}.iv-row:hover td{background:var(--inv-soft)}
.iv-table td.iv-num,.iv-table th.iv-num{text-align:right;font-variant-numeric:tabular-nums;white-space:nowrap}
.iv-table td.iv-ell{max-width:420px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.iv-table td.iv-ell--sys{max-width:220px}
.iv-nowrap{white-space:nowrap}
.iv .iv-strong{font-weight:700;color:var(--inv-ink)}
.iv-col-field{width:14em}
.iv-pager{display:flex;gap:8px;align-items:center;justify-content:flex-end;margin-top:12px;font-size: calc(13px * var(--ui-scale, 1));color:var(--inv-sub)}
.iv-pager button{font:inherit;border:1px solid var(--inv-line);background:var(--inv-card);color:var(--inv-ink);border-radius:8px;padding:5px 10px;cursor:pointer}
.iv-pager button:disabled{opacity:.4;cursor:default}
.iv-empty{padding:30px;text-align:center;color:var(--inv-sub)}
.iv-note{font-size: calc(14px * var(--text-scale, 1));color:var(--inv-a);margin:0 0 10px}
/* 機房站台：雲端資料暫時拿不到的橫幅（警示色用 --warn，邊框與底色混透明，深淺色都看得清楚） */
.iv-note--cloud{color:var(--text);padding:8px 12px;border:1px solid color-mix(in srgb, var(--warn) 55%, transparent);border-inline-start:4px solid var(--warn);border-radius:var(--radius-sm);background:color-mix(in srgb, var(--warn) 14%, transparent)}
.iv-muted{color:var(--inv-sub)}
.iv-sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* 詳情 */
.iv-head{display:flex;gap:14px;align-items:flex-start;flex-wrap:wrap;margin-bottom:14px}
.iv-head__main{flex:1 1 400px}
.iv-meta{color:var(--inv-sub);font-size: calc(14.5px * var(--text-scale, 1));display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.iv-kv{margin:0;display:grid;grid-template-columns:8em 1fr;gap:8px 14px;font-size: calc(14.5px * var(--text-scale, 1))}
.iv-kv dt{color:var(--inv-sub)}.iv-kv dd{margin:0;word-break:break-word}
.iv-why{background:var(--inv-soft);border-left:4px solid var(--inv-g);padding:10px 12px;border-radius:0 8px 8px 0;font-size: calc(14.5px * var(--text-scale, 1))}
.iv-why--A{border-color:var(--inv-a)}.iv-why--C{border-color:var(--inv-c)}
@media (max-width:980px){.iv-g4{grid-template-columns:repeat(2,1fr)}.iv-g3,.iv-g21{grid-template-columns:1fr}}
@media (max-width:760px){.iv-g4,.iv-g2{grid-template-columns:1fr}.iv-table td.iv-ell{max-width:200px}.iv-hidem{display:none}}
/* 清冊維護：編輯表單（對話框裡兩欄排）、上傳預覽 */
.iv-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 14px}
.iv-form__wide{grid-column:1/-1}
.iv-ministat [data-stat]{min-width:90px}
@media (max-width:760px){.iv-form{grid-template-columns:1fr}}
/* 總覽的「問盤點清冊」：輸入列、範例問題、答案（答案本文與來源表沿用提問頁的 ask-answer 樣式） */
.iv-qa__row{display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.iv-qa__input{flex:1 1 320px;min-width:0}
.iv-qa__examples{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin-top:10px}
.iv-qa__examples .iv-qa__out{margin-top:14px}
.iv-qa__out:empty{display:none}
/* 上傳到資料湖（含下半部「我上傳的資料」）、議題（src/pages/data/upload.rs）。顏色只用色票名字 */
.upl-step { display: grid; gap: var(--space-2); }
.upl-step h3, .upl-warn h3 { margin: 0 0 var(--space-2); font-size: calc(17px * var(--text-scale, 1)); font-weight: 600; }
.upl-hint { margin: -2px 0 var(--space-3); font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); line-height: 1.6; }
.upl-muted { font-size: calc(14px * var(--text-scale, 1)); color: var(--text-muted); margin: 0; }
.upl-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-top: var(--space-3); }
.upl-warn ul { margin: var(--space-2) 0; padding-left: 1.2em; }
.upl-cand { border-top: 1px solid var(--line); padding: var(--space-3) 0; display: grid; gap: var(--space-2); }
.upl-cand ul { margin: 0; padding-left: 1.2em; font-size: calc(14px * var(--text-scale, 1)); color: var(--text-muted); }
.upl-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-2); }
.upl-chip {
  font: inherit; font-size: calc(12px * var(--ui-scale, 1)); padding: 3px 10px; border-radius: var(--radius-pill, 999px);
  border: 1px solid var(--line); background: var(--surface); color: var(--text); cursor: pointer; margin: 2px 4px 2px 0;
}
.upl-chip--on { border-color: var(--accent); color: var(--accent); }
.upl-active td:first-child { font-weight: 600; }
.upl-issues { display: grid; gap: var(--space-2); }
.upl-kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px var(--space-4); margin: 0; font-size: calc(15px * var(--text-scale, 1)); }
.upl-kv dt { color: var(--text-muted); }
.upl-kv dd { margin: 0; }
.upl-table td { white-space: normal; vertical-align: top; }
.upl-new td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.upl-tag { font-size: calc(12px * var(--text-scale, 1)); font-weight: 600; color: var(--accent); }
.upl-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3);
  border-left: 3px solid var(--accent); }
.upl-base { border-left: 3px solid var(--accent-2); }
.upl-withdraw { border-top: 1px solid var(--line); padding-top: var(--space-3); }
.upl-chip--kept { opacity: .7; cursor: default; border-style: dashed; }
.upl-issue-new { margin-top: var(--space-2); }
.upl-issue-form { display: flex; flex-direction: column; gap: var(--space-2); margin-top: var(--space-2); }
.upl-issue-editor { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.upl-issue-editor > .upl-step { flex-basis: 100%; }
/* 系統說明頁（#/doc、#/doc/<段>、#/doc/auto）專用版面。類別一律 doc- 開頭；顏色只拿 tokens.css 的變數 */

/* 目錄頁 */
.doc-home { container-type: inline-size; max-width: 64rem; display: grid; gap: var(--space-5); }
.doc-home__head { display: grid; gap: var(--space-3); }
.doc-home__summary { max-width: 48rem; margin: 0; font-size: calc(15px * var(--text-scale, 1)); }
.doc-live {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-5) 36px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  padding: var(--space-5) 0; font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted);
}
.doc-live__item { min-width: 0; }
.doc-live__value { display: block; font-size: calc(30px * var(--text-scale, 1)); line-height: 1.2; font-weight: 600; color: var(--text); }
.doc-live__more { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.doc-grid { display: grid; gap: var(--space-5); align-items: start; grid-template-columns: minmax(0, 1fr); }
.doc-grid > * { min-width: 0; }
.doc-category { min-width: 0; }
.doc-pages { list-style: none; margin: 0; padding: 0; }
.doc-pages__item { padding: var(--space-3) 0; display: grid; gap: 2px; border-top: 1px solid var(--line); }
.doc-pages__item:first-child { padding-top: 0; border-top: 0; }
.doc-pages__item:last-child { padding-bottom: 0; }
.doc-pages__title { font-weight: 600; }
.doc-pages__meta { font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
.doc-agent { min-width: 0; }
.doc-form__row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-4); }
.doc-form__row > .field { min-width: 13rem; flex: 1; }
@container (min-width: 48rem) {
  .doc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 單頁只有內容（不放目錄，行寬限在 48rem）；即時狀態頁左邊目錄、右邊內容 */
.doc-wrap { container-type: inline-size; max-width: 72rem; }
.doc-wrap--single { max-width: 48rem; }
.doc-layout { display: flex; flex-direction: column; gap: var(--space-5) 48px; }
.doc-main { min-width: 0; flex: 1; display: grid; gap: var(--space-5); align-content: start; }
.doc-main > * { min-width: 0; }
.doc-main__foot { border-top: 1px solid var(--line); padding-top: var(--space-4); }
.doc-section { display: grid; gap: var(--space-4); }
.doc-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-2) 20px; }
.doc-head__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 4px; font-size: calc(13px * var(--text-scale, 1)); }

/* 即時狀態頁的目錄 */
.doc-toc { display: flex; flex-wrap: wrap; gap: 4px 16px; border-bottom: 1px solid var(--line); padding-bottom: var(--space-4); font-size: calc(15px * var(--text-scale, 1)); }
.doc-toc__top { width: 100%; font-size: calc(13px * var(--text-scale, 1)); letter-spacing: .1em; }
.doc-toc__home { color: var(--text-muted); text-decoration: none; }
.doc-toc__home:hover { color: var(--text); }
.doc-toc__group { width: 100%; padding-top: var(--space-3); font-size: calc(13px * var(--text-scale, 1)); letter-spacing: .1em; color: var(--text-muted); }
.doc-toc__item { color: var(--text-muted); text-decoration: none; }
.doc-toc__item:hover { color: var(--text); }
.doc-toc__item--current { font-weight: 600; color: var(--text); }
.doc-toc__hint { display: none; margin: 0; padding: 20px 0 0 14px; font-size: calc(13px * var(--text-scale, 1)); color: var(--text-muted); }
@container (min-width: 64rem) {
  .doc-layout { flex-direction: row; }
  .doc-toc {
    display: block; position: sticky; top: var(--space-5); align-self: flex-start; flex-shrink: 0;
    width: 13rem; max-height: 100vh; overflow-y: auto; border-bottom: 0; padding-bottom: var(--space-5);
  }
  .doc-toc__top, .doc-toc__group { padding-left: 14px; }
  .doc-toc__group { padding-top: var(--space-5); }
  .doc-toc__item { display: block; border-left: 2px solid transparent; padding: 4px 0 4px 12px; }
  .doc-toc__item--current { border-left-color: var(--text); }
  .doc-toc__hint { display: block; }
}

/* 就地編輯、歷史與差異 */
.doc-edit { display: grid; gap: var(--space-4); }
.doc-edit__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.doc-edit__row .field__label { color: var(--text-muted); }
.doc-edit__title { width: 20rem; max-width: 100%; }
.doc-edit__by { width: 8rem; }
.doc-edit__reason { min-width: 13rem; flex: 1; }
.doc-history__content { margin-top: var(--space-2); min-width: 24rem; max-width: 100%; }
.doc-diffbox { display: grid; gap: var(--space-3); }

/* 即時狀態頁 */
.doc-canary { display: grid; gap: var(--space-4); }
.doc-canary__note { font-size: calc(15px * var(--text-scale, 1)); font-weight: 400; }
.doc-named__body { margin: var(--space-2) 0 var(--space-3); }
.doc-subheading { padding-top: var(--space-2); font-size: calc(15px * var(--text-scale, 1)); font-weight: 600; }
.doc-mono-sub { font-size: calc(13px * var(--text-scale, 1)); }
.doc-schema-files { display: grid; gap: 6px; }
/* 操作指南：每個畫面一個摺疊，進去先看到「要什麼權限」與「到這個畫面」 */
.help-need { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-4); margin: 0; }
/* 模組與題詞調整頁（#/nodes）專用版面。類別一律 nodes- 開頭；顏色只拿 tokens.css 的變數 */
.nodes-cols { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); }
.nodes-cols__stats, .nodes-cols__detail { min-width: 0; }
.nodes-cols__stats { align-self: start; }
@media (min-width: 1024px) {
  .nodes-cols { grid-template-columns: repeat(11, minmax(0, 1fr)); }
  .nodes-cols__stats { grid-column: span 5; }
  .nodes-cols__detail { grid-column: span 6; }
}
/* 左欄統計表比整頁窄，儲存格內距縮小，「最後」那欄的時間才不會被切掉 */
.nodes-cols__stats .table th, .nodes-cols__stats .table td { padding-left: 8px; padding-right: 8px; }
/* 版本紀錄頁（#/releases）專用版面。類別一律 rel- 開頭；顏色只拿 tokens.css 的變數 */
.rel-wrap { container-type: inline-size; }
.rel-w-48 { width: 12rem; }
.rel-list { margin: 0; padding-left: 20px; list-style: disc; display: grid; gap: var(--space-1); }
.rel-cols { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
.rel-cols > * { min-width: 0; display: grid; gap: var(--space-2); align-content: start; grid-template-columns: minmax(0, 1fr); }
.rel-cols p, .rel-cols li { overflow-wrap: anywhere; }
.rel-shots { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); }
.rel-shot { margin: 0; display: grid; gap: var(--space-1); }
.rel-shot__img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }
.rel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--space-3); margin-bottom: var(--space-3); }
.rel-dialog-grid { display: grid; gap: var(--space-4); grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rel-dialog-stack { display: grid; gap: var(--space-4); }
.rel-dialog-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
@container (min-width: 36rem) {
  .rel-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* 外框（頁首、側欄、登入頁）專用樣式。顏色只用 tokens.css 的變數 */
/* 雜湊鏈膠囊平常（全部正常）降成小字、去外框；有警示時回到 app.css 的膠囊樣式 */
.chain-pill.chain-pill--calm {
  font-size: calc(11px * var(--text-scale, 1));
  padding: 0;
  border-color: transparent;
  opacity: 0.7;
}
/* 執行紀錄頁（#/trace）專用版面。類別一律 trace- 開頭；顏色只拿 tokens.css 的變數 */
.trace-inline { display: flex; align-items: center; gap: var(--space-2); max-width: 100%; min-width: 0; }
.trace-inline > label { flex-shrink: 0; }
.trace-w-28 { width: 7rem; }
.trace-w-40 { width: 10rem; }
.trace-w-52 { width: 13rem; }
.trace-w-72 { width: 18rem; }
/* 版本與更新頁（#/versions）專用版面。類別一律 ver- 開頭；顏色只拿 tokens.css 的變數 */
.ver-check { display: flex; align-items: center; gap: var(--space-2); }
