/* Voicenotes 工作台 v1.5.0 · 设计系统（ADR-015）
 * - 6 套主题，全部通过语义 token 驱动；正文/按钮/破坏性确认对比度 ≥ 4.5:1。
 * - 动效：只在 prefers-reduced-motion: no-preference 且未在设置里关闭（:root[data-motion="off"]）时运行位移/缩放；
 *   减少动效时退化为颜色/透明度。
 * - 图标：index.html 内联 <symbol> 线性图标，24×24 网格按尺寸光学调节线宽。
 */

/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, "Noto Sans Mono CJK SC", monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs: 0.875rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.25rem;
  --r-xs: 6px;
  --r-sm: 8px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 16px;
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --shell-max: min(100% - 56px, 1600px);
  --topbar-h: 56px;
  --drawer-w: clamp(440px, 34vw, 560px);

  /* 宣纸松绿（默认浅色：Linear/Vercel 石中性阶 + 松绿强调 + 3:1+ UI 边线对比） */
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #f2f2ef;
  --surface-3: #e8e8e3;
  --border: #e4e4df;
  --border-strong: #858b86;
  --text: #161817;
  --text-2: #464b48;
  --text-3: #5b625e;
  --accent: #146449;
  --accent-hover: #0f503a;
  --on-accent: #ffffff;
  --accent-soft: #e2efe9;
  --accent-ink: #11513b;
  --danger: #b42318;
  --danger-fill: #b42318;
  --on-danger: #ffffff;
  --danger-soft: #fdecea;
  --warn: #8a5200;
  --warn-soft: #fbf0dc;
  --ok: #146449;
  --ok-soft: #e2efe9;
  --ok-ink: #11513b;
  --star: #b3740e;
  --focus: #146449;
  --mark-bg: #fbe39b;
  --mark-text: #161817;
  --toast-bg: #161817;
  --toast-text: #f3f5f4;
  --toast-action-bg: rgb(255 255 255 / 0.14);
  --surface-highlight: inset 0 1px 0 rgb(255 255 255 / 0.7);
  --ring-border: 0 0 0 1px rgb(22 24 23 / 0.07), 0 1px 2px -1px rgb(22 24 23 / 0.05), 0 2px 4px 0 rgb(22 24 23 / 0.03);
  --ring-border-hover: 0 0 0 1px rgb(22 24 23 / 0.13), 0 2px 6px -1px rgb(22 24 23 / 0.08);
  --scrim: rgb(20 24 22 / 0.36);
  --shadow-1: 0 1px 2px rgb(20 24 22 / 0.04), 0 1px 3px rgb(20 24 22 / 0.03);
  --shadow-2: 0 1px 2px rgb(20 24 22 / 0.06), 0 8px 20px -6px rgb(20 24 22 / 0.12);
  --shadow-3: 0 2px 6px rgb(20 24 22 / 0.08), 0 24px 60px -12px rgb(20 24 22 / 0.24);
  --wave-idle: #858b86;
  --wave-rec: #c2362b;
  --wave-live: #146449;
  --rec: #c2362b;
  --rec-soft: #fbe6e4;
}

:root[data-theme="sky"] {
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #edf0f7;
  --surface-3: #e3e8f2;
  --border: #dce2ee;
  --border-strong: #7d889e;
  --text: #161e30;
  --text-2: #445068;
  --text-3: #59657d;
  --accent: #2e52c6;
  --accent-hover: #2442a6;
  --on-accent: #ffffff;
  --accent-soft: #e7ecfb;
  --accent-ink: #2340a0;
  --ok: #1f7a4d;
  --ok-soft: #e3efe8;
  --ok-ink: #195f3c;
  --focus: #2e52c6;
  --toast-bg: #161e30;
  --scrim: rgb(16 22 36 / 0.36);
  --wave-idle: #7d889e;
  --wave-live: #2e52c6;
}

:root[data-theme="sand"] {
  --bg: #f8f4ec;
  --surface: #fffdf9;
  --surface-2: #f3ede2;
  --surface-3: #ebe2d2;
  --border: #e6dcc9;
  --border-strong: #918470;
  --text: #2a2117;
  --text-2: #584b3a;
  --text-3: #6c5e49;
  --accent: #9c4c17;
  --accent-hover: #823e12;
  --on-accent: #ffffff;
  --accent-soft: #f7e8da;
  --accent-ink: #843f12;
  --ok: #3f6d2a;
  --ok-soft: #e3eedd;
  --ok-ink: #2d5a27;
  --focus: #9c4c17;
  --toast-bg: #2a2117;
  --scrim: rgb(30 22 14 / 0.36);
  --wave-idle: #918470;
  --wave-live: #9c4c17;
}

:root[data-theme="dark"],
:root[data-theme="midnight"] {
  color-scheme: dark;
}

:root[data-theme="dark"] {
  --bg: #111413;
  --surface: #181c1b;
  --surface-2: #1f2422;
  --surface-3: #272d2b;
  --border: #2a312e;
  --border-strong: #68736e;
  --text: #e8ecea;
  --text-2: #b4bcb8;
  --text-3: #969f9a;
  --accent: #5cc198;
  --accent-hover: #74d0aa;
  --on-accent: #0a1712;
  --accent-soft: #1c372c;
  --accent-ink: #8fe0be;
  --danger: #ff8a7f;
  --danger-fill: #c9342b;
  --on-danger: #ffffff;
  --danger-soft: #3a1c1a;
  --warn: #f0b85b;
  --warn-soft: #3a2c14;
  --ok: #5cc198;
  --ok-soft: #1c372c;
  --ok-ink: #8fe0be;
  --star: #f0b85b;
  --focus: #8fe0be;
  --mark-bg: #6b5410;
  --mark-text: #fff4cc;
  --toast-bg: #e8ecea;
  --toast-text: #151918;
  --toast-action-bg: rgb(0 0 0 / 0.09);
  --surface-highlight: inset 0 1px 0 rgb(255 255 255 / 0.04);
  --ring-border: 0 0 0 1px rgb(255 255 255 / 0.08);
  --ring-border-hover: 0 0 0 1px rgb(255 255 255 / 0.14);
  --scrim: rgb(0 0 0 / 0.56);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -8px rgb(0 0 0 / 0.6);
  --shadow-3: 0 2px 8px rgb(0 0 0 / 0.5), 0 24px 60px -12px rgb(0 0 0 / 0.75);
  --wave-idle: #68736e;
  --wave-rec: #ff7a6e;
  --wave-live: #5cc198;
  --rec: #ff6f62;
  --rec-soft: #3a1c1a;
}

:root[data-theme="midnight"] {
  --bg: #0c111d;
  --surface: #131a2b;
  --surface-2: #192136;
  --surface-3: #212a42;
  --border: #242e47;
  --border-strong: #617094;
  --text: #e5e9f4;
  --text-2: #b0b9d1;
  --text-3: #8c97b5;
  --accent: #7d9cff;
  --accent-hover: #98b1ff;
  --on-accent: #0a0f1f;
  --accent-soft: #1d2a52;
  --accent-ink: #aec0ff;
  --danger: #ff8f8a;
  --danger-fill: #c9343b;
  --on-danger: #ffffff;
  --danger-soft: #3a1d26;
  --warn: #f2bd63;
  --warn-soft: #362b17;
  --ok: #6fd3a5;
  --ok-soft: #172a25;
  --ok-ink: #8ce5bc;
  --star: #f2bd63;
  --focus: #aec0ff;
  --mark-bg: #5a4a14;
  --mark-text: #fff3c4;
  --toast-bg: #e5e9f4;
  --toast-text: #0e1422;
  --toast-action-bg: rgb(0 0 0 / 0.09);
  --surface-highlight: inset 0 1px 0 rgb(255 255 255 / 0.05);
  --ring-border: 0 0 0 1px rgb(255 255 255 / 0.09);
  --ring-border-hover: 0 0 0 1px rgb(255 255 255 / 0.16);
  --scrim: rgb(0 0 0 / 0.62);
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.45);
  --shadow-2: 0 1px 2px rgb(0 0 0 / 0.45), 0 8px 24px -8px rgb(0 0 0 / 0.65);
  --shadow-3: 0 2px 8px rgb(0 0 0 / 0.55), 0 24px 60px -12px rgb(0 0 0 / 0.8);
  --wave-idle: #617094;
  --wave-rec: #ff8178;
  --wave-live: #7d9cff;
  --rec: #ff7a70;
  --rec-soft: #3a1d26;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #111413;
    --surface: #181c1b;
    --surface-2: #1f2422;
    --surface-3: #272d2b;
    --border: #2a312e;
    --border-strong: #68736e;
    --text: #e8ecea;
    --text-2: #b4bcb8;
    --text-3: #909994;
    --accent: #5cc198;
    --accent-hover: #74d0aa;
    --on-accent: #0a1712;
    --accent-soft: #1c372c;
    --accent-ink: #8fe0be;
    --danger: #ff8a7f;
    --danger-fill: #c9342b;
    --on-danger: #ffffff;
    --danger-soft: #3a1c1a;
    --warn: #f0b85b;
    --warn-soft: #3a2c14;
    --ok: #5cc198;
    --ok-soft: #1c372c;
    --ok-ink: #8fe0be;
    --star: #f0b85b;
    --focus: #8fe0be;
    --mark-bg: #6b5410;
    --mark-text: #fff4cc;
    --toast-bg: #e8ecea;
    --toast-text: #151918;
    --toast-action-bg: rgb(0 0 0 / 0.09);
    --surface-highlight: inset 0 1px 0 rgb(255 255 255 / 0.04);
    --ring-border: 0 0 0 1px rgb(255 255 255 / 0.08);
    --ring-border-hover: 0 0 0 1px rgb(255 255 255 / 0.14);
    --scrim: rgb(0 0 0 / 0.56);
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 1px 2px rgb(0 0 0 / 0.4), 0 8px 24px -8px rgb(0 0 0 / 0.6);
    --shadow-3: 0 2px 8px rgb(0 0 0 / 0.5), 0 24px 60px -12px rgb(0 0 0 / 0.75);
    --wave-idle: #68736e;
    --wave-rec: #ff7a6e;
    --wave-live: #5cc198;
    --rec: #ff6f62;
    --rec-soft: #3a1c1a;
  }
}

