/* ═══════════════════════════════════════════════════════════════════
   Forge · 设计变量与组件样式
   ───────────────────────────────────────────────────────────────────
   来源：参考实现 forge-ui.html 的 <style>。组件样式照抄，只做删减与适配，
   不重新设计、不改类名、不新增变量。
   相对原型的三处适配（其余逐字一致）：
     1. 深色由主题属性选择器改成 @media (prefers-color-scheme: dark)（契约 §5.4）
     2. 评审台外壳的样式（左侧导轨 / 论证面板 / 配色 token 面板 / 手机外框 /
        分段开关 / 表格清单 等）全部删除
     3. 原型那个固定 375×812 的手机画板 → .app（真实视口，100dvh）
   ═══════════════════════════════════════════════════════════════════ */

/* ─── tokens ─────────────────────────────────────────────────────────
   tech-utility 的六个变量。色相由冷 240 移到暖 80：健身房顶灯下冷灰会显脏。
   accent 由绿改为琥珀 —— 本产品的语义里绿=进步=数据色，功能色只能有一个响的。
   对比度已实测：浅色 accent 对背景 4.94:1，深色 8.58:1（均为 0.13–0.135 彩度）。 */
:root {
  --bg:      oklch(98% 0.004 80);
  --surface: oklch(100% 0 0);
  --fg:      oklch(22% 0.012 70);
  --muted:   oklch(50% 0.012 70);
  --border:  oklch(90% 0.006 80);
  --accent:  oklch(54% 0.13 65);

  --ink-soft: color-mix(in oklch, var(--fg) 7%, transparent);
  --accent-soft: color-mix(in oklch, var(--accent) 16%, transparent);

  --font-display: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  --font-body:    -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Segoe UI', 'Microsoft YaHei', system-ui, sans-serif;
  --font-mono:    'SF Mono', ui-monospace, 'JetBrains Mono', Menlo, Consolas, monospace;

  /* 字号阶梯 —— 数字是主角，故数字阶单独一套 */
  --fs-num-xl: 46px;  /* 总结页 PR 数字 */
  --fs-num-lg: 30px;  /* 编辑态大数字 */
  --fs-num-md: 21px;  /* 行内重量 / 次数 */
  --fs-num-sm: 16px;  /* 表格数字 */
  --fs-h1: 27px;
  --fs-h2: 20px;
  --fs-h3: 17px;
  --fs-body: 16px;
  --fs-meta: 13px;
  --fs-micro: 11px;

  --gap-xs: 4px;  --gap-sm: 8px;  --gap-md: 12px;
  --gap-lg: 16px; --gap-xl: 24px; --gap-2xl: 32px;

  --radius: 8px; --radius-lg: 12px;
  --tap: 44px;      /* 最小点击区 */
  --tap-main: 56px; /* 主要操作 */

  color-scheme: light dark;
}

/* 深色：契约 §5.4 —— 不挂主题属性，跟随系统。
   只覆盖原型深色那组里出现过的那几个变量，不新增。 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:      oklch(18% 0.008 75);
    --surface: oklch(23.5% 0.009 75);
    --fg:      oklch(93% 0.006 80);
    --muted:   oklch(67% 0.010 78);
    --border:  oklch(32% 0.008 78);
    --accent:  oklch(76% 0.135 72);
    --accent-soft: color-mix(in oklch, var(--accent) 18%, transparent);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  height: 100%;
  background: var(--bg);
}
body {
  margin: 0;
  height: 100%;
  overflow: hidden;                 /* 全屏应用：滚动条只在 .scroll 里 */
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; }
h1, h2, h3 { margin: 0; text-wrap: balance; }
p { margin: 0; text-wrap: pretty; }
ul { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; border-radius: 4px; }

/* ═══ 屏幕容器（原型的固定手机画板；去掉外框，改成真实视口） ═══ */
.app {
  position: relative; width: 100%; height: 100dvh; min-height: 100vh; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-size: var(--fs-body); line-height: 1.5; isolation: isolate;
}

