/*
 * Subdots 的样式。设计语言来自 v1.0 的效果图(app-ideas 仓库 070 的设计画布):
 * 精美但克制——顶部一层非常淡的强调色渐变、白色圆角 20 的卡片配一根发丝阴影、
 * 无边框的浅色填充控件、强调色渐变的胶囊主按钮、系统字体。
 *
 * Token 只有一套,分三段:浅色(默认)、跟随系统的深色、显式选择的深色。后两段内容
 * 相同 —— 一段给"跟随系统",一段给"手动选了深色"。用到的每一个变量都要在这里定义,
 * scripts/check.ts 会查。
 */

:root {
  --bg: #F2F3F7;
  --surface: #FFFFFF;
  --surface-2: #F6F7F9;
  --fill: rgba(17, 24, 39, 0.05);
  --fill-strong: rgba(17, 24, 39, 0.08);
  --line: rgba(17, 24, 39, 0.07);
  --text: #111318;
  --text-2: #5C6270;
  --text-3: #8A909C;
  --accent: #1F66E0;
  --accent-text: #1F5AC8;
  --accent-soft: rgba(31, 102, 224, 0.10);
  --accent-soft-strong: rgba(31, 102, 224, 0.16);
  --accent-grad: linear-gradient(90deg, #1F66E0, #3172E2);
  --accent-shadow: 0 6px 16px rgba(31, 102, 224, 0.26);
  --on-accent: #FFFFFF;
  --focus: rgba(31, 102, 224, 0.6);
  --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px rgba(16, 24, 40, 0.05);
  --shadow-pop: 0 12px 40px rgba(16, 24, 40, 0.16);
  --wash: linear-gradient(180deg, rgba(31, 102, 224, 0.12) 0, rgba(31, 102, 224, 0.04) 180px, rgba(31, 102, 224, 0) 380px);
  --warn-bg: rgba(234, 138, 24, 0.14);
  --warn-text: #9A4D00;
  --danger-bg: rgba(220, 53, 38, 0.10);
  --danger-text: #B42318;
  --trial-bg: rgba(105, 84, 220, 0.12);
  --trial-text: #5440C2;
  --info-bg: #E8F1FC;
  --info-text: #1F5AB4;
  --ok-bg: #E6F2EC;
  --ok-text: #17664A;
  --neutral-bg: #ECEDF0;
  --neutral-text: #3B4250;
  --mono-1-bg: #E6F2EC; --mono-1-text: #17664A;
  --mono-2-bg: #F7ECE5; --mono-2-text: #9A4A22;
  --mono-3-bg: #FDF1E2; --mono-3-text: #9A5300;
  --mono-4-bg: #E8F1FC; --mono-4-text: #1F5AB4;
  --mono-5-bg: #EEEBFB; --mono-5-text: #5440C2;
  --mono-6-bg: #ECEDF0; --mono-6-text: #3B4250;
  --backdrop: rgba(15, 18, 26, 0.32);
  --radius-card: 20px;
  --radius-inner: 16px;
  --radius-control: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono-font: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060C19;
    --surface: #0D1628;
    --surface-2: #121D33;
    --fill: rgba(255, 255, 255, 0.06);
    --fill-strong: rgba(255, 255, 255, 0.10);
    --line: rgba(255, 255, 255, 0.07);
    --text: #EEF2FA;
    --text-2: #A3ADC2;
    --text-3: #6B7690;
    --accent-text: #8DB8FF;
    --accent-soft: rgba(141, 184, 255, 0.15);
    --accent-soft-strong: rgba(141, 184, 255, 0.24);
    --accent-shadow: 0 6px 16px rgba(31, 102, 224, 0.35);
    --focus: rgba(141, 184, 255, 0.7);
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 28px rgba(0, 0, 0, 0.26);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
    --wash: linear-gradient(180deg, rgba(31, 102, 224, 0.20) 0, rgba(31, 102, 224, 0.06) 180px, rgba(31, 102, 224, 0) 380px);
    --warn-bg: rgba(255, 159, 64, 0.16);
    --warn-text: #FFBD7A;
    --danger-bg: rgba(255, 99, 82, 0.16);
    --danger-text: #FF948A;
    --trial-bg: rgba(150, 130, 255, 0.18);
    --trial-text: #BCB0FF;
    --info-bg: rgba(141, 184, 255, 0.15);
    --info-text: #8DB8FF;
    --ok-bg: rgba(127, 217, 168, 0.15);
    --ok-text: #7FD9A8;
    --neutral-bg: rgba(214, 217, 224, 0.15);
    --neutral-text: #D6D9E0;
    --mono-1-bg: rgba(127, 217, 168, 0.15); --mono-1-text: #7FD9A8;
    --mono-2-bg: rgba(242, 169, 133, 0.15); --mono-2-text: #F2A985;
    --mono-3-bg: rgba(255, 194, 122, 0.15); --mono-3-text: #FFC27A;
    --mono-4-bg: rgba(141, 184, 255, 0.15); --mono-4-text: #8DB8FF;
    --mono-5-bg: rgba(150, 130, 255, 0.18); --mono-5-text: #BCB0FF;
    --mono-6-bg: rgba(214, 217, 224, 0.15); --mono-6-text: #D6D9E0;
    --backdrop: rgba(0, 0, 0, 0.55);
  }
}

