/* CT 跟進後台：毛玻璃＋深海（老闆定案）
 * 骨架參考：Apple macOS Big Sur（WWDC 2020）Control Center／通知中心。
 *   只借骨架：光暈桌布上放半透明模糊面板、1px 細邊、大圓角、柔和陰影；動態只有「淡入＋上滑」。
 * 色彩骨架：James McNeill Whistler《藍與金的夜曲：老巴特西橋》（1872–75，倫敦 Tate Britain）。
 *   深海軍藍／墨綠底、青色與琥珀微光；琥珀＝主色，青＝「已複製待確認」。
 * 主角＝草稿卡（玻璃面板），母題＝浮在光暈上的圓角玻璃。光暈固定在最底層，不放字。
 * 對比以「玻璃疊在最亮／最暗光暈上」實算，全部過 WCAG AA。
 * 第 8 批：客戶時間軸借 Massimo Vignelli 紐約地鐵路線圖（1972）的骨架——一條直線、每件事一個「站」，
 *   站的形狀分類型（空心圓＝新消息、方框＝草稿、實心琥珀＝發送、菱形＝回覆、雙圈＝階段），旁邊再寫字，不只靠顏色。
 *   週報橫條借 Edward Tufte《The Visual Display of Quantitative Information》（1983）的少墨原則：
 *   沒有格線與座標軸、數字直接寫在條旁；寄出＝琥珀外框、回覆＝琥珀實心（同一色，用填滿與否區分）。不加新顏色。
 * 第 9 批：購買意願量表借 Otto Neurath & Gerd Arntz 的 Isotype（1920–30 年代維也納）——「數量＝重複的同一個記號」：
 *   三格長條，填滿幾格＝幾級（高 3／中 2／低 1／不明＝虛線空格），旁邊一定寫字。每月則數用 Tufte《Beautiful Evidence》（2006）
 *   的 sparkline：無座標軸、線尾直接寫數字；對方＝琥珀實線＋實心點、我＝淺色虛線＋空心點。筆記站沿用 Vignelli 路線圖：
 *   長條＝筆記（空心＝手動記一筆、實心＝對話摘要）。母題仍是「外框 vs 實心」，一個琥珀色，不加新顏色。 */

:root {
  color-scheme: dark;
  --bg: #06121d; --bg-1: #0a1c2b; --bg-2: #04101a;
  --glow-1: #0f6a74; --glow-2: #0d3b34; --glow-3: #7a5414; --glow-4: #0b4a52;
  --glass: rgba(8, 20, 32, .72); --glass-strong: rgba(8, 20, 32, .86); --glass-edge: rgba(255, 255, 255, .12);
  --shadow-c: rgba(0, 0, 0, .45);
  --ink: #e6eef4; --muted: #a8bccb; --paper: #0b1926;
  --line: rgba(230, 238, 244, .12); --line-strong: rgba(230, 238, 244, .28);
  --hover: rgba(255, 255, 255, .08); --btn-bg: rgba(255, 255, 255, .06); --btn-line: rgba(230, 238, 244, .24);
  --readonly-bg: rgba(255, 255, 255, .04);
  --accent: #f2b440; --accent-hover: #f7c766; --on-accent: #1a1204; --accent-text: #f5c25a;
  --accent-soft: rgba(242, 180, 64, .14); --accent-glow: rgba(242, 180, 64, .22);
  --focus: #e6eef4;
  --st-pending-bg: rgba(230, 238, 244, .1); --st-pending-fg: #e6eef4;
  --st-copied-bg: #67d8e6; --st-copied-fg: #04161c; --st-copied-line: #2bb3c4;
  --st-sent-bg: #f2b440; --st-sent-fg: #1a1204;
  --st-skipped-fg: #a8bccb; --st-skipped-line: rgba(230, 238, 244, .5);
  --st-token-bg: #c9b8fb; --st-token-fg: #1d0d45;
  --st-replied-bg: #e6eef4; --st-replied-fg: #0b1926;
  --warn-bg: #f2b440; --warn-fg: #1a1204; --warn-soft-bg: rgba(242, 180, 64, .18);
  --err: #ff9a9a; --err-soft: rgba(248, 113, 113, .2);
  --toast-bg: rgba(230, 238, 244, .96); --toast-fg: #0b1926; --toast-err-bg: rgba(254, 202, 202, .97);

  --blur: blur(22px) saturate(170%);
  --radius: 24px;
  --radius-s: 14px;
  --shadow: 0 10px 40px var(--shadow-c);
  --rise: rise .42s cubic-bezier(.2, .8, .2, 1) both;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", Arial, sans-serif;
  --gut: 16px;
  --max: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--font); min-height: 100vh; min-height: 100dvh; }
