:root {
  color-scheme: dark;
  font-family: Inter, "Microsoft YaHei UI", system-ui, sans-serif;
  --bg: #0b1019;
  --panel: #121a28;
  --raised: #1b2535;
  --line: #29364a;
  --ink: #ecf2fc;
  --muted: #a0b0c5;
  --blue: #84bcff;
  --cyan: #75dedb;
  --amber: #f2c176;
  --danger: #ffaaa9;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; color: var(--ink); background: var(--bg); font-size: 14px; }
button, input, select { font: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, .control {
  min-height: 38px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  color: var(--ink); background: var(--raised); cursor: pointer; text-align: center;
}
button:hover:not(:disabled), .control:hover { border-color: var(--blue); text-decoration: none; }
button:disabled { opacity: .48; cursor: default; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.primary { background: #8abaff; border-color: transparent; color: #091626; font-weight: 650; }
.primary:hover:not(:disabled) { background: #aecdff; }
.quiet { background: transparent; }
h1, h2, p { margin: 0; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.045em; line-height: 1.2; }
h2 { font-size: 16px; font-weight: 650; line-height: 1.35; }
p { color: var(--muted); line-height: 1.6; }
.topbar { background: #0c131f; border-bottom: 1px solid var(--line); }
.topbar-inner, main { width: min(100% - 48px, 1360px); margin: auto; }
.topbar-inner { display: flex; justify-content: space-between; align-items: center; min-height: 66px; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; letter-spacing: .085em; }
.brand img { object-fit: contain; }
.site-nav, .entry, .presets, .segmented, .views { display: flex; align-items: center; gap: 6px; }
.site-nav { gap: 22px; }
.site-nav a { color: var(--muted); }
main { padding: 36px 0 0; }
.title-row { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.entry, .presets, .segmented { background: #0e1623; border: 1px solid var(--line); padding: 4px; border-radius: 10px; }
.entry a, .presets button, .segmented button {
  white-space: nowrap; padding: 7px 12px; min-height: 33px; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
}
.entry a[aria-current], .presets button[aria-pressed=true], .segmented button[aria-pressed=true] { background: var(--raised); color: var(--ink); }
.panel, .metric { background: var(--panel); border: 1px solid var(--line); border-radius: 13px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px 20px; }
.panel-head p { margin-top: 4px; font-size: 12px; }
.login { width: min(100%, 480px); margin: 38px auto 70px; overflow: hidden; }
.login-intro { padding: 26px 26px 17px; background: linear-gradient(120deg, #1a2a42, var(--panel) 77%); }
.login-intro h2 { font-size: 22px; margin-bottom: 6px; }
#login-form { display: grid; gap: 15px; padding: 9px 26px 26px; }
#site-login { justify-self: center; }
label { display: grid; gap: 7px; min-width: 0; color: var(--muted); font-size: 12px; }
input, select { width: 100%; min-width: 0; min-height: 39px; border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; color: var(--ink); background: #0b1422; }
.filters { padding: 14px 16px 16px; }
.filters-top { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 13px; }
.fields { display: grid; grid-template-columns: minmax(125px, .8fr) minmax(125px, .8fr) minmax(115px, .8fr) minmax(145px, 1fr) minmax(125px, 1fr) auto; align-items: end; gap: 12px; }
#dashboard[data-role=customer] .fields { grid-template-columns: repeat(2, minmax(125px, .8fr)) repeat(2, minmax(125px, 1fr)) auto; }
.notice { margin-bottom: 12px; padding: 11px 14px; background: #172846; border: 1px solid #344d6f; border-radius: 9px; color: #d2e5ff; }
.notice[data-tone=error] { color: var(--danger); background: #2b1b28; border-color: #694455; }
.status-line { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 5px 15px; padding: 13px 2px; font-size: 12px; }
#sync-status[data-tone=warning] { color: var(--amber); }
.views { border-bottom: 1px solid var(--line); margin: 0 0 16px; gap: 21px; }
.views button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); padding: 8px 6px 11px; }
.views button[aria-pressed=true] { color: var(--blue); border-color: var(--blue); font-weight: 650; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; margin-bottom: 16px; }
.metric { padding: 17px 18px; min-width: 0; }
.metric span { color: var(--muted); }
.metric strong { display: block; margin-top: 8px; font-size: clamp(17px, 2.7vw, 33px); font-weight: 630; font-variant-numeric: tabular-nums; letter-spacing: -.035em; overflow-wrap: anywhere; }
.metric-note { display: block; color: var(--muted); margin-top: 6px; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.chart { display: grid; grid-template-columns: max-content minmax(0,1fr); gap: 10px; margin: 4px 20px 0; }
.chart-scale { height: 158px; display: flex; flex-direction: column; justify-content: space-between; text-align: right; color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.plot { display: flex; height: 158px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), var(--line) calc(25% - 1px) 25%); }
.plot button { flex: 1 1 0; min-width: 0; min-height: 0; padding: 0; border: 0; border-radius: 0; position: relative; background: transparent; }
.plot button:hover, .plot button[aria-pressed=true] { background: #233a535e; }
.plot button::after { content: ""; position: absolute; inset: auto 13% 0; margin: auto; max-width: 52px; height: var(--bar, 0%); min-height: 2px; border-radius: 3px 3px 0 0; background: linear-gradient(#80baff, #4884d8); }
.plot button[data-quality=partial]::after { background: repeating-linear-gradient(135deg, #578bcd 0 3px, #375d91 3px 6px); }
.plot button[data-quality=missing]::after { background: var(--amber); }
.chart-labels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; color: var(--muted); font-size: 10px; padding-top: 6px; text-align: center; }
.chart-labels span { white-space: nowrap; }
#chart-caption { margin: 7px 20px 14px; min-height: 20px; font-size: 12px; }
.ranking { padding: 0 16px 13px; }
.ranking button { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 7px 10px; background: transparent; border-color: transparent; text-align: left; padding: 7px 7px 9px; }
.ranking .model-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ranking .model-total { color: var(--muted); font-variant-numeric: tabular-nums; }
.ranking .track { grid-column: 1 / -1; height: 3px; background: #28394d; border-radius: 6px; overflow: hidden; }
.ranking .track i { display: block; background: var(--cyan); height: 100%; }
.checkbox { display: flex; align-items: center; gap: 7px; }
.checkbox input { width: 16px; min-height: 16px; accent-color: var(--blue); }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 12px 15px; border-top: 1px solid var(--line); vertical-align: middle; }
th:first-child, td:first-child { padding-left: 20px; }
th { background: #0e1725; font-size: 12px; color: var(--muted); white-space: nowrap; font-weight: 600; }
td { min-width: 76px; font-size: 13px; overflow-wrap: anywhere; }
td small { display: block; color: var(--muted); margin-top: 4px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; }
.actions button, td .quiet { min-height: 32px; padding: 5px 9px; font-size: 12px; color: var(--blue); }
.table-panel table { min-width: 640px; }
.account-panel table { min-width: 470px; }
.account-panel .key-child td:first-child { padding-left: 34px; color: var(--muted); }
#accounts button[data-expand] { display: inline-flex; gap: 7px; align-items: center; text-align: left; }
#accounts button[data-expand]::before { content: "+"; width: .7em; }
#accounts button[aria-expanded=true]::before { content: "−"; }
.chip { display: inline-block; color: #9ce4cf; background: #19463b70; border-radius: 7px; padding: 4px 8px; white-space: nowrap; font-size: 12px; }
.chip.warning { color: var(--amber); background: #674b2170; }
.chip.error { color: var(--danger); background: #69445570; }
.empty { margin: 14px 20px; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 13px 20px; border-top: 1px solid var(--line); color: var(--muted); }
.pager div { display: flex; gap: 7px; }
footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 7px; padding: 21px 0; margin-top: 20px; color: var(--muted); border-top: 1px solid var(--line); font-size: 11px; }
@media (max-width: 1060px) {
  .fields, #dashboard[data-role=customer] .fields { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .topbar-inner, main { width: calc(100% - 28px); }
  .topbar-inner { min-height: 58px; }
  .brand { font-size: 12px; letter-spacing: .035em; gap: 5px; }
  .brand img { width: 24px; height: 24px; }
  .site-nav { gap: 10px; font-size: 12px; }
  .site-nav button { font-size: 12px; padding: 4px 6px; min-height: 33px; }
  main { padding-top: 23px; }
  .title-row { align-items: start; flex-direction: column; gap: 12px; margin-bottom: 16px; }
  .fields, #dashboard[data-role=customer] .fields { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .filters { padding: 10px; }
  .filters-top { align-items: center; }
  .presets button { padding: 6px; font-size: 12px; }
  .metrics { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
  .metric { padding: 12px; }
  .overview-grid { grid-template-columns: 1fr; }
  .panel-head, .pager { padding: 13px 12px; }
  .chart { margin-inline: 12px; }
  .table-scroll { overscroll-behavior-inline: contain; }
  .account-panel table { min-width: 0; }
  .account-panel th, .account-panel td { padding-inline: 6px; min-width: 0; }
  .account-panel th:first-child, .account-panel td:first-child { padding-left: 10px; }
  .account-panel .key-child td:first-child { padding-left: 17px; }
  .account-panel th.actions { font-size: 0; }
  .account-panel td .quiet { padding-inline: 5px; }
  #accounts button[data-expand] { white-space: normal; overflow-wrap: anywhere; }
}
@media (max-width: 380px) { .site-nav a[href="/"] { display: none; } }
