:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #16181d;
  --muted: #5f6672;
  --line: #e3e6eb;
  --accent: #2f6fde;
  --accent-soft: #e8effc;
  --error: #b42318;
  --error-soft: #fdecea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --card: #181b21;
    --text: #e8eaee;
    --muted: #9aa1ad;
    --line: #2a2f38;
    --accent: #6c9bf0;
    --accent-soft: #1e2a40;
    --error: #f2877d;
    --error-soft: #3a1d1b;
  }
}

* { 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;
}

.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 48px; }

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.small p { margin: 4px 0; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.login { max-width: 420px; margin: 12vh auto 0; }
.login form { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
label { font-size: 13px; color: var(--muted); }

input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

button {
  font: inherit;
  padding: 10px 14px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }

.error {
  background: var(--error-soft);
  color: var(--error);
  padding: 8px 12px;
  border-radius: 8px;
  margin: 8px 0 0;
}

.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.top p { margin: 0; }

.periods { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.periods a {
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-decoration: none;
  background: var(--card);
}
.periods a.active { background: var(--accent-soft); color: var(--accent); border-color: transparent; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
}
.tile .label { font-size: 13px; color: var(--muted); }
.tile .value { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.group th, tr.group td { background: var(--bg); font-weight: 600; }
.link-label { display: block; }
code { font-size: 12px; color: var(--muted); word-break: break-all; }

.bar-col { width: 30%; }
meter { width: 100%; height: 10px; }

@media (max-width: 560px) {
  .tiles { grid-template-columns: 1fr; }
  .tile .value { font-size: 22px; }
  .bar-col { display: none; }
}
