/* 工作台 · 纸面与墨色。手机优先，≥1024px 切换为侧栏布局。 */

:root {
  color-scheme: light dark;
  interpolate-size: allow-keywords;

  --bg: #F5F3EE;
  --side: #EEEBE4;
  --surface: #FFFFFF;
  --surface-2: #FBFAF7;
  --sunken: #F1EEE8;
  --ink: #1B1F27;
  --ink-2: #4A505C;
  --muted: #858A94;
  --faint: #B9BCC2;
  --line: #E8E4DC;
  --line-2: #DCD7CC;

  --brand: #1F2A44;
  --on-brand: #FFFFFF;
  --focus: rgba(47, 98, 214, .22);

  --late: #C23F2A;
  --late-bg: #FBEBE6;
  --late-line: #F0C9BF;
  --today: #1F2A44;
  --today-bg: #E8EAF0;
  --doing: #2F62D6;
  --doing-bg: #E9EFFC;
  --wait: #9C6206;
  --wait-bg: #F8EFDC;
  --mark: #0E7462;
  --mark-bg: #E4F2EE;
  --done: #2E8456;
  --done-bg: #E3F2E9;

  --logo-bg: #1F2A44;
  --logo-fg: #FFFFFF;
  --logo-dot: #E0563D;
  --art-bg: #1F2A44;

  --toast-bg: #1E2330;
  --toast-fg: #F4F2ED;
  --toast-accent: #A8C0FF;

  /* 看板图表：分类色经 dataviz 校验（浅色对 #FFFFFF、深色对 #1A1D23） */
  --s-1: #257DE0;
  --s-2: #F47230;
  --s-3: #00B894;
  --s-quiet-1: #BFC3CA;
  --s-quiet-2: #8E949E;
  --bar: #2F5FA8;

  --shadow-sm: 0 1px 2px rgba(40, 32, 20, .05);
  --shadow: 0 1px 2px rgba(40, 32, 20, .04), 0 6px 18px -6px rgba(40, 32, 20, .08);
  --shadow-lg: 0 18px 48px -12px rgba(20, 18, 12, .28);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", "Segoe UI", system-ui, sans-serif;
  --serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --side-w: 248px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121418;
    --side: #0E1013;
    --surface: #1A1D23;
    --surface-2: #1E2128;
    --sunken: #23272F;
    --ink: #ECEAE5;
    --ink-2: #B6B9C1;
    --muted: #868B95;
    --faint: #555A64;
    --line: #2A2E36;
    --line-2: #363B45;

    --brand: #E9E5DC;
    --on-brand: #15171B;
    --focus: rgba(134, 168, 255, .28);

    --late: #F2836E;
    --late-bg: rgba(242, 131, 110, .13);
    --late-line: rgba(242, 131, 110, .32);
    --today: #E9E5DC;
    --today-bg: rgba(233, 229, 220, .1);
    --doing: #8AABFF;
    --doing-bg: rgba(138, 171, 255, .13);
    --wait: #E6B054;
    --wait-bg: rgba(230, 176, 84, .13);
    --mark: #5FC8B0;
    --mark-bg: rgba(95, 200, 176, .12);
    --done: #6FCB95;
    --done-bg: rgba(111, 203, 149, .13);

    --logo-bg: #E9E5DC;
    --logo-fg: #15171B;
    --logo-dot: #F07A63;
    --art-bg: #0B0D10;

    --toast-bg: #ECEAE5;
    --toast-fg: #16181D;
    --toast-accent: #2F62D6;

    --s-1: #338CED;
    --s-2: #E76624;
    --s-3: #00A888;
    --s-quiet-1: #4A505B;
    --s-quiet-2: #747B87;
    --bar: #6E9BEA;

    --shadow-sm: none;
    --shadow: 0 0 0 1px rgba(255, 255, 255, .02), 0 8px 24px -10px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, .7);
  }
}

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 var(--font);
  font-feature-settings: "tnum";
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p, dl, dd { margin: 0; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
summary { list-style: none; cursor: pointer; }
summary::-webkit-details-marker { display: none; }
[hidden] { display: none !important; }
::selection { background: var(--doing-bg); }
:focus-visible { outline: 2px solid var(--doing); outline-offset: 2px; border-radius: 8px; }

.i {
  width: 1.15em; height: 1.15em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: fixed; top: -60px; left: 16px; z-index: 100; padding: 10px 14px; border-radius: 10px; background: var(--brand); color: var(--on-brand); }
.skip:focus { top: 12px; }

/* ---------- 按钮与表单 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 13px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface);
  font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--ink);
  transition: background-color .15s, border-color .15s, transform .12s var(--ease), box-shadow .15s;
}
.btn .i { width: 15px; height: 15px; }
.btn:hover { background: var(--sunken); }
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn-primary:hover { background: var(--brand); box-shadow: 0 4px 14px -4px color-mix(in srgb, var(--brand) 55%, transparent); }
.btn-quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn-quiet:hover { color: var(--late); background: var(--late-bg); }

.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field textarea, .field select {
  width: 100%; min-width: 0; height: 44px; padding: 0 12px;
  border: 1px solid var(--line-2); border-radius: 12px;
  background: var(--surface-2); color: var(--ink); font-size: 16px;
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.field textarea { height: auto; min-height: 112px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--doing); background: var(--surface);
  box-shadow: 0 0 0 4px var(--focus);
}
.field input[type="date"] { appearance: none; -webkit-appearance: none; display: block; line-height: 42px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.select-wrap { position: relative; display: block; }
.select-wrap select { appearance: none; -webkit-appearance: none; padding-right: 34px; }
.select-wrap .i { position: absolute; right: 11px; top: 50%; translate: 0 -50%; color: var(--muted); pointer-events: none; }
.date-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent;
  font-size: 13px; color: var(--ink-2);
  transition: background-color .15s, color .15s, border-color .15s;
}
.chip-btn:hover, .chip-btn.is-on { background: var(--today-bg); color: var(--ink); border-color: transparent; }

/* ---------- 顶栏：品牌、快速记一条、心跳 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.is-scrolled .topbar::before { border-bottom-color: var(--line); }
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.logo { width: 32px; height: 32px; display: block; }
.brand-name { display: none; font-size: 17px; font-weight: 700; letter-spacing: .04em; }

.quick {
  position: relative; flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px;
  height: 44px; padding: 0 5px 0 12px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-sm);
  transition: border-color .15s, box-shadow .2s;
}
.quick:focus-within { border-color: var(--doing); box-shadow: 0 0 0 4px var(--focus); }
.quick-icon { color: var(--muted); width: 18px; height: 18px; }
.quick input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; padding: 0 2px;
  background: transparent; font-size: 16px; color: var(--ink);
}
.quick input::placeholder { color: var(--muted); }
.quick-kbd {
  display: none; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line-2);
  font: 12px/18px var(--font); color: var(--muted);
}
.quick-send {
  display: grid; place-items: center; flex: none;
  width: 34px; height: 34px; border: 0; border-radius: 10px;
  background: var(--brand); color: var(--on-brand);
  transition: opacity .15s, transform .15s var(--ease);
}
.quick-send .i { width: 18px; height: 18px; stroke-width: 2.2; }
.quick input:placeholder-shown ~ .quick-send { opacity: .28; transform: scale(.92); }
.quick input:not(:placeholder-shown) ~ .quick-kbd { display: none; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 5;
  padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  max-height: 280px; overflow: auto;
}
.suggest button {
  display: flex; align-items: center; gap: 8px; width: 100%; height: 40px; padding: 0 10px;
  border: 0; border-radius: 9px; background: transparent; text-align: left; font-size: 15px;
}
.suggest button b { color: var(--muted); font-weight: 500; }
.suggest button[aria-selected="true"], .suggest button:hover { background: var(--sunken); }
.suggest-hint { padding: 6px 10px 4px; font-size: 12px; color: var(--muted); }

.beat { position: relative; flex: none; }
.beat > summary {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 40px; height: 40px; border-radius: 12px;
}
.beat > summary:hover { background: var(--sunken); }
.beat-dot {
  position: relative; width: 10px; height: 10px; border-radius: 50%; flex: none;
  background: #E8913A; box-shadow: 0 0 0 4px color-mix(in srgb, #E8913A 20%, transparent);
}
.beat-dot.is-ok { background: var(--done); box-shadow: 0 0 0 4px color-mix(in srgb, var(--done) 18%, transparent); }
.beat-dot.is-small { width: 8px; height: 8px; margin-top: 7px; box-shadow: none; }
.beat-label { display: none; }
.beat-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 30;
  width: min(300px, calc(100vw - 32px)); padding: 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); overflow-wrap: anywhere;
  animation: pop .18s var(--ease);
}
.beat-panel h2 { font-size: 15px; }
.beat-hint { margin-top: 2px; font-size: 13px; color: var(--muted); }
.job { display: flex; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.job > div { display: grid; gap: 1px; min-width: 0; }
.job strong { font-size: 14px; }
.job time, .job span { font-size: 12.5px; color: var(--muted); }

/* ---------- 导航（手机：底栏） ---------- */
.nav {
  position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  padding: 6px max(10px, env(safe-area-inset-left)) calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(16px);
  backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
}
.nav a {
  display: grid; justify-items: center; align-content: center; gap: 3px;
  min-height: 52px; color: var(--muted); font-size: 11.5px; font-weight: 600;
  transition: color .15s;
}
.nav-icon {
  position: relative; display: grid; place-items: center;
  width: 54px; height: 30px; border-radius: 999px;
  transition: background-color .2s var(--ease);
}
.nav-icon .i { width: 22px; height: 22px; stroke-width: 1.7; }
.nav [aria-current="page"] { color: var(--ink); }
.nav [aria-current="page"] .nav-icon { background: var(--today-bg); }
.nav [aria-current="page"] .i { stroke-width: 2; }
.badge {
  position: absolute; top: -2px; left: 32px;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--late); color: #fff; border: 2px solid var(--surface);
  font-size: 10.5px; font-weight: 700; line-height: 14px; text-align: center;
}
.nav-count { display: none; }

