:root {
  --bg: #fbfbf9;
  --surface: #ffffff;
  --text: #1c1d1f;
  --muted: #6b6f76;
  --line: #e4e4e0;
  --accent: #2f5bd3;
  --good: #1f7a45;
  --warn: #a35a00;
  --bad: #b3261e;
  --chip: #f0f0ec;
  --bar: #2f5bd3;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121315;
    --surface: #1b1c1f;
    --text: #e8e8e6;
    --muted: #9a9ea6;
    --line: #2c2e33;
    --accent: #8aa8ff;
    --good: #5fc48a;
    --warn: #e0a24a;
    --bad: #ff8a80;
    --chip: #26282c;
    --bar: #8aa8ff;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #121315;
  --surface: #1b1c1f;
  --text: #e8e8e6;
  --muted: #9a9ea6;
  --line: #2c2e33;
  --accent: #8aa8ff;
  --good: #5fc48a;
  --warn: #e0a24a;
  --bad: #ff8a80;
  --chip: #26282c;
  --bar: #8aa8ff;
  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 13px; }
.spacer { flex: 1; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.top-row { display: flex; align-items: center; gap: 12px; height: 52px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); font-weight: 650; font-size: 17px; }
.brand svg { fill: var(--accent); stroke: var(--accent); stroke-width: 1.6; }
.agent-link { font-size: 13px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; padding-bottom: 0; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { color: var(--muted); padding: 8px 10px; border-bottom: 2px solid transparent; white-space: nowrap; font-size: 14px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }

main { padding-top: 20px; padding-bottom: 32px; min-height: 60vh; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 28px 0 10px; }
p { margin: 6px 0; }

.lede { color: var(--muted); max-width: 70ch; margin-bottom: 16px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .n { font-size: 24px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tile .l { color: var(--muted); font-size: 13px; }
.tile.highlight { border-color: var(--accent); }
.tile.alert .n { color: var(--bad); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px; }
.card-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.card-title { font-weight: 600; overflow-wrap: anywhere; }

.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--chip); color: var(--muted); white-space: nowrap; }
.chip.good { color: var(--good); }
.chip.warn { color: var(--warn); }
.chip.bad { color: var(--bad); }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.feed time { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.feed .what { overflow-wrap: anywhere; }
.who { font-weight: 600; }
.quote { color: var(--muted); }

table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-weight: 500; font-size: 13px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }

.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 220px) 1fr 56px; gap: 10px; align-items: center; font-size: 14px; }
.bar-track { background: var(--chip); border-radius: 4px; height: 12px; overflow: hidden; }
.bar-fill { background: var(--bar); height: 100%; border-radius: 4px; }
.bar-row .num { text-align: right; font-variant-numeric: tabular-nums; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
select { font: inherit; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }

.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 22px; text-align: center; color: var(--muted); }
.note { font-size: 13px; color: var(--muted); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.days { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.days a { padding: 3px 9px; border-radius: 999px; background: var(--chip); color: var(--text); font-size: 13px; }
.days a.active { background: var(--accent); color: var(--bg); }

.foot { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-bottom: 28px; font-size: 13px; }

@media (max-width: 720px) {
  .cols { grid-template-columns: 1fr; }
  .feed li { grid-template-columns: 1fr; gap: 2px; }
  .bar-row { grid-template-columns: 110px 1fr 44px; }
  #day { display: none; }
}