:root[data-theme="dark"] {
  --bg: #060C19;
  --surface: #0D1628;
  --surface-2: #121D33;
  --fill: rgba(255, 255, 255, 0.06);
  --fill-strong: rgba(255, 255, 255, 0.10);
  --line: rgba(255, 255, 255, 0.07);
  --text: #EEF2FA;
  --text-2: #A3ADC2;
  --text-3: #6B7690;
  --accent-text: #8DB8FF;
  --accent-soft: rgba(141, 184, 255, 0.15);
  --accent-soft-strong: rgba(141, 184, 255, 0.24);
  --accent-shadow: 0 6px 16px rgba(31, 102, 224, 0.35);
  --focus: rgba(141, 184, 255, 0.7);
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.30), 0 10px 28px rgba(0, 0, 0, 0.26);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.5);
  --wash: linear-gradient(180deg, rgba(31, 102, 224, 0.20) 0, rgba(31, 102, 224, 0.06) 180px, rgba(31, 102, 224, 0) 380px);
  --warn-bg: rgba(255, 159, 64, 0.16);
  --warn-text: #FFBD7A;
  --danger-bg: rgba(255, 99, 82, 0.16);
  --danger-text: #FF948A;
  --trial-bg: rgba(150, 130, 255, 0.18);
  --trial-text: #BCB0FF;
  --info-bg: rgba(141, 184, 255, 0.15);
  --info-text: #8DB8FF;
  --ok-bg: rgba(127, 217, 168, 0.15);
  --ok-text: #7FD9A8;
  --neutral-bg: rgba(214, 217, 224, 0.15);
  --neutral-text: #D6D9E0;
  --mono-1-bg: rgba(127, 217, 168, 0.15); --mono-1-text: #7FD9A8;
  --mono-2-bg: rgba(242, 169, 133, 0.15); --mono-2-text: #F2A985;
  --mono-3-bg: rgba(255, 194, 122, 0.15); --mono-3-text: #FFC27A;
  --mono-4-bg: rgba(141, 184, 255, 0.15); --mono-4-text: #8DB8FF;
  --mono-5-bg: rgba(150, 130, 255, 0.18); --mono-5-text: #BCB0FF;
  --mono-6-bg: rgba(214, 217, 224, 0.15); --mono-6-text: #D6D9E0;
  --backdrop: rgba(0, 0, 0, 0.55);
}

/* ---------------------------------------------------------------- 基础 */

*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; }

body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

.wash {
  position: fixed;
  inset: 0 0 auto 0;
  height: 380px;
  background: var(--wash);
  pointer-events: none;
  z-index: 0;
}

#root { position: relative; z-index: 1; }

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