/* ---------- 主体 ---------- */
.main { max-width: 760px; margin: 0 auto; padding: 6px 16px calc(100px + env(safe-area-inset-bottom)); }
.notice { margin: 8px 0; padding: 10px 14px; border-radius: 12px; background: var(--today-bg); font-size: 14px; }

.page-head { padding: 14px 2px 18px; }
.page-head h1 { font-size: 30px; line-height: 1.2; font-weight: 700; letter-spacing: .02em; }
.eyebrow { font-size: 13px; color: var(--muted); font-weight: 500; margin-bottom: 4px; letter-spacing: .02em; }
.page-sub { margin-top: 6px; font-size: 14.5px; color: var(--ink-2); }
.page-sub b { font-weight: 700; color: var(--ink); }
.page-sub .tone-late-text { color: var(--late); }
.page-sub .tone-wait-text { color: var(--wait); }
.page-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; }
.head-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.page-head-row > div:first-child { flex: 1 1 auto; }

/* 今天：统计 */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat {
  display: grid; gap: 1px; padding: 10px 12px 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform .15s var(--ease), border-color .15s;
}
.stat:active { transform: scale(.97); }
.stat b { font-size: 24px; line-height: 1.15; font-weight: 700; letter-spacing: -.01em; }
.stat span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.stat.tone-late b { color: var(--late); }
.stat.tone-today b { color: var(--today); }
.stat.tone-doing b { color: var(--doing); }
.stat.tone-wait b { color: var(--wait); }
.stat.tone-late:not(.is-zero) { background: var(--late-bg); border-color: var(--late-line); }
.stat.is-zero b { color: var(--faint); }

/* 分组 */
.group { margin-top: 26px; scroll-margin-top: 80px; }
.group-head {
  display: flex; align-items: center; gap: 8px; margin: 0 4px 10px;
  font-size: 13.5px; font-weight: 650; color: var(--ink-2); letter-spacing: .04em;
}
.group-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.group-dot.tone-late { background: var(--late); }
.group-dot.tone-today { background: var(--today); }
.group-dot.tone-doing { background: var(--doing); }
.group-dot.tone-wait { background: var(--wait); }
.group-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--sunken); color: var(--ink-2);
  font-size: 12px; line-height: 20px; text-align: center; letter-spacing: 0;
}
.empty-line {
  display: flex; align-items: center; gap: 8px; padding: 12px 14px;
  border: 1px dashed var(--line-2); border-radius: 14px;
  color: var(--muted); font-size: 14px;
}
.empty-line .i { color: var(--done); width: 16px; height: 16px; stroke-width: 2.2; }
.empty-line.is-soft { border: 0; padding: 4px 16px 16px; font-size: 13px; }

/* ---------- 待办卡片 ---------- */
.list {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); overflow: hidden;
}
.list.is-flat { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.todo {
  position: relative; display: grid; grid-template-columns: 46px minmax(0, 1fr);
  padding-right: 14px;
  transition: background-color .2s, opacity .3s var(--ease), transform .3s var(--ease);
}
.todo + .todo::after, .list.is-flat .todo::after {
  content: ""; position: absolute; top: 0; left: 46px; right: 0; border-top: 1px solid var(--line);
}
.todo.is-late::before {
  content: ""; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--late);
}
.todo:has(> .todo-body > summary:hover) { background: var(--surface-2); }
.todo.is-new { animation: arrive 1.6s var(--ease); }

.check-form { display: contents; }
.check {
  position: relative; display: grid; place-items: center; align-self: start;
  width: 46px; height: 50px; margin: 0; padding: 0; border: 0; background: none;
  color: var(--on-brand);
}
.check::before {
  content: ""; position: absolute; top: 14px; left: 13px; width: 22px; height: 22px;
  border-radius: 50%; border: 1.8px solid var(--line-2); background: var(--surface);
  transition: background-color .2s var(--ease), border-color .2s, transform .2s var(--ease);
}
.check .i {
  position: absolute; top: 18px; left: 17px; width: 14px; height: 14px; stroke-width: 2.8;
  stroke-dasharray: 22; stroke-dashoffset: 22; color: #fff;
  transition: stroke-dashoffset .28s var(--ease) .06s;
}
button.check:hover::before { border-color: var(--done); background: var(--done-bg); }
button.check:active::before { transform: scale(.88); }
.s-doing .check::before { border-color: var(--doing); }
.s-waiting .check::before { border-style: dashed; border-color: var(--wait); }
.is-late .check::before { border-color: var(--late); }
.check.is-done::before, .todo.is-leaving .check::before { background: var(--done); border-color: var(--done); border-style: solid; }
.check.is-done .i, .todo.is-leaving .check .i { stroke-dashoffset: 0; }
.todo.is-leaving .todo-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.todo.is-leaving { background: var(--surface-2); }
.todo.is-dropping .todo-title { color: var(--muted); }
.todo.is-dropping .check::before { border-color: var(--faint); background: var(--sunken); }

