/* ══════════════════════════════════════════════════
   MX UAT Platform — site.css
   提取自 prototype_0401.html v1.0
   ══════════════════════════════════════════════════ */

/* ══════════════════════════════════════════════════
   自架字型：Inter（英數，woff2 Latin 子集，各 layout <head> preload 400/600）
   ──────────────────────────────────────────────────
   分工同業界主流（Gmail/GitHub/Linear…）：英數自架 Inter、中文（CJK）走系統字
   （見 body font-family：PingFang TC／微軟正黑／Noto Sans CJK），CJK 零 webfont＝零換字。
   'Inter Fallback'＝以 Arial 度量（ascent/descent/size-adjust）對齊 Inter，swap 前後字寬一致，
   消除 Ctrl+Shift+R 的 FOUT 位移。unicode-range 限 Latin＝CJK 不觸發 Inter、直接落系統中文字。
   ⚠️ 改字型前讀 docs/ui-tokens.md；新增/移除字重須同步 wwwroot/fonts 與 preload。
   ══════════════════════════════════════════════════ */
@font-face { font-family:'Inter'; font-style:normal; font-weight:400; font-display:swap; src:url('/fonts/inter-latin-400-normal.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:500; font-display:swap; src:url('/fonts/inter-latin-500-normal.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:600; font-display:swap; src:url('/fonts/inter-latin-600-normal.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family:'Inter'; font-style:normal; font-weight:700; font-display:swap; src:url('/fonts/inter-latin-700-normal.woff2') format('woff2'); unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
/* Inter 度量對齊的系統 fallback（Arial；僅覆蓋英數，CJK 由 body stack 落系統中文字）。
   值對齊 Next.js next/font 為 Inter/Arial 計算之 override，swap 時字寬不跳。 */
@font-face {
  font-family: 'Inter Fallback';
  src: local('Arial');
  ascent-override: 90.44%;
  descent-override: 22.43%;
  line-gap-override: 0%;
  size-adjust: 107.06%;
}

/* ══════════════════════════════════════════════════
   Design Tokens（日/夜模式，全站色彩透過變數表達）
   品牌色固定；表面/文字/邊框/陰影依 data-theme 切換
   ══════════════════════════════════════════════════ */
:root {
  /* ══ Primitive 色階（design-system-v3 §2；顏料庫——只准本 token 定義區的 semantic 引用；元件/頁面/JS 一律禁用）══
     🔒 primitive 值永不改色相：換皮＝新增色階＋semantic 改指向，舊階退役刪除（見 docs/ui-tokens.md 修改紀律）*/
  --violet-100:#F1EDFB; --violet-200:#DCD3F4; --violet-300:#B9A7E8; --violet-400:#9E7BFF; --violet-500:#8A2BFF;
  --violet-600:#5C4EA6; --violet-700:#453B7D; --violet-800:#2E2853; --violet-900:#2A1B5E;
  --teal-600:#0A9396; --teal-700:#005F73;
  --cyan-100:#E0FBF9; --cyan-300:#00F5FF; --cyan-600:#0E7E96;
  --grey-50:#FAFAFC; --grey-100:#F4F4F8; --grey-200:#ECEDF4; --grey-250:#E3E3EE; --grey-300:#D4D5E3;
  --grey-400:#A9ABBC; --grey-500:#8B8DA0; --grey-600:#5F6172; --grey-700:#393A4B; --grey-750:#2C2D42;
  --grey-800:#26283B; --grey-850:#1D1E2B; --grey-900:#16161F; --grey-950:#13131B;
  --amber-400:#F0B93A; --amber-500:#EE9B00; --yellow-400:#FFFF00; --lime-400:#B4FF00; --red-700:#AE2012; --pink-400:#FF5CA8;

  /* ══ Semantic 色相家族（design-system-v3 §3a；Cyberpunk Violet 定案值 v6；日值於此、夜值見 dark 區）══ */
  --accent:       var(--violet-600);   /* #5C4EA6 實心底/色點/甘特待分配（日白字 6.8:1）；夜 violet-500（夜唯一白字實心底 5.4:1）*/
  --accent-text:  var(--violet-600);   /* #5C4EA6 連結/必填星/選中/focus 邊框（日 6.8:1）；夜 violet-400 5.3:1 */
  --accent-soft:  rgba(92,78,166,.12); /* 選中列底/soft chip */
  --accent-fill:  rgba(92,78,166,.28); /* 資料面積 */
  --info:         var(--teal-700);     /* #005F73 點/填色/複測；夜 cyan-300 */
  --info-text:    var(--teal-700);     /* #005F73 數值強調 7.3:1；夜 #00F5FF 12:1 */
  --info-soft:    rgba(0,95,115,.12);
  --info-fill:    rgba(0,95,115,.28);
  --success:      var(--teal-600);     /* #0A9396 點/填色/完成（日實心白字 3.7:1 元件級，甘特 bar 可用）；夜 lime-400 */
  --success-soft: rgba(10,147,150,.12);
  --success-fill: rgba(10,147,150,.28); /* 無 -text：success 禁作文字 */
  --warn:         var(--amber-500);    /* #EE9B00 點/填色/處理中/警示；夜 yellow-400 */
  --warn-soft:    rgba(238,155,0,.12);
  --warn-fill:    rgba(238,155,0,.35);  /* 無 -text：warn 禁作文字 */
  --warn-solid:   var(--amber-500);    /* 實心底：日 #EE9B00 配深字 #232433(7.0:1)；夜 #FFFF00 配 #16161F（btn-warn）*/
  --danger:       var(--red-700);      /* #AE2012 點/填色/實心底（日白字 7.0:1）；夜 pink-400（夜實心底配深字 #16161F）*/
  --danger-text:  var(--red-700);      /* #AE2012 錯誤/刪除/超載% 7.0:1；夜 #FF5CA8 5.8:1 */
  --danger-soft:  rgba(174,32,18,.12); /* btn-delete hover 底 */
  --danger-solid: var(--red-700);      /* 實心 danger 白字底（日夜共用深紅 7.0:1；白字壓深紅場景，夜 --danger 拉亮不可白字）*/
  --neutral-dot:  var(--grey-500);     /* #8B8DA0 中性色點（其他/低）；低優先淡點另用 #C7C9D6/#4D4F69 */
  --ink:          #232433;             /* 實心深底白字（標題/btn-primary 底；頭像 2026-07-10 起改 --ink-muted）；舊 --dark，日夜共用深值 */
  --soft-gray:    rgba(0,0,0,.05);
  --icon-fill:    .2;                   /* 全站線性 icon 雙色調填色透明度（2026-07-12 icon 線→雙色調；一處可調，見下方 svg[stroke="currentColor"] 全域規則）。日夜共用；如夜太淡可於 dark 區 override */

  /* ── 輔助色 ─────── */
  --ink-muted: var(--grey-600);        /* #5F6172 實心底白字（全站頭像 sb-avatar 系列、avatar-md、issue-av、wo-av、kb-avatar、account-card-av、avatar-circle-lg、甘特 .bar.done、role-tag--gray、filter-btn-count；白字 6.1:1）；舊 --gray-700 實心底用途。⚠️「次文字/icon」用途改吃 --text-secondary、--text-tertiary */
  --paper:    #FFFFFF;                 /* 卡片底色（純白，靠陰影/邊框拉層次）*/

  /* ── 表面層次（design-system-v3 §3b：紫調冷灰 grey 階，靠邊框/陰影排層次）
     bg-page → bg-subtle → bg-card；hover 獨立 token */
  --bg-page:      var(--grey-50);   /* #FAFAFC 畫布（最底）*/
  --bg-card:      var(--paper);     /* #FFFFFF 主工作表面 */
  --bg-elevated:  #FFFFFF;          /* 浮層最高階（modal/dropdown）：純白＋陰影拉層次 */
  --bg-subtle:    var(--grey-100);  /* #F4F4F8 比 card 暗：sidebar / 看板欄底（凹·安靜）*/
  --bg-section:   var(--grey-200);  /* #ECEDF4 分組標題列 / 表頭 / sticky header */
  --bg-hover:     #EFEFF6;          /* 列/導覽/卡片 hover（往下加深一階）*/
  --bg-sunk:      var(--grey-200);  /* #ECEDF4 input rest、再凹一階 */
  --bg-overlay:   rgba(22,22,31,.55);   /* 深紫遮罩 */
  --bg-load-chip: rgba(250,250,252,.9); /* Time Board % chip 底（配 --text-primary；dark 對應深值）*/

  /* 互動表面 token：「卡片上的互動元件要與 card 有一階差異」
     - --bg-input：凹型互動表面（form input、search-box、可填寫容器）— 可編輯態
     - --bg-control：抬型互動表面（btn-secondary、page-btn、chip、member-item 等卡上按鈕）
     - --bg-frozen：readonly / disabled 凍結態的攤平底色，視覺要與 --bg-input 不同
     light mode：editable 維持白色（card），凍結用淺灰（subtle）— Apple iOS 表單派
     dark mode：editable 凹到 sunk，凍結攤回 card 高度（見下方 [data-theme="dark"] override） */
  --bg-input:     var(--bg-card);
  --bg-control:   var(--bg-card);
  --bg-frozen:    var(--bg-subtle);

  /* 互動 hover 填色（按鈕/控制項/popover hover）：2026-06-24 自 --bg-sunk 解耦
     —— 近白後 input 靜止底(sunk #E9ECEA)需近白、但 hover 需看得見，兩者需求相反，故獨立給值 */
  --bg-muted:     #E7E7EF;

  /* ── Glass / 毛玻璃浮層（Sidebar / Modal / Toast / Standalone-card 共用；design-system-v3 §3c 質感值）
     註：.toast / .standalone-card box-shadow 吃 --glass-shadow（2026-07-11 接回，取代 --shadow-lg——glass 元件用較柔的 glass 陰影）*/
  --glass-bg:     rgba(255, 255, 255, .62);
  --glass-border: rgba(255, 255, 255, .65);
  --glass-blur:   20px;
  --glass-shadow: 0 6px 24px rgba(35, 36, 51, .10);
  /* Modal 質感 v3.1（2026-07-11 核可）：頂緣亮 hairline＋多層柔光；scrim 調淺＋模糊。實心不套毛玻璃 */
  --modal-shadow: inset 0 1px 0 rgba(255,255,255,.9), 0 2px 6px rgba(20,20,35,.09), 0 16px 36px rgba(20,20,35,.17);
  --modal-scrim:  rgba(22,22,31,.36);

  /* ── 邊框 / 分隔線（design-system-v3 §3b：紫調冷灰，精確 hex） ─────── */
  --border-faint:    #E9E9F1;
  --border-input:    var(--grey-300);  /* #D4D5E3 */
  --border-card:     var(--grey-250);  /* #E3E3EE 近白 canvas 上卡片靠框定義 */
  --border-hover:    #C7C9D6;          /* hover 加深 */
  --divider:         #E9E9F1;

  /* ── Sidebar（active 用左側指示條而非漸層底色） ─────── */
  --bg-sidebar:         var(--bg-subtle);  /* 比 bg-page 深一階（§3b：sidebar 別名指向新值）*/
  --bg-sidebar-hover:   var(--bg-hover);  /* 還原為原本 alias */
  --border-sidebar:     var(--divider);
  --text-sidebar:       var(--text-primary);
  --text-sidebar-muted: var(--text-secondary);
  --text-sidebar-hint:  var(--text-tertiary);

  /* ── 文字色階（design-system-v3 §3b：紫調冷灰）─────── */
  --text-primary:   #232433;           /* 對 paper #FFFFFF 對比充足 */
  --text-secondary: var(--grey-600);   /* #5F6172 次文字：對 page 過 AA */
  /* --text-tertiary：hint / caption / annotation */
  --text-tertiary:  var(--grey-500);   /* #8B8DA0 */
  --text-link:      var(--accent-text);/* §3b：連結改吃 accent-text（violet）*/
  --text-on-accent: #FFFFFF;
  --text-on-bright: #232433;           /* 深字 on 亮實心底（warn/success夜/danger夜/info夜）＝design §6.3；夜 #16161F */
  /* 舊過渡色 --warn-fg/--success-fg（bronze/gray-teal 當文字）已於 2026-07-11 UAT 全數退役：
     warn/success 一律不作文字（§6）→ 徽章/badge 改中性字＋色點、警示改 danger、選中改 accent（見各元件） */

  /* ── 實心族色底過渡名（併入正式家族；.sf-step 逐處字色表待 Phase 5 §5.4）
     active-review 底＝success、active-doing 底＝warn-solid（實心族色，白字/深字見 design §6.3）*/
  --warn-solid-deep:      var(--warn-solid);  /* 併入 warn-solid 家族（舊 orange-dark）*/

  /* ── 陰影（Linear：只給「浮層」，平面元素一律靠邊框，不用陰影）
     sm：小浮層（dropdown / popover / menu / tooltip）
     lg：大浮層（modal / toast / lightbox / standalone / 拖曳中）
     兩階都帶 1px ring；dark 的 ring 會拉亮，因黑陰影在深底不可見、靠 ring 界定輪廓
     UAT 決議（2026-07-11）：v3 曾試多層 hairline 配方，回饋差異不明顯→回復原單層配方 */
  --shadow-sm: 0 2px 8px rgba(17,24,39,.08), 0 0 0 1px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 28px rgba(17,24,39,.12), 0 0 0 1px rgba(0,0,0,.06);

  /* ── 圓角（Linear 風：比 v1 再緊，精密工具感）─────── */
  --r-xs:   4px;     /* 小按鈕、icon button、badge、view-btn（Linear 對齊：原 3px）*/
  --r-sm:   6px;     /* 按鈕、input、小元件（Linear 對齊：原 5px）*/
  --r-md:   8px;     /* 內層卡片、列表面板、區塊容器（Linear 對齊：原 7px）*/
  --r-lg:   12px;    /* 外層卡片、Modal（Linear 對齊：原 9px，Linear 大卡主力 12）*/
  --r-pill: 999px;   /* 搜尋框等特定語意場景保留 */

  /* ── 間距尺度（Linear 4px base grid；2026-06-14 新增，收斂全站零散 px）─────
     規則：嚴格 4 倍數階；--space-0_5 為 2px 例外（badge/chip 內距、細指示條）。
     1px hairline 與 >40px 版面特例不進此系統。token 不隨主題切換（不在 dark 區 override）。*/
  --space-0_5: 2px;
  --space-1:   4px;
  --space-2:   8px;
  --space-3:   12px;
  --space-4:   16px;
  --space-5:   20px;
  --space-6:   24px;
  --space-8:   32px;
  --space-10:  40px;

  /* ── 表格列高（2026-07-22 DS 定案：同類全站統一、以視覺舒適為準、無「表頭≥資料列」鐵則）
     資料列＝標準列表基準；密集資料列＝甘特/負載時間軸（共用一值＝兩者密度一致）；
     刻度行＝時間軸月/日/星期薄標尺；分組標題列取舒適下限。token 不隨主題切換。詳見 docs/ui-tokens.md。*/
  --row-data:       44px;   /* 標準列表資料列（.list-row / issue-table / 報價表）*/
  --row-data-dense: 40px;   /* 甘特/負載資料列（任務列/成員列，兩者共用＝密度一致）*/
  --row-axis:       20px;   /* 甘特/負載時間軸刻度行（月/日/星期，每行）*/
  --row-group:      40px;   /* 分組/組別標題列最小高 */

  /* ── 字重 / 行高 ─────── */
  --fw-medium:  500;        /* 中等粗體：sidebar 標籤、filter chip */
  --fw-bold:    600;        /* 粗體：常規 emphasized 文字、metric 數字 */
  --fw-heading: 500;        /* 標題字重（Linear 對齊：原 700 Bold → Medium 500；Linear 標題不用 Bold）*/
  --lh-normal:  1.65;
  --lh-relaxed: 1.7;

  /* ── 互動（v2）─────── */
  /* focus ring：顏色/幾何解耦——色走 --focus-ring-color，各 selector 自留幾何（spread/inset）。
     UAT 決議（2026-07-11）：focus 只保留「變色細框」、全站不加發光；glow 效果移除 */
  --focus-ring-color: rgba(92,78,166,.25);       /* violet accent 25% */
  --focus-ring:       0 0 0 3px var(--focus-ring-color);

  /* ── btn-primary（violet 招牌 CTA：accent 實心白字；日 6.8:1 / 夜 5.4:1 皆過 AA）*/
  --btn-primary-bg:    var(--accent);
  --btn-primary-fg:    var(--text-on-accent);
  --btn-primary-hover: var(--violet-700);   /* 日 hover 加深 #453B7D（夜見 dark override）*/

  /* ── 內部留言 note-box（2026-07-22：改金系 amber，脫離 warn/accent）。
     為何改：warn 夜間翻純黃 #FFFF00 大面積刺眼；accent 又與品牌紫難分＝易誤把內部當公開。
     解法：--note-* 直接指 primitive amber、自帶日夜值（不寄生別的 semantic）；面積紀律＝大面積只鋪淡底、飽和金只在細條/chip/toggle/送出鈕。
     用於：左條/chip/toggle-on/送出鈕(--note-accent)、卡底(--note-bg)、邊(--note-border)、label/chip 字(--note-strong)、金鈕深字(--note-btn-text)；內文字仍中性 --text-primary */
  --note-bg:     rgba(238,155,0,.08);   /* amber #EE9B00 @8%（大面積淡底不刺眼）；夜見 dark override */
  --note-border: rgba(238,155,0,.35);   /* amber @35% */
  --note-accent: var(--amber-500);      /* #EE9B00 內部留言金：左條/chip/toggle-on/送出鈕 */
  --note-strong: #8A5A00;               /* 深金：label/chip 字（白底過 AA）*/
  --note-btn-text: #1D1E2B;             /* 金底送出鈕深字（白字在金上破 AA）*/
  --note-accent-hover: #D98E00;         /* 金鈕 hover 深一階 */

  /* --warn-border 保留給真警示 .unsaved-pill（時數未存）；warn 家族其餘在上方 semantic 區 */
  --warn-border: rgba(238,155,0,.45);   /* warn 主值 #EE9B00 @45%（unsaved-pill 邊框）*/

  /* ── select 箭頭（token 化：日夜自適應，取代寫死 data-URI；stroke=--text-secondary #5F6172）*/
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235F6172' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");

  /* ── 第三方品牌色 ─────── */
  --google-blue: #4285F4;

  /* ── Scrollbar（紫調冷灰）*/
  --scroll-thumb:       var(--grey-400);   /* #A9ABBC */
  --scroll-thumb-hover: var(--grey-500);   /* #8B8DA0 */

  /* ── Legacy alias（既有引用沿用 - 直接刪除無效，保留指向新 token）*/
  --body-bg:        var(--bg-page);
  --card-bg:        var(--bg-card);
  --bg-tooltip:     #26283B;       /* tooltip chip：light/dark 皆固定（§3b：深紫底白字）*/

  /* ── 字級階梯（2026-07 整組上推一階：舊「小」body11 太小移除，預設＝舊「大」）：xs13<sm14<body15<lg17<h2_19。三檔密度見下（中=預設、小/大 各 -2/+2px）。*/
  --fs-h2:     19px;
  --fs-lg:     17px;
  --fs-body:   15px;
  --fs-sm:     14px;
  --fs-xs:     13px;   /* 最小階：hint / caption / annotation */
}

/* 字級無障礙：小/中/大 三檔；中為預設、小/大 各 -2/+2px */
html[data-fs="sm"] {
  --fs-h2:     17px;
  --fs-lg:     15px;
  --fs-body:   13px;
  --fs-sm:     12px;
  --fs-xs:     11px;
}
html[data-fs="lg"] {
  --fs-h2:     21px;
  --fs-lg:     19px;
  --fs-body:   17px;
  --fs-sm:     16px;
  --fs-xs:     15px;
}
/* sb-section / sb-proj label 已改用 --fs-sm，會自動跟著 fs-toggle 縮放 */

/* ══════════════════════════════════════════════════
   Dark theme（<html data-theme="dark">）
   ══════════════════════════════════════════════════ */
[data-theme="dark"] {
  /* ── 表面層次（design-system-v3 §3b night：深紫黑 grey 暗階）*/
  --paper:       var(--grey-850);  /* #1D1E2B */
  --bg-page:     var(--grey-900);  /* #16161F */
  --bg-card:     var(--paper);     /* #1D1E2B 主工作表面 */
  --bg-elevated: var(--grey-800);  /* #26283B */
  --bg-subtle:   var(--grey-950);  /* #13131B 比 card 暗：sidebar / 看板欄底 */
  --bg-section:  #26293E;          /* 分組標題列 / 表頭 / sticky header */
  --bg-hover:    #23243A;          /* hover 底色（card 可感知）*/
  --bg-sunk:     #101018;
  --bg-overlay:  rgba(0,0,0,.80);
  --bg-tooltip:  #26283B;          /* tooltip chip：與 light 一致，刻意不切換 */
  --bg-load-chip: rgba(22,22,31,.85);   /* Time Board % chip 深底（配 dark --text-primary）*/

  /* 互動表面 token（dark：拉開層次）*/
  --bg-input:    var(--bg-sunk);
  --bg-control:  var(--bg-elevated);
  --bg-frozen:   var(--bg-card);

  /* alias */
  --bg-muted:    #2E3050;  /* 控制項 hover（疊 control 需可感知回饋）*/

  /* ── Glass dark（design-system-v3 §3c night：深底 + 微亮邊；blur 統一為 20px）*/
  --glass-bg:     rgba(29, 30, 43, .62);
  --glass-border: rgba(255, 255, 255, .10);
  --glass-blur:   20px;
  --glass-shadow: 0 8px 30px rgba(0, 0, 0, .40);
  --modal-shadow: inset 0 1px 0 rgba(255,255,255,.11), 0 2px 8px rgba(0,0,0,.40), 0 18px 42px rgba(0,0,0,.52);
  --modal-scrim:  rgba(6,6,12,.60);

  /* ── 邊框 / 分隔線（design-system-v3 §3b night：紫調冷灰）*/
  --border-faint: #292B41;
  --border-input: var(--grey-700);  /* #393A4B */
  --border-card:  var(--grey-750);  /* #2C2D42 */
  --border-hover: #4D4F69;
  --divider:      #292B41;

  /* ── Sidebar（dark：與 subtle 同階凹底 + 右側分隔線）*/
  --bg-sidebar:         var(--bg-subtle);  /* #13131B */
  --bg-sidebar-hover:   var(--bg-hover);
  --border-sidebar:     var(--divider);
  --text-sidebar:       var(--text-primary);
  --text-sidebar-muted: var(--text-secondary);
  --text-sidebar-hint:  var(--text-tertiary);

  /* ── 文字色階（design-system-v3 §3b night：冷白 / 紫調冷灰）*/
  --text-primary:   #EEEFFC;     /* 對 bg-card #1D1E2B 對比充足 */
  --text-secondary: #B0B5C0;
  --text-tertiary:  #858699;
  --text-link:      var(--accent-text);  /* violet 亮版 */

  /* ── Semantic 色相家族 dark override（design-system-v3 §3a night；夜螢光功能色）*/
  --accent:       var(--violet-500);   /* #8A2BFF 實心底白字 5.4:1（夜唯一白字實心底）*/
  --accent-text:  var(--violet-400);   /* #9E7BFF 連結/必填星/選中/focus 邊框 5.3:1 */
  --accent-soft:  rgba(138,43,255,.16);
  --accent-fill:  rgba(138,43,255,.30);
  --info:         var(--cyan-300);     /* #00F5FF 點/填色/複測 */
  --info-text:    var(--cyan-300);     /* #00F5FF 12:1 */
  --info-soft:    rgba(0,245,255,.16);
  --info-fill:    rgba(0,245,255,.30);
  --success:      var(--lime-400);     /* #B4FF00 點/填色/完成 */
  --success-soft: rgba(180,255,0,.16);
  --success-fill: rgba(180,255,0,.30);
  --warn:         var(--yellow-400);   /* #FFFF00 點/填色/處理中 */
  --warn-soft:    rgba(255,255,0,.16);
  --warn-fill:    rgba(255,255,0,.32);
  --warn-solid:   var(--yellow-400);   /* 底 #FFFF00 配深字 #16161F（btn-warn）*/
  --danger:       var(--pink-400);     /* #FF5CA8 點/填色（實心底配深字 #16161F，白字 2.9:1 禁用）*/
  --danger-text:  var(--pink-400);     /* #FF5CA8 5.8:1 */
  --danger-soft:  rgba(255,92,168,.16);
  --neutral-dot:  #858699;             /* 中性色點（低優先淡點另用 #4D4F69）*/
  /* --ink #232433・--ink-muted #5F6172・--danger-solid #AE2012＝日夜共用，不 override（見 :root）*/

  /* 舊過渡色 --warn-fg/--success-fg dark 已於 2026-07-11 UAT 退役（見 :root 註）*/
  --soft-gray:    rgba(255,255,255,.07);

  /* ── 文字 on accent / on bright（accent 夜實心底仍配白字；warn/success/danger 夜亮底配深字 #16161F）*/
  --text-on-accent: #FFFFFF;
  --text-on-bright: #16161F;   /* §6.3：夜亮實心底深字 */

  /* ── 陰影 dark：黑陰影在深底不可見 → 浮層靠「明顯亮邊 ring」界定輪廓（.14/.18）+ 表面色比背景亮
     （--bg-elevated vs --bg-page 色差，浮層範圍主要靠這個色差被看見）*/
  --shadow-sm: 0 4px 14px rgba(0,0,0,.50), 0 0 0 1px rgba(255,255,255,.14);
  --shadow-lg: 0 16px 40px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.18);

  /* ── select 箭頭 dark 亮版（stroke=--text-tertiary #858699）*/
  --select-chevron: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23858699' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");

  /* ── 互動：focus-ring 暗模式（violet 拉亮 alpha 配深底；UAT 決議：不加發光）*/
  --focus-ring-color: rgba(138,43,255,.38);
  --focus-ring:       0 0 0 3px var(--focus-ring-color);

  /* ── btn-primary 暗模式 → violet 招牌 CTA（accent #8A2BFF 實心白字 5.4:1；bg/fg 承 :root、僅 hover override）*/
  --btn-primary-hover: var(--violet-400);   /* #9E7BFF 夜 hover 提亮 */

  /* ── 內部留言 note-box 暗模式（2026-07-22 金系）：收一階暖金 amber-400 #F0B93A，刻意不吃 warn 夜 #FFFF00 的刺眼 */
  --note-bg:     rgba(240,185,58,.12);  /* amber-400 #F0B93A @12%（大面積淡底不刺眼）*/
  --note-border: rgba(240,185,58,.38);
  --note-accent: var(--amber-400);      /* #F0B93A 夜間暖金 */
  --note-strong: #F5C765;               /* 亮金字（深底過 AA）*/
  --note-btn-text: #16161F;             /* 金底送出鈕深字 */
  --note-accent-hover: #E0A62E;         /* 金鈕 hover */
  --warn-border: rgba(255,255,0,.35);   /* warn 夜主值 #FFFF00 @35%（unsaved-pill 邊框）*/

  /* ── scrollbar */
  --scroll-thumb:       rgba(255,255,255,.20);
  --scroll-thumb-hover: rgba(255,255,255,.35);
}

/* 主題切換平滑過渡（preload 期間關閉避免首屏閃動） */
html:not(.sb-preload) body,
html:not(.sb-preload) #main,
html:not(.sb-preload) #content,
html:not(.sb-preload) .card,
html:not(.sb-preload) .kb-col,
html:not(.sb-preload) .kb-card,
html:not(.sb-preload) .modal,
html:not(.sb-preload) .reply-card,
html:not(.sb-preload) .psc {
  transition: background-color .18s ease, color .18s ease, border-color .18s ease;
}
/* sidebar 保留原 width/min-width transition，同時加上色彩 */
html:not(.sb-preload) #sidebar {
  transition: width .2s ease, min-width .2s ease,
              background-color .18s ease, color .18s ease, border-color .18s ease;
}

/* ── 全站導航 fade（搭配 site-chrome.js 的 mxReload/mxNavigate） ───
   reload/href 觸發前先加 .navigating 讓畫面淡出，避免「modal 關 → 舊內容停留 → 整頁閃白」的中間態 */
body.navigating {
  opacity: .35;
  transition: opacity .12s ease-out;
  pointer-events: none;
}

/* ── Reset ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family:
    'Inter', 'Inter Fallback',
    -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI',
    'PingFang TC', 'Noto Sans TC', 'Microsoft JhengHeiUI', 'Microsoft JhengHei',
    sans-serif;
  font-feature-settings: 'cv11', 'ss01', 'palt';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--body-bg);
  color: var(--text-primary);
  font-size: var(--fs-lg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* 數字 / 統計欄位等寬數字（Apple 派細節）*/
.stat-value, .num,
table th, table td,
.info-value, .issue-num,
.psc-total-badge {
  font-variant-numeric: tabular-nums;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* ── 全域動畫 ─────────────────────────────────────── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ══════════════════════════════════════════════════
   Layout
   ══════════════════════════════════════════════════ */
#app { flex: 1; display: flex; overflow: hidden; position: relative; }

/* ── Sidebar ─────────────────────────────────────── */
#sidebar {
  width: 224px; min-width: 224px;
  /* 改回不透明 --bg-sidebar（冷 sage）做出與主畫面的層次；
     原毛玻璃 --glass-bg 近白透明，與主區區隔不足（PM 回報太淺）。
     暗色版 --bg-sidebar 仍為深色，方向一致。 */
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-card);   /* 明確分隔線（底色層次 + 線雙管，仿 Linear/Notion）*/
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width .2s ease, min-width .2s ease;
}
/* 首次 paint 前關閉 transition，避免 class 套用當下被動畫化 */
html.sb-preload #sidebar { transition: none !important; }
.sb-brand {
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);   /* 左 22 對齊 nav icon 左緣（#sb-nav 10 + a 12）*/
  position: relative;
  display: flex; align-items: center; gap: var(--space-2);
}
.sb-brand-name {
  flex: 1; min-width: 0; font-size: var(--fs-body); font-weight: var(--fw-medium);
  color: var(--text-sidebar); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* theme-aware utility：讓同一份 markup 放兩種素材，依 [data-theme] 切換顯示 */
.theme-dark-only                            { display: none; }
[data-theme="dark"] .theme-light-only       { display: none; }
[data-theme="dark"] .theme-dark-only        { display: block; }

#sb-nav { flex: 1; padding: var(--space-2) var(--space-2); overflow-y: auto; }
.sb-section {
  font-size: var(--fs-sm); color: var(--text-sidebar-hint); letter-spacing: .04em; font-weight: var(--fw-medium);
  padding: var(--space-2) var(--space-3) var(--space-1); margin-top: var(--space-1);
}
/* 側欄選單列。`.sb-foot .sb-link`（側欄底部固定區的按鈕）共用同一份規則——
   同概念不寫第二份樣式，差異只在它是 <button> 需重置瀏覽器預設（見 .sb-foot 段）。 */
#sb-nav a, .sb-foot .sb-link {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-3); border-radius: var(--r-sm);
  color: var(--text-sidebar-muted); font-size: var(--fs-body);
  cursor: pointer; margin-bottom: var(--space-1);
  transition: all .15s; user-select: none; outline: none;
}
#sb-nav a:hover, .sb-foot .sb-link:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar); }
/* focus 幾何/顏色解耦已備 --focus-ring-color（見 :root）；inset 暫留 accent 實心保鍵盤 focus 清晰，
   待 Phase 2 focus 色定案 + Phase 4 glow 上線再遷移至 --focus-ring-color（design §7；避免現階段變半透明淡化）*/