h1, h2, h3, p { margin: 0; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 50;
  padding: 10px 16px; border-radius: 999px;
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
.skip-link:focus { top: 16px; }

.boot { padding: 120px 24px; text-align: center; color: var(--text-2); }

.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------------------------- 外壳 */

.app {
  display: flex;
  min-height: 100vh;
  max-width: 1440px;
  margin: 0 auto;
}

.side {
  position: sticky; top: 0;
  width: 248px; height: 100vh; flex-shrink: 0;
  padding: 28px 16px 24px;
  display: flex; flex-direction: column; gap: 28px;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: var(--accent-grad); box-shadow: var(--accent-shadow);
  display: inline-flex; align-items: center; justify-content: center;
}

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px; border-radius: var(--radius-control);
  color: var(--text-2); font-weight: 500;
}
.nav a:hover { background: var(--fill); text-decoration: none; color: var(--text); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); font-weight: 600; }
.nav .count { margin-left: auto; font-size: 12px; color: var(--text-3); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.identity { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: var(--radius-control); }
.identity-text { min-width: 0; }
.identity-email { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.identity-how { font-size: 12px; color: var(--text-2); }

.main { flex: 1; min-width: 0; padding: 32px 32px 64px; }
/* 跳转链接和换页时程序把焦点放到 main 上,给读屏用;它不需要一圈描边。 */
.main:focus { outline: none; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; }
.page-head p { margin-top: 4px; color: var(--text-2); }
.page-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.back { display: inline-flex; align-items: center; gap: 4px; color: var(--text-2); margin-bottom: 12px; }

/* ---------------------------------------------------------------- 卡片与网格 */

.card {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  padding: 22px 24px;
  min-width: 0;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.card-head p { color: var(--text-2); font-size: 13px; margin-top: 2px; }
.card-foot { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--text-2); font-size: 13px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.stat-label { color: var(--text-2); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.stat-value { margin-top: 10px; font-size: 30px; font-weight: 650; letter-spacing: -0.02em; }
.stat-value .approx { color: var(--text-3); font-weight: 500; margin-right: 2px; }
.stat-note { margin-top: 6px; color: var(--text-2); font-size: 13px; }

/* ---------------------------------------------------------------- 行 */

.rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-top: 1px solid var(--line); min-width: 0;
}
.row:first-child { border-top: 0; padding-top: 0; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row-sub { color: var(--text-2); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.row-side { text-align: right; flex-shrink: 0; }
.row-amount { font-weight: 600; }
.row-equiv { color: var(--text-3); font-size: 12px; }
a.row, a.row-link, a.day-item, a.chain-node { color: inherit; }
a.row:hover, a.row-link:hover, a.day-item:hover, a.chain-node:hover { text-decoration: none; background: var(--fill); }
.row-link { border-radius: var(--radius-control); margin: 0 -10px; padding-left: 10px; padding-right: 10px; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--text-3); }
.dot-danger { background: var(--danger-text); }
.dot-warn { background: var(--warn-text); }
.dot-info { background: var(--info-text); }
.dot-trial { background: var(--trial-text); }

.day-group { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.day-group:first-child { border-top: 0; padding-top: 0; }
.day-date { font-weight: 650; }
.day-rel { color: var(--text-3); font-size: 12px; white-space: nowrap; }
.day-items { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.day-item { display: flex; align-items: center; gap: 12px; min-width: 0; }

/* ---------------------------------------------------------------- 头像与标签 */

.mono {
  width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; letter-spacing: -0.02em;
}
.mono-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
.mono-1 { background: var(--mono-1-bg); color: var(--mono-1-text); }
.mono-2 { background: var(--mono-2-bg); color: var(--mono-2-text); }
.mono-3 { background: var(--mono-3-bg); color: var(--mono-3-text); }
.mono-4 { background: var(--mono-4-bg); color: var(--mono-4-text); }
.mono-5 { background: var(--mono-5-bg); color: var(--mono-5-text); }
.mono-6 { background: var(--mono-6-bg); color: var(--mono-6-text); }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 1; white-space: nowrap;
  background: var(--neutral-bg); color: var(--neutral-text);
}
.chip-warn { background: var(--warn-bg); color: var(--warn-text); }
.chip-danger { background: var(--danger-bg); color: var(--danger-text); }
.chip-trial { background: var(--trial-bg); color: var(--trial-text); }
.chip-info { background: var(--info-bg); color: var(--info-text); }
.chip-ok { background: var(--ok-bg); color: var(--ok-text); }
.chip-accent { background: var(--accent-soft); color: var(--accent-text); }

.count-badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--fill-strong); color: var(--text-2); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }

/* ---------------------------------------------------------------- 按钮 */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 18px; border-radius: 999px; border: 0;
  font-size: 14px; font-weight: 600; white-space: nowrap; cursor: pointer;
  background: var(--fill); color: var(--text); text-decoration: none;
}
.btn:hover { background: var(--fill-strong); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--accent-grad); color: var(--on-accent); box-shadow: var(--accent-shadow); }
.btn-primary:hover { background: var(--accent-grad); filter: brightness(1.05); }
.btn-danger { background: var(--danger-bg); color: var(--danger-text); }
.btn-danger:hover { background: var(--danger-bg); filter: brightness(0.97); }
.btn-quiet { background: transparent; color: var(--text-2); }
.btn-quiet:hover { background: var(--fill); color: var(--text); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; font-weight: 600; }
.btn-link:hover { text-decoration: underline; }

.icon { width: 16px; height: 16px; flex-shrink: 0; display: block; }

/* ---------------------------------------------------------------- 表单 */

.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .span-2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-2); }
.field-hint { font-size: 12px; color: var(--text-3); }
.field-error { font-size: 12px; color: var(--danger-text); }

