:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --border: #e4e4e0;
  --grid: #ececea;
  --text: #191919;
  --text-2: #666666;
  --series-1: #257de0;
  --series-2: #f47230;
  --good: #0a7d1d;
  --bad: #c62f30;
  --warn-bg: #fff4dc;
  --warn-text: #7a5200;
  --bad-bg: #fde8e8;
  --chip: #efefec;
  --accent: #1b64be;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121212;
    --surface: #191919;
    --border: #2c2c2c;
    --grid: #262626;
    --text: #efefef;
    --text-2: #9c9c9c;
    --series-1: #338ced;
    --series-2: #e76624;
    --good: #3cc85a;
    --bad: #eb6263;
    --warn-bg: #3a2c0a;
    --warn-text: #f5c35a;
    --bad-bg: #3a1616;
    --chip: #262626;
    --accent: #6aabf1;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
header.top {
  display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5;
}
.brand { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
nav.main { display: flex; gap: 4px; flex: 1; }
nav.main a { padding: 8px 12px; border-radius: 8px; color: var(--text-2); font-weight: 500; }
nav.main a.on { background: var(--chip); color: var(--text); }
nav.main a:hover { text-decoration: none; color: var(--text); }
.sync-status { color: var(--text-2); font-size: 12px; white-space: nowrap; }
.sync-status .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--good); }
.sync-status .dot.err { background: var(--bad); }
main { max-width: 1320px; margin: 0 auto; padding: 24px; }
.pagehead { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 16px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 15px; margin: 0 0 12px; }
.seg { display: inline-flex; background: var(--chip); border-radius: 8px; padding: 3px; }
.seg a { padding: 5px 12px; border-radius: 6px; color: var(--text-2); font-weight: 500; }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg a:hover { text-decoration: none; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.tile .lbl { color: var(--text-2); font-size: 12px; font-weight: 500; }
.tile .val { font-size: 24px; font-weight: 650; margin-top: 4px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.tile .sub { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.delta.up { color: var(--good); } .delta.down { color: var(--bad); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 960px) { .grid2 { grid-template-columns: 1fr; } }
.chartbox { position: relative; height: 280px; }
.chartbox.small { height: 200px; }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-2); font-weight: 500; font-size: 12px; white-space: nowrap; cursor: pointer; user-select: none; }
th.num, td.num { text-align: right; }
tr:hover td { background: color-mix(in srgb, var(--chip) 50%, transparent); }
td.title { max-width: 420px; }
.muted { color: var(--text-2); }
.small { font-size: 12px; }
.tablewrap { overflow-x: auto; }
.pl td { border: none; padding: 6px 0; }
.pl td.num { font-weight: 600; }
.pl tr.total td { border-top: 1px solid var(--border); padding-top: 10px; font-weight: 700; }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--chip); color: var(--text-2); margin: 1px 2px 1px 0; white-space: nowrap; }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.warn { background: var(--warn-bg); color: var(--warn-text); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.filters button { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.filters button.on { background: var(--text); color: var(--surface); border-color: var(--text); }
input[type=search], input[type=password], select, input[type=file] {
  font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text);
}
.btn { display: inline-block; font: inherit; font-weight: 600; padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.flash { background: var(--warn-bg); color: var(--warn-text); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; background: var(--chip); }
.login { max-width: 340px; margin: 14vh auto; }
.login form { display: flex; flex-direction: column; gap: 12px; }
.empty { padding: 32px; text-align: center; color: var(--text-2); }
.ok { color: var(--good); } .err { color: var(--bad); }
.nowrap { white-space: nowrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text); }
.brand:hover { text-decoration: none; }
nav.sub { display: flex; gap: 4px; padding: 0 24px; height: 44px; align-items: center; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 56px; z-index: 4; }
nav.sub a { padding: 6px 10px; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; }
nav.sub a.on { color: var(--text); border-bottom-color: var(--accent); }
nav.sub a:hover { text-decoration: none; color: var(--text); }
