/* ===== 设计令牌（配色经色盲安全校验，详见 dataviz 调色板） ===== */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #898781;
  --gridline: #e1e0d9;
  --baseline: #c3c2b7;
  --border: rgba(11, 11, 11, 0.10);

  --kimi: #2a78d6;
  --kimi-track: #cde2fb;
  --minimax: #eb6834;
  --minimax-track: #f8d9c9;
  --deepseek: #1baf7a;
  --deepseek-track: #c9ecdd;

  --good: #0ca30c;
  --warning: #fab219;
  --critical: #d03b3b;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0d0d0d;
  --surface: #1a1a19;
  --surface-2: #262624;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --gridline: #2c2c2a;
  --baseline: #383835;
  --border: rgba(255, 255, 255, 0.10);

  --kimi: #3987e5;
  --kimi-track: #184f95;
  --minimax: #d95926;
  --minimax-track: #6b3417;
  --deepseek: #199e70;
  --deepseek-track: #14503d;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  min-height: 100vh;
}

/* ===== 登录页 ===== */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
}
.login-card h1 { font-size: 20px; font-weight: 650; margin-bottom: 6px; }
.login-card p { color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }
.login-card input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--baseline);
  border-radius: 10px;
  font-size: 15px;
  background: var(--page);
  color: var(--text-primary);
  outline: none;
}
.login-card input:focus { border-color: var(--kimi); }
.login-card .error { color: var(--critical); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ===== 通用 ===== */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  transition: opacity 0.15s, transform 0.05s;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--text-primary);
  color: var(--page);
  padding: 10px 22px;
  font-weight: 600;
}
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 12px;
  border: 1px solid var(--border);
}
.btn-block { width: 100%; margin-top: 14px; padding: 12px; }

.hidden { display: none !important; }

/* ===== 顶栏 ===== */
.topbar {
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar .updated { color: var(--text-muted); font-size: 13px; }
.topbar .spacer { flex: 1; }

/* ===== 平台卡片 ===== */
.cards {
  max-width: 1120px;
  margin: 24px auto 0;
  padding: 0 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.card-head { display: flex; align-items: center; gap: 10px; }
.card-head .dot { width: 10px; height: 10px; border-radius: 50%; }
.card-head h2 { font-size: 16px; font-weight: 650; flex: 1; }
.badge {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--text-secondary);
  font-weight: 600;
}
.badge.ok { color: var(--good); }
.badge.err { color: var(--critical); }

.hero-num { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.hero-num small { font-size: 15px; font-weight: 500; color: var(--text-secondary); }
.hero-label { font-size: 13px; color: var(--text-secondary); margin-bottom: 2px; }

/* 用量条：填充色随严重度变化，轨道为同色系浅色 */
.meter-row { display: flex; flex-direction: column; gap: 6px; }
.meter-row .meter-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-secondary);
}
.meter {
  height: 10px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}
.meter .fill {
  height: 100%;
  border-radius: 6px 6px 6px 6px;
  transition: width 0.6s ease;
}
.fill.sev-low { background: var(--meter-hue, var(--kimi)); }
.fill.sev-mid { background: var(--warning); }
.fill.sev-high { background: var(--critical); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat-tile {
  background: var(--surface-2);
  border-radius: 12px;
  padding: 12px;
}
.stat-tile .label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.stat-tile .value { font-size: 19px; font-weight: 700; }
.stat-tile .value small { font-size: 12px; color: var(--text-muted); font-weight: 500; }

.note { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.error-box {
  font-size: 13px;
  color: var(--critical);
  background: color-mix(in srgb, var(--critical) 8%, transparent);
  border-radius: 10px;
  padding: 10px 12px;
  word-break: break-all;
}

/* ===== 分析区 ===== */
.analysis {
  max-width: 1120px;
  margin: 18px auto 60px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
}
.panel-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: 16px; font-weight: 650; flex: 1; }
.range-filter { display: flex; gap: 6px; }
.range-filter button {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 5px 12px;
  font-size: 12.5px;
  border-radius: 8px;
}
.range-filter button.active {
  background: var(--text-primary);
  color: var(--page);
  border-color: var(--text-primary);
}

.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--text-secondary); }
.legend .key { display: inline-flex; align-items: center; gap: 6px; }
.legend .swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

.chart-wrap { position: relative; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.tooltip {
  position: absolute;
  pointer-events: none;
  background: var(--text-primary);
  color: var(--page);
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.1s;
  z-index: 5;
  line-height: 1.6;
}

.chart-empty { color: var(--text-muted); font-size: 13px; padding: 40px 0; text-align: center; }

.chart-caption {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  text-align: right;
}

/* 数据表（无障碍视图） */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--gridline); font-variant-numeric: tabular-nums; }
th { color: var(--text-secondary); font-weight: 600; font-size: 12px; }

.overview-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 24px;
}