#sb-nav a:focus-visible, .sb-foot .sb-link:focus-visible { box-shadow: 0 0 0 2px var(--accent-text) inset; }
#sb-nav a.active {
  background: transparent;
  color: var(--text-sidebar); font-weight: var(--fw-medium);
  position: relative;
}
#sb-nav a.active::before {
  content: '';
  position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 2px; height: 16px; border-radius: var(--r-pill);
  background: var(--accent-text);
}
#sb-nav a svg, .sb-foot .sb-link svg { width: 22px; height: 22px; flex-shrink: 0; }

/* ── Sidebar 底部固定區（不隨主選單捲動）────────────── */
/* 目前只放「更新內容」（更版公告重看入口，僅內部使用者渲染）。 */
.sb-foot { flex: none; padding: var(--space-2); border-top: 1px solid var(--border-card); }
/* <button> 重置：其餘視覺一律吃上方與 #sb-nav a 共用的那份規則 */
.sb-foot .sb-link {
  width: 100%; border: none; background: none; text-align: left;
  font-family: inherit; margin-bottom: 0;
}
/* 「新」未讀標記靠右；已讀後由 JS 整顆移除 */
.sb-foot .sb-link .rn-new { margin-left: auto; }

/* ── Sidebar 分組（工作中心 / 管理中心）─────────────── */
.sb-grp { }
.sb-grp-hd {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-sm); color: var(--text-sidebar-hint);
  letter-spacing: .04em; font-weight: var(--fw-medium);
  padding: var(--space-2) var(--space-3) var(--space-1); margin-top: var(--space-1);
  cursor: pointer; user-select: none; border: none; background: none; width: 100%;
  outline: none;
}
.sb-grp-hd:hover { color: var(--text-sidebar-muted); }
.sb-grp-hd:focus-visible { box-shadow: 0 0 0 2px var(--accent-text) inset; border-radius: var(--r-xs); }
.sb-grp-hd .sb-grp-label { flex: 1; text-align: left; }
.sb-grp-hd svg { width: 12px; height: 12px; transition: transform .2s; flex-shrink: 0; opacity: .6; }
.sb-grp.collapsed .sb-grp-hd svg { transform: rotate(-90deg); }
.sb-grp.collapsed .sb-grp-body { display: none; }
/* 收合 sidebar 時隱藏群組標頭文字 & 整個 grp-hd */
html.sb-collapsed #app .sb-grp-hd { display: none; }

/* ── Sidebar 收藏專案（★ 釘選，跟人走）──────────────── */
/* 比一般 nav 連結更緊湊、縮排，視覺上隸屬「專案列表」下方 */
#sb-nav a.sb-fav {
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-8); gap: var(--space-2); font-size: var(--fs-sm);
  color: var(--text-sidebar-muted);
}
#sb-nav a.sb-fav .sb-fav-star { width: 13px; height: 13px; flex-shrink: 0; color: var(--warn); opacity: .85; }
#sb-nav a.sb-fav .sb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#sb-nav a.sb-fav.active .sb-fav-star { opacity: 1; }
/* 收合 sidebar 時隱藏收藏列（僅 icon rail 太擠，且星號無意義）*/
html.sb-collapsed #app a.sb-fav { display: none; }

/* ── 頂部 avatar（22px，點擊開帳號 panel）+ 角色漸層 ───────── */
.sb-avatar {
  width: 22px; height: 22px; border-radius: 50%; padding: 0; border: none; cursor: pointer;
  display: grid; place-items: center; font-size: 10px; font-weight: var(--fw-bold);
  color: var(--text-on-accent); flex-shrink: 0; overflow: hidden;
  background: var(--ink-muted);  /* 單色（角色 class 一律 override 同值）*/
}
.sb-avatar:focus-visible { box-shadow: var(--focus-ring); }
/* 頭像統一單色（2026-07-02 A6：去角色配色）。產品化後角色可自由設定＝無「哪個角色該什麼色」，
   故全站頭像一律 --ink-muted 實心底（日夜共用，白字 6.1:1 兩主題皆過 AA），與列表頭像 .avatar-md 一致。
   角色 class 名（.sb-avatar-admin/manager/team/client）保留為 plumbing、視覺一律相同（呼叫端待 R2 一併收斂）。
   〔2026-07-10 page-chrome-status-icons：--ink #232433 夜間壓側欄看不見 → 全站頭像提亮為 --ink-muted #5F6172〕*/
.sb-avatar-admin,
.sb-avatar-manager,
.sb-avatar-team,
.sb-avatar-client  { background: var(--ink-muted); }

/* 離職者頭像：全站一致灰階（帳號管理卡片 / 任務列表 / 看板）；名字保持原色、不加 badge。
   filter 不涉及色票，light / dark 雙模直接成立 */
.avatar-left { filter: grayscale(100%); opacity: .6; }

/* ── 帳號 panel（點 avatar 彈出；取代原 sidebar 底部帳號區）──── */
.account-panel {
  position: fixed; top: 46px; left: 12px; width: 226px; z-index: 1150;
  background: var(--bg-elevated); border: 1px solid var(--border-card);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); overflow: hidden;
}
.account-panel[hidden] { display: none; }
.ap-div { height: 1px; background: var(--divider); }
.ap-link, .ap-logout-btn {
  display: flex; align-items: center; gap: var(--space-2); width: 100%;
  padding: var(--space-3) var(--space-3); font-size: var(--fs-body); font-family: inherit;
  color: var(--text-primary); background: none; border: none; cursor: pointer;
  text-decoration: none; text-align: left; box-sizing: border-box;
}
.ap-link svg, .ap-logout-btn svg { width: 17px; height: 17px; flex-shrink: 0; color: var(--text-tertiary); }
.ap-link:hover, .ap-logout-btn:hover { background: var(--bg-hover); }
.ap-logout { display: block; }
.ap-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: var(--space-2) var(--space-3); }
.ap-lbl { font-size: var(--fs-body); color: var(--text-secondary); }

/* panel 內 segmented：字級（小/中/大）與外觀（日/夜），label 與控制同行不斷行 */
.fs-toggle, .theme-seg {
  display: flex; gap: 1px; padding: var(--space-0_5); flex-shrink: 0;
  background: var(--bg-muted); border-radius: var(--r-sm);
}
.fs-toggle { width: 120px; }
.theme-seg { width: 84px; }
.fs-toggle button, .theme-seg button {
  flex: 1; height: 26px; padding: 0; border: none; background: transparent;
  color: var(--text-tertiary); font-family: inherit; font-size: var(--fs-sm); font-weight: var(--fw-medium);
  border-radius: var(--r-xs); cursor: pointer; transition: background .15s, color .15s;
}
.fs-toggle button:hover, .theme-seg button:hover { color: var(--text-primary); }
.fs-toggle button.active, .theme-seg button.active { background: var(--bg-card); color: var(--text-primary); font-weight: var(--fw-heading); box-shadow: var(--shadow-sm); }
.fs-toggle button:focus-visible, .theme-seg button:focus-visible { box-shadow: var(--focus-ring); }

/* toggle switch（.mx-switch）：共用開關控制元件（2026-06-17 自 Issues 頁 @section Styles 上收，登記於 ui-components.md）*/
.mx-switch { position: relative; width: 32px; height: 18px; flex-shrink: 0; }
.mx-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.mx-switch-slider {
  position: absolute; inset: 0; background: var(--bg-elevated);
  border: 1px solid var(--border-input);   /* off 狀態軌道在日間會與 panel 底色融合，加邊框讓凹槽可見（雙模） */
  border-radius: var(--r-pill); cursor: pointer; transition: background .15s, border-color .15s;
}
.mx-switch-slider::before {
  content: ''; position: absolute;
  width: 12px; height: 12px; left: 3px; top: 2px;   /* top=2：18px 軌內含 1px 邊，圓鈕垂直置中（上下各留 3px 外緣）；原 3px 使鈕偏低 1px */
  background: var(--text-tertiary); border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0,0,0,.35);   /* 2026-06-23：knob 加陰影，避免 dark「on」態白滑塊在淺石墨軌（--accent 翻淺）上糊掉 */
  transition: transform .15s, background .15s;
}
/* 2026-07-21 DS 對齊：開啟軌道＝實心填滿→用 --accent（實心底語意 token），非 --accent-text（文字/邊框語意）。
   使全站開關「開」與 btn-primary、內部留言 --note-accent 日夜同紫；連帶清單/時間板夜間由亮紫轉品牌深紫（白鈕 5.4:1 過標準）。 */
.mx-switch input:checked + .mx-switch-slider { background: var(--accent); border-color: var(--accent); }
.mx-switch input:checked + .mx-switch-slider::before { transform: translateX(14px); background: #fff; }

/* ── Main ────────────────────────────────────────── */
/* v2 Apple 派：拿掉 topbar，sidebar + 內容區直接拼；頁面標題與 CTA 各頁自行處理 */
/* v2.5：#main / #content 改 transparent，讓 body 的 bg-page + 光暈 gradient 透到右側
   各元件（.card / .issue-table 容器等）自身有 bg，視覺不變；只有卡片間隙會透出彩色光暈 */
#main    { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; background: transparent; }
#content { flex: 1; overflow-y: auto; padding: var(--space-5) var(--space-6); background: transparent; }

/* ══════════════════════════════════════════════════
   Buttons
   ══════════════════════════════════════════════════ */
/* 全站按鈕統一高度 32px（Linear 對齊）與字級 --fs-body(13px)/400 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1);
  height: 32px; padding: 0 var(--space-3); border-radius: var(--r-sm);
  font-size: var(--fs-body); font-weight: 400; line-height: 1;
  cursor: pointer; border: 1px solid transparent; font-family: inherit;
  transition: all .15s; white-space: nowrap; outline: none;
  box-sizing: border-box;
}
.btn:focus-visible { box-shadow: var(--focus-ring); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary   { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); }
.btn-primary:hover { background: var(--btn-primary-hover); border-color: var(--btn-primary-hover); }
.btn-secondary { background: var(--bg-control); color: var(--text-primary); border-color: var(--border-input); }
.btn-secondary:hover { background: var(--bg-muted); border-color: var(--border-hover); }
/* 內部留言送出鈕（2026-07-22）：金底深字＝內部語意色，取代舊「內部/公開都 btn-primary 紫、只換字」；換色＝防誤送。JS toggleReplyInternal 依 toggle 切 btn-note↔btn-primary */
.btn-note { background: var(--note-accent); color: var(--note-btn-text); border-color: var(--note-accent); }
.btn-note:hover { background: var(--note-accent-hover); border-color: var(--note-accent-hover); }
/* btn-delete：outline 風格（v2.1 — 不填實色，避免成為「畫面上的第 4 種亮色」）
   破壞性辨識度由 danger 紅邊框 + danger 文字承擔；hover 才微微亮起 soft-danger 底 */
.btn-delete    { background: var(--bg-card); color: var(--danger-text); border-color: var(--danger-text); }
.btn-delete:hover { background: var(--danger-soft); border-color: var(--danger-text); }
/* btn-warn：warn 警示色按鈕（DS 按鈕變體，保留備用）。實心白字一律 --warn-solid。
   註：內部留言送出鈕 2026-07-16（B-5）已改 accent 實心 btn-primary，不再套此 class；目前站內無固定使用處 */
.btn-warn      { background: var(--warn-solid); color: var(--text-on-bright); border-color: var(--warn-solid); }
.btn-warn:hover { background: var(--warn-solid); border-color: var(--warn-solid); filter: brightness(1.05); }
.btn-sm        { /* 舊相容：.btn 已為此尺寸，保留以免舊程式壞掉 */ }

/* ── View Toggle（清單/看板切換） ─────────────────── */
.view-toggle { display: flex; gap: var(--space-0_5); background: var(--bg-muted); border-radius: var(--r-sm); padding: var(--space-1); height: 32px; box-sizing: border-box; }
.view-btn {
  padding: 0 var(--space-2); border-radius: var(--r-xs); border: none;
  background: transparent; color: var(--text-tertiary);
  font-size: var(--fs-body); cursor: pointer;
  display: flex; align-items: center; gap: var(--space-1); transition: all .15s;
  font-family: inherit;
}
.view-btn:not(.active):hover { background: var(--bg-hover); color: var(--text-secondary); }
.view-btn.active { background: var(--bg-elevated); color: var(--text-primary); }

.btn-icon {
  width: 32px; height: 32px; padding: 0; border-radius: var(--r-xs); background: transparent;
  border: 1px solid transparent; cursor: pointer;
  color: var(--text-tertiary); transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center;
  outline: none; box-sizing: border-box; flex-shrink: 0;
}
.btn-icon:hover        { background: var(--bg-muted); border-color: transparent; }
.btn-icon:focus-visible { box-shadow: var(--focus-ring); }
.btn-icon svg { width: 15px; height: 15px; display: block; }

/* disabled：全站 ghost（透明底＋淡邊＋淡字）。不再用 opacity dim 深色 primary（會變深灰、像可按）。 */
.btn:disabled,
.btn-icon:disabled {
  background: transparent; color: var(--text-tertiary); border-color: var(--border-faint);
  cursor: not-allowed; pointer-events: none;
}

/* ══════════════════════════════════════════════════
   Cards
   ══════════════════════════════════════════════════ */
/* read-only 卡片：default 軟陰影、無 hover 變化（Apple 派 — 不誤導可點性）。
   可點容器（.kb-card / .psc）有自己的 hover lift 規則，不靠 .card 通用 hover */
.card      { background: var(--card-bg); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border-card); box-shadow: none; }
.card-pad  { padding: var(--space-5); }
.card-title { font-size: var(--fs-body); font-weight: var(--fw-heading); color: var(--text-primary); }

/* ══════════════════════════════════════════════════
   Badges
   ══════════════════════════════════════════════════ */
/* Badge 色點制（design-system-v3 §4）：透明底、無框、中性字＋6px 語意色點；尺寸/圓角/字級不變 */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: var(--space-0_5) var(--space-2); border-radius: var(--r-xs);
  font-size: var(--fs-xs); font-weight: 500; color: var(--text-primary);
  background: transparent;
  white-space: nowrap; line-height: 1.5;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--neutral-dot); }
/* 非狀態語意的通用色點修飾（如更版公告「新」標記）；狀態/優先/屬性仍走下方對照表 */
.badge-dot--accent { background: var(--accent); }
/* 備援開關（PM 已知情）：無框制若密集表格辨識度不足→取消下行註解加中性細框（不動 markup）
.badge { box-shadow: inset 0 0 0 1px var(--border-input); } */

/* 狀態色點：待分配=accent / 處理中=warn / 複測中=info / 完成=success / 其他=中性 */
.status-todo   .badge-dot { background: var(--accent); }
.status-doing  .badge-dot { background: var(--warn); }
.status-review .badge-dot { background: var(--info); }
.status-done   .badge-dot { background: var(--success); }
.status-other  .badge-dot { background: var(--neutral-dot); }
.status-todo, .status-other { color: var(--text-secondary); }   /* 次要態淡字 */

/* ══════════════════════════════════════════════════
   全站 icon 雙色調（2026-07-12）：所有 currentColor 線性 inline SVG 統一「線＋淡填」。
   機制：CSS fill 覆蓋各 icon 的 fill="none" 屬性（CSS property 勝過 presentation attribute），
         子 <path> 無自身 fill 屬性→繼承 currentColor；fill-opacity 由 --icon-fill 一處控。
   ⚠️ 各 icon 外殼（IconHelper.cs / site-core.js mxIcon / _Layout NavIcon）標記仍是 fill="none"，
      但實際渲染為雙色調由此規則接手——改風格改這裡，不必動那三處外殼。
   ✅ 不影響：收藏星 .sb-fav-star（fill-based、無 stroke=currentColor）、Google logo（無 stroke=currentColor）、
      spinner _SPIN（path 皆零面積線段、填不出面）；emoji（字型 Unicode、非 SVG）完全無關。
   opt-out：需維持純線條的 icon 加 class .ico-line。
   ══════════════════════════════════════════════════ */
svg[stroke="currentColor"]:not(.ico-line) {
  fill: currentColor;
  fill-opacity: var(--icon-fill);
}

/* 狀態 icon（page-chrome-status-icons）：任務狀態色點→同族色線性 icon（收件匣/時鐘/放大鏡/打勾圈/減號圈）。
   沿用上方狀態→族色 map，改套在 icon 的 color（currentColor）；同 .badge-icon 也用於列點/看板欄點（.ir-dot/.kb-col-dot，族色走外層 inline color）。
   優先/屬性/邀請維持 .badge-dot。備援：密集列辨識度不足→整組改回 .badge-dot markup（一行）。 */
.badge-icon { width: 14px; height: 14px; flex: none; }
.status-todo   .badge-icon { color: var(--accent); }
.status-doing  .badge-icon { color: var(--warn); }
.status-review .badge-icon { color: var(--info); }
.status-done   .badge-icon { color: var(--success); }
.status-other  .badge-icon { color: var(--neutral-dot); }

/* 客戶邀請：待啟用=warn / 待審核=中性 / 已啟用=success */
.invitation-pending .badge-dot { background: var(--warn); }
.invitation-review  .badge-dot { background: var(--neutral-dot); }
.invitation-active  .badge-dot { background: var(--success); }
.invitation-review  { color: var(--text-secondary); }

/* 類型（屬性）：全中性、現制不動＝outline chip、無色點（typeBadge 不輸出 dot）*/
.type-fix, .type-opt, .type-other {
  background: transparent; color: var(--text-primary); font-weight: 400;
  box-shadow: inset 0 0 0 1px var(--border-input);
}

/* 優先色點：高=danger(+medium) / 中=warn / 低=中性淡 */
.priority-high .badge-dot { background: var(--danger); }
.priority-high { font-weight: var(--fw-medium); }
.priority-mid  .badge-dot { background: var(--warn); }
.priority-low  .badge-dot { background: var(--border-hover); }   /* 中性淡點 #C7C9D6 / #4D4F69 */
.priority-low  { color: var(--text-secondary); }

/* ══════════════════════════════════════════════════
   Issue Table
   ══════════════════════════════════════════════════ */
.issue-table { width: 100%; border-collapse: collapse; }
.issue-table th {
  padding: var(--space-3) var(--space-3);
  font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-secondary);
  letter-spacing: .03em;
  border-bottom: 1px solid var(--divider);
  background: var(--bg-section);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.issue-table th a                      { color: inherit; text-decoration: none; cursor: pointer; }
.issue-table th a:hover                { color: var(--text-primary); }
.issue-table th .sort-icon             { display: inline-flex; align-items: center; margin-left: var(--space-1); vertical-align: middle; }
.issue-table th .sort-icon.sorted      { color: var(--info-text); }
.issue-table td {
  height: var(--row-data);   /* 統一標準資料列高（DS，2026-07-22；table-cell height＝min-height 語意）*/
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
  font-size: var(--fs-body);
}
.issue-table tr.issue-row               { cursor: pointer; transition: background .1s; }
.issue-table tr.issue-row:hover td      { background: var(--bg-hover); }
.issue-num   { color: var(--text-tertiary); font-size: var(--fs-sm); white-space: nowrap; }
.issue-title { font-weight: 400; color: var(--text-primary); margin-bottom: var(--space-0_5); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }

/* 行內可編輯單元格。可編輯 affordance＝手型游標＋hover 淡底（--bg-muted），與指派頭像同一套；
   不顯示 caret 箭頭（2026-07-21 PM 定案：去 caret、保留 hover 底）*/