/* ---------------------------------------------------------------- base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-block-start: calc(var(--topbar-h) + 12px);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--fs) / 1.6 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p { margin: 0; }
h2[tabindex="-1"]:focus { outline: none; }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.005em; line-height: 1.35; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: var(--accent-ink); text-underline-offset: 2px; }
code, kbd, pre { font-family: var(--mono); }
[hidden] { display: none !important; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
::selection { background: var(--accent-soft); color: var(--text); }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic {
  width: 18px;
  height: 18px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65px;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}
.ic * { vector-effect: non-scaling-stroke; }
.ic-sm { width: 14px; height: 14px; stroke-width: 1.75px; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: fixed;
  inset-inline-start: -999px;
  inset-block-start: 8px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-2);
}
.skip-link:focus { inset-inline-start: 12px; }

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid var(--border-strong);
  border-block-end-width: 2px;
  border-radius: var(--r-xs);
  background: var(--surface);
  color: var(--text-2);
  font: 500 0.75rem / 1 var(--mono);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
  user-select: none;
  touch-action: manipulation;
}
.btn:has(> .ic):has(> span) { padding-inline: 10px 12px; }
.btn > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.btn:disabled { opacity: 0.45; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-ink); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-danger { color: var(--danger); }
.btn-primary.btn-danger { background: var(--danger-fill); border-color: var(--danger-fill); color: var(--on-danger); }
.btn-icon { width: 34px; padding: 0; }
.btn-mini { min-height: 30px; padding: 0 10px; font-size: var(--fs-xs); }
.btn-mini:has(> .ic):has(> span) { padding-inline: 8px 10px; }
.btn-mini.btn-icon { width: 30px; }
.btn-xs { min-height: 26px; width: 26px; padding: 0; border-radius: var(--r-xs); }
.btn-xs .ic { width: 15px; height: 15px; stroke-width: 1.7px; }
.btn.is-confirming {
  width: auto;
  padding: 0 10px;
  background: var(--danger-fill);
  border-color: var(--danger-fill);
  color: var(--on-danger);
  font-weight: 600;
}
.btn.is-busy .ic { opacity: 0.6; }

@media (hover: hover) {
  .btn:not(:disabled):hover { background: var(--surface-2); color: var(--text); }
  .btn-quiet:not(:disabled):hover { background: var(--surface-3); }
  .btn-soft:not(:disabled):hover { background: var(--accent-soft); color: var(--accent-ink); filter: brightness(0.97); }
  .btn-primary:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); }
  .btn-danger:not(:disabled):hover { background: var(--danger-soft); color: var(--danger); }
  .btn.is-confirming:hover { background: var(--danger-fill); color: var(--on-danger); }
}
.btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); }

.btn-group { display: inline-flex; align-items: center; gap: 2px; }

/* ---------------------------------------------------------------- form controls */
input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="password"],
input[type="number"],
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs);
  line-height: 1.4;
}
select {
  appearance: none;
  padding-inline-end: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-3) 50%), linear-gradient(135deg, var(--text-3) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  text-overflow: ellipsis;
}
textarea { resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: var(--text-3); opacity: 1; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
input[type="checkbox"] {
  position: relative;
  width: 16px;
  height: 16px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
  cursor: pointer;
}
input[type="checkbox"]::after {
  content: "";
  position: absolute;
  inset: -4px;
}

/* switch: checkbox visually replaced by a track */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  color: var(--text);
  font-size: var(--fs-sm);
  cursor: pointer;
  user-select: none;
}
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
  position: relative;
  flex: none;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--border-strong);
}
.switch-track::after {
  content: "";
  position: absolute;
  inset-block-start: 2px;
  inset-inline-start: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--on-accent);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.25);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
[dir="rtl"] .switch input:checked + .switch-track::after { transform: translateX(-14px); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch-sm { min-height: 28px; gap: 8px; font-size: var(--fs-xs); color: var(--text-2); }
.switch-sm .switch-track { width: 28px; height: 16px; }
.switch-sm .switch-track::after { width: 12px; height: 12px; }
.switch-sm input:checked + .switch-track::after { transform: translateX(12px); }
[dir="rtl"] .switch-sm input:checked + .switch-track::after { transform: translateX(-12px); }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field-label { color: var(--text-2); font-size: var(--fs-sm); font-weight: 500; }
.field-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.field-row > input, .field-row > select { flex: 1 1 160px; }
.field-row > .btn { flex: none; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.field-note { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.55; }
.field-status:empty, .result-note:empty { display: none; }
.result-note { padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); color: var(--text-2); font-size: var(--fs-sm); }
.actions-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.option-row { display: flex; width: 100%; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 20;
  height: var(--topbar-h);
  padding-inline: max(28px, env(safe-area-inset-left)) max(28px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  border-block-end: 1px solid var(--border);
  backdrop-filter: saturate(1.4) blur(12px);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, var(--shell-max));
  height: 100%;
  margin: 0 auto;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; min-width: 0; }
.brand-emblem {
  display: grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-1);
}
.brand-emblem .ic { width: 17px; height: 17px; stroke-width: 1.9px; }
.brand-emblem-lg { width: 44px; height: 44px; border-radius: 12px; }
.brand-emblem-lg .ic { width: 22px; height: 22px; }
.brand-title { font-size: var(--fs-md); font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
.topbar-spacer { flex: 1 1 0; min-width: 0; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }
.palette-trigger { gap: 8px; min-width: 220px; justify-content: flex-start; border-color: var(--border-strong); background: var(--surface); color: var(--text-3); }
.palette-trigger .kbd-hint { margin-inline-start: auto; height: 20px; font-size: 0.75rem; }
.palette-trigger-text { font-weight: 400; }
.account-wrap, .theme-wrap { position: relative; }
.account-btn { max-width: 200px; }
.account-name { overflow: hidden; text-overflow: ellipsis; }
.account-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: var(--ok); }
.notes-toggle { position: relative; }
.notes-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.menu {
  position: absolute;
  inset-block-start: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 40;
  min-width: 240px;
  max-height: min(70vh, 480px);
  overflow: auto;
  overscroll-behavior: contain;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}
.menu-title { padding: 8px 10px 6px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: start;
}
.account-row .account-dot { background: var(--border-strong); }
.account-row.is-active { background: var(--accent-soft); color: var(--accent-ink); }
.account-row.is-active .account-dot { background: var(--accent); }
.account-row-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.account-row-plan { color: var(--text-3); font-size: var(--fs-xs); }
.account-menu-empty { padding: 8px 10px; color: var(--text-3); font-size: var(--fs-sm); }
.account-add { width: 100%; justify-content: flex-start; margin-block-start: 4px; }
@media (hover: hover) { .account-row:not(.is-active):hover { background: var(--surface-2); } }

.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.theme-menu { width: 300px; }
.theme-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  text-align: start;
}
.theme-card.is-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
@media (hover: hover) { .theme-card:not(.is-active):hover { background: var(--surface-2); } }
.theme-swatch {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  width: 36px;
  height: 24px;
  flex: none;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08);
}
.theme-swatch i { display: block; }
.theme-swatch[data-swatch="auto"] i:nth-child(1) { background: #f6f5f1; } .theme-swatch[data-swatch="auto"] i:nth-child(2) { background: #181c1b; } .theme-swatch[data-swatch="auto"] i:nth-child(3) { background: #1d6a50; }
.theme-swatch[data-swatch="light"] i:nth-child(1) { background: #f6f5f1; } .theme-swatch[data-swatch="light"] i:nth-child(2) { background: #e3efe8; } .theme-swatch[data-swatch="light"] i:nth-child(3) { background: #1d6a50; }
.theme-swatch[data-swatch="sky"] i:nth-child(1) { background: #f3f5fa; } .theme-swatch[data-swatch="sky"] i:nth-child(2) { background: #e7ecfb; } .theme-swatch[data-swatch="sky"] i:nth-child(3) { background: #2e52c6; }
.theme-swatch[data-swatch="sand"] i:nth-child(1) { background: #f8f4ec; } .theme-swatch[data-swatch="sand"] i:nth-child(2) { background: #f7e8da; } .theme-swatch[data-swatch="sand"] i:nth-child(3) { background: #9c4c17; }
.theme-swatch[data-swatch="dark"] i:nth-child(1) { background: #111413; } .theme-swatch[data-swatch="dark"] i:nth-child(2) { background: #1c372c; } .theme-swatch[data-swatch="dark"] i:nth-child(3) { background: #5cc198; }
.theme-swatch[data-swatch="midnight"] i:nth-child(1) { background: #0c111d; } .theme-swatch[data-swatch="midnight"] i:nth-child(2) { background: #1d2a52; } .theme-swatch[data-swatch="midnight"] i:nth-child(3) { background: #7d9cff; }
.theme-gallery { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.theme-gallery .theme-card { min-height: 56px; }
.theme-gallery .theme-swatch { width: 48px; height: 32px; }

/* ---------------------------------------------------------------- layout */
.shell { padding: 24px 28px 40px; }
html.has-statusbar .shell { padding-block-end: 72px; }
.col { width: min(100%, var(--shell-max)); margin: 0 auto; display: flex; flex-direction: column; gap: 22px; outline: none; }
.card {
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--ring-border);
}
.count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  padding: 0 7px;
  margin-inline-start: 4px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  vertical-align: 2px;
  font-variant-numeric: tabular-nums;
}
.count:empty { display: none; }

/* ---------------------------------------------------------------- capture（工作台顶部声学面板：同心圆角、无灰框嵌套、克制录音键） */
.capture { padding: 0; overflow: hidden; }
.capture-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  border-block-end: 1px solid var(--border);
  background: var(--surface);
}
.pane { padding: 14px 16px 16px; }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-sm); background: var(--surface-2); }
.seg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  touch-action: manipulation;
}
.seg-btn .ic { width: 15px; height: 15px; }
.seg-btn.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); }