/* 桌布：四團光暈（固定在畫面後方，捲動時不重畫） */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(55vmax 55vmax at 0% 0%, var(--glow-1) 0, transparent 60%),
    radial-gradient(50vmax 50vmax at 100% 5%, var(--glow-2) 0, transparent 58%),
    radial-gradient(60vmax 60vmax at 85% 100%, var(--glow-3) 0, transparent 60%),
    radial-gradient(55vmax 55vmax at 5% 95%, var(--glow-4) 0, transparent 62%),
    linear-gradient(135deg, var(--bg-1), var(--bg-2));
}
a { color: inherit; text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
::placeholder { color: var(--muted); opacity: 1; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 0; z-index: 100; padding: 8px 12px; background: var(--paper); color: var(--ink); border-radius: var(--radius-s); }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- 共用玻璃面板 ---- */
.topbar, .demo, .filter, .filter-note, .tray, .draft, #draft-list > .empty, .toolbar, .preview-box, .table-wrap,
.gmail, .spend, .run, .login, .notice, .kbd-help, .selbar, .tl-card, .tl, .weekbar, .rp-kpis, .rp-sec, .rp-empty, .tl-empty, .tl-err, .rp-err, .imp, .tl-compose {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
}
/* 不支援模糊的瀏覽器：玻璃改成幾乎不透明，字一樣清楚 */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --glass: var(--glass-strong); }
}

/* ---- 頁首：浮起的玻璃條 ---- */
.topbar { position: sticky; top: 0; z-index: 20; border-width: 0 0 1px; box-shadow: 0 4px 24px var(--shadow-c); }
.topbar-in { max-width: var(--max); margin: 0 auto; padding: 0 var(--gut); display: flex; align-items: stretch; gap: 24px; min-height: 56px; }
.brand { font-weight: 700; font-size: 20px; letter-spacing: -0.01em; align-self: center; white-space: nowrap; }
.tabs { display: flex; gap: 6px; align-items: center; flex: 1; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  display: flex; align-items: center; gap: 6px; padding: 0 14px; min-height: 44px; border-radius: 999px;
  text-decoration: none; color: var(--muted); white-space: nowrap; font-weight: 600;
}
.tabs a:hover { background: var(--hover); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--accent); color: var(--on-accent); }
.count:empty { display: none; }
.count { background: var(--ink); color: var(--paper); border-radius: 999px; font-size: 13px; font-weight: 700; line-height: 1; padding: 4px 7px; min-width: 24px; text-align: center; }
.tabs a[aria-current="page"] .count { background: var(--on-accent); color: var(--accent); }
.signout { background: none; border: 0; border-radius: 999px; color: var(--muted); cursor: pointer; padding: 0 12px; min-height: 44px; align-self: center; }
.signout:hover { color: var(--ink); background: var(--hover); }

.demo { margin: 0; padding: 8px var(--gut); font-size: 14px; font-weight: 600; border-width: 0 0 1px; box-shadow: none; }

main { max-width: var(--max); margin: 0 auto; padding: 28px var(--gut) 96px; }

/* ---- 按鈕、欄位 ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 20px;
  border: 1px solid var(--btn-line); background: var(--btn-bg); color: var(--ink); border-radius: var(--radius-s);
  cursor: pointer; font-weight: 600; touch-action: manipulation; text-decoration: none; transition: background-color .15s, box-shadow .15s;
}
.btn:hover { background: var(--glass-strong); }
.btn:active { background: var(--glass-strong); box-shadow: inset 0 0 0 2px var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:active { background: var(--accent-hover); box-shadow: none; }
.btn-quiet { background: none; border-color: transparent; box-shadow: none; color: var(--muted); font-weight: 400; }
.btn-quiet:hover { background: var(--hover); color: var(--ink); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.actions.opened [data-act="sent"] { background: var(--st-copied-bg); border-color: var(--st-copied-line); color: var(--st-copied-fg); box-shadow: 0 0 0 3px var(--st-copied-line); }

.field { display: block; }
.field > span { display: flex; gap: 12px; align-items: baseline; font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.field input, .field textarea, .field-inline input { width: 100%; padding: 10px 12px; min-height: 48px; }
.field input, .field textarea, .field-inline input, .field-inline select, .table select { background: var(--glass-strong); color: var(--ink); border: 1px solid var(--btn-line); border-radius: 12px; }
.field textarea { line-height: 1.6; resize: vertical; }
.field input:focus, .field textarea:focus { border-color: var(--accent); outline: 3px solid var(--accent-glow); outline-offset: 0; }
.save-state { font-style: normal; font-weight: 400; }

.hint, .empty, .src, .who, .none, .save-state, .service span, .tray-item span, .run-meta, .spend-label,
.spend-stats dt, .spend-models caption, .c-name small, .row-off td { color: var(--muted); }
.empty { padding: 24px 0; }
.err, .run-failed .run-status { color: var(--err); }
.hint { font-size: 14px; margin: 0; }
.flag { display: inline-block; background: var(--warn-bg); color: var(--warn-fg); border-radius: 999px; padding: 1px 8px; font-size: 13px; margin-left: 6px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 20px; border-radius: var(--radius); padding: 12px 16px; }
.check { display: inline-flex; gap: 8px; align-items: center; min-height: 44px; cursor: pointer; }
.check input, .switch input, .pick input { width: 20px; height: 20px; accent-color: var(--accent); }
.field-inline { display: flex; align-items: center; gap: 8px; }
.field-inline > span { font-weight: 700; font-size: 14px; }
.field-inline input { width: 220px; }
.upload { cursor: pointer; }

/* ---- 狀態篩選：玻璃分段控制 ---- */
.filter { display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; margin-bottom: 20px; max-width: 100%; border-radius: 999px; }
.filter-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  background: none; border: 0; border-radius: 999px; color: var(--muted); cursor: pointer; font-weight: 600; touch-action: manipulation; white-space: nowrap;
}
.filter-btn:hover { background: var(--hover); color: var(--ink); }
.filter-btn[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 14px var(--accent-glow); }
.filter-btn .n { font-weight: 700; font-variant-numeric: tabular-nums; }
.filter-note { display: inline-block; border-radius: 999px; padding: 6px 14px; margin: 0 0 16px 8px; box-shadow: none; }