.cell-edit {
  cursor: pointer; border-radius: var(--r-xs); padding: var(--space-0_5) var(--space-1); margin: -2px -4px;
  transition: background .1s; display: inline-flex; align-items: center; gap: var(--space-1);
}
.cell-edit:hover { background: var(--bg-muted); }

/* ══════════════════════════════════════════════════
   Issue 狀態分組（Linear 風收合 group header）
   用途：Issues 列表頁的狀態分組開合容器。
   往後所有需要「開合分組」的列表，應沿用這套 class。
   ══════════════════════════════════════════════════ */
#issues-groups { display: flex; flex-direction: column; gap: var(--space-1); }
.issue-group { overflow: hidden; }   /* IA：去卡片化（無底色/圓角），與專案列表扁平索引列統一；分組靠標題 bar(.section-hd, --bg-section) + 列上緣分隔線區隔 */
/* .issue-group-hd / .issue-group-count 樣式併入下方「全站統一列元件」的 .section-hd / .counter-badge */
.issue-group-name { font-weight: var(--fw-medium); font-size: var(--fs-body); }
.issue-group-chev {
  width: 14px; height: 14px; color: var(--text-tertiary);
  margin-left: auto; flex-shrink: 0;
}

/* ── 共用收合區塊（collapsible）──────────────────
   預設展開；容器加 .collapsed 收合。狀態記憶見 site-core.js mxToggleCollapse / mxInitCollapsibles。
   專案列表 (.proj-row) 與任務分組 (.issue-group) 共用此機制。 */
.collapse-body { display: block; }
.collapsible.collapsed .collapse-body { display: none; }
.collapse-chev { transition: transform .15s ease; transform: rotate(180deg); }
.collapsible.collapsed .collapse-chev { transform: rotate(0deg); }

/* ── 全站統一列元件（issue-row / 專案列共同規範）─── */
.list-row {
  display: flex; align-items: center;
  /* 統一列高：原 ≈47px（26px 頭像+編輯熱區撐出）；2026-07-22 收斂為 --row-data(44) ＝全站標準資料列基準。
     無編輯熱區的列會矮，故在共用基底補 min-height 讓各頁列高一致。 */
  min-height: var(--row-data);
  padding: var(--space-1) var(--space-3); cursor: pointer;
  border-top: 1px solid var(--border-card);
  transition: background .1s; user-select: none;
}
.list-row:hover { background: var(--bg-hover); }

/* ── callout box（2026-07-22 DS：帶 icon 的資訊/警示提示條；沿用 note-box 淡底+左條 pattern，換 info/warn 色族。
   底/邊/左條用既有 dark-aware token；info 的 icon 白字因 --info 夜間反亮＝亮青，夜間切深字（見下方 dark override）。icon 由 markup 端塞 IconHelper SVG）。
   用途分態見 docs/ui-tokens.md「information 三態」：helper text(.hint) / tooltip / callout。*/
.callout {
  display: flex; gap: var(--space-2); padding: 11px 13px;
  border-radius: var(--r-md); font-size: var(--fs-sm); line-height: 1.55;
  border: 1px solid transparent;
}
.callout .callout-ico {
  flex: none; width: 18px; height: 18px; display: flex; align-items: center;
  justify-content: center; border-radius: 50%; margin-top: 1px;
}
.callout .callout-ico svg { width: 12px; height: 12px; }
.callout.callout--info { background: var(--info-soft); border-color: var(--info-fill); box-shadow: inset 3px 0 0 var(--info); }
.callout.callout--info .callout-ico { background: var(--info); color: var(--text-on-accent); }
.callout.callout--warn { background: var(--warn-soft); border-color: var(--warn-fill); box-shadow: inset 3px 0 0 var(--warn-solid); }
.callout.callout--warn .callout-ico { background: var(--warn-solid); color: var(--text-on-bright); }
/* --info 日深/夜亮反轉：夜間亮青底改深字（比照 .sf-step.active-review），否則白字對比破表看不見 */
[data-theme="dark"] .callout.callout--info .callout-ico { color: var(--text-on-bright); }

/* 分組標題列（任務列表 .issue-group-hd / 專案列表 .proj-row-hd 為 alias）*/
.section-hd, .issue-group-hd, .proj-row-hd {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); cursor: pointer; user-select: none;
  min-height: var(--row-group);   /* 分組標題列最小高（DS，2026-07-22）*/
  background-color: var(--bg-section);
  transition: background-color .1s;
}
.section-hd:hover, .issue-group-hd:hover, .proj-row-hd:hover { background-color: var(--bg-hover); }

/* 計數小膠囊（分組標題列/列內數量；狀態/屬性標籤走 .badge，勿混用）*/
.counter-badge, .issue-group-count {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  background-color: var(--bg-card);
  padding: 1px var(--space-2); border-radius: var(--r-xs);
  flex-shrink: 0; white-space: nowrap;
}
/* 列底色本身是 --bg-card 時改 elevated 一階，膠囊才浮得出來 */
.counter-badge--elevated { background-color: var(--bg-elevated); }

/* 列表列頭像 26px（任務列 .issue-av / 專案列成員 .wo-av 為 alias）*/
.avatar-md, .issue-av, .wo-av {
  width: 26px; height: 26px; border-radius: 50%;
  background-color: var(--ink-muted); color: #fff;   /* 頭像單色底（--ink-muted #5F6172，白字 6.1:1；2026-07-10 由 --ink 提亮，夜間可見）*/
  display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-xs); font-weight: var(--fw-medium);
  flex-shrink: 0;
}
.avatar-md.no, .issue-av.no { background-color: var(--bg-elevated); color: var(--text-tertiary); }

/* .ir-dot（任務列列前狀態指示，2026-07-10 起包 .badge-icon 同族色線性 icon、非色點；族色由 inline color 控）。
   上收自 Pages/Issues/Index.cshtml（design-system-v3 §5.3）*/
.ir-dot { display: inline-flex; align-items: center; flex: none; margin-right: 10px; }
/* 多人疊放：-6px 疊 + 卡底色分隔環。用 box-shadow 不用 border：避免 border-box
   吃掉 2px 讓頭像圓縮成 22px（與任務列 .avatar-md 26px 不一致），box-shadow 不影響尺寸 */
.wo-av { margin-left: -6px; box-shadow: 0 0 0 2px var(--bg-card); }
.wo-av:first-child { margin-left: 0; }
.wo-av--more { background-color: var(--bg-elevated); color: var(--text-secondary); }

/* ══════════════════════════════════════════════════
   Tickets 三欄 panes（任務列表頁：列表 | 第三欄 inspector）
   詳情注入第三欄時列表收窄成 360px 精簡列；關閉→列表回 100% 寬版多欄。
   篩選/顯示不走這裡（保持列表全寬，見 wireframe-filter-display）。
   ══════════════════════════════════════════════════ */
.tickets-panes { display: flex; align-items: flex-start; }
.tickets-list-pane { flex: 1; min-width: 0; }
/* inspector 開啟 → 列表:第三欄 = 40:60 比例分割（改 30/70 把 4/6 換成 3/7）*/
.tickets-panes.has-inspector .tickets-list-pane { flex: 4 1 0; min-width: 0; }

.ticket-inspector { display: none; flex-direction: column; min-width: 0; }
.tickets-panes.has-inspector .ticket-inspector {
  display: flex; flex: 6 1 0; min-width: 0;
  position: sticky; top: 0; max-height: calc(100vh - 40px); overflow: hidden;
  margin-left: var(--space-4);
  background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--r-md);
}
.ip-hd {
  display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0;
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--divider);
}
.ip-title {
  flex: 1; min-width: 0; font-weight: var(--fw-medium); font-size: var(--fs-body);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ip-close { flex-shrink: 0; }
.ip-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: var(--space-4); container-type: inline-size; }

/* inspector 開啟 → 列表收窄成精簡列：隱藏選用欄（只留 dot + 編號 + 簡述 + 指派）*/
.tickets-panes.has-inspector #issues-groups .ir-unit,
.tickets-panes.has-inspector #issues-groups .ir-start,
.tickets-panes.has-inspector #issues-groups .ir-due,
.tickets-panes.has-inspector #issues-groups .ir-type,
.tickets-panes.has-inspector #issues-groups .ir-prio { display: none !important; }

/* 選中列高亮 */
.issue-row.sel { background: var(--bg-hover); box-shadow: inset 2px 0 0 var(--accent-text); }  /* 選中列：左指示條（UAT 決議：不加發光）*/

/* 響應式：主區窄（≤1080px）→ 第三欄退成右側覆蓋抽屜，列表回全寬不收窄 */
@media (max-width: 1080px) {
  .tickets-panes.has-inspector .tickets-list-pane { flex: 1; width: auto; }
  .tickets-panes.has-inspector #issues-groups .ir-unit,
  .tickets-panes.has-inspector #issues-groups .ir-start,
  .tickets-panes.has-inspector #issues-groups .ir-due,
  .tickets-panes.has-inspector #issues-groups .ir-type,
  .tickets-panes.has-inspector #issues-groups .ir-prio { display: revert !important; }
  .tickets-panes.has-inspector .ticket-inspector {
    position: fixed; top: 0; right: 0; bottom: 0; max-height: none;
    width: min(440px, 92vw); z-index: 200; margin-left: 0;
    border-radius: 0; box-shadow: var(--shadow-lg);
  }
}

/* ══════════════════════════════════════════════════
   Filters & Search
   ══════════════════════════════════════════════════ */
.filter-bar { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); align-items: center; }
/* 篩選膠囊容器：display:contents 讓 .filter-pill 直接成為 .filter-bar 的 flex children，
   與 view 切換/搜尋/顯示同列（取代原本獨立下一排）；空容器不佔位、不留空行 */
.filter-pills { display: contents; }

.search-box {
  display: flex; align-items: center; gap: var(--space-2);
  background: var(--bg-input); border: 1px solid var(--border-input);
  border-radius: var(--r-sm); padding: 0 var(--space-3); height: 32px; min-width: 200px;
  box-sizing: border-box;
}
.search-box:focus-within { border-color: var(--accent-text); box-shadow: var(--focus-ring); }

/* Filter dropdown（filter-bar 內的 select，例如狀態篩選）*/
.filter-select {
  height: 32px; padding: 0 var(--space-8) 0 var(--space-3); border-radius: var(--r-sm);
  border: 1px solid var(--border-input); background: var(--bg-input);
  color: var(--text-primary); font-size: var(--fs-body); font-family: inherit;
  cursor: pointer; outline: none; box-sizing: border-box;
  min-width: 120px;
  background-image: var(--select-chevron);
  background-repeat: no-repeat; background-position: right 10px center;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
.filter-select:hover { border-color: var(--border-hover); }
.filter-select:focus-visible { border-color: var(--accent-text); box-shadow: var(--focus-ring); }
.search-box svg   { width: 14px; height: 14px; color: var(--text-tertiary); flex-shrink: 0; }
.search-box input { border: none; outline: none; font-size: var(--fs-body); color: var(--text-primary); font-family: inherit; width: 100%; background: transparent; }

/* ── 篩選 pill（＋篩選 CTA）：全站共用層（2026-06-24 自 Pages/Issues/Index.cshtml @section Styles 上收）──
   pill＝控制項家族（與 .btn / 搜尋框 同高同字級），非 badge；點「＋篩選」選維度→選值→變成可移除 pill。
   使用頁：我的任務（Issues/Index）、帳號管理（Admin/Users/Index）。JS 各頁自帶維度設定，CSS 共用。 */
.filter-pill {
  display: inline-flex; align-items: center; gap: var(--space-2);
  height: 32px; padding: 0 var(--space-2) 0 var(--space-3); box-sizing: border-box;   /* 8/12px→token（gap 6px、fp-x 18px、fp-clear 6px 為刻意 off-grid 非 4 倍數，維持 literal）*/
  border: 1px solid var(--border-input); background: var(--bg-control);
  border-radius: var(--r-sm); font-family: inherit; line-height: 1;
  font-size: var(--fs-body); color: var(--text-primary); cursor: pointer;
  transition: all .15s;
}
.filter-pill:hover { background: var(--bg-muted); border-color: var(--border-hover); }
.filter-pill .fp-k { color: var(--text-tertiary); }
.filter-pill .fp-v { font-weight: var(--fw-medium); }
.filter-pill .fp-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; color: var(--text-tertiary);
  border-radius: var(--r-xs); font-size: 12px;
}
.filter-pill .fp-x:hover { color: var(--text-primary); background: var(--bg-elevated); }
.filter-pill--add { border-style: dashed; color: var(--text-secondary); padding: 0 14px; }
.fp-clear { background: none; border: none; cursor: pointer; font-family: inherit;
  color: var(--text-secondary); font-size: var(--fs-body); padding: 0 var(--space-1); height: 32px; }
.fp-clear:hover { color: var(--text-primary); }

/* 篩選維度/值彈出選單 */
.filter-menu {
  position: fixed; z-index: 250; min-width: 140px; max-height: 320px; overflow: auto;
  background: var(--bg-card); border: 1px solid var(--border-card);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 4px;
}
.filter-menu-opt {
  display: block; width: 100%; text-align: left; padding: 7px 10px;
  border: none; background: none; cursor: pointer; font-family: inherit; white-space: nowrap;
  font-size: var(--fs-sm); color: var(--text-primary); border-radius: var(--r-sm);
}
.filter-menu-opt:hover { background: var(--bg-hover); }
.filter-menu-opt.active { color: var(--accent-text); font-weight: var(--fw-medium); }
.fp-empty { padding: 8px 10px; color: var(--text-tertiary); font-size: var(--fs-sm); }

/* 篩選按鈕（取代狀態 select；點擊彈出兩層 popover：dimension → option）*/
.filter-btn {
  height: 32px; padding: 0 var(--space-3); gap: var(--space-1);
  display: inline-flex; align-items: center;
  border-radius: var(--r-sm); border: 1px solid var(--border-input);
  background: var(--bg-input); color: var(--text-primary);
  font-size: var(--fs-body); font-family: inherit; cursor: pointer;
  outline: none; box-sizing: border-box; transition: border .15s, background .15s;
}
.filter-btn:hover           { border-color: var(--border-hover); }
.filter-btn:focus-visible   { border-color: var(--accent-text); box-shadow: var(--focus-ring); }
.filter-btn.has-filter      { border-color: var(--accent-text); color: var(--accent-text); background: var(--accent-soft); }
.filter-btn svg             { width: 14px; height: 14px; flex-shrink: 0; }
.filter-btn-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 var(--space-1);
  background: var(--ink); color: var(--text-on-accent); border-radius: var(--r-pill);   /* ink 實心底：白字兩主題皆過 AA */
  font-size: var(--fs-xs); font-weight: var(--fw-bold); line-height: 1;
}

/* Popover：絕對定位於按鈕下方，第一層 dimension 列表 / 第二層 option 列表共用此容器 */
.filter-popover {
  position: fixed; z-index: 1100; min-width: 220px;
  background: var(--bg-elevated); border: none;
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  padding: var(--space-1); max-height: 70vh; overflow-y: auto;
}
.filter-popover .fp-head {
  padding: var(--space-2) var(--space-2) var(--space-1); font-size: var(--fs-sm); color: var(--text-tertiary); font-weight: var(--fw-bold);
}
.filter-popover .fp-row,
.filter-popover .fp-opt,
.filter-popover .fp-back,
.filter-popover .fp-clear {
  display: flex; align-items: center; gap: var(--space-2);
  width: 100%; padding: var(--space-2) var(--space-2); border-radius: var(--r-sm);
  background: transparent; border: none; cursor: pointer; outline: none;
  font-size: var(--fs-body); color: var(--text-primary); font-family: inherit;
  text-align: left;
}
.filter-popover .fp-row:hover,
.filter-popover .fp-opt:hover,
.filter-popover .fp-back:hover,
.filter-popover .fp-clear:hover { background: var(--bg-muted); }
.filter-popover .fp-row-label    { flex: 1; font-weight: var(--fw-medium); }
.filter-popover .fp-row-value    { color: var(--text-secondary); font-size: var(--fs-sm); }
.filter-popover .fp-chev         { color: var(--text-tertiary); flex-shrink: 0; }
.filter-popover .fp-back         { color: var(--text-secondary); font-size: var(--fs-sm); padding: var(--space-1) var(--space-2); margin-bottom: var(--space-0_5); }
.filter-popover .fp-back svg     { color: var(--text-tertiary); }
.filter-popover .fp-divider      { height: 1px; background: var(--divider); margin: var(--space-1) 0; }
.filter-popover .fp-clear        { color: var(--text-secondary); justify-content: center; font-weight: var(--fw-medium); }
.filter-popover .fp-opt.active   { color: var(--accent-text); font-weight: var(--fw-bold); }   /* UAT：選中指示改 accent 紫（非 success 綠）*/
.filter-popover .fp-opt span     { flex: 1; }
.filter-popover .fp-check        { color: var(--accent-text); flex-shrink: 0; }
.filter-popover .fp-empty        { padding: var(--space-4) var(--space-3); color: var(--text-tertiary); font-size: var(--fs-sm); text-align: center; }
.filter-popover .fp-opts-wrap    { max-height: 50vh; overflow-y: auto; }

/* ══════════════════════════════════════════════════
   Pagination
   ══════════════════════════════════════════════════ */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-5); border-top: 1px solid var(--divider);
  font-size: var(--fs-sm); color: var(--text-tertiary);
  flex-wrap: wrap; gap: var(--space-2);
}
.pager-btns { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 var(--space-2);
  border-radius: var(--r-xs); border: 1px solid var(--border-input);
  background: var(--bg-control); color: var(--text-secondary);
  font-size: var(--fs-sm); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .15s; outline: none; font-family: inherit;
}
.page-btn:hover         { background: var(--bg-muted); border-color: var(--border-hover); color: var(--text-primary); }
.page-btn:focus-visible { box-shadow: var(--focus-ring); }
.page-btn.active        { background: var(--btn-primary-bg); color: var(--btn-primary-fg); border-color: var(--btn-primary-bg); }
.page-btn:disabled      { opacity: .35; cursor: not-allowed; pointer-events: none; }
/* <a class="disabled"> 也要實際 disable（:disabled 偽類只對 button 生效）*/
.page-btn.disabled      { opacity: .35; cursor: not-allowed; pointer-events: none; }

/* ══════════════════════════════════════════════════
   Form
   ══════════════════════════════════════════════════ */
.fg       { display: flex; flex-direction: column; gap: var(--space-1); }
.fg.full  { grid-column: 1 / -1; }
/* label 用 Body (CLAUDE.md spec：form input & label = Body 14/primary) */
.fg label { font-size: var(--fs-body); color: var(--text-primary); }
.fg label .req { color: var(--accent-text); margin-left: var(--space-0_5); }

/* form-stack：modal 內表單容器，每個欄位等距，不再用 inline margin-bottom */
.form-stack    { display: flex; flex-direction: column; gap: var(--space-4); }
.form-section  { display: flex; flex-direction: column; gap: var(--space-2); }
.form-section .card-title { font-size: var(--fs-body); font-weight: var(--fw-heading); color: var(--text-primary); }
.fg input, .fg select {
  width: 100%; height: 40px; padding: 0 var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-body); color: var(--text-primary);
  font-family: inherit; outline: none;
  transition: border .15s, box-shadow .15s;
  background: var(--bg-input); line-height: 1;
}
/* 原生 <select> 統一視覺：移除瀏覽器預設箭頭 + 套 design system 自訂箭頭 SVG。
   保留原生 picker 行為（accessibility / 鍵盤 / 行動裝置 native picker 體驗都比客製好），只改外觀。 */
.fg select {
  padding-right: var(--space-8);
  background-image: var(--select-chevron);   /* token 日夜自適應（原寫死 data-URI＋dark override 已收斂）*/
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
.fg textarea {
  width: 100%; padding: var(--space-3) var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-body); color: var(--text-primary);
  font-family: inherit; outline: none;
  transition: border .15s, box-shadow .15s;
  background: var(--bg-input); line-height: 1.65;
}
.fg input:focus, .fg select:focus, .fg textarea:focus {
  border-color: var(--accent-text);
  box-shadow: var(--focus-ring);
}
.fg input[aria-invalid="true"],
.fg select[aria-invalid="true"],
.fg textarea[aria-invalid="true"] { border-color: var(--danger-text); }
.fg textarea { resize: vertical; min-height: 90px; }
/* placeholder 統一走 text-tertiary（過 AA），避免瀏覽器預設灰在深底不可讀 */
.fg input::placeholder, .fg textarea::placeholder { color: var(--text-tertiary); opacity: 1; }

/* Multi-Select */
.ms-wrap    { position: relative; }
.ms-trigger {
  width: 100%; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-body); color: var(--text-primary);
  background: var(--bg-input); cursor: pointer; text-align: left;
  display: flex; align-items: center; justify-content: space-between;
  font-family: inherit; outline: none;
  transition: border .15s, box-shadow .15s;
}
.ms-trigger:focus,
.ms-trigger.open { border-color: var(--accent-text); box-shadow: var(--focus-ring); }
.ms-arrow { transition: transform .15s; flex-shrink: 0; color: var(--text-tertiary); }
.ms-trigger.open .ms-arrow { transform: rotate(180deg); }
.ms-menu {
  display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg-elevated); border-radius: var(--r-md);
  padding: var(--space-1); z-index: 50; box-shadow: var(--shadow-sm);
}
.ms-menu.show { display: block; }
.ms-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-2); border-radius: var(--r-xs);
  font-size: var(--fs-body); color: var(--text-primary);
  cursor: pointer; user-select: none;
}
.ms-item:hover                       { background: var(--bg-muted); }
.ms-item input[type="checkbox"]      { width: 15px; height: 15px; accent-color: var(--success); cursor: pointer; flex-shrink: 0; }

/* Inline Popup */
.inline-opt {
  padding: var(--space-2) var(--space-3); font-size: var(--fs-body);
  cursor: pointer; border-radius: var(--r-xs); color: var(--text-primary);
  white-space: nowrap; transition: background .1s;
}
.inline-opt:hover  { background: var(--bg-muted); }
.inline-opt.active { background: var(--accent-soft); color: var(--accent-text); }   /* UAT：選中指示改 accent 紫 */

/* ══════════════════════════════════════════════════
   Image Upload & Thumbnails
   ══════════════════════════════════════════════════ */
.img-grid           { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
/* 嵌在 reply-input-box 內的預覽：左右配合 textarea 內距，上下留呼吸空間 */
.img-grid--in-box   { padding: 0 var(--space-3) var(--space-2); margin-top: 0; }
.img-grid--in-box:empty { display: none; }
.img-thumb {
  position: relative; width: 80px; height: 80px; cursor: pointer;
  border-radius: var(--r-sm); overflow: hidden;
  cursor: pointer; flex-shrink: 0;
  /* 細框＋點擊/選定高亮（參考 Claude 桌面 App 上傳縮圖；色彩依 iTracker 設計規範） */
  border: 1px solid var(--border-input);
  transition: border-color .15s, box-shadow .15s;
}
.img-thumb:hover,
.img-thumb:active,
.img-thumb:focus-visible,
.img-thumb.is-selected {
  border-color: var(--accent-text);
  box-shadow: var(--focus-ring);
  outline: none;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-thumb .del {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,.6); border: none; cursor: pointer;
  border-radius: var(--r-xs); display: flex; align-items: center; justify-content: center; padding: var(--space-1);
}
.img-thumb .del svg { width: 11px; height: 11px; color: var(--text-on-accent); display: block; }
/* 上傳前預覽縮圖：hover 顯示「編輯」鉛筆提示（點縮圖開截圖編輯器 mxAnnotate）*/
.thumb-edit {
  position: absolute; bottom: 3px; right: 3px; width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-xs); background: var(--accent); color: var(--text-on-accent);
  opacity: 0; transition: opacity .15s; pointer-events: none;
}
.thumb-edit svg { width: 12px; height: 12px; display: block; }
.img-thumb:hover .thumb-edit,
.img-thumb:focus-visible .thumb-edit { opacity: 1; }

/* Issue 卡片內縮圖列 */
.thumb-strip      { display: flex; gap: var(--space-1); flex-wrap: wrap; margin-top: var(--space-1); }
.thumb-strip.thumb-strip--mt { margin-top: var(--space-2); }
/* 問題截圖（Detail 頂部）縮圖 */
.issue-shot-strip { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: var(--space-2); }
.issue-shot {
  width: 72px; height: 72px; border-radius: var(--r-sm); overflow: hidden;
  cursor: pointer;
  position: relative;             /* anchor for .shot-delete-btn */
  border: 1px solid var(--border-input);
  transition: border-color .15s, box-shadow .15s;
}
.issue-shot:hover,
.issue-shot:active,
.issue-shot:focus-visible,
.issue-shot.is-selected {
  border-color: var(--accent-text);
  box-shadow: var(--focus-ring);
  outline: none;
}
.issue-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-strip .th  {
  width: 48px; height: 48px; border-radius: var(--r-xs); overflow: hidden;
  cursor: pointer; position: relative; flex-shrink: 0;
}
/* 圖片右上角 × 刪除鈕：hover 才浮出 */
.shot-delete-btn {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; padding: 0; border: none;
  border-radius: var(--r-xs); background: rgba(0,0,0,.6);
  color: #fff; font-size: 14px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s, background .15s;
}
.issue-shot:hover .shot-delete-btn,
.thumb-strip .th:hover .shot-delete-btn { opacity: 1; }
.shot-delete-btn:hover { background: rgba(0,0,0,.8); }
.shot-delete-btn:focus-visible { opacity: 1; box-shadow: var(--focus-ring); outline-offset: 1px; }
.thumb-strip .th img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-more {
  width: 48px; height: 48px; border-radius: var(--r-xs);
  background: var(--bg-muted);
  display: grid; place-items: center;
  font-size: var(--fs-sm); color: var(--text-secondary);
  cursor: pointer; flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   Stats（總覽大數字卡）
   ══════════════════════════════════════════════════ */
.stat-grid {
  display: flex; flex-wrap: wrap; gap: var(--space-2); margin-bottom: var(--space-4);
}
/* Linear 風 metric 卡（限寬不撐滿；個人中心用）*/
.stat-card {
  width: 155px; background: var(--card-bg); border-radius: var(--r-md);
  padding: var(--space-3) var(--space-3); border: 1px solid var(--border-card); box-shadow: none;
}
.stat-kicker { display: flex; align-items: center; gap: var(--space-1); font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-secondary); margin-bottom: var(--space-1); }
.stat-value  { font-size: 20px; font-weight: var(--fw-heading); line-height: 1.2; color: var(--text-primary); font-variant-numeric: tabular-nums; }
/* 狀態色點（取代舊彩色頂條）*/
.stat-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; display: inline-block; }
.stat-dot--magenta  { background: var(--accent-text); }
.stat-dot--orange   { background: var(--warn); }
.stat-dot--green    { background: var(--success); }
.stat-dot--gray     { background: var(--neutral-dot); }
.stat-dot--gray-700 { background: var(--ink-muted); }
.stat-note   { font-size: var(--fs-sm); color: var(--text-tertiary); margin-top: var(--space-1); }