.mic-deck {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 2px 0;
  border-radius: var(--r);
  background: transparent;
}
.rec-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-1);
}
.rec-btn .ic { width: 20px; height: 20px; }
.rec-icon-stack { position: relative; display: grid; place-items: center; width: 22px; height: 22px; }
.rec-icon-stack > * { grid-area: 1 / 1; }
.mic-live { width: 22px; height: 22px; opacity: 0; }
.rec-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid var(--rec);
  opacity: 0;
  pointer-events: none;
}
.rec-btn[aria-pressed="true"] { background: var(--rec); border-color: color-mix(in srgb, var(--rec) 30%, transparent); }
.rec-btn[aria-pressed="true"] .mic-idle { opacity: 0; }
.rec-btn[aria-pressed="true"] .mic-live { opacity: 1; }
.rec-btn[aria-pressed="true"] .rec-ring { opacity: 0.45; }
.rec-readout { min-width: 124px; }
.rec-time-row { display: flex; align-items: center; gap: 10px; }
.rec-time {
  font: 600 1.5rem / 1.1 var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}
.rec-time.is-live { color: var(--rec); }
.rec-badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.rec-badge[data-mode="recording"] { background: var(--rec-soft); color: var(--rec); }
.rec-badge[data-mode="transcribing"], .rec-badge[data-mode="live"] { background: var(--accent-soft); color: var(--accent-ink); }
.rec-badge[data-mode="paused"] { background: var(--warn-soft); color: var(--warn); }
.rec-hint { margin-block-start: 4px; color: var(--text-3); font-size: var(--fs-xs); min-height: 1em; }
.rec-hint:empty { display: none; }
.wave-well {
  min-width: 0;
  height: 48px;
  padding-inline: 12px;
  border-radius: var(--r);
  background: var(--surface-2);
}
.rec-wave { display: block; width: 100%; height: 48px; }
.rec-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.live-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  white-space: nowrap;
  touch-action: manipulation;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.live-toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.live-toggle[aria-pressed="true"] .live-dot { background: var(--accent); }
.mic-deck[data-deck-state="recording"] .wave-well { background: color-mix(in srgb, var(--rec-soft) 55%, var(--surface-2)); }
.mic-deck[data-deck-state="live"] .wave-well { background: color-mix(in srgb, var(--accent-soft) 65%, var(--surface-2)); }
.mic-deck[data-deck-state="paused"] .wave-well { background: color-mix(in srgb, var(--warn-soft) 65%, var(--surface-2)); }

.live-area { margin-block-start: 12px; padding: 12px 14px; border-block-start: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.live-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-block-end: 10px; }
.live-state { font-weight: 600; font-size: var(--fs-sm); }
.live-chunks { display: flex; flex-wrap: wrap; gap: 4px; }
.live-chunk-pill { padding: 2px 8px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.live-chunk-pill[data-status="pending"] { background: var(--warn-soft); color: var(--warn); }
.live-chunk-pill[data-status="done"] { background: var(--accent-soft); color: var(--accent-ink); }
.live-chunk-pill[data-status="error"] { background: var(--danger-soft); color: var(--danger); }
.live-meta { margin-inline-start: auto; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.live-text { margin: 0; max-width: 74ch; max-height: 240px; overflow: auto; overscroll-behavior: contain; white-space: pre-wrap; overflow-wrap: anywhere; font: var(--fs-md) / 1.75 var(--font); color: var(--text); }

.drop {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--r);
  background: var(--surface-2);
}
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop-badge { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-1); border: 1px solid var(--border); }
.drop-badge .ic { width: 22px; height: 22px; stroke-width: 1.5px; }
.drop-copy { flex: 1; min-width: 0; }
.drop-title { font-weight: 600; }
.drop-sub { color: var(--text-3); font-size: var(--fs-xs); }

/* ---------------------------------------------------------------- queue（无外层大框：卡片直接浮在画布上，消除四层套娃） */
.queue { padding: 4px 0 8px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-block-end: 12px; padding-inline: 2px; }
.queue-title-group { display: flex; align-items: center; gap: 10px; min-width: 0; }
.queue-title-group h2 { font-size: var(--fs-md); white-space: nowrap; }
.queue-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.check-all { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check-inline { color: var(--text-2); font-size: var(--fs-xs); white-space: nowrap; }

.date-group + .date-group { margin-block-start: 8px; }
.date-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  text-align: start;
  font-size: var(--fs-sm);
}
@media (hover: hover) { .date-head:hover { background: var(--surface-2); } }
.date-chevron { width: 16px; height: 16px; color: var(--text-3); }
.date-head[aria-expanded="false"] .date-chevron { transform: rotate(-90deg); }
.date-label { font-weight: 600; color: var(--text); }
.date-count { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.date-body { display: flex; flex-direction: column; gap: 10px; padding-block: 6px 2px; }

.item {
  position: relative;
  padding: 16px 18px 14px;
  border: 1px solid transparent;
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--ring-border);
}
@media (hover: hover) { .item:hover { box-shadow: var(--ring-border-hover); } }
.item.is-checked { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow-1); }
.item[data-state="error"] { border-color: color-mix(in srgb, var(--danger) 42%, var(--border)); }
.item-top { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 12px; }
.row-check { margin-block-start: 3px; }
.item-head { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.item-name {
  font-size: var(--fs-md);
  font-weight: 600;
  line-height: 1.4;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.meta-item { white-space: nowrap; }
.meta-item + .meta-item::before { content: "·"; padding-inline: 6px; color: var(--border-strong); }
.meta-recordingId { font-family: var(--mono); }
.meta-exported { color: var(--accent-ink); }
.item-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.status[data-state="uploading"] { background: var(--accent-soft); color: var(--accent-ink); }
.status[data-state="done"] { background: var(--accent-soft); color: var(--accent-ink); }
.status[data-state="error"] { background: var(--danger-soft); color: var(--danger); }
.bar { height: 3px; margin-block-start: 12px; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.bar i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); }
.job-stage-steps { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 10px 0 0; padding: 0; list-style: none; counter-reset: step; }
.job-stage-step { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-size: var(--fs-xs); counter-increment: step; }
.job-stage-step::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.job-stage-step.is-done { color: var(--text-2); }
.job-stage-step.is-done::before { content: "✓"; border-color: var(--accent); background: var(--accent); color: var(--on-accent); }
.job-stage-step.is-active { color: var(--accent-ink); font-weight: 600; }
.job-stage-step.is-active::before { border-color: var(--accent); color: var(--accent-ink); }
.transcribe-stage { display: flex; align-items: center; gap: 10px; margin-block-start: 10px; color: var(--accent-ink); font-size: var(--fs-xs); }
.transcribe-stage-timer { color: var(--text-3); font-variant-numeric: tabular-nums; }
.item-cancel-btn { margin-inline-start: auto; }
.item-queue-actions { display: flex; justify-content: flex-end; margin-block-start: 8px; }
.note-load-cloud { width: 100%; margin-block-start: 6px; border: 1px dashed var(--border-strong); color: var(--accent-ink); }
.eq-bars { display: inline-flex; align-items: center; gap: 2px; height: 14px; }
.eq-bars i { width: 3px; height: 40%; border-radius: 2px; background: var(--accent); }
.eq-bars i:nth-child(2) { height: 80%; } .eq-bars i:nth-child(3) { height: 60%; } .eq-bars i:nth-child(4) { height: 95%; } .eq-bars i:nth-child(5) { height: 50%; }
.ai-working-pill { display: inline-flex; align-items: center; gap: 8px; margin-block-start: 10px; padding: 4px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 500; }
.ai-working-dots { display: inline-flex; gap: 3px; }
.ai-working-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; opacity: 0.6; }
.item-note { margin-block-start: 10px; padding: 8px 12px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn); font-size: var(--fs-sm); }
.item[data-state="error"] .item-note { background: var(--danger-soft); color: var(--danger); }
.item-error-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-block-start: 10px; }
.item-body { display: none; margin-block-start: 12px; padding-block-start: 12px; border-block-start: 1px solid color-mix(in srgb, var(--border) 65%, transparent); }
.item.is-open .item-body { display: block; }
.transcript {
  margin: 0;
  max-width: 74ch;
  padding: 2px 0 4px;
  color: var(--text);
  font: var(--fs-md) / 1.75 var(--font);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  text-wrap: pretty;
  max-height: 360px;
  overflow: auto;
  overscroll-behavior: contain;
}
.transcript.is-polished {
  padding: 10px 14px;
  border-radius: var(--r);
  border-inline-start: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface-2));
}
.item-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-block-start: 12px; }
.item-actions .btn-soft { margin-inline-end: 2px; }
.item-audio-wrap {
  margin-block-start: 10px;
  padding: 6px 10px;
  border-radius: var(--r);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.item-audio-player { display: block; width: 100%; height: 34px; }
.actions-sep { width: 1px; height: 18px; margin-inline: 4px; background: var(--border); }
.item-more-wrap { position: relative; margin-inline-start: auto; }
.item-more-menu { min-width: 196px; inset-block-start: calc(100% + 6px); inset-block-end: auto; }
.item-more-menu.is-dropup { inset-block-start: auto; inset-block-end: calc(100% + 6px); }
.item-more-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-sm);
  text-align: start;
}
.item-more-row .ic { width: 15px; height: 15px; color: var(--text-3); }
.item-more-row.is-danger { color: var(--danger); }
.item-more-row.is-danger .ic { color: var(--danger); }
@media (hover: hover) { .item-more-row:hover { background: var(--surface-2); } .item-more-row.is-danger:hover { background: var(--danger-soft); } }
.job-attachments { display: flex; flex-direction: column; gap: 6px; margin-block-start: 10px; }
.job-attachments:empty { display: none; }
.job-attachment { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.job-attachment-head { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 4px 6px 4px 10px; list-style: none; cursor: pointer; font-size: var(--fs-sm); }
.job-attachment-head::-webkit-details-marker { display: none; }
.job-attachment-caret { width: 15px; height: 15px; color: var(--text-3); }
.job-attachment[open] .job-attachment-caret { transform: rotate(90deg); }
.job-attachment-ic { width: 15px; height: 15px; color: var(--accent-ink); }
.job-attachment-title { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job-attachment-meta { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.job-attachment-body { padding: 4px 14px 12px; }
.job-todo-list { display: flex; flex-direction: column; gap: 4px; padding: 4px 14px 12px; }
.job-todo-item { display: flex; align-items: flex-start; gap: 8px; font-size: var(--fs-sm); line-height: 1.6; cursor: pointer; }
.job-todo-item input { margin-block-start: 4px; }
.job-todo-item.is-done span { color: var(--text-3); text-decoration: line-through; }

.empty-well {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 44px 20px;
  border: 0;
  border-radius: var(--r-lg);
  background: transparent;
  text-align: center;
}
.empty-icon-wrap { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--surface-2); color: var(--text-3); }
.empty-icon-wrap .ic { width: 20px; height: 20px; }
.empty-title { font-weight: 600; color: var(--text); }
.empty-sub { color: var(--text-3); font-size: var(--fs-sm); max-width: 44ch; text-wrap: balance; }
.empty-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; margin-block-start: 6px; }
.empty-actions:empty { display: none; }

.batch-bar {
  position: sticky;
  inset-block-end: 12px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-block-start: 14px;
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}
.batch-count { padding-inline: 6px; font-size: var(--fs-sm); font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.batch-spacer { flex: 1; }
.batch-bar select { width: auto; max-width: 180px; min-height: 32px; font-size: var(--fs-sm); }

.batch-bar:has(.item-more-menu:not([hidden])) { z-index: 25; }
.scrim { position: fixed; inset: 0; z-index: 29; background: var(--scrim); }
.drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-start: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: min(100vw, var(--drawer-w));
  overflow: hidden;
  overscroll-behavior: contain;
  background: var(--surface);
  border-inline-end: 1px solid var(--border);
  box-shadow: var(--shadow-3);
  visibility: hidden;
  transform: translateX(-100%);
}
.drawer.is-open { visibility: visible; transform: none; }
[dir="rtl"] .drawer { transform: translateX(100%); }
.drawer-head { display: flex; align-items: center; gap: 8px; min-height: var(--topbar-h); padding: 0 10px 0 18px; border-block-end: 1px solid var(--border); }
.drawer-title { flex: 1; min-width: 0; font-size: var(--fs-md); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.drawer-tools { display: flex; align-items: center; gap: 2px; flex: none; }
.drawer-filters { display: flex; flex-direction: column; gap: 10px; padding: 12px 14px 10px; border-block-end: 1px solid var(--border); }

.search-box {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-height: 40px;
  padding: 4px 6px 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r);
  background: var(--surface);
}
.search-box:focus-within { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.search-ic { color: var(--text-3); }
.search-pills { display: contents; }
.search-box input[type="search"] { flex: 1 1 120px; min-height: 30px; padding: 0 4px; border: 0; background: transparent; outline: none; }
.search-box input[type="search"]::-webkit-search-cancel-button { display: none; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  height: 26px;
  padding-inline: 9px 2px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: var(--fs-xs);
  font-weight: 500;
}
.pill-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pill-x { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.pill-x .ic { width: 13px; height: 13px; }
@media (hover: hover) { .pill-x:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); } }
.search-wrap { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
/* 文档流内（不再 absolute 浮层）：永远不会盖住视图按钮/快速开始，只在输入语法词时出现 */
.search-hints {
  max-height: 136px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  overscroll-behavior: contain;
}
.hints-title { margin-block-end: 6px; color: var(--text-3); font-size: 0.75rem; }
.hints-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px; }
.search-hint-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  text-align: start;
  font-size: var(--fs-xs);
  color: var(--text-2);
}
.search-hint-chip code { flex: none; color: var(--accent-ink); font-size: 0.75rem; }
.search-hint-chip span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .search-hint-chip:hover { background: var(--surface-3); color: var(--text); } }

