﻿/* ============================================================================
   犟驴 · 设计系统
   手写 CSS，零外部依赖、零 CDN（铁规：国内直连可用）。

   语言：冷白 · 墨 · 青绿
   · 底是冷白（#f7fbfc），不是暖米 —— 这套视觉的根换成「干净」而非「温润」
   · 卡片纯白浮在冷白底上，靠描边分层，不靠重阴影
   · 主色青绿 #16808f，克制使用：只有主按钮 / 选中态 / 进行中 / 强调
   · 字重最高 600：粗体显笨，600 才有"精致"

   断点：≤560 手机 / 561–860 大屏手机与平板竖屏 / 861–1080 平板横屏 / >1080 桌面
   ========================================================================== */

/* ---------- 0. 基础：hidden 必须真的隐藏 ----------
   作者样式里的 display 会盖掉浏览器默认的 [hidden]{display:none}。
   .btn{display:inline-flex}、.file-chip{display:inline-flex} 都踩过这个坑：
   JS 把 hidden 设成 true，元素照样显示（上传后的文件名胶囊等）。
   这条一次性兜住整类问题，以后新组件不必各自写 [hidden] 特例。 */
[hidden] { display: none !important; }

/* ---------- 1. 设计令牌 ----------
   色值整体取自 jiangdekuai.com 实测（对站点 HTML / CSS 逐色统计后取的高频真相）：
     主色青绿 #16808f · 深一档 #0d5f6b · 浅青底 #e9fbfd / #f0fcfe · 点缀青 #62d6e3
     页面底 #f7fbfc（手机 #f6fafb）· 卡片 #ffffff / #fbfeff
     描边 slate-200 #e2e8f0 · 正文 #17191f · 次级 #334155 / #64748b / #94a3b8
     第三色用他们的紫 #5656bf（原来的青与主色撞了，换掉）
     diff 红绿沿用他们用的 red-100/700、emerald-100/700
   ========================================================================== */
:root {
  /* 主色：青绿（沿用 --ember 变量名，语义已改为「主色」） */
  --ember: #16808f;
  --ember-strong: #0d5f6b;
  --ember-soft: #e9fbfd;
  --ember-line: #b6e8ef;
  --on-primary: #ffffff;

  /* 点缀色：进行中 / 焦点 / 链接 */
  --accent: #2c7d8a;
  --accent-soft: #f0fcfe;
  --accent-line: #cdeef3;

  /* 文字：冷黑（带一点蓝），不用纯黑 */
  --ink: #17191f;
  --ink-2: #334155;
  --ink-3: #64748b;
  --ink-4: #94a3b8;

  /* 面：冷白底 + 近白卡片，靠描边分层，不靠重阴影 */
  --bg: #f7fbfc;
  --surface: #ffffff;
  --surface-2: #fbfeff;
  --surface-3: #f0fcfe;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;

  --ok: #0ea451;
  --ok-soft: #eaf9f0;
  --warn: #4b3100;
  --warn-soft: #fdf6e0;
  --warn-fill: #f8c846;
  --bad: #b91c1c;
  --bad-soft: #fee2e2;
  --info: #5656bf;
  --info-soft: #f1f1ff;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 20px;
  --r-xl: 28px;

  --shadow-1: 0 1px 2px rgba(15, 45, 55, .05);
  --shadow-2: 0 4px 16px -8px rgba(15, 45, 55, .14);
  --shadow-3: 0 18px 44px -22px rgba(15, 45, 55, .22);

  /* 参考成熟产品：几何人文无衬线，中文回落苹方/雅黑 */
  --sans: "Avenir Next", "Avenir", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --maxw: 1160px;
  --topbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ember: #62d6e3;
    --ember-strong: #8ce6f0;
    --ember-soft: #10313a;
    --ember-line: #1f4b56;
    --on-primary: #06222a;

    --accent: #7ad8e8;
    --accent-soft: #0f2a31;
    --accent-line: #1f4b56;

    --ink: #e8f1f4;
    --ink-2: #bccbd2;
    --ink-3: #8b9ba3;
    --ink-4: #64757e;

    --bg: #0c1417;
    --surface: #121c20;
    --surface-2: #162126;
    --surface-3: #1a272d;
    --line: #233239;
    --line-strong: #32454e;

    --ok: #34d399;
    --ok-soft: #0e2a1f;
    --warn: #f8c846;
    --warn-soft: #2e2610;
    --warn-fill: #f8c846;
    --bad: #f87171;
    --bad-soft: #351a1a;
    --info: #9e9eff;
    --info-soft: #1b1b33;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-2: 0 6px 20px -10px rgba(0, 0, 0, .65);
    --shadow-3: 0 16px 44px -22px rgba(0, 0, 0, .8);
  }
}

:root[data-theme="dark"] {
  --ember: #62d6e3;
  --ember-strong: #8ce6f0;
  --ember-soft: #10313a;
  --ember-line: #1f4b56;
  --on-primary: #06222a;

  --accent: #7ad8e8;
  --accent-soft: #0f2a31;
  --accent-line: #1f4b56;

  --ink: #e8f1f4;
  --ink-2: #bccbd2;
  --ink-3: #8b9ba3;
  --ink-4: #64757e;

  --bg: #0c1417;
  --surface: #121c20;
  --surface-2: #162126;
  --surface-3: #1a272d;
  --line: #233239;
  --line-strong: #32454e;

  --ok: #34d399;
  --ok-soft: #0e2a1f;
  --warn: #f8c846;
  --warn-soft: #2e2610;
  --warn-fill: #f8c846;
  --bad: #f87171;
  --bad-soft: #351a1a;
  --info: #9e9eff;
  --info-soft: #1b1b33;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-2: 0 6px 20px -10px rgba(0, 0, 0, .65);
  --shadow-3: 0 16px 44px -22px rgba(0, 0, 0, .8);
}