/* 分佈型 stat-card（類型 / 優先）— 不放大數字，改 3 行 mini list 列出細項 */
.stat-card--dist .stat-dist-list {
  display: flex; flex-direction: column; gap: var(--space-1); margin-top: var(--space-1);
}
.stat-dist-row {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: center; gap: var(--space-2);
}
.stat-dist-label {
  font-size: var(--fs-body); color: var(--text-secondary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; gap: var(--space-1);
}
.stat-dist-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.stat-dist-count {
  font-size: var(--fs-body); font-weight: var(--fw-heading); color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat-dist-pct {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
  min-width: 32px; text-align: right;
}

/* Progress Bars */
.metric-row   { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.metric-label { font-size: var(--fs-body); color: var(--text-secondary); min-width: 64px; }
.metric-bar   { flex: 1; height: 8px; background: var(--bg-muted); border-radius: var(--r-pill); overflow: hidden; }
.metric-bar span { display: block; height: 100%; border-radius: var(--r-pill); }
.metric-count { font-size: var(--fs-sm); color: var(--text-tertiary); min-width: 36px; text-align: right; }

/* 分佈圖三欄並列；窄版自動堆疊 */
.dist-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
.dist-grid--2 { grid-template-columns: repeat(2, 1fr); }

/* Stats 時數預估統計 — 全寬大卡（PM 規劃工時主視覺）*/
.hours-stats-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0 var(--space-6);
}
.hours-stat-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: var(--space-3);
  align-items: baseline;
  padding: var(--space-2) 0; border-bottom: 1px solid var(--divider);
}
.hours-stat-name   { font-size: var(--fs-body); color: var(--text-primary); font-weight: var(--fw-bold); }
.hours-stat-meta   { font-size: var(--fs-sm);  color: var(--text-tertiary); }
.hours-stat-amount { font-size: var(--fs-body); color: var(--info-text); font-weight: var(--fw-bold); min-width: 56px; text-align: right; }
.hours-stats-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: var(--space-3) var(--space-1) var(--space-1); margin-top: var(--space-2);
  border-top: 2px solid var(--divider);
}
.hours-stats-total-label  { font-size: var(--fs-body); font-weight: var(--fw-heading); color: var(--text-primary); }
.hours-stats-total-amount { font-size: var(--fs-lg);   font-weight: var(--fw-heading); color: var(--info-text); }

/* ── iTracker 區塊抬頭：title / 總計 / 匯出 — flex-wrap 不破版 ──────── */
.hours-head {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-3) var(--space-4); row-gap: var(--space-2);
}
.hours-head .section-title { flex: 1 1 auto; min-width: 0; }
.hours-head-end {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2);
  margin-left: auto;
}

/* 篩選輸入元件（共用樣式：column header popover 用）*/
.hours-filter-input {
  height: 32px; padding: 0 var(--space-2); border-radius: var(--r-sm);
  border: 1px solid var(--border-input); background: var(--bg-input);
  color: var(--text-primary); font-size: var(--fs-body); font-family: inherit;
  outline: none; box-sizing: border-box;
}
.hours-filter-input:focus-visible { border-color: var(--accent-text); box-shadow: var(--focus-ring); }

/* iTracker 表頭右側「時薪 NT$ 2,000/人時」標籤（原 .hours-total-tag「總計 X h」已移除，
   因表單下方 tfoot 已有「篩選後合計」） */
.hours-rate-tag {
  font-size: var(--fs-body); color: var(--text-secondary);
}
.hours-rate-tag strong { color: var(--info-text); font-weight: var(--fw-heading); font-size: var(--fs-body); }

.hours-table thead th { text-transform: none; }  /* letter-spacing 沿用 issue-table th 的 .03em */

/* iTracker 表格自身與 issue-table 共享樣式；只覆寫 footer/empty */
.hours-table tfoot td {
  padding: var(--space-3) var(--space-3); font-weight: var(--fw-heading); color: var(--text-primary);
  background: var(--bg-section); border-bottom: none;
}
.hours-empty {
  padding: var(--space-8) var(--space-4); text-align: center;
  color: var(--text-tertiary); font-size: var(--fs-body);
}

/* iTracker（admin 9 欄版）— 問題簡述全文展開（自動斷行、不截斷）+ 整列垂直置中
   middle 比 top 視覺更整齊：badge / input / 純文字三種高度不同的 cell 對齊到列中央 */
.hours-table--admin tbody td { vertical-align: middle; padding-top: var(--space-2); padding-bottom: var(--space-2); }
.hours-table--admin .td-shrink { min-width: 280px; max-width: none; }
.hours-table--admin .issue-title {
  white-space: normal; overflow: visible; text-overflow: clip;
  word-break: break-word; overflow-wrap: anywhere;
  line-height: 1.55;
}


/* iTracker 表格內報價時數 inline input（admin/superadmin 才見） */
.ht-quoted-cell { padding: var(--space-1) var(--space-2); }
.ht-quoted-input {
  width: 78px; height: 30px; padding: 0 var(--space-2);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  background: var(--bg-input); color: var(--text-primary);
  font-size: var(--fs-body); font-family: inherit; text-align: right;
  outline: none; box-sizing: border-box;
  -moz-appearance: textfield;
}
.ht-quoted-input::-webkit-outer-spin-button,
.ht-quoted-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ht-quoted-input:hover { border-color: var(--text-tertiary); }
.ht-quoted-input:focus-visible { border-color: var(--accent-text); box-shadow: var(--focus-ring); }
.ht-quoted-input:disabled { opacity: .55; cursor: progress; }

/* iTracker 發票開立 checkbox（admin/superadmin） */
.ht-invoice-cell { padding: var(--space-1) var(--space-2); }
.ht-invoice-input { width: 16px; height: 16px; cursor: pointer; accent-color: var(--info-text); }
.ht-invoice-input:disabled { cursor: progress; opacity: .55; }
/* 表頭內的全選 label：checkbox + 文字並排 */
.ht-invoice-th { display: inline-flex; align-items: center; gap: var(--space-1); cursor: pointer; }
/* 已勾發票開立的 row：淡背景區別，hover 時仍可清楚識別 */
.hours-table--admin tbody tr.is-invoiced td { background: var(--bg-muted); }
.hours-table--admin tbody tr.is-invoiced:hover td { background: var(--bg-hover); }

/* iTracker 欄位排序按鈕（純文字 + 箭頭，與篩選漏斗共存於同 th） */
.th-sort-btn {
  display: inline-flex; align-items: center; gap: var(--space-1);
  background: transparent; border: 0; padding: 0;
  font: inherit; color: inherit; cursor: pointer;
  text-transform: inherit; letter-spacing: inherit;
}
.th-sort-btn:hover { color: var(--text-primary); }
.th-sort-btn--right { float: right; }
.th-sort-btn .sort-icon.sorted { color: var(--info-text); }

/* iTracker Modal — 成員時數細節 */
.hours-member-list { display: flex; flex-direction: column; }
.hours-member-row {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: var(--space-2) 0; border-bottom: 1px solid var(--divider);
}
.hours-member-row:last-child { border-bottom: 0; }
.hours-member-name   { font-size: var(--fs-body); color: var(--text-primary); font-weight: var(--fw-bold); }
.hours-member-amount { font-size: var(--fs-body); color: var(--info-text); font-weight: var(--fw-bold); }
.hours-member-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: var(--space-3); margin-top: var(--space-2);
  border-top: 2px solid var(--divider);
  font-size: var(--fs-body); font-weight: var(--fw-heading); color: var(--text-primary);
}

/* ══════════════════════════════════════════════════
   Detail Modal / Reply
   ══════════════════════════════════════════════════ */
/* Detail 兩欄版型（左內容 + 右欄 290px）。改「看容器寬」收合（container query）：
   修第三欄 inspector——窄容器在寬螢幕也會正確收成單欄（viewport media 做不到）。
   容器＝下方 .modal-bd / .ip-body 的 container-type。@media 900 留作不支援 CQ 的 fallback。 */
.detail-grid { display: grid; grid-template-columns: 1fr 290px; gap: var(--space-4); }
.detail-grid > * { min-width: 0; }   /* 防 1fr 軌道被內容（截圖/留言框）撐爆而溢出窄容器 */
@container (max-width: 600px) {
  .detail-grid { grid-template-columns: 1fr; gap: var(--space-3); }
}
/* 區塊間距 */
.section-block { margin-bottom: var(--space-4); }
.section-block--sm { margin-bottom: var(--space-3); }
/* 純展示型 section 內文（問題簡述、備註等）— 主內容容器，給卡色白底彰顯份量
   保持純 div 結構（無 form 語意），與 reply-input-box（input 凹陷）形成「展示 vs 輸入」區隔 */
.section-content {
  font-size: var(--fs-body); color: var(--text-primary);
  line-height: 1.75; white-space: pre-wrap; word-break: break-word;
  background: var(--bg-card);
  border: 1px solid var(--border-faint);
  border-radius: var(--r-md);
  padding: var(--space-3) var(--space-3);
  min-height: 44px;
}
/* Form readonly 規範：兩種 readonly 視覺分流
   1. 凍結態（純展示，不可改）→ 攤平到 --bg-card + muted 文字，視覺等同靜態文字
   2. click-to-edit 態（reply empty / 時數預估等，JS 加 inline style="cursor:pointer"）→ 維持 input 視覺邀請點擊
   分流靠 :not([style*="cursor:pointer"]) 判斷 */
.fg input[readonly],
.fg textarea[readonly],
.reply-input-box textarea[readonly],
.input-inline[readonly] {
  cursor: default;
}
/* 凍結態：攤平到 --bg-frozen（light 灰、dark 卡色），與 editable 形成視覺差 */
.fg input[readonly]:not([style*="cursor:pointer"]),
.fg textarea[readonly]:not([style*="cursor:pointer"]),
.input-inline[readonly]:not([style*="cursor:pointer"]) {
  background: var(--bg-frozen);
  color: var(--text-tertiary);
  border-color: var(--border-faint);
}
.reply-input-box:has(> textarea[readonly]:not([style*="cursor:pointer"])) {
  background: var(--bg-frozen);
  border-color: var(--border-faint);
}
.fg input[readonly]:focus,
.fg textarea[readonly]:focus,
.input-inline[readonly]:focus {
  border-color: var(--border-faint);
  box-shadow: none;
}
/* readonly 的 textarea 在 .reply-input-box 內：focus 不觸發 box 綠光暈，維持 readonly 視覺 */
.reply-input-box:has(textarea[readonly]:focus) {
  border-color: var(--border-faint);
  box-shadow: none;
}
/* Disabled 一律攤平 + 不可互動視覺 */
.fg input:disabled,
.fg textarea:disabled,
.fg select:disabled,
.compact-select:disabled,
.filter-select:disabled,
.input-inline:disabled {
  background: var(--bg-frozen);
  color: var(--text-tertiary);
  border-color: var(--border-faint);
  opacity: .7;
  cursor: not-allowed;
}
/* 隱形 textarea（含於 reply-input-box 或 empty-state 展開） */
.embedded-textarea {
  width: 100%; min-height: 72px; padding: var(--space-2) var(--space-3);
  border: none; outline: none;
  font-size: var(--fs-body); font-family: inherit; line-height: 1.75;
  resize: vertical; color: var(--text-primary); background: transparent;
}
/* 右欄 select（對齊全站 .filter-select：自訂箭頭＋appearance:none，統一下拉外觀）*/
.compact-select {
  width: 100%; height: 32px; padding: 0 var(--space-8) 0 var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-body); font-family: inherit; outline: none; cursor: pointer;
  background: var(--bg-input) var(--select-chevron) no-repeat right var(--space-3) center;
  color: var(--text-primary);
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
}
.compact-select:focus { border-color: var(--accent-text); box-shadow: var(--focus-ring); }
/* 右欄置中按鈕 */
.btn-block { width: 100%; justify-content: center; }
/* inline-popup 區塊標題（狀態/類型/指派/優先 dropdown 的 heading） */
.inline-popup-label {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  padding: var(--space-1) var(--space-2) var(--space-1);
  text-transform: uppercase; letter-spacing: .05em;
}

.status-flow {
  display: flex; align-items: stretch;
  margin-bottom: var(--space-4); overflow: hidden;
  border-radius: var(--r-sm);
}
.sf-step {
  flex: 1; text-align: center; padding: var(--space-2) var(--space-1);
  font-size: var(--fs-sm);
  color: var(--text-tertiary); background: var(--bg-section);
  border-right: 1px solid var(--divider);
}
.sf-step:last-child    { border-right: none; }
/* v2：done 與 future 同 bg（用 text 色區分）；active = 該狀態 brand 色 */
.sf-step.done            { background: var(--bg-section); color: var(--text-secondary); }

/* sf-step 底色用 --bg-section（比 card 亮·突出），日夜自動切換。
   active 規則須放在此後以贏過 source order */

/* active = 該狀態 brand 色（與 status badge 同步，class 名綁語意便於改色不改 class）
   須放在 dark override 之後以贏過 source order */
/* design-system-v3 §5/§6.3：active-* 實心族色底＝狀態族色（待分配 accent／處理中 warn／複測 info／完成 success）；
   夜間亮底一律深字 #16161F（例外 accent 紫底白字＝夜唯一白字實心底）*/
.sf-step.active-todo    { background: var(--accent);  color: var(--text-on-accent); }  /* 待分配＝accent（日 6.8 / 夜 5.4 白字）*/
.sf-step.active-doing   { background: var(--warn-solid-deep); color: var(--text-on-bright); }  /* 處理中＝warn 亮底深字（日夜）*/
.sf-step.active-review  { background: var(--info);    color: var(--text-on-accent); }  /* 複測＝info（日 #005F73 白字 7.3；夜 cyan→下方 dark override 深字）*/
[data-theme="dark"] .sf-step.active-review { color: var(--text-on-bright); }
.sf-step.active-done    { background: var(--success);  color: var(--text-on-accent); }  /* 完成＝success（日 #0A9396 白字 3.7 元件級；夜 lime→下方 dark override 深字）*/
[data-theme="dark"] .sf-step.active-done   { color: var(--text-on-bright); }
.sf-step.active-other   { background: var(--ink-muted);  color: var(--text-on-accent); }  /* 不處理＝中性（design 未指定，維持中性實心底）*/

/* status-flow 手機版（v2.1）：
   ≤480px 5 個 chip 並排會擠不可讀。改 padding 緊縮 + font-size 縮 +
   active 步驟用「實色」突出，done/future 步驟用「dot」精簡顯示，
   保留歷程感但不搶位 */
@media (max-width: 480px) {
  .status-flow { gap: var(--space-1); border-radius: var(--r-pill); }
  .sf-step {
    padding: var(--space-1) var(--space-0_5);
    font-size: var(--fs-xs); letter-spacing: -.02em;
    border-right: none;
  }
  /* 非 active 步驟收成圓點：保留位置感、文字隱藏 */
  .sf-step:not([class*="active-"]) {
    flex: 0 0 auto; width: 8px; padding: 0;
    align-self: center; height: 8px;
    border-radius: 50%; background: var(--bg-sunk);
    color: transparent; overflow: hidden;
  }
  .sf-step.done {
    background: var(--neutral-dot);
  }
  /* active 步驟保留完整 chip */
  .sf-step[class*="active-"] {
    flex: 1; padding: var(--space-1) var(--space-3);
    border-radius: var(--r-pill);
  }
  /* dark mode override（active 規則在後，蓋過 dot 顏色）*/
  [data-theme="dark"] .sf-step:not([class*="active-"]) { background: var(--bg-sunk); }
  [data-theme="dark"] .sf-step.done                    { background: var(--text-tertiary); }
}

.reply-wrap  { display: flex; flex-direction: column; gap: var(--space-2); }
.reply-card  {
  background: var(--bg-subtle); border-radius: var(--r-md);
  padding: var(--space-3) var(--space-4);
  animation: fadeIn .2s ease;
  position: relative;
}
.reply-card.system { background: var(--bg-muted); border: 1px dashed var(--border-input); color: var(--text-secondary); }
.reply-card.internal { background: var(--note-bg); border: 1px solid var(--note-border); border-left: 3px solid var(--note-accent); }
.reply-internal-tag {   /* 外框 chip（2026-07-22 金系：淡金底＋深金字＋金細框），去實心警示感 */
  font-size: var(--fs-sm); font-weight: var(--fw-bold); background: var(--note-bg); color: var(--note-strong);
  box-shadow: inset 0 0 0 1px var(--note-border);
  border-radius: var(--r-pill); padding: var(--space-0_5) var(--space-2); letter-spacing: .04em;
}
/* 內部留言 toggle：開關本體 2026-07-21 退私版 .toggle-sw、改套共用 .mx-switch（DS 對齊、全站一顆開關）。
   此處只留外層排版＋「內部留言」label 勾選強調；input 現包在 .mx-switch 內、與 label 非相鄰兄弟→改 :has()。 */
.internal-toggle { display: flex; align-items: center; gap: var(--space-2); cursor: pointer; user-select: none; }
.internal-toggle .toggle-label { font-size: var(--fs-sm); color: var(--text-secondary); }
.internal-toggle:has(input:checked) .toggle-label { color: var(--note-strong); font-weight: var(--fw-bold); }
/* 內部 toggle 開啟＝金（--note-accent）＝內部語意色，覆蓋共用 .mx-switch 預設的品牌紫 on 態，與 chip/卡/送出鈕一致（2026-07-22）*/
.internal-toggle .mx-switch input:checked + .mx-switch-slider { background: var(--note-accent); border-color: var(--note-accent); }
/* 金軌道亮＝圓鈕改深色（--note-btn-text，同金鈕深字理）：白鈕壓金僅 ~2.2:1(日)/1.8:1(夜) 破 WCAG 非文字 3:1；深鈕壓金 ~7.3:1/10:1 過 */
.internal-toggle .mx-switch input:checked + .mx-switch-slider::before { background: var(--note-btn-text); }
.reply-meta   { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-1); flex-wrap: wrap; }
.reply-author { font-size: var(--fs-body); color: var(--text-primary); }
.reply-role-tag {
  font-size: var(--fs-body); color: var(--text-on-accent); border-radius: var(--r-pill);
  padding: var(--space-0_5) var(--space-2); background: var(--ink-muted);   /* 白字壓 --neutral-dot 僅 2.3:1 破 AA → 深一階 */
}
.reply-time { font-size: var(--fs-sm); color: var(--text-tertiary); margin-left: auto; }
.reply-body { font-size: var(--fs-body); color: var(--text-primary); line-height: 1.65; white-space: pre-wrap; }
.reply-edited { font-size: var(--fs-xs); color: var(--text-tertiary); margin-left: var(--space-1); }

/* 留言 hover 動作列（反應 / 編輯 / 刪除 / 引用）— 浮在卡片右上 */
.reply-actions {
  position: absolute; top: var(--space-2); right: var(--space-3);
  display: none; gap: var(--space-0_5);
  background: var(--bg-card); border: 1px solid var(--border-card);
  border-radius: var(--r-sm); padding: var(--space-0_5); box-shadow: var(--shadow-sm);
}
.reply-card:hover .reply-actions, .reply-actions:focus-within { display: flex; }
.reply-act {
  width: 26px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  border: none; background: transparent; color: var(--text-tertiary);
  border-radius: var(--r-xs); cursor: pointer;
}
.reply-act:hover { background: var(--bg-muted); color: var(--text-primary); }
.reply-act svg { width: 15px; height: 15px; }

/* 反應 chips（emoji + 計數）；自己按過的高亮 magenta */
.reply-reactions { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-top: var(--space-2); }
.rchip {
  display: inline-flex; align-items: center; gap: var(--space-1);
  font-size: var(--fs-sm); line-height: 1; cursor: pointer;
  border: 1px solid var(--border-input); border-radius: var(--r-pill);
  padding: var(--space-0_5) var(--space-2); background: var(--bg-card); color: var(--text-secondary);
}
.rchip:hover { border-color: var(--border-hover); }
.rchip.mine { border-color: var(--accent-text); background: var(--accent-soft); color: var(--accent-text); }
.rchip .rcount { font-weight: var(--fw-heading); }

/* 編輯留言就地 textarea */
.reply-edit-area { width: 100%; }
.reply-edit-area textarea {
  width: 100%; min-height: 60px; padding: var(--space-2); resize: vertical;
  border: 1px solid var(--accent-text); border-radius: var(--r-sm);
  font-size: var(--fs-body); font-family: inherit; color: var(--text-primary);
  background: var(--bg-input); line-height: 1.65;
}
.reply-edit-actions { display: flex; gap: var(--space-2); justify-content: flex-end; margin-top: var(--space-2); }

/* Emoji picker 浮層（完整：搜尋 + 分類捲動格） */
.emoji-picker {
  position: fixed; z-index: 1200; width: 280px;
  background: var(--bg-card); border: 1px solid var(--border-card);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: var(--space-2);
}
.emoji-picker .ep-search {
  width: 100%; padding: var(--space-1) var(--space-2); margin-bottom: var(--space-2);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-family: inherit; color: var(--text-primary); background: var(--bg-input);
}
.emoji-picker .ep-search:focus { outline: none; border-color: var(--accent-text); }
.emoji-picker .ep-scroll { max-height: 220px; overflow-y: auto; }
.emoji-picker .ep-cat { font-size: var(--fs-xs); color: var(--text-tertiary); margin: var(--space-1) 0; }
.emoji-picker .ep-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.emoji-picker .ep-grid button {
  display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; cursor: pointer;
  font-size: 18px; line-height: 1; padding: var(--space-1) 0; border-radius: var(--r-xs);
}
.emoji-picker .ep-grid button:hover { background: var(--bg-muted); }
.emoji-picker .ep-grid button .mx-emoji { width: 24px; height: 24px; }
.emoji-picker .ep-empty { font-size: var(--fs-sm); color: var(--text-tertiary); padding: var(--space-2); text-align: center; }

/* OpenMoji 圖示：行內 emoji 圖（picker / 反應 chip / 留言內文等共用） */
.mx-emoji {
  display: inline-block; width: 1.25em; height: 1.25em;
  vertical-align: -0.25em; object-fit: contain;
}
.rchip .remoji { display: inline-flex; align-items: center; }
.rchip .remoji .mx-emoji { width: 16px; height: 16px; vertical-align: middle; }

.reply-input-box {
  border: 1px solid var(--border-input); border-radius: var(--r-md);
  overflow: hidden; background: var(--bg-input);
  transition: border .15s, box-shadow .15s, background .15s;
}
.reply-input-box:focus-within { border-color: var(--accent-text); box-shadow: var(--focus-ring); }
.reply-input-box.drag {
  border-color: var(--success); border-style: dashed;
  background: color-mix(in srgb, var(--success) 6%, var(--bg-input));
}
.reply-input-box textarea {
  width: 100%; padding: var(--space-3) var(--space-3);
  border: none; outline: none;
  font-size: var(--fs-body); font-family: inherit;
  resize: none; min-height: 80px;
  color: var(--text-primary); line-height: 1.65;
  background: transparent;        /* 顯式設透明，避免瀏覽器 dark 模式預設白底 */
}
/* 表單把 .reply-input-box 包進 .fg 時，.fg textarea:focus 會在內層 textarea 再疊一圈 focus-ring →
   視覺像「框中框」。內層 textarea 不自己畫 focus 框，focus 視覺一律交給外層 .reply-input-box:focus-within。 */
.reply-input-box textarea:focus { box-shadow: none; }
.reply-input-footer {
  padding: var(--space-2) var(--space-3); border-top: 1px solid var(--divider);
  display: flex; justify-content: space-between; align-items: center;
}

/* Collapsible replies — 改為左右橫線中間置中按鈕的 separator 樣式 */
.replies-collapse-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  width: 100%; padding: var(--space-1) 0;
  background: transparent; border: none;
  color: var(--text-secondary); font-size: var(--fs-sm);
  cursor: pointer; transition: color .15s; outline: none; font-family: inherit;
  margin: var(--space-3) 0 var(--space-2);
}
.replies-collapse-btn::before,
.replies-collapse-btn::after {
  content: ''; flex: 1; height: 1px; background: var(--divider); min-width: 24px;
}
.replies-collapse-btn:hover { color: var(--text-primary); }
.replies-collapse-btn:focus-visible { box-shadow: var(--focus-ring); outline-offset: 2px; border-radius: var(--r-xs); }

