/* =====================================================================
 * TokenTally · Design System v3
 * - 中性色：冷灰（slate）；界面主题色可在“系统管理 → 品牌与备份”中切换（蓝 / 靛蓝 / 紫 / 青 / 石墨）
 * - 图表：分类色 / 顺序色 / 状态色取自经色盲校验的参考调色板，浅色、深色两套分别针对各自底色校验；
 *   图表颜色与界面主题色相互独立，切换主题色不会改变数据颜色
 * - 间距 4px 基数；圆角 6 / 10 / 14；正文 14px；数字列等宽
 * ===================================================================== */
:root {
  color-scheme: light;
  /* 主题色预设（默认：蓝）；-l 用于浅色模式，-d 用于深色模式 */
  --accent-l: #2563eb; --accent-d: #2563eb; --accent-ink-l: #ffffff; --accent-ink-d: #ffffff; --accent-2: #60a5fa;
  --accent-text-l: #1d4ed8; --accent-text-d: #7aa7ff; --acc-rgb: 37 99 235; --acc-rgb-d: 96 150 255;

  --page: #f3f5f9; --surface: #ffffff; --surface-2: #f7f9fc; --surface-3: #eef2f7; --raised: #ffffff; --side-bg: #fbfcfe;
  --ink: #0f172a; --ink-2: #334155; --muted: #5b6678; --faint: #838da0;
  --grid: #e8ecf2; --axis: #c3cbd7; --border: rgba(15,23,42,.08); --border-strong: rgba(15,23,42,.15);
  --accent: var(--accent-l); --accent-ink: var(--accent-ink-l); --accent-text: var(--accent-text-l);
  --accent-wash: rgb(var(--acc-rgb) / .07); --accent-wash-2: rgb(var(--acc-rgb) / .13); --accent-ring: rgb(var(--acc-rgb) / .24);
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300; --s7: #6250d6; --s8: #e34948; --other: #b5b8bf;
  --good: #0ca30c; --good-ink: #006300; --good-wash: rgba(12,163,12,.10);
  --warn: #fab219; --warn-ink: #8a5a00; --warn-wash: rgba(250,178,25,.16);
  --crit: #d03b3b; --crit-ink: #b42318; --crit-wash: rgba(208,59,59,.09);
  --q0: #eef2f7; --q1: #cde2fb; --q2: #9ec5f4; --q3: #6da7ec; --q4: #3987e5; --q5: #256abf; --q6: #184f95; --q7: #0d366b;
  --div-neg: #2a78d6; --div-pos: #e34948;
  /* 界面点缀色（KPI 图标与迷你趋势线），不用于分类图表 */
  --t-blue: #2563eb; --t-blue-bg: rgba(37,99,235,.10); --t-violet: #7c3aed; --t-violet-bg: rgba(124,58,237,.10);
  --t-teal: #0f766e; --t-teal-bg: rgba(13,148,136,.11); --t-sky: #0369a1; --t-sky-bg: rgba(2,132,199,.11);
  --t-amber: #b45309; --t-amber-bg: rgba(217,119,6,.12); --t-indigo: #4338ca; --t-indigo-bg: rgba(79,70,229,.10);
  --t-fuchsia: #a21caf; --t-fuchsia-bg: rgba(192,38,211,.10);
  --shadow-1: 0 1px 2px rgba(15,23,42,.06);
  --shadow-2: 0 1px 2px rgba(15,23,42,.04), 0 4px 18px -8px rgba(15,23,42,.12);
  --shadow-3: 0 2px 6px rgba(15,23,42,.06), 0 18px 40px -16px rgba(15,23,42,.26);
  --shadow-pop: 0 20px 50px -12px rgba(15,23,42,.30), 0 2px 8px rgba(15,23,42,.08);
  --hl: inset 0 1px 0 rgba(255,255,255,.7);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6678' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --topbar-h: 56px; --side-w: 236px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}
/* 主题色预设 */
:root[data-accent="indigo"] { --accent-l: #4f46e5; --accent-d: #4f46e5; --accent-2: #818cf8; --accent-text-l: #4338ca; --accent-text-d: #a5a8ff; --acc-rgb: 79 70 229; --acc-rgb-d: 129 140 248; }
:root[data-accent="violet"] { --accent-l: #7c3aed; --accent-d: #7c3aed; --accent-2: #a78bfa; --accent-text-l: #6d28d9; --accent-text-d: #c0a3ff; --acc-rgb: 124 58 237; --acc-rgb-d: 167 139 250; }
:root[data-accent="teal"] { --accent-l: #0f766e; --accent-d: #0f766e; --accent-2: #2dd4bf; --accent-text-l: #0f766e; --accent-text-d: #3cd6c2; --acc-rgb: 13 148 136; --acc-rgb-d: 45 212 191; }
:root[data-accent="graphite"] { --accent-l: #1e293b; --accent-d: #e2e8f0; --accent-ink-d: #0f172a; --accent-2: #64748b; --accent-text-l: #1e293b; --accent-text-d: #e2e8f0; --acc-rgb: 51 65 85; --acc-rgb-d: 203 213 225; }

@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) {
    color-scheme: dark;
    --page: #0b1018; --surface: #121823; --surface-2: #171e2b; --surface-3: #1f2735; --raised: #1a2230; --side-bg: #0e141e;
    --ink: #e8edf5; --ink-2: #c4ccd8; --muted: #8f9aab; --faint: #6f7b8e;
    --grid: #212a38; --axis: #354052; --border: rgba(255,255,255,.07); --border-strong: rgba(255,255,255,.13);
    --accent: var(--accent-d); --accent-ink: var(--accent-ink-d); --accent-text: var(--accent-text-d);
    --accent-wash: rgb(var(--acc-rgb-d) / .12); --accent-wash-2: rgb(var(--acc-rgb-d) / .2); --accent-ring: rgb(var(--acc-rgb-d) / .35);
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #596273;
    --good-ink: #3fc23f; --good-wash: rgba(12,163,12,.16); --warn-ink: #f4be4f; --warn-wash: rgba(250,178,25,.14); --crit-ink: #ef7d7d; --crit-wash: rgba(230,103,103,.14);
    --q0: #1f2735; --div-neg: #3987e5; --div-pos: #e66767;
    --t-blue: #7aa7ff; --t-blue-bg: rgba(96,150,255,.15); --t-violet: #b79bff; --t-violet-bg: rgba(167,139,250,.15);
    --t-teal: #3cd6c2; --t-teal-bg: rgba(45,212,191,.13); --t-sky: #5ec4f5; --t-sky-bg: rgba(56,189,248,.13);
    --t-amber: #f2b45c; --t-amber-bg: rgba(245,158,11,.14); --t-indigo: #a5a8ff; --t-indigo-bg: rgba(129,140,248,.15);
    --t-fuchsia: #ea8cf5; --t-fuchsia-bg: rgba(232,121,249,.13);
    --shadow-1: 0 1px 2px rgba(0,0,0,.45); --shadow-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-3: 0 2px 6px rgba(0,0,0,.5), 0 20px 44px -16px rgba(0,0,0,.75); --shadow-pop: 0 20px 56px -10px rgba(0,0,0,.7), 0 2px 8px rgba(0,0,0,.4);
    --hl: inset 0 1px 0 rgba(255,255,255,.04);
    --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f9aab' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0b1018; --surface: #121823; --surface-2: #171e2b; --surface-3: #1f2735; --raised: #1a2230; --side-bg: #0e141e;
  --ink: #e8edf5; --ink-2: #c4ccd8; --muted: #8f9aab; --faint: #6f7b8e;
  --grid: #212a38; --axis: #354052; --border: rgba(255,255,255,.07); --border-strong: rgba(255,255,255,.13);
  --accent: var(--accent-d); --accent-ink: var(--accent-ink-d); --accent-text: var(--accent-text-d);
  --accent-wash: rgb(var(--acc-rgb-d) / .12); --accent-wash-2: rgb(var(--acc-rgb-d) / .2); --accent-ring: rgb(var(--acc-rgb-d) / .35);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300; --s7: #9085e9; --s8: #e66767; --other: #596273;
  --good-ink: #3fc23f; --good-wash: rgba(12,163,12,.16); --warn-ink: #f4be4f; --warn-wash: rgba(250,178,25,.14); --crit-ink: #ef7d7d; --crit-wash: rgba(230,103,103,.14);
  --q0: #1f2735; --div-neg: #3987e5; --div-pos: #e66767;
  --t-blue: #7aa7ff; --t-blue-bg: rgba(96,150,255,.15); --t-violet: #b79bff; --t-violet-bg: rgba(167,139,250,.15);
  --t-teal: #3cd6c2; --t-teal-bg: rgba(45,212,191,.13); --t-sky: #5ec4f5; --t-sky-bg: rgba(56,189,248,.13);
  --t-amber: #f2b45c; --t-amber-bg: rgba(245,158,11,.14); --t-indigo: #a5a8ff; --t-indigo-bg: rgba(129,140,248,.15);
  --t-fuchsia: #ea8cf5; --t-fuchsia-bg: rgba(232,121,249,.13);
  --shadow-1: 0 1px 2px rgba(0,0,0,.45); --shadow-2: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
  --shadow-3: 0 2px 6px rgba(0,0,0,.5), 0 20px 44px -16px rgba(0,0,0,.75); --shadow-pop: 0 20px 56px -10px rgba(0,0,0,.7), 0 2px 8px rgba(0,0,0,.4);
  --hl: inset 0 1px 0 rgba(255,255,255,.04);
  --chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f9aab' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ---------------- 基础 ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--page); color: var(--ink); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
html { scrollbar-color: color-mix(in srgb, var(--ink) 24%, transparent) transparent; }
.sidebar, .tbl-wrap, .insights, .heat-wrap, .dlg-b, .timeline, pre.code, .report-prev, .pop { scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--ink) 20%, transparent) transparent; }
::selection { background: var(--accent-wash-2); }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.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; }
.ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -3px; }
.ok-text { color: var(--good-ink); } .acc-text { color: var(--accent-text); } .bad-text { color: var(--crit-ink); } .warn-text { color: var(--warn-ink); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------------- 应用框架 ---------------- */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.app.collapsed { --side-w: 64px; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--side-bg); border-right: 1px solid var(--border); display: flex; flex-direction: column; padding: 14px 12px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 6px 14px; min-width: 0; height: 54px; }
.brand-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(140deg, var(--accent-2), var(--accent)); display: grid; place-items: center; flex: none; box-shadow: 0 6px 14px -6px rgb(var(--acc-rgb) / .75), inset 0 1px 0 rgba(255,255,255,.28); }
.brand-mark svg { width: 18px; height: 18px; stroke: var(--accent-ink); }
.brand-text { min-width: 0; line-height: 1.25; }
.brand-text b { display: block; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { display: block; font-size: 11px; color: var(--muted); white-space: nowrap; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.nav-sec { font-size: 11px; font-weight: 600; letter-spacing: .08em; color: var(--faint); padding: 16px 10px 6px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 2px 0; border-radius: 9px; color: var(--ink-2); cursor: pointer; border: 0; background: none; text-align: left; width: 100%; white-space: nowrap; font-size: 13.5px; transition: background-color .15s, color .15s; }
.nav-item svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--muted); transition: color .15s; }
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }
.nav-item[aria-current="page"] { background: var(--accent-wash-2); color: var(--accent-text); font-weight: 600; }
.nav-item[aria-current="page"] svg { color: var(--accent-text); }
.nav-item[aria-current="page"]::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav-item .badge { margin-left: auto; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; display: inline-grid; place-items: center; font-size: 11px; font-style: normal; color: var(--muted); background: var(--surface-3); font-weight: 600; font-variant-numeric: tabular-nums; }
.nav-item[aria-current="page"] .badge { background: var(--accent); color: var(--accent-ink); }
.side-foot { margin-top: auto; padding: 12px 4px 4px; display: grid; gap: 8px; }
.side-card { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; font-size: 12px; color: var(--muted); line-height: 1.65; background: var(--surface); box-shadow: var(--shadow-1); }
.side-card b { color: var(--ink-2); font-weight: 600; display: inline-flex; align-items: center; gap: 6px; }
.side-card b::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-wash); }
.app.collapsed .brand-text, .app.collapsed .nav-item span, .app.collapsed .nav-item .badge, .app.collapsed .nav-sec, .app.collapsed .side-card { display: none; }
.app.collapsed .nav-item { justify-content: center; }
.app.collapsed .nav-item[aria-current="page"]::before { left: -12px; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; min-height: var(--topbar-h); background: color-mix(in srgb, var(--page) 80%, transparent); backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid transparent; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 20px 6px 12px; transition: border-color .2s, background-color .2s, box-shadow .2s; }
.topbar.scrolled { border-bottom-color: var(--border); background: color-mix(in srgb, var(--surface) 86%, transparent); box-shadow: 0 8px 24px -20px rgba(15,23,42,.5); }
.loadbar { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; pointer-events: none; }
.loadbar::after { content: ""; position: absolute; top: 0; bottom: 0; width: 30%; background: var(--accent); transform: translateX(-100%); opacity: 0; }
.loading .loadbar::after { opacity: 1; animation: loadbar 1s ease-in-out infinite; }
@keyframes loadbar { from { transform: translateX(-100%); } to { transform: translateX(340%); } }
/* 标题至少显示 4 个字；顶栏放不下时周期控件 / 右侧按钮整体换行（此前固定一行，图标按钮被压缩、标题只剩“成…”，日期框会盖住右侧按钮） */
.page-title { display: flex; flex-direction: column; min-width: 72px; flex: 1 1 72px; line-height: 1.25; }
#btnCollapse, #periodBox { flex: none; }
.page-title h1 { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-group { display: flex; align-items: center; gap: 6px; flex: none; }
.tb-right { display: flex; align-items: center; gap: 10px; flex: none; margin-left: auto; }
.tb-right > * { flex: none; }
.tb-sep { width: 1px; height: 24px; background: var(--border-strong); margin: 0 4px; }
.content { padding: 16px 20px 40px; width: 100%; max-width: 1760px; margin: 0 auto; }
.content.dim { opacity: .55; transition: opacity .15s; pointer-events: none; }

/* ---------------- 按钮 & 表单 ---------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border: 1px solid var(--border-strong); background: var(--surface); border-radius: 8px; padding: 0 12px; cursor: pointer; white-space: nowrap; color: var(--ink); font-size: 13px; box-shadow: var(--shadow-1); transition: background-color .15s, border-color .15s, box-shadow .15s, transform .08s, filter .15s; }
.btn:hover { background: var(--surface-2); border-color: color-mix(in srgb, var(--border-strong) 60%, var(--ink) 18%); }
.btn:active:not(:disabled) { transform: translateY(1px); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff), var(--accent)); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; box-shadow: 0 1px 2px rgb(var(--acc-rgb) / .3), 0 4px 12px -6px rgb(var(--acc-rgb) / .55), inset 0 1px 0 rgba(255,255,255,.18); }
.btn.primary:hover { filter: brightness(1.06) saturate(1.05); }
.btn.danger { color: var(--crit-ink); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); box-shadow: none; }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn.icon { width: 32px; padding: 0; }
.btn.icon.sm { width: 26px; }
.btn .count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 11px; display: inline-grid; place-items: center; font-weight: 600; }
.inp { height: 32px; border: 1px solid var(--border-strong); background-color: var(--surface); border-radius: 8px; padding: 0 10px; min-width: 0; color: var(--ink); font-size: 13px; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s, background-color .15s; }
textarea.inp { height: auto; padding: 8px 10px; }
.inp::placeholder { color: var(--faint); }
.inp:hover { border-color: color-mix(in srgb, var(--border-strong) 60%, var(--ink) 30%); }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.inp.active { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background-color: var(--accent-wash); color: var(--accent-text); font-weight: 500; }
.inp.invalid { border-color: var(--crit); background-color: var(--crit-wash); }
.copy { display: inline-grid; place-items: center; width: 20px; height: 20px; padding: 0; margin-left: 4px; border: 0; border-radius: 5px; background: transparent; color: var(--faint); cursor: pointer; vertical-align: -4px; opacity: .7; }
.copy:hover, .copy:focus-visible { background: var(--surface-3); color: var(--ink); opacity: 1; }
.copy .ico { width: 13px; height: 13px; }
tr .copy { opacity: 0; } tr:hover .copy, tr:focus-within .copy, tr .copy:focus-visible { opacity: .8; }
@media (hover: none) { tr .copy { opacity: .7; } }
select.inp { appearance: none; -webkit-appearance: none; padding-right: 30px; cursor: pointer; background-image: var(--chev); background-repeat: no-repeat; background-position: right 9px center; background-size: 14px; }
select.inp option { background: var(--raised); color: var(--ink); }
.inp.sm { height: 26px; font-size: 12px; padding: 0 6px; border-radius: 6px; }
select.inp.sm { padding-right: 24px; background-position: right 6px center; background-size: 12px; }
.seg { display: inline-flex; padding: 2px; border-radius: 9px; background: var(--surface-3); gap: 2px; box-shadow: inset 0 0 0 1px var(--border); }
.seg button { border: 0; background: transparent; height: 28px; padding: 0 11px; border-radius: 7px; cursor: pointer; color: var(--ink-2); font-size: 13px; white-space: nowrap; transition: background-color .15s, color .15s, box-shadow .15s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(15,23,42,.1), 0 0 0 1px var(--border); }
.seg.sm button { height: 22px; padding: 0 8px; font-size: 12px; border-radius: 6px; }
.seg.scroll { max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.seg.scroll::-webkit-scrollbar { display: none; }
.seg.scroll button { flex: none; }
.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.chk input { width: 15px; height: 15px; accent-color: var(--accent); }
.chk.full { white-space: normal; align-items: flex-start; line-height: 1.5; }
.chk.full input { flex: none; margin-top: 2px; }
.field { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--ink-2); min-width: 0; }
.field > span { font-weight: 500; white-space: nowrap; }
.field .inp { width: 100%; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
/* 窄栏中的固定两列表单（告警规则）：标签较长时允许折行（不折行会溢出到相邻一栏，1024~1440 宽与手机上标签重叠），同一行的输入框底部对齐 */
.form-grid.wrap-labels { align-items: end; }
.form-grid.wrap-labels .field > span { white-space: normal; line-height: 1.45; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.link { color: var(--accent-text); cursor: pointer; background: none; border: 0; padding: 0; font-size: inherit; }
.link:hover { text-decoration: underline; }

/* 状态徽标 */
.pill { display: inline-flex; align-items: center; gap: 3px; height: 20px; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.pill.bad { background: var(--crit-wash); color: var(--crit-ink); }
.pill.good { background: var(--good-wash); color: var(--good-ink); }
.pill.warn { background: var(--warn-wash); color: var(--warn-ink); }
.pill.info { background: var(--accent-wash-2); color: var(--accent-text); }
.pill.neutral, .pill.flat, .pill.na { background: var(--surface-3); color: var(--ink-2); font-weight: 500; }
.cmp { font-size: 12px; color: var(--muted); white-space: nowrap; }
.state { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.state.on::before { background: var(--good); } .state.off::before { background: var(--crit); } .state.warn::before { background: var(--warn); }
.tag { display: inline-flex; align-items: center; height: 18px; font-size: 11px; padding: 0 6px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); margin-left: 6px; white-space: nowrap; vertical-align: 1px; }
.tag.warn { background: var(--warn-wash); color: var(--warn-ink); } .tag.off { background: var(--crit-wash); color: var(--crit-ink); }
.role { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap; }
.role.admin { background: var(--accent-wash-2); color: var(--accent-text); }
.sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; flex: none; vertical-align: 1px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.ok { background: var(--good); } .dot.bad { background: var(--crit); } .dot.warn { background: var(--warn); } .dot.busy { background: var(--accent); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.progress { width: 100%; height: 4px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }

/* 顶栏组件 */
.period-badge { font-size: 11.5px; }
.sync-btn { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; box-shadow: var(--shadow-1); transition: background-color .15s; }
.sync-btn .dot.ok { box-shadow: 0 0 0 3px var(--good-wash); }
.sync-btn:hover { background: var(--surface-2); }
.user-btn { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 4px; border-radius: 8px; border: 0; background: none; cursor: pointer; color: var(--ink); }
.user-btn:hover { background: var(--surface-2); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(140deg, var(--accent-2), var(--accent)); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 12px; text-transform: uppercase; box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--accent-wash-2); }

/* 弹出层 */
.pop { position: fixed; z-index: 90; min-width: 220px; max-width: min(380px, calc(100vw - 24px)); background: var(--raised); border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; animation: popin .16s var(--ease); transform-origin: top right; }
@keyframes popin { from { opacity: 0; transform: translateY(-6px) scale(.98); } }
.pop-h { padding: 8px 10px 6px; font-size: 12px; color: var(--muted); }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--ink); text-align: left; transition: background-color .12s; }
.pop-item:hover { background: var(--surface-3); }
.pop-item .ico { color: var(--muted); }
.pop-sep { height: 1px; background: var(--border); margin: 4px 0; }
.pop-body { padding: 8px 10px; display: grid; gap: 12px; font-size: 12.5px; }
.sync-row { display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 10px; align-items: start; }
.sync-row > .dot { margin-top: 6px; }
.sync-body { display: grid; gap: 3px; min-width: 0; }
.sync-body b { font-weight: 600; font-size: 13px; white-space: nowrap; }
.sync-body > span { color: var(--muted); font-size: 12px; line-height: 1.5; }
.sync-body .progress { margin-top: 2px; }
.pop.wide { min-width: 320px; }

/* ---------------- 筛选条 ---------------- */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin-bottom: 12px; }
.filterbar .fgroup { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; flex: 1 1 560px; min-width: 0; }
.filterbar .fgroup > select.inp { flex: 0 1 190px; min-width: 120px; max-width: 220px; }
.filterbar .search { position: relative; flex: 1 1 200px; min-width: 160px; max-width: 360px; }
.filterbar .search .inp { width: 100%; max-width: none; padding-left: 30px; }
.filterbar .search .ico { position: absolute; left: 9px; top: 8px; color: var(--faint); }
.filterbar .metric { display: inline-flex; align-items: center; gap: 6px; flex: none; margin-left: auto; white-space: nowrap; }
.filterbar .lbl { font-size: 12px; color: var(--muted); }
.more-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 12px; margin: -4px 0 12px; border: 1px dashed var(--border-strong); border-radius: var(--r); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 4px 0 10px; border-radius: 999px; background: var(--accent-wash); color: var(--accent-text); font-size: 12px; border: 1px solid var(--accent-wash-2); animation: popin .18s var(--ease); }
.fchip b { font-weight: 600; }
.fchip.warn { background: color-mix(in srgb, var(--warn-wash) 80%, var(--surface)); color: var(--warn-ink); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }
.fchip.warn button:hover { background: var(--warn-wash); }
.chips .chip-note { font-size: 12px; color: var(--muted); margin-right: 6px; }
.filterbar .metric .seg button[aria-pressed="true"]:not([data-metric="pretax"]) { color: var(--warn-ink); }
.fchip button { width: 20px; height: 20px; border-radius: 50%; border: 0; background: transparent; color: inherit; cursor: pointer; display: grid; place-items: center; }
.fchip button:hover { background: var(--accent-wash-2); }