.input, .select, .textarea {
  width: 100%; min-height: 44px; padding: 10px 14px;
  border: 0; border-radius: var(--radius-control);
  background: var(--fill); color: var(--text);
  outline: none;
}
.textarea { min-height: 88px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { box-shadow: 0 0 0 3px var(--accent-soft-strong); outline: none; }
.input[aria-invalid="true"] { box-shadow: 0 0 0 2px var(--danger-text); }
.input-code { font-family: var(--mono-font); letter-spacing: 0.4em; font-size: 20px; text-align: center; }
.input-group { display: flex; gap: 8px; }
.input-group .select { flex: 0 0 auto; width: auto; min-width: 96px; }

.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--accent); flex-shrink: 0; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: var(--fill); flex-wrap: wrap; }
.seg button, .seg label { height: 32px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; }
.seg button[aria-pressed="true"], .seg label:has(input:checked) { background: var(--surface); color: var(--text); box-shadow: var(--shadow-card); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }

.search { position: relative; min-width: 260px; }
.search .input { padding-left: 38px; border-radius: 999px; min-height: 40px; background: var(--surface); box-shadow: var(--shadow-card); }
.search .icon { position: absolute; left: 14px; top: 12px; color: var(--text-3); }

.steps { display: flex; gap: 8px; margin: 0 0 20px; padding: 0; list-style: none; flex-wrap: wrap; }
.step { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px; border-radius: 999px; background: var(--fill); color: var(--text-2); font-size: 13px; font-weight: 600; }
.step[aria-current="step"] { background: var(--accent-soft); color: var(--accent-text); }
.step-n { width: 20px; height: 20px; border-radius: 50%; background: var(--surface); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; }

.picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pick {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px; border: 0; border-radius: var(--radius-inner);
  background: var(--surface-2); cursor: pointer; min-width: 0;
}
.pick:hover { background: var(--fill-strong); }
.pick[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--accent); background: var(--accent-soft); }
.pick-name { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pick-sub { display: block; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.preview { padding: 12px 14px; border-radius: var(--radius-control); background: var(--accent-soft); color: var(--accent-text); font-size: 13px; }
.note { padding: 12px 14px; border-radius: var(--radius-control); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.note-warn { background: var(--warn-bg); color: var(--warn-text); }
.note-danger { background: var(--danger-bg); color: var(--danger-text); }

.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 4px; }
.form-actions .grow { flex: 1; }

/* ---------------------------------------------------------------- 列表页 */

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .select { width: auto; min-height: 36px; padding: 6px 12px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-card); }

.group { margin-bottom: 16px; }
.group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 0 4px 8px; }
.group-title { font-weight: 650; }
.group-meta { color: var(--text-2); font-size: 13px; }

.sub-row { display: grid; grid-template-columns: 36px minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1.2fr) minmax(0, 1fr); align-items: center; gap: 14px; padding: 12px 10px; border-radius: var(--radius-control); color: inherit; }
.sub-row:hover { background: var(--fill); text-decoration: none; }
.sub-row + .sub-row { border-top: 1px solid var(--line); }
.sub-col { min-width: 0; }

details.collapse > summary { cursor: pointer; list-style: none; color: var(--text-2); font-weight: 600; padding: 8px 4px; }
details.collapse > summary::-webkit-details-marker { display: none; }

/* ---------------------------------------------------------------- 详情 */

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.status-card { position: relative; overflow: hidden; }
.status-title { display: flex; align-items: center; gap: 14px; }
.status-title h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.status-line { margin-top: 14px; font-size: 16px; font-weight: 600; }
.status-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 16px; }

.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 20px; margin: 0; }
.facts dt { color: var(--text-2); font-size: 13px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.chain { display: flex; flex-direction: column; gap: 8px; }
.chain-node { padding: 12px 14px; border-radius: var(--radius-inner); background: var(--surface-2); }
.chain-label { color: var(--text-3); font-size: 12px; }
.chain-arrow { color: var(--text-3); padding-left: 18px; font-size: 12px; }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--text-3); font-weight: 600; font-size: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 4px; border-bottom: 1px solid var(--line); vertical-align: middle; }
td.num, th.num { text-align: right; }
tr:last-child td { border-bottom: 0; }