.todo-body { min-width: 0; }
.todo-body > summary { display: grid; gap: 6px; padding: 13px 0 14px; outline-offset: -2px; }
.todo-title { font-size: 16px; line-height: 1.45; font-weight: 600; overflow-wrap: anywhere; transition: color .2s; }
.s-done .todo-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }
.todo-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.meta-text { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); }
.meta-text .i { width: 13px; height: 13px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 7px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1;
  background: var(--sunken); color: var(--ink-2);
}
.chip .i { width: 13px; height: 13px; stroke-width: 2; }
.chip-doing { background: var(--doing-bg); color: var(--doing); }
.chip-wait { background: var(--wait-bg); color: var(--wait); }
.chip-done { background: var(--done-bg); color: var(--done); }
.chip-due.tone-late { background: var(--late-bg); color: var(--late); }
.chip-due.tone-today { background: var(--today-bg); color: var(--today); }
.chip-due.tone-soon { color: var(--ink-2); }
.chip-due.tone-plain { color: var(--muted); }
.chip-project { color: var(--ink-2); }
.chip-project.is-empty { color: var(--muted); }
.pulse { position: relative; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pulse::after {
  content: ""; position: absolute; inset: -3px; border-radius: 50%;
  border: 1.5px solid currentColor; opacity: 0; animation: ping 2.2s var(--ease) infinite;
}

.mark {
  display: flex; gap: 7px; align-items: flex-start; margin-top: 2px;
  padding: 7px 10px; border-radius: 10px; background: var(--mark-bg);
  font-size: 13px; line-height: 1.55; color: var(--ink-2);
}
.mark > .i { color: var(--mark); width: 14px; height: 14px; margin-top: 2.5px; stroke-width: 2; fill: color-mix(in srgb, var(--mark) 22%, transparent); }
.mark-text {
  white-space: pre-line; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.todo-body[open] .mark-text { -webkit-line-clamp: unset; }

.todo-more { padding: 0 0 14px; }
.details { white-space: pre-wrap; font-size: 14px; color: var(--ink-2); margin-bottom: 10px; }
.facts { display: grid; gap: 3px; font-size: 13px; }
.facts div { display: flex; gap: 10px; }
.facts dt { width: 3.2em; flex: none; color: var(--muted); }
.facts dd { color: var(--ink-2); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@supports selector(::details-content) {
  .todo-body::details-content, .quote::details-content {
    block-size: 0; overflow: clip;
    transition: block-size .3s var(--ease), content-visibility .3s allow-discrete;
  }
  .todo-body[open]::details-content, .quote[open]::details-content { block-size: auto; }
}

/* 离开动画：先打勾，再收起 */
.todo.is-collapsing, .inbox-card.is-collapsing, .inbox-slot.is-collapsing {
  overflow: hidden; opacity: 0;
  transition: height .32s var(--ease), opacity .22s, padding .32s var(--ease), margin .32s var(--ease), transform .32s var(--ease);
}
.inbox-card.is-collapsing { transform: translateX(14px) scale(.98); }

/* ---------- 弹出面板（底部抽屉 / 居中对话框） ---------- */
dialog.sheet {
  width: 100%; max-width: 100%; max-height: 92dvh; margin: auto 0 0; padding: 0;
  border: 0; border-radius: 22px 22px 0 0;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-lg);
  opacity: 0; translate: 0 40px;
  transition: opacity .2s, translate .32s var(--ease), overlay .32s allow-discrete, display .32s allow-discrete;
}
dialog.sheet[open] { opacity: 1; translate: 0 0; }
@starting-style { dialog.sheet[open] { opacity: 0; translate: 0 40px; } }
dialog.sheet::backdrop {
  background: rgba(15, 14, 10, 0); transition: background-color .25s, overlay .32s allow-discrete, display .32s allow-discrete;
}
dialog.sheet[open]::backdrop { background: rgba(15, 14, 10, .38); }
@starting-style { dialog.sheet[open]::backdrop { background: rgba(15, 14, 10, 0); } }
.sheet-form {
  display: grid; gap: 14px;
  padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
}
.sheet-form::before {
  content: ""; justify-self: center; width: 38px; height: 5px; border-radius: 3px; background: var(--line-2); margin-bottom: 4px;
}
.sheet-head { display: flex; gap: 12px; align-items: center; }
.sheet-head h3 { font-size: 17px; line-height: 1.35; }
.sheet-head p { font-size: 13px; color: var(--muted); overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; }
.sheet-icon {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 12px;
  background: var(--sunken); color: var(--ink-2);
}
.sheet-icon .i { width: 20px; height: 20px; }
.sheet-icon.tone-wait { background: var(--wait-bg); color: var(--wait); }
.sheet-icon.tone-mark { background: var(--mark-bg); color: var(--mark); }
.sheet-actions { display: flex; flex-direction: row-reverse; gap: 10px; margin-top: 4px; }
.sheet-actions .btn { flex: 1; height: 46px; border-radius: 12px; font-size: 15px; }

/* ---------- 收集箱 ---------- */
.inbox-grid { display: grid; gap: 12px; }
.inbox-slot { scroll-margin-top: 90px; }
.inbox-card {
  display: grid; gap: 10px; padding: 15px 16px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow);
  transition: opacity .25s, transform .3s var(--ease), box-shadow .2s;
}
.inbox-slot:target .inbox-card { box-shadow: 0 0 0 3px var(--focus), var(--shadow); }
.inbox-top { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.source { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-2); font-weight: 600; }
.source .i { width: 14px; height: 14px; }
.dot-sep { width: 3px; height: 3px; border-radius: 50%; background: var(--faint); }
.by { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; color: var(--ink-2); white-space: nowrap; }
.by .i { width: 13px; height: 13px; }
.inbox-title { font-size: 17px; line-height: 1.45; font-weight: 650; overflow-wrap: anywhere; }
.quote > summary {
  position: relative; padding: 8px 12px 8px 14px; border-radius: 4px 12px 12px 4px;
  background: var(--sunken); border-left: 3px solid var(--line-2);
}
.quote-text {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
  font: 14px/1.7 var(--serif); color: var(--ink-2); white-space: pre-line; overflow-wrap: anywhere;
}
.quote[open] .quote-text { -webkit-line-clamp: unset; }
.inbox-actions { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.inbox-actions .btn-quiet { margin-right: auto; padding: 0 10px; }
.inbox-actions .btn-primary { padding: 0 16px; }
.revise { display: grid; gap: 12px; padding-top: 14px; border-top: 1px dashed var(--line-2); animation: drop-in .25s var(--ease); }

/* 侧栏里的收集箱预览（仅宽屏） */
.rail { display: none; }
.inbox-card.is-compact { gap: 7px; padding: 13px 14px 12px; border-radius: 16px; box-shadow: none; background: var(--surface-2); }
.is-compact .inbox-title { font-size: 15px; }
.quote-line {
  font: 13px/1.6 var(--serif); color: var(--muted);
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden;
}
.is-compact .inbox-actions .btn { height: 32px; font-size: 13px; padding: 0 11px; }
.is-compact .by { font-size: 12px; }

/* ---------- 项目 ---------- */
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); font-weight: 600; min-height: 36px; }
.switch {
  position: relative; width: 34px; height: 20px; border-radius: 999px;
  background: var(--line-2); transition: background-color .2s;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: translate .22s var(--ease);
}
[aria-checked="true"] .switch { background: var(--done); }
[aria-checked="true"] .switch::after { translate: 14px 0; }
.company { margin-top: 22px; }
.company:first-of-type { margin-top: 4px; }
.company-name {
  display: flex; align-items: baseline; gap: 10px; margin: 0 4px 10px;
  font-size: 13.5px; font-weight: 700; color: var(--ink-2); letter-spacing: .06em;
}
.company-name span { font-size: 12.5px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.project-grid { display: grid; gap: 12px; align-items: start; }
.project {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); overflow: hidden;
}
.project-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 6px; }
.project-head h3 { font-size: 16px; font-weight: 650; }
.project-count {
  min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--today-bg); color: var(--ink); font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
}
.project-count.is-zero { background: var(--sunken); color: var(--muted); }
.project .list.is-flat .todo:first-child::after { border-top-color: transparent; }