/* ---------------- 提示 ---------------- */
.notices { display: grid; gap: 8px; margin-bottom: 12px; }
.notice { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--border); background: var(--surface); border-radius: var(--r); padding: 10px 14px; font-size: 13px; box-shadow: var(--shadow-1); line-height: 1.6; }
.notice .ico { margin-top: 3px; }
.notice.warn { background: color-mix(in srgb, var(--warn-wash) 55%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); border-left: 3px solid var(--warn); }
.notice.warn > .ico { color: var(--warn-ink); }
.notice.err { background: color-mix(in srgb, var(--crit-wash) 70%, var(--surface)); border-color: color-mix(in srgb, var(--crit) 30%, transparent); border-left: 3px solid var(--crit); }
.notice.err > .ico { color: var(--crit-ink); }
.notice.info { background: color-mix(in srgb, var(--accent-wash) 80%, var(--surface)); border-color: var(--accent-wash-2); border-left: 3px solid var(--accent); }
.notice.info > .ico { color: var(--accent-text); }
.notice b { font-weight: 600; }
.notice .why { display: block; color: var(--ink-2); word-break: break-word; }

/* ---------------- BI 栅格 & 卡片 ---------------- */
.bi { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c7 { grid-column: span 7; } .c6 { grid-column: span 6; } .c5 { grid-column: span 5; } .c4 { grid-column: span 4; }
@media (max-width: 1180px) { .c4 { grid-column: span 6; } .c8, .c7, .c5 { grid-column: span 12; } }
@media (max-width: 760px) { .c4, .c6 { grid-column: span 12; } }
.sec-h { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; margin: 10px 0 -2px; font-size: 12px; font-weight: 650; color: var(--muted); letter-spacing: .06em; }
.sec-h::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2), var(--hl); padding: 15px 18px 18px; min-width: 0; display: flex; flex-direction: column; }
.panel + .panel { margin-top: 14px; }
.bi > .panel + .panel { margin-top: 0; }
.panel-h { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; min-height: 28px; flex-wrap: wrap; }
.panel-h h3 { margin: 0; font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; line-height: 1.35; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.panel-h .sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 1 1 0; }
.panel-h .actions { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 100%; }
/* 很窄的屏幕（320px）上分段按钮组放不下时在组内换行，不撑出页面 */
.panel-h .actions .seg { flex-wrap: wrap; max-width: 100%; }
.help { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; color: var(--faint); cursor: help; }
.help .ico { width: 14px; height: 14px; }
.panel-body { flex: 1; min-height: 0; }
.panel-foot { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* KPI */
.kpis { display: grid; grid-template-columns: minmax(300px, 1.45fr) repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-2), var(--hl); padding: 15px 18px; min-width: 0; display: flex; flex-direction: column; gap: 4px; overflow: hidden; --tone: var(--accent-text); --tone-bg: var(--accent-wash-2); }
.kpi[data-tone="blue"] { --tone: var(--t-blue); --tone-bg: var(--t-blue-bg); } .kpi[data-tone="violet"] { --tone: var(--t-violet); --tone-bg: var(--t-violet-bg); }
.kpi[data-tone="teal"] { --tone: var(--t-teal); --tone-bg: var(--t-teal-bg); } .kpi[data-tone="sky"] { --tone: var(--t-sky); --tone-bg: var(--t-sky-bg); }
.kpi[data-tone="amber"] { --tone: var(--t-amber); --tone-bg: var(--t-amber-bg); } .kpi[data-tone="indigo"] { --tone: var(--t-indigo); --tone-bg: var(--t-indigo-bg); }
.kpi[data-tone="fuchsia"] { --tone: var(--t-fuchsia); --tone-bg: var(--t-fuchsia-bg); }
.kpi-h { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 12.5px; min-width: 0; }
.kpi-h span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--tone-bg); color: var(--tone); flex: none; }
.kpi-ico .ico { width: 15px; height: 15px; }
.kpi .value { font-size: 25px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi .value small { font-size: 14px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.kpi .trend { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-height: 20px; }
.kpi .meta { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: auto; padding-top: 2px; }
.kpi.hero { grid-row: span 2; padding: 18px 20px 14px; background: radial-gradient(120% 70% at 0% 0%, rgb(var(--acc-rgb) / .11), transparent 62%), linear-gradient(180deg, color-mix(in srgb, var(--accent-wash) 60%, var(--surface)) 0%, var(--surface) 58%); border-color: color-mix(in srgb, var(--accent) 16%, var(--border)); }
.kpi.hero::before { content: ""; position: absolute; right: -70px; top: -90px; width: 240px; height: 240px; border-radius: 50%; background: radial-gradient(circle, rgb(var(--acc-rgb) / .16), transparent 68%); pointer-events: none; }
.kpi.hero > * { position: relative; }
.kpi.hero .kpi-ico { background: linear-gradient(140deg, var(--accent-2), var(--accent)); color: var(--accent-ink); box-shadow: 0 4px 10px -4px rgb(var(--acc-rgb) / .6); }
.kpi.hero .value { font-size: 42px; font-weight: 750; letter-spacing: -.03em; line-height: 1.1; margin: 10px 0 6px; }
.kpi.hero { container-type: inline-size; }
.kpi .stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
@container (max-width: 380px) { .kpi .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 10px; } }
.kpi .stats div { min-width: 0; }
.kpi .stats span { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.kpi .stats b { display: block; font-weight: 600; font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .spark { margin-top: auto; padding-top: 10px; }
.kpi .spark svg { display: block; width: 100%; height: 60px; }
.kpi .kspark { margin-top: auto; padding-top: 8px; height: 44px; }
.kpi .kspark svg { display: block; width: 100%; height: 36px; overflow: visible; }
.kpi .kspark + .meta { margin-top: 4px; }
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi.hero { grid-column: 1 / -1; grid-row: auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 24px; }
  .kpi.hero > .kpi-h, .kpi.hero > .value, .kpi.hero > .trend { grid-column: 1; }
  .kpi.hero > .stats { grid-column: 1; }
  .kpi.hero > .spark { grid-column: 2; grid-row: 1 / span 4; align-self: end; }
}
@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi.hero { display: flex; }
  .kpi.hero .value { font-size: 32px; }
  .kpi .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 初始设置清单（首页，仅管理员） */
.setup { margin-bottom: 14px; gap: 12px; }
.setup.solo { border-color: color-mix(in srgb, var(--accent) 18%, var(--border)); }
.setup-h { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 4px 10px; }
.setup-ttl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.setup-ttl h3 { margin: 0; font-size: 15px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.setup-ttl h3 .ico { color: var(--accent-text); }
.setup-x { align-self: start; }
.setup-sub { grid-column: 1 / -1; margin: 0; }
.setup .progress { height: 6px; border-radius: 3px; }
.setup .progress > i { background: var(--good); border-radius: 3px; }
.setup-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.setup-steps > li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 6px 12px; padding: 10px; border-radius: var(--r); }
.setup-steps > li + li { border-top: 1px solid var(--border); border-top-left-radius: 0; border-top-right-radius: 0; }
.setup-steps > li.next { background: var(--accent-wash); border-top-color: transparent; border-radius: var(--r); }
.setup-steps > li.next + li { border-top-color: transparent; }
.step-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--muted); border: 1.5px solid var(--border-strong); background: var(--surface); align-self: start; }
.step-n .ico { width: 15px; height: 15px; stroke-width: 2.6; }
li.done .step-n { background: var(--good); border-color: var(--good); color: #fff; }
li.next .step-n { border-color: var(--accent); color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-ring); }
li.blocked .step-n { border-style: dashed; color: var(--faint); }
.step-b { min-width: 0; line-height: 1.5; padding-top: 3px; }
.step-t { font-weight: 600; font-size: 13.5px; color: var(--ink); overflow-wrap: anywhere; }
li.done .step-t { color: var(--ink-2); font-weight: 500; }
li.blocked .step-t { color: var(--muted); font-weight: 500; }
.step-pill { margin-left: 8px; vertical-align: 1px; }
.step-d { display: block; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; }
.step-d code { font: 12px var(--mono); background: var(--surface-3); color: var(--ink-2); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.step-w { display: flex; align-items: flex-start; gap: 6px; margin-top: 4px; font-size: 12.5px; color: var(--warn-ink); overflow-wrap: anywhere; }
.step-w .ico { margin-top: 2px; width: 14px; height: 14px; }
.step-a { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.step-a:empty { display: none; }
.setup:not(.solo) .setup-steps > li.done { padding-block: 6px; } /* 显示在概览上方时，已完成的步骤收紧，少占首屏高度 */
.setup-foot { margin: 0; padding-top: 2px; }
@media (max-width: 640px) {
  .setup-steps > li { grid-template-columns: 28px minmax(0, 1fr); align-items: start; padding: 10px 6px; gap: 8px 10px; }
  .step-a { grid-column: 2; justify-content: flex-start; }
  li.done .step-a { margin-left: -9px; } /* 已完成步骤的按钮无边框：文字与说明左对齐 */
}

/* 预算 */
.budget { margin-top: 10px; display: grid; gap: 5px; font-size: 12px; }
.budget-top { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.budget-top b { font-weight: 600; color: var(--ink-2); }
.budget-fc { font-size: 11.5px; }
.mini-budget { display: grid; gap: 3px; min-width: 110px; }
.mini-budget .progress { height: 4px; }
.mini-budget span { font-size: 11.5px; }

/* 排行列表（两行式：名称/数值 + 条形/占比/环比） */
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rank li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 0 8px; padding: 6px 6px; border-radius: 8px; align-items: start; }
.rank li.clickable { cursor: pointer; }
.rank li:hover { background: var(--surface-2); }
.rank-no { width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-3); font-variant-numeric: tabular-nums; margin-top: 1px; }
.rank li:nth-child(-n+3) .rank-no { background: var(--accent-wash-2); color: var(--accent-text); }
.rank li:first-child .rank-no { background: linear-gradient(140deg, var(--accent-2), var(--accent)); color: var(--accent-ink); }
.rank li { transition: background-color .12s; }
.rank-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.rank-label { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.rank-label small { color: var(--muted); font-size: 11.5px; margin-left: 6px; }
.rank-val { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-bot { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.rank-bar { flex: 1 1 auto; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; display: flex; gap: 2px; }
.rank-bar i { display: block; height: 100%; border-radius: 0 3px 3px 0; }
.rank-bar i + i { border-radius: 0; }
.rank-bar i:last-child { border-radius: 0 3px 3px 0; }
.rank-bar .stack { display: flex; gap: 2px; height: 100%; min-width: 2px; }
.rank-bar .stack i { min-width: 1px; border-radius: 0; }
.rank-bar .stack i:last-child { border-radius: 0 3px 3px 0; }
.rank-meta { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.rank-meta .pill { height: 18px; font-size: 11px; padding: 0 6px; }
.more { color: var(--muted); font-size: 12px; margin-top: 8px; padding-left: 6px; }
/* 发散（环比变动） */
.dv-bar { flex: 1 1 auto; display: grid; grid-template-columns: 1fr 1fr; height: 8px; }
.dv-bar .neg { display: flex; justify-content: flex-end; border-right: 1px solid var(--axis); }
.dv-bar .pos { display: flex; }
.dv-bar .neg i { background: var(--div-neg); border-radius: 3px 0 0 3px; height: 100%; }
.dv-bar .pos i { background: var(--div-pos); border-radius: 0 3px 3px 0; height: 100%; }

/* 分段条 & 图例 */
.segbar { display: flex; gap: 2px; height: 28px; margin: 2px 0 14px; }
.segbar > div { height: 100%; border-radius: 4px; min-width: 2px; display: flex; align-items: center; padding: 0 7px; font-size: 11.5px; font-weight: 600; color: #fff; overflow: hidden; white-space: nowrap; container-type: inline-size; }
/* 段宽不足以完整显示百分比时隐藏标签（悬停提示仍可查看） */
@container (max-width: 30px) { .segbar > div > span { display: none; } }
.segbar > div.dk { color: #0b0b0b; }
.segbar.thin { height: 10px; margin: 6px 0 4px; }
.segbar.thin > div { padding: 0; border-radius: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); margin-bottom: 8px; }
.legend span { display: inline-flex; align-items: center; min-width: 0; max-width: 220px; }
.legend span em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; flex: none; }
.legend i.line { height: 3px; border-radius: 2px; width: 14px; }
.lgl { display: grid; gap: 2px; font-size: 12.5px; }
.lgl .li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 48px; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 6px; }
.lgl .li:hover { background: var(--surface-2); }
.lgl .li.clickable { cursor: pointer; }
.lgl .li i { width: 10px; height: 10px; border-radius: 3px; }
.lgl .li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lgl .li b { font-weight: 600; font-variant-numeric: tabular-nums; }
.lgl .li em { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.dim-block + .dim-block { margin-top: 14px; }
.dim-h { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.dim-h b { font-weight: 600; }
.dim-h span { color: var(--muted); text-align: right; }

/* 洞察 */
/* 宽屏下“关键发现”不参与行高计算，与左侧趋势卡片等高、内部滚动 */
.ins-panel .insights { grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); overflow: visible; }
.insights { list-style: none; margin: 0; padding: 0 4px 0 0; display: grid; gap: 10px; overflow-y: auto; min-height: 0; flex: 1 1 auto; align-content: start; scrollbar-width: thin; }
.ins { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.ins-ico { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-wash-2); color: var(--accent-text); }
.ins.warn .ins-ico { background: var(--warn-wash); color: var(--warn-ink); }
.ins.bad .ins-ico { background: var(--crit-wash); color: var(--crit-ink); }
.ins.good .ins-ico { background: var(--good-wash); color: var(--good-ink); }
.ins-t { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.ins-d { font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.ins-d b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.ins .link { font-size: 12px; margin-top: 4px; }

/* KPI 行（详情页） */
.kpi-wrap { container-type: inline-size; margin-bottom: 14px; }
.kpi-row { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.kpi-row.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@container (max-width: 1080px) { .kpi-row { grid-template-columns: repeat(3, minmax(0, 1fr)); } .kpi-row.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container (max-width: 560px) { .kpi-row, .kpi-row.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi-row .kpi .value { font-size: 19px; } }
.kpi-row .kpi .value { font-size: 22px; }
.kpi-row .budget { margin-top: 6px; }
/* 时间线 */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: 12.5px; max-height: 260px; overflow: auto; }
.timeline li { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.timeline b { font-weight: 600; font-variant-numeric: tabular-nums; }

/* 治理摘要 */
.gov-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.gov-c { border-radius: var(--r); padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); }
.gov-c b { display: block; font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.2; }
.gov-c span { font-size: 12px; color: var(--muted); }
.gov-c.high b { color: var(--crit-ink); } .gov-c.medium b { color: var(--warn-ink); } .gov-c.low b { color: var(--ink-2); }
.gov-c.zero b { color: var(--faint); }
.gov-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; font-size: 12.5px; }
.gov-list li { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; padding: 6px 6px; border-radius: 6px; }
.gov-list li b { font-variant-numeric: tabular-nums; }
.gov-list li:hover { background: var(--surface-2); }
.rule-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.rule-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--ink-2); }
.rule-chip b { font-variant-numeric: tabular-nums; color: var(--ink); }
.rule-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-wash); color: var(--accent-text); }

.pager-nav { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.pager-nav .btn { gap: 2px; }

/* 详情页头 */
.back { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; background: none; border: 0; cursor: pointer; padding: 0; }
.back:hover { color: var(--accent-text); }
.entity-h { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.entity-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-wash-2); color: var(--accent-text); flex: none; }
.entity-ico .ico { width: 22px; height: 22px; }
.entity-t { min-width: 0; flex: 1 1 300px; }
.entity-t h2 { margin: 0; font-size: 20px; font-weight: 650; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.entity-t .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.entity-t .sub .mono { color: var(--ink-2); }

/* SVG 图表 */
.chart { width: 100%; position: relative; }
.chart svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--faint); font-size: 11px; font-family: var(--font); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .weekend { fill: var(--ink); fill-opacity: .025; }
.chart .hit { fill: transparent; }
.chart .hit:hover { fill: var(--ink); fill-opacity: .05; }
.chart .ann { fill: var(--ink-2); font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.chart .avgline { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 4 4; opacity: .6; }

/* 热力图 */
.heat-wrap { overflow-x: auto; padding-bottom: 4px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: 11px; }
.heat th { font-weight: 500; color: var(--muted); padding: 0 6px 0 0; white-space: nowrap; text-align: left; position: sticky; left: 0; background: var(--surface); z-index: 1; max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
.heat th.clickable { cursor: pointer; } .heat th.clickable:hover { color: var(--accent-text); }
.heat thead th { text-align: center; position: static; font-variant-numeric: tabular-nums; padding: 0; color: var(--faint); }
.heat thead th.we { color: var(--muted); font-weight: 600; }
.heat td { width: 22px; min-width: 20px; height: 22px; border-radius: 4px; background: var(--q0); }
.heat td.h1 { background: var(--q1); } .heat td.h2 { background: var(--q2); } .heat td.h3 { background: var(--q3); } .heat td.h4 { background: var(--q4); } .heat td.h5 { background: var(--q5); } .heat td.h6 { background: var(--q6); } .heat td.h7 { background: var(--q7); }
.heat td.tot { background: none; width: auto; text-align: right; padding-left: 8px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scale { display: inline-flex; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); }
.scale i { width: 18px; height: 10px; display: inline-block; border-radius: 2px; }

/* ---------------- 表格 ---------------- */
.tbl-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
/* 表格区域高度随视口：表头始终可见，横向滚动条留在可视范围内，避免页面与表格双重滚动的割裂感 */
.tbl-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--r); max-height: max(320px, calc(100vh - 190px)); background: var(--surface); overscroll-behavior: contain; }
.dt tbody tr:last-child td { border-bottom: 0; }
table.dt { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 12.5px; }
.dt th, .dt td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; vertical-align: middle; }
.dt.compact th, .dt.compact td { padding: 5px 10px; }
.dt th { position: sticky; top: 0; background: var(--surface-2); font-weight: 600; color: var(--muted); z-index: 2; user-select: none; font-size: 12px; letter-spacing: .01em; box-shadow: inset 0 -1px 0 var(--border); }
.dt th.sortable { cursor: pointer; }
.dt th.sortable:hover { color: var(--ink); }
.dt th .arr { color: var(--accent-text); margin-left: 3px; }
.dt th.sticky, .dt td.sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--border); }
.dt th.sticky { z-index: 3; background: var(--surface-2); }
.dt td.r, .dt th.r { text-align: right; font-variant-numeric: tabular-nums; }
.dt td { transition: background-color .1s; }
.dt tbody tr:hover td { background: color-mix(in srgb, var(--accent-wash) 85%, var(--surface)); }
.dt tbody tr.clickable { cursor: pointer; }
.dt tbody tr.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dt tbody tr.deleted td { color: var(--muted); }
.dt tfoot td { position: sticky; bottom: 0; background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border-strong); border-bottom: 0; z-index: 1; }
.dt tfoot td.sticky { z-index: 3; }
.dt td.nodata { text-align: center; white-space: normal; }
.dt td.wide-cell, .dt th.wide-cell { min-width: 340px; max-width: 560px; }
.dt .wide-cell .ad-i { overflow-wrap: break-word; word-break: normal; }
.dt .wrap-cell { white-space: normal; min-width: 200px; max-width: 420px; line-height: 1.5; }
.dt .sub { color: var(--muted); font-size: 11.5px; display: block; font-weight: 400; line-height: 1.4; }
.dt .databar { display: block; position: relative; padding-bottom: 6px; min-width: 100px; }
.dt .databar i { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--surface-3); }
.dt .databar i::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%); background: var(--accent); border-radius: 2px; }
.dt td.cell-heat { color: #0b0b0b; } .dt td.cell-heat.dk { color: #fff; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding-top: 10px; color: var(--ink-2); font-size: 12.5px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 11.5px; margin: 2px 4px 2px 0; white-space: nowrap; }

.pv { display: inline-block; min-width: 64px; padding: 2px 6px; border-radius: 4px; text-align: right; font-variant-numeric: tabular-nums; }
.pv-btn { border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; border-radius: 5px; font-variant-numeric: tabular-nums; }
.pv-btn:hover .pv, .pv-btn:focus-visible .pv { box-shadow: 0 0 0 2px var(--accent); }
.pv-btn:hover:not(:has(.pv)) { color: var(--accent-text); text-decoration: underline; }

/* 统计条（页面顶部小计） */
/* 统计条：flex 换行，最后一行自动铺满（不会留下空格子）；1px 间隙即分隔线 */
.stat-strip { display: flex; flex-wrap: wrap; gap: 1px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--border); box-shadow: var(--shadow-2); margin-bottom: 14px; overflow: hidden; }
.stat-strip > div { flex: 1 1 160px; padding: 12px 16px; background: var(--surface); min-width: 0; }
.stat-strip > div > span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-strip > div > b { display: block; font-size: 19px; font-weight: 700; letter-spacing: -.01em; margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 空 / 加载 */
.empty { text-align: center; padding: 56px 16px; color: var(--ink-2); }
.empty h2, .empty > b { display: block; color: var(--ink); font-size: 18px; font-weight: 650; margin: 0 0 6px; }
.empty::before { content: ""; display: block; width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; background: var(--accent-wash-2) var(--empty-ico, none) center / 26px no-repeat; }
.nodata::before { content: ""; display: block; width: 28px; height: 3px; margin: 0 auto 10px; border-radius: 2px; background: var(--border-strong); }
.nodata { color: var(--muted); padding: 28px 12px; text-align: center; font-size: 13px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-lg); border: 0; box-shadow: none; }
@keyframes sk { to { background-position: -200% 0; } }

