/* ==========================================================================
   瀚海罗盘 · Design System
   Palette: 海图纸 (chart paper) · 深海墨 (abyss ink) · 海图青 (chart teal) · 罗盘铜 (compass brass)
   ========================================================================== */

:root {
  --bg: #EFF2F1;
  --bg-2: #E6EBE9;
  --surface: #FFFFFF;
  --surface-2: #F6F8F7;
  --surface-3: #EEF2F1;
  --line: #D9E0DE;
  --line-2: #E7ECEA;
  --text: #0F1A21;
  --text-2: #354550;
  --muted: #62727A;
  --faint: #95A2A8;

  --accent: #0E6A64;
  --accent-2: #0A534E;
  --accent-soft: #DFEFEC;
  --accent-ink: #FFFFFF;
  --brass: #976A1E;
  --brass-2: #B8893A;
  --brass-soft: #F4EBD9;

  --good: #2A7748;
  --good-soft: #E1F0E6;
  --warn: #A9690A;
  --warn-soft: #FAEFD9;
  --bad: #AF3A2D;
  --bad-soft: #F7E3DF;
  --info: #2C5A88;
  --info-soft: #E2EAF3;

  --side-bg: #0B171E;
  --side-bg-2: #0F1F27;
  --side-text: #C5D0D3;
  --side-muted: #6F8188;
  --side-active: #15272F;
  --side-line: #1A2C35;
  --side-accent: #4FBFB4;

  --chart-1: #0E6A64;
  --chart-2: #B8893A;
  --chart-3: #2C5A88;
  --chart-4: #7A8D95;
  --chart-grid: #DCE3E1;

  --shadow-1: 0 1px 2px rgba(15, 26, 33, .05), 0 0 0 1px rgba(15, 26, 33, .02);
  --shadow-2: 0 12px 32px -12px rgba(15, 26, 33, .22), 0 2px 6px rgba(15, 26, 33, .05);
  --shadow-3: 0 24px 64px -16px rgba(8, 18, 24, .40);

  --radius: 10px;
  --radius-sm: 6px;
  --radius-xs: 4px;

  --font-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC", "Hiragino Sans GB", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", "Source Han Sans SC", "Segoe UI", Roboto, sans-serif;
  --font-serif: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", "Noto Serif SC", "SimSun", Georgia, serif;
  --font-num: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "PingFang SC", sans-serif;
  --font-mono: "SF Mono", ui-monospace, Menlo, Consolas, "Liberation Mono", monospace;

  --side-w: 236px;
  --top-h: 60px;
  --gutter: 28px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #091016; --bg-2: #0C151C; --surface: #0F1A21; --surface-2: #132029; --surface-3: #172731;
    --line: #213440; --line-2: #1A2A34;
    --text: #E4EBED; --text-2: #BCC8CD; --muted: #8798A0; --faint: #5E7079;
    --accent: #3EAEA3; --accent-2: #5CC4B9; --accent-soft: rgba(62, 174, 163, .14); --accent-ink: #06201D;
    --brass: #D3A757; --brass-2: #E0BA72; --brass-soft: rgba(211, 167, 87, .14);
    --good: #57B67D; --good-soft: rgba(87, 182, 125, .14);
    --warn: #E0A43C; --warn-soft: rgba(224, 164, 60, .14);
    --bad: #E2735F; --bad-soft: rgba(226, 115, 95, .14);
    --info: #6FA0D6; --info-soft: rgba(111, 160, 214, .14);
    --side-bg: #060C10; --side-bg-2: #0A1318; --side-active: #11202A; --side-line: #14232C;
    --chart-1: #3EAEA3; --chart-2: #D3A757; --chart-3: #6FA0D6; --chart-4: #7D8F98; --chart-grid: #22343F;
    --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .02);
    --shadow-2: 0 14px 36px -12px rgba(0, 0, 0, .6);
    --shadow-3: 0 28px 72px -16px rgba(0, 0, 0, .75);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #091016; --bg-2: #0C151C; --surface: #0F1A21; --surface-2: #132029; --surface-3: #172731;
  --line: #213440; --line-2: #1A2A34;
  --text: #E4EBED; --text-2: #BCC8CD; --muted: #8798A0; --faint: #5E7079;
  --accent: #3EAEA3; --accent-2: #5CC4B9; --accent-soft: rgba(62, 174, 163, .14); --accent-ink: #06201D;
  --brass: #D3A757; --brass-2: #E0BA72; --brass-soft: rgba(211, 167, 87, .14);
  --good: #57B67D; --good-soft: rgba(87, 182, 125, .14);
  --warn: #E0A43C; --warn-soft: rgba(224, 164, 60, .14);
  --bad: #E2735F; --bad-soft: rgba(226, 115, 95, .14);
  --info: #6FA0D6; --info-soft: rgba(111, 160, 214, .14);
  --side-bg: #060C10; --side-bg-2: #0A1318; --side-active: #11202A; --side-line: #14232C;
  --chart-1: #3EAEA3; --chart-2: #D3A757; --chart-3: #6FA0D6; --chart-4: #7D8F98; --chart-grid: #22343F;
  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 0 0 1px rgba(255, 255, 255, .02);
  --shadow-2: 0 14px 36px -12px rgba(0, 0, 0, .6);
  --shadow-3: 0 28px 72px -16px rgba(0, 0, 0, .75);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); color: var(--text); }