/* ---------- 空状态 ---------- */
.empty-hero { display: grid; justify-items: center; text-align: center; padding: 44px 24px 24px; }
.empty-art { width: 150px; height: 112px; margin-bottom: 10px; }
.ea-card { fill: var(--surface); stroke: var(--line-2); stroke-width: 2; }
.ea-check { fill: none; stroke: var(--done); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.ea-line { fill: none; stroke: var(--line-2); stroke-width: 2; stroke-linejoin: round; }
.ea-dot { fill: var(--logo-dot); }
.empty-hero h2 { font-size: 18px; }
.empty-hero p { margin-top: 6px; max-width: 300px; font-size: 14px; color: var(--muted); }
.empty-small { display: flex; align-items: center; gap: 8px; padding: 14px; color: var(--muted); font-size: 14px; }
.empty-small .i { color: var(--done); }

/* ---------- 提示条 ---------- */
.toasts {
  position: fixed; z-index: 60; left: 16px; right: 16px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  display: grid; justify-items: center; gap: 8px; pointer-events: none;
}
.toast {
  position: relative; overflow: hidden; pointer-events: auto;
  display: flex; align-items: center; gap: 12px; max-width: 100%;
  min-height: 48px; padding: 0 8px 0 16px; border-radius: 14px;
  background: var(--toast-bg); color: var(--toast-fg); box-shadow: var(--shadow-lg);
  font-size: 14.5px; animation: toast-in .32s var(--ease);
}
.toast.is-out { animation: toast-out .22s var(--ease) forwards; }
.toast-text { min-width: 0; padding: 12px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toast-text em { font-style: normal; opacity: .7; }
.toast .i { width: 18px; height: 18px; color: var(--toast-accent); }
.toast.is-error .i { color: #F2836E; }
.toast button {
  flex: none; height: 34px; padding: 0 10px; border: 0; border-radius: 9px;
  background: transparent; color: var(--toast-accent); font-weight: 700; font-size: 14.5px;
}
.toast-link {
  flex: none; display: inline-flex; align-items: center; height: 34px; padding: 0 10px; border-radius: 9px;
  color: var(--toast-accent); font-weight: 700;
}
.toast button:hover, .toast-link:hover { background: color-mix(in srgb, var(--toast-accent) 16%, transparent); }
.toast-bar {
  position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
  background: var(--toast-accent); opacity: .7; transform-origin: left;
  animation: shrink linear forwards;
}

/* ---------- 登录 ---------- */
.login-body {
  background:
    radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 0) 0 0 / 22px 22px,
    var(--bg);
}
.login { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr; }
.login-art { position: relative; display: grid; place-items: center; height: 318px; overflow-x: clip; padding-top: env(safe-area-inset-top); }
.art-stack { position: relative; width: 290px; height: 268px; }
.art-card {
  position: absolute; left: 0; right: 0; display: grid; grid-template-columns: 26px 1fr; gap: 6px;
  padding: 14px 16px; border-radius: 16px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: var(--shadow-lg);
  animation: float-in .8s var(--ease) backwards;
}
.art-card.c1 { top: 6px; rotate: -5deg; translate: -14px 0; animation-delay: .05s; }
.art-card.c2 { top: 76px; rotate: 2.5deg; translate: 14px 0; z-index: 2; animation-delay: .15s; }
.art-card.c3 { top: 190px; rotate: -1.5deg; translate: -4px 0; animation-delay: .25s; }
.art-check { width: 18px; height: 18px; border-radius: 50%; border: 1.8px solid var(--line-2); margin-top: 1px; }
.c1 .art-check { border-color: var(--late); }
.c2 .art-check { border-color: var(--doing); }
.c3 .art-check { border-color: var(--wait); border-style: dashed; }
.art-lines { display: grid; gap: 8px; justify-items: start; }
.art-lines > i, .art-mark i { display: block; height: 9px; border-radius: 5px; background: var(--line-2); }
.art-mark { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 9px; border-radius: 9px; background: var(--mark-bg); color: var(--mark); }
.art-mark i { background: color-mix(in srgb, var(--mark) 30%, transparent); height: 7px; }
.art-mark .i { width: 13px; height: 13px; }
.login-panel { width: 100%; max-width: 400px; margin: 0 auto; padding: 8px 24px calc(28px + env(safe-area-inset-bottom)); }
.login-logo { width: 48px; height: 48px; display: block; margin-bottom: 16px; }
.login-panel h1 { font-size: 30px; line-height: 1.2; letter-spacing: .06em; }
.lede { margin-top: 10px; color: var(--ink-2); font-size: 15px; line-height: 1.75; }
.login-form { display: grid; gap: 14px; margin-top: 26px; }
.password { position: relative; display: block; }
.password input { padding-right: 46px; }
.peek {
  position: absolute; right: 4px; top: 4px; width: 36px; height: 36px; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted);
}
.peek[aria-pressed="true"] { color: var(--doing); }
.field input[aria-invalid="true"] { border-color: var(--late); box-shadow: 0 0 0 4px var(--late-bg); }
.form-error { display: flex; align-items: center; gap: 6px; margin-top: -4px; color: var(--late); font-size: 13.5px; font-weight: 600; animation: shake .36s; }
.btn-block { width: 100%; height: 50px; border-radius: 14px; font-size: 16px; gap: 8px; }
.btn-block .i { width: 18px; height: 18px; transition: translate .2s var(--ease); }
.btn-block:hover .i { translate: 3px 0; }
.login-foot { margin-top: 28px; font-size: 12.5px; color: var(--muted); }

/* ---------- 宽屏：侧栏 + 内容区 ---------- */
@media (min-width: 1024px) {
  html { scroll-padding-top: 100px; }
  .app-body::before {
    content: ""; position: fixed; z-index: 0; inset: 0 auto 0 0; width: var(--side-w);
    background: var(--side); border-right: 1px solid var(--line);
  }
  .topbar { margin-left: var(--side-w); padding: 18px 40px 14px; }
  .topbar::before { inset: 0; }
  .brand { position: fixed; z-index: 21; top: 22px; left: 24px; }
  .brand-name { display: inline; }
  .quick { max-width: 720px; height: 48px; padding-left: 14px; }
  .quick-kbd { display: inline-block; }
  .beat { position: fixed; z-index: 21; left: 14px; bottom: 16px; width: calc(var(--side-w) - 28px); }
  .beat > summary { justify-content: flex-start; height: auto; padding: 10px 12px; border-radius: 12px; }
  .beat-label { display: grid; line-height: 1.35; }
  .beat-label strong { font-size: 13.5px; font-weight: 600; }
  .beat-label small { font-size: 12px; color: var(--muted); }
  .beat-panel { top: auto; bottom: calc(100% + 8px); left: 0; right: auto; }

  .nav {
    top: 84px; bottom: auto; left: 14px; right: auto; width: calc(var(--side-w) - 28px);
    display: grid; grid-auto-flow: row; gap: 2px; padding: 0;
    background: none; border: 0; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .nav a {
    grid-template-columns: auto 1fr auto; justify-items: start; align-items: center; gap: 10px;
    min-height: 42px; padding: 0 10px; border-radius: 11px;
    font-size: 14.5px; font-weight: 600; color: var(--ink-2);
    transition: background-color .15s, color .15s;
  }
  .nav a:hover { background: color-mix(in srgb, var(--surface) 60%, transparent); }
  .nav-icon { width: 22px; height: 22px; border-radius: 0; background: none !important; }
  .nav-icon .i { width: 20px; height: 20px; }
  .badge { display: none; }
  .nav-count {
    display: block; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px;
    background: var(--sunken); color: var(--ink-2); font-size: 12px; line-height: 20px; text-align: center;
  }
  .nav-count.is-late { background: var(--late-bg); color: var(--late); }
  .nav [aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }

  .main { max-width: none; margin: 0 0 0 var(--side-w); padding: 4px 40px 64px; position: relative; z-index: 1; }
  .main > * { max-width: 1160px; }
  .page-head { padding: 18px 2px 22px; }
  .page-head h1 { font-size: 34px; }
  .head-tools { width: auto; }
  .tab-inbox .main > .page-head, .tab-projects .main > .page-head { max-width: 1160px; }

  .today-layout { display: grid; grid-template-columns: minmax(0, 720px); gap: 40px; }
  .stats { gap: 10px; }
  .stat { padding: 14px 16px 12px; }
  .stat b { font-size: 28px; }
  .stat span { font-size: 13px; }

  .inbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; align-items: start; }
  .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
  .company { margin-top: 30px; }

  dialog.sheet {
    width: 440px; max-width: calc(100vw - 48px); margin: auto; border-radius: 20px;
    translate: 0 12px; scale: .98;
    transition: opacity .2s, translate .26s var(--ease), scale .26s var(--ease), overlay .26s allow-discrete, display .26s allow-discrete;
  }
  dialog.sheet[open] { translate: 0 0; scale: 1; }
  @starting-style { dialog.sheet[open] { opacity: 0; translate: 0 12px; scale: .98; } }
  .sheet-form { padding: 22px; }
  .sheet-form::before { display: none; }
  .sheet-actions .btn { flex: 0 0 auto; height: 40px; min-width: 88px; }
  .sheet-actions { justify-content: flex-start; }

  .toasts { left: var(--side-w); right: 0; bottom: 28px; }

  .login { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); grid-template-rows: none; }
  .login-art { height: auto; background: var(--art-bg); }
  .login-art::after {
    content: "今天 · 收集箱 · 项目"; position: absolute; left: 40px; bottom: 32px;
    font-size: 13px; letter-spacing: .2em; color: rgba(255, 255, 255, .45);
  }
  .art-stack { width: 380px; height: 290px; scale: 1.1; }
  .art-card { border-color: transparent; }
  .login-panel { align-self: center; padding: 40px; }
  .login-panel h1 { font-size: 36px; }
}