.views-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.views-ic { color: var(--text-3); width: 16px; height: 16px; }
.views-chips { display: flex; gap: 6px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; padding-block: 2px; padding-inline-end: 14px; mask-image: linear-gradient(to right, #000 calc(100% - 14px), transparent 100%); }
.views-chips::-webkit-scrollbar { display: none; }
.views-empty { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.view-chip { display: inline-flex; align-items: center; gap: 2px; flex: none; }
.view-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.view-count { color: var(--text-3); font-variant-numeric: tabular-nums; }
.view-new { display: inline-flex; align-items: center; justify-content: center; height: 16px; padding: 0 5px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 0.75rem; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.view-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.view-btn[aria-pressed="true"] .view-count { color: var(--accent-ink); }
@media (hover: hover) { .view-btn[aria-pressed="false"]:hover { background: var(--surface-2); color: var(--text); } }
.views-row.is-managing { align-items: flex-start; }
.views-row.is-managing .views-ic { margin-block-start: 7px; }
.is-managing .views-chips { flex-wrap: wrap; overflow: visible; }
.is-managing .view-chip { padding: 2px 2px 2px 4px; border: 1px dashed var(--border-strong); border-radius: 999px; }
.view-rename { width: auto; min-height: 24px; padding: 0 6px; border-radius: 999px; font-size: var(--fs-xs); }
.rot-left .ic { transform: rotate(-90deg); }
[dir="rtl"] .rot-left .ic { transform: rotate(90deg); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-radius: var(--r); background: var(--surface-2); }
.inline-form input[type="text"] { flex: 1 1 160px; }

.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.filter-spacer { flex: 1; }
.select-mini { display: inline-flex; align-items: center; gap: 4px; color: var(--text-3); }
.select-mini select { width: auto; min-height: 30px; padding-block: 2px; font-size: var(--fs-xs); color: var(--text-2); }
.dot-badge { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.facet-panel { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: var(--r); background: var(--surface-2); }
.facet-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: start; gap: 8px; }
.facet-label { padding-block-start: 4px; color: var(--text-3); font-size: var(--fs-xs); }
.facet-opts { display: flex; flex-wrap: wrap; gap: 4px; }
.chip-toggle, .chip-row .chip-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
}
.chip-count { color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip-toggle { border-color: var(--border-strong); }
.chip-toggle[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip-toggle[aria-pressed="true"] .chip-count { color: var(--accent-ink); }
@media (hover: hover) { .chip-toggle:not([aria-pressed="true"]):hover { background: var(--surface-2); color: var(--text); } }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }

.note-list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 8px 16px; scroll-padding-block-start: 36px; }
.batch-bar-drawer { position: static; margin: 0; border-radius: 0; border-inline: 0; border-block-end: 0; box-shadow: none; padding: 8px 12px max(8px, env(safe-area-inset-bottom)); }
.quick-starts { padding: 8px 6px 6px; }
.qs-title { margin: 0 4px 8px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.qs-grid { display: flex; flex-wrap: wrap; gap: 6px; }
.qs-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 500;
  text-align: start;
  touch-action: manipulation;
}
.qs-card .ic { color: var(--text-3); width: 14px; height: 14px; stroke-width: 1.8px; }
.qs-label { white-space: nowrap; }
.qs-count { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.qs-card:disabled { opacity: 0.45; }
@media (hover: hover) { .qs-card:not(:disabled):hover { border-color: var(--border-strong); background: var(--surface-2); color: var(--text); } }
.group-label {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 2px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  backdrop-filter: blur(6px);
}
.group-count { color: var(--text-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 10px 10px 10px 8px;
  border-radius: var(--r);
}
.note + .note { margin-block-start: 2px; }
.note .row-check { margin-block-start: 3px; }
.note.is-checked { background: var(--accent-soft); }
.note.is-new-hit { box-shadow: inset 3px 0 0 var(--accent); background: color-mix(in srgb, var(--accent-soft) 50%, var(--surface)); }
@media (hover: hover) { .note:not(.is-checked):hover { background: var(--surface-2); } }
.note-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.note-top-row { display: flex; align-items: flex-start; gap: 6px; }
.note-open-btn {
  flex: 1;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  line-height: 1.45;
  text-align: start;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: anywhere;
}
.note-pin-btn { margin: -3px -4px 0 0; color: var(--text-3); }
.note-pin-btn[aria-pressed="true"],
#sheetPinToggle[aria-pressed="true"] { color: var(--star); background: transparent; }
.note-pin-btn[aria-pressed="true"] .ic,
#sheetPinToggle[aria-pressed="true"] .ic { fill: currentColor; }
@media (hover: hover) { .note:hover .note-pin-btn { color: var(--text); } }
.note-sub { display: flex; flex-wrap: wrap; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.note-sub span + span::before { content: "·"; padding-inline: 6px; color: var(--border-strong); }
.note-preview { color: var(--text-2); font-size: var(--fs-sm); line-height: 1.55; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.note-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-block-start: 2px; }
.tag-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
button.tag-chip { cursor: pointer; }
.note-load-more { width: 100%; margin-block-start: 8px; }
.search-hit { padding: 0 2px; border-radius: 3px; background: var(--mark-bg); color: var(--mark-text); }
.drawer .drawer-empty { margin: 16px 14px; padding: 28px 16px; }

/* ---------------------------------------------------------------- status bar */
.statusbar {
  /* v1.4：放回文档流的页脚（v1.3 固定悬浮会盖住卡片与批量栏），可在设置里关闭 */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  width: min(100% - 56px, var(--shell-max));
  margin: -48px auto 0;
  padding: 0 4px 28px;
  color: var(--text-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
}
.bar-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.bar-conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border: 1px solid color-mix(in srgb, var(--warn) 40%, var(--border));
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: var(--fs-xs);
  font-weight: 500;
}

/* ---------------------------------------------------------------- dialogs */
dialog { padding: 0; border: 0; color: var(--text); }
dialog::backdrop { background: var(--scrim); }
.sheet {
  width: min(960px, calc(100vw - 32px));
  max-height: min(88vh, 900px);
  overflow: visible;
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow-3);
}
.sheet-detail { min-height: 360px; }
.sheet-head { border-start-start-radius: var(--r-xl); border-start-end-radius: var(--r-xl); }
.sheet-body { border-end-start-radius: var(--r-xl); border-end-end-radius: var(--r-xl); }
.item-more-menu > .btn { display: flex; justify-content: flex-start; width: 100%; text-decoration: none; }
.sheet[open] { display: flex; flex-direction: column; }
.sheet-small { width: min(640px, calc(100vw - 32px)); }
.sheet-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 12px 10px 22px;
  border-block-end: 1px solid var(--border);
}
.sheet-head h2 { flex: 1; min-width: 0; font-size: var(--fs-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head-text { flex: 1; min-width: 0; }
.sheet-head-text h2 { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.sheet-sub { margin-block-start: 2px; color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.sheet-sub:empty { display: none; }
.sheet-tools { display: flex; align-items: center; gap: 4px; flex: none; }
.sheet-body { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 20px 22px 24px; }

/* note detail */
.sheet-detail { width: min(880px, calc(100vw - 32px)); }
.sheet-detail .sheet-body { position: relative; padding: 22px 28px 40px; }
/* 标签行、正文、附加卡同一阅读列：三者都按正文字号算 68ch（ch 随元素字号变化），子元素再回到基础字号 */
.sheet-meta { display: flex; flex-wrap: wrap; gap: 6px; max-width: 68ch; margin: 0 auto 16px; font-size: var(--fs-md); }
:where(.sheet-meta, .sheet-extras) > * { font-size: var(--fs); }
.sheet-meta:empty { display: none; }
#sheetText {
  max-width: 68ch;
  margin: 0 auto;
  font-size: 1rem;
  line-height: 1.75;
}
.sheet-edit-box { display: flex; flex-direction: column; gap: 14px; max-width: 68ch; margin: 0 auto; }
.sheet-edit-box textarea { min-height: 280px; font-size: var(--fs-md); line-height: 1.7; }
.sheet-sub-area { max-width: 68ch; margin: 18px auto 0; }
.sheet-sub-bar { display: flex; justify-content: flex-start; }
.sheet-sub-box { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.sheet-extras { display: flex; flex-direction: column; gap: 10px; max-width: 68ch; margin: 18px auto 0; font-size: var(--fs-md); }
.extra-card { border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.extra-head { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 4px 8px 4px 14px; list-style: none; cursor: pointer; font-size: var(--fs-sm); font-weight: 600; }
.extra-head::-webkit-details-marker { display: none; }
.extra-head .ic { width: 16px; height: 16px; color: var(--accent-ink); }
.extra-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.extra-card .md { padding: 0 16px 14px; font-size: var(--fs); }
.back-top { position: sticky; inset-block-end: 0; float: inline-end; margin-block-start: 16px; border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-2); }

/* markdown typography */
.md { color: var(--text); overflow-wrap: anywhere; }
.md > :first-child { margin-block-start: 0; }
.md > :last-child { margin-block-end: 0; }
.md-p, .md p { margin: 0 0 0.9em; text-wrap: pretty; }
.md-h { margin: 1.5em 0 0.55em; color: var(--text); font-weight: 600; line-height: 1.4; }
.md-h1 { font-size: 1.32em; }
.md-h2 { font-size: 1.18em; padding-block-end: 0.3em; border-block-end: 1px solid var(--border); }
.md-h3 { font-size: 1.06em; }
.md-h4, .md-h5, .md-h6 { font-size: 1em; color: var(--text-2); }
.md-list { margin: 0 0 0.9em; padding-inline-start: 1.5em; }
.md-list .md-list { margin: 0.25em 0 0.1em; }
.md-list li { margin: 0.2em 0; padding-inline-start: 0.15em; }
.md-list li::marker { color: var(--text-3); }
.md-task { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 8px; margin-inline-start: -1.4em; }
.md-task input { margin-block-start: 0.35em; }
.md-task > label.md-task-label { display: contents; cursor: pointer; }
.md-task > .md-list { grid-column: 2; }
.md-task.is-done > span { color: var(--text-3); text-decoration: line-through; text-decoration-color: var(--border-strong); }
.md-quote { margin: 0 0 1em; padding: 0.2em 0 0.2em 1em; border-inline-start: 3px solid var(--border-strong); color: var(--text-2); }
.md code { padding: 0.1em 0.38em; border-radius: 5px; background: var(--surface-3); font-size: 0.88em; }
.md-code { margin: 0 0 1em; padding: 12px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); overflow-x: auto; font-size: 0.8125rem; line-height: 1.6; }
.md-code code { padding: 0; background: none; font-size: inherit; }
.md-hr { height: 1px; margin: 1.6em 0; border: 0; background: var(--border); }
.md a { color: var(--accent-ink); text-decoration: underline; text-underline-position: from-font; text-decoration-thickness: from-font; text-decoration-color: color-mix(in srgb, var(--accent-ink) 40%, transparent); }
.md strong { font-weight: 600; }
.md-table-wrap { margin: 0 0 1em; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r); }
.md-table { width: 100%; border-collapse: collapse; font-size: 0.94em; font-variant-numeric: tabular-nums; }
.md-table th, .md-table td { padding: 8px 12px; border-block-end: 1px solid var(--border); text-align: start; vertical-align: top; }
.md-table th { background: var(--surface-2); color: var(--text-2); font-weight: 600; white-space: nowrap; }
.md-table tr:last-child td { border-block-end: 0; }
.md-al-center { text-align: center !important; }
.md-al-end { text-align: end !important; }
.md-raw { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 0.84375rem / 1.7 var(--mono); color: var(--text-2); }

/* settings */
.sheet-settings { width: min(1040px, calc(100vw - 32px)); height: min(86vh, 820px); overflow: hidden; }
.settings-layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); flex: 1; min-height: 0; overflow: hidden; }
.settings-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 10px; border-inline-end: 1px solid var(--border); background: var(--surface-2); overflow-y: auto; overscroll-behavior: contain; }
.settings-tab {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: start;
  white-space: nowrap;
}
.settings-tab .ic { width: 17px; height: 17px; color: var(--text-3); }
.settings-tab[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-1), 0 0 0 1px var(--border); }
.settings-tab[aria-selected="true"] .ic { color: var(--accent-ink); }
@media (hover: hover) { .settings-tab[aria-selected="false"]:hover { background: var(--surface-3); color: var(--text); } }
.settings-body { padding: 24px 28px 32px; overflow-y: auto; min-height: 0; }
.rule-quick-cards { display: flex; flex-wrap: wrap; gap: 8px; }
.rule-live-preview { margin: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-sm); line-height: 1.5; }
.settings-panel { display: flex; flex-direction: column; gap: 20px; max-width: 720px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.panel-title { font-size: var(--fs-xl); font-weight: 600; }
.panel-sub { margin-block-start: -12px; color: var(--text-3); font-size: var(--fs-sm); }
.panel-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.select-mini-inline { width: auto; max-width: 100%; min-width: 0; min-height: 30px; padding: 2px 26px 2px 10px; font-size: var(--fs-xs); }
.rec-controls .select-mini-inline { max-width: min(220px, 100%); }
.settings-search-input { width: 100%; min-height: 32px; margin-block-end: 6px; padding: 4px 10px; font-size: var(--fs-xs); }
.ai-ask-presets { margin-block: 6px 8px; }
.settings-group { display: flex; flex-direction: column; gap: 12px; }
.group-title { color: var(--text); font-size: var(--fs-sm); font-weight: 600; }
.editor-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.editor-card input, .editor-card select, .editor-card textarea { background: var(--surface); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.check-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.check-chip:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.chip-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.list-rows { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.list-rows:empty { display: none; }
.list-rows > * + * { border-block-start: 1px solid var(--border); }
.list-empty, .list-rows > .field-note { padding: 14px 16px; color: var(--text-3); font-size: var(--fs-sm); }
.prompt-line, .account-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 16px;
  background: var(--surface);
}
.prompt-line.is-off { background: var(--surface-2); }
.prompt-line.is-off .prompt-line-name { color: var(--text-3); }
.prompt-line-info { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.prompt-line-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; font-weight: 600; font-size: var(--fs-sm); }
.prompt-line-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.prompt-line-sub { color: var(--text-3); font-size: var(--fs-xs); line-height: 1.55; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.prompt-line-actions { display: flex; align-items: center; gap: 2px; flex-wrap: nowrap; }
.prompt-line-actions .btn-mini { min-height: 28px; }
.rule-index { display: grid; place-items: center; width: 20px; height: 20px; flex: none; border-radius: 6px; background: var(--surface-3); color: var(--text-2); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.rule-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; -webkit-line-clamp: unset; }
.rule-arrow { width: 14px; height: 14px; color: var(--text-3); }
.rule-then { color: var(--text-2); }
.badge {
  display: inline-flex;
  align-items: center;
  flex: none;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.badge-accent { background: var(--accent-soft); color: var(--accent-ink); }
.badge-ok { background: var(--ok-soft); color: var(--ok-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.rule-matrix { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding-block-start: 4px; }
.rule-col { display: flex; flex-direction: column; gap: 12px; padding: 0; border: 0; background: transparent; }
.rule-col + .rule-col { padding-inline-start: 18px; border-inline-start: 1px solid var(--border); }
.rule-col-title { color: var(--accent-ink); font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.02em; }
.rule-col .field-row select { flex: 0 0 84px; }
.kv-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.kv-cards dt { color: var(--text-3); font-size: var(--fs-xs); }
.kv-cards dd { margin: 2px 0 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kv-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.account-line-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.account-line { grid-template-columns: minmax(0, 1fr) auto auto; }
.account-line-meta { color: var(--text-3); font-size: var(--fs-xs); white-space: nowrap; }
.account-line-actions { display: flex; gap: 2px; }
.token-help summary { cursor: pointer; color: var(--text-2); font-size: var(--fs-sm); }
.token-help p { margin-block-start: 6px; }
.model-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.model-chip-row { display: inline-flex; align-items: center; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); }
.model-chip-row.is-active { border-color: var(--accent); background: var(--accent-soft); }
.model-chip-name { height: 28px; padding: 0 4px 0 12px; border: 0; background: none; font-size: var(--fs-xs); font-weight: 500; color: var(--text); }
.model-chip-row.is-active .model-chip-name { color: var(--accent-ink); }
.model-chip-del { width: 26px; height: 26px; border: 0; border-radius: 50%; background: none; color: var(--text-3); }
@media (hover: hover) { .model-chip-del:hover { color: var(--danger); background: var(--danger-soft); } }

/* keyboard table */
.kbd-table { display: flex; flex-direction: column; }
.kbd-group { margin: 14px 0 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.kbd-group:first-child { margin-block-start: 0; }
.kbd-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  min-height: 40px;
  padding: 4px 0;
  border-block-end: 1px solid var(--border);
}
.kbd-label { min-width: 0; color: var(--text); font-size: var(--fs-sm); }
.kbd-keys { display: inline-flex; align-items: center; gap: 4px; justify-self: end; white-space: nowrap; }
.kbd-plus { color: var(--text-3); font-size: 0.75rem; }

/* vocabulary */
.vocab-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r-lg); }
.vocab-table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.vocab-table th { padding: 8px 10px; background: var(--surface-2); color: var(--text-2); font-size: var(--fs-xs); font-weight: 600; text-align: start; white-space: nowrap; border-block-end: 1px solid var(--border); }
.vocab-table td { padding: 6px 8px; border-block-end: 1px solid var(--border); vertical-align: middle; }
.vocab-table tr:last-child td { border-block-end: 0; }
.vocab-table input[type="text"], .vocab-table select { min-height: 32px; padding: 4px 8px; font-size: var(--fs-sm); border-color: var(--border-strong); background: var(--surface); }
@media (hover: hover) { .vocab-table input[type="text"]:hover, .vocab-table select:hover { border-color: var(--border); } }
.vocab-table .col-on, .vocab-table .col-case { width: 64px; text-align: center; }
.vocab-table .col-scope { width: 132px; }
.vocab-table .col-act { width: 44px; text-align: end; }
.vocab-table .col-right { width: 30%; }
.vocab-use-pill { display: inline-flex; align-items: center; margin-inline-start: 6px; padding: 1px 6px; border-radius: 999px; background: var(--surface-2); color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.vocab-table tr.is-off td:not(.col-on) { opacity: 0.55; }
.vocab-empty td { padding: 20px; color: var(--text-3); text-align: center; }
.vocab-add { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; }
.vocab-import { flex-direction: column; align-items: stretch; }
.vocab-import label { color: var(--text-2); font-size: var(--fs-sm); }
.vocab-suggest-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-xs);
}
.vocab-suggest-chip .ic { width: 13px; height: 13px; color: var(--accent-ink); }
@media (hover: hover) { .vocab-suggest-chip:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); } }
.push-log-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px 10px;
  padding: 10px 14px;
  background: var(--surface);
}
.push-log-main { min-width: 0; }
.push-log-title { font-size: var(--fs-sm); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.push-log-sub { color: var(--text-3); font-size: var(--fs-xs); }
.push-log-time { color: var(--text-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.push-log-actions { display: flex; align-items: center; gap: 4px; }
.push-log-actions:empty { display: none; }

/* about & stats */
.about-card { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-2); }
.about-name { font-weight: 600; font-size: var(--fs-md); }
.about-version { color: var(--text-2); font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.stats-summary-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.stat-card { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.stat-label { color: var(--text-3); font-size: var(--fs-xs); }
.stat-value { margin-block-start: 2px; font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }
.stats-chart-box { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; align-items: end; gap: 4px; height: 84px; padding: 10px 10px 8px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.stats-bar-col { display: flex; align-items: flex-end; height: 100%; }
.stats-bar-fill { display: block; width: 100%; height: 25%; border-radius: 3px 3px 1px 1px; background: color-mix(in srgb, var(--accent) 42%, var(--surface)); }
.stats-bar-fill[data-level="2"] { height: 50%; background: color-mix(in srgb, var(--accent) 62%, var(--surface)); }
.stats-bar-fill[data-level="3"] { height: 75%; background: color-mix(in srgb, var(--accent) 82%, var(--surface)); }
.stats-bar-fill[data-level="4"] { height: 100%; background: var(--accent); }
.stats-bar-fill.is-zero { height: 2px; background: var(--border-strong); }
.stats-tags-box { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 2px; }
.tag-filter { min-height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: var(--fs-xs); }
.backup-preview-box { flex-direction: column; align-items: stretch; }

/* save picker */
.target-list { display: flex; flex-direction: column; gap: 6px; }
.pick-section-title { margin: 10px 0 2px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.pick-section-title:first-child { margin-block-start: 0; }
.target-btn {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  text-align: start;
}
.target-btn:disabled { color: var(--text-3); background: var(--surface-2); }
@media (hover: hover) { .target-btn:not(:disabled):hover { border-color: var(--border-strong); background: var(--surface-2); } }

/* combine / tags */
.combine-preview { min-height: 240px; font: 13px / 1.65 var(--mono); background: var(--surface-2); }
#combineSheet .sheet-body, #tagSheet .sheet-body, #batchEditSheet .sheet-body, #aiSheet .sheet-body { display: flex; flex-direction: column; gap: 14px; }

/* AI sheet */
.ai-mode-tabs { align-self: flex-start; }
.ai-section { display: flex; flex-direction: column; gap: 10px; padding-block-end: 4px; }
.ai-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ai-section-title { font-size: var(--fs-sm); font-weight: 600; }
.ai-ask-controls { display: flex; align-items: center; gap: 10px; }
.ai-ask-controls select { width: auto; min-height: 30px; font-size: var(--fs-xs); }
.ai-group-label { color: var(--text-3); font-size: var(--fs-xs); }
.ai-types { display: flex; flex-direction: column; gap: 8px; }
.prompt-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.prompt-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 500;
  text-align: start;
}
.prompt-card .ic { width: 16px; height: 16px; color: var(--accent-ink); }
.prompt-card-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (hover: hover) { .prompt-card:hover { border-color: var(--accent); background: var(--accent-soft); } }
.ai-recent { display: flex; flex-wrap: wrap; gap: 6px; }
.ai-recent:empty { display: none; }
.ai-state:empty { display: none; }
.ai-result {
  margin: 0;
  max-height: 340px;
  overflow: auto;
  overscroll-behavior: contain;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: var(--fs) / 1.7 var(--font);
}
.ai-actions select { width: auto; max-width: 200px; }

/* polish diff */
.polish-diff-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.polish-diff-head { margin-block-end: 8px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.polish-diff-box { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); font-size: var(--fs); line-height: 1.75; overflow-wrap: anywhere; }
.diff-line { min-height: 1.75em; white-space: pre-wrap; }
.diff-line.is-changed-before { background: var(--danger-soft); }
.diff-line.is-changed-after { background: var(--accent-soft); }

/* batch edit */
.batch-preview-list { display: flex; flex-direction: column; gap: 6px; }
.batch-preview-item { padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); }
.batch-preview-title { font-weight: 600; font-size: var(--fs-sm); }
.batch-preview-sub { color: var(--text-3); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#batchEditSheet .filter-row select { width: auto; }

/* palette */
.palette {
  width: min(620px, calc(100vw - 32px));
  margin-block-start: 12vh;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-3);
  overflow: hidden;
}
.palette-search-wrap { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-block-end: 1px solid var(--border); }
.palette-search-wrap:focus-within { box-shadow: inset 0 -2px 0 var(--focus); }
.palette-search-icon { color: var(--text-3); }
.palette-input { min-height: 54px; border: 0; background: transparent; font-size: var(--fs-md); outline: none; padding: 0; }
.palette-list { max-height: 50vh; overflow: auto; overscroll-behavior: contain; padding: 6px; }
.palette-group-head { padding: 8px 10px 4px; color: var(--text-3); font-size: var(--fs-xs); font-weight: 600; }
.palette-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: var(--fs-sm);
  text-align: start;
}
.palette-item .ic { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.palette-item[aria-selected="true"] .ic { color: var(--accent-ink); }
.palette-item[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-ink); }
.palette-item:disabled { opacity: 0.45; }
.pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-hint { flex: none; color: var(--text-3); font-size: var(--fs-xs); }
.palette-empty { padding: 20px; color: var(--text-3); text-align: center; font-size: var(--fs-sm); }
.palette-hint { display: flex; align-items: center; gap: 6px; padding: 8px 16px; border-block-start: 1px solid var(--border); color: var(--text-3); font-size: var(--fs-xs); }

/* toast & tooltip（popover 顶层，叠在弹窗之上） */
.toast {
  position: fixed;
  inset: auto 0 20px 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: min(560px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 10px 12px 10px 16px;
  border: 1px solid color-mix(in srgb, var(--toast-text) 16%, transparent);
  border-radius: var(--r);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-3), 0 0 0 1px rgb(0 0 0 / 0.12);
  overflow: visible;
}
.toast-action { flex: none; min-height: 28px; padding: 0 10px; border: 0; border-radius: var(--r-sm); background: var(--toast-action-bg); color: inherit; font-weight: 600; font-size: var(--fs-xs); }
.tooltip {
  position: fixed;
  inset: auto;
  z-index: 70;
  max-width: 260px;
  margin: 0;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--toast-text) 12%, transparent);
  border-radius: var(--r-xs);
  background: var(--toast-bg);
  color: var(--toast-text);
  font-size: 0.75rem;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: var(--shadow-2);
  overflow: visible;
}

/* ---------------------------------------------------------------- motion（全部可关） */
@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="off"]) .btn,
  :root:not([data-motion="off"]) .seg-btn,
  :root:not([data-motion="off"]) .chip-toggle,
  :root:not([data-motion="off"]) .view-btn,
  :root:not([data-motion="off"]) .qs-card,
  :root:not([data-motion="off"]) .note,
  :root:not([data-motion="off"]) .settings-tab,
  :root:not([data-motion="off"]) .prompt-card,
  :root:not([data-motion="off"]) .theme-card,
  :root:not([data-motion="off"]) .target-btn {
    transition-property: background-color, color, border-color, box-shadow, scale;
    transition-duration: 140ms;
    transition-timing-function: ease-out;
  }
  :root:not([data-motion="off"]) .btn:not(:disabled):active,
  :root:not([data-motion="off"]) .seg-btn:not(:disabled):active,
  :root:not([data-motion="off"]) .chip-toggle:not(:disabled):active,
  :root:not([data-motion="off"]) .view-btn:not(:disabled):active,
  :root:not([data-motion="off"]) .qs-card:not(:disabled):active,
  :root:not([data-motion="off"]) .theme-card:not(:disabled):active,
  :root:not([data-motion="off"]) .prompt-card:not(:disabled):active,
  :root:not([data-motion="off"]) .rec-btn:not(:disabled):active { scale: 0.96; }
  :root:not([data-motion="off"]) .rec-btn { transition: background-color 200ms var(--ease), box-shadow 200ms var(--ease), scale 150ms ease-out; }
  :root:not([data-motion="off"]) .mic-idle,
  :root:not([data-motion="off"]) .mic-live { transition: opacity 300ms var(--ease), scale 300ms var(--ease), filter 300ms var(--ease); }
  :root:not([data-motion="off"]) .rec-btn[aria-pressed="false"] .mic-live,
  :root:not([data-motion="off"]) .rec-btn[aria-pressed="true"] .mic-idle { scale: 0.25; filter: blur(4px); }
  :root:not([data-motion="off"]) .rec-btn[aria-pressed="true"] .rec-ring { animation: rec-breathe 2.4s var(--ease) infinite; }
  :root:not([data-motion="off"]) .switch-track,
  :root:not([data-motion="off"]) .switch-track::after { transition: background-color 160ms ease-out, transform 200ms var(--ease); }
  :root:not([data-motion="off"]) .drawer { transition: transform 260ms var(--ease), visibility 0s linear 260ms; }
  :root:not([data-motion="off"]) .drawer.is-open { transition: transform 300ms var(--ease), visibility 0s; }
  :root:not([data-motion="off"]) .date-chevron,
  :root:not([data-motion="off"]) .job-attachment-caret { transition: transform 200ms var(--ease); }
  :root:not([data-motion="off"]) .bar i { transition: width 300ms var(--ease); }
  :root:not([data-motion="off"]) .eq-bars i { animation: eq 1.1s ease-in-out infinite; transform-origin: center; }
  :root:not([data-motion="off"]) .eq-bars i:nth-child(2) { animation-delay: -0.2s; }
  :root:not([data-motion="off"]) .eq-bars i:nth-child(3) { animation-delay: -0.45s; }
  :root:not([data-motion="off"]) .eq-bars i:nth-child(4) { animation-delay: -0.7s; }
  :root:not([data-motion="off"]) .eq-bars i:nth-child(5) { animation-delay: -0.9s; }
  :root:not([data-motion="off"]) .ai-working-dots i { animation: dot 1.2s ease-in-out infinite; }
  :root:not([data-motion="off"]) .ai-working-dots i:nth-child(2) { animation-delay: 0.15s; }
  :root:not([data-motion="off"]) .ai-working-dots i:nth-child(3) { animation-delay: 0.3s; }
  :root:not([data-motion="off"]) .live-toggle[aria-pressed="true"] .live-dot { animation: live-dot 1.6s ease-in-out infinite; }
  :root:not([data-motion="off"]) .item:not([data-entered="1"]) { animation: enter 240ms ease-out both; }
  :root:not([data-motion="off"]) .sheet[open],
  :root:not([data-motion="off"]) .palette[open] { animation: dialog-in 240ms var(--ease) both; }
  :root:not([data-motion="off"]) .menu:not([hidden]),
  :root:not([data-motion="off"]) .search-hints:not([hidden]) { animation: pop-in 160ms ease-out both; }
  :root:not([data-motion="off"]) .toast:not([hidden]) { animation: toast-in 220ms var(--ease) both; }
  :root:not([data-motion="off"]) .batch-bar:not([hidden]) { animation: pop-in 200ms ease-out both; }
}
/* 减少动效时：只保留透明度渐变，不位移不缩放 */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="off"]) .sheet[open],
  :root:not([data-motion="off"]) .palette[open],
  :root:not([data-motion="off"]) .menu:not([hidden]),
  :root:not([data-motion="off"]) .search-hints:not([hidden]),
  :root:not([data-motion="off"]) .batch-bar:not([hidden]),
  :root:not([data-motion="off"]) .toast:not([hidden]) { animation: fade-in 150ms ease-out both; }
  :root:not([data-motion="off"]) .mic-idle,
  :root:not([data-motion="off"]) .mic-live { transition: opacity 150ms ease-out; }
  :root:not([data-motion="off"]) .drawer { transition: opacity 150ms ease-out, visibility 0s linear 150ms; opacity: 0; transform: none; }
  :root:not([data-motion="off"]) .drawer.is-open { opacity: 1; transition: opacity 150ms ease-out, visibility 0s; }
}
:root[data-motion="off"] .drawer { transform: none; }
:root[data-motion="off"] *,
:root[data-motion="off"] *::before,
:root[data-motion="off"] *::after,
:root[data-theme-switching] *,
:root[data-theme-switching] *::before,
:root[data-theme-switching] *::after {
  animation: none !important;
  transition: none !important;
}