/* ---- 已複製，待確認發送（集中區） ---- */
.tray { border-radius: var(--radius); box-shadow: var(--shadow), inset 4px 0 0 var(--st-copied-line); padding: 16px 20px; margin-bottom: 24px; display: grid; gap: 10px; }
.tray-head { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.tray-title { margin: 0; font-size: 18px; }
.tray-title b { background: var(--st-copied-bg); color: var(--st-copied-fg); border-radius: 999px; padding: 0 10px; }
.tray-list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tray-item {
  min-height: 44px; padding: 0 14px; background: var(--glass-strong); color: var(--ink); border: 1px solid var(--btn-line); border-radius: 999px;
  cursor: pointer; display: inline-flex; gap: 8px; align-items: center; max-width: 100%; overflow-wrap: anywhere; text-align: left;
}
.tray-item span { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tray-item:hover { background: var(--paper); }
.tray-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tray-confirm { font-weight: 700; }

/* ---- 草稿卡：玻璃面板（主角） ---- */
.draft { margin-bottom: 20px; border-radius: var(--radius); overflow: hidden; scroll-margin-top: 72px; }
.draft:focus { outline: none; }
.draft-copied { box-shadow: var(--shadow), 0 0 0 3px var(--st-copied-line); }
.kbd .draft.is-active { box-shadow: var(--shadow), 0 0 0 3px var(--focus); }
.draft.leaving { pointer-events: none; }
.band { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 18px 20px 6px; }
.band h2 { margin: 0; font-size: 22px; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.who { font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.chip { border-radius: 999px; background: var(--st-pending-bg); color: var(--ink); padding: 3px 10px; font-size: 13px; line-height: 1.4; white-space: nowrap; max-width: 100%; overflow-wrap: anywhere; }
.chip-cold { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.chip-warn { background: var(--st-token-bg); color: var(--st-token-fg); font-weight: 700; }

/* 狀態標記：待審＝中性、已複製待確認＝青、已發送＝實心琥珀、已略過＝虛線淡 */
.state, .tag { display: inline-block; font-size: 13px; font-weight: 700; line-height: 1.4; padding: 3px 10px; border: 1px solid transparent; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.state-pending { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.state-copied { background: var(--st-copied-bg); border-color: var(--st-copied-line); color: var(--st-copied-fg); }
.state-sent { background: var(--st-sent-bg); color: var(--st-sent-fg); }
.state-skipped { border: 1px dashed var(--st-skipped-line); color: var(--st-skipped-fg); }
.tag-auto { background: var(--accent-soft); color: var(--accent-text); }
.tag-replied { background: var(--st-replied-bg); color: var(--st-replied-fg); }

.draft-body { display: grid; grid-template-columns: minmax(0, 1fr); }
.news { padding: 12px 20px 16px; border-bottom: 1px solid var(--line); }
.summary { margin: 0 0 12px; font-size: 17px; font-weight: 700; line-height: 1.5; }
.sources { list-style: none; margin: 0 0 12px; padding: 0; font-size: 14px; }
.sources li { padding: 6px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.sources a { display: block; }
.src { font-size: 13px; }
.service { margin: 0; font-size: 15px; }
.service span { display: block; font-size: 13px; }
.compose { padding: 16px 20px 20px; display: grid; gap: 14px; }
.draft textarea[readonly], .draft input[readonly] { background: var(--readonly-bg); border-color: var(--line); }

.actions { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; gap: 8px; }
.actions .btn { min-width: 0; }

/* Email 建議主旨（點一下套用） */
.subj-opts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.subj-label { font-size: 14px; font-weight: 700; width: 100%; }
.subj-opt {
  min-height: 44px; padding: 6px 14px; background: var(--glass-strong); color: var(--ink); border: 1px solid var(--btn-line); border-radius: 999px;
  cursor: pointer; text-align: left; line-height: 1.35; max-width: 100%; overflow-wrap: anywhere; touch-action: manipulation;
}
.subj-opt:hover { background: var(--paper); }
.subj-opt[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.subj-opt[aria-pressed="true"]::before { content: "✓ "; }

/* ---- 客戶名單、匯入 ---- */
.table-wrap { overflow-x: auto; border-radius: var(--radius); padding: 4px 8px; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 13px; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line-strong); }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.c-name small { display: block; font-size: 13px; }
.row-missing td { background: var(--warn-soft-bg); }
.row-error td { background: var(--err-soft); }
.table select, .field-inline select { min-height: 44px; padding: 0 8px; }
.switch { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; cursor: pointer; }
.c-last { white-space: nowrap; font-variant-numeric: tabular-nums; }
.c-last small { display: block; font-size: 13px; }
.c-pending { font-variant-numeric: tabular-nums; }
.pending-n { font-weight: 700; color: var(--accent-text); }
.replied { font-weight: 700; }
.c-pick { width: 52px; }
.pick { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.row-picked td { background: var(--accent-soft); }

.preview-box { padding: 16px; margin-bottom: 32px; border-radius: var(--radius); }
.preview-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 12px; }
.preview-head p { margin: 0; }
.preview-head .actions { display: flex; }

/* 已勾選的客戶：底部固定列（只在「客戶名單」分頁） */
.selbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; background: var(--glass-strong);
  border-width: 1px 0 0; box-shadow: 0 -6px 24px var(--shadow-c);
  padding: 12px var(--gut) calc(12px + env(safe-area-inset-bottom));
}
.selbar-in { max-width: var(--max); margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.selbar-n { margin: 0 auto 0 0; font-weight: 700; font-variant-numeric: tabular-nums; }
body:has(#view-clients:not([hidden]) .selbar:not([hidden])) main { padding-bottom: calc(160px + env(safe-area-inset-bottom)); }
body:has(#view-clients:not([hidden]) .selbar:not([hidden])) .kbd-btn { bottom: 96px; }
body:has(#view-clients:not([hidden]) .selbar:not([hidden])) .kbd-help { bottom: 152px; }
body:has(#view-clients:not([hidden]) .selbar:not([hidden])) .toast { bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---- 執行紀錄、Gmail、花費 ---- */
.runs { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.run { border-radius: 18px; padding: 14px 18px; }
.run-top { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; }
.run-top strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.run-status { font-weight: 700; }
.run-running .run-status { background: var(--warn-bg); color: var(--warn-fg); border-radius: 999px; padding: 0 10px; }
.run-pick { font-weight: 700; color: var(--accent-text); }
.run-drafts { margin-left: auto; }
.bar { height: 8px; background: var(--st-pending-bg); border-radius: 999px; margin: 10px 0 6px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .4s ease-out; }
.run-meta { margin: 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 16px; }

.gmail, .spend { margin-bottom: 32px; border-radius: var(--radius); overflow: hidden; }
.gmail .band, .spend .band { padding: 16px 20px 0; }
.gmail .band h2, .spend .band h2 { font-size: 20px; }
.gmail-body, .spend-body { padding: 12px 20px 20px; display: grid; }
.gmail-body { gap: 10px; }
.gmail-body p { margin: 0; }
.gmail-line { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; overflow-wrap: anywhere; }
.gmail-on .band .who { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 1px 10px; font-weight: 700; font-size: 13px; }

.spend-body { gap: 16px; }
.spend-total { display: flex; flex-direction: column; align-items: flex-start; }
.spend-num { font-size: 44px; font-weight: 700; line-height: 1.05; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.spend-alert .spend-num { background: var(--warn-bg); color: var(--warn-fg); border-radius: 12px; padding: 0 8px; margin-left: -8px; }
.spend-label { font-size: 14px; margin-top: 4px; }
.spend-stats { display: flex; flex-wrap: wrap; gap: 8px 32px; margin: 0; }
.spend-stats dt { font-size: 13px; }
.spend-stats dd { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.spend-models { border-collapse: collapse; font-size: 15px; width: 100%; max-width: 420px; font-variant-numeric: tabular-nums; }
.spend-models caption { text-align: left; font-size: 13px; font-weight: 700; padding-bottom: 4px; }
.spend-models th, .spend-models td { text-align: left; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--line); }
.spend-models thead th { font-size: 13px; color: var(--muted); border-bottom-color: var(--line-strong); }
.spend-models tbody th { font-weight: 400; }
.spend-models td:last-child, .spend-models th:last-child { text-align: right; padding-right: 0; }
.spend-warn { margin: 0; padding: 8px 12px; background: var(--warn-soft-bg); border-radius: 12px; font-weight: 700; }
.spend-note { font-size: 13px; }

/* Telegram 推播（沿用 Gmail 區塊的面板） */
.tg-steps { margin: 0; padding-left: 1.4em; display: grid; gap: 6px; }
.tg-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.tg-msg { font-weight: 700; overflow-wrap: anywhere; }
.tg-msg:empty { display: none; }

/* ---- 第二次跟進、上一則、對方已回覆 ---- */
.tag-follow { border-color: var(--line-strong); color: var(--ink); }
.prev { margin-top: 12px; border-top: 1px solid var(--line); }
.prev summary { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; min-height: 44px; cursor: pointer; font-weight: 700; font-size: 15px; }
.prev summary .src { font-weight: 400; font-variant-numeric: tabular-nums; }
.prev-subj { margin: 0 0 6px; font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.prev-msg { margin: 0; padding: 10px 12px; background: var(--readonly-bg); border: 1px solid var(--line); border-radius: 12px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; }
.prev-none { margin-top: 8px; }
.actions-sent { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }

/* 客戶名稱＝連到時間軸 */
.client-link {
  background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-align: left; cursor: pointer;
  min-height: 44px; display: inline-flex; align-items: center; overflow-wrap: anywhere; max-width: 100%;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; touch-action: manipulation;
}
.client-link:hover { text-decoration-color: var(--accent); }
.c-stage { white-space: nowrap; }

/* ---- 客戶時間軸（一條線＋站） ---- */
.tl-back { margin: 0 0 12px -8px; padding: 0 12px; }
.tl-card { border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.tl-card h1 { margin: 0; font-size: 28px; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.tl-card h1:focus { outline: none; }
.tl-card h1 small { display: block; font-size: 15px; font-weight: 400; color: var(--muted); }
.tl-card .who { margin: 4px 0 12px; }
.tl-facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 24px; }
.tl-facts dt { font-size: 13px; color: var(--muted); }
.tl-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; min-width: 0; }
.tl-facts dd small { display: block; font-weight: 400; }
.tl-contact { grid-column: 1 / -1; }
.tl-stage { min-height: 44px; padding: 0 8px; background: var(--glass-strong); color: var(--ink); border: 1px solid var(--btn-line); border-radius: 12px; }

.tl { list-style: none; margin: 0; padding: 12px 16px 12px 20px; border-radius: var(--radius); position: relative; }
.tl::before { content: ""; position: absolute; left: 31px; top: 28px; bottom: 28px; width: 2px; background: var(--line-strong); }
.tl-item { position: relative; padding: 10px 0 12px 32px; border-bottom: 1px solid var(--line); min-width: 0; }
.tl-item:last-child { border-bottom: 0; }
.tl-dot { position: absolute; left: 4px; top: 16px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper); }
.tl-draft .tl-dot { border-radius: 4px; border-color: var(--muted); }
.tl-sent .tl-dot { background: var(--accent); border-color: var(--accent); }
.tl-reply .tl-dot { border-radius: 3px; transform: rotate(45deg) scale(.9); background: var(--st-replied-bg); border-color: var(--st-replied-bg); }
.tl-stage .tl-dot { border-color: var(--accent); box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 8px var(--accent); }
.tl-head { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; }
.tl-kind { font-weight: 700; font-size: 14px; }
.tl-head time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tl-main { margin: 2px 0 0; overflow-wrap: anywhere; }
.tl-sub { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.tl-msg { margin-top: 8px; display: grid; gap: 8px; }
.seg { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 999px; justify-self: start; }
.seg button { min-height: 36px; padding: 0 14px; background: none; border: 0; border-radius: 999px; color: var(--muted); cursor: pointer; font-weight: 600; touch-action: manipulation; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }
.tl-empty, .tl-err, .rp-empty, .rp-err { border-radius: var(--radius); padding: 20px 24px; }

/* ---- 第 9 批：購買意願量表（三格：填滿幾格＝幾級） ---- */
.intent { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; line-height: 1.4; white-space: nowrap; }
.meter { display: inline-flex; gap: 2px; align-items: flex-end; }
.meter i { display: block; width: 5px; height: 12px; border: 1.5px solid var(--accent); border-radius: 2px; }
.meter i:nth-child(1) { height: 7px; }
.meter i:nth-child(2) { height: 10px; }
.meter i.on { background: var(--accent); }
.intent-unknown .meter i { border-style: dashed; border-color: var(--muted); }
.chips .intent { padding: 3px 10px; border-radius: 999px; background: var(--st-pending-bg); }
.c-intent { white-space: nowrap; }
.th-sort { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; min-height: 32px; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
th[aria-sort="ascending"] .th-sort { color: var(--accent-text); text-decoration-color: var(--accent); }
th[aria-sort="ascending"] .th-sort::after { content: " ▼"; }
.pf-icon { display: inline-flex; vertical-align: middle; margin-left: 6px; color: var(--muted); }

/* ---- 時間軸頂部：工具列、意願、簡介 ---- */
.tl-tools { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 0; }
.kbd-hint { margin-left: 8px; background: var(--on-accent); color: var(--accent); border-color: transparent; }
@media (hover: none), (pointer: coarse) { .kbd-hint { display: none; } }
.tl-intent, .tl-profile { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.tli-top { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 0; }
.tli-top h2 { margin: 0; font-size: 18px; }
.tli-top .intent { font-size: 16px; }
.tli-top .intent .meter i { width: 7px; height: 16px; }
.tli-top .intent .meter i:nth-child(1) { height: 8px; }
.tli-top .intent .meter i:nth-child(2) { height: 12px; }
.tli-top .who { font-size: 14px; }
.tli-next { margin: 10px 0 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; padding: 10px 12px; background: var(--accent-soft); border-radius: 12px; overflow-wrap: anywhere; }
.tli-next strong { color: var(--accent-text); }
.tli-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 24px; margin-top: 12px; }
.tli-grid h3, .tli-timing h3, .imp-sec h3, .ws-lang h3 { margin: 0 0 4px; font-size: 14px; color: var(--muted); }
.tli-grid ul, .imp-sec ul, .ws-ex { margin: 0; padding-left: 1.2em; overflow-wrap: anywhere; }
.tli-grid p { margin: 0; overflow-wrap: anywhere; }
.chips-l { display: flex; flex-wrap: wrap; gap: 6px; }
.tli-timing { margin-top: 14px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px 24px; }
.tli-timing h3 small { font-weight: 400; }
.tm-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 2px 24px; }
.tm-list li { padding: 3px 0; overflow-wrap: anywhere; }
.tm-list li.none { font-size: 14px; }
.spark { margin: 6px 0 0; max-width: 320px; }
.spark svg { display: block; width: 100%; height: auto; overflow: visible; }
.sp-them { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.sp-me { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 4 3; stroke-linejoin: round; }
.sp-dot-them { fill: var(--accent); }
.sp-dot-me { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.sp-lab, .sp-mo { fill: var(--ink); font: 600 11px/1 var(--font); }
.sp-lab-them { fill: var(--accent-text); }
.sp-mo { fill: var(--muted); font-weight: 400; }
.spark figcaption { margin-top: 2px; font-size: 13px; }
.sp-key { display: inline-block; width: 16px; height: 0; border-top: 1.5px dashed var(--ink); vertical-align: middle; margin-right: 4px; }
.sp-key-them { border-top: 2.5px solid var(--accent); }
.tl-profile summary { display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; min-height: 44px; cursor: pointer; padding: 6px 0; }
.pf-h { font-weight: 700; font-size: 18px; }
.pf-peek { font-size: 14px; overflow-wrap: anywhere; min-width: 0; }
.pf-text { width: 100%; min-height: 120px; padding: 10px 12px; line-height: 1.6; resize: vertical; background: var(--glass-strong); color: var(--ink); border: 1px solid var(--btn-line); border-radius: 12px; }
.pf-text:focus { border-color: var(--accent); outline: 3px solid var(--accent-glow); outline-offset: 0; }
.pf-foot { display: flex; justify-content: space-between; gap: 12px; margin: 4px 0 0; font-size: 14px; }

/* ---- 筆記站與記一筆 ---- */
.tl-note .tl-dot { top: 19px; height: 10px; border-radius: 3px; border-color: var(--ink); }
.tl-note-import .tl-dot { background: var(--ink); }
.tl-meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.note-acts { margin-left: auto; display: inline-flex; gap: 4px; }
.btn-mini { min-height: 36px; min-width: 44px; padding: 0 10px; background: none; border: 1px solid transparent; border-radius: 10px; color: var(--muted); cursor: pointer; font-size: 14px; touch-action: manipulation; }
.btn-mini:hover { background: var(--hover); color: var(--ink); }
.btn-mini-danger, .btn-danger { background: var(--err-soft); border-color: var(--err); color: var(--ink); font-weight: 700; }
.note-body { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.note-edit { margin-top: 8px; display: grid; gap: 8px; }
.note-ta, .ws-edit textarea { width: 100%; padding: 10px 12px; line-height: 1.6; resize: vertical; background: var(--glass-strong); color: var(--ink); border: 1px solid var(--accent); border-radius: 12px; }
.note-bar, .imp-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.tl-compose { border-radius: var(--radius); padding: 14px 16px; margin-bottom: 16px; display: grid; gap: 10px; box-shadow: var(--shadow), inset 4px 0 0 var(--accent); }
.tl-compose .field > span { flex-wrap: wrap; }
.tl-compose .hint { font-weight: 400; font-style: normal; }

/* ---- 匯入對話紀錄（一步一步，在時間軸上方） ---- */
.imp { border-radius: var(--radius); padding: 16px 20px 20px; margin-bottom: 20px; display: grid; gap: 14px; box-shadow: var(--shadow), inset 4px 0 0 var(--accent); }
.imp-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.imp-head h2 { margin: 0; font-size: 22px; }
.imp-head h2:focus { outline: none; }
.imp-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: st; }
.imp-steps li { counter-increment: st; display: inline-flex; align-items: center; gap: 6px; padding: 3px 12px 3px 4px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--muted); font-size: 14px; }
.imp-steps li::before { content: counter(st); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 12px; font-weight: 700; }
.imp-steps li.done::before { content: "✓"; }
.imp-steps li[aria-current="step"] { color: var(--on-accent); background: var(--accent); border-color: var(--accent); font-weight: 700; }
.imp-how summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 700; }
.imp-how ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.imp-src { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.imp-me { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
.imp-me legend { font-weight: 700; margin-bottom: 8px; padding: 0; }
.imp-who { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 14px; border: 1px solid var(--btn-line); border-radius: 999px; background: var(--glass-strong); cursor: pointer; max-width: 100%; overflow-wrap: anywhere; }
.imp-who input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
.imp-who small { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.imp-who:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.imp-stats { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px 24px; }
.imp-stats dt { font-size: 13px; color: var(--muted); }
.imp-stats dd { margin: 0; font-weight: 700; font-size: 18px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.imp-warn { margin: 0; padding: 8px 12px; background: var(--warn-soft-bg); border-radius: 12px; font-weight: 700; }
.imp-busy { display: grid; gap: 6px; font-weight: 700; }
.bar-busy { display: block; margin: 0; }
.bar-busy i { width: 35%; animation: busy 1.4s ease-in-out infinite; }
@keyframes busy { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.imp-err { margin: 0; padding: 8px 12px; background: var(--err-soft); border-radius: 12px; font-weight: 700; overflow-wrap: anywhere; }
.imp-err:focus { outline: none; }
.imp-ok { margin: 0; font-weight: 700; }
.imp-sec { border-top: 1px solid var(--line); padding-top: 12px; }
.imp-sugg { list-style: none; padding: 0 !important; display: grid; gap: 6px; }
.imp-sugg li { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; min-height: 48px; }
.sg-l { color: var(--muted); font-size: 14px; }
.sg-v small { display: block; color: var(--muted); font-size: 13px; }
.imp-style { margin: 0; padding: 10px 12px; background: var(--accent-soft); border-radius: 12px; }

/* ---- 我的寫作風格（執行紀錄頁） ---- */
.ws-lang { border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.ws-desc { margin: 0 0 6px; overflow-wrap: anywhere; }
.ws-ex li { color: var(--muted); }
.ws-edit { border: 1px solid var(--line); border-radius: 16px; margin: 0; padding: 8px 14px 14px; display: grid; gap: 10px; min-width: 0; }
.ws-edit legend { font-weight: 700; padding: 0 6px; }

/* ---- 週報 ---- */
.weekbar { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; border-radius: 999px; padding: 6px; margin-bottom: 20px; }
.week-label { margin: 0; text-align: center; font-size: 18px; font-variant-numeric: tabular-nums; }
.weekbar .btn { border-radius: 999px; }
.rp-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 20px; border-radius: var(--radius); padding: 18px 20px; }
.rp-kpis div { min-width: 0; }
.rp-kpis dt { font-size: 14px; color: var(--muted); font-weight: 700; }
.rp-kpis dd { margin: 0; overflow-wrap: anywhere; font-size: 36px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rp-kpis dd small { font-size: 15px; font-weight: 400; letter-spacing: 0; }
.rp-kpis .rp-sub { font-size: 14px; font-weight: 400; color: var(--muted); letter-spacing: 0; line-height: 1.5; margin-top: 4px; }
.rp-sec { border-radius: var(--radius); padding: 16px 20px 20px; margin-bottom: 20px; }
.rp-sec h2 { margin: 0 0 8px; font-size: 20px; }
.rp-legend { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.lg { display: inline-block; width: 14px; height: 10px; border-radius: 3px; margin-left: 8px; }
.lg:first-child { margin-left: 0; }
.lg-sent, .rp-bar { border: 1.5px solid var(--accent); background: var(--accent-soft); }
.lg-rep, .rp-bar i { background: var(--accent); }
.rp-bars { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.rp-bars th, .rp-bars td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.rp-bars tbody tr:last-child > * { border-bottom: 0; }
.rp-bars th { text-align: left; font-weight: 600; padding-right: 12px; width: 32%; overflow-wrap: anywhere; }
.rp-track { width: 46%; }
.rp-bar { display: block; height: 14px; min-width: 6px; border-radius: 0 4px 4px 0; overflow: hidden; }
.rp-bar i { display: block; height: 100%; }
.rp-bars .rp-num { padding-left: 12px; white-space: nowrap; font-size: 14px; text-align: right; }
.rp-stages { border-collapse: collapse; width: 100%; max-width: 480px; font-variant-numeric: tabular-nums; }
.rp-stages th, .rp-stages td { text-align: left; padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); }
.rp-stages thead th { font-size: 13px; color: var(--muted); border-bottom-color: var(--line-strong); }
.rp-stages tbody th { font-weight: 600; }
.rp-delta { color: var(--muted); }
.rp-note { margin-top: 4px; }

/* ---- 登入、提示 ---- */
.login, .notice { border-radius: var(--radius); padding: 8px 24px 24px; margin: 24px auto; }
.login { max-width: 440px; }
.notice { max-width: 640px; }
.login h1, .notice h1 { font-size: 32px; letter-spacing: -0.01em; margin: 24px 0; }
.login form { display: grid; gap: 16px; }
.login form > .btn-quiet { justify-self: start; padding: 0; min-height: 44px; }

/* ---- toast ---- */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); z-index: 50;
  display: flex; gap: 16px; align-items: center; max-width: calc(100% - 32px); width: max-content; padding: 12px 16px;
  background: var(--toast-bg); color: var(--toast-fg); -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-edge); border-radius: 16px; box-shadow: var(--shadow); transition: transform .2s ease-out;
}
.toast.show { transform: translate(-50%, 0); }
.toast-error { background: var(--toast-err-bg); }
.toast-action { background: none; border: 1px solid var(--toast-fg); border-radius: 10px; color: var(--toast-fg); min-height: 40px; padding: 0 12px; cursor: pointer; }

/* ---- 鍵盤快捷鍵說明（只在有滑鼠的桌機出現） ---- */
.kbd-btn {
  position: fixed; right: 20px; bottom: 20px; z-index: 30; width: 44px; height: 44px; border-radius: 50%;
  background: var(--glass-strong); color: var(--ink); border: 1px solid var(--glass-edge); box-shadow: var(--shadow);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur); font-weight: 700; font-size: 18px; cursor: pointer;
}
.kbd-help { position: fixed; right: 20px; bottom: 76px; z-index: 40; width: min(320px, calc(100% - 40px)); padding: 16px; border-radius: 20px; }
.kbd-help h2 { margin: 0 0 8px; font-size: 18px; }
.kbd-help dl { margin: 0 0 12px; display: grid; gap: 6px; }
.kbd-help dl div { display: grid; grid-template-columns: 72px 1fr; gap: 8px; align-items: center; }
.kbd-help dt, .kbd-help dd { margin: 0; }
kbd { display: inline-block; min-width: 24px; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 6px; font: 700 13px/1.4 var(--font); text-align: center; background: var(--paper); color: var(--ink); }
@media (hover: none), (pointer: coarse) { .kbd-btn, .kbd-help { display: none !important; } }

/* ---- 動態：只用淡入＋上滑 ---- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.draft, .tray, .run, .gmail, .spend, .toolbar, .table-wrap, .preview-box, .login, .notice, .kbd-help:not([hidden]), .tl-card, .tl, .imp, .tl-compose { animation: var(--rise); }
.settled .tl-card, .settled .tl { animation: none; } /* 時間軸重畫（存筆記、改階段）不重播 */
.draft:nth-child(2), .run:nth-child(2) { animation-delay: 40ms; }
.draft:nth-child(3), .run:nth-child(3) { animation-delay: 80ms; }
.draft:nth-child(4), .run:nth-child(4) { animation-delay: 120ms; }
.draft:nth-child(n+5), .run:nth-child(n+5) { animation-delay: 160ms; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- 桌機 ---- */
@media (min-width: 900px) {
  :root { --gut: 32px; }
  .draft-body { grid-template-columns: 5fr 7fr; }
  .band { padding: 20px 24px 8px; }
  .news { border-bottom: 0; border-right: 1px solid var(--line); padding-bottom: 20px; }
  .news, .compose { padding-left: 24px; padding-right: 24px; }
  .actions { display: flex; }
  .actions .btn-primary { min-width: 200px; }
  .spend-body { grid-template-columns: auto auto 1fr; align-items: end; gap: 16px 48px; }
  .spend-models { justify-self: end; }
  .spend-warn, .spend-note { grid-column: 1 / -1; }
  .rp-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---- 手機：模糊減量（省電、不卡）、圓角略小、表格改成一列一張 ---- */
@media (max-width: 699px) {
  :root { --blur: blur(14px) saturate(160%); --radius: 20px; }
  .filter { display: grid; width: 100%; border-radius: 22px; }
  .filter-btn { padding: 0 8px; }
  .filter-note { margin-left: 0; }
  .table-wrap { padding: 4px 0; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { position: relative; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { border: 0; padding: 4px 10px; display: flex; gap: 12px; align-items: center; }
  .table td[data-label]::before { content: attr(data-label); width: 64px; flex: none; font-size: 13px; color: var(--muted); }
  .table td.c-name { display: block; font-size: 17px; padding-right: 56px; }
  .table td.c-pick { position: absolute; top: 4px; right: 4px; width: auto; padding: 0; }
  .field-inline, .field-inline input { width: 100%; }
  .weekbar { grid-template-columns: 1fr 1fr; border-radius: 22px; }
  .week-label { grid-column: 1 / -1; grid-row: 1; font-size: 17px; }
  .rp-bars tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .rp-bars tbody tr:last-child { border-bottom: 0; }
  .rp-bars th, .rp-bars td { border: 0; padding: 2px 0; width: auto; }
  .rp-bars th { grid-column: 1 / -1; }
  .rp-kpis dd { font-size: 30px; }
  .imp { padding: 14px 16px 16px; }
  .imp-sugg li { grid-template-columns: minmax(0, 1fr) auto; }
  .imp-sugg .sg-l { grid-column: 1 / -1; }
  .note-acts { margin-left: 0; }
}

/* 很窄的手機（≤400px）：按鈕縮內距、標籤換行，保證沒有水平捲動 */
@media (max-width: 400px) {
  .btn { padding: 0 10px; }
  .chip { white-space: normal; }
  .chips { margin-left: 0; }
  .spend-num { font-size: 36px; }
  .rp-kpis { gap: 12px; padding: 14px 16px; }
  .rp-kpis dd { font-size: 24px; }
  .weekbar .btn { padding: 0 8px; }
}

#draft-list > .empty { border-radius: var(--radius); padding: 20px 24px; }

/* ---- 第 10 批：客戶資料表單（編輯資料／新增客戶）＋聯絡方式清單 ---- */
.field select { width: 100%; min-height: 48px; padding: 10px 12px; background: var(--glass-strong); color: var(--ink); border: 1px solid var(--btn-line); border-radius: 12px; }
.field select:focus { border-color: var(--accent); outline: 3px solid var(--accent-glow); outline-offset: 0; }
.field [aria-invalid="true"] { border-color: var(--err); }
.cf { margin: 16px 0 0; }
.cf-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; }
.cf-head h2 { margin: 0; font-size: 18px; }
.cf-head .btn-quiet { margin-left: auto; }
.cf-group { border: 0; border-top: 1px solid var(--line); margin: 16px 0 0; padding: 12px 0 0; min-width: 0; }
.cf-group legend { font-size: 13px; font-weight: 700; color: var(--muted); padding: 0 8px 0 0; }
.cf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 4px 16px; }
.cf-wide { grid-column: 1 / -1; }
.cf-f { min-width: 0; }
.cf-req { color: var(--accent-text); font-style: normal; margin-left: 2px; }
.cf-primary .field > span { color: var(--accent-text); }
.cf-hint, .cf-err { margin: 4px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.cf-err:empty { display: none; }
.cf-err { font-weight: 700; }
.cf-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.cf-danger { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--err-soft); display: grid; gap: 8px; max-width: 420px; }
.cf-danger .btn { justify-self: start; }
.cf-legacy { margin: 0 0 12px; }
.ct-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.ct-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.ct-ch { min-width: 7em; display: inline-flex; align-items: center; gap: 6px; }
.ct-v { font-weight: 400; overflow-wrap: anywhere; min-width: 0; flex: 1 1 12em; }
.ct-primary .ct-v { font-weight: 700; }
.ct-acts { display: inline-flex; gap: 4px; }
.ct-acts a.btn-mini { display: inline-flex; align-items: center; color: var(--accent-text); text-decoration: none; border-color: var(--btn-line); }
.ct-none { margin: 4px 0 0; font-weight: 400; }
.flag-btn { border: 0; cursor: pointer; font: inherit; font-size: 13px; min-height: 28px; margin: 2px 6px 2px 0; touch-action: manipulation; }
.flag-btn:hover { box-shadow: 0 0 0 2px var(--accent-glow); }
.preview td small { display: block; font-weight: 400; }