@media (min-width: 1200px) {
  .today-layout { grid-template-columns: minmax(0, 1fr) 340px; max-width: 1160px; }
  .rail {
    display: grid; gap: 10px; align-self: start; position: sticky; top: 96px;
    margin-top: 26px; padding: 16px; border-radius: 20px;
    background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
    max-height: calc(100dvh - 120px); overflow: auto;
  }
  .rail-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 4px; }
  .rail-head h2 { display: flex; align-items: center; gap: 8px; font-size: 15px; }
  .rail-head h2 .i { width: 18px; height: 18px; color: var(--ink-2); }
  .rail-head a { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 600; }
  .rail-head a:hover { color: var(--ink); }
  .rail-head a .i { width: 14px; height: 14px; }
  .rail-more { display: block; padding: 6px; text-align: center; font-size: 13px; color: var(--muted); font-weight: 600; }
}

@media (min-width: 1600px) {
  .project-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .main > * { max-width: 1320px; }
}

@media (max-width: 380px) {
  .stat { padding: 9px 9px 8px; }
  .stat b { font-size: 21px; }
  .stat span { font-size: 11px; }
}

/* ---------- 看板 ---------- */
.ea-bars { fill: none; stroke: var(--line-2); stroke-width: 7; stroke-linecap: round; }
.demo-tag {
  display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 6px;
  background: var(--wait-bg); color: var(--wait); font-size: 11.5px; font-weight: 700; line-height: 19px; letter-spacing: .04em;
}
.badge.is-warn { background: var(--wait); }
.nav-count.is-warn { background: var(--wait-bg); color: var(--wait); }

.dash-stats .stat b { white-space: nowrap; }
.dash-stats .stat b small { margin-left: 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.stat.tone-ok b { color: var(--done); }
.stat.tone-plain b { color: var(--ink); }
.stat.tone-wait:not(.is-zero) { background: var(--wait-bg); border-color: color-mix(in srgb, var(--wait) 28%, transparent); }
.stat.tone-ok.is-zero b { color: var(--done); }

.dash { display: grid; gap: 12px; margin-top: 14px; }
.stack-col { display: grid; gap: 12px; align-content: start; min-width: 0; }
.panel {
  display: grid; gap: 14px; align-content: start; min-width: 0;
  padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); scroll-margin-top: 80px;
}
.panel-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 6px 12px; }
.panel-head > div { min-width: 0; flex: 1 1 200px; }
.panel-head h2 { font-size: 16px; line-height: 1.4; font-weight: 650; }
.panel-head p { margin-top: 1px; font-size: 12.5px; color: var(--muted); }
.fresh {
  display: inline-flex; align-items: center; gap: 4px; flex: none;
  height: 24px; padding: 0 8px; border-radius: 7px; background: var(--sunken);
  font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap;
}
.fresh .i { width: 13px; height: 13px; }
.fresh.is-stale { background: var(--late-bg); color: var(--late); box-shadow: inset 0 0 0 1px var(--late-line); }
.fresh.is-missing { color: var(--ink-2); }
.head-tools { display: inline-flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; flex: none; }
.refresh-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border: 0; border-radius: 7px;
  background: var(--sunken); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.refresh-btn:hover:not(:disabled) { background: color-mix(in srgb, var(--ink) 10%, var(--sunken)); color: var(--ink); }