@keyframes rec-breathe { 0%, 100% { scale: 1; opacity: 0.35; } 50% { scale: 1.12; opacity: 0.08; } }
@keyframes eq { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }
@keyframes dot { 0%, 100% { opacity: 0.3; } 50% { opacity: 1; } }
@keyframes live-dot { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---------------------------------------------------------------- responsive */
@media (min-width: 1160px) {
  .item-body:has(.job-attachment) {
    display: none;
  }
  .item.is-open .item-body:has(.job-attachment) {
    display: grid;
    grid-template-columns: minmax(0, 74ch) minmax(280px, 1fr);
    gap: 12px 24px;
    align-items: start;
  }
  .item.is-open .item-body:has(.job-attachment) .transcript { max-width: none; }
  .item.is-open .item-body:has(.job-attachment) .job-attachments { margin-block-start: 0; }
  .item.is-open .item-body:has(.job-attachment) .item-actions { grid-column: 1 / -1; margin-block-start: 4px; }
  .item.is-open .item-body:has(.job-attachment) .item-audio-wrap { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .palette-trigger { min-width: 0; }
  .palette-trigger-text, .palette-trigger .kbd-hint { display: none; }
}
@media (max-width: 860px) {
  .mic-deck { grid-template-columns: auto minmax(0, 1fr) auto; }
  .wave-well { grid-column: 1 / -1; grid-row: 2; height: 44px; }
  .rec-wave { height: 42px; }
  .settings-layout { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .settings-nav { flex-direction: row; padding: 8px 20px 8px 8px; overflow-x: auto; overflow-y: hidden; border-inline-end: 0; border-block-end: 1px solid var(--border); scrollbar-width: none; mask-image: linear-gradient(to right, #000 calc(100% - 20px), transparent 100%); }
  .settings-nav::-webkit-scrollbar { display: none; }
  .settings-tab { flex: none; min-height: 34px; }
  .settings-body { padding: 18px 18px 28px; }
  .rule-matrix { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .rule-col + .rule-col { padding-inline-start: 0; padding-block-start: 14px; border-inline-start: 0; border-block-start: 1px solid var(--border); }
}
@media (max-width: 640px) {
  :root { --topbar-h: 52px; }
  .topbar { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .topbar-inner { gap: 6px; }
  .brand-title { font-size: var(--fs); }
  .nav-btn-label, .account-name { display: none; }
  .palette-trigger, .settings-btn { width: 34px; min-width: 34px; padding: 0; justify-content: center; }
  .notes-toggle { padding: 0 8px; gap: 4px; }
  .account-btn { padding: 0 8px; }
  .topbar-actions { gap: 4px; }
  .shell { padding: 12px max(12px, env(safe-area-inset-right)) 32px max(12px, env(safe-area-inset-left)); }
  html.has-statusbar .shell { padding-block-end: 68px; }
  .col { gap: 14px; }
  .capture { border-radius: var(--r-lg); }
  .capture-head { padding: 10px 14px; }
  .pane { padding: 12px 14px 14px; }
  .queue { padding: 2px 0 8px; }
  .mic-deck { grid-template-columns: auto minmax(0, 1fr); gap: 12px; padding: 2px 0; }
  .rec-btn { width: 42px; height: 42px; }
  .rec-time { font-size: 1.375rem; }
  .rec-controls { grid-column: 1 / -1; grid-row: 3; justify-content: flex-start; }
  .rec-readout { min-width: 0; }
  .drop { flex-wrap: wrap; }
  .drop .btn { width: 100%; }
  .section-head { align-items: center; }
  .queue-tools { width: 100%; justify-content: space-between; gap: 8px; }
  .item { padding: 14px; }
  .item-top { grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; }
  .meta-item + .meta-item::before { padding-inline: 4px; }
  .item-actions { gap: 3px; }
  .item-actions .btn-icon { width: 30px; min-width: 30px; height: 30px; min-height: 30px; }
  .item-actions .btn-soft { padding-inline: 8px 10px; min-height: 30px; margin-inline-end: 2px; }
  .field-pair, .field-grid-3, .kv-cards { grid-template-columns: minmax(0, 1fr); }
  .field-row { flex-wrap: wrap; }
  .field-row > input, .field-row > select { flex-basis: 100%; }
  input[type="text"], input[type="search"], input[type="email"], input[type="url"], input[type="password"], input[type="number"], select, textarea { font-size: 16px; }
  .sheet, .sheet-small, .sheet-detail, .sheet-settings { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .sheet-head { flex-wrap: wrap; gap: 8px; padding: 10px 16px; min-height: 56px; }
  .sheet-body, .sheet-detail .sheet-body { padding: 16px 16px 28px; }
  .sheet-detail .sheet-head { align-items: flex-start; }
  .sheet-detail .sheet-head-text { flex: 1 1 100%; }
  .sheet-detail .sheet-tools { width: 100%; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
  .sheet-detail .sheet-tools .btn-primary span { display: none; }
  .sheet-detail .sheet-tools .btn-primary { width: 34px; padding: 0; }
  .batch-bar { flex-wrap: wrap; gap: 6px; }
  .batch-bar select { max-width: 140px; min-height: 30px; font-size: 1rem; }
  .polish-diff-grid { grid-template-columns: minmax(0, 1fr); }
  .hints-grid { grid-template-columns: minmax(0, 1fr); }
  .vocab-add { grid-template-columns: minmax(0, 1fr); }
  .vocab-table .col-scope { width: 110px; }
  .statusbar { width: calc(100% - 24px); margin-block-start: -52px; }
  .batch-bar > .btn span, .batch-bar > .item-more-wrap > .btn span { display: none; }
  .batch-bar > .btn:not(.btn-mini):not(.is-confirming), .batch-bar > .item-more-wrap > .btn { width: 34px; padding: 0; }
  .batch-bar > .btn.is-confirming { width: auto; padding-inline: 10px; }
  .queue-search-input { max-width: none; flex-basis: 100%; }
  .toast { inset-block-end: 12px; }
  .palette { margin-block-start: 8vh; }
  .account-menu, .theme-menu { position: fixed; inset-block-start: calc(var(--topbar-h) + 6px); inset-inline: 12px; width: auto; min-width: 0; max-width: none; }
  .shortcuts-trigger { display: none; }
  .prompt-line, .account-line { grid-template-columns: minmax(0, 1fr); gap: 6px; padding: 12px; }
  .prompt-line-actions { flex-wrap: wrap; justify-content: flex-end; }
  .push-log-row { grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; padding: 10px 12px; }
  .push-log-time { grid-column: 2; justify-self: start; }
  .push-log-actions { grid-column: 2; justify-self: start; margin-block-start: 2px; }
  .batch-bar-drawer { flex-wrap: wrap; gap: 4px; }
  .batch-bar-drawer .batch-spacer { flex: 1 0 4px; }
  .vocab-table thead { display: none; }
  .vocab-table tbody tr {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) auto 40px;
    grid-template-areas: "on right right act" "on wrong wrong wrong" "on scope case case";
    align-items: center;
    gap: 2px 6px;
    padding: 8px 6px;
    border-block-end: 1px solid var(--border);
  }
  .vocab-table tbody tr:last-child { border-block-end: 0; }
  .vocab-table td { padding: 0; border: 0; width: auto !important; }
  .vocab-table .col-on { grid-area: on; align-self: start; padding-block-start: 8px; }
  .vocab-table .col-right { grid-area: right; font-weight: 600; }
  .vocab-table .col-right input { font-weight: 600; }
  .vocab-table .col-wrong { grid-area: wrong; }
  .vocab-table .col-scope { grid-area: scope; }
  .vocab-table .col-case { grid-area: case; display: flex; align-items: center; gap: 6px; justify-content: flex-start; color: var(--text-3); font-size: var(--fs-xs); }
  .vocab-table .col-case::after { content: "区分大小写"; }
  .vocab-table .col-act { grid-area: act; }
  .vocab-table .vocab-empty { display: block; }
}
@media (max-width: 480px) {
  .brand-title { display: none; }
}
@media (forced-colors: active) {
  .btn, .chip-toggle, .view-btn, .qs-card, .settings-tab, .card, .item, .menu, .sheet, .palette { border: 1px solid ButtonText; }
  .switch-track { border: 1px solid ButtonText; }
  .palette-search-wrap:focus-within, .search-box:focus-within { outline: 2px solid Highlight; }
}

/* 抽屉内顺序：空状态紧跟筛选区，而不是被挤到底部 */
.drawer-head { order: 0; }
.drawer-filters { order: 1; }
.drawer .drawer-empty { order: 2; }
.note-list { order: 3; }
.batch-bar-drawer { order: 4; }
/* 空状态的「清理临时笔记」：作为说明文字显示，而不是一个几乎看不见的禁用按钮 */
#cleanup:disabled { opacity: 1; padding-inline: 0; color: var(--text-3); background: transparent; cursor: default; }

/* ---------- Cloudflare unlock page ---------- */
.unlock-body { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--bg); color: var(--text); }
.unlock-shell { width: min(100%, 420px); }
.unlock-card { display: grid; gap: 16px; padding: 24px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid transparent; box-shadow: var(--shadow-2); }
.unlock-brand { display: flex; align-items: center; gap: 14px; }
.unlock-brand .brand-mark { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-ink); border: 1px solid var(--border); }
.unlock-brand .brand-mark .ic { width: 22px; height: 22px; }
.unlock-title { margin: 0; font-size: var(--fs-lg); font-weight: 600; line-height: 1.3; }
.unlock-sub { margin: 4px 0 0; font-size: var(--fs-xs); color: var(--text-3); line-height: 1.45; }
.unlock-error { margin: 0; color: var(--danger); font-weight: 500; }
.unlock-actions { display: flex; justify-content: flex-end; }
.unlock-actions .btn { min-width: 120px; }

/* ---------- S3 Sync Wizard, Conflict Center & Account Index Badges ---------- */
.account-row-idx { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-3); font-size: 0.7rem; font-variant-numeric: tabular-nums; flex: none; }
.sync-wizard-box, .sync-danger-box { display: grid; gap: 10px; margin-block-start: 10px; padding: 12px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface-2); }
.sync-danger-box { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: var(--danger-soft); }
#s3ConflictsBox { margin-block-start: 10px; display: grid; gap: 8px; }
#s3ConflictsList .account-line-name { white-space: normal; overflow: visible; word-break: break-word; line-height: 1.45; }
.theme-card, .view-btn, .qs-card, .prompt-card, .target-btn, .model-chip-row, .vocab-suggest-chip, .tag-filter { border-color: var(--border-strong); }
button.tag-chip { min-height: 24px; padding-block: 2px; }
.field-note.is-danger { color: var(--danger); font-weight: 500; }
.item-audio { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; max-width: 68ch; margin: 0 auto 16px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.item-audio audio { flex: 1 1 220px; min-width: 0; height: 36px; }
.item-audio .btn { text-decoration: none; }
.drawer-tools { display: flex; align-items: center; gap: 6px; }
.drawer-close-btn { margin-inline-start: 4px; }
.extra-head-wrap, .job-attachment-head-wrap { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.extra-head-wrap > .extra-head-toggle, .job-attachment-head-wrap > .job-att-toggle { display: flex; align-items: center; gap: 8px; flex: 1 1 auto; min-width: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: start; cursor: pointer; }
.extra-head-wrap > .extra-head-toggle > .ic, .job-attachment-head-wrap > .job-att-toggle > .ic { flex: none; }
.extra-card[open] .extra-title, .job-attachment[open] .job-attachment-title { white-space: normal; }
.extra-actions-bar { display: flex; align-items: center; gap: 4px; flex: none; }
.queue-filter-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block-end: 8px; }
.queue-filter-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.queue-search-input { flex: 1 1 160px; max-width: 240px; min-height: 30px; font-size: var(--fs-xs); margin-inline-start: auto; }
.batch-more-menu { min-width: 230px; }
.batch-more-row { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.batch-more-row select { flex: 1 1 auto; min-width: 0; min-height: 30px; font-size: var(--fs-xs); }
.qs-grid { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-block: 2px; }
.qs-grid::-webkit-scrollbar { display: none; }