.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.timeline .when { color: var(--text-3); }

/* ---------------------------------------------------------------- 图表 */

.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); align-items: end; gap: 12px; height: 168px; padding-top: 24px; }
.bar { position: relative; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; border: 0; background: none; padding: 0; cursor: default; }
.bar-fill { width: 100%; max-width: 40px; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); opacity: 0.85; }
.bar:hover .bar-fill, .bar:focus-visible .bar-fill { opacity: 1; }
.bar-value { font-size: 12px; color: var(--text-2); margin-bottom: 6px; white-space: nowrap; }
.bar-tip { position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translate(-50%, 4px); opacity: 0; pointer-events: none; padding: 6px 10px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 12px; white-space: nowrap; transition: opacity .15s ease, transform .15s ease; z-index: 2; }
.bar:hover .bar-tip, .bar:focus-visible .bar-tip { opacity: 1; transform: translate(-50%, 0); }
.bar-axis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 8px; color: var(--text-3); font-size: 12px; text-align: center; border-top: 1px solid var(--line); padding-top: 8px; }
figure { margin: 0; }
figcaption { margin-top: 10px; color: var(--text-2); font-size: 13px; }
details.table-view { margin-top: 12px; }
details.table-view > summary { cursor: pointer; color: var(--text-2); font-size: 13px; }

/* ---------------------------------------------------------------- 弹层与提示 */

dialog {
  border: 0; padding: 0; border-radius: 22px; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop);
}
dialog::backdrop { background: var(--backdrop); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-body h2 { font-size: 18px; font-weight: 650; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-pop); }
.toast-danger { background: var(--danger-text); color: #FFFFFF; }
.toast button { border: 0; background: transparent; color: inherit; cursor: pointer; font-size: 16px; line-height: 1; }

.empty { text-align: center; padding: 40px 16px; color: var(--text-2); }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 6px; }
.empty .btn { margin-top: 16px; }
.empty .page-actions { justify-content: center; }

.banner { padding: 12px 16px; border-radius: var(--radius-inner); margin-bottom: 16px; background: var(--info-bg); color: var(--info-text); }
.banner-warn { background: var(--warn-bg); color: var(--warn-text); }
.banner-danger { background: var(--danger-bg); color: var(--danger-text); }

/* ---------------------------------------------------------------- 登录与引导 */

.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 48px 16px; }
.auth-card { width: min(420px, 100%); }
.auth-card .brand { justify-content: center; margin-bottom: 28px; padding: 0; }
.auth-title { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; text-align: center; }
.auth-lead { color: var(--text-2); text-align: center; margin-top: 8px; }
.auth-body { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.btn-apple { background: var(--text); color: var(--bg); }
.btn-apple:hover { background: var(--text); filter: brightness(1.15); }
.hint-last { text-align: center; font-size: 13px; color: var(--accent-text); }
.auth-foot { margin-top: 20px; text-align: center; font-size: 12px; color: var(--text-3); }

.onboard { max-width: 560px; margin: 0 auto; padding: 64px 16px; }
.onboard-title { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 28px; }
.onboard-note { margin: 20px 0; display: flex; flex-direction: column; gap: 4px; }
.onboard-note-actions { margin-top: 8px; }

/* ---------------------------------------------------------------- 响应式 */

@media (max-width: 1100px) {
  .grid-main, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .sub-row { grid-template-columns: 36px minmax(0, 2fr) minmax(0, 1.3fr) minmax(0, 1fr); }
  .sub-row .sub-col-account { display: none; }
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .side { position: sticky; top: 0; z-index: 20; width: 100%; height: auto; padding: 12px 16px; gap: 10px; flex-direction: row; align-items: center; background: var(--bg); box-shadow: 0 1px 0 var(--line); overflow-x: auto; }
  .side .brand span:last-child { display: none; }
  .nav { flex-direction: row; gap: 4px; }
  .nav a { height: 36px; padding: 0 12px; white-space: nowrap; }
  .nav .count { display: none; }
  .side-foot { display: none; }
  .main { padding: 20px 16px 48px; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  .page-head h1 { font-size: 24px; }
  .search { min-width: 0; width: 100%; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .sub-row { grid-template-columns: 36px minmax(0, 1fr) auto; }
  .sub-row .sub-col-meta, .sub-row .sub-col-account { display: none; }
  .card { padding: 18px 16px; }
  .day-group { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .facts { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .facts dd { margin-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

.currency-input { flex: 0 0 auto; width: 104px; text-transform: uppercase; }