.refresh-btn:focus-visible { outline: 2px solid var(--doing); outline-offset: 2px; }
.refresh-btn:disabled { cursor: default; color: var(--muted); }
.refresh-icon { display: inline-block; font-size: 13px; line-height: 1; }
.refresh-btn.is-busy .refresh-icon { animation: refresh-spin 1s linear infinite; }
@keyframes refresh-spin { to { rotate: 360deg; } }
.refresh-err { font-size: 12px; font-weight: 600; color: var(--late); white-space: nowrap; }
.refresh-note { font-size: 12px; color: var(--muted); white-space: nowrap; }
.refresh-done {
  display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 8px; border-radius: 7px;
  background: var(--done-bg); color: var(--done);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.refresh-done[hidden], .refresh-note[hidden], .refresh-btn[hidden] { display: none; }
.refresh-btn .refresh-text { font-variant-numeric: tabular-nums; }
.stale-note {
  display: flex; gap: 8px; padding: 9px 12px; border-radius: 12px;
  background: var(--late-bg); color: var(--late); font-size: 13px; line-height: 1.55;
}
.stale-note .i { width: 15px; height: 15px; margin-top: 2px; }
.stale-note code { font-size: 12px; overflow-wrap: anywhere; opacity: .85; }
.dash-empty { display: flex; align-items: center; gap: 8px; padding: 18px 4px; color: var(--muted); font-size: 14px; }
.dash-empty .i { width: 16px; height: 16px; }
.foot-note { font-size: 12.5px; line-height: 1.65; color: var(--muted); }
.foot-note b { color: var(--ink-2); font-weight: 650; }
.is-soft { color: var(--muted); }

/* 需要处理 */
.alerts { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.alert {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 12px 8px 12px 12px; border-radius: 14px;
  background: var(--late-bg); border: 1px solid var(--late-line);
}
.alert.is-warning { background: var(--wait-bg); border-color: color-mix(in srgb, var(--wait) 26%, transparent); }
.alert-icon {
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: var(--late); color: #fff;
}
.is-warning .alert-icon { background: var(--wait); }
.alert-icon .i { width: 19px; height: 19px; stroke-width: 2.2; }
.alert-msg { font-size: 15px; font-weight: 650; line-height: 1.45; overflow-wrap: anywhere; }
.sev {
  display: inline-block; margin-right: 8px; padding: 0 6px; border-radius: 5px; vertical-align: 1px;
  background: var(--late); color: #fff; font-size: 11.5px; font-weight: 700; line-height: 19px;
}
.is-warning .sev { background: var(--wait); }
.alert-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 2px; font-size: 12.5px; color: var(--ink-2); }
.alert-go { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; color: var(--ink-2); }
.alert-go:hover { background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink); }
.all-good {
  display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px;
  background: var(--done-bg); color: var(--ink-2); font-size: 14px;
}
.all-good > .i { width: 22px; height: 22px; color: var(--done); stroke-width: 2.4; }
.all-good b { display: block; color: var(--ink); font-size: 15px; }
.panel.is-clear { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; padding-top: 12px; padding-bottom: 12px; }
.all-clear { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.all-clear .i { width: 18px; height: 18px; color: var(--done); stroke-width: 2.4; }

/* 运营分析：比核心运营区弱一级 */
.dash-group {
  display: flex; align-items: center; gap: 12px; margin-top: 10px;
  font-size: 13px; font-weight: 650; letter-spacing: .06em; color: var(--muted);
}
.dash-group::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.panel.is-sub { background: color-mix(in srgb, var(--surface) 55%, var(--bg)); box-shadow: none; }
.panel.is-sub .panel-head h2 { font-size: 15px; }

/* 资金：上游钱包 · 合计（大数字 / 小卡 / 进度条） */
.hero-num { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.hero-label { width: 100%; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.hero-num b { font-size: 38px; line-height: 1.1; font-weight: 700; letter-spacing: -.01em; font-feature-settings: normal; }
.hero-num .unit { font-size: 13px; color: var(--muted); font-weight: 600; }
.kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.kv div { padding: 9px 11px; border-radius: 12px; background: var(--sunken); min-width: 0; }
.kv dt { font-size: 12px; color: var(--muted); }
.kv dd { font-size: 16px; font-weight: 700; white-space: nowrap; }
.kv dd.tone-ok { color: var(--done); }
.kv dd.tone-wait { color: var(--wait); }
.kv dd.tone-late { color: var(--late); }
.runway { --tone: var(--done); padding-top: 4px; }
.wallet.tone-wait .runway { --tone: var(--wait); }
.wallet.tone-late .runway { --tone: var(--late); }
.runway-track { position: relative; height: 10px; border-radius: 5px; background: color-mix(in srgb, var(--tone) 16%, var(--surface)); }
.runway-fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--tone); }
.runway-mark { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink-2); box-shadow: 0 0 0 2px var(--surface); }
.runway-mark.is-crit { background: var(--late); }
.runway-axis { position: relative; height: 18px; margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.runway-axis span { position: absolute; top: 0; translate: -50% 0; white-space: nowrap; }
.runway-axis span:first-child { translate: 0 0; }
.runway-axis span:last-child { translate: -100% 0; }

/* 资金：上游钱包合计 */
.ut-top { display: grid; gap: 10px; align-items: end; }
.ut-top .kv div { min-width: 0; }
.ut-soon { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.ut-soon-label { color: var(--muted); font-weight: 600; margin-right: 2px; }
.ut-chip {
  display: inline-flex; align-items: center; gap: 3px; padding: 0 7px; border-radius: 6px;
  font-size: 12px; font-weight: 650; line-height: 22px; white-space: nowrap; background: var(--sunken); color: var(--muted);
}
.ut-chip .i { width: 13px; height: 13px; stroke-width: 2.2; }
.ut-chip.tone-ok { background: var(--done-bg); color: var(--done); }
.ut-chip.tone-wait { background: var(--wait-bg); color: var(--wait); }
.ut-chip.tone-late { background: var(--late); color: #fff; }
.wallet .uw-cols { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--line); }

/* 资金：上游钱包列表 */
.uw-head, .uw { display: grid; grid-template-columns: minmax(96px, 1fr) 88px minmax(132px, 1.15fr) 66px; gap: 2px 12px; align-items: center; }
.uw-head { padding: 0 10px 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.uw-head span:nth-child(2), .uw-head span:nth-child(4) { text-align: right; }
.uw-cols { display: grid; gap: 0 28px; }
.uws { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.uw { padding: 8px 10px; border-radius: 10px; box-shadow: inset 0 -1px 0 var(--line); }
.uw:last-child { box-shadow: none; }
.uw-id { display: grid; min-width: 0; }
.uw-name { font-size: 14px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uw-name .i { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; color: var(--late); stroke-width: 2.2; }
.uw-origins { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uw-bal { font-size: 15px; font-weight: 650; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.uw-cost { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.uw-cost-num { flex: none; font-weight: 600; }
.uw-cost small { flex: none; width: 3ch; font-size: 11px; color: var(--muted); text-align: right; }
.uw-cost.is-none { color: var(--muted); }
.uw-share { flex: 1 1 auto; min-width: 24px; height: 5px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.uw-share i { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--bar); }
.uw-days {
  justify-self: end; flex: none; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 650; line-height: 22px; white-space: nowrap;
  background: var(--sunken); color: var(--muted);
}
.uw-days.tone-ok { background: var(--done-bg); color: var(--done); }
.uw-days.tone-wait { background: var(--wait-bg); color: var(--wait); }
.uw-days.tone-late { background: var(--late); color: #fff; }
.uw.is-low, .uw.is-warn { box-shadow: inset 3px 0 0 var(--tone-c); background: color-mix(in srgb, var(--tone-c) 10%, var(--surface)); }
.uw.is-low { --tone-c: var(--late); }
.uw.is-warn { --tone-c: var(--wait); }
.uw.is-low .uw-name, .uw.is-low .uw-bal { color: var(--late); }
.uw.is-low .uw-share, .uw.is-warn .uw-share { background: color-mix(in srgb, var(--surface) 70%, transparent); }

.bar { grid-column: 1 / -1; display: block; height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; }
.bar i { display: block; height: 100%; min-width: 2px; border-radius: 3px; background: var(--bar); }
.more > summary {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 0;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.more > summary .i { width: 15px; height: 15px; transition: rotate .2s var(--ease); rotate: -90deg; }
.more[open] > summary .i { rotate: 0deg; }
.more[open] > summary { margin-bottom: 6px; }

/* 收入 */
.sw { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--faint); }
.s-ym, .t-input { background: var(--s-1) !important; }
.s-ld, .t-output { background: var(--s-2) !important; }
.s-hipay, .b-pos { background: var(--s-3) !important; }
.t-cache-read, .b-zero { background: var(--s-quiet-1) !important; }
.t-cache-write { background: var(--s-quiet-2) !important; }
.b-neg { background: var(--s-2) !important; }
.rev-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.rev-tile { display: grid; gap: 1px; min-width: 0; padding: 10px 11px; border-radius: 12px; background: var(--sunken); }
.rev-tile .key { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 650; color: var(--ink-2); white-space: nowrap; }
.rev-tile .key small { font-weight: 500; color: var(--muted); font-size: 11.5px; }
.rev-tile b { font-size: 19px; line-height: 1.3; font-weight: 700; overflow-wrap: anywhere; }
.rev-tile .sub { font-size: 12px; color: var(--muted); }
.chart { padding: 8px 0 24px 42px; }
.chart-plot { position: relative; height: 190px; }
.gridline { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--line); }
.gridline.is-base { border-top-color: var(--line-2); }
.gridline em {
  position: absolute; right: calc(100% + 8px); top: 0; translate: 0 -50%;
  font-style: normal; font-size: 11px; color: var(--muted); white-space: nowrap;
}
.cols { position: absolute; inset: 0; display: flex; gap: 2px; }
.col { position: relative; flex: 1 1 0; min-width: 0; outline-offset: 0; border-radius: 4px; }
.col:focus-visible { outline: 2px solid var(--doing); }
.stack {
  position: absolute; inset: 0 auto 0 50%; translate: -50% 0; width: min(100%, 22px);
  display: flex; flex-direction: column-reverse; gap: 2px; transition: opacity .15s;
}
.stack i { display: block; flex: none; min-height: 1px; }
.stack i.is-top { border-radius: 3px 3px 0 0; }
.cols:hover .col:not(:hover) .stack, .cols:has(.col:focus-visible) .col:not(:focus-visible) .stack { opacity: .45; }
.xtick { position: absolute; top: calc(100% + 6px); left: 50%; translate: -50% 0; font-size: 11px; color: var(--muted); white-space: nowrap; }
.col:last-child .xtick { left: auto; right: 0; translate: 0 0; }
.col:first-child .xtick { left: 0; translate: 0 0; }
.col template { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-tip {
  position: fixed; z-index: 70; pointer-events: none; display: grid; gap: 4px; min-width: 176px;
  padding: 9px 11px; border-radius: 11px; background: var(--toast-bg); color: var(--toast-fg);
  box-shadow: var(--shadow-lg); font-size: 12.5px;
}
.chart-tip strong { font-size: 12.5px; margin-bottom: 1px; }
.tip-row { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 6px; }
.tip-row b { font-weight: 650; text-align: right; }
.tip-row em { font-style: normal; opacity: .65; min-width: 44px; text-align: right; }
.table-wrap { overflow-x: auto; margin: 0 -16px; padding: 0 16px; -webkit-overflow-scrolling: touch; }
.table-wrap[data-more] { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.nowrap { white-space: nowrap; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tbl thead th { font-size: 12px; font-weight: 600; color: var(--muted); border-bottom-color: var(--line-2); }
.tbl .num { text-align: right; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }

/* 用量 */
.rank-tools, .health-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border-radius: 11px; background: var(--sunken); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg input:checked + span { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm), 0 0 0 1px var(--line); }
.seg input:focus-visible + span { outline: 2px solid var(--doing); outline-offset: 1px; }
.rank { margin: 0; padding: 0; list-style: none; display: grid; }
.rank li {
  display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 3px 10px; align-items: baseline;
  padding: 8px 0 9px; border-top: 1px solid var(--line);
}
.rank li:first-child { border-top: 0; }
.rank .bar, .rank-sub { grid-column: 2 / -1; }
.rank-no { font-size: 13px; font-weight: 700; color: var(--muted); text-align: center; }
.rank li:nth-child(-n+3) .rank-no { color: var(--ink); }
.rank-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-pct { font-size: 14px; font-weight: 700; }
.rank-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.rank-empty { color: var(--muted); font-size: 14px; }
.panel:has(input[name="rank-dim"]) .rank, .panel:has(input[name="rank-sort"]) .rank-note { display: none; }
.panel:has([name="rank-dim"][value="model"]:checked):has([name="rank-sort"][value="tokens"]:checked) .rank[data-dim="model"][data-sort="tokens"],
.panel:has([name="rank-dim"][value="model"]:checked):has([name="rank-sort"][value="cost"]:checked) .rank[data-dim="model"][data-sort="cost"],
.panel:has([name="rank-dim"][value="group"]:checked):has([name="rank-sort"][value="tokens"]:checked) .rank[data-dim="group"][data-sort="tokens"],
.panel:has([name="rank-dim"][value="group"]:checked):has([name="rank-sort"][value="cost"]:checked) .rank[data-dim="group"][data-sort="cost"],
.panel:has([name="rank-dim"][value="user"]:checked):has([name="rank-sort"][value="tokens"]:checked) .rank[data-dim="user"][data-sort="tokens"],
.panel:has([name="rank-dim"][value="user"]:checked):has([name="rank-sort"][value="cost"]:checked) .rank[data-dim="user"][data-sort="cost"] { display: grid; }
.panel:has([name="rank-sort"][value="tokens"]:checked) .rank-note[data-sort="tokens"],
.panel:has([name="rank-sort"][value="cost"]:checked) .rank-note[data-sort="cost"] { display: block; }
.segbar { display: flex; gap: 2px; height: 12px; border-radius: 6px; overflow: hidden; }
.segbar i { display: block; min-width: 3px; flex-basis: 0; }
.token-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.token-list li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto 52px; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; }
.token-list b { font-weight: 650; }
.token-list em { font-style: normal; font-size: 12.5px; color: var(--muted); text-align: right; }
.token-list .is-cache span { color: var(--ink-2); }
.cohorts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.cohort { display: grid; gap: 0; padding: 10px 12px; border-radius: 12px; background: var(--sunken); min-width: 0; }
.cohort b { font-size: 20px; line-height: 1.3; font-weight: 700; }
.cohort span { font-size: 13px; font-weight: 650; }
.cohort small { font-size: 11.5px; color: var(--muted); }

/* 渠道健康 */
.site-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.site-kpi, .site-codes { display: grid; padding: 10px 12px; border-radius: 12px; background: var(--sunken); min-width: 0; }
.site-kpi span, .site-codes > span { font-size: 12px; color: var(--muted); }
.site-kpi b { font-size: 20px; line-height: 1.3; font-weight: 700; }
.site-kpi b small { font-size: 12px; margin-left: 1px; color: var(--muted); font-weight: 600; }
.site-kpi b.tone-late { color: var(--late); }
.site-codes { grid-column: 1 / -1; }
.site-codes p { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.code {
  display: inline-flex; align-items: baseline; gap: 3px; padding: 1px 6px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--line); font: 600 12px/18px var(--font); color: var(--ink-2);
}
.tbl .code { background: var(--sunken); border-color: transparent; }
.code em { font-style: normal; font-weight: 500; color: var(--muted); }
.code-hint { font-size: 12px; color: var(--muted); }
.health-tbl td.codes { display: flex; gap: 4px; }
.health-tbl th[scope="row"] { font-weight: 600; }
.row-name { display: flex; align-items: center; max-width: 280px; min-width: 0; }
.row-name .nm { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-name .plat { flex: none; margin-left: 6px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.row-name .i { flex: none; }
.row-name .mini-tag { flex: none; }
.code.is-benign { color: var(--muted); font-weight: 500; background: transparent; border: 1px dashed var(--line-2); }
.code.is-benign em { color: var(--faint); }
.health-tbl th[scope="row"] .i { width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; color: var(--late); stroke-width: 2.2; }
.health-tbl th[scope="row"] { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.health-tbl tr.is-low th[scope="row"], .health-tbl tr.is-low td { background: color-mix(in srgb, var(--late) 10%, var(--surface)); }
.health-tbl tr.is-low th[scope="row"] { color: var(--late); box-shadow: inset 3px 0 0 var(--late); padding-left: 10px; }
.pct-cell small { margin-left: 4px; font-size: 11px; color: var(--wait); font-weight: 600; }
.pct { font-weight: 650; }
.pct.tone-late { color: var(--late); font-weight: 700; }
.pct.tone-few { color: var(--wait); }
.mini-tag {
  margin-left: 6px; padding: 0 5px; border-radius: 5px; background: var(--late); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 17px; display: inline-block; vertical-align: 1px;
}
.panel:has(input[name="health-dim"]) .health-pane { display: none; }
.panel:has([name="health-dim"][value="channel"]:checked) .health-pane[data-dim="channel"],
.panel:has([name="health-dim"][value="account"]:checked) .health-pane[data-dim="account"] { display: grid; gap: 8px; }
.health-pane .more-rows { display: none; }
.health-pane:has(.show-more input:checked) .more-rows { display: table-row-group; }
.show-more { display: inline-flex; align-items: center; gap: 6px; justify-self: start; padding: 6px 0; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.show-more input { position: absolute; opacity: 0; pointer-events: none; }
.show-more .i { width: 15px; height: 15px; rotate: -90deg; transition: rotate .2s var(--ease); }
.show-more:has(input:checked) .i { rotate: 0deg; }
.show-more .when-open, .show-more:has(input:checked) .when-closed { display: none; }
.show-more:has(input:checked) .when-open { display: inline; }
.show-more:has(input:focus-visible) { outline: 2px solid var(--doing); outline-offset: 2px; border-radius: 6px; }

/* 收支 */
.f-income { background: var(--s-1) !important; }
.f-qiu { background: var(--s-2) !important; }
.f-others { background: color-mix(in srgb, var(--s-2) 45%, var(--surface)) !important; }
.f-payout { background: #8E86A8 !important; }
.fin-periods { display: grid; gap: 8px; }
.fin-card { display: grid; align-content: start; gap: 10px; min-width: 0; padding: 12px 14px; border-radius: 14px; background: var(--sunken); }
.fin-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 13px; }
.fin-head b { font-weight: 700; color: var(--ink); }
.fin-head span { font-size: 12px; color: var(--muted); white-space: nowrap; }
.fin-income { display: grid; gap: 1px; min-width: 0; }
.fin-label, .fin-kv dt { font-size: 12px; font-weight: 600; color: var(--muted); }
.fin-income b { font-size: 26px; line-height: 1.25; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.fin-parts { font-size: 12px; line-height: 1.6; color: var(--muted); }
.fin-parts .est {
  display: inline-block; margin-left: 2px; padding: 0 4px; border-radius: 5px; vertical-align: 1px;
  background: var(--wait-bg); color: var(--wait); font-style: normal; font-size: 10.5px; font-weight: 700; line-height: 16px;
}
/* 支出 | 转付 | 毛利：三格等宽 */
.fin-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; align-self: end; }
.fin-kv > div { display: grid; align-content: start; gap: 1px; min-width: 0; padding: 8px 10px; border-radius: 10px; background: var(--surface); }
.fin-kv > div[title] { cursor: help; }
.fin-kv dd { font-size: 14.5px; line-height: 1.35; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.fin-profit { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--done) 30%, transparent); }
.fin-profit dd { color: var(--done); font-size: 16px; }
.fin-profit.tone-late { box-shadow: inset 0 0 0 1px var(--late-line); }
.fin-profit.tone-late dd { color: var(--late); }
/* 数据缺口：一行摘要，展开看全文 */
.fin-gap { min-width: 0; border-radius: 12px; background: var(--sunken); font-size: 12.5px; color: var(--muted); }
.fin-gap.has-gap { background: var(--wait-bg); color: var(--ink-2); }
.fin-gap > summary {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 8px 12px;
  list-style: none; cursor: pointer; line-height: 1.5;
}
.fin-gap > summary::-webkit-details-marker { display: none; }
.fin-gap > summary > .i { flex: none; width: 15px; height: 15px; color: var(--wait); }
.fin-gap:not(.has-gap) > summary > .i { color: var(--muted); transition: rotate .2s var(--ease); }
.fin-gap:not(.has-gap)[open] > summary > .i { rotate: 180deg; }
.fin-gap-line { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fin-gap-more { flex: none; font-size: 12px; font-weight: 600; color: var(--muted); }
.fin-gap[open] > summary { align-items: flex-start; }
.fin-gap[open] > summary > .i { margin-top: 2px; }
.fin-gap[open] .fin-gap-line { white-space: normal; line-height: 1.65; }
.fin-gap[open] .fin-gap-more { font-size: 0; }
.fin-gap[open] .fin-gap-more::after { content: "收起"; font-size: 12px; }
.fin-gap-body { padding: 0 12px 10px 35px; line-height: 1.65; color: var(--muted); }
.fin-pair {
  position: absolute; inset: 0 auto 0 50%; translate: -50% 0; width: min(100%, 26px);
  display: flex; align-items: stretch; gap: 1px; transition: opacity .15s;
}
.fin-bar { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column-reverse; gap: 1px; }
.fin-bar i { display: block; flex: none; min-height: 1px; }
.fin-bar i.is-top { border-radius: 3px 3px 0 0; }
.cols:hover .col:not(:hover) .fin-pair, .cols:has(.col:focus-visible) .col:not(:focus-visible) .fin-pair { opacity: .45; }
.tip-row.is-sub { opacity: .72; font-size: 12px; }
.tip-row.is-total { margin-top: 2px; padding-top: 4px; border-top: 1px solid color-mix(in srgb, var(--toast-fg) 18%, transparent); }
.tip-row > i:not(.sw) { width: 10px; }
.tip-note { margin-top: 2px; font-size: 11.5px; opacity: .7; }

@media (max-width: 420px) {
  .dash-stats .stat b { font-size: 18px; }
  .dash-stats .stat b small { font-size: 11px; margin-left: 1px; }
  .hero-num b { font-size: 32px; }
  .kv dd { font-size: 15px; }
  .ut-top .kv { grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); }
  .seg span { padding: 0 10px; }
}

@media (max-width: 639px) {
  .uw-head { display: none; }
  .uw { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
  .uw-cost { grid-column: 1; }
  .uw-days { grid-column: 2; }
  .row-name { max-width: 180px; }
  .rev-tiles { grid-template-columns: 1fr; gap: 6px; }
  .rev-tile { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding: 9px 12px; }
  .rev-tile b { grid-column: 2; grid-row: 1 / span 2; font-size: 18px; text-align: right; }
}

@media (min-width: 640px) {
  .site-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (min-width: 1024px) {
  .dash { gap: 16px; margin-top: 18px; }
  .stack-col { gap: 16px; }
  .panel { padding: 18px 20px; }
  .table-wrap { margin: 0 -20px; padding: 0 20px; }
  .chart-plot { height: 220px; }
}

@media (min-width: 1200px) {
  .dash { grid-template-columns: repeat(12, minmax(0, 1fr)); align-items: start; }
  .span-full { grid-column: 1 / -1; }
  .span-7 { grid-column: span 7; }
  .span-5 { grid-column: span 5; }
  .dash > .panel.span-7 { align-self: stretch; }
  .dash > .stack-col:first-child { align-self: stretch; grid-template-rows: auto 1fr; }
  .site-row { grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 2fr); }
  .site-codes { grid-column: auto; }
  .uw-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 中等宽度：期间卡片纵向排列，卡内左右两栏 */
@media (min-width: 640px) and (max-width: 1199px) {
  .fin-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); column-gap: 16px; }
  .fin-head { grid-column: 1 / -1; }
}
@media (min-width: 1200px) {
  .fin-periods { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
}

@media (min-width: 760px) {
  .ut-top { grid-template-columns: minmax(0, 1fr) minmax(0, 520px); }
}

/* ---------- 动效 ---------- */
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(.97); } }
@keyframes shrink { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes ping { 0% { opacity: .8; transform: scale(.6); } 70%, 100% { opacity: 0; transform: scale(1.6); } }
@keyframes arrive { 0% { background: var(--doing-bg); } 100% { background: transparent; } }
@keyframes shake { 0%, 100% { translate: 0; } 25% { translate: -4px; } 75% { translate: 4px; } }
@keyframes float-in { from { opacity: 0; translate: 0 18px; } }

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* 看板顶部 6 张指标卡 */
.dash-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-stats .stat { align-content: start; min-width: 0; }
.dash-stats .stat b, .dash-stats .stat span { overflow: hidden; text-overflow: ellipsis; }
.stat .stat-sub { font-style: normal; font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.stat .stat-days { font-style: normal; font-weight: 700; color: var(--ink-2); }
.stat .stat-days.tone-late { color: var(--late); }
.stat .stat-days.tone-warn { color: var(--wait); }
.stat .stat-days.tone-ok { color: var(--done); }
@media (min-width: 640px) {
  .dash-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .dash-stats { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .dash-stats .stat { padding: 12px 14px 11px; }
  .dash-stats .stat b { font-size: 24px; }
}

/* ---------- 公网只读看板模式 ---------- */
.is-public .brand-name { display: inline; }
.is-public .main { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
@media (min-width: 1024px) {
  .is-public.app-body::before { display: none; }
  .is-public .topbar { margin-left: 0; }
  .is-public .brand { position: static; }
  .is-public .main { margin-left: 0; }
  .is-public .main > * { max-width: none; }
  .is-public .toasts { left: 0; }
}