/* ══════════════════════════════════════════════════
   Modal
   ══════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: var(--modal-scrim);
  -webkit-backdrop-filter: blur(2.5px); backdrop-filter: blur(2.5px);   /* 遮罩調淺＋模糊，讓 modal 陰影讀得出（2026-07-11 核可）*/
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: var(--space-4);
  animation: fadeIn .15s ease;
}
.modal {
  /* 質感 v3.1（2026-07-11 核可）：不透明微漸層（elevated→card，頂亮底沉）＋細框＋頂緣 hairline 陰影 */
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-card) 62%); border-radius: var(--r-lg);
  border: 1px solid var(--border-card);
  width: 560px; max-width: 100%;
  max-height: 92vh; display: flex; flex-direction: column; overflow: hidden;
  box-shadow: var(--modal-shadow);
}
.modal-wide { width: 860px; }
.modal-xl   { width: 980px; }
.modal-hd {
  padding: var(--space-3) var(--space-5) var(--space-3); border-bottom: 1px solid var(--divider);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-hd h3 { font-size: var(--fs-lg); font-weight: var(--fw-heading); color: var(--text-primary); }
/* h3 內附帶的「使用者識別」（如 abby.th - MX）：同字級、較輕字重、次要色，跟標題在同一行 */
.modal-hd h3 .modal-hd-user { font-weight: 400; color: var(--text-secondary); margin-left: var(--space-2); }
.modal-bd { padding: var(--space-4) var(--space-5); overflow-y: auto; flex: 1; container-type: inline-size; }
.modal-ft {
  padding: var(--space-2) var(--space-5); border-top: 1px solid var(--divider);
  display: flex; justify-content: flex-end; gap: var(--space-2); flex-shrink: 0;
}

/* ══════════════════════════════════════════════════
   Release Note（更版公告彈窗 _ReleaseNote.cshtml）
   —— 殼走既有 .modal-overlay/.modal/.modal-hd/.modal-bd/.modal-ft，
      本段只補「條目列」與「頁尾左右分置」兩處本元件自有版型（2026-07-28 add-release-announcement）
   ══════════════════════════════════════════════════ */
#relnote[hidden] { display: none; }
/* 標題上方眉標＝共用 .hint-sm（不另寫一份同概念樣式） */
/* 版號徽章：沿用 .badge（透明底無框中性字），僅補與標題的間距 */
.rn-ver { margin-left: var(--space-2); color: var(--text-tertiary); }

.rn-item {
  display: flex; gap: var(--space-3);
  padding: var(--space-3) 0; border-bottom: 1px solid var(--divider);
}
.rn-item:last-child { border-bottom: none; }
.rn-ico {
  flex: none; width: 28px; height: 28px; border-radius: var(--r-sm);
  background-color: var(--bg-muted); color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
}
.rn-ico svg { width: 16px; height: 16px; }
.rn-h { font-size: var(--fs-body); font-weight: var(--fw-medium); color: var(--text-primary); margin: 0 0 var(--space-0_5); }
.rn-b { font-size: var(--fs-sm); color: var(--text-secondary); margin: 0; line-height: var(--lh-normal); }

/* 頁尾：手冊連結靠左、主按鈕靠右（一般 .modal-ft 為全靠右） */
.rn-ft { justify-content: space-between; align-items: center; }
.rn-link { font-size: var(--fs-sm); color: var(--text-secondary); text-decoration: underline; }
.rn-link:hover { color: var(--text-primary); }

/* 「更新內容」重看入口＝側欄底部固定區（.sb-foot），樣式與未讀標記見 Sidebar 段 */

/* ══════════════════════════════════════════════════
   Lightbox
   ══════════════════════════════════════════════════ */
#lightbox {
  position: fixed; inset: 0; background: rgba(0,0,0,.88);
  display: flex; align-items: center; justify-content: center;
  z-index: 400; cursor: zoom-out;
}
#lightbox img { max-width: 90vw; max-height: 90vh; border-radius: var(--r-md); object-fit: contain; display: block; }

/* ══════════════════════════════════════════════════
   Screenshot Annotate Editor（截圖畫布編輯器 site-annotate.js）
   —— slide 式畫布 modal：工具列 + 畫布 stage；全走 token，浮層層級高於一般 modal。
   （dark 靠上方 token 值自適應，本區不需獨立 dark override）
   ══════════════════════════════════════════════════ */
body.mxann-open { overflow: hidden; }
.mxann-overlay {
  position: fixed; inset: 0;
  background: var(--modal-scrim);
  -webkit-backdrop-filter: blur(2.5px); backdrop-filter: blur(2.5px);
  display: flex; align-items: center; justify-content: center;
  /* 1180：蓋過啟動它的一般 modal（200），但**低於** confirmDialog 的 z-index:1200，
     讓「放棄編輯」確認框能疊在編輯器之上、可點（site-util.js confirmDialog 寫死 1200）*/
  z-index: 1180; padding: var(--space-4);
  animation: fadeIn .15s ease;
}
.mxann-modal {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-card) 62%);
  border: 1px solid var(--border-card); border-radius: var(--r-lg);
  box-shadow: var(--modal-shadow);
  width: min(1040px, 96vw); height: min(88vh, 820px);
  display: flex; flex-direction: column; overflow: hidden;
}
.mxann-toolbar {
  display: flex; align-items: center; gap: var(--space-1); flex-wrap: wrap;
  padding: var(--space-2) var(--space-3);
  background: var(--bg-section); border-bottom: 1px solid var(--divider);
  flex-shrink: 0;
}
.mxann-tools { display: flex; align-items: center; gap: var(--space-0_5); }
.mxann-tool {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-2); border-radius: var(--r-sm);
  border: 1px solid transparent; background: transparent;
  color: var(--text-tertiary); font-size: var(--fs-body); font-family: inherit;
  cursor: pointer; transition: all .15s;
}
.mxann-tool svg { width: 15px; height: 15px; flex: none; }
.mxann-tool:hover { background: var(--bg-muted); color: var(--text-secondary); }
.mxann-tool.active { background: var(--bg-elevated); color: var(--text-primary); border-color: var(--border-input); }
.mxann-sep { width: 1px; height: 20px; background: var(--divider); margin: 0 var(--space-1); }
.mxann-swatches { display: flex; align-items: center; gap: var(--space-1); }
.mxann-swatch {
  width: 22px; height: 22px; border-radius: var(--r-pill); padding: 0;
  background: var(--sw); border: 2px solid var(--bg-card);
  box-shadow: 0 0 0 1px var(--border-input); cursor: pointer; transition: box-shadow .15s;
}
.mxann-swatch.active { box-shadow: 0 0 0 2px var(--accent-text); }
.mxann-actbtn {
  width: 32px; height: 32px; padding: 0; border-radius: var(--r-xs);
  background: transparent; border: 1px solid transparent; cursor: pointer;
  color: var(--text-tertiary); transition: all .15s;
  display: inline-flex; align-items: center; justify-content: center;
}
.mxann-actbtn svg { width: 17px; height: 17px; }
.mxann-actbtn:hover:not(:disabled) { background: var(--bg-muted); color: var(--text-secondary); }
.mxann-actbtn:disabled { opacity: .4; cursor: default; }
.mxann-spacer { flex: 1 1 auto; }
.mxann-stage {
  flex: 1 1 auto; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-sunk); padding: var(--space-4);
}
.mxann-canvas-wrap { position: relative; line-height: 0; }
.mxann-canvas {
  display: block; background: #fff; border: 1px solid var(--border-input);
  border-radius: var(--r-xs); box-shadow: var(--shadow-sm);
  touch-action: none;
}
.mxann-cvhandle {
  position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px;
  background: var(--accent); border: 2px solid var(--bg-card); border-radius: var(--r-xs);
  cursor: nwse-resize; touch-action: none;
}
.mxann-textinput {
  position: absolute; z-index: 2; min-width: 60px;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  border: 1px dashed var(--accent-text); border-radius: var(--r-xs);
  padding: 0 2px; font-weight: 600; font-family: inherit; line-height: 1.2;
  outline: none; box-shadow: var(--focus-ring);
}
.mxann-hint {
  flex-shrink: 0; padding: var(--space-2) var(--space-3);
  border-top: 1px solid var(--divider); background: var(--bg-card);
  font-size: var(--fs-xs); color: var(--text-tertiary);
}
@media (max-width: 768px) {
  .mxann-modal { width: 100%; height: 100%; border-radius: 0; }
  .mxann-tool span { display: none; }
}

/* ══════════════════════════════════════════════════
   Toast
   ══════════════════════════════════════════════════ */
.toast {
  position: fixed; top: 20px; right: 20px;
  /* v2.5 Glass：底改毛玻璃；text 從 on-accent 改 primary（token 自動 dark-aware）*/
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4); border-radius: var(--r-md);
  font-size: var(--fs-body); z-index: 500;
  opacity: 0; transform: translateY(-8px);
  transition: all .2s; pointer-events: none;
  max-width: 360px; line-height: 1.5;
  box-shadow: var(--glass-shadow);   /* glass 元件吃較柔的 glass 陰影（2026-07-11 接回，取代 --shadow-lg）*/
}
.toast.show      { opacity: 1; transform: translateY(0); }
/* toast 變體（v2.5 — glass 底 + 左邊 4px 語意條，文字用 text-primary 自動 dark-aware）*/
.toast.toast-err  { border-left: 4px solid var(--danger); padding-left: var(--space-3); }
.toast.toast-ok   { border-left: 4px solid var(--success);  padding-left: var(--space-3); }
.toast.toast-warn { border-left: 4px solid var(--warn);     padding-left: var(--space-3); }  /* 提醒/警示（非成功也非錯誤）：黃／amber 語意條 */

/* ══════════════════════════════════════════════════
   Empty State
   ══════════════════════════════════════════════════ */
.empty     { text-align: center; padding: 52px var(--space-5); color: var(--text-tertiary); }
.empty svg { width: 40px; height: 40px; margin: 0 auto var(--space-3); opacity: .3; display: block; }
.empty p   { font-size: var(--fs-body); }

/* ══════════════════════════════════════════════════
   Kanban Board
   ══════════════════════════════════════════════════ */
.board-wrap {
  /* padding-bottom 0：交給 #content 的 bottom padding 統一處理，看板底部就會對齊清單 */
  /* min-width:100% + kb-col flex:1 0 320：可用寬夠→5 欄等分撐滿、右側不留白；
     不夠→欄位維持 320px 底寬、看板水平捲動（由 view-board-frame 的 overflow-x:auto 承接，滾輪轉橫捲在 issues-index.js）*/
  height: 100%; min-width: 100%;
  padding: var(--space-1) 0 0; display: flex; gap: var(--space-3); align-items: stretch;
}
.kb-col {
  /* 卡片寬度＝欄寬。flex:1 0 320（grow 撐滿寬螢幕、shrink 0 不縮）＝窄螢幕維持 320px 底寬改水平捲動（Trello 式），
     取代舊 1 1 0 等分被 5 欄擠窄（約 215px 太窄）；固定 5 欄不變，只放寬每欄 */
  flex: 1 0 320px; min-width: 320px;
  display: flex; flex-direction: column;
  background: var(--bg-subtle);
  border-radius: var(--r-md);
  /* height: 100% 配合 board-wrap align-items: stretch，欄位拉滿可用高度；
     原本的 max-height: calc(100vh - 120px) 會讓欄位提前結束，造成卡片硬切 + 大片空白 */
  height: 100%;
}
.kb-col-head {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3) var(--space-2); flex-shrink: 0;
  border-bottom: 1px solid var(--divider);
}
.kb-col-dot  { display: inline-flex; align-items: center; flex: none; }   /* 內含 .badge-icon 狀態 icon；族色由 inline color 控 */
.kb-col-name { font-size: var(--fs-body); font-weight: var(--fw-heading); flex: 1; }
.kb-col-count {
  background: var(--bg-muted); color: var(--text-tertiary);
  font-size: var(--fs-sm);
  border-radius: var(--r-pill); padding: 1px var(--space-2); min-width: 24px; text-align: center;
}
/* 看板欄頭排序鈕 / 單元漏斗已移除（篩選改走 toolbar pill）— 相關樣式一併清除 */
.kb-list {
  flex: 1; overflow-y: auto; padding: var(--space-1) var(--space-2) var(--space-2);
  display: flex; flex-direction: column; gap: var(--space-2); min-height: 60px;
  scrollbar-width: none;
}
.kb-list::-webkit-scrollbar { width: 0; height: 0; display: none; }
.kb-col:hover .kb-list { scrollbar-width: thin; scrollbar-color: rgba(0,0,0,.2) transparent; }
.kb-col:hover .kb-list::-webkit-scrollbar { width: 4px; display: block; }
.kb-col:hover .kb-list::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: var(--r-xs); border: none; }
.kb-card {
  background: var(--bg-card); border-radius: var(--r-md); padding: var(--space-2) var(--space-3);
  /* border: border-card 預設，依據極簡平整風與 border 優先原則，移除預設陰影 */
  box-shadow: none;
  cursor: pointer; transition: border-color .15s, background .15s, transform .15s;
  border: 1.5px solid var(--border-card); user-select: none;
}
[data-theme="dark"] .kb-card { border-color: var(--border-card); box-shadow: none; }
.kb-card:hover { box-shadow: none; border-color: var(--border-hover); background: var(--bg-hover); }
.kb-card.sortable-chosen { box-shadow: var(--shadow-lg); transform: rotate(1.5deg); cursor: grabbing; border-color: var(--accent-text); opacity: .95; }
.kb-card.sortable-ghost  { opacity: .3; background: var(--accent-soft); border: 2px dashed var(--accent-text); }
.kb-card-desc { font-size: var(--fs-body); line-height: 1.55; color: var(--text-primary); word-break: break-word; margin-bottom: var(--space-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; min-height: 40px; }
.kb-card-foot { display: flex; align-items: center; gap: var(--space-1); }
.kb-date  { font-size: var(--fs-sm); color: var(--text-tertiary); display: flex; align-items: center; gap: var(--space-1); }
.kb-code  { font-size: var(--fs-sm); color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
/* 封存專案的看板卡片小標（僅 superadmin 會看到含封存 ticket）；用既有中性 token，雙模自動跟隨 */
.kb-archived {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  background: var(--bg-subtle); border: 1px solid var(--border-input);
  border-radius: var(--r-xs); padding: 0 var(--space-1); line-height: 1.5;
}
/* 看板小頭像（24×24）— 有指派人但沒實際照片時的 fallback 色塊
   v2.2.1 從 magenta 改 gray-700：看板上每張卡都有頭像，magenta 會堆疊成噪音；
   中性深灰穩定不搶 status badge 風頭 */
.kb-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink-muted); color: var(--text-on-accent);
  font-size: var(--fs-sm);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.kb-avatar.no { background: var(--bg-muted); color: var(--text-tertiary); }

/* ══════════════════════════════════════════════════
   Scrollbar
   ══════════════════════════════════════════════════ */
::-webkit-scrollbar       { width: 10px; height: 12px; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb); border-radius: var(--r-pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--scroll-thumb-hover); background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
* { scrollbar-width: auto; scrollbar-color: var(--scroll-thumb) transparent; }

/* ══════════════════════════════════════════════════
   Admin List
   ══════════════════════════════════════════════════ */
.admin-list-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2); flex-wrap: wrap;
  padding: var(--space-2) 0;
  font-size: var(--fs-body);
}
.admin-list-item > :first-child { min-width: 0; flex: 1; word-break: break-all; }
/* 專案管理仍維持帳號間分隔線；使用者管理（卡內含 .user-group-head）只用線分隔角色組 */
.admin-list-item:not(:last-child) { border-bottom: 1px solid var(--divider); }
.card-pad:has(> .user-group-head) .admin-list-item { border-bottom: none; padding: var(--space-2) 0; }

/* admin row 內：標題行 / meta 行 / disabled 整列灰化 */
.admin-row-title  { font-size: var(--fs-body); color: var(--text-primary); }
.admin-row-meta   { font-size: var(--fs-sm); color: var(--text-tertiary); }
.admin-list-item.is-disabled { opacity: 0.5; }
.admin-row-actions { display: flex; gap: var(--space-1); }

/* admin section header（標題 + 右側「+ 新增」按鈕） */
.admin-section-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-3);
}

/* 使用者管理：分組小標（管理員 / 專案成員 / 客戶 / 待審核）— 卡片內 section divider
   分隔線放在 user-group-head 上方，分組之間有清楚的角色界線；組內帳號則無線、靠 padding 給呼吸 */
.user-group-head {
  font-size: var(--fs-sm); color: var(--text-secondary);
  font-weight: var(--fw-bold); letter-spacing: .03em;
  padding: var(--space-4) 0 var(--space-2);
  margin-top: var(--space-2);
  border-top: 1px solid var(--divider);
}
.user-group-head:first-child {
  padding-top: 0; margin-top: 0; border-top: none;
}
.user-group-head--pending { color: var(--accent-text); }

/* 待審核帳號整列高亮：左邊條 + 微底色 */
.admin-list-item.is-pending {
  position: relative;
  padding-left: var(--space-3);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 7%, transparent), transparent 60%);
  border-radius: var(--r-xs);
}
.admin-list-item.is-pending::before {
  content: '';
  position: absolute; left: 0; top: 12px; bottom: 12px;
  width: 3px; border-radius: 2px;
  background: var(--accent-text);
}
.admin-list-item.is-pending .admin-row-title { color: var(--accent-text); font-weight: var(--fw-bold); }

/* ── Admin entity 卡片版（使用者 / 專案共用視覺 — 取代條列，省空間且支援大量資料） ── */
.user-card-grid,
.project-card-grid {
  display: grid;
  /* auto-fill：依容器寬度自動配置欄數（卡片最小 280，撐不到 280 時降成單欄 → 手機自然 1 欄） */
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.user-card,
.project-card {
  position: relative;   /* 配合下方 hover/focus 抬層，讓卡內 .card-pop hover 小卡蓋過鄰卡 */
  background: var(--bg-card);
  border: 1px solid var(--border-card);
  border-radius: var(--r-md);
  padding: var(--space-3);
  box-shadow: none;
  display: flex; flex-direction: column; gap: var(--space-3);
  min-width: 0;
  transition: background .15s ease, border-color .15s ease;
}
.user-card:hover,
.project-card:hover { background: var(--bg-hover); border-color: var(--border-hover); box-shadow: none; }
/* hover / 鍵盤聚焦時抬層：否則卡內 .card-pop（聯絡人/專案 hover 小卡）會被「後繪的相鄰卡片」蓋住上緣＝看似被裁切。
   比照 .account-card:hover/:focus-within 的 z-index 處理（客戶管理卡片用 .project-card，需同等抬層）。 */
.user-card:hover, .user-card:focus-within,
.project-card:hover, .project-card:focus-within { z-index: 3; }

/* 已封存專案卡片：降透明示意非進行中；opacity 不涉及色票，雙模直接成立 */
.project-card.is-archived { opacity: .65; }

/* actions / empty placeholder — 卡片底部規則共用 */
.user-card-actions,
.project-card-actions {
  display: flex; gap: var(--space-1);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--divider);
}
.user-card-actions .btn,
.project-card-actions .btn { flex: 1; justify-content: center; }
.user-card-empty,
.project-card-empty {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  padding: var(--space-1) 0 var(--space-3);
}

/* user-card 專屬 ── 頭像 + 姓名 + 角色 tag + Email */
.user-card.is-disabled { opacity: .55; }
.user-card.is-pending {
  border-color: color-mix(in srgb, var(--accent-text) 50%, transparent);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 7%, var(--bg-card)), var(--bg-card) 60%);
}
.user-card-head { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.user-card-identity { min-width: 0; flex: 1; }
.user-card-name {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1);
  font-size: var(--fs-body); color: var(--text-primary); font-weight: var(--fw-bold);
}
.user-card-name-text {
  min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-card.is-pending .user-card-name { color: var(--accent-text); }
.user-card-email {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin-top: var(--space-0_5);
}

/* ── 帳號管理卡片（設定中心 › 帳號管理；2026-06-24 由條列改卡片）──
   一張卡 = 勾選框(右上) + 40px 角色頭像 + 姓名 + 角色/狀態標 + 綁定專案數(純文字 hover tooltip) + 編輯/刪除。
   不放 email、不放「公司：內部」——角色/啟用/公司改由工具列「＋篩選」處理。最多 4 併排，看容器寬收欄。 */
.account-grid {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-3); margin-bottom: var(--space-5);
}
@container (max-width: 1000px) { .account-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@container (max-width: 680px)  { .account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 440px)  { .account-grid { grid-template-columns: 1fr; } }
.account-card {
  position: relative; display: flex; flex-direction: column; gap: var(--space-2);
  background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--r-md);
  padding: var(--space-3) var(--space-4); cursor: pointer;   /* 整卡可點＝勾選（空白處） */
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.account-card:hover     { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }
/* hover / 鍵盤聚焦時提升層級，讓專案 hover-pop 蓋在鄰卡之上（is-dim 的 opacity 會建立堆疊脈絡，須整卡提升）*/
.account-card:hover, .account-card:focus-within { z-index: 3; }
.account-card.is-checked{ border-color: var(--accent-text); background: var(--bg-hover); }
.account-card.is-dim    { opacity: .6; }
.account-card-ck {
  position: absolute; top: var(--space-2); right: var(--space-2);
  width: 16px; height: 16px; accent-color: var(--accent-text); cursor: pointer; margin: 0;
}
.account-card-top { display: flex; align-items: center; gap: var(--space-3); min-width: 0; padding-right: var(--space-5); }
/* 卡片頭像：40px（設定中心帳號卡專屬尺寸）+ 沿用 .sb-avatar-* 角色漸層 */
.account-card-av {
  width: 40px; height: 40px; border-radius: 50%; flex: none; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-on-accent); font-size: var(--fs-lg); font-weight: var(--fw-bold);
}
.account-card-av .avatar-img-fill { width: 100%; height: 100%; object-fit: cover; }
.account-card-name {
  min-width: 0; font-size: var(--fs-body); font-weight: var(--fw-bold); color: var(--text-primary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-card-tags { display: flex; flex-wrap: wrap; gap: var(--space-1); min-height: 22px; }
/* 卡頭識別欄：標籤（小）→ 名稱 → email 直式堆疊（2026-07-02 加回 email；標籤縮小移到名字上方）*/
.account-card-idcol { min-width: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.account-card-email { min-width: 0; font-size: var(--fs-sm); color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 標籤縮小＋左對齊，僅作用於帳號卡內，不影響全站共用 .role-tag */
.account-card-idcol .account-card-tags { min-height: 0; }
.account-card-idcol .role-tag { font-size: var(--fs-xs); padding: 0 var(--space-2); margin-left: 0; }
.account-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap;
  border-top: 1px solid var(--divider); padding-top: var(--space-2); margin-top: auto;
}
.account-card-proj { font-size: var(--fs-sm); color: var(--text-tertiary); white-space: nowrap; cursor: help; }
/* 卡片明細 hover-pop（.card-pop）：帳號卡「綁定專案」＋客戶卡「聯絡人 / 專案」共用。
   覆蓋共用 .hover-pop 的 nowrap＋置中 → 固定舒適寬、每列一行超長省略、左錨定（箭頭跟著左移），
   解掉舊版「短名縮成小框 / 長名亂斷行 / 靠左卡片置中 tooltip 被裁切」三問題。
   只動版型（寬 / 換行 / 定位），不引入新色票，日夜兩模式直接成立。
   ⚠️ 選擇器用 `.hover-pop.card-pop`（雙類＝特異度 0,2,0）：共用 base `.hover-pop`（left:50%/translateX
   置中）定義在本規則「之後」（site.css 較後段），同特異度會後者勝、把左錨定蓋回置中→靠左卡片仍往左溢出
   被內容區裁切。提高特異度才能不靠檔案順序穩定勝出。 */
.hover-pop.card-pop {
  left: 0; transform: none;
  white-space: normal; width: max-content;
  min-width: 150px; max-width: 240px;
}
.hover-pop.card-pop::after { left: 16px; transform: none; }
.hover-pop.card-pop .hover-pop-row {
  display: block;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.account-card-actions { display: flex; gap: var(--space-1); }

/* 🗑️ 2026-06-30 移除「條列 + 就地展開」家族（`.account-row` / `.account-id*` / `.account-expand`
   / `.account-caret` / `.account-row-actions` / `.account-sub*` / `.account-proj-chip`）：
   帳號管理 2026-06-24 已改卡片，客戶管理 `/mng/orgs` 2026-06-30 亦改 `.project-card` 卡片，
   此家族全站 0 引用＝dead code，整批清除（客戶卡聯絡人/專案改用共用 `.card-pop` hover 小卡）。 */

/* 公司 / 角色分組標題上的「內部 / 客戶」類型小標 */
.account-group-kind {
  font-size: var(--fs-sm); color: var(--text-tertiary); font-weight: 400;
  border: 1px dashed var(--border-card); border-radius: var(--r-xs);
  padding: 0 var(--space-1); margin-left: var(--space-1);
}
/* 批量動作列：勾選後出現，黏在工具列下方 */
.account-batch-bar {
  display: flex; align-items: center; gap: var(--space-3);
  background: var(--bg-section); border: 1px solid var(--border-hover);
  border-radius: var(--r-md); padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-3);
}
.account-batch-count { font-size: var(--fs-body); color: var(--text-primary); }
.account-batch-actions { display: flex; gap: var(--space-1); margin-left: auto; flex-wrap: wrap; }

/* project-card 專屬 ── 名稱 + Code + 客戶 + 成員/客戶數 */
.project-card-name {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--space-1);
  font-size: var(--fs-body); color: var(--text-primary); font-weight: var(--fw-bold);
}
.project-card-name-text {
  min-width: 0; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-card-code {
  font-size: var(--fs-sm); color: var(--text-tertiary); font-weight: 400;
  flex-shrink: 0;
}
.project-card-client {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  margin-top: var(--space-0_5);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.project-card-meta {
  font-size: var(--fs-sm); color: var(--text-secondary);
}

/* 角色 / 來源 / 停用 標籤（admin row 內小標；2026-05-09 對齊 .badge 尺寸 4px 10px / pill）*/
.role-tag {
  font-size: var(--fs-sm);
  color: var(--text-on-accent);
  padding: var(--space-1) var(--space-2); border-radius: var(--r-pill);
  margin-left: var(--space-1);
}
.role-tag--admin    { background: var(--ink); }   /* ink 實心底：白字兩主題皆過 AA（--accent dark 翻淺會破）*/
.role-tag--pending  { background: var(--ink); }
.role-tag--gray     { background: var(--ink-muted); }   /* 白字壓 --neutral-dot 破 AA → 深一階 */
.role-tag--google   { background: var(--google-blue); }
/* role-tag--google-lg 已合併到 role-tag base 尺寸；保留 alias 以免破壞既有引用 */
.role-tag--google-lg { background: var(--google-blue); margin-left: var(--space-1); }
/* 中性角色標（專案執行 / 專案成員 / 客戶）：非 admin/pending 的角色用，soft 中性底深字（帳號卡片用） */
.role-tag--soft { background: var(--bg-section); color: var(--text-secondary); border: 1px solid var(--border-card); }

/* 成員/客戶挑選工具列（公司下拉 + 姓名搜尋並排；客戶區「先選公司再選人」用） */
.member-pick-toolbar {
  display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center;
  margin-bottom: var(--space-2);
}
.member-pick-toolbar .member-search { margin-bottom: 0; flex: 1; min-width: 160px; }

/* 成員勾選清單（含搜尋框） */
.member-search {
  width: 100%; height: 32px; padding: 0 var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-sm); margin-bottom: var(--space-2);
  box-sizing: border-box;
  background: var(--bg-input); color: var(--text-primary);
  font-family: inherit; outline: none;
}
.member-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-1);
  max-height: 200px; overflow-y: auto; padding: 1px;
}
.member-item {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); border: 1px solid var(--border-input);
  border-radius: var(--r-sm); cursor: pointer;
  font-size: var(--fs-sm); overflow: hidden;
  background: var(--bg-control);
}
.member-item input { width: 14px; height: 14px; accent-color: var(--success); flex-shrink: 0; }
.member-item span  { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 密碼輸入 + 眼睛按鈕（全站共用） */
.pwd-field-wrap { position: relative; }
/* 任何 input 在 .pwd-field-wrap 內都自動讓出右側空間給眼睛按鈕，
   不限定 .pwd-input class — 這樣 Login / Settings 沿用既有 form input 樣式即可 */
.pwd-field-wrap > input { padding-right: var(--space-10); }
.pwd-input {
  width: 100%; height: 40px; padding: 0 var(--space-10) 0 var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-body); font-family: inherit; outline: none;
  background: var(--bg-input); color: var(--text-primary);
}
.pwd-eye {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  border: none; background: none; cursor: pointer;
  color: var(--text-tertiary); padding: var(--space-0_5);
  display: flex; align-items: center; line-height: 1;
}
.pwd-eye:hover { color: var(--text-secondary); }