mark { background: var(--brass-soft); color: inherit; border-radius: 2px; padding: 0 1px; box-shadow: inset 0 -1px 0 var(--brass-2); }
hr { border: 0; border-top: 1px solid var(--line-2); margin: 0; }

.num, .tnum { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.serif { font-family: var(--font-serif); }
.mono { font-family: var(--font-mono); font-size: .92em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.t-accent { color: var(--accent); }
.t-brass { color: var(--brass); }
.t-good { color: var(--good); }
.t-warn { color: var(--warn); }
.t-bad { color: var(--bad); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.eyebrow {
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  font-size: 11px; color: var(--muted); background: var(--surface-2); font-family: var(--font-sans);
}

svg.ico { display: inline-block; vertical-align: middle; flex: none; width: 16px; height: 16px; }

/* ---------- app shell ---------- */
.app { display: flex; min-height: 100%; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40;
  background: var(--side-bg);
  background-image: radial-gradient(120% 60% at 0% 0%, rgba(79, 191, 180, .08), transparent 60%);
  color: var(--side-text);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--side-line);
  padding-top: env(safe-area-inset-top, 0px);
}
.side-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 20px 20px 18px;
  color: #F1F5F5; text-decoration: none;
}
.side-brand:hover { text-decoration: none; }
.side-brand .mark { width: 34px; height: 34px; flex: none; }
.side-brand .name { font-family: var(--font-serif); font-size: 19px; letter-spacing: .08em; font-weight: 600; line-height: 1.1; }
.side-brand .sub { font-size: 9.5px; letter-spacing: .22em; color: var(--side-muted); margin-top: 3px; text-transform: uppercase; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; }
.nav-group { margin-top: 18px; }
.nav-group:first-child { margin-top: 6px; }
.nav-group-label {
  font-size: 10.5px; letter-spacing: .18em; color: var(--side-muted);
  padding: 0 10px 6px; text-transform: uppercase; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 36px; padding: 0 10px; border-radius: 7px;
  color: var(--side-text); text-decoration: none; font-size: 13.5px;
  position: relative; transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255, 255, 255, .04); color: #FFFFFF; text-decoration: none; }
.nav-item .ico { width: 17px; height: 17px; opacity: .72; flex: none; }
.nav-item.active { background: var(--side-active); color: #FFFFFF; }
.nav-item.active .ico { opacity: 1; color: var(--side-accent); }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 2px;
  background: var(--side-accent); border-radius: 0 2px 2px 0;
}
.nav-item .count {
  margin-left: auto; font-size: 11px; color: var(--side-muted);
  font-variant-numeric: tabular-nums;
}
.nav-item .count.alert { color: #F0A090; }
.side-foot {
  border-top: 1px solid var(--side-line); padding: 14px 16px 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--side-muted);
}
.side-foot .who { color: var(--side-text); font-size: 13px; }
.side-foot .avatar { background: #1E3440; color: #CFE6E3; }

.main {
  flex: 1; min-width: 0; margin-left: var(--side-w);
  display: flex; flex-direction: column; min-height: 100%;
}
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30;
  height: var(--top-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line-2);
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs a { color: var(--muted); }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { color: var(--text); font-weight: 500; }
.top-search {
  margin-left: auto;
  display: flex; align-items: center; gap: 10px;
  width: min(420px, 40vw); min-width: 0; height: 36px; padding: 0 10px 0 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  color: var(--faint); cursor: text; font-size: 13px;
  transition: border-color .15s, box-shadow .15s;
}
.top-search:hover { border-color: var(--faint); }
.top-search .ico { width: 16px; height: 16px; flex: none; }
.top-search span.ph { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 6px; }
.demo-badge {
  font-size: 11px; color: var(--brass); background: var(--brass-soft);
  border: 1px solid color-mix(in srgb, var(--brass) 30%, transparent);
  padding: 2px 8px; border-radius: 999px; white-space: nowrap; letter-spacing: .02em;
}
.menu-btn { display: none; }

.view {
  width: 100%; max-width: 1480px; margin: 0 auto;
  padding: 26px var(--gutter) 64px;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  animation: viewIn .28s ease both;
}
@keyframes viewIn { from { opacity: .4; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------- page head ---------- */
.page-head {
  display: flex; align-items: flex-end; gap: 24px; flex-wrap: wrap;
  margin-bottom: 22px;
}
.page-head .titles { flex: 1; min-width: 260px; }
.page-head h1 {
  font-family: var(--font-serif); font-size: 28px; font-weight: 600;
  letter-spacing: .02em; line-height: 1.25; margin-top: 6px;
}
.page-head .sub { color: var(--muted); margin-top: 6px; max-width: 72ch; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.section-title {
  display: flex; align-items: baseline; gap: 12px; margin: 30px 0 14px;
}
.section-title h2 { font-family: var(--font-serif); font-size: 19px; letter-spacing: .02em; }
.section-title .aside { margin-left: auto; color: var(--muted); font-size: 12.5px; }

/* ---------- grid ---------- */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }
.s-3 { grid-column: span 3; } .s-4 { grid-column: span 4; } .s-5 { grid-column: span 5; }
.s-6 { grid-column: span 6; } .s-7 { grid-column: span 7; } .s-8 { grid-column: span 8; }
.s-9 { grid-column: span 9; } .s-12 { grid-column: span 12; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-nw { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-top { display: flex; align-items: flex-start; gap: 12px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }

/* ---------- panel ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--radius); box-shadow: var(--shadow-1);
  min-width: 0;
}
.panel-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 18px 0;
}
.panel-head.bordered { padding-bottom: 13px; border-bottom: 1px solid var(--line-2); }
.panel-title { font-size: 14.5px; font-weight: 600; letter-spacing: .01em; display: flex; align-items: center; gap: 8px; }
.panel-title .ico { width: 16px; height: 16px; color: var(--accent); }
.panel-sub { color: var(--muted); font-size: 12.5px; }
.panel-head .tools { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.panel-body { padding: 16px 18px 18px; }
.panel-body.flush { padding: 0; }
.panel-foot {
  padding: 11px 18px; border-top: 1px solid var(--line-2);
  display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px;
}
.panel.inset { background: var(--surface-2); box-shadow: none; }
.panel.dark {
  background: var(--side-bg); color: var(--side-text); border-color: var(--side-line);
  background-image: radial-gradient(90% 80% at 100% 0%, rgba(184, 137, 58, .14), transparent 55%), radial-gradient(70% 70% at 0% 100%, rgba(79, 191, 180, .10), transparent 60%);
}
.panel.dark .muted { color: var(--side-muted); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { padding: 16px 18px 15px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 7px; }
.kpi-label .ico { width: 15px; height: 15px; }
.kpi-value {
  font-family: var(--font-num); font-size: 32px; font-weight: 300; letter-spacing: -.01em;
  line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text);
}
.kpi-value .unit { font-size: 14px; color: var(--muted); margin-left: 3px; font-weight: 400; letter-spacing: 0; }
.kpi-foot { font-size: 12px; color: var(--muted); display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; min-height: 18px; }
.delta-up { color: var(--good); } .delta-down { color: var(--bad); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 7px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
  text-decoration: none;
}
.btn:hover { border-color: var(--faint); text-decoration: none; }
.btn .ico { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-brass { background: var(--brass); border-color: var(--brass); color: #FFFFFF; }
:root[data-theme="dark"] .btn-brass { color: #1A1306; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { height: 42px; padding: 0 20px; font-size: 14px; border-radius: 8px; }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-danger { color: var(--bad); }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.field .hint { font-size: 11.5px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 11px;
  border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px;
  transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 84px; padding: 9px 11px; resize: vertical; line-height: 1.55; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2362727A' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }

.seg {
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 8px;
  background: var(--surface-3); border: 1px solid var(--line-2); flex-wrap: wrap;
}
.seg button, .seg label {
  border: 0; background: transparent; height: 28px; padding: 0 12px; border-radius: 6px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg .on, .seg button.on, .seg input:checked + span, .seg label:has(input:checked) {
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-1); font-weight: 500;
}
.seg label:has(input:focus-visible) { outline: 2px solid var(--accent); }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track {
  width: 34px; height: 20px; border-radius: 999px; background: var(--line);
  position: relative; transition: background .18s; flex: none;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px;
  border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .18s;
}
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(14px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }

input[type="range"].range { width: 100%; accent-color: var(--accent); }

/* ---------- pills & tags ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2);
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-good { background: var(--good-soft); color: var(--good); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }
.pill-info { background: var(--info-soft); color: var(--info); }
.pill-accent { background: var(--accent-soft); color: var(--accent); }
.pill-brass { background: var(--brass-soft); color: var(--brass); }
.pill-outline { background: transparent; border: 1px solid var(--line); color: var(--text-2); }
.pill-neutral { background: var(--surface-3); color: var(--text-2); }

.tag {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px;
  border-radius: 5px; font-size: 12px; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--line-2); white-space: nowrap;
}
.tags { display: flex; flex-wrap: wrap; gap: 6px; }

.cc {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 20px; padding: 0 5px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600; letter-spacing: .06em;
  color: var(--text-2); background: var(--surface-3); border: 1px solid var(--line);
}
.cc-lg { min-width: 44px; height: 30px; font-size: 13px; border-radius: 6px; }
.country { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

.rag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.rag i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.rag-R { color: var(--bad); } .rag-R i { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-soft); }
.rag-Y { color: var(--warn); } .rag-Y i { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.rag-G { color: var(--good); } .rag-G i { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }

.grade {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 24px; padding: 0 6px; border-radius: 5px;
  font-family: var(--font-num); font-size: 12.5px; font-weight: 700; letter-spacing: .02em;
}
.grade-Ap { background: var(--brass); color: #FFFFFF; }
.grade-A { background: var(--accent); color: var(--accent-ink); }
.grade-B { background: var(--accent-soft); color: var(--accent); }
.grade-C { background: var(--warn-soft); color: var(--warn); }
.grade-D { background: var(--bad-soft); color: var(--bad); }

.score-chip {
  display: inline-flex; align-items: baseline; gap: 2px;
  font-family: var(--font-num); font-variant-numeric: tabular-nums; font-weight: 600; font-size: 15px;
}
.score-chip small { font-size: 11px; color: var(--muted); font-weight: 400; }

/* ---------- avatar ---------- */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-size: 15px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.avatar.av-sm { width: 28px; height: 28px; font-size: 13px; }
.avatar.av-lg { width: 64px; height: 64px; font-size: 26px; }
.avatar.av-xl { width: 84px; height: 84px; font-size: 34px; }
.av-1 { background: #DCEDEA; color: #0E6A64; }
.av-2 { background: #F1E6D2; color: #8A5E17; }
.av-3 { background: #DDE6F0; color: #2C5A88; }
.av-4 { background: #E6E3EE; color: #574B7E; }
.av-5 { background: #E3E9E4; color: #3D6A4B; }
:root[data-theme="dark"] .av-1, :root[data-theme="dark"] .av-2, :root[data-theme="dark"] .av-3, :root[data-theme="dark"] .av-4, :root[data-theme="dark"] .av-5 { filter: brightness(.38) saturate(1.3) contrast(1.4); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .av-1, :root:not([data-theme="light"]) .av-2, :root:not([data-theme="light"]) .av-3, :root:not([data-theme="light"]) .av-4, :root:not([data-theme="light"]) .av-5 { filter: brightness(.38) saturate(1.3) contrast(1.4); }
}
.ent-logo {
  width: 38px; height: 38px; border-radius: 9px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 16px;
  background: var(--side-bg); color: #E9D3A6; border: 1px solid var(--side-line);
}
.ent-logo.lg { width: 60px; height: 60px; font-size: 24px; border-radius: 12px; }

/* ---------- table ---------- */
.table-wrap { width: 100%; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: left; font-weight: 500; color: var(--muted); font-size: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line-2); white-space: nowrap;
  background: var(--surface-2); position: sticky; top: 0;
}
.tbl th.sortable { cursor: pointer; user-select: none; }
.tbl th.sortable:hover { color: var(--text); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.clickable { cursor: pointer; transition: background .12s; }
.tbl tr.clickable:hover td { background: var(--surface-2); }
.tbl.compact td { padding: 8px 14px; }

/* ---------- list ---------- */
.list { display: flex; flex-direction: column; }
.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 18px;
  border-top: 1px solid var(--line-2); min-width: 0;
}
.list-item:first-child { border-top: 0; }
a.list-item { color: inherit; text-decoration: none; }
a.list-item:hover { background: var(--surface-2); text-decoration: none; }
.list-item .li-title { font-weight: 500; font-size: 13.5px; }
.list-item .li-sub { color: var(--muted); font-size: 12px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tab {
  height: 38px; padding: 0 14px; border: 0; background: transparent; cursor: pointer;
  font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tab .count { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---------- bars & meters ---------- */
.bar { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; position: relative; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.bar.brass > i { background: var(--brass-2); }
.bar.good > i { background: var(--good); } .bar.warn > i { background: var(--warn); } .bar.bad > i { background: var(--bad); }
.bar .mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-2); border-radius: 1px; }
.meter-row { display: grid; grid-template-columns: minmax(84px, 128px) 1fr 40px; gap: 12px; align-items: center; font-size: 13px; }
.meter-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.meters { display: flex; flex-direction: column; gap: 11px; }

/* ---------- callouts ---------- */
.callout {
  display: flex; gap: 11px; padding: 12px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; color: var(--text-2);
}
.callout .ico { width: 17px; height: 17px; flex: none; margin-top: 2px; }
.callout-info { background: var(--info-soft); border-color: transparent; }
.callout-info .ico { color: var(--info); }
.callout-warn { background: var(--warn-soft); border-color: transparent; }
.callout-warn .ico { color: var(--warn); }
.callout-bad { background: var(--bad-soft); border-color: transparent; }
.callout-bad .ico { color: var(--bad); }
.callout-brass { background: var(--brass-soft); border-color: transparent; }
.callout-brass .ico { color: var(--brass); }
.callout-accent { background: var(--accent-soft); border-color: transparent; }
.callout-accent .ico { color: var(--accent); }
.callout b { color: var(--text); }

/* ---------- definition list ---------- */
.dl { display: grid; grid-template-columns: minmax(90px, max-content) 1fr; gap: 9px 18px; font-size: 13px; margin: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; color: var(--text); min-width: 0; }

/* ---------- timeline ---------- */
.timeline { position: relative; display: flex; flex-direction: column; gap: 16px; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 6px; bottom: 6px; width: 1px; background: var(--line); }
.tl-item { position: relative; }
.tl-item::before {
  content: ""; position: absolute; left: -21px; top: 6px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.tl-item.brass::before { border-color: var(--brass-2); }
.tl-item.bad::before { border-color: var(--bad); }
.tl-item .tl-when { font-size: 12px; color: var(--muted); }
.tl-item .tl-title { font-weight: 500; }

/* ---------- empty ---------- */
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .ico { width: 34px; height: 34px; color: var(--faint); margin-bottom: 10px; }
.empty h3 { font-size: 15px; color: var(--text); margin-bottom: 4px; }

/* ---------- source note ---------- */
.source { font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.source::before { content: "来源 · "; color: var(--muted); }

/* ---------- toast ---------- */
#toast-root {
  position: fixed; z-index: 90; left: 50%; transform: translateX(-50%);
  bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 9px; font-size: 13px;
  background: var(--side-bg); color: #EEF3F4; box-shadow: var(--shadow-3);
  animation: toastIn .22s ease both;
}
.toast .ico { width: 16px; height: 16px; color: var(--side-accent); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- command palette ---------- */
.cmdk-backdrop {
  position: fixed; inset: 0; z-index: 80; background: rgba(6, 14, 19, .42);
  backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
  display: flex; justify-content: center; align-items: flex-start;
  padding: calc(10vh + env(safe-area-inset-top, 0px)) 16px 16px;
}
.cmdk {
  width: min(680px, 100%); max-height: 72vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-3);
  overflow: hidden; animation: cmdkIn .18s ease both;
}
@keyframes cmdkIn { from { opacity: 0; transform: translateY(-6px) scale(.985); } to { opacity: 1; transform: none; } }
.cmdk-top { display: flex; align-items: center; gap: 12px; padding: 0 16px; border-bottom: 1px solid var(--line-2); }
.cmdk-top .ico { width: 18px; height: 18px; color: var(--muted); flex: none; }
.cmdk-input { flex: 1; height: 56px; border: 0; outline: none; background: transparent; font-size: 16px; color: var(--text); min-width: 0; }
.cmdk-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px 0; }
.cmdk-chips:empty { display: none; }
.cmdk-list { overflow-y: auto; padding: 8px; }
.cmdk-group { font-size: 11px; letter-spacing: .12em; color: var(--faint); padding: 10px 10px 6px; text-transform: uppercase; font-weight: 600; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; cursor: pointer;
  color: var(--text); text-decoration: none; min-width: 0;
}
.cmdk-item:hover { text-decoration: none; }
.cmdk-item.sel { background: var(--accent-soft); }
.cmdk-item .ci-ico {
  width: 30px; height: 30px; border-radius: 7px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-3); color: var(--text-2);
}
.cmdk-item .ci-ico .ico { width: 15px; height: 15px; }
.cmdk-item .ci-title { font-size: 13.5px; font-weight: 500; }
.cmdk-item .ci-sub { font-size: 12px; color: var(--muted); }
.cmdk-item .ci-go { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; }
.cmdk-foot { display: flex; gap: 14px; padding: 9px 16px; border-top: 1px solid var(--line-2); font-size: 11.5px; color: var(--muted); align-items: center; }
.cmdk-foot span { display: inline-flex; gap: 5px; align-items: center; }

/* ---------- query chips (parsed search entities) ---------- */
.qchip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; background: var(--accent-soft); color: var(--accent); font-weight: 500;
}
.qchip b { font-weight: 400; color: var(--muted); }
.qchip button { border: 0; background: transparent; padding: 0; cursor: pointer; color: inherit; display: inline-flex; }
.qchip .ico { width: 12px; height: 12px; }

/* ---------- AI / copilot marker ---------- */
.ai-mark {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  color: var(--brass); background: var(--brass-soft); border-radius: 999px; padding: 2px 9px 2px 7px;
}
.ai-mark .ico { width: 13px; height: 13px; }

/* ---------- chart primitives (SVG) ---------- */
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--muted); font-family: var(--font-sans); font-size: 11px; }
.chart .grid-line { stroke: var(--chart-grid); stroke-width: 1; fill: none; }
.chart .axis-line { stroke: var(--line); stroke-width: 1; }
.chart .s1-fill { fill: var(--chart-1); fill-opacity: .16; }
.chart .s1-line { stroke: var(--chart-1); stroke-width: 2; fill: none; }
.chart .s1-dot { fill: var(--surface); stroke: var(--chart-1); stroke-width: 2; }
.chart .s2-fill { fill: var(--chart-2); fill-opacity: .08; }
.chart .s2-line { stroke: var(--chart-2); stroke-width: 1.5; fill: none; stroke-dasharray: 4 3; }
.chart .s2-dot { fill: var(--chart-2); }
.chart .s3-line { stroke: var(--chart-3); stroke-width: 1.5; fill: none; }
.chart .label-strong { fill: var(--text); font-weight: 600; }
.chart .val { fill: var(--text-2); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.gauge-track { stroke: var(--surface-3); }
.gauge-fill { stroke: var(--accent); }
.gauge-tick { stroke: var(--line); }
.gauge-needle { fill: var(--brass-2); }
.gauge-num { fill: var(--text); font-family: var(--font-num); font-weight: 300; font-variant-numeric: tabular-nums; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.legend .l-dash { height: 0; border-top: 2px dashed var(--chart-2); width: 14px; border-radius: 0; vertical-align: 3px; }

/* ---------- heat matrix ---------- */
.heat { border-collapse: separate; border-spacing: 3px; width: 100%; font-size: 12px; }
.heat th { font-weight: 500; color: var(--muted); padding: 4px 6px; text-align: center; white-space: nowrap; font-size: 11.5px; }
.heat th.rowh { text-align: left; color: var(--text); }
.heat td {
  height: 30px; text-align: center; border-radius: 4px; font-variant-numeric: tabular-nums;
  color: var(--text); font-weight: 500; min-width: 44px;
}

/* ---------- misc ---------- */
.divider-label { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 18px 0 12px; }
.divider-label::before, .divider-label::after { content: ""; flex: 1; border-top: 1px solid var(--line-2); }
.stat-big { font-family: var(--font-num); font-weight: 300; font-size: 44px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-big .unit { font-size: 18px; color: var(--muted); margin-left: 2px; }
.dot-sep::before { content: "·"; margin: 0 6px; color: var(--faint); }
.link-more { font-size: 12.5px; display: inline-flex; align-items: center; gap: 4px; }
.link-more .ico { width: 13px; height: 13px; }

.click { cursor: pointer; }
.hide-sm { }
.skeleton-note { font-size: 12px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-12 > [class*="s-"] { grid-column: span 12; }
  .g-12 > .s-6.keep, .g-12 > .s-4.keep { grid-column: span 6; }
}
@media (max-width: 960px) {
  :root { --gutter: 18px; }
  .sidebar { transform: translateX(-100%); transition: transform .24s ease; box-shadow: var(--shadow-3); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .scrim { display: block; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .top-search { width: auto; flex: 1; max-width: 420px; }
  .topbar { gap: 8px; }
  .top-search .kbd { display: none; }
}
@media (max-width: 680px) {
  :root { --gutter: 16px; }
  .g-2, .g-3, .g-4, .kpis, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .g-12 > .s-6.keep, .g-12 > .s-4.keep { grid-column: span 12; }
  .page-head h1 { font-size: 23px; }
  .crumbs { display: none; }
  .demo-badge { display: none; }
  .hide-sm { display: none !important; }
  .kpi-value { font-size: 28px; }
  .meter-row { grid-template-columns: 84px 1fr 34px; }
}
.scrim { display: none; position: fixed; inset: 0; background: rgba(6, 14, 19, .45); z-index: 35; }

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