/* ---------- 2. 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.35; letter-spacing: -.015em; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }
p { margin: 0; }

a { color: inherit; text-decoration: none; }
a.link { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
button:disabled { cursor: not-allowed; }

::selection { background: var(--accent-soft); color: var(--ink); }

hr { border: 0; border-top: 1px solid var(--line); margin: 0; }

.num, .tabular { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .88em; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- 3. 布局骨架 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) {
  .topbar { background: color-mix(in srgb, var(--surface) 86%, transparent); backdrop-filter: saturate(180%) blur(14px); }
}
.topbar-inner {
  max-width: var(--maxw); height: 100%; margin: 0 auto;
  padding: 0 22px; display: flex; align-items: center; gap: 18px;
}

.brand { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: 0 0 auto;
  display: block; object-fit: contain;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-name { font-weight: 600; font-size: 16.5px; letter-spacing: -.02em; }
.brand-sub { font-size: 10.5px; color: var(--ink-4); letter-spacing: .06em; text-transform: uppercase; }

.nav { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.nav a {
  padding: 7px 13px; border-radius: 9px;
  font-size: 14px; font-weight: 550; color: var(--ink-3);
  transition: background .16s, color .16s;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--surface-3); }
.nav a.is-active { color: var(--ember); background: var(--ember-soft); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.shell { max-width: var(--maxw); margin: 0 auto; padding: 26px 22px 80px; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 6px;
}
.page-head .lede { color: var(--ink-3); font-size: 14px; margin-top: 6px; max-width: 62ch; }

/* ---------- 4. 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-pad { padding: 20px 22px; }
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 15px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 14.5px; }
.card-head .spacer { margin-left: auto; }
.card-body { padding: 18px 20px; }
.card-foot { padding: 13px 20px; border-top: 1px solid var(--line); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); }

.section-label {
  font-size: 11px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-4);
}

/* ---------- 5. 按钮：胶囊形，reference 语言 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 20px; border-radius: 999px;
  font-size: 14px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
  transition: background .16s, border-color .16s, color .16s, transform .08s, box-shadow .16s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; }

.btn-primary {
  background: var(--ember); color: var(--on-primary);
  box-shadow: 0 2px 8px -4px rgba(22, 128, 143, .5);
}
.btn-primary:hover:not(:disabled) { background: var(--ember-strong); }

.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }

.btn-quiet { background: transparent; color: var(--ink-3); }
.btn-quiet:hover:not(:disabled) { background: var(--surface-3); color: var(--ink); }

.btn-sm { height: 32px; padding: 0 14px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 28px; font-size: 15.5px; }
.btn-block { width: 100%; }

.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center;
  color: var(--ink-3); border: 1px solid transparent;
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- 6. 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-3); }

.input, .textarea, .select {
  width: 100%; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px;
  padding: 10px 12px; font-size: 14px; color: var(--ink);
  transition: border-color .16s, box-shadow .16s;
}
.input:focus, .textarea:focus, .select:focus {
  outline: 0; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.textarea { resize: vertical; line-height: 1.8; min-height: 120px; }
.select { appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-4) 50%), linear-gradient(135deg, var(--ink-4) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}

.input-sm, .select-sm { height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.select-sm { padding-right: 28px; background-position: calc(100% - 15px) 15px, calc(100% - 10px) 15px; }

/* 分段选择器 */
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--surface-3); border-radius: 10px; border: 1px solid var(--line); }
.seg button {
  padding: 6px 13px; border-radius: 7px; font-size: 13px; font-weight: 600;
  color: var(--ink-3); transition: background .16s, color .16s, box-shadow .16s;
}
.seg button:hover { color: var(--ink); }
.seg button.is-on { background: var(--surface); color: var(--ember); box-shadow: var(--shadow-1); }

/* 开关 */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; color: var(--ink-2); }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 38px; height: 22px; border-radius: 11px; background: var(--line-strong);
  position: relative; transition: background .18s; flex: 0 0 auto;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
  transition: transform .18s;
}
.switch input:checked + .track { background: var(--ember); }
.switch input:checked + .track::after { transform: translateX(16px); }

/* ---------- 7. 徽章 / 状态 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid transparent; white-space: nowrap;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 22%, transparent); }
.badge-bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 22%, transparent); }
.badge-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 22%, transparent); }
.badge-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 22%, transparent); }
.badge-neutral { background: var(--surface-3); color: var(--ink-3); border-color: var(--line); }
/* 处理中：实心深绿，与「已完成」的浅绿底形成明确区分 */
.badge-ember { background: var(--ember); color: var(--on-primary); border-color: var(--ember); }

/* ---------- 8. 进度 ---------- */
.bar { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); transition: width .4s ease; }
.bar.is-striped > i {
  background-image: linear-gradient(115deg, rgba(255, 255, 255, .35) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, .35) 50%, rgba(255, 255, 255, .35) 75%, transparent 75%, transparent);
  background-size: 16px 16px; animation: stripe .7s linear infinite;
}
@keyframes stripe { from { background-position: 0 0; } to { background-position: 32px 0; } }

