/* Tokens first, and no rule below names a colour of its own — that is what
   makes a second theme possible without auditing every rule. Values are the
   manager's mockup. */
:root {
  color-scheme: light;
  --surface-1:      #fcfcfb;
  --page:           #f9f9f7;
  --text-primary:   #0b0b0b;
  --text-secondary: #52514e;
  --muted:          #898781;
  --grid:           #e1e0d9;
  --baseline:       #c3c2b7;
  --border:         rgba(11, 11, 11, 0.10);
  --series-1:       #2a78d6;
  --series-2:       #eb6834;
  --success:        #006300;
  --critical:       #d03b3b;
  --tile-bg:        #ffffff;
}

/* The dark values are written twice on purpose: once for the explicit choice
   and once for the system preference. A token present in one list and not the
   other is broken only for whichever half of the readers hits that rule. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --surface-1:      #1a1a19;
    --page:           #0d0d0d;
    --text-primary:   #ffffff;
    --text-secondary: #c3c2b7;
    --muted:          #898781;
    --grid:           #2c2c2a;
    --baseline:       #383835;
    --border:         rgba(255, 255, 255, 0.10);
    --series-1:       #3987e5;
    --series-2:       #d95926;
    --success:        #0ca30c;
    --critical:       #e66767;
    --tile-bg:        #201f1e;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --surface-1:      #1a1a19;
  --page:           #0d0d0d;
  --text-primary:   #ffffff;
  --text-secondary: #c3c2b7;
  --muted:          #898781;
  --grid:           #2c2c2a;
  --baseline:       #383835;
  --border:         rgba(255, 255, 255, 0.10);
  --series-1:       #3987e5;
  --series-2:       #d95926;
  --success:        #0ca30c;
  --critical:       #e66767;
  --tile-bg:        #201f1e;
}

* { box-sizing: border-box; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--page);
  color: var(--text-primary);
  margin: 0;
  padding: 28px 20px 48px;
  min-height: 100vh;
}
.wrap { max-width: 1100px; margin: 0 auto; }
a { color: var(--series-1); }

.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.top h1 { font-size: 22px; margin: 0 0 4px; }
.top .who { font-size: 12.5px; color: var(--muted); text-align: right; }
.top .who a { margin-left: 10px; }

nav.tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--grid); margin-bottom: 18px; }
nav.tabs a {
  font-size: 13px; padding: 8px 2px; text-decoration: none;
  color: var(--text-secondary); border-bottom: 2px solid transparent;
}
nav.tabs a.active { color: var(--text-primary); border-bottom-color: var(--series-1); font-weight: 600; }

.notice {
  font-size: 12.5px; border-radius: 8px; padding: 9px 12px; margin-bottom: 14px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text-secondary);
}
.notice.alert { border-color: var(--critical); color: var(--critical); }

form.filters {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; margin: 0 0 22px;
}
form.filters label { font-size: 12px; color: var(--muted); }
form.filters input[type="date"] {
  font: inherit; font-size: 13px; padding: 5px 9px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--page); color: var(--text-primary);
}
form.filters button {
  font: inherit; font-size: 13px; padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--series-1); background: transparent; color: var(--series-1);
}
form.filters .rate { margin-left: auto; font-size: 12px; color: var(--muted); }

section.block {
  background: var(--surface-1); border: 1px solid var(--border);
  border-radius: 14px; padding: 20px 22px 24px; margin-bottom: 20px;
}
section.block.summary { border: 1.5px dashed var(--baseline); background: transparent; }
.block-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.block-head h2 { font-size: 15px; margin: 0; text-transform: uppercase; letter-spacing: .04em; color: var(--text-secondary); }
.block-note { font-size: 12px; color: var(--muted); }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.tiles.one { grid-template-columns: 1fr; }
.tile { background: var(--tile-bg); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.tile .label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tile .value { font-size: 24px; font-weight: 600; }
.tile .value.headline { color: var(--series-1); }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.cols { display: grid; grid-template-columns: 1.1fr 1fr; gap: 24px; }
.cols.wide-right { grid-template-columns: 0.9fr 1.3fr; }
h3.sub { font-size: 12.5px; color: var(--text-secondary); margin: 0 0 12px; font-weight: 600; }

.barlist { display: flex; flex-direction: column; gap: 10px; }
.barrow { display: grid; grid-template-columns: minmax(90px, 130px) 1fr 82px; align-items: center; gap: 10px; }
.barrow .name { font-size: 12.5px; color: var(--text-secondary); }
.barrow .track { background: var(--grid); border-radius: 5px; height: 10px; position: relative; }
.barrow .fill { position: absolute; inset: 0 auto 0 0; border-radius: 5px; background: var(--series-1); }
.barrow .amt { font-size: 12.5px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); }

.legend { display: flex; gap: 16px; margin-bottom: 12px; font-size: 12.5px; color: var(--text-secondary); flex-wrap: wrap; }
.legend .sw { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { width: 9px; height: 9px; border-radius: 2px; }

.split { display: flex; gap: 10px; align-items: flex-end; height: 130px; margin-bottom: 8px; }
.split .colwrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.split .colbar { width: 56%; min-height: 2px; border-radius: 4px 4px 2px 2px; }
.split .collabel { font-size: 12px; color: var(--muted); text-align: center; }
.split .colval { font-size: 13px; font-weight: 600; }

.table-shell { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: .02em;
  padding: 6px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap;
}
tbody td { padding: 8px; border-bottom: 1px solid var(--grid); color: var(--text-secondary); }
tbody td.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-primary); white-space: nowrap; }
tbody tr:hover { background: var(--page); }
.code-pill {
  display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px;
  background: var(--grid); color: var(--text-primary); font-variant-numeric: tabular-nums;
}
.empty { font-size: 12.5px; color: var(--muted); padding: 10px 0; }

.summary-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.summary-eq { font-size: 13px; color: var(--text-secondary); }
.summary-eq b { color: var(--text-primary); }
.summary-result { text-align: right; }
.summary-result .value { font-size: 28px; font-weight: 700; }
.summary-result .value.neg { color: var(--critical); }
.summary-result .value.pos { color: var(--success); }

.login-shell { max-width: 340px; margin: 12vh auto; }
.login-shell h1 { font-size: 19px; margin: 0 0 18px; }
.login-shell label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.login-shell input[type="text"], .login-shell input[type="password"] {
  font: inherit; width: 100%; padding: 8px 10px; margin-bottom: 14px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--page); color: var(--text-primary);
}
.login-shell button {
  font: inherit; width: 100%; padding: 9px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--series-1); background: var(--series-1); color: var(--tile-bg);
}
.login-shell .error { font-size: 12.5px; color: var(--critical); margin-bottom: 12px; }

@media (max-width: 760px) {
  .tiles { grid-template-columns: 1fr; }
  .cols, .cols.wide-right { grid-template-columns: 1fr; }
}