/* form label 後的小字 hint（紅 *  右邊的「2-8 字…」說明）*/
.label-hint { font-size: var(--fs-sm); color: var(--text-tertiary); font-weight: 400; margin-left: var(--space-1); }

/* 「停用此帳號」label 與其 checkbox */
.disable-label {
  display: flex; align-items: center; gap: var(--space-2); cursor: pointer;
}
.disable-label input { width: 15px; height: 15px; accent-color: var(--danger); }
.disable-label-text { font-size: var(--fs-body); color: var(--danger-text); font-weight: var(--fw-medium); }

/* edit-user 標題（小灰 + Google 帳號徽章）*/

/* 窄版頁面容器系列 — 系統設定 / 表單頁依內容密度選用 */
.page-narrow  { max-width: 680px; margin: 0 auto; }
.page-medium  { max-width: 700px; margin: 0 auto; }
.page-wide    { max-width: 880px; margin: 0 auto; }

/* ── 設定中心（Settings Center）殼層 — 2026-06-13 Phase 0 ──────
   共用兩欄版型：左次選單（settings-nav）+ 右內容（settings-body）。
   登記於 docs/ui-components.md；Phase 2 帳號管理頁將複用此殼。 */
.settings-center { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: var(--space-6); align-items: start; }
.settings-nav { display: flex; flex-direction: column; gap: var(--space-0_5); border-right: 1px solid var(--border-card); padding-right: var(--space-5); }
.settings-nav-title { font-size: var(--fs-h2); font-weight: var(--fw-heading); color: var(--text-primary); padding: 0 var(--space-2) var(--space-3); line-height: 1.4; }
.settings-nav-grp { font-size: var(--fs-xs, var(--fs-body)); color: var(--text-secondary); letter-spacing: .04em; padding: var(--space-3) var(--space-2) var(--space-1); }
.settings-nav-item { display: block; padding: var(--space-2) var(--space-2); border-radius: var(--r-md); color: var(--text-secondary); font-size: var(--fs-body); text-decoration: none; }
.settings-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-nav-item.active { background: var(--bg-hover); color: var(--text-primary); font-weight: var(--fw-heading); }
.settings-body { min-width: 0; max-width: 760px; }
/* 清單型設定頁（帳號管理）：取消 760 限寬吃滿內容區，並設為 container（卡片網格用 @container 收欄） */
.settings-body--wide { max-width: none; container-type: inline-size; }
.settings-h1 { font-size: var(--fs-h2); font-weight: var(--fw-heading); color: var(--text-primary); margin: 0 0 var(--space-3); line-height: 1.4; }
.settings-sub { font-size: var(--fs-body); color: var(--text-secondary); margin: 0 0 var(--space-4); }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); padding: var(--space-3) 0; border-bottom: 1px solid var(--border-card); }
.pref-row:last-child { border-bottom: 0; }
.pref-label-title { font-size: var(--fs-body); font-weight: var(--fw-heading); color: var(--text-primary); }
/* 偏好頁 hint 為堆疊在標題下方（非行內），清掉 .label-hint 的行內左邊距，讓說明左緣切齊標題 */
.pref-label .label-hint { margin-left: 0; }

@media (max-width: 768px) {
  .settings-center { grid-template-columns: 1fr; gap: var(--space-4); }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; gap: var(--space-1); overflow-x: auto; }
  .settings-nav-title, .settings-nav-grp { display: none; }
  .settings-nav-item { white-space: nowrap; border: 1px solid var(--border-card); }
}

/* 頁面 H1（H1 = 16/700 per CLAUDE.md） */
/* 區塊間距 18px（card 之間）*/
.mb-section { margin-bottom: var(--space-4); }
.mt-section { margin-top: var(--space-6); }
.ta-right { text-align: right; }
/* 個人中心：摘要卡列（時數/報價彙總、客戶摘要）— 不套 .stat-grid 故不觸發數字捲動動畫 */
.summary-cards { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.summary-cards .stat-card { width: auto; min-width: 190px; }
.stat-unit { font-size: var(--fs-sm); font-weight: var(--fw-medium); color: var(--text-tertiary); }
/* card-title 後 14px 間距（介於 mb-3 12 與 mb-section 18 之間）*/
.mb-card-title { margin-bottom: var(--space-3); }

/* 全頁通用 alert（成功/錯誤）*/
.alert {
  padding: var(--space-3) var(--space-4); border-radius: var(--r-sm);
  margin-bottom: var(--space-4); font-size: var(--fs-body);
}
.alert--success { border-left: 3px solid var(--success); color: var(--text-primary); }   /* UAT：無底色，success 左條＋中性字 */
.alert--error   { background: var(--danger-soft); color: var(--danger-text); }
/* modal 內部行內錯誤條（較小字、可隱藏）*/
.alert-inline {
  margin-top: var(--space-3); padding: var(--space-2) var(--space-3);
  background: var(--danger-soft); color: var(--danger-text);
  border-radius: var(--r-sm); font-size: var(--fs-sm);
}

/* 大圓頭像（個人設定 64px）*/
.avatar-trigger {
  position: relative; width: 64px; height: 64px;
  border-radius: 50%; border: none; padding: 0;
  cursor: pointer; background: none; flex-shrink: 0;
}
.avatar-circle-lg {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--text-on-accent); font-size: 20px; font-weight: var(--fw-bold);
  overflow: hidden;
  background-size: cover; background-position: center;
}
.avatar-overlay {
  position: absolute; inset: 0; border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-on-accent); font-size: var(--fs-xs);
  opacity: 0; transition: opacity .2s;
}
.avatar-img-fill { width: 100%; height: 100%; object-fit: cover; }

/* 製表人簽章預覽（個人設定）*/
.signature-preview {
  width: 220px; min-height: 80px;
  border: 1px dashed var(--border-input); border-radius: var(--r-sm);
  background: var(--bg-input);
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-2);
}
.signature-img { max-width: 100%; max-height: 70px; object-fit: contain; }
.signature-empty { color: var(--text-tertiary); font-size: var(--fs-body); }

/* Cropper.js 容器：限定高度避免 modal 撐爆 */
.sig-crop-stage {
  width: 100%; max-height: 380px; overflow: hidden;
  background: var(--bg-input); border-radius: var(--r-sm);
}
.sig-crop-stage > img { max-width: 100%; display: block; }

/* 行內表單 input（一條線寬，獨立於 .fg 容器）*/
.input-line {
  width: 100%; height: 40px; padding: 0 var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  background: var(--bg-input); color: var(--text-primary);
  font-size: var(--fs-body); font-family: inherit; outline: none;
}

/* 純文字按鈕（移除頭像等小操作）*/
.btn-text {
  margin-top: var(--space-1);
  background: none; border: none;
  color: var(--text-tertiary);
  font-size: var(--fs-xs); text-decoration: underline;
  cursor: pointer; padding: 0;
}

/* form label 行 & meta 標籤 */
.form-label-inline {
  display: block; font-size: var(--fs-sm);
  color: var(--text-secondary); margin-bottom: var(--space-1);
}

/* 密碼規則 hint（11px tertiary）*/
.pwd-rule-hint { font-size: var(--fs-xs); color: var(--text-tertiary); margin-top: var(--space-1); }

/* modal-sm 變體：480px 寬 */
.modal-sm--480 { width: 480px; }

/* 安全卡片：密碼行 */
.security-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.security-label { font-size: var(--fs-sm); color: var(--text-secondary); }

/* 文字色 utility 補強 */
.text-blue { color: var(--info-text); }

/* 範圍 meta 行（統計頁頂部）*/
.range-meta { font-size: var(--fs-sm); color: var(--text-tertiary); margin-top: var(--space-0_5); }

/* 區塊上邊線 + padding-top（統計卡內子段落分隔）*/
.psc-divider-top    { border-top: 1px solid var(--divider); padding-top: var(--space-3); }
.psc-divider-top-sm { border-top: 1px solid var(--divider); padding-top: var(--space-2); margin-top: var(--space-2); }

/* 合計/總計行的大字（16/700）*/
.psc-total-text  { font-size: var(--fs-lg); font-weight: var(--fw-heading); }
.psc-total-blue  { font-size: var(--fs-lg); font-weight: var(--fw-heading); color: var(--info-text); }

/* 時數欄位（右靠等寬）*/
.psc-hours-amount { color: var(--info-text); min-width: 44px; text-align: right; }

/* ── Standalone 頁面（Login / Pending / Error 等 layout=null 頁共用） ──
   都採同一容器骨架：.standalone-page（置中外層）+ .standalone-card（白底浮卡）
   各頁差異只在卡內容；任何新 standalone 頁面都應沿用，避免再寫 inline <style> */
.standalone-page {
  /* Login / Pending / Error hero 場景漸層背景（design-system-v3 §3c；§6.5 准登入頁漸層）
     注意：body class="standalone-page"，不能用 background shorthand 否則會把 body 設定全打掉 → 拆 background-color / -image / -attachment 長寫
     #E9E2FB / #DCF3F6 為 hero 專用色（design §3c 定案值，非通用階故不入 primitive）*/
  background-color: var(--bg-page);
  background-image: linear-gradient(135deg, #E9E2FB 0%, #FAFAFC 52%, #DCF3F6 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--space-6);
}
[data-theme="dark"] .standalone-page {
  /* 夜：紫黑 radial + 右下青光暈（design §3c）；尾端純色 #16161F 拆成 background-color（bare color 不是合法 background-image 值）*/
  background-color: var(--bg-page);   /* #16161F */
  background-image:
    radial-gradient(130% 150% at 12% -10%, #2A1B5E 0%, #16161F 50%),
    radial-gradient(90% 110% at 100% 110%, rgba(0,245,255,.16) 0%, transparent 55%);
}
.standalone-card {
  max-width: 440px; width: 100%;
  /* Glass：登入卡漂在 hero 漸層上（design-system-v3 §3c）*/
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  border-radius: var(--r-lg);
  padding: var(--space-10) var(--space-8);
  box-shadow: var(--glass-shadow);   /* glass 登入卡吃 glass 陰影（2026-07-11 接回）*/
  text-align: center;
}
.standalone-card--form { text-align: left; padding: var(--space-10) var(--space-8); }   /* Login 等表單卡 */
.icon-circle-orange-magenta {
  width: 64px; height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--warn-solid-deep), var(--ink));   /* 深值漸層：白字兩主題皆過 AA */
  color: var(--text-on-accent);
  display: flex; align-items: center; justify-content: center;
}
.standalone-title {
  font-size: var(--fs-h2); font-weight: var(--fw-heading); color: var(--text-primary);
  margin: 0 0 var(--space-2);
}
.standalone-text {
  font-size: var(--fs-body); color: var(--text-tertiary);
  line-height: 1.8; margin: 0 0 var(--space-2);
}
.standalone-text--last { margin-bottom: var(--space-6); }
.standalone-account {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  padding: var(--space-3) var(--space-3); background: var(--bg-muted);
  border-radius: var(--r-sm); margin-bottom: var(--space-6);
}
.btn-min-120 { min-width: 120px; }

/* Error 頁中的大 emoji */
.err-emoji { font-size: 40px; margin-bottom: var(--space-4); }

/* Login 頁專屬 */
.login-brand   { display: flex; align-items: center; justify-content: center; margin-bottom: var(--space-6); }
.login-logo    { height: 36px; width: auto; object-fit: contain; flex-shrink: 0; max-width: 100%; }
.login-tagline { margin: -12px 0 var(--space-6); text-align: center; font-size: var(--fs-sm); color: var(--text-tertiary); letter-spacing: .3px; }
.divider-or {
  display: flex; align-items: center; gap: var(--space-2);
  margin: var(--space-5) 0; color: var(--text-tertiary); font-size: var(--fs-sm);
}
.divider-or::before, .divider-or::after {
  content: ''; flex: 1; height: 1px; background: var(--divider);
}
.btn-google {
  width: 100%; padding: var(--space-2);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  background: var(--bg-card); color: var(--text-primary);
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  font-size: var(--fs-body); cursor: pointer; transition: all .15s;
  font-family: inherit;
}
.btn-google:hover { background: var(--bg-muted); border-color: var(--border-hover); }

/* Alert（錯誤訊息塊 — 用 danger soft 底，與 v2.1 token 對齊）*/
.alert-err {
  background: var(--danger-soft); color: var(--danger-text);
  border-radius: var(--r-sm);
  padding: var(--space-2) var(--space-3); font-size: var(--fs-body);
  margin-bottom: var(--space-4);
}

/* ══════════════════════════════════════════════════
   Skeleton Loader（v2.1 — 列表 / 卡片載入中佔位）
   用法：把目標元素改成 .skeleton 或在 placeholder 內填 .skeleton-line
   shimmer 漸層動畫橫掃，預設灰底；dark 模式自動翻轉
   ══════════════════════════════════════════════════ */
@keyframes mx-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}
.skeleton {
  background-image: linear-gradient(
    90deg,
    var(--bg-subtle) 0%,
    var(--bg-card) 50%,
    var(--bg-subtle) 100%
  );
  background-size: 200% 100%;
  animation: mx-shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-sm);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}
/* dark：在 card 之上提亮微光（section→hover→section），避免比卡片還暗的「黑洞」掃過 */
[data-theme="dark"] .skeleton {
  background-image: linear-gradient(90deg, var(--bg-section) 0%, var(--bg-hover) 50%, var(--bg-section) 100%);
}
.skeleton-line   { height: 12px; margin: var(--space-1) 0; }
.skeleton-line.lg{ height: 16px; }
.skeleton-line.sm{ height: 10px; }
.skeleton-card   { height: 80px; border-radius: var(--r-md); margin-bottom: var(--space-3); }
.skeleton-avatar { width: 36px; height: 36px; border-radius: 50%; }

/* ══════════════════════════════════════════════════
   Empty state 強化（v2.1 — .empty 既有但僅單行；補完整變體）
   既有 .empty / .empty svg / .empty p 維持
   新增：.empty-title 標題 + .empty-hint 補充說明 + .empty-cta 按鈕區
   用法：<div class="empty"><svg…/><div class="empty-title">標題</div>
                              <p>說明</p><div class="empty-cta">…</div></div>
   ══════════════════════════════════════════════════ */
.empty-title {
  font-size: var(--fs-lg); font-weight: var(--fw-heading);
  color: var(--text-primary);
  margin: 0 0 var(--space-1);
}
.empty-hint {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  margin-top: var(--space-1);
}
.empty-cta { margin-top: var(--space-4); display: inline-flex; gap: var(--space-2); }

/* 新增任務表單佈局（v7）：垂直單欄堆疊。任務簡述用 .reply-input-box 複合框（圖在下、框內＋加圖）；
   「優先/指派/開始/截止」與測試環境用 row4/row2 等分。.ticketform 為 container-query 容器
   → 窄寬時 row4 4→2→1（看容器寬、不看視窗）。測試環境組勾 .ticketform-toggle 後 JS toggle。 */
.ticketform { container-type: inline-size; display: flex; flex-direction: column; gap: var(--space-4); }
.ticketform-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.ticketform-row4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
/* row5：屬性/優先/指派各 1fr（1/5）＋期程 grid-column:span 2（2/5）。無權隱藏的欄自動退位、其餘維持 1/5 寬。 */
.ticketform-row5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: var(--space-3); }
.ticketform-row2 > *, .ticketform-row4 > *, .ticketform-row5 > * { min-width: 0; }
.fg-grow          { flex: 1; min-height: 0; }
.fg-grow textarea { min-height: 120px; flex: 1; resize: vertical; }
.fg-flat textarea { min-height: 0; }

/* 勾選列：點整列展開測試環境 */
.ticketform-toggle {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-3); cursor: pointer;
  font-size: var(--fs-body); color: var(--text-secondary);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-card);
  border-radius: var(--r-md);
}
.ticketform-toggle input { width: 16px; height: 16px; }

/* 測試環境組：左側強調色帶，視覺上與基本欄位分群。
   margin-top 用 space-3，讓展開後與上方表單保持固定間距。 */
.ticketform-env {
  display: flex; flex-direction: column; gap: var(--space-3);
  margin-top: var(--space-3);
  padding: var(--space-3);
  background-color: var(--bg-subtle);
  border: 1px solid var(--border-card);
  border-left: 3px solid var(--text-link);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* row4 隨容器寬 4→2→1（優先/指派/開始/截止 + 測試環境四欄）；row2 很窄時也收單欄 */
@container (max-width: 680px) { .ticketform-row4, .ticketform-row5 { grid-template-columns: 1fr 1fr; } }
@container (max-width: 440px) { .ticketform-row2, .ticketform-row4, .ticketform-row5 { grid-template-columns: 1fr; } }

/* ── 收尾小 utility（最後一輪 inline 清理）── */
.uppercase   { text-transform: uppercase; }
.shrink-0    { flex-shrink: 0; }
.ml-0        { margin-left: 0; }
.ml-2        { margin-left: var(--space-1); }
.lh-7        { line-height: 1.7; }
.justify-end     { justify-content: flex-end; }
.justify-between { justify-content: space-between; }
.btn-grow    { flex: 1; min-width: 0; justify-content: center; }
.td-shrink   { max-width: 0; }
.title-narrow { max-width: 130px; }
.avatar-img-fill--round { border-radius: 50%; }

/* sidebar 客戶單專案文字（無下拉時的顯示）*/
.sb-client-proj {
  color: var(--text-sidebar);
  font-size: var(--fs-body);
  padding: var(--space-1) 0;
}

/* 表單行 form (display:contents — sidebar 登出 form 用) */
.form-contents { display: contents; }

/* ══════════════════════════════════════════════════
   Misc
   ══════════════════════════════════════════════════ */
.section-title {
  font-size: var(--fs-h2); font-weight: var(--fw-heading); color: var(--text-primary);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: var(--space-2);
}
.info-row        { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-2); padding: var(--space-1) 0; border-bottom: 1px solid var(--divider); }
.info-row:last-child { border-bottom: none; }
.info-label { font-size: var(--fs-sm); color: var(--text-tertiary); white-space: nowrap; padding-top: 1px; }
.info-value { font-size: var(--fs-sm); color: var(--text-primary); text-align: right; word-break: break-all; }

/* ══════════════════════════════════════════════════
   Collapsible Project Stat Card (.psc) — Stats 頁
   ══════════════════════════════════════════════════ */
.psc {
  background: var(--card-bg); border-radius: var(--r-md);
  overflow: hidden; border: 1px solid var(--border-card); box-shadow: none;
  transition: border-color .15s, background .15s, transform .15s;
}
.psc:hover { border-color: var(--border-hover); background: var(--bg-hover); box-shadow: none; }
.psc-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--space-3) var(--space-4); cursor: pointer; user-select: none; gap: var(--space-2);
}
.psc-header:hover { background: var(--bg-hover); }
.psc-left { flex: 1; min-width: 0; }
.psc-name {
  font-size: var(--fs-body); color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.psc-client { font-size: var(--fs-sm); color: var(--text-tertiary); margin-top: 1px; }
.psc-meta   { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.psc-total-badge {
  font-size: var(--fs-body); color: var(--info-text);
  background: var(--info-soft); padding: var(--space-0_5) var(--space-2); border-radius: var(--r-pill); white-space: nowrap;
}
.psc-total-badge-empty { background: var(--soft-gray); color: var(--text-tertiary); }
.psc-toggle-btn {
  width: 32px; height: 32px; border-radius: var(--r-xs); border: 1px solid var(--border-input);
  background: var(--bg-card); display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-tertiary); flex-shrink: 0; box-sizing: border-box; padding: 0;
}
.psc-toggle-btn svg { transition: transform .2s; }
.psc.open .psc-toggle-btn svg { transform: rotate(180deg); }
.psc-body { display: none; padding: 0 var(--space-4) var(--space-3); border-top: 1px solid var(--divider); }
.psc.open .psc-body { display: block; }
.psc-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-1) 0; font-size: var(--fs-body);
}
.psc-hours-label {
  font-size: var(--fs-body); color: var(--text-secondary); margin-bottom: var(--space-1);
}
.psc-total-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-1) 0 var(--space-0_5); font-size: var(--fs-body);
  border-top: 1px solid var(--divider); margin-top: var(--space-0_5);
}

/* ══════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════ */

/* 側邊欄遮罩（桌機隱藏） */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: var(--bg-overlay);
  z-index: 999;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
#sidebar-overlay.show { display: block; }

/* ── 行動底部導航 bar（桌機隱藏；≤768 顯示） ──
   點 logo 觸發 toggleSidebar 開 drawer；其他 icon 直接導航 */
#mobile-bottom-bar { display: none; }

.sb-brand { user-select: none; }

/* ── Sidebar 收合/展開切換鈕（與 logo 同列、靠右） ── */
.sb-toggle {
  margin-left: auto;              /* flex 推到 brand row 最右側 */
  width: 32px; height: 32px; padding: 0;
  background: transparent; border: none; border-radius: var(--r-xs);
  color: var(--text-sidebar-muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; box-sizing: border-box;
  transition: background .15s, color .15s;
}
.sb-toggle:hover { background: var(--bg-sidebar-hover); color: var(--text-sidebar); }
.sb-toggle:focus-visible { box-shadow: var(--focus-ring); outline-offset: 1px; }
.sb-toggle svg { width: 22px; height: 22px; transition: transform .2s; display: block; }
/* ── 收合狀態：icon rail ─────────────────────────── */
html.sb-collapsed #app > #sidebar {
  width: 56px; min-width: 56px;
}
/* 收合：brand 改直排 → avatar / 淡橫線 / toggler，與下方 nav 等距 */
html.sb-collapsed #app .sb-brand        {
  flex-direction: column; padding: var(--space-5) 0 var(--space-1); gap: var(--space-1);
  justify-content: center; align-items: center;
}
html.sb-collapsed #app .sb-brand-name   { display: none; }
html.sb-collapsed #app .sb-toggle       { margin-left: 0; }
/* 收合：「主選單」label 文字隱藏 */
html.sb-collapsed #app .sb-section      { display: none; }
html.sb-collapsed #app .sb-label        { display: none; }
html.sb-collapsed #app #sb-nav          { padding: var(--space-2) var(--space-1); }
html.sb-collapsed #app #sb-nav a        { justify-content: center; padding: var(--space-2) 0; gap: 0; }
/* 收合：底部固定區同 rail 化；「新」標記文字收起、只留右上角一顆色點 */
html.sb-collapsed #app .sb-foot           { padding: var(--space-2) var(--space-1); }
html.sb-collapsed #app .sb-foot .sb-link  { justify-content: center; padding: var(--space-2) 0; gap: 0; position: relative; }
html.sb-collapsed #app .sb-foot .rn-new   {
  position: absolute; top: 2px; right: 6px;
  margin: 0; padding: 0; gap: 0; font-size: 0;
}