/* 屏幕层 */
.screen { position: absolute; inset: 0; display: none; flex-direction: column; background: var(--bg); }
.screen.is-on { display: flex; animation: screen-in .18s ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .screen.is-on { animation: none; }
  * { transition-duration: .001ms !important; }
}

/* 安全区：主屏打开时没有地址栏，刘海/底部横条会压内容 */
.appbar {
  flex: 0 0 auto;
  padding: max(52px, calc(env(safe-area-inset-top) + 12px)) calc(20px + env(safe-area-inset-left)) 12px calc(20px + env(safe-area-inset-right));
  border-bottom: 1px solid var(--border);
  background: var(--bg); position: relative; z-index: 5;
}
.appbar-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.appbar .ab-title {
  font-size: var(--fs-h1); font-weight: 650; letter-spacing: -.02em; line-height: 1.15;
  display: flex; align-items: center; gap: 6px;
}
.appbar .ab-sub {
  font-family: var(--font-mono); font-size: var(--fs-meta); color: var(--muted);
  margin-top: 3px; font-variant-numeric: tabular-nums;
}
.appbar .ab-right { display: flex; align-items: center; gap: 6px; padding-bottom: 3px; }
.icon-btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border-radius: var(--radius); color: var(--muted); transition: background .15s ease, color .15s ease;
}
.icon-btn:hover { background: var(--ink-soft); color: var(--fg); }
.icon-btn svg { width: 21px; height: 21px; }
/* t18 / t6-F1：命中区 ≥44 —— 原型这里是 4+31+4 = 39.1，低于 DESIGN-BRIEF §6 的硬线 */
.plan-open {
  display: inline-flex; align-items: center; gap: 5px; border-radius: var(--radius);
  padding: 4px 6px 4px 0; min-height: var(--tap);
}
.plan-open:hover { color: var(--muted); }
.plan-open svg { width: 17px; height: 17px; }

/* 顶部极小提示位 */
.hintbar {
  display: flex; align-items: center; gap: 7px; margin-top: 10px;
  font-size: 12.5px; color: var(--muted);
}
.hintbar[hidden] { display: none; }
/* t18 / t6-F1：按钮命中区抬到 ≥44 高，但**整条 bar 不撑高** —— 44px 的盒配上下各 -13px
   的负外边距，布局贡献仍是 18px（原来的行高）；多出来的上下各 13px 落在 hintbar 自己的
   margin-top:10px 与 .appbar 的 padding-bottom:12px 这两处空白里（几何证据见
   tests/review/hardchecks.mjs §2 的三条断言；真机上的点按手感仍属待人工确认） */
.hintbar button {
  text-decoration: underline; text-underline-offset: 2px; color: var(--muted);
  display: inline-flex; align-items: center; padding: 0 4px; border-radius: 6px;
  min-height: var(--tap); margin-top: -13px; margin-bottom: -13px;
}
.hintbar button:hover { color: var(--fg); }
.hintbar .dot { width: 5px; height: 5px; border-radius: 99px; background: var(--accent); flex: 0 0 auto; }

/* 滚动区 */
.scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.scroll::-webkit-scrollbar { width: 0; }
.list { padding: 16px 20px 8px; display: flex; flex-direction: column; gap: 12px; }

/* 继续训练横幅（此刻唯一的主操作，用实心中性按钮而非强调色 —— 强调色留给进步） */
.resume {
  margin: 16px 20px 0; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); display: flex; flex-direction: column; gap: 12px;
}
.resume-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.resume-top .rs-name { font-size: var(--fs-h3); font-weight: 600; }
.resume-top .rs-meta { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.resume-bar { height: 5px; border-radius: 99px; background: var(--ink-soft); overflow: hidden; }
.resume-bar span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .3s ease; }
.resume-actions { display: flex; align-items: center; gap: 8px; }