.seg-dots { display: flex; flex-wrap: wrap; gap: 5px; }
.seg-dots i {
  width: 22px; height: 5px; border-radius: 3px; background: var(--line-strong);
  transition: background .3s;
}
.seg-dots i.is-done { background: var(--ok); }
.seg-dots i.is-run { background: var(--accent); animation: pulseSoft 1.1s ease-in-out infinite; }
@keyframes pulseSoft { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.spin {
  width: 15px; height: 15px; border-radius: 50%; flex: 0 0 auto;
  border: 2px solid color-mix(in srgb, currentColor 25%, transparent);
  border-top-color: currentColor;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- 10. 工作台 ---------- */
.work-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
@media (min-width: 1080px) {
  .work-grid { grid-template-columns: minmax(0, 430px) minmax(0, 1fr); align-items: start; }
  .work-grid > .work-side { position: sticky; top: calc(var(--topbar-h) + 18px); }
}

.editor {
  width: 100%; min-height: 260px; max-height: 52vh;
  background: var(--surface); border: 0; border-radius: 0;
  padding: 16px 18px; font-size: 14.5px; line-height: 1.9;
  resize: none; display: block;
}
.editor:focus { outline: 0; }
.editor::placeholder { color: var(--ink-4); }

.editor-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 16px; border-top: 1px solid var(--line);
  background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg);
  font-size: 12.5px; color: var(--ink-3);
}
.editor-foot .spacer { margin-left: auto; }
.char-count { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
/* 字数越界：只变字色，不加图标不加感叹号 —— 安静地告诉你哪里不对 */
.char-count.is-over { color: var(--bad); }
.char-count.is-under { color: var(--warn); }

.opts { display: flex; flex-direction: column; gap: 16px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.opt-row > .opt-label { font-size: 13px; color: var(--ink-2); font-weight: 550; }
.opt-row > .opt-ctl { display: flex; align-items: center; gap: 8px; }

/* 实况 */
.live-head { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14px; }
.live-stage {
  margin-top: 10px; font-size: 13px; color: var(--accent);
  font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px;
}
.timeline { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 0; }
.timeline li {
  position: relative; padding: 0 0 14px 22px; font-size: 13.2px; color: var(--ink-2);
}
.timeline li::before {
  content: ""; position: absolute; left: 4px; top: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: var(--line-strong);
}
.timeline li::after {
  content: ""; position: absolute; left: 7px; top: 15px; bottom: 0; width: 1px; background: var(--line);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline li.is-ok::before { background: var(--ok); }
.timeline li.is-run::before { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }

/* 结果 */
.result-top { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.figure { display: flex; flex-direction: column; gap: 2px; }
.figure .k { font-size: 11px; font-weight: 600; letter-spacing: .1em; color: var(--ink-4); }
.figure .v { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.figure .v.ok { color: var(--ok); }
.figure .v.bad { color: var(--bad); }
.figure .v.warn { color: var(--warn); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); padding: 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  padding: 12px 13px; font-size: 13.5px; font-weight: 600; color: var(--ink-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--ink); }
.tabs button.is-on { color: var(--ember); border-bottom-color: var(--ember); }

.prose {
  white-space: pre-wrap; word-break: break-word;
  font-size: 15px; line-height: 1.95; color: var(--ink);
  max-height: 60vh; max-height: 60dvh; overflow: auto; padding: 18px 20px;
}
.prose.sm { font-size: 13.6px; line-height: 1.85; }
.prose-box { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); }

/* 记录列表：桌面单行省略，手机卡片流里换两行 */
.rec-title {
  max-width: 460px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
}
.rec-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }

/* ---------- 11. 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tbl th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-4); padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); white-space: nowrap;
}
table.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: 0; }
table.tbl tbody tr { transition: background .13s; }
table.tbl tbody tr.is-link { cursor: pointer; }
table.tbl tbody tr.is-link:hover { background: var(--surface-2); }
table.tbl .r { text-align: right; }
table.tbl .nowrap { white-space: nowrap; }
.tbl-empty { padding: 56px 20px; text-align: center; color: var(--ink-3); }

.pager { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 16px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 32px; height: 32px; padding: 0 9px; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.pager a:hover { background: var(--surface-3); }
.pager .is-on { background: var(--ink); color: var(--surface); font-weight: 600; }
.pager .is-off { color: var(--ink-4); opacity: .5; }

/* ---------- 12. 杂项 ---------- */
.empty { text-align: center; padding: 64px 20px; }
.empty .empty-ico { color: var(--ink-4); margin-bottom: 14px; }
.empty h3 { margin-bottom: 6px; }
.empty p { color: var(--ink-3); font-size: 14px; }

.alert {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 15px; border-radius: var(--r-md); font-size: 13.5px;
  border: 1px solid transparent;
}
.alert-bad { background: var(--bad-soft); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 25%, transparent); }
.alert-warn { background: var(--warn-soft); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 25%, transparent); }
.alert-info { background: var(--info-soft); color: var(--info); border-color: color-mix(in srgb, var(--info) 25%, transparent); }
.alert-ok { background: var(--ok-soft); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 25%, transparent); }