/* Admin 兩欄管理面板 */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

/* Admin Hub — 三層 IA 的 Layer 1 入口卡（2x2 grid，整卡可點）*/
.admin-hub-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.admin-hub-card {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.admin-hub-card:hover { background: var(--bg-hover); border-color: var(--border-hover); box-shadow: none; }
.admin-hub-card.is-disabled { cursor: not-allowed; opacity: 0.5; pointer-events: none; }
.admin-hub-title {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--fs-lg); font-weight: var(--fw-heading); color: var(--text-primary);
  margin-bottom: var(--space-2);
}
.admin-hub-meta { font-size: var(--fs-body); color: var(--text-primary); margin-bottom: var(--space-1); }
.admin-hub-desc { font-size: var(--fs-sm); color: var(--text-tertiary); }

/* Admin Layer 2 列表頁工具列（搜尋 + chip filter）*/
.admin-toolbar {
  display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap;
  margin-bottom: var(--space-3);
}
.admin-toolbar input[type="text"] {
  flex: 1; min-width: 200px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-input);
  border-radius: var(--r-md);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: var(--fs-body);
}
.admin-toolbar input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-text);
}

/* 角色 chip filter */
.admin-chip-group { display: flex; gap: var(--space-1); flex-wrap: wrap; }
.admin-chip {
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--border-input);
  border-radius: var(--r-pill);
  background: var(--bg-control);
  color: var(--text-secondary);
  font-size: var(--fs-sm);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.admin-chip:hover { border-color: var(--border-hover); }
.admin-chip.is-active {
  background: var(--ink);          /* active = ink 實心底（白字兩主題過 AA；--info-text dark 翻亮 #92AACC 白字僅 2.4:1 破，故不用）*/
  border-color: var(--ink);
  color: #fff;
}


.admin-empty { text-align: center; padding: var(--space-6) 0; }

/* ≤ 1400px：stat-grid 8→4（兩排四張），≤768 再降到 2 欄；avoid cramming 8 cards in narrow viewports */
@media (max-width: 1400px) {
  .stat-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ≤ 900px：分佈圖改單欄堆疊；管理面板亦改單欄；
   問題詳情 Detail 兩欄改堆疊，避免右欄 290px 把左欄擠到不能用 */
@media (max-width: 900px) {
  .dist-grid  { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  .admin-hub-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; gap: var(--space-3); }
  /* 看板高度：900px 以下 toolbar 可能 wrap 兩列，估算 50→ ~96，留更多空間給看板 */
  .view-board-frame { height: calc(100vh - 160px); }
}

/* ≤ 768px：行動裝置 — sidebar 改成「從底部彈出的卡片」（不是左側抽屜）
   底部固定 bottom bar 做主導航；卡片只放使用者點 logo 才需要的東西（專案、字級、主題、登出）
   清單模式只顯示問題簡述（每張卡片至多 3 行），看板模式整個隱藏（手機只給清單）；
   filter-bar 簡化為「篩選 / 指派給我 / 回報」三顆並列 + 搜尋整行 */
@media (max-width: 768px) {
  /* ── Sidebar 變成從底部 bar 上方彈出的「卡片」（向上滑入動畫） ──
     注意：#app 維持桌機 flex 配置，sidebar 用 position:fixed 不佔 flex 空間，
     這樣 #main flex:1 仍然能撐滿，#content overflow-y:auto 才會正常滾動。
     之前把 #app 改 block 導致 flex 鏈斷掉 → content 無法 scroll，是 bug，不要重蹈覆轍。 */
  #sidebar {
    position: fixed;
    /* 60 = bottom bar 高，再加 8 留呼吸空間 + iOS safe area */
    bottom: calc(60px + env(safe-area-inset-bottom) + 8px);
    left: 8px; right: 8px; top: auto;
    width: auto; min-width: 0;
    height: auto; max-height: none;
    z-index: 1000;
    background: var(--bg-card);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: visible;
    /* 卡片內排成一行 toolbar：[小][中][大]  [日/月]  [登出] */
    display: flex; flex-direction: row; align-items: center; gap: var(--space-2);
    padding: var(--space-3) var(--space-3);
    transform: translateY(calc(100% + 100px));   /* 完全滑出畫面外（往下） */
    transition: transform .25s ease;
  }
  #app.sidebar-mobile-open > #sidebar { transform: translateY(0); }

  /* 手機 slide-out：顯示 avatar+名稱 header + 帳號 panel（inline 常駐）；nav 走底部 bar */
  #sidebar #sb-nav,
  #sidebar .sb-proj { display: none; }
  /* 「更新內容」重看入口留在手機卡片（手機無側欄捲動區、此卡即入口所在）；
     卡片是橫排 toolbar → 靠右擺，去掉直式側欄用的滿寬與上分隔線 */
  #sidebar .sb-foot { margin-left: auto; padding: 0; border-top: none; }
  #sidebar .sb-foot .sb-link { width: auto; margin-bottom: 0; }
  #sidebar .sb-brand { padding: var(--space-4); gap: var(--space-2); }
  #sidebar .sb-brand .sb-avatar { width: 30px; height: 30px; font-size: var(--fs-sm); }
  #sidebar .sb-brand-name { font-size: var(--fs-lg); font-weight: var(--fw-heading); }
  .sb-toggle { display: none; }

  /* ── 底部 bar ── */
  #mobile-bottom-bar {
    display: flex; justify-content: space-around; align-items: stretch;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 900;
    height: 60px;
    padding: var(--space-1) var(--space-1);
    padding-bottom: calc(4px + env(safe-area-inset-bottom));
    background: var(--bg-card);
    border-top: 1px solid var(--divider);
  }
  .mb-item {
    flex: 1; min-width: 0;
    display: inline-flex; align-items: center; justify-content: center;
    background: transparent; border: 0; cursor: pointer;
    color: var(--text-tertiary);
    padding: var(--space-1) var(--space-1); border-radius: var(--r-sm);
    transition: color .15s, background .15s;
    text-decoration: none;
  }
  .mb-item:hover         { color: var(--text-primary); }
  .mb-item.active        { color: var(--text-primary); background: var(--bg-muted); }
  .mb-item:focus-visible { box-shadow: var(--focus-ring); outline-offset: -2px; }
  .mb-item svg           { width: 24px; height: 24px; }
  .mb-logo img           { width: 28px; height: auto; object-fit: contain; }

  /* 專案 picker：可見的是 folder icon，invisible <select> 疊在上方觸發 native picker */
  .mb-proj             { position: relative; }
  .mb-proj-select {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    opacity: 0; cursor: pointer;
    border: 0; padding: 0; margin: 0;
    font-size: 16px;            /* iOS 避免 focus 時自動縮放畫面 */
    -webkit-appearance: none; appearance: none;
  }
  .mb-avatar {
    width: 30px; height: 30px; border-radius: 50%; overflow: hidden;
    display: grid; place-items: center;
    color: var(--text-on-accent); font-size: var(--fs-sm); font-weight: var(--fw-bold);
  }
  .mb-avatar img { width: 100%; height: 100%; object-fit: cover; }
  /* 底色：套用既有 .sb-avatar-* 單色 --ink-muted（co-apply 角色 class，共用 background 規則） */

  /* 內容下方留出 bottom bar 空間（含 iOS home indicator 安全區） */
  #content { padding: 14px 14px calc(76px + env(safe-area-inset-bottom)); }

  .stat-grid  { grid-template-columns: repeat(2, 1fr); }
  .form-grid  { grid-template-columns: 1fr; }

  /* ── 看板模式手機禁用：強制只顯示清單 ── */
  #view-board     { display: none !important; }
  #view-list      { display: block !important; }
  .view-toggle    { display: none; }

  /* ── Filter bar：按鈕並列 + 搜尋整行；toolbar-end 用 display:contents
       讓 toolbar-end 的按鈕直接成為 filter-bar 的 flex children ── */
  .filter-bar              { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-3); }
  .filter-bar .toolbar-end { display: contents; }
  .filter-bar > .filter-btn,
  .filter-bar > .toolbar-end > .btn-primary,
  .filter-bar > .toolbar-end > .btn {
    flex: 1 1 0; min-width: 0; padding-left: var(--space-2); padding-right: var(--space-2);
    justify-content: center;
  }
  .filter-bar .search-box  { flex: 1 1 100%; min-width: 0; order: 99; }

  /* ── 清單卡片：只保留問題簡述，至多 3 行，超過刪節號；其他 meta 全部隱藏 ── */
  .issue-table          { display: block; width: 100%; background: transparent; }
  .issue-table colgroup { display: none; }
  .issue-table thead    { display: none; }
  .issue-table tbody    { display: block; width: 100%; }
  .issue-table tr.issue-row {
    display: block; width: 100%;
    background: var(--bg-card);
    border-radius: var(--r-md); border: 1px solid var(--border-card); box-shadow: none;
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-2);
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
  }
  .issue-table tr.issue-row:hover { border-color: var(--border-hover); background: var(--bg-hover); box-shadow: none; }
  .issue-table tr.issue-row td { display: none; }
  .issue-table tr.issue-row td:nth-child(4) {
    display: block; padding: 0; border: 0; height: auto; text-align: left;
    /* 問題簡述 td 帶有 .td-shrink class（桌機表格用 max-width:0 + ellipsis），
       手機卡片化必須 override，否則內容寬度為 0 → 看不到任何文字 */
    max-width: none;
  }
  .issue-table tr.issue-row td:nth-child(4) .issue-title {
    display: -webkit-box;
    -webkit-line-clamp: 3;
            line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    font-size: var(--fs-body); color: var(--text-primary);
    /* 桌機 .issue-title 預設 white-space: nowrap，手機要恢復 normal 才能多行顯示 */
    white-space: normal;
    width: auto;
    margin-bottom: 0;
  }
  /* 列表頁外層 .card 在手機改透明，讓每張 issue card 浮起來 */
  #view-list > .card { background: transparent; box-shadow: none; }

  /* ── iTracker 時數表格手機版：覆寫 .issue-table 規則（欄位順序不同）──
     桌機欄位 1=# / 2=日期 / 3=簡述 / 4=類型 / 5=時數
     手機簡化為：#編號（左上）+ 時數（右上）+ 簡述（下方 2 行截斷） */
  .hours-table tr.issue-row {
    display: flex; flex-wrap: wrap; align-items: baseline;
    column-gap: var(--space-3); row-gap: var(--space-1);
    padding: var(--space-3) var(--space-3);
  }
  /* 先把 .issue-table 規則放出來的 nth-child(4)（類型）藏掉 */
  .hours-table tr.issue-row td:nth-child(4) { display: none; }
  /* # 編號 */
  .hours-table tr.issue-row td:nth-child(1) {
    display: block; padding: 0; border: 0; height: auto; text-align: left;
    flex: 0 0 auto; font-weight: var(--fw-bold); color: var(--text-primary);
  }
  /* 時數（右上對齊） */
  .hours-table tr.issue-row td:nth-child(5) {
    display: block; padding: 0; border: 0; height: auto;
    flex: 0 0 auto; margin-left: auto; text-align: right;
    font-weight: var(--fw-bold); color: var(--info-text);
  }
  /* 簡述（整行寬，2 行截斷） */
  .hours-table tr.issue-row td:nth-child(3) {
    display: block; padding: 0; border: 0; height: auto; text-align: left;
    flex: 1 1 100%; max-width: none;
  }
  .hours-table tr.issue-row td:nth-child(3) .issue-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
            line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
    font-size: var(--fs-body); color: var(--text-primary);
    white-space: normal; width: auto; margin-bottom: 0;
  }
  /* tfoot 改成同樣卡片風格的合計列 */
  .hours-table tfoot { display: block; width: 100%; }
  .hours-table tfoot tr {
    display: flex; justify-content: space-between; align-items: baseline;
    background: var(--bg-card); border-radius: var(--r-md);
    padding: var(--space-3) var(--space-3); margin-top: var(--space-1); border: 1px solid var(--border-card); box-shadow: none;
  }
  .hours-table tfoot td { display: block; padding: 0; border: 0; background: transparent; }
  .hours-table tfoot td[colspan] { flex: 1; text-align: left; }

  /* admin 9 欄版手機：欄太多無法卡片化，回退標準 table 並依賴 .scroll-x 橫向捲動。
     用 !important 統一壓掉前面 .issue-table / .hours-table 的卡片化規則（含 nth-child 隱藏）*/
  .hours-table--admin tr.issue-row { display: table-row !important; padding: 0; column-gap: 0; row-gap: 0; }
  .hours-table--admin tr.issue-row td { display: table-cell !important; padding: var(--space-3) var(--space-3) !important; }
  .hours-table--admin tfoot { display: table-footer-group !important; }
  .hours-table--admin tfoot tr {
    display: table-row !important; background: transparent !important; border-radius: 0 !important;
    padding: 0 !important; margin-top: 0 !important; box-shadow: none !important;
  }
  .hours-table--admin tfoot td { display: table-cell !important; padding: var(--space-3) var(--space-3) !important; background: var(--bg-section); }
  .hours-table--admin tfoot td[colspan] { text-align: right; }

  /* ── Admin 列表：標題 + meta + 動作三段堆疊，避免擠在一行造成文字疊起來 ── */
  .admin-list-item       { flex-direction: column; align-items: stretch; gap: var(--space-2); padding: var(--space-3) 0; }
  /* 動作按鈕（編輯 / 刪除）等寬均分 */
  .admin-row-actions     { display: flex; gap: var(--space-2); }
  .admin-row-actions > .btn { flex: 1 1 0; min-width: 0; }
  .admin-section-head    { gap: var(--space-2); flex-wrap: wrap; }
}

/* ≤ 480px：篩選 popover 在窄螢幕用 8px 邊距固定全寬，避免跑出畫面 */
@media (max-width: 480px) {
  .filter-popover {
    left: 8px !important;
    right: 8px;
    width: auto;
    min-width: 0;
    max-width: calc(100vw - 16px);
  }
}

/* ≤ 480px：極窄手機 — modal padding 縮，避免被表單擠爆 */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .stat-card { padding: var(--space-3) var(--space-3); }
  .stat-value { font-size: 24px; }

  /* Modal：100dvh 避開 iOS Safari address bar 壓縮，padding 縮小留出表單空間 */
  .modal-overlay { padding: var(--space-2); }
  .modal         { max-height: calc(100dvh - 16px); }
  .modal-hd      { padding: var(--space-3) var(--space-4) var(--space-3); }
  .modal-bd      { padding: var(--space-3) var(--space-4); }
  .modal-ft      { padding: var(--space-3) var(--space-4); }
  .modal-wide,
  .modal-xl      { width: 100%; }

  /* Sidebar 展開時佔大部分螢幕 */
  #app.sidebar-mobile-open > #sidebar { width: 80vw; min-width: 240px; }
}

/* ══════════════════════════════════════════════════
   @ Mention
   ══════════════════════════════════════════════════ */
.mention-popup {
  position: fixed; background: var(--bg-elevated);
  border-radius: var(--r-md);
  padding: var(--space-1); z-index: 600;
  box-shadow: var(--shadow-lg);
  min-width: 210px; max-width: 280px; max-height: 220px;
  overflow-y: auto; display: none;
}
.mention-opt {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-2); border-radius: var(--r-xs);
  cursor: pointer; transition: background .1s;
}
.mention-opt:hover,
.mention-opt.focused { background: var(--info-soft); }
.mention-av {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  background: var(--ink-muted);   /* 頭像單色底（2026-07-10：與全站頭像一致 --ink-muted，去漸層）*/
  display: grid; place-items: center;
  font-size: var(--fs-sm); color: var(--text-on-accent);
}
.mention-tag {
  color: var(--info-text);
  background: var(--info-soft); border-radius: var(--r-xs);
  padding: 1px var(--space-1); font-size: inherit;
}
.mention-notify-bar {
  padding: var(--space-1) var(--space-3);
  background: var(--info-soft); border-top: 1px solid var(--divider);
  font-size: var(--fs-body); color: var(--info-text);
  display: none; align-items: center; gap: var(--space-1); flex-wrap: wrap;
}
.mention-notify-bar svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════
   Utility Classes（抽自頁面 inline style）
   為避免 245 處 inline 散在 14 個 cshtml，集中於此
   ══════════════════════════════════════════════════ */

/* 文字對齊 */
.tac { text-align: center; }
.tar { text-align: right; }
.tal { text-align: left; }

/* 文字色階／字級 */
.muted { color: var(--text-tertiary); }
.hint  { font-size: var(--fs-sm); color: var(--text-tertiary); line-height: 1.5; }
.hint-sm { font-size: var(--fs-xs); color: var(--text-tertiary); line-height: 1.5; }
.text-primary   { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary  { color: var(--text-tertiary); }
/* 語意色文字 utility（SES diagnose / 結果訊息 / 通用狀態文字）*/
/* UAT：success 不作文字→中性字＋色點；warning 文字→danger（warn 禁作文字）*/
.text-success { color: var(--text-secondary); }
.text-success::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); margin-right: 5px; vertical-align: middle; }
.text-danger  { color: var(--danger-text); }
.text-warning { color: var(--danger-text); }
.fs-h2      { font-size: var(--fs-h2); }
.fs-lg      { font-size: var(--fs-lg); }
.fs-body    { font-size: var(--fs-body); }
.fs-sm      { font-size: var(--fs-sm); }
.fs-xs      { font-size: var(--fs-xs); }
.fw-medium  { font-weight: var(--fw-medium); }
.fw-bold    { font-weight: var(--fw-bold); }
.fw-heading { font-weight: var(--fw-heading); }

/* 文字流向 */
.nowrap   { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Flex 容器 */
.flex-center  { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-end     { display: flex; align-items: center; justify-content: flex-end; }
.flex-stack   { display: flex; flex-direction: column; }
.flex-1       { flex: 1; min-width: 0; }
.ml-auto      { margin-left: auto; }

/* Gap（與 flex 搭配） */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-1); }
.gap-3 { gap: var(--space-2); }
.gap-4 { gap: var(--space-3); }
.gap-5 { gap: var(--space-4); }

/* 上下間距（替代 margin inline） */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }

/* ══════════════════════════════════════════════════
   SES 設定頁（admin/SesSettings）— 唯讀資訊 / 診斷結果樣式
   ══════════════════════════════════════════════════ */
.ses-info-block {
  background: var(--bg-frozen);
  border-radius: var(--r-sm);
  padding: var(--space-3) var(--space-4);
  line-height: 1.8;
}
.ses-result {
  margin-top: var(--space-2);
  font-size: var(--fs-sm);
}
.ses-toggle-row {
  display: flex; align-items: center; gap: var(--space-3);
  cursor: pointer;
}
.ses-toggle-row input[type="checkbox"] {
  width: 18px; height: 18px; cursor: pointer;
}
.ses-state-text { font-weight: var(--fw-bold); }
.ses-test-form {
  display: flex; flex-direction: column; gap: var(--space-2);
  max-width: 400px;
}

/* 行內小 input（cell 編輯、預估時數等） */
.input-inline {
  flex: 1; min-width: 0;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--border-input);
  border-radius: var(--r-sm);
  font-size: var(--fs-body); font-family: inherit;
  outline: none; text-align: center;
  transition: all .2s;
  background: var(--bg-input);
  color: var(--text-primary);
}
.input-inline:focus { border-color: var(--accent-text); box-shadow: var(--focus-ring); }

/* Card padding 變體 */
.card-pad-tight { padding: var(--space-3) var(--space-4); }

/* 動作按鈕網格（指派/狀態：兩欄等寬） */
.action-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-1); }

/* embedded-textarea 大尺寸（Detail 描述編輯） */
.embedded-textarea--lg { min-height: 80px; padding: var(--space-3) var(--space-3); }

/* 未儲存警示 pill — Detail 我的時數預估，dirty 時顯示 */
.unsaved-pill {
  font-size: var(--fs-body); color: var(--text-primary);
  background: var(--warn-soft); border: 1px solid var(--warn-border);
  padding: var(--space-0_5) var(--space-2); border-radius: var(--r-pill);
}

/* 我的時數 input — 隱藏 number type 預設的 spinner（webkit + firefox）*/
.hour-input::-webkit-inner-spin-button,
.hour-input::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
.hour-input { -moz-appearance: textfield; appearance: textfield; }

/* 最新異動 footer 行 */
.last-update-line {
  font-size: var(--fs-sm); color: var(--text-tertiary);
  margin: var(--space-2) 0 0; padding: 0 var(--space-1); line-height: 1.6;
}

/* 問題網址連結 */
.info-link { color: var(--info-text); font-size: var(--fs-body); word-break: break-all; }

/* lightbox（圖片放大檢視） */
.lightbox {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.88);
  align-items: center; justify-content: center;
  z-index: 400; cursor: zoom-out;
}
.lightbox-img {
  max-width: 90vw; max-height: 90vh;
  border-radius: var(--r-md); object-fit: contain; display: block;
}

/* modal overlay 上層（覆蓋既有 modal 之上的 confirm dialog） */
.modal-overlay--top { z-index: 1200; }

/* inline popup（行內 dropdown：狀態/類型/指派/優先）*/
.inline-popup {
  position: fixed;
  background: var(--bg-elevated);
  border-radius: var(--r-md);
  padding: var(--space-1);
  z-index: 500;
  box-shadow: var(--shadow-lg);
}
.inline-popup--status { min-width: 130px; }
.inline-popup--type   { min-width: 120px; }
.inline-popup--prio   { min-width: 120px; }
.inline-popup--assign { min-width: 160px; max-height: 240px; overflow-y: auto; }

/* cell-edit 置中變體 */
.cell-edit--center { justify-content: center; }

/* 看板卡片內可點擊區（屬性/優先/指派頭像 — 避免被 SortableJS 攔截）。
   可編輯 affordance＝手型游標＋hover 淡底，與清單 .cell-edit 同一語彙；不顯示 caret 箭頭（2026-07-21 PM 定案：去 caret、保留 hover 底）。 */
.kb-clickable {
  cursor: pointer; display: inline-flex; align-items: center; gap: 2px;
  border-radius: var(--r-xs); padding: 1px 3px; margin: -1px -1px; transition: background .1s;
}
.kb-clickable:hover { background: var(--bg-muted); }

/* toolbar 右側群組（filter-bar 內，靠右） */
.toolbar-end {
  margin-left: auto;
  display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0;
}

/* 看板容器 */
.view-board-frame {
  /* 100vh - 上 padding 20 - 下 padding 20 - filter-bar 約 50（高 32 + margin 14）= 100vh - 90px
     讓看板底部與清單模式 #content padding-bottom 20px 完全對齊 */
  height: calc(100vh - 90px);
  overflow-x: auto; overflow-y: hidden;
  margin: 0 -24px;
  padding: var(--space-2) var(--space-5) 0;
  /* 註：先前加 scroll-snap-type: x proximity 是想讓行動裝置橫滑對齊欄位邊緣，
     但行動裝置看板已隱藏，這個 snap 在桌機反而會把滾輪轉橫向滾動拉回去（感覺滾不動）。
     後端使用者只剩桌機，直接拿掉。*/
}
/* 看板橫向捲軸釘視窗底（page-chrome-status-icons §5.2）：
   原 .view-board-frame 用 height:calc(100vh-90px) 魔術數字，未算到上方麵包屑列 → frame 比 #content 可用高，
   底部（含橫向捲軸）被推出視窗，某欄卡片多時要往下捲才看到橫捲軸。改為 flex 填滿：#content 轉直排 flex、
   看板 frame flex:1 吃滿剩餘高度，橫向捲軸恆貼視窗底、欄位維持各自內部垂直捲（Trello/Jira 式）。
   全程 scoped 於 html.mx-board-active（JS 切換／初載即套），list 視圖零影響；board 視圖 inspector 恆隱藏，
   .tickets-panes 只含 list-pane，改 stretch/直排安全。*/
html.mx-board-active #content            { display: flex; flex-direction: column; min-height: 0; }
html.mx-board-active #tickets-panes      { flex: 1 1 auto; min-height: 0; align-items: stretch; }
html.mx-board-active .tickets-list-pane  { display: flex; flex-direction: column; min-height: 0; }
html.mx-board-active .view-board-frame   { flex: 1 1 auto; min-height: 0; height: auto; }
/* 排程 view 鎖甘特於視窗高（unify-scroll 2026-07-13，比照看板 flex 釘底）：#content 直排 flex、
   #view-schedule 吃滿剩餘高，甘特內部縱捲、橫向捲軸釘視窗底常駐（甘特內部捲動規則在 _ScheduleView 內嵌樣式，
   同 scope html.mx-schedule-active）。!important 蓋 switchView 設的 inline display:block。 */