/* 动作卡片 */
.ex-card {
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden;
}
.ex-head { display: flex; align-items: center; gap: 10px; padding: 13px 14px 11px; }
.ex-name { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -.005em; }
.ex-chip {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 2px 7px;
}
/* t18 / t6-F1：原型 34×34 是按鼠标做的，触摸要 ≥44×44（代价：卡片头高 58 → 68） */
.ex-more {
  margin-left: auto; width: var(--tap); height: var(--tap); border-radius: 8px;
  display: grid; place-items: center; color: var(--muted);
}
.ex-more:hover { background: var(--ink-soft); color: var(--fg); }
.ex-more svg { width: 19px; height: 19px; }

.set-head, .set-row {
  display: grid; grid-template-columns: 34px 1fr 1fr var(--tap);
  align-items: center; gap: 4px;
}
.set-head {
  padding: 5px 14px; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .07em;
  text-transform: uppercase; color: var(--muted);
}
.set-head .sh-c { text-align: center; }
.set-row { border-top: 1px solid var(--border); min-height: 60px; transition: background .15s ease; }
.set-row:hover { background: var(--ink-soft); }
.set-row .s-idx {
  font-family: var(--font-mono); font-size: 13px; color: var(--muted);
  text-align: center; font-variant-numeric: tabular-nums;
}
/* 数值格：整格可点，命中区 ≥44pt，两格等宽。
   t18 / t6-F1：原型只靠 padding 撑到 ≈40.1（9 + 21×1.05 + 9），这里补 min-height；
   行高仍由 .set-row 的 min-height:60px 决定，一行的视觉节奏不变。 */
