:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #16202e;
  --ink-2: #4a5a70;
  --ink-3: #8695a8;
  --line: #e3e8f0;
  --line-2: #eef1f6;
  --brand: #1f6feb;
  --brand-2: #0f9d8f;
  --my: #2f80ed;
  --id: #f2994a;
  --good: #16a34a;
  --bad: #e5484d;
  --warn: #d97706;
  --shadow: 0 1px 2px rgba(16, 32, 54, .04), 0 8px 24px rgba(16, 32, 54, .06);
  --r: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------- layout ---------------- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 214px;
  flex: 0 0 214px;
  background: #0f1a2b;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side .brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.side .brand h1 { font-size: 15px; margin: 0 0 4px; color: #fff; letter-spacing: .2px; }
.side .brand p { margin: 0; font-size: 11px; color: #7c8ca4; line-height: 1.5; }
.side nav { padding: 10px 8px; flex: 1; }
.side nav button {
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 9px 11px; margin-bottom: 2px;
  background: transparent; border: 0; border-radius: 8px;
  color: #a9b7c9; font-size: 13px; text-align: left; cursor: pointer;
  transition: background .16s, color .16s;
}
.side nav button:hover { background: rgba(255, 255, 255, .06); color: #e6edf7; }
.side nav button.on { background: #1d2c44; color: #fff; font-weight: 600; }
.side nav button .ic { width: 16px; text-align: center; opacity: .9; }
.side .foot {
  padding: 12px 16px 18px; font-size: 11px; color: #6b7b90; line-height: 1.7;
  border-top: 1px solid rgba(255, 255, 255, .07);
}
.side .foot b { color: #9fb0c6; font-weight: 600; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px; background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar .ttl { font-size: 14px; font-weight: 650; }
.topbar .ttl small { font-weight: 400; color: var(--ink-3); margin-left: 8px; font-size: 11.5px; }
.spacer { flex: 1; }

.seg { display: inline-flex; background: #eef1f6; border-radius: 9px; padding: 3px; }
.seg button {
  border: 0; background: transparent; padding: 5px 12px; border-radius: 7px;
  font-size: 12.5px; color: var(--ink-2); cursor: pointer; transition: .15s;
}
.seg button.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: 0 1px 3px rgba(16,32,54,.12); }

.dates { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.dates input {
  border: 1px solid var(--line); border-radius: 7px; padding: 4px 7px;
  font-size: 12px; color: var(--ink); background: #fff; font-family: inherit;
}

.fresh { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px; background: #f1f5fb;
  font-size: 11px; color: var(--ink-2); border: 1px solid #e4eaf4; white-space: nowrap;
}
.chip i { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.chip.lag i { background: var(--warn); }
.chip.bad i { background: var(--bad); }

.content { padding: 18px 20px 40px; }

/* ---------------- cards ---------------- */
.grid { display: grid; gap: 12px; }
.kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); }
@media (max-width: 1560px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 900px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  background: var(--panel); border-radius: var(--r); padding: 13px 15px;
  box-shadow: var(--shadow); border: 1px solid var(--line-2);
  position: relative; overflow: hidden;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--brand); opacity: .85;
}
.kpi.g2::before { background: var(--brand-2); }
.kpi.g3::before { background: var(--id); }
.kpi .lab { font-size: 11.5px; color: var(--ink-3); display: flex; align-items: center; gap: 4px; }
.kpi .val { font-size: 21px; font-weight: 680; margin-top: 5px; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.kpi .sub { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.kpi .sub b { color: var(--ink-2); font-weight: 600; }
.up { color: var(--good); }
.down { color: var(--bad); }

.panel {
  background: var(--panel); border-radius: var(--r); border: 1px solid var(--line-2);
  box-shadow: var(--shadow); padding: 14px 15px 10px;
  display: flex; flex-direction: column;
}
.panel h3 {
  margin: 0 0 2px; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 6px;
}
.panel .hint { font-size: 11px; color: var(--ink-3); margin: 0 0 8px; line-height: 1.5; }
.chart { width: 100%; height: 268px; }
.chart.tall { height: 320px; }
.chart.short { height: 210px; }

.two { grid-template-columns: 1fr 1fr; }
.three { grid-template-columns: repeat(3, 1fr); }
.sixty { grid-template-columns: 1.55fr 1fr; }
@media (max-width: 1180px) {
  .two, .three, .sixty { grid-template-columns: 1fr; }
}

/* ---------------- table ---------------- */
.tblwrap { overflow: auto; max-height: 420px; border-radius: 8px; border: 1px solid var(--line-2); }
table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; white-space: nowrap; }
th {
  position: sticky; top: 0; background: #f7f9fc; color: var(--ink-2);
  font-weight: 600; font-size: 11.5px; border-bottom: 1px solid var(--line); z-index: 2;
}
th:first-child, td:first-child { text-align: left; }
tbody tr { border-bottom: 1px solid var(--line-2); }
tbody tr:hover { background: #f8fafd; }
tbody tr.alt { background: #fcfdff; }
td.dim { color: var(--ink-3); }
.tag {
  display: inline-block; padding: 1px 6px; border-radius: 5px; font-size: 10.5px;
  background: #eef2f9; color: var(--ink-2); margin-right: 4px;
}
.tag.mine { background: #e8f1ff; color: #1f5fd0; }
.tag.out { background: #fff1e6; color: #b45309; }
.bar-in { display: inline-block; height: 6px; border-radius: 3px; background: var(--brand); vertical-align: middle; }

.legend-note { font-size: 11px; color: var(--ink-3); margin-top: 8px; line-height: 1.6; }
.legend-note b { color: var(--ink-2); }

.sec-title {
  font-size: 12px; font-weight: 650; color: var(--ink-2); margin: 20px 0 10px;
  display: flex; align-items: center; gap: 8px;
}
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* progress */
.prog { margin: 10px 0; }
.prog .row { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-2); margin-bottom: 5px; }
.prog .row b { font-variant-numeric: tabular-nums; }
.track { height: 9px; background: #eef1f6; border-radius: 5px; overflow: hidden; display: flex; }
.track span { display: block; height: 100%; }
.track .fill { background: linear-gradient(90deg, #3b82f6, #1f6feb); }
.track .fill.warn { background: linear-gradient(90deg, #fbbf24, #d97706); }
.track .fill.bad { background: linear-gradient(90deg, #f87171, #e5484d); }
.track .mark { width: 2px; background: #94a3b8; }

.empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 12px; }

.tip { cursor: help; border-bottom: 1px dashed #b9c4d4; }
.hidden { display: none !important; }

.footnote {
  margin-top: 22px; padding: 12px 14px; background: #fff; border-radius: 10px;
  border: 1px dashed var(--line); font-size: 11.5px; color: var(--ink-3); line-height: 1.85;
}
.footnote b { color: var(--ink-2); }
