:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface-1: #fcfcfb;
  --border: #e3e2de;
  --grid: #ecebe7;
  --text-primary: #0b0b0b;
  --text-secondary: #52514e;
  --text-muted: #77756f;
  --accent: #2a78d6;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --notice-bg: #fff6e0;
  --notice-border: #eda100;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #111110;
    --surface-1: #1a1a19;
    --border: #2e2e2c;
    --grid: #2a2a28;
    --text-primary: #ffffff;
    --text-secondary: #c3c2b7;
    --text-muted: #9a998f;
    --accent: #3987e5;
    --series-1: #3987e5;
    --series-2: #d95926;
    --notice-bg: #2b2412;
    --notice-border: #c98500;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111110;
  --surface-1: #1a1a19;
  --border: #2e2e2c;
  --grid: #2a2a28;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #9a998f;
  --accent: #3987e5;
  --series-1: #3987e5;
  --series-2: #d95926;
  --notice-bg: #2b2412;
  --notice-border: #c98500;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  padding: 24px;
  max-width: 1200px;
  margin-inline: auto;
  background: var(--bg);
  color: var(--text-primary);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1 { font-size: 22px; margin: 0; font-weight: 600; }
h2 { font-size: 16px; margin: 0; font-weight: 600; }
.muted { color: var(--text-muted); }

.topbar { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 16px; }
.title-block { display: flex; align-items: center; gap: 12px; }
.sync { margin: 0; color: var(--text-secondary); font-size: 13px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; margin-bottom: 16px; }
.segmented { display: inline-flex; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--text-secondary); font: inherit;
  padding: 6px 12px; border-radius: 6px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.range { display: inline-flex; align-items: center; gap: 6px; }
.range[hidden] { display: none; }
input[type="date"], select {
  font: inherit; color: var(--text-primary); background: var(--surface-1);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
}
.icon-btn {
  font: inherit; font-size: 18px; line-height: 1; width: 32px; height: 32px; cursor: pointer;
  color: var(--text-primary); background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px;
}
.range-label { margin: 0; color: var(--text-secondary); }

.notice { background: var(--notice-bg); border: 1px solid var(--notice-border); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 16px; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head .swatch { margin: 0; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.kpi-label { color: var(--text-secondary); font-size: 12px; }
.kpi-label[title] { cursor: help; text-decoration: underline dotted; text-underline-offset: 3px; }
.footnote { color: var(--text-secondary); font-size: 12px; margin: -4px 0 16px; }
.kpi-value { font-size: 26px; font-weight: 600; line-height: 1.2; overflow-wrap: anywhere; }
.rows { margin: 0; display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; }
.rows dt { color: var(--text-secondary); }
.rows dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; font-weight: 500; }
.rows .sep { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 4px 0; }

.panel { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.legend { display: flex; gap: 16px; color: var(--text-secondary); }
.legend span { display: inline-flex; align-items: center; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; }
.swatch.s1 { background: var(--series-1); }
.swatch.s2 { background: var(--series-2); }
.swatch.s0 { background: var(--text-primary); }
.chart-title { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin: 12px 0 4px; }
.chart-box { position: relative; height: 240px; }

.table-view { margin-top: 16px; }
.table-view summary { cursor: pointer; color: var(--text-secondary); }
.table-scroll { overflow-x: auto; margin-top: 8px; }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--text-secondary); font-weight: 500; }

@media (max-width: 900px) {
  .cards { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  body { padding: 16px; }
  .kpi-value { font-size: 22px; }
  .chart-box { height: 200px; }
}