/* KV 信息 */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 12px 20px; font-size: 13px; }
.kv > div { min-width: 0; }
.kv span { display: block; color: var(--muted); font-size: 11.5px; margin-bottom: 2px; }
.kv b { font-weight: 500; overflow-wrap: anywhere; }
.test-list { display: grid; gap: 8px; margin-top: 12px; font-size: 13px; }
.test-list > div { display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start; }
pre.code { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; font: 12px/1.55 var(--mono); overflow: auto; margin: 0; max-height: 280px; }

/* ---------------- 对话框 / 抽屉 ---------------- */
dialog { border: 1px solid var(--border-strong); border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: var(--shadow-pop); }
dialog[open]:not(.drawer) { animation: dlgin .2s var(--ease); }
@keyframes dlgin { from { opacity: 0; transform: translateY(10px) scale(.98); } }
dialog::backdrop { background: rgba(8,12,20,.42); backdrop-filter: blur(3px); }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(820px, 100vw); border-radius: 16px 0 0 16px; border: 0; border-left: 1px solid var(--border-strong); animation: drawerin .26s var(--ease); display: flex; flex-direction: column; }
dialog.drawer:not([open]) { display: none; }
@keyframes drawerin { from { transform: translateX(40px); opacity: 0; } }
.dlg-h { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); background: var(--surface); }
.dlg-h h2 { margin: 0; font-size: 16px; font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-h .sp { flex: 1; }
.dlg-b { padding: 16px 18px 22px; display: grid; gap: 16px; overflow-y: auto; }
.drawer .dlg-b { flex: 1; background: var(--page); }
.drawer .dlg-b > section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 14px 16px; }
.dlg-b h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; }