.toast-host {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  background: var(--ink); color: var(--surface);
  padding: 10px 18px; border-radius: 11px; font-size: 13.5px; font-weight: 550;
  box-shadow: var(--shadow-3); animation: toastIn .22s cubic-bezier(.22, 1, .36, 1);
  max-width: min(90vw, 480px);
}
.toast.is-bad { background: var(--bad); color: #fff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 22px; }
.footer-inner {
  max-width: var(--maxw); margin: 0 auto; display: flex; gap: 14px;
  align-items: center; justify-content: space-between; flex-wrap: wrap;
  font-size: 12.5px; color: var(--ink-4);
}

/* 备案与主体信息：单独一行，页脚正中。监管要求「可见、可点」，
   所以不跟 slogan 挤在一行，也不做小到看不见的字号。 */
.footer-beian {
  max-width: var(--maxw); margin: 12px auto 0; padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  flex-wrap: wrap; gap: 8px;
  font-size: 12px; color: var(--ink-3); text-align: center;
}
.footer-beian .sep { opacity: .45; }
.footer-beian a { color: var(--ink-2); text-decoration: none; }
.footer-beian a:hover { color: var(--ember); text-decoration: underline; }

details.acc { border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface); overflow: hidden; }
details.acc + details.acc { margin-top: 8px; }
details.acc > summary {
  list-style: none; cursor: pointer; padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 600;
  background: var(--surface-2);
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after {
  content: ""; margin-left: auto; width: 7px; height: 7px;
  border-right: 1.5px solid var(--ink-4); border-bottom: 1.5px solid var(--ink-4);
  transform: rotate(45deg) translateY(-2px); transition: transform .18s;
}
details.acc[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.acc .acc-body { padding: 14px 16px; border-top: 1px solid var(--line); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 13.5px; margin: 0; }
.kv dt { color: var(--ink-3); white-space: nowrap; }
.kv dd { margin: 0; color: var(--ink); word-break: break-word; }

.chips { display: flex; gap: 7px; flex-wrap: wrap; }

/* ---------- 13. 移动端 ---------- */
.mobile-bar { display: none; }

@media (max-width: 860px) {
  :root { --topbar-h: 54px; }

  h1 { font-size: 21px; }
  h2 { font-size: 17px; }

  .topbar-inner { padding: 0 14px; gap: 10px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 15.5px; }
  .nav { gap: 0; margin-left: 0; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { padding: 6px 10px; font-size: 13px; }

  .shell { padding: 16px 13px 96px; }
  .card-pad { padding: 16px; }
  .card-head { padding: 13px 15px; }
  .card-body { padding: 15px; }

  /* 输入元件统一抬高到 iOS 不缩放的字号 */
  .input, .textarea, .select, .editor { font-size: 16px; }

  .work-grid { gap: 14px; }
  .editor { min-height: 190px; max-height: none; }
  .prose { max-height: none; padding: 15px 16px; }

  .page-head { margin-bottom: 15px; }
  .page-head .lede { font-size: 13px; }

  /* 底部常驻操作条：拇指可达 */
  .mobile-bar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    padding: 10px 13px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  @supports (backdrop-filter: blur(1px)) {
    .mobile-bar { background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(14px); }
  }
  .mobile-bar .mb-info { font-size: 12px; color: var(--ink-3); line-height: 1.3; }
  .mobile-bar .mb-info b { display: block; font-size: 13px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .mobile-bar .btn { flex: 1; }

  .toast-host { bottom: 78px; }

  .stat-grid { gap: 9px; }
  .stat { padding: 11px 12px; }
  .stat .v { font-size: 18px; }

  .result-top { gap: 14px; }
  .gauge { width: 74px; height: 74px; }
  .gauge .gauge-num { font-size: 17px; }

  table.tbl { font-size: 13px; }
  table.tbl th, table.tbl td { padding: 10px 11px; }

  .footer { margin-top: 26px; padding: 18px 14px; }
  .footer-inner { font-size: 12px; gap: 8px; }
  .footer-beian { margin-top: 10px; padding-top: 10px; gap: 6px; font-size: 11.5px; }
}

@media (max-width: 560px) {
  .shell { padding-left: 10px; padding-right: 10px; }
  .result-figures { gap: 12px; }
  .figure .v { font-size: 15.5px; }
  .tabs { padding: 0 6px; }
  .card { border-radius: var(--r-md); }
  .opts { gap: 13px; }
}

/* 触屏优化 */
@media (hover: none) {
  .btn, .icon-btn, .seg button, .nav a, .chip { min-height: 40px; }
  .icon-btn { min-width: 40px; }
  .tabs button { min-height: 44px; }
}

/* 打印：只要结果 */
@media print {
  .topbar, .mobile-bar, .footer, .no-print { display: none !important; }
  .shell { padding: 0; max-width: none; }
  .card { border: 0; box-shadow: none; }
  .prose { max-height: none; overflow: visible; }
}

/* 减少动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============================================================================
   14. 对比阅读（原文 ↔ 成品）
   **不做逐字高亮**：成品是重写不是编辑，逐字标会满屏染色（实测 98% 的字）。
   这里只给两类信号：篇幅变了多少（哪段被写胖/写瘦）、数字与人物有没有保住。
   ========================================================================== */
.cmp-body { display: flex; flex-direction: column; }
/* 段号作为段落前缀，不单独占一行 */
.cmp-txt .cmp-no { margin-right: 6px; vertical-align: middle; }

/* 对比视图的「并排/上下」切换：从对比控件内移出，放到页签操作行（复制成品前） */
.mode-seg {
  display: inline-flex; gap: 2px; padding: 2px;
  background: var(--surface-3); border: 1px solid var(--line); border-radius: 9px;
}
.mode-seg button {
  padding: 4px 11px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  white-space: nowrap;
}
.mode-seg button:hover { color: var(--ink); }
.mode-seg button.is-on { background: var(--surface); color: var(--ember); box-shadow: var(--shadow-1); }

/* 列头：一次说明「左边原文、右边成品」，替代每段重复的小标签。
   滚动时贴在顶栏下方，长文翻到中段也不会忘了哪边是哪边。 */
.cmp-cols {
  position: sticky; top: var(--topbar-h); z-index: 5;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  margin: 0 -20px;
  padding: 7px 0;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 600; letter-spacing: .06em; color: var(--ink-3);
}
.cmp-cols .cmp-col { padding-left: 14px; }
.cmp-cols .cmp-col + .cmp-col { border-left: 1px solid var(--line); }

/* 段落不再各装进一张卡片：连成一片读，段与段之间只用一条发丝线。
   一篇文章几十段时，卡片缝（每段 60px 上下）比正文还占地方。 */
.cmp-row {
  position: relative;
  background: var(--surface);
  border: 0;
  border-radius: 0;
  margin-bottom: 0;
}
.cmp-row + .cmp-row { border-top: 1px solid var(--line); }

/* 跳转后短暂描边，指明"就是这一段" */
.cmp-row.is-focus { outline: 2px solid var(--ember); outline-offset: -2px; }

.cmp-cell { padding: 10px 14px; min-width: 0; }
.cmp-cell + .cmp-cell { border-top: 1px solid var(--line); }
.cmp-cell.is-a { background: var(--surface-2); }
/* 单边为空（段数不齐）时不撑成一大块空白，压成一条细提示 */
.cmp-cell.is-void { padding: 4px 14px 6px; }

.cmp-no {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 5px;
  background: var(--surface-3); color: var(--ink-3);
  font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}

.cmp-txt {
  margin: 0; white-space: pre-wrap; word-break: break-word;
  font-size: 14.6px; line-height: 1.78; color: var(--ink);
}
.cmp-txt.is-empty { color: var(--ink-4); font-style: normal; font-size: 12px; line-height: 1.4; }

/* 并排：仅宽屏启用；窄屏自然回落成上下 */
@media (min-width: 900px) {
  .cmp.is-side .cmp-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
  .cmp.is-side .cmp-cell + .cmp-cell { border-top: 0; border-left: 1px solid var(--line); }
  .cmp.is-side .cmp-cell { display: flex; flex-direction: column; }
  /* 并排时右侧那列不必重复段号，中线已经说明了对应关系 */
  .cmp.is-side .cmp-cell + .cmp-cell .cmp-no { display: none; }
  .cmp.is-compact.is-side .cmp-cell.is-void { align-items: center; justify-content: center; }
}

/* 堆叠模式（窄屏）没有列头，段首那个极小角标就派上用场 */
.cmp:not(.is-side) .cmp-cols { display: none; }

.cmp-empty { padding: 44px 16px; text-align: center; color: var(--ink-3); font-size: 14px; }

@media (max-width: 860px) {
  .cmp-txt { font-size: 15.2px; line-height: 1.82; }
  .cmp-cell { padding: 9px 13px; }
  .cmp-cell.is-void { padding: 4px 13px 6px; }
}

/* ============================================================================
   15. 工作台（单列全宽）：输入框吃满整行宽度，参数压成一条
   输入文本通常很长，左窄右宽的双栏会把人憋死，所以改成上下结构。
   ========================================================================== */
.input-card .editor-lg {
  min-height: 360px;
  max-height: 62vh;
  font-size: 15px;
  line-height: 1.95;
  resize: vertical;
}

.param-bar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--r-lg) var(--r-lg);
}
.pb-item { display: flex; align-items: center; gap: 9px; }
.pb-label {
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  white-space: nowrap;
}
.pb-spacer { margin-left: auto; }
.pb-item.is-dim { opacity: .45; }
.pb-hint { font-size: 11.5px; color: var(--ink-4); }

@media (max-width: 860px) {
  .input-card .editor-lg { min-height: 38vh; min-height: 38dvh; max-height: none; font-size: 16px; }
  .param-bar { flex-direction: column; align-items: stretch; gap: 13px; padding: 13px 15px; }
  .pb-item { justify-content: space-between; }
  .pb-spacer { display: none; }
  /* 手机上主操作交给底部常驻条，卡片里不再放第二个大按钮 */
  #startBtn { display: none; }
}

/* 输入卡片：让底部的参数条贴合圆角，中间的 editor-foot 不再自带下圆角 */
.input-card { overflow: hidden; }
.input-card .editor-foot { border-radius: 0; }

/* ============================================================================
   16. 精修：首页 Hero / 结果仪表区 / 面板留白
   目标「简约而不简单」：靠字重、字距与留白的节奏分层，不靠多加边框和色块。
   ========================================================================== */

/* ---------- 首页 Hero：只保留两层，一屏就能开工 ---------- */
.hero { margin-bottom: 18px; }
.hero h1 {
  font-size: 34px; line-height: 1.32; font-weight: 600; letter-spacing: -.028em;
  color: var(--ink); margin: 0;
}
.hero h1 span { color: var(--ink-3); font-weight: 500; }

.hero-sub {
  margin: 10px 0 0;
  font-size: 15px; line-height: 1.7; color: var(--ink-3);
  /* 整句一行约需 570px，给足 68ch(≈600px) 才不会在「…不收费」处断开 */
  max-width: 68ch;
  /* 折行时避免最后一行只剩一两个字（浏览器支持时生效，不支持也不影响） */
  text-wrap: pretty;
}
.hero-sub b { color: var(--ink); font-weight: 600; }
/* 「不收费」是一个词，不能被折行拆成「不收 / 费」。
   只对这三字局部 nowrap：既保住语义完整，又不会像整段 nowrap 那样撑破窄屏。 */
.nb { white-space: nowrap; }

@media (max-width: 860px) {
  .hero { margin-bottom: 14px; }
  .hero h1 { font-size: 21px; line-height: 1.35; letter-spacing: -.02em; }
  .hero-sub { margin-top: 8px; font-size: 13.5px; }
}

/* ---------- 结果区：右指标 ---------- */
.result-top { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.rt-figs {
  margin-left: auto;
  display: grid; grid-auto-flow: column; grid-auto-columns: auto;
  gap: 0 26px;
  padding-left: 26px;
  border-left: 1px solid var(--line);
}
.rt-figs .figure { align-items: flex-start; }
.rt-figs .figure .v { font-size: 18px; }

@media (max-width: 1000px) {
  .rt-figs { gap: 0 20px; padding-left: 20px; }
  .rt-figs .figure .v { font-size: 16px; }
}
@media (max-width: 860px) {
  .result-top { gap: 16px; }
  .rt-figs {
    margin-left: 0; width: 100%;
    grid-auto-flow: column; grid-auto-columns: max-content;
    justify-content: flex-start;
    gap: 0 20px;
    padding-left: 0; padding-top: 14px;
    border-left: 0; border-top: 1px solid var(--line);
  }
}

/* ---------- 面板：统一的留白节奏 ---------- */
.pane { padding: 16px 20px 18px; }
@media (max-width: 860px) {
  .pane { padding: 14px 15px 16px; }
}

/* ============================================================================
   17. 移动端重做（2026-10-26）
   目标：手机上不是「桌面版缩小」，而是重新排。原则——
   · 表格改卡片流，不再左右拖
   · 工具条在窄屏只留必要开关
   · 触控目标 ≥ 40px
   · 键盘弹起时底部操作条让位，不遮挡输入
   · 没有底部条的页面不白吃底部留白
   ========================================================================== */

/* ---------- 17.1 视口高度：iOS 地址栏收起时不跳变 ---------- */
.editor { max-height: 52vh; max-height: 52dvh; }
.input-card .editor-lg { max-height: 62vh; max-height: 62dvh; }

/* ---------- 17.2 底部留白：只有真的有底栏的页面才留 ---------- */
@media (max-width: 860px) {
  .shell { padding-bottom: 32px; }
  body.has-mbar .shell { padding-bottom: 96px; }
  /* 键盘弹起：底栏让位，输入区不被压住 */
  body.kb-open .mobile-bar { display: none !important; }
  body.kb-open .shell { padding-bottom: 24px; }
}

/* ---------- 17.3 记录页：桌面表格 → 手机卡片流 ---------- */
.filter-panel { margin-bottom: 16px; }
.filter-panel > summary {
  list-style: none; cursor: pointer;
  display: none;
  align-items: center; gap: 8px;
  padding: 12px 15px;
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.filter-panel > summary::-webkit-details-marker { display: none; }
.filter-panel > summary::after {
  content: ""; width: 7px; height: 7px; margin-left: auto;
  border-right: 2px solid var(--ink-4); border-bottom: 2px solid var(--ink-4);
  transform: rotate(45deg) translateY(-2px); transition: transform .18s;
}
.filter-panel[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
.filter-body {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 15px;
}
.filter-body .input { flex: 1 1 180px; min-width: 0; max-width: none !important; }
.filter-body .select { flex: 0 0 128px; width: auto !important; }
.filter-count { color: var(--ink-4); font-size: 12.5px; margin-left: auto; }

@media (max-width: 860px) {
  .filter-panel > summary { display: flex; }
  .filter-body { padding: 14px; }
}

@media (max-width: 700px) {
  /* 表格变卡片：每行一张卡，字段用 data-label 标注 */
  table.tbl, table.tbl tbody, table.tbl tr, table.tbl td { display: block; width: 100%; }
  table.tbl thead { display: none; }
  table.tbl tr {
    border: 1px solid var(--line); border-radius: var(--r-md);
    padding: 12px 13px; margin-bottom: 10px; background: var(--surface);
  }
  table.tbl tr:last-child { margin-bottom: 0; }
  table.tbl td {
    display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
    padding: 6px 0; border-bottom: 0; text-align: left !important;
  }
  table.tbl td::before {
    content: attr(data-label);
    flex: none; color: var(--ink-4); font-size: 12px; font-weight: 600;
  }
  table.tbl td[data-label=""]::before { content: none; }
  table.tbl td.cell-main {
    display: block; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px;
  }
  table.tbl td.cell-main::before { display: none; }
  table.tbl td.cell-main .rec-title {
    max-width: none;
    font-size: 14.5px; font-weight: 600; color: var(--ink);
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  table.tbl td.cell-main .rec-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 3px; }
  .pager a, .pager span { min-width: 38px; height: 38px; }
}

/* ---------- 17.4 对比阅读：窄屏只留必要开关 ---------- */
@media (max-width: 900px) {
  .cmp-cell { padding: 9px 13px; }
  .cmp-cell.is-void { padding: 4px 13px 6px; }
  .cmp-txt { font-size: 15.4px; line-height: 1.8; }
}

/* ---------- 17.5 触控目标 ---------- */
@media (hover: none) {
  .seg button, .pager a, .pager span,
  .filter-panel > summary { min-height: 42px; }
  .filter-body .input, .filter-body .select { min-height: 42px; }
}

/* ============================================================================
   18. 视觉细节：焦点 / 滚动条
   ========================================================================== */
/* 键盘可达性：焦点用唯一的点缀色；鼠标点击不画圈 */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 桌面端细滚动条，去掉系统默认的粗灰条 */
@media (pointer: fine) {
  * { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
  ::-webkit-scrollbar { width: 10px; height: 10px; }
  ::-webkit-scrollbar-thumb {
    background: var(--line-strong); border-radius: 6px;
    border: 3px solid var(--bg);
  }
  ::-webkit-scrollbar-track { background: transparent; }
}

/* ============================================================================
   19. 语言精修（对齐成熟产品的观感）
   ========================================================================== */

/* 顶栏：白色半透明毛玻璃，贴在米色纸上 */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
@supports (backdrop-filter: blur(1px)) {
  .topbar {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    backdrop-filter: saturate(160%) blur(16px);
  }
}

/* 品牌名与导航：字重降下来，靠字号和间距分层 */
.brand-name { font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 10px; letter-spacing: .08em; color: var(--ink-4); }
.nav a { padding: 8px 14px; border-radius: 999px; font-size: 14px; }
.nav a.is-active { background: var(--ember-soft); color: var(--ember-strong); }

/* 主标题：大字 + 600 字重，行距放宽 */
.hero h1 {
  font-size: 34px; line-height: 1.32; font-weight: 600;
  letter-spacing: -.028em;
}
.hero h1 span { color: var(--ink-3); font-weight: 500; }

/* 卡片：大圆角 + 极淡阴影，靠描边分层 */
.card { border-radius: var(--r-lg); box-shadow: var(--shadow-1); }

/* 输入框：圆角加大、描边柔和 */
.input, .textarea, .select { border-radius: var(--r-md); border-color: var(--line-strong); }
.editor { border-radius: 0; }

/* 分段选择器：胶囊化 */
.seg { border-radius: 999px; padding: 4px; }
.seg button { border-radius: 999px; padding: 5px 16px; }
.seg button.is-on { background: var(--surface); color: var(--ember-strong); box-shadow: var(--shadow-1); }

/* 标签/徽标：胶囊 */
.badge { border-radius: 999px; padding: 2px 10px; font-weight: 600; }
.input-sm, .select-sm { border-radius: 999px; padding: 6px 14px; }

/* 页脚：与米底融合 */
.footer { border-top: 1px solid var(--line); background: transparent; }
.footer-inner { color: var(--ink-4); font-size: 12.5px; }

/* 米底上滚动条也带暖意 */
@media (pointer: fine) {
  ::-webkit-scrollbar-thumb { border-color: var(--bg); }
}

/* ============================================================================
   20. 结果卡：「页签 + 操作」同一行
   左边切视图（最终成品 / 对比阅读），右边立刻能拿走成品。
   原来三个按钮挂在卡片底部，用户看完正文还要滚下去找，多一步就多一次流失。
   ========================================================================== */
.tabs-bar {
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 0 14px 0 6px;
  /* 页签自己会横向滚动，外框不允许被撑破 */
  min-width: 0;
}
.tabs-bar .tabs {
  flex: 0 1 auto; min-width: 0;
  border-bottom: 0;
  padding: 0;
}
.tabs-actions {
  flex: 0 0 auto;
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}

/* 中等宽度：按钮组收成小尺寸，避免把页签挤没 */
@media (max-width: 1000px) {
  .tabs-bar { gap: 10px; }
  .tabs-actions { gap: 6px; }
  .tabs-actions .btn { padding: 0 12px; font-size: 12.5px; }
}

/* 窄屏：页签占一行，操作另起一行靠右 —— 硬塞会挤出屏幕 */
@media (max-width: 760px) {
  .tabs-bar {
    flex-wrap: wrap; gap: 0;
    padding: 0;
  }
  .tabs-bar .tabs {
    flex: 1 1 100%;
    padding: 0 8px;
    border-bottom: 1px solid var(--line);
  }
  .tabs-actions {
    flex: 1 1 100%;
    margin-left: 0;
    padding: 9px 12px;
    /* 三个按钮一行放不下就换行，绝不允许撑破卡片 */
    flex-wrap: wrap;
    gap: 8px;
  }
  .tabs-actions .btn {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0 10px;
    font-size: 12.5px;
  }
}

/* ---------- 21. 上传文件 ---------- */

/* 文件来源标记：只在真的上传过时出现，是个胶囊，跟字数统计同一行 */
.file-chip {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 48%; padding: 1px 4px 1px 10px;
  border-radius: 999px; background: var(--surface-3);
  color: var(--ink-2); line-height: 19px;
}
.file-chip > span {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.file-chip > button {
  flex: 0 0 auto;
  width: 17px; height: 17px; padding: 0;
  border: 0; border-radius: 50%; background: transparent;
  color: var(--ink-4); font-size: 13px; line-height: 1;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
}
.file-chip > button:hover { background: var(--line); color: var(--ink); }

/* 拖拽：整张卡亮一下边界，编辑器换成虚线，明确告诉用户「松手就行」 */
.input-card.is-drag { border-color: var(--accent); }
.input-card.is-drag .editor {
  border: 1px dashed var(--accent);
  background: var(--surface-2);
}

/* 窄屏：卡片头挤不下两个按钮，允许换行，别把「清空」挤出屏幕 */
@media (max-width: 620px) {
  .input-card .card-head { flex-wrap: wrap; row-gap: 8px; }
  .input-card .card-head .spacer { flex: 1 1 0; }
  .file-chip { max-width: 100%; }
}

/* ---------- 22. 账号（顶栏登录态） ---------- */

/* 用 <details> 做下拉：不引 JS，点外面靠浏览器默认行为关闭（点别处再点回来即可收起） */
.user-menu { position: relative; }
.user-menu > summary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 12px 0 5px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); cursor: pointer;
  list-style: none; user-select: none;
  transition: border-color .16s, background .16s;
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { border-color: var(--line-strong); }
.user-menu[open] > summary { border-color: var(--accent); }

.user-face {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  object-fit: cover; background: var(--surface-3); display: block;
}
.user-face-text {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600;
  color: var(--ember); background: var(--ember-soft);
}
.user-name {
  max-width: 8em; font-size: 13px; color: var(--ink-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.user-pop {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40;
  min-width: 172px; padding: 6px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-2);
}
.user-pop-head {
  padding: 7px 10px 8px; margin-bottom: 2px;
  font-size: 12px; color: var(--ink-4);
  border-bottom: 1px solid var(--line);
}
.user-item {
  display: block; width: 100%; box-sizing: border-box;
  padding: 9px 10px; border: 0; border-radius: 8px;
  background: transparent; text-align: left; text-decoration: none;
  font: inherit; font-size: 13.5px; color: var(--ink); cursor: pointer;
}
.user-item:hover { background: var(--surface-2); }
.user-item.is-danger { color: var(--bad); }

.login-link { height: 34px; padding: 0 15px; font-size: 13px; }

@media (max-width: 620px) {
  .user-name { display: none; }
  .user-menu > summary { padding: 0 5px 0 4px; }
  .login-link { padding: 0 11px; font-size: 12.5px; }
}

/* ============================================================================
   21. 购买 / 支付弹窗 / 我的额度
   全部走设计令牌，深色自动跟随。二维码弹窗刻意做成「一张白纸上的码」：
   二维码周围必须是纯白，否则扫不出来——所以 .pay-qr 底下强制白底，不跟主题。
   ========================================================================== */
.buy-sec { margin: 22px 0 8px; }
.buy-sec h2 { font-size: 15px; font-weight: 600; }
.buy-sec p { color: var(--ink-3); font-size: 13px; margin-top: 5px; }

.buy-grid {
  display: grid; gap: 14px; margin-top: 14px;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
}
.buy-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 18px 18px 16px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-1); transition: border-color .16s, box-shadow .16s, transform .16s;
}
.buy-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.buy-card.is-featured { border-color: var(--ember-line); box-shadow: 0 0 0 1px var(--ember-line), var(--shadow-2); }
.buy-card.is-featured::before {
  content: "推荐"; position: absolute; top: -9px; left: 16px;
  padding: 2px 8px; border-radius: 999px;
  background: var(--ember); color: var(--on-primary);
  font-size: 10.5px; font-weight: 600; letter-spacing: .04em;
}

.buy-name { font-size: 14px; font-weight: 600; color: var(--ink); }
.buy-quota { font-size: 24px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); line-height: 1.15; }
.buy-quota small { font-size: 12.5px; font-weight: 500; color: var(--ink-3); margin-left: 3px; }
.buy-sub { font-size: 12.5px; color: var(--ink-3); line-height: 1.55; min-height: 2.1em; }

.buy-price-row { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.buy-price { font-size: 19px; font-weight: 600; color: var(--ember); font-variant-numeric: tabular-nums; }
.buy-was { font-size: 12px; color: var(--ink-4); text-decoration: line-through; font-variant-numeric: tabular-nums; }
.buy-unit { font-size: 11.5px; color: var(--ink-4); font-variant-numeric: tabular-nums; }

.buy-sale {
  display: inline-flex; align-items: center; gap: 4px; align-self: flex-start;
  padding: 2px 8px; border-radius: 999px;
  background: var(--bad-soft); color: var(--bad);
  font-size: 11px; font-weight: 600;
}

/* ---------- 支付弹窗 ---------- */
.pay-modal {
  position: fixed; inset: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(8, 32, 38, .42);
  backdrop-filter: blur(3px);
  animation: payIn .16s ease-out;
}
@keyframes payIn { from { opacity: 0 } to { opacity: 1 } }

.pay-box {
  width: min(400px, 100%);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  overflow: hidden; animation: payUp .2s cubic-bezier(.2, .8, .3, 1);
}
@keyframes payUp { from { opacity: 0; transform: translateY(10px) scale(.985) } to { opacity: 1; transform: none } }

.pay-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.pay-head h3 { font-size: 14px; font-weight: 600; }
.pay-head .pay-amt { margin-left: auto; font-size: 15px; font-weight: 600; color: var(--ember); font-variant-numeric: tabular-nums; }
.pay-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border: 0; border-radius: 8px;
  background: transparent; color: var(--ink-3); cursor: pointer; font-size: 18px; line-height: 1;
}
.pay-close:hover { background: var(--surface-3); color: var(--ink); }

.pay-body { padding: 16px; }

/* 二维码区：强制白底。二维码带透明底或深色底会扫不出来，这里不跟主题走。 */
.pay-qr {
  background: #ffffff; border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; display: flex; align-items: center; justify-content: center;
  min-height: 292px;
}
.pay-qr iframe { width: 100%; height: 300px; border: 0; display: block; background: #fff; }
.pay-qr img { display: block; max-width: 100%; }

.pay-tip { margin-top: 12px; font-size: 12.5px; color: var(--ink-3); text-align: center; line-height: 1.6; }
.pay-tip b { color: var(--ink); font-variant-numeric: tabular-nums; }

.pay-loading { display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--ink-3); font-size: 13px; padding: 40px 0; }
.pay-spin {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--line-strong); border-top-color: var(--ember);
  animation: paySpin .8s linear infinite;
}
@keyframes paySpin { to { transform: rotate(360deg) } }

.pay-ok { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 34px 0; }
.pay-ok-ico {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ok-soft); color: var(--ok); font-size: 22px;
}
.pay-ok h4 { font-size: 15px; font-weight: 600; }
.pay-ok p { font-size: 13px; color: var(--ink-3); }

/* ---------- 我的额度 ---------- */
.wallet-top {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 20px 22px;
}
.wallet-num { font-size: 30px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; }
.wallet-num small { font-size: 13px; font-weight: 500; color: var(--ink-3); margin-left: 4px; }
.wallet-kv { display: flex; gap: 22px; flex-wrap: wrap; margin-left: auto; }
.wallet-kv > div { display: flex; flex-direction: column; gap: 2px; }
.wallet-kv .k { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-4); }
.wallet-kv .v { font-size: 13.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }

.redeem { display: flex; gap: 9px; flex-wrap: wrap; align-items: flex-end; }
.redeem .field { flex: 1 1 220px; }

.led-row {
  display: grid; grid-template-columns: 92px 1fr auto;
  gap: 10px; align-items: center;
  padding: 11px 0; border-top: 1px solid var(--line);
  font-size: 13px;
}
.led-row:first-child { border-top: 0; }
.led-row .t { color: var(--ink-4); font-size: 12px; font-variant-numeric: tabular-nums; }
.led-row .n { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.led-row .n em { font-style: normal; color: var(--ink-3); }
.led-row .d { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.led-row .d.in { color: var(--ok); }
.led-row .d.out { color: var(--ink-2); }

@media (max-width: 560px) {
  .buy-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .buy-card { padding: 14px; }
  .buy-quota { font-size: 20px; }
  .wallet-top { padding: 16px; }
  .wallet-kv { margin-left: 0; width: 100%; }
  .led-row { grid-template-columns: 78px 1fr auto; font-size: 12.5px; }
}

/* 小工具：整站只加这两个，别让模板里散落一堆 inline margin */
.mb { margin-bottom: 16px; }
.tiny { font-size: 12px; line-height: 1.6; }

/* ---------- 工作台：余额胶囊 ----------
   放在输入卡片标题行的「待处理」旁边——用户正是在这个位置才会想「我还够不够改」，
   比让他切到充值页看一眼再回来要省事。
   形状跟着 badge 走，但它是可点的，所以用主色的细描边把「能点」说出来。 */
.quota-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 9px; border-radius: 999px;
  border: 1px solid var(--ember-line); background: var(--ember-soft);
  color: var(--ember-strong); text-decoration: none;
  font-size: 12px; line-height: 1.5; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.quota-chip:hover {
  background: color-mix(in srgb, var(--ember) 12%, var(--surface));
  border-color: color-mix(in srgb, var(--ember) 38%, transparent);
}
.quota-chip .qk {
  font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  color: var(--ember); opacity: .78;
}
.quota-chip b { font-weight: 600; font-variant-numeric: tabular-nums; }