.set-row .cell {
  padding: 9px 0; min-height: var(--tap); text-align: center;
  border-radius: var(--radius); transition: background .15s ease;
}
.set-row .cell:hover { background: var(--ink-soft); }
.set-row .cell.is-empty .v-main { color: var(--muted); }
.set-row .v-line { display: flex; align-items: baseline; justify-content: center; gap: 4px; }
.set-row .v-main {
  font-family: var(--font-mono); font-size: var(--fs-num-md); font-weight: 600;
  font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.05;
}
.set-row .v-main.is-empty { color: var(--muted); font-weight: 500; }
.set-row .v-unit { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.set-row .v-sub {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  margin-top: 2px; font-variant-numeric: tabular-nums;
}
.set-row.done .v-main { color: var(--fg); }
.set-row.done { background: color-mix(in oklch, var(--fg) 4%, transparent); }
/* 打勾：44×44 命中区，视觉只占 28 */
.check {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  border-radius: var(--radius);
}
.check:hover { background: var(--ink-soft); }
.check .box {
  width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid var(--border);
  display: grid; place-items: center; transition: background .13s ease, border-color .13s ease, transform .13s ease;
}
.check .box svg { width: 15px; height: 15px; opacity: 0; transform: scale(.6); transition: opacity .13s ease, transform .13s ease; }
.check:hover .box { border-color: var(--fg); }
.check:active .box { transform: scale(.9); }
.check[aria-pressed="true"] .box { background: var(--fg); border-color: var(--fg); color: var(--bg); }
.check[aria-pressed="true"] .box svg { opacity: 1; transform: none; }
.check[aria-pressed="true"]:hover .box { background: color-mix(in oklch, var(--fg) 82%, var(--bg)); }

.ex-foot {
  display: flex; align-items: center; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border);
}
.ex-foot .ef-progress { font-family: var(--font-mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ex-foot .ef-spacer { flex: 1 1 auto; }
/* t18 / t6-F1：原型 36 → 44（「加一组」是记录页行内最常点的次级操作） */
.text-btn {
  font-size: 13.5px; color: var(--muted); padding: 9px 10px; border-radius: 7px;
  display: inline-flex; align-items: center; gap: 5px; min-height: var(--tap);
}
.text-btn:hover { background: var(--ink-soft); color: var(--fg); }
.text-btn svg { width: 15px; height: 15px; }

/* 底部操作条（同样要避开底部横条） */
.actionbar {
  flex: 0 0 auto;
  padding: 14px calc(20px + env(safe-area-inset-right)) max(34px, calc(env(safe-area-inset-bottom) + 10px)) calc(20px + env(safe-area-inset-left));
  border-top: 1px solid var(--border);
  background: var(--bg); display: flex; gap: 10px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 18px; border-radius: var(--radius);
  font-size: 16px; font-weight: 550; letter-spacing: -.005em;
  border: 1px solid transparent; transition: background .15s ease, border-color .15s ease, color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 19px; height: 19px; flex: 0 0 auto; }
.btn-main { flex: 1 1 auto; min-height: var(--tap-main); background: var(--fg); color: var(--bg); }
.btn-main:hover { background: color-mix(in oklch, var(--fg) 88%, var(--bg)); }
.btn-ghost { border-color: var(--border); color: var(--fg); }
.btn-ghost:hover { border-color: var(--fg); }
.btn-quiet { color: var(--muted); }
.btn-quiet:hover { background: var(--ink-soft); color: var(--fg); }
.btn-block { width: 100%; }
.btn-danger { color: var(--fg); border-color: var(--border); }
.btn-danger:hover { border-color: var(--muted); background: var(--ink-soft); }
/* 原型写在 index 行内（#btn-sample style="font-size:14px"）→ 按类名落到这里 */
.btn-quiet.btn-block { font-size: 14px; }
#btn-finish { flex: 0 0 auto; }
#edit-remove { flex: 0 0 auto; }

/* ─── 首屏空状态 ─────────────────────────────────────────────── */
.empty-wrap { flex: 1 1 auto; display: flex; flex-direction: column; padding: 0 24px 34px; overflow-y: auto; }
.empty-hero { padding: 74px 0 30px; }
.wordmark {
  font-size: 34px; font-weight: 700; letter-spacing: -.035em; display: flex; align-items: center; gap: 9px;
}
.wordmark .spark { width: 7px; height: 7px; border-radius: 99px; background: var(--accent); }
.empty-hero .tagline { margin-top: 12px; color: var(--muted); font-size: 15.5px; max-width: 28ch; }
.empty-actions { display: flex; flex-direction: column; gap: 10px; }
.empty-note {
  margin-top: 18px; padding: 13px 14px; border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; color: var(--muted); line-height: 1.6; display: flex; gap: 10px;
}
.empty-note svg { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 2px; color: var(--fg); }
.empty-note strong { color: var(--fg); font-weight: 600; }
.hist-strip { margin-top: auto; padding-top: 22px; border-top: 1px solid var(--border); }
/* 没有历史时（home.js 里 innerHTML 清空）连那条分隔线一起收掉：
   原型的分隔线上永远有记录，本项目首屏在无数据时是常态，空线条会像多余的装饰。 */
.hist-strip:empty { display: none; }
.hist-strip .hs-head {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px;
}
.hist-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 7px 0; font-size: 14px; }
.hist-row .hr-date { font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hist-row .hr-name { flex: 1 1 auto; }
.hist-row .hr-vol { font-family: var(--font-mono); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ─── 动作选择器 ─────────────────────────────────────────────── */
.searchwrap { padding: 12px 20px; border-bottom: 1px solid var(--border); }
.search {
  display: flex; align-items: center; gap: 9px; padding: 0 12px; height: 44px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
}
.search:focus-within { border-color: var(--fg); }
.search svg { width: 17px; height: 17px; color: var(--muted); flex: 0 0 auto; }
.search input { flex: 1 1 auto; border: 0; background: none; color: var(--fg); outline: none; font-size: 16px; min-width: 0; }
.search input::placeholder { color: var(--muted); }
.search .clear { color: var(--muted); width: 26px; height: 26px; display: none; place-items: center; border-radius: 99px; }
.search .clear:hover { background: var(--ink-soft); color: var(--fg); }
.search.has-value .clear { display: grid; }
.pick-group { padding: 16px 20px 0; }
.pick-group h3 {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 8px; font-weight: 500;
}
.pick-item {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  min-height: 52px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); text-align: left; transition: border-color .15s ease, background .15s ease;
}
.pick-item + .pick-item { margin-top: 6px; }
.pick-item:hover { border-color: var(--fg); }
.pick-item .pi-name { font-size: 16px; font-weight: 500; }
.pick-item .pi-en { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-left: auto; }
.pick-item .pi-recent {
  font-family: var(--font-mono); font-size: 11px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 1px 7px;
}
.pick-empty { padding: 44px 20px; text-align: center; color: var(--muted); font-size: 14.5px; }

/* ─── 总结页 ─────────────────────────────────────────────────── */
.sum-wrap { padding: 8px 20px 12px; display: flex; flex-direction: column; gap: 12px; }
.pr-card { border: 1px solid var(--accent); border-radius: var(--radius-lg); padding: 18px; }
.pr-card .pr-label {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 12px;
}
.pr-ex { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.pr-ex + .pr-ex { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.pr-ex .pe-name { font-size: var(--fs-h3); font-weight: 600; }
.pr-ex .pe-nums { text-align: right; }
.pr-ex .pe-main { font-family: var(--font-mono); font-size: var(--fs-num-lg); font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; line-height: 1; }
.pr-ex .pe-delta { font-family: var(--font-mono); font-size: 12.5px; color: var(--accent); margin-top: 4px; font-variant-numeric: tabular-nums; }
.flat-card { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.flat-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.sum-row { display: flex; align-items: center; padding: 12px 16px; gap: 12px; }
.sum-row + .sum-row { border-top: 1px solid var(--border); }
.sum-row.is-flat .sr-delta { color: var(--muted); }
.sum-row .sr-name { font-size: 15.5px; font-weight: 500; }
.sum-row .sr-sets { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 2px; font-variant-numeric: tabular-nums; }
.sum-row .sr-right { margin-left: auto; text-align: right; }
.sum-row .sr-vol { font-family: var(--font-mono); font-size: var(--fs-num-sm); font-variant-numeric: tabular-nums; }
.sum-row .sr-delta { font-family: var(--font-mono); font-size: 12px; color: var(--accent); font-variant-numeric: tabular-nums; margin-top: 2px; }
.summary-empty {
  padding: 26px 18px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6;
}
.summary-empty strong { display: block; color: var(--fg); font-size: 16px; font-weight: 600; margin-bottom: 4px; }

/* ─── 进度页 ─────────────────────────────────────────────────── */
.stats-3 { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.stats-3 > div { padding: 14px; border-right: 1px solid var(--border); }
.stats-3 > div:last-child { border-right: 0; }
.stats-3 .s-label { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stats-3 .s-num { font-family: var(--font-mono); font-size: 25px; font-weight: 650; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 5px; line-height: 1; }
.stats-3 .s-unit { font-size: 12px; color: var(--muted); margin-left: 2px; font-weight: 400; }
.stats-3 .s-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.heat { display: flex; gap: 4px; margin-top: 14px; }
.heat-days {
  display: grid; grid-template-rows: repeat(7, 13px); gap: 3px;
  font-family: var(--font-mono); font-size: 9px; color: var(--muted); line-height: 13px;
}
.heat-grid { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 13px); gap: 3px; flex: 1 1 auto; }
.heat-cell { width: 13px; height: 13px; border-radius: 3px; background: var(--ink-soft); }
.heat-cell[data-lv="1"] { background: color-mix(in oklch, var(--fg) 22%, transparent); }
.heat-cell[data-lv="2"] { background: color-mix(in oklch, var(--fg) 42%, transparent); }
.heat-cell[data-lv="3"] { background: color-mix(in oklch, var(--fg) 64%, transparent); }
.heat-cell[data-lv="4"] { background: var(--fg); }
.heat-cell.is-today { box-shadow: 0 0 0 1.5px var(--accent); }
.heat-legend { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.heat-legend .heat-cell { width: 11px; height: 11px; }
.heat-legend .lg-gap { flex: 1 1 auto; }

.chart-box { padding: 16px; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.chart-head .ch-name { font-size: 16px; font-weight: 600; }
.chart-head .ch-now { font-family: var(--font-mono); font-size: var(--fs-num-sm); font-variant-numeric: tabular-nums; }
.chart-head .ch-delta { font-family: var(--font-mono); font-size: 12px; color: var(--accent); }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--border); stroke-width: 1; }
.ch-area { fill: color-mix(in oklch, var(--fg) 8%, transparent); }
.ch-line { fill: none; stroke: var(--fg); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-dot { fill: var(--fg); }
.ch-dot.is-last { fill: var(--accent); }
.ch-axis { font-family: var(--font-mono); font-size: 9px; fill: var(--muted); }
.ex-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; }
.ex-tabs::-webkit-scrollbar { height: 0; }
.ex-tab {
  flex: 0 0 auto; padding: 8px 12px; min-height: 36px; border: 1px solid var(--border);
  border-radius: 999px; font-size: 13.5px; color: var(--muted); transition: all .15s ease;
}
.ex-tab:hover { border-color: var(--fg); color: var(--fg); }
.ex-tab[aria-pressed="true"] { background: var(--fg); border-color: var(--fg); color: var(--bg); }

/* ─── 抽屉 / 底部面板 ────────────────────────────────────────── */
.scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,.45); z-index: 40;
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.scrim.is-on { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 50;
  background: var(--surface); border-top: 1px solid var(--border);
  border-radius: 18px 18px 0 0;
  padding: 10px calc(20px + env(safe-area-inset-right)) max(30px, calc(env(safe-area-inset-bottom) + 12px)) calc(20px + env(safe-area-inset-left));
  transform: translateY(102%); transition: transform .24s cubic-bezier(.22,.8,.3,1);
  max-height: 88%; overflow-y: auto;
}
.sheet.is-on { transform: none; }
.sheet-grip { width: 38px; height: 4px; border-radius: 99px; background: var(--border); margin: 0 auto 14px; }
.sheet-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.sheet-title h2 { font-size: var(--fs-h2); font-weight: 650; letter-spacing: -.015em; }
.sheet-title .st-sub { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.sheet-close { position: absolute; top: 14px; right: 14px; }

/* 编辑态大数字 */
.edit-big {
  text-align: center; padding: 6px 0 14px; border-bottom: 1px solid var(--border);
  user-select: none; touch-action: none; cursor: ns-resize;
}
.edit-big .eb-value {
  font-family: var(--font-mono); font-size: var(--fs-num-lg); font-weight: 650;
  letter-spacing: -.035em; font-variant-numeric: tabular-nums; line-height: 1;
  display: inline-flex; align-items: baseline; gap: 6px;
}
.edit-big .eb-value .eb-unit { font-size: 15px; color: var(--muted); font-weight: 500; }
.edit-big .eb-hint { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); margin-top: 9px; }
.edit-big.is-dragging { background: var(--ink-soft); border-radius: var(--radius); }
.edit-big.is-dragging .eb-value { color: var(--accent); }
.edit-big .eb-prev { font-family: var(--font-mono); font-size: 12px; color: var(--muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.edit-big .eb-prev button { text-decoration: underline; text-underline-offset: 2px; color: var(--muted); padding: 4px; border-radius: 4px; }
.edit-big .eb-prev button:hover { color: var(--fg); }

.stepper { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 18px; }
.step-btn {
  height: var(--tap-main); border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--font-mono); font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums;
  display: grid; place-items: center; transition: all .12s ease; user-select: none;
}
.step-btn:hover { border-color: var(--fg); background: var(--ink-soft); }
.step-btn:active { transform: translateY(1px); }
.step-btn.is-step { font-size: 14.5px; font-weight: 550; }
.step-btn.is-holding { background: var(--fg); border-color: var(--fg); color: var(--bg); }

.quick { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.quick button {
  flex: 1 1 auto; min-height: var(--tap); padding: 0 12px; border: 1px solid var(--border);
  border-radius: 999px; font-family: var(--font-mono); font-size: 13px;
  font-variant-numeric: tabular-nums; transition: all .12s ease; white-space: nowrap;
}
.quick button:hover { border-color: var(--fg); background: var(--ink-soft); }
.quick button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.sheet-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.mini-field { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; text-align: left; }
.mini-field .mf-label { font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.mini-field .mf-value { font-family: var(--font-mono); font-size: var(--fs-num-md); font-weight: 600; font-variant-numeric: tabular-nums; }
.mini-field.is-off { opacity: .55; }
.mini-field.is-on { border-color: var(--accent); }
.mini-field.is-on .mf-value { color: var(--accent); }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }

/* 面板列表 */
.opt-list { display: flex; flex-direction: column; gap: 8px; }
.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  min-height: var(--tap-main); padding: 0 14px; border: 1px solid var(--border);
  border-radius: var(--radius); transition: all .15s ease;
}
.opt:hover { border-color: var(--fg); background: var(--ink-soft); }
.opt[aria-pressed="true"] { border-color: var(--fg); }
.opt .o-name { font-size: 16px; font-weight: 500; }
.opt .o-sub { font-size: 12.5px; color: var(--muted); margin-top: 1px; }
.opt .o-right { margin-left: auto; font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.opt .o-tick { margin-left: auto; width: 18px; height: 18px; color: var(--fg); opacity: 0; }
.opt[aria-pressed="true"] .o-tick { opacity: 1; }
.opt.is-danger .o-name { color: var(--fg); }
.opt.is-danger:hover { border-color: var(--muted); }

/* 设置抽屉 */
.set-group { padding: 16px 0; border-top: 1px solid var(--border); }
.set-group:first-of-type { border-top: 0; padding-top: 4px; }
.set-group > h3 {
  font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 10px; font-weight: 500;
}
/* 备份告警：本产品最重要的一个提醒。左侧琥珀色条 + 浅底，正文用前景色保证可读 */
.backup-warn {
  position: relative; display: flex; gap: 11px; padding: 14px 14px 14px 18px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: color-mix(in oklch, var(--accent) 7%, transparent); margin-bottom: 12px;
}
.backup-warn::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--accent); border-radius: var(--radius) 0 0 var(--radius);
}
.backup-warn svg { width: 19px; height: 19px; flex: 0 0 auto; color: var(--accent); margin-top: 1px; }
.backup-warn .bw-txt { font-size: 13px; line-height: 1.6; color: var(--fg); }
.backup-warn .bw-txt strong { display: block; font-size: 14px; margin-bottom: 3px; }
.btn-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ver-line {
  display: flex; align-items: baseline; justify-content: space-between;
  font-family: var(--font-mono); font-size: 12.5px; color: var(--muted); padding: 5px 0;
}
.ver-line .vl-k { }
.ver-line .vl-v { color: var(--fg); font-variant-numeric: tabular-nums; }

/* 导入用的多行文本框（原型里靠 .textarea + 行内样式，这里落成类） */
.textarea {
  width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--fg); outline: none; resize: vertical;
}
.textarea:focus { border-color: var(--fg); }

/* 面板永远在遮罩之上，否则点面板等于点遮罩 */
.sheet { z-index: 50; }

/* toast */
.toast {
  position: absolute; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom));
  transform: translate(-50%, 8px);
  z-index: 70; background: var(--fg); color: var(--bg); font-size: 13.5px;
  /* pointer-events:none 是隐藏态（含长文案被点掉之后）的保证：永远不挡住下面的内容 */
  padding: 10px 16px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; max-width: 300px; text-align: center;
}
/* 只有亮着的时候才接收点击 —— 「点一下立刻收起」，见 src/app.js 的 toast() */
.toast.is-on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }

/* 320pt 窄屏：动作卡片格子收一点，避免横向滚动（设计硬约束：最小支持到 320） */
@media (max-width: 340px) {
  .list { padding: 14px 14px 8px; }
  .appbar { padding-left: 14px; padding-right: 14px; }
  .actionbar { padding-left: 14px; padding-right: 14px; }
  .set-head, .set-row { grid-template-columns: 28px 1fr 1fr var(--tap); }
  .set-row .v-main { font-size: 19px; }
}