/* 提示框 / Toast */
#tip { position: fixed; z-index: 100; pointer-events: none; background: color-mix(in srgb, var(--raised) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: var(--ink); border: 1px solid var(--border-strong); border-radius: 10px; padding: 9px 11px; font-size: 12px; box-shadow: var(--shadow-pop); max-width: 360px; display: none; line-height: 1.55; }
#tip .t { font-weight: 600; margin-bottom: 4px; }
#tip .r { display: flex; gap: 16px; justify-content: space-between; align-items: center; }
#tip .r span:first-child { display: inline-flex; align-items: center; min-width: 0; color: var(--ink-2); }
#tip .r span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
#tip .p { color: var(--ink-2); max-width: 320px; }
#tip .tip-hint { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--border); color: var(--accent-text); font-size: 11.5px; }
.chart .hit:focus-visible { outline: none; fill: var(--accent); fill-opacity: .12; }
.toast-host { position: fixed; right: 20px; bottom: 20px; z-index: 120; display: grid; gap: 8px; }
.toast { display: flex; align-items: center; gap: 9px; background: color-mix(in srgb, var(--ink) 94%, transparent); backdrop-filter: blur(8px); color: var(--page); padding: 10px 14px 10px 12px; border-radius: 12px; font-size: 13px; box-shadow: var(--shadow-pop); max-width: 440px; animation: toastin .26s var(--ease); }
.toast .ico { flex: none; color: color-mix(in srgb, var(--good) 75%, #fff); }
.toast.err { background: var(--crit); color: #fff; }
.toast.err .ico { color: #fff; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px) scale(.97); } }

details.note { margin-top: 20px; font-size: 12px; color: var(--muted); }
details.note summary { cursor: pointer; width: fit-content; }
details.note div { margin-top: 8px; line-height: 1.8; max-width: 1100px; }

/* 大屏模式 */
.app.screen { --side-w: 0px; }
.app.screen .sidebar, .app.screen .filterbar, .app.screen .chips, .app.screen .more-filters, .app.screen details.note { display: none !important; }
.app.screen .content { max-width: none; }

/* ---------------- 响应式 ---------------- */
/* 1280px 以下顶栏只显示同步状态圆点与头像（文字在悬停提示中），页面副标题隐藏，顶栏保持一行 */
@media (max-width: 1280px) {
  .page-title span { display: none; }
  .tb-hide-md { display: none !important; }
  .sync-btn { padding: 0 10px; }
}
@media (max-width: 1180px) {
  #cycleSel { max-width: 210px; }
}
@media (max-width: 900px) {
  .app, .app.collapsed { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 6px 8px; border-right: 0; border-bottom: 1px solid var(--border); gap: 4px; }
  .brand { height: auto; padding: 0 6px 0 0; }
  .brand-text, .nav-sec, .side-foot, #btnCollapse { display: none !important; }
  #nav { display: flex; gap: 2px; }
  .nav-item { width: auto; padding: 6px 10px; }
  .nav-item[aria-current="page"]::before { display: none; }
  .topbar { position: static; height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .page-title { flex-basis: 100%; }
  #periodBox { flex: 1 1 100%; flex-wrap: wrap; }
  #monthBox, #rangeBox { flex: 1 1 auto; flex-wrap: wrap; min-width: 0; }
  #cycleSel { flex: 1 1 120px; min-width: 0; }
  #rangeBox input[type="date"] { flex: 1 1 120px; min-width: 0; }
  .content { padding: 12px 12px 32px; }
  .filterbar .inp { max-width: none; flex: 1 1 140px; }
  .filterbar .search { max-width: none; flex-basis: 100%; }
  .filterbar .fgroup > select.inp { flex: 1 1 140px; max-width: none; }
  .filterbar .metric { margin-left: 0; }
  .brand { flex: none; }
  .sidebar { scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  dialog.drawer { width: 100vw; }
}

/* ---------------- 登录页 ---------------- */
.login-page { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 24px; overflow: hidden; background: radial-gradient(900px 520px at 12% -10%, rgb(var(--acc-rgb) / .16), transparent 62%), radial-gradient(800px 520px at 110% 110%, rgb(var(--acc-rgb) / .12), transparent 60%), var(--page); }
.login-page::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%); -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%); pointer-events: none; }
.login-shell { position: relative; width: min(940px, 100%); display: grid; grid-template-columns: 1.05fr 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-pop); overflow: hidden; animation: dlgin .4s var(--ease); }
.login-side { position: relative; padding: 38px 36px; background: linear-gradient(155deg, color-mix(in srgb, var(--accent-l) 70%, #020617) 0%, var(--accent-l) 58%, color-mix(in srgb, var(--accent-l) 72%, #fff) 100%); color: #fff; display: flex; flex-direction: column; gap: 18px; overflow: hidden; }
.login-side::before { content: ""; position: absolute; right: -120px; bottom: -140px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.18), transparent 65%); pointer-events: none; }
.login-side::after { content: ""; position: absolute; right: 30px; top: 34px; width: 120px; height: 72px; opacity: .22; pointer-events: none; background: linear-gradient(to top, #fff 0 100%) 0 100% / 14px 40% no-repeat, linear-gradient(to top, #fff 0 100%) 26px 100% / 14px 70% no-repeat, linear-gradient(to top, #fff 0 100%) 52px 100% / 14px 52% no-repeat, linear-gradient(to top, #fff 0 100%) 78px 100% / 14px 100% no-repeat, linear-gradient(to top, #fff 0 100%) 104px 100% / 14px 82% no-repeat; }
.login-side > * { position: relative; }
.login-side h2 { margin: 6px 0 0; font-size: 22px; line-height: 1.35; }
.login-side p { margin: 0; opacity: .88; font-size: 13.5px; line-height: 1.7; }
.login-side ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; font-size: 13px; }
.login-side li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; opacity: .95; }
.login-side li .ico { width: 18px; height: 18px; margin-top: 1px; }
.login-side .brand-mark { background: rgba(255,255,255,.18); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.login-side .brand-mark svg { stroke: #fff; }
.login-side .foot { margin-top: auto; font-size: 12px; opacity: .7; }
.login-card { padding: 44px 40px 34px; display: flex; flex-direction: column; justify-content: center; }
.login-card h1 { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 0 0 4px; }
.login-card > p { margin: 0 0 24px; color: var(--muted); font-size: 13px; }
.login-card form { display: grid; gap: 16px; }
.login-card .inp { height: 42px; font-size: 14px; border-radius: 10px; }
.login-card .btn.primary { height: 42px; font-size: 14.5px; border-radius: 10px; }
.login-card .err { color: var(--crit-ink); font-size: 13px; min-height: 20px; }
.login-card .sec-note { margin-top: 18px; font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.login-card .demo-login { margin-top: 18px; padding: 12px 14px; border: 1px dashed var(--border-strong); border-radius: 10px; background: var(--surface-2); display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.login-card .demo-login .demo-t { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.login-card .demo-login .demo-r { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); grid-column: 1; min-width: 0; }
.login-card .demo-login .demo-r span { flex: none; white-space: nowrap; }
.login-card .demo-login .demo-r code { min-width: 0; overflow-wrap: anywhere; }
.login-card .demo-login code { font-family: var(--mono, ui-monospace, Menlo, Consolas, monospace); font-size: 13.5px; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; user-select: all; }
.login-card .demo-login .btn { grid-column: 2; grid-row: 2 / span 2; }
@media (max-width: 480px) { .login-card .demo-login { grid-template-columns: 1fr; } .login-card .demo-login .btn { grid-column: 1; grid-row: auto; justify-self: start; } }
.pw-wrap { position: relative; }
.pw-wrap .inp { width: 100%; padding-right: 40px; }
.pw-wrap button { position: absolute; right: 4px; top: 4px; }
@media (max-width: 760px) { .login-shell { grid-template-columns: 1fr; } .login-side { display: none; } .login-card { padding: 32px 24px; } }

@media print {
  .sidebar, .topbar, .filterbar, .chips, .more-filters, details.note { display: none !important; }
  .app { display: block; } body { background: #fff; }
  .panel, .kpi { box-shadow: none; break-inside: avoid; }
}

/* 预算告警通知 */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; line-height: 1.55; color: var(--ink-2); }
.alert-list li { position: relative; padding: 6px 10px 6px 14px; border-radius: 8px; background: var(--surface-2); overflow-wrap: anywhere; }
.alert-list li::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--warn); }
.alert-list li.bad::before { background: var(--crit); }
.alert-list li b { font-weight: 600; color: var(--ink); }
.panel .sec-h { margin: 16px 0 8px; }
.alert-list li.good::before { background: var(--good); }
.alert-list li.info::before { background: var(--accent); }
.alert-list li .muted { font-size: 12px; margin-top: 2px; }

/* ===== v1.2：多云 / 成本中心 / 告警渠道 / 品牌与备份 ===== */
.sp { flex: 1; }
.prov { display: inline-flex; align-items: center; height: 17px; padding: 0 5px; margin-left: 6px; border-radius: 4px; font-size: 10.5px; font-weight: 600; letter-spacing: .02em; white-space: nowrap; vertical-align: 1px; border: 1px solid transparent; }
.prov.aliyun { color: #c2410c; background: rgba(235,104,52,.10); border-color: rgba(235,104,52,.28); }
.prov.tencent { color: #1c5cab; background: rgba(42,120,214,.10); border-color: rgba(42,120,214,.28); }
:root[data-theme="dark"] .prov.aliyun { color: #f59e6b; } :root[data-theme="dark"] .prov.tencent { color: #7fb2f0; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .prov.aliyun { color: #f59e6b; } :root:not([data-theme="light"]) .prov.tencent { color: #7fb2f0; } }
.entity-t h2 .prov { font-size: 11px; height: 19px; }
.tag .ico { width: 12px; height: 12px; margin-right: 3px; }
.tag-line { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; color: var(--ink-2); }
.tag-line > .ico { width: 14px; height: 14px; color: var(--muted); margin-right: -8px; }
.tag-line b { font-weight: 600; color: var(--ink); }
.tag-line .link { font-size: 12.5px; }
.sync-prov { font-size: 11.5px; font-weight: 600; color: var(--muted); letter-spacing: .04em; padding-top: 4px; border-top: 1px dashed var(--border); }
.sync-prov:first-child { border-top: 0; padding-top: 0; }
.sync-card { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; margin-bottom: 10px; background: var(--surface-2); }
.sync-card-h { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sync-card-h .prov { margin-left: 0; }
.sync-card-h b { font-weight: 600; }
.sync-card .kv { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }

/* 对话框 */
dialog.modal { width: min(520px, calc(100vw - 32px)); }
dialog.modal.wide { width: min(860px, calc(100vw - 32px)); }
dialog.modal .dlg-b { max-height: calc(100vh - 140px); }
.dlg-f { position: sticky; bottom: -22px; background: var(--surface); padding: 10px 0 0; margin-top: -4px; border-top: 1px solid var(--border); }
.dlg-err:empty { display: none; }
.tag-tbl td, .tag-tbl th { vertical-align: middle; }
.tag-tbl .inp.sm { width: 100%; min-width: 110px; }
.tag-tbl td:first-child { min-width: 180px; }

/* 告警渠道 */
.ch-list { display: grid; gap: 10px; }
.ch-card { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; background: var(--surface); display: grid; gap: 10px; }
.ch-card.off { background: var(--surface-2); }
.ch-card.off .ch-t b { color: var(--ink-2); }
.ch-top { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.ch-ico { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-wash-2); color: var(--accent-text); flex: none; }
.ch-ico .ico { width: 16px; height: 16px; }
.ch-t { min-width: 0; flex: 1; display: grid; gap: 2px; }
.ch-t b { font-weight: 600; }
.ch-t .muted { font-size: 12px; overflow-wrap: anywhere; }
.ch-evs { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-evs .tag { margin-left: 0; }
.ch-evs .tag.info { background: var(--accent-wash-2); color: var(--accent-text); }
.scope-list { margin-top: 8px; max-height: 220px; overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 4px 14px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); scrollbar-width: thin; }
.scope-list .chk { white-space: normal; align-items: flex-start; line-height: 1.45; }
.scope-list .chk input { margin-top: 2px; flex: none; }
.ch-next { display: flex; align-items: flex-start; gap: 6px; font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.ch-next svg { width: 13px; height: 13px; flex: none; margin-top: 2px; }
.ch-next b { color: var(--ink-2); font-weight: 600; }
.ch-next i { font-style: normal; margin: 0 6px; color: var(--ink-4, var(--ink-3)); }
.ch-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.ch-foot > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.empty-mini { display: flex; gap: 12px; align-items: flex-start; padding: 18px; border: 1px dashed var(--border-strong); border-radius: var(--r); color: var(--ink-2); font-size: 13px; }
.empty-mini > .ico { width: 22px; height: 22px; color: var(--muted); flex: none; }
.empty-mini b { display: block; color: var(--ink); font-weight: 600; margin-bottom: 2px; }
.report-prev { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); padding: 12px 14px; font-size: 13px; line-height: 1.65; max-height: 420px; overflow: auto; }
.report-prev .rp-t { font-weight: 650; font-size: 14px; margin-bottom: 6px; }
.report-prev .rp-h { font-weight: 600; margin-top: 2px; color: var(--ink); }
.report-prev .rp-l { color: var(--ink-2); overflow-wrap: anywhere; }
.report-prev .rp-l b { color: var(--ink); font-weight: 600; }
.report-prev .rp-gap { height: 6px; }
/* 报表预览（飞书卡片布局） */
.report-prev:has(.fc) { padding: 0; background: transparent; border: 0; max-height: 720px; }
.fc { border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
.fc-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 14px; background: var(--accent-wash-2); border-bottom: 1px solid var(--border); }
.fc-h > div { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.fc-h b { font-size: 14px; color: var(--accent-text); overflow-wrap: anywhere; }
.fc-b { padding: 12px 14px; display: grid; gap: 8px; }
.fc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm, 8px); }
.fc-kpis > div { display: grid; gap: 2px; min-width: 0; align-content: start; }
.fc-kpis span, .fc-kpis small { font-size: 11.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.fc-kpis b { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.fc-kpis.long b { font-size: 14.5px; white-space: nowrap; }
.fc-kpis b.bad-text { color: var(--crit-ink); } .fc-kpis b.warn-text { color: var(--warn-ink); } .fc-kpis b.ok-text { color: var(--good-ink); }
.fc-note { font-size: 12px; color: var(--ink-3); }
.fc-sec { font-weight: 650; font-size: 13px; color: var(--ink); margin-top: 4px; }
.fc-chart { display: flex; align-items: flex-end; gap: 3px; height: 72px; padding: 4px 2px 0; border-bottom: 1px solid var(--border); }
.fc-chart i { flex: 1; min-width: 2px; border-radius: 2px 2px 0 0; display: flex; flex-direction: column; overflow: hidden; }
.fc-chart i span { display: block; min-height: 0; }
.fc-rows { display: grid; }
.fc-rows > div { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto 52px; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.fc-rows > div:last-child { border-bottom: 0; }
.fc-sub { font-weight: 400; font-size: 11.5px; color: var(--ink-3); margin-left: 8px; }
.fc-rows > .fc-head { padding: 2px 0 4px; font-size: 11.5px; color: var(--ink-3); border-bottom: 1px solid var(--border); }
.fc-rows > .fc-head b, .fc-rows > .fc-head small { font-weight: 500; color: var(--ink-3); text-align: right; }
.fc-rows em { font-style: normal; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fc-rows span { overflow-wrap: anywhere; }
.fc-rows .fc-rsub { display: block; font-style: normal; font-size: 11.5px; color: var(--ink-3); }
.fc-rows .fc-rsub.bad-text { color: var(--crit-ink); }
.fc-rows .fc-rsub.warn-text { color: var(--warn-ink); }
.fc-rows b { font-variant-numeric: tabular-nums; font-weight: 650; }
.fc-rows small { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fc-item { font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.fc-f { padding: 8px 14px; font-size: 11.5px; border-top: 1px solid var(--border); background: var(--surface-2); }
.brand-prev { display: flex; align-items: center; gap: 10px; padding: 12px; border: 1px dashed var(--border-strong); border-radius: var(--r); background: var(--surface-2); min-width: 0; }
.brand-prev .brand-text { min-width: 0; }
.brand-prev .brand-text b, .brand-prev .brand-text span { overflow: hidden; text-overflow: ellipsis; }

/* 打印 / 导出 PDF：隐藏交互元素，按页面宽度排版 */
@media print {
  .notices, .actions, .pager, .copy, .back, .pager-nav, #toasts, #tip, .loadbar { display: none !important; }
  .main-col { margin: 0 !important; }
  .content { padding: 0 !important; }
  .bi { display: block !important; }
  .bi > .panel { margin-bottom: 12px; }
  .tbl-wrap { max-height: none !important; overflow: visible !important; }
  a, .link { color: inherit !important; }
}

/* Key 详情：Token 消耗与调用统计 */
.tok-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 18px; }
@media (max-width: 1180px) { .tok-grid { grid-template-columns: 1fr; } }
.tok-group h4 { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; }
.tok-cells { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.tok-cell { border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; background: var(--surface-2); min-width: 0; display: grid; gap: 3px; }
.tok-cell > span { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tok-cell > b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tok-cell > b small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }
.tok-cell > em { font-style: normal; font-size: 11.5px; color: var(--ink-2); min-height: 16px; overflow-wrap: anywhere; }
.tok-cell.big { background: var(--accent-wash); border-color: var(--accent-wash-2); }
.tok-cell.big > b { font-size: 22px; }
.tok-cell.warn > b { color: var(--warn-ink); } .tok-cell.bad > b { color: var(--crit-ink); }
.tok-empty { display: flex; gap: 10px; align-items: flex-start; padding: 14px; border: 1px dashed var(--border-strong); border-radius: var(--r); font-size: 12.5px; color: var(--ink-2); line-height: 1.6; }
.tok-empty > .ico { width: 18px; height: 18px; flex: none; color: var(--muted); margin-top: 2px; }
.tok-empty b { display: block; color: var(--ink); font-weight: 600; }
.tok-grid.dense { grid-template-columns: 1fr; gap: 14px; }
.tok-grid.dense .tok-cells { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); }
.drawer .tok-cell { background: var(--surface-2); }

.notice > div { flex: 1; min-width: 0; }
.notice .notice-x { margin: -4px -6px -4px 4px; flex: none; }

/* 联动与下钻：行内链接、可点击图例 / 格子、筛选范围摘要、层级钻取 */
.lnk { border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; text-decoration: underline dotted; text-decoration-color: var(--border-strong); text-underline-offset: 3px; border-radius: 3px; }
.lnk:hover { color: var(--accent-text); text-decoration: underline; text-decoration-color: currentColor; }
.lnk:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.dt .sub .lnk { color: var(--muted); }
.dt .sub .lnk:hover { color: var(--accent-text); }
.tag-line b .lnk, .entity-t .sub .lnk { color: inherit; }
.cell-btn { border: 0; background: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; width: 100%; text-align: inherit; border-radius: 4px; }
.cell-btn:hover, .cell-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.legend span.clk { cursor: pointer; border-radius: 4px; padding: 1px 4px; margin: -1px -4px; }
.legend span.clk:hover, .legend span.clk:focus-visible { background: var(--surface-2); color: var(--ink); outline: none; }
.legend span.clk:hover em { text-decoration: underline; }
.lgl .li.clickable:hover span, .lgl .li.clickable:focus-visible span { color: var(--accent-text); }
.lgl .li.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.heat td.clk { cursor: pointer; }
.heat td.clk:hover { outline: 2px solid var(--accent); outline-offset: -1px; }
.heat th.clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.chips .scope-sum { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.chips .scope-sum b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi.kpi-go { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.kpi.kpi-go:hover { border-color: var(--accent-wash-2); box-shadow: var(--shadow-2), 0 0 0 1px var(--accent-wash-2); }
.kpi.kpi-go:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi-arrow { margin-left: auto; color: var(--faint); display: inline-flex; opacity: 0; transition: opacity .15s; }
.kpi-arrow .ico { width: 14px; height: 14px; }
.kpi.kpi-go:hover .kpi-arrow, .kpi.kpi-go:focus-visible .kpi-arrow { opacity: 1; }
@media (hover: none) { .kpi-arrow { opacity: .6; } }
.page-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; font-size: 12px; }
.page-tools .lbl { color: var(--muted); }
.dt.tree td { white-space: nowrap; }
.dt.tree .tree-name { padding-left: calc(8px + var(--lv, 0) * 22px); max-width: 520px; overflow: hidden; text-overflow: ellipsis; }
.dt.tree .tg { width: 22px; height: 22px; border: 0; background: none; color: var(--muted); cursor: pointer; display: inline-grid; place-items: center; border-radius: 5px; vertical-align: middle; margin-right: 2px; }
.dt.tree .tg:hover { background: var(--surface-3); color: var(--ink); }
.dt.tree .tg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.dt.tree .tg .ico { width: 14px; height: 14px; transition: transform .15s; }
.dt.tree .tg[aria-expanded="true"] .ico { transform: rotate(90deg); }
.dt.tree .tg-sp { display: inline-block; width: 24px; }
.dt.tree .tree-label { vertical-align: middle; }
.dt.tree .tree-sub { font-size: 11.5px; margin-left: 8px; vertical-align: middle; }
.dt.tree tr.tr-lv0 td { font-weight: 600; }
.dt.tree tr.tr-lv0 td .pill { font-weight: 500; }
.dt.tree tr.tr-lv1 td { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.dt.tree tr.tr-lv2 td { background: var(--surface-2); font-size: 12.5px; }
.dt.tree tr.tr-more td { font-size: 12px; white-space: normal; }
.share-bar { display: inline-block; width: 44px; height: 4px; border-radius: 2px; background: var(--surface-3); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.share-bar i { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
@media print { .lnk, .cell-btn { text-decoration: none; } .kpi-arrow, .dt.tree .tg { display: none; } }
.bud-tools { margin-bottom: 10px; }
.bud-tools select.inp { max-width: 200px; }

/* ===== v1.6：审计详情 / IP 归属地 / 主题色 / 动效 ===== */
/* 审计详情、接口参数：“标签 值” 分段显示 */
.ad { display: flex; flex-wrap: wrap; gap: 4px 6px; line-height: 1.5; }
.ad-i { display: inline-flex; align-items: baseline; gap: 6px; max-width: 100%; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--ink); overflow-wrap: anywhere; }
.ad-i em { font-style: normal; color: var(--muted); white-space: nowrap; flex: none; }
.ad-i:not(:has(em)) { background: none; border-color: transparent; padding: 2px 0; color: var(--ink-2); }
/* IP + 归属地 */
.ip-cell { display: inline-flex; flex-direction: column; gap: 1px; line-height: 1.35; }
.ip-cell .mono { font-size: 12px; }
.ip-loc { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.ip-loc::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; background: var(--accent); vertical-align: 1px; opacity: .8; }
.ip-loc.lan { color: var(--muted); } .ip-loc.lan::before { background: var(--faint); }
.ip-loc.none { color: var(--faint); } .ip-loc.none::before { display: none; }
.kv b .ip-cell { font-weight: 500; }

/* 主题色选择（品牌设置） */
.accent-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.accent-pick label { position: relative; display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 8px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-size: 12.5px; color: var(--ink-2); transition: border-color .15s, box-shadow .15s; }
.accent-pick label:hover { border-color: color-mix(in srgb, var(--border-strong) 50%, var(--ink) 30%); }
.accent-pick input { position: absolute; opacity: 0; pointer-events: none; }
.accent-pick i { width: 20px; height: 20px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.accent-pick label:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); color: var(--ink); font-weight: 600; }
.accent-pick label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

/* 空状态图标 */
.empty { --empty-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7a90' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19V11M10 19V5M16 19v-6M22 19H2'/%3E%3C/svg%3E"); }

/* 卡片悬停：可点击的 KPI / 排行项轻微上浮 */
.kpi.kpi-go { transition: border-color .18s, box-shadow .18s, transform .18s var(--ease); }
.kpi.kpi-go:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }

/* 主题切换：短暂开启颜色过渡，避免明暗切换时的生硬闪变 */
.theme-anim, .theme-anim *, .theme-anim *::before, .theme-anim *::after { transition: background-color .3s ease, border-color .3s ease, color .3s ease, fill .3s ease, stroke .3s ease, box-shadow .3s ease !important; }

/* ---- 进入动效：仅在切换页面时播放（#view.anim），后台刷新与窗口缩放重绘不重复播放 ---- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes fadein { from { opacity: 0; } }
@keyframes growY { from { transform: scaleY(0); } }
@keyframes growX { from { transform: scaleX(0); } }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
#view.anim > :not(.kpis, .bi, .kpi-wrap), #view.anim .kpis > *, #view.anim .bi > *, #view.anim .kpi-row > * { animation: rise .45s var(--ease) both; }
#view.anim .kpis > :nth-child(2), #view.anim .bi > :nth-child(2), #view.anim .kpi-row > :nth-child(2) { animation-delay: .04s; }
#view.anim .kpis > :nth-child(3), #view.anim .bi > :nth-child(3), #view.anim .kpi-row > :nth-child(3) { animation-delay: .08s; }
#view.anim .kpis > :nth-child(4), #view.anim .bi > :nth-child(4), #view.anim .kpi-row > :nth-child(4) { animation-delay: .12s; }
#view.anim .kpis > :nth-child(5), #view.anim .bi > :nth-child(5), #view.anim .kpi-row > :nth-child(5) { animation-delay: .16s; }
#view.anim .kpis > :nth-child(6), #view.anim .bi > :nth-child(6), #view.anim .kpi-row > :nth-child(6) { animation-delay: .2s; }
#view.anim .kpis > :nth-child(7), #view.anim .bi > :nth-child(n+7), #view.anim .kpi-row > :nth-child(n+7) { animation-delay: .24s; }
#view.anim .chart g.bars { animation: growY .6s var(--ease) both .12s; transform-box: view-box; }
#view.anim .chart path.ln { stroke-dasharray: 1; animation: draw .9s var(--ease) both .12s; }
#view.anim .chart circle.end { animation: fadein .3s ease both .8s; }
#view.anim .rank-bar > i, #view.anim .rank-bar > .stack, #view.anim .dv-bar i, #view.anim .share-bar i, #view.anim .dt .databar i::after { animation: growX .6s var(--ease) both .15s; transform-origin: left; }
#view.anim .dv-bar .neg i { transform-origin: right; }
#view.anim .segbar, #view.anim .progress > i, #view.anim .spark svg, #view.anim .kspark svg { animation: reveal .8s var(--ease) both .15s; }
#view.anim .heat td:not(.tot) { animation: fadein .5s ease both .1s; }
@media (prefers-reduced-motion: reduce) { #view.anim *, .kpi.kpi-go:hover { animation: none !important; transform: none !important; } }
@media print { #view.anim * { animation: none !important; } }

/* 只读分享模式（/share）：隐藏同步状态、用户菜单与周期切换；链接失效页 */
.share-mode #btnSync, .share-mode #btnUser, .share-mode #periodBox, .share-mode .tb-sep { display: none !important; }
.share-fail { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.share-fail-card { max-width: 440px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 28px 24px; text-align: center; box-shadow: var(--shadow-1, 0 1px 3px rgba(0,0,0,.06)); }
.share-fail-card .brand-mark { margin: 0 auto 12px; }
.share-fail-card h1 { font-size: 18px; margin: 0 0 8px; color: var(--ink); }
.share-fail-card p { margin: 6px 0; font-size: 13.5px; line-height: 1.7; color: var(--ink-2); }
.share-fail-card p.muted { font-size: 12px; color: var(--ink-3); }
.share-new .inp.sm { height: 30px; }

/* ---------------- Key 分析 ---------------- */
.kpis.even { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1180px) { .kpis.even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.lgl.wide .li { grid-template-columns: 10px minmax(0, 1fr) auto auto; }
.lgl.wide .li em { min-width: 72px; }
.chart .qline { stroke: var(--border-strong); stroke-width: 1; stroke-dasharray: 4 4; }
.chart .qlabel { fill: var(--muted); font-size: 11px; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.chart circle.pt { fill-opacity: .55; stroke-width: 1.5; cursor: default; transition: fill-opacity .15s; }
.chart circle.pt[role="button"] { cursor: pointer; }
.chart circle.pt:hover, .chart circle.pt:focus { fill-opacity: .9; outline: none; }
.heat.mx thead th { writing-mode: vertical-rl; transform: rotate(180deg); text-align: left; padding: 4px 0; max-height: 132px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat.mx td { width: 44px; min-width: 36px; }
.gchips { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 14px; }
.gchip { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: baseline; text-align: left; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; }
.gchip:hover { background: var(--surface-2); }
.gchip b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--muted); }
.gchip.hit b { color: var(--warn); }
.gchip span { font-weight: 600; font-size: 13px; }
.gchip small { grid-column: 1 / -1; color: var(--muted); font-size: 11.5px; line-height: 1.45; margin-top: 4px; }
.gchip.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; background: var(--surface-2); }
.kflag-on { margin-left: 8px; display: inline-flex; align-items: center; gap: 4px; }
.kflag-on .link { padding: 0 2px; font-size: 14px; line-height: 1; }
.rank.neu .dv-bar .neg i { background: var(--s1); } .rank.neu .dv-bar .pos i { background: var(--s3); }