html.mx-schedule-active #content            { display: flex; flex-direction: column; min-height: 0; }
html.mx-schedule-active #tickets-panes      { flex: 1 1 auto; min-height: 0; align-items: stretch; }
html.mx-schedule-active .tickets-list-pane  { display: flex; flex-direction: column; min-height: 0; }
html.mx-schedule-active #view-schedule      { display: flex !important; flex-direction: column; flex: 1 1 auto; min-height: 0; }
/* Time Board 橫向捲軸釘第一屏（ui-scroll「容器限高、捲軸本在視窗內」；.tb-wrap 原只設 overflow-x、未限高
   → 全展開時捲軸跟著表格長度被推到頁面最底，要滑到底才摸得到）：#content → .settings-body → .tb-wrap
   一條 flex 直排鏈，表格改在框內雙向捲動、橫向捲軸恆在視窗內（比照上面看板／甘特的 flex 釘底鏈）。
   .tb-wrap 用 flex: 0 1 auto＝「只縮不長」：成員少時維持自然高（不留一大塊空框）、多時縮到剩餘視窗高。
   scope 走 :has(#tb-wrap)＝只此頁（Time Board 為獨立頁、無 view 切換，不必為它加 html class；
   #tb-wrap 僅 Pages/Timeboard/TimeBoard.cshtml 有，且無成員可顯示時走 .empty-box、不套此鏈）。
   表頭黏頂與 hover 卡片翻轉在本頁 @section Styles（同頁專屬版面）。2026-07-28 */
html:has(#tb-wrap) #content       { display: flex; flex-direction: column; min-height: 0; }
html:has(#tb-wrap) .settings-body { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 0; }
html:has(#tb-wrap) .tb-wrap       { flex: 0 1 auto; min-height: 0; overflow: auto; }
html:has(#tb-wrap) .page-toolbar,
html:has(#tb-wrap) .tb-controls,
html:has(#tb-wrap) .tb-legend     { flex: 0 0 auto; }   /* 麵包屑／控制列／圖例不被壓縮，捲軸上下都留在視窗內 */
/* 看板載入/失敗訊息 */
.board-msg { padding: var(--space-10); color: var(--text-tertiary); }

/* 分頁省略符號 */
.pager-ellipsis { padding: 0 var(--space-1); color: var(--text-tertiary); }

/* 橫向捲動容器 */
.scroll-x { overflow-x: auto; }

/* table 內小字 cell（meta 欄位）*/
.td-meta {
  font-size: var(--fs-sm);
  white-space: nowrap;
  text-align: center;
}
.td-meta--primary   { color: var(--text-primary); }
.td-meta--secondary { color: var(--text-secondary); }

/* ── 編輯專案全頁：環境網址 input + 開新分頁 icon ────────── */
.url-input-row { display: flex; align-items: stretch; gap: var(--space-2); }
.url-input-row input { flex: 1; }
.url-open-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; min-height: 38px;
  border: 1px solid var(--border-card);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  text-decoration: none;
  transition: border-color .15s, color .15s, background .15s;
}
.url-open-btn:hover  { border-color: var(--accent-text); color: var(--accent-text); }
.url-open-btn:focus-visible { outline: none; border-color: var(--accent-text); box-shadow: var(--focus-ring); }
.url-open-btn.disabled { opacity: .4; pointer-events: none; }
.url-open-btn svg { width: 18px; height: 18px; }

/* 編輯專案全頁底部動作列 */
.proj-edit-actions {
  display: flex; justify-content: space-between; align-items: center;
  gap: var(--space-3); padding-top: var(--space-2);
}
.proj-edit-actions-right { display: flex; gap: var(--space-2); }

/* asp-validation-for 錯誤訊息（沿用 .hint 字級，但用 danger 色）*/
.hint.err, span.field-validation-error {
  color: var(--danger-text);
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.hint.err:empty { display: none; }

/* ══════════════════════════════════════════════════
   報價單／團隊負載 — 2026-06-05（原「工單管理」；工單退場後由報價單/Time Board 承接）
   含 Time Board 容量格、報價單頁、Add modal 樣式
   ══════════════════════════════════════════════════ */

/* ── 通用補強（全站頁面工具列，命名沿用其他頁慣例）─── */
.page-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4);
}

/* ── 麵包屑（content 頂部頁面路徑，取代大標題）：根層=區塊名、父層 muted 可點、現頁加重 ── */
.bc { display: flex; align-items: center; gap: var(--space-2); font-size: var(--fs-body); flex-wrap: wrap; min-width: 0; }
.bc-link, .bc-seg { color: var(--text-tertiary); text-decoration: none; }
.bc-link:hover { color: var(--text-primary); text-decoration: underline; }
.bc-sep { color: var(--text-tertiary); font-size: var(--fs-sm); }
/* 末節＝現頁標題：加粗放大，取代原 .settings-h1 大標題（頁首 IA v3） */
.bc-cur { color: var(--text-primary); font-weight: var(--fw-medium); font-size: var(--fs-lg); }

/* 頁首第 2 排：操作列（麵包屑下方，收攏搜尋／篩選／視圖切換／＋新增；取代原「標題＋操作」同列）
   —— 搭配 .ml-auto 把主操作（＋新增等）推到最右；無操作的頁面不需此列 */
.page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-4); }

.empty-box {
  border: 1px dashed var(--border-input); border-radius: var(--r-md);
  padding: var(--space-8) var(--space-5); text-align: center; color: var(--text-secondary);
  font-size: var(--fs-body); background: var(--bg-subtle);
}
.empty-box.small { padding: var(--space-4) var(--space-3); font-size: var(--fs-body); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border-card);
  border-radius: var(--r-md); background: var(--bg-card); }
table.data-table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
table.data-table th, table.data-table td {
  padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--border-input);
  text-align: left; color: var(--text-primary); vertical-align: middle;
}
table.data-table th {
  background: var(--bg-section); font-weight: var(--fw-medium);
  color: var(--text-secondary); font-size: var(--fs-sm);
  letter-spacing: .03em; white-space: nowrap;
}
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr:hover { background: var(--bg-hover); }
table.data-table th.num, table.data-table td.num { text-align: center; white-space: nowrap; }

.form-row { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-3); }
.form-row .form-label { font-size: var(--fs-xs); color: var(--text-secondary); font-weight: var(--fw-medium); }
.form-input {
  width: 100%; padding: var(--space-2) var(--space-3); border: 1px solid var(--border-input);
  border-radius: var(--r-sm); background: var(--bg-input); color: var(--text-primary);
  font: inherit; font-size: var(--fs-body);
}
.form-input:focus { outline: none; border-color: var(--accent-text); box-shadow: var(--focus-ring); }

label.fld { display: flex; flex-direction: column; gap: var(--space-1);
  font-size: var(--fs-xs); color: var(--text-secondary); }

/* ── 通用日曆 Date Picker（B-6；JS＝site-daterange.js，2026-07-17 通用化）──
   全站唯一日曆元件（range 雙月選起訖／single 單月選一天），取代原生 <input type=date>＝樣式統一。
   masked 觸發欄 .drp-field（顯示 yyyy/mm/dd 樣板、只打數字自動補分隔）＋ body 掛載彈窗 .drp-pop。
   值真實來源＝隱藏原 input（type=hidden、id/value 不變）→ 呼叫端讀值零改動。全 token 化、dark-aware。
   用在：建立任務／ticket 排程卡／群組期間（range）、里程碑（single）；未來任何日曆一律用此、勿再用原生 date。 */
.drp { display: block; }
.drp-field-wrap { position: relative; display: flex; align-items: center; }
.drp-field { width: 100%; padding-right: 34px; cursor: text; }
.drp-field::placeholder { color: var(--text-tertiary); }
.drp-ico { position: absolute; right: 10px; width: 16px; height: 16px; color: var(--text-tertiary); pointer-events: none; }
.drp-clear {
  position: absolute; right: 30px; width: 18px; height: 18px; line-height: 16px; text-align: center;
  border: none; background: none; color: var(--text-tertiary); font-size: 16px; cursor: pointer; border-radius: var(--r-xs);
}
.drp-clear:hover { color: var(--text-primary); background: var(--bg-muted); }
.drp-pop {
  position: fixed; z-index: 1250; background: var(--bg-elevated);
  border: 1px solid var(--border-card); border-radius: var(--r-md); box-shadow: var(--shadow-sm); padding: var(--space-3);
}
.drp-cals { display: flex; gap: var(--space-4); }
.drp-cal { width: 224px; }
.drp-hd { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-1); padding: 0 2px; }
.drp-ttl { font-size: var(--fs-body); font-weight: var(--fw-medium); color: var(--text-primary); }
.drp-nav, .drp-nav-sp { width: 22px; height: 22px; flex: none; }
.drp-nav {
  display: flex; align-items: center; justify-content: center; border: 1px solid var(--border-input);
  background: var(--bg-control); color: var(--text-secondary); border-radius: var(--r-xs); cursor: pointer; font-size: var(--fs-body);
}
.drp-nav:hover { background: var(--bg-muted); color: var(--text-primary); }
.drp-dow, .drp-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.drp-dow span { text-align: center; font-size: var(--fs-xs); color: var(--text-tertiary); padding: 3px 0; }
.drp-d {
  height: 28px; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-sm); color: var(--text-primary); border-radius: var(--r-sm); cursor: pointer; user-select: none;
}
.drp-d.mut { color: var(--text-tertiary); opacity: .5; cursor: default; }
.drp-d.we { color: var(--text-tertiary); }
.drp-d:hover:not(.mut):not(.ep) { background: var(--bg-hover); }
.drp-d.hv, .drp-d.in { background: var(--accent-soft); border-radius: 0; }
.drp-d.ep { background: var(--accent); color: var(--text-on-accent); font-weight: var(--fw-bold); border-radius: var(--r-sm); }
.drp-d.today:not(.ep) { box-shadow: inset 0 0 0 1px var(--accent-text); }
.drp-ft { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px solid var(--divider); }
.drp-legend { font-size: var(--fs-xs); color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; }
.drp-lg-ep, .drp-lg-in, .drp-lg-today { width: 10px; height: 10px; border-radius: 3px; display: inline-block; vertical-align: -1px; }
.drp-lg-ep { background: var(--accent); }
.drp-lg-in { background: var(--accent-soft); }
.drp-lg-today { box-shadow: inset 0 0 0 1px var(--accent-text); }
.drp-ft-clear { border: none; background: none; color: var(--accent-text); font-size: var(--fs-sm); cursor: pointer; }
.drp-ft-clear:hover { text-decoration: underline; }

.spacer { flex: 1; }

/* ── 報價單 detail「加報價項目」modal 內任務清單 ── */
.wo-issues-list {
  max-height: 320px; overflow-y: auto; border: 1px solid var(--border-input);
  border-radius: var(--r-sm); background: var(--bg-input);
}
.wo-issue-row {
  display: grid; grid-template-columns: 24px auto minmax(0, 1fr) auto;
  align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-input); cursor: pointer;
  font-size: var(--fs-body); color: var(--text-primary);
}
.wo-issue-row:last-child { border-bottom: none; }
.wo-issue-row:hover { background: var(--bg-hover); }
.wo-issue-row .num { font-variant-numeric: tabular-nums; color: var(--text-secondary); white-space: nowrap; }
.wo-issue-row .wo-issue-desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── 報價單 Detail：邀請估時成員列 ── */
.member-row {
  display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-input); border-radius: var(--r-sm);
  font-size: var(--fs-body); color: var(--text-primary); background: var(--bg-card);
  cursor: pointer;
}
.member-row:hover { background: var(--bg-hover); }
.member-row input[type=checkbox] { accent-color: var(--accent); }

/* ── Detail 頁籤（我的工時等）── */
.detail-tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border-card);
  margin-bottom: var(--space-4);
}
.detail-tab-btn {
  padding: var(--space-2) var(--space-4);
  font-size: var(--fs-body); font-weight: var(--fw-medium);
  color: var(--text-tertiary);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer; margin-bottom: -1px;
  transition: color .15s, border-color .15s;
}
.detail-tab-btn:hover { color: var(--text-primary); }
.detail-tab-btn.active { color: var(--accent-text); border-bottom-color: var(--accent-text); }
/* anchor 變體：專案 detail view tab（_ProjectViewTabs partial）用 <a> 走路由，同一視覺 */
a.detail-tab-btn { text-decoration: none; display: inline-block; }
.detail-tab-pane { display: none; }
.detail-tab-pane.active { display: block; }

.wo-detail .section-block { background: var(--bg-card);
  border: 1px solid var(--border-card); border-radius: var(--r-md);
  padding: var(--space-4) var(--space-5); margin-bottom: var(--space-4); }

/* ══════════════════════════════════════════════════
   Time Board — TeamGantt 式容量格
   ══════════════════════════════════════════════════ */
.tb-wrap { overflow-x: auto; border: 1px solid var(--border-card);
  border-radius: var(--r-md); background: var(--bg-card); }
table.tb {
  border-collapse: collapse; font-size: var(--fs-sm);
  min-width: 880px; width: 100%; table-layout: fixed;
}
table.tb th, table.tb td {
  border: 1px solid var(--border-input); padding: 0;
}
table.tb th {
  background: var(--bg-section); color: var(--text-secondary);
  font-weight: var(--fw-medium); padding: var(--space-1) var(--space-1); text-align: center;
  white-space: nowrap; font-size: var(--fs-sm);
}
table.tb th.tb-namecol, table.tb td.tb-member {
  width: 96px; text-align: center; padding: var(--space-1) var(--space-2);
}
table.tb td.tb-member { background: var(--bg-subtle); font-weight: var(--fw-medium); color: var(--text-primary); }

.tb-day { height: 50px; vertical-align: bottom; padding: var(--space-1); position: relative; cursor: pointer; }
.tb-day.weekend, .tb th.weekend {
  background-color: var(--bg-subtle);
  background-image: repeating-linear-gradient(45deg,
    transparent, transparent 4px,
    rgba(0,0,0,.06) 4px, rgba(0,0,0,.06) 8px);
}
[data-theme="dark"] .tb-day.weekend,
[data-theme="dark"] .tb th.weekend {
  background-image: repeating-linear-gradient(45deg,
    transparent, transparent 4px,
    rgba(255,255,255,.06) 4px, rgba(255,255,255,.06) 8px);
}
.tb-track {
  position: relative; height: 42px; background: var(--bg-input);
  border-radius: var(--r-xs); overflow: hidden;
}
/* 夜間：空格 track 改與卡片同色（原 --bg-input 近黑 #101018 比卡片深太多，每格像內凹陰影盒）。
   有負載時 .tb-seg 疊在上面照常著色，故只影響「空格」視覺、不影響負載顯示。 */
[data-theme="dark"] .tb-track { background: var(--bg-card); }
.tb-seg { position: absolute; left: 0; right: 0; }
/* decouple 單元4：負載改「期程佔用件數」，中性灰條、高度＝件數比例，暫不分級著色（門檻待累積產能數據）*/
.tb-seg--flat { background: var(--ink-muted); opacity: .28; }

.tb-pct {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--fs-xs); font-weight: 700; color: var(--text-primary);
  background: var(--bg-load-chip); border-radius: var(--r-xs);
  padding: 0 var(--space-1); white-space: nowrap; pointer-events: none;
}
/* dark 底色不另 override：--bg-load-chip 已日夜自適應（配 --text-primary）*/
/* 件數顯示：格內數字補「件」字尾（decouple 單元4；沿用 .tb-pct chip 底）*/
.tb-pct.cnt::after { content: " 件"; font-size: 9px; opacity: .7; }

/* tooltip — hover（桌機）/ .open（行動點擊）
   2026-06-24：視覺一般化為共用 `.hover-pop`（墨藍底白字＋上箭頭），`.tb-tip*` 設為 alias（Time Board 不動）。
   其他頁要 hover 明細小卡：外層加 `.hover-pop-host`(position:relative)、內放 `.hover-pop`。 */
.hover-pop, .tb-tip {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(100% + 8px); z-index: 30;
  background: var(--bg-tooltip); color: #fff; font-size: var(--fs-xs); line-height: 1.6;
  padding: var(--space-2) var(--space-3); border-radius: var(--r-sm);
  white-space: nowrap; display: none; box-shadow: var(--shadow-lg);
}
.hover-pop::after, .tb-tip::after {
  content: ""; position: absolute; bottom: 100%; left: 50%;
  transform: translateX(-50%); border: 6px solid transparent;
  border-bottom-color: var(--bg-tooltip);
}
/* Time Board tb-tip 預設「左錨定」（從格子左緣往右展開）：覆蓋共用 .hover-pop 的置中（left:50%/translateX）。
   置中展開會讓卡片左半伸到凍結的「成員姓名」欄底下被蓋住／被切（尤其滑到第一天）；左錨定後永遠在格子右側、
   不被姓名欄蓋、且浮在表格之上。右緣格子放不下 → JS 加 .tb-tip--flip-r 改往左展開（定義在本規則之後＝套用時勝出）。
   只覆蓋 .tb-tip，不動共用 .hover-pop（Admin 綁定專案小卡定位不變）。2026-07-22。*/
.tb-tip { left: 0; transform: none; }
.tb-tip::after { left: 16px; transform: none; }
.tb-tip--flip-r { left: auto; right: 0; transform: none; }
.tb-tip--flip-r::after { left: auto; right: 16px; transform: none; }
.hover-pop-title, .tb-tip-title { color: rgba(255,255,255,.7); font-size: 10px; margin-bottom: var(--space-1); }
.hover-pop-row, .tb-tip-row { display: flex; align-items: center; gap: var(--space-1); }
/* 2026-06-23：tooltip 小點去色 → 中性小圓點 */
.tb-tip-row .tb-tip-dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 auto; display: inline-block; background: rgba(255,255,255,.45); }
.tb-tip-row b { margin-left: auto; padding-left: var(--space-3); }
.tb-tip-sum { border-top: 1px solid rgba(255,255,255,.18);
  margin-top: var(--space-1); padding-top: var(--space-1); }
/* Time Board hover 卡片限寬：長任務名不撐爆卡片，超出以省略號收尾（2026-07-22 問題2-1；只收 .tb-tip，
   共用 .hover-pop 的 Admin 綁定專案小卡內容較短、未反映過寬，不動）。sum 列（合計）短字不套省略。*/
.tb-tip { max-width: 240px; }
/* 任務名過長 → 省略號。用 flex-shrink（不加 flex-grow）＋min-width:0 讓長名縮到可用寬即截斷；
   text-align:left 壓過格子 .tb-day/.tb-week 的 text-align:center（否則短名會置中、截斷會兩端切）。*/
.tb-tip-row:not(.tb-tip-sum) > span:not(.tb-tip-dot) {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; text-align: left;
}

/* 共用 hover host：滑過 / 鍵盤 focus 顯示內含的 .hover-pop（桌機 hover；觸控用 tabindex+focus-within 接力） */
.hover-pop-host { position: relative; }
.hover-pop-host:hover .hover-pop, .hover-pop-host:focus-visible .hover-pop, .hover-pop-host:focus-within .hover-pop { display: block; }
.hover-pop-host:focus-visible { outline: none; }

.tb-day:hover .tb-tip, .tb-day.open .tb-tip { display: block; }
@media (hover: none) {
  .tb-day:hover .tb-tip { display: none; }   /* 觸控裝置只用 .open 控制 */
}

.tb-legend {
  display: flex; gap: var(--space-4); flex-wrap: wrap;
  font-size: var(--fs-xs); color: var(--text-secondary);
  margin-top: var(--space-3);
}
.tb-legend .tb-sw {
  display: inline-block; width: 14px; height: 14px;
  border-radius: var(--r-xs); margin-right: var(--space-1); vertical-align: -2px;
}

/* ═══ 首頁滿版月曆（add-home-calendar；Pages/Index.cshtml ＋ js/pages/home-calendar.js）═══ */
/* 單卡、唯讀。橫條＝狀態族色 soft 底＋族色左條（對齊 Badge 族色，零新色票）。 */
.hc-card { position: relative; margin-bottom: var(--space-4); }
.hc-nav { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-3); }
.hc-nav-title { font-size: var(--fs-lg); font-weight: var(--fw-heading); color: var(--text-primary); min-width: 110px; text-align: center; }
.hc-nav-btn {
  border: 1px solid var(--border-card); background: var(--bg-card); color: var(--text-secondary);
  border-radius: var(--r-sm); padding: var(--space-0_5) var(--space-2); cursor: pointer; font-size: var(--fs-sm);
}
.hc-nav-btn:hover { border-color: var(--border-hover); color: var(--text-primary); }

.hc-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: var(--fs-sm); color: var(--text-tertiary); padding-bottom: var(--space-1); }
.hc-week { position: relative; border-top: 1px solid var(--border-card); }
.hc-days { display: grid; grid-template-columns: repeat(7, 1fr); min-height: 118px; }
.hc-day { border-left: 1px solid var(--border-card); padding: var(--space-1); display: flex; flex-direction: column; }
.hc-day:first-child { border-left: 0; }
.hc-day.hc-holiday { background: var(--bg-hover); }   /* 僅假日灰底；週末白底（規格）*/
.hc-day.hc-out .hc-date-num { color: var(--text-tertiary); }
.hc-date { display: flex; align-items: center; gap: var(--space-1); font-size: var(--fs-sm); color: var(--text-secondary); }
.hc-date-num { width: 22px; height: 22px; line-height: 22px; text-align: center; border-radius: 50%; }
.hc-date-num.hc-today { background: var(--accent); color: #fff; font-weight: var(--fw-medium); }   /* 今天＝主色圓底（同 btn-primary 實心白字）*/
.hc-makeup { font-size: var(--fs-xs); color: var(--text-tertiary); border: 1px solid var(--border-card);
  border-radius: var(--r-xs); padding: 0 3px; line-height: 1.4; }   /* 補班小標記 */
.hc-holiday-name { font-size: var(--fs-xs); color: var(--text-tertiary); overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis; }

.hc-lanes { position: absolute; left: 0; right: 0; top: 30px; bottom: 24px; pointer-events: none; }
.hc-bar {
  position: absolute; height: 20px; line-height: 20px; pointer-events: auto;
  border: 0; border-radius: var(--r-xs); padding: 0 var(--space-1);
  font-size: var(--fs-xs); color: var(--text-primary); text-align: left; cursor: pointer;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.hc-bar:hover { filter: brightness(.96); }
.hc-cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; }     /* 跨週續條：斷邊收直角 */
.hc-cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; }
/* 狀態族色（同 .status-* 族色：待分配 accent／處理中 warn／複測中 info／完成 success／不處理中性）*/
.hc-st-todo   { background: var(--accent-soft);  box-shadow: inset 3px 0 0 var(--accent); }
.hc-st-doing  { background: var(--warn-soft);    box-shadow: inset 3px 0 0 var(--warn); }
.hc-st-review { background: var(--info-soft);    box-shadow: inset 3px 0 0 var(--info); }
.hc-st-done   { background: var(--success-soft); box-shadow: inset 3px 0 0 var(--success); color: var(--text-tertiary); }
.hc-st-other  { background: var(--bg-hover);     box-shadow: inset 3px 0 0 var(--neutral-dot); color: var(--text-tertiary); }

.hc-more {
  margin-top: auto; align-self: flex-start; border: 0; background: none; cursor: pointer;
  font-size: var(--fs-xs); color: var(--text-secondary); padding: 0 var(--space-1);
}
.hc-more:hover { color: var(--text-primary); }

.hc-pop {
  position: absolute; z-index: 30; width: 260px; max-height: 300px; overflow-y: auto;
  background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: var(--space-2);
}
.hc-pop-title { font-size: var(--fs-sm); font-weight: var(--fw-heading); color: var(--text-primary); margin-bottom: var(--space-1); }
.hc-pop-item { display: flex; align-items: center; gap: var(--space-2); width: 100%; border: 0; background: none;
  cursor: pointer; text-align: left; padding: var(--space-1); border-radius: var(--r-xs);
  font-size: var(--fs-sm); color: var(--text-primary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hc-pop-item:hover { background: var(--bg-hover); }
.hc-pop-dot { flex: 0 0 8px; width: 8px; height: 8px; border-radius: 50%; box-shadow: none; background: var(--neutral-dot); }
.hc-pop-dot.hc-st-todo { background: var(--accent); } .hc-pop-dot.hc-st-doing { background: var(--warn); }
.hc-pop-dot.hc-st-review { background: var(--info); } .hc-pop-dot.hc-st-done { background: var(--success); }

/* 逾期／未排期展開列 */
.hc-list-card { margin-bottom: var(--space-4); }
.hc-list-head {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; border: 0; background: none; cursor: pointer;
  padding: var(--space-2) var(--space-3); font-size: var(--fs-body); font-weight: var(--fw-heading); color: var(--text-primary);
  border-top: 1px solid var(--border-card); text-align: left;
}
.hc-list-head:first-child { border-top: 0; }
.hc-list-caret { color: var(--text-tertiary); width: 14px; }
.hc-list-count { font-size: var(--fs-sm); color: var(--text-tertiary); font-weight: 400; }
.hc-list-body { padding: 0 var(--space-3) var(--space-2); }
.hc-list-empty { font-size: var(--fs-sm); color: var(--text-tertiary); padding: var(--space-1) 0; }
.hc-list-row {
  display: flex; align-items: center; gap: var(--space-2); width: 100%; border: 0; background: none; cursor: pointer;
  padding: var(--space-1) var(--space-1); border-radius: var(--r-xs); font-size: var(--fs-body); text-align: left;
}
.hc-list-row:hover { background: var(--bg-hover); }
.hc-list-name { color: var(--text-primary); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hc-list-proj { font-size: var(--fs-sm); color: var(--text-tertiary); flex: 0 0 auto; }
.hc-list-due { margin-left: auto; flex: 0 0 auto; font-size: var(--fs-sm); color: var(--text-secondary); }
.hc-overdue-days { color: var(--danger-text); }
