:root {
  --bg: #0b0c10;
  --surface: #14161c;
  --surface-2: #1b1e26;
  --line: #2a2e38;
  --grid: #232731;
  --text: #f1f1f3;
  --text-2: #b9bcc6;
  --muted: #8a8f9c;
  --gold: #f5c542;
  --gold-soft: #f5c54233;
  --warn: #f0a04b;
  --radius: 16px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "DM Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 1180px; margin: 0 auto; padding: 28px 16px 64px; }
h1 { font-family: Syne, "DM Sans", sans-serif; font-size: 34px; line-height: 1.1; margin: 0; }
h2 { font-size: 17px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 18px 0 8px; font-weight: 600; color: var(--text-2); }
.gold { color: var(--gold); text-shadow: 0 0 20px rgba(245, 197, 66, 0.2); }
.sub { margin: 6px 0 0; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.top { display: flex; align-items: end; justify-content: space-between; margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; min-width: 0; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.grid2 > .card { margin-bottom: 0; }
.grid2 + .card, .card + .grid2 { margin-top: 16px; }

.login { max-width: 420px; margin: 40px auto; }
.login form { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="password"] {
  flex: 1 1 200px; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); color: var(--text); font: inherit;
}
input[type="password"]:focus-visible { outline: 2px solid var(--gold); outline-offset: 1px; }
.btn {
  padding: 10px 16px; border-radius: 10px; border: 1px solid var(--gold); background: transparent; color: var(--gold);
  font: inherit; font-weight: 600; cursor: pointer; box-shadow: 0 0 16px rgba(245, 197, 66, 0.15);
}
.btn:hover { background: var(--gold-soft); }
.btn-quiet { border-color: var(--line); color: var(--text-2); box-shadow: none; }
.btn-quiet:hover { background: transparent; color: var(--text); }
.foot { text-align: center; margin: 24px 0 8px; }
[hidden] { display: none !important; }
.error { color: var(--warn); min-height: 1.5em; margin: 8px 0 0; }
.link { background: none; border: 0; color: var(--gold); font: inherit; cursor: pointer; padding: 4px 0; }
.link:hover { text-decoration: underline; }
.link .ico { vertical-align: -3px; margin-right: 5px; }
/* Icon-only buttons (they carry aria-label): no gap, and a 44 px hit area that doesn't change the look. (:only-child
   also matched "icon + Sign out": text nodes don't count, so the word sat against the icon.) */
.link[aria-label] .ico { margin-right: 0; }
.link[aria-label] { position: relative; }
.link[aria-label]::before { content: ""; position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); }
button:focus-visible, a:focus-visible, tr:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-bottom: 16px; }
.spacer { flex: 1; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; }
.seg button { background: none; border: 0; color: var(--text-2); font: inherit; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.seg button[aria-checked="true"] { background: var(--surface-2); color: var(--gold); font-weight: 600; }
.check { display: inline-flex; gap: 8px; align-items: center; color: var(--text-2); cursor: pointer; }
.check input { accent-color: var(--gold); width: 16px; height: 16px; }

.hero { display: grid; grid-template-columns: minmax(200px, 1fr) 3fr; gap: 18px; align-items: center; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } }
.label { color: var(--text-2); font-size: 13px; }
.hero-value { font-size: 56px; font-weight: 600; line-height: 1.05; margin: 4px 0; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface-2); border-radius: 12px; padding: 12px; min-width: 0; }
.tile .value { font-size: 22px; font-weight: 600; margin-top: 2px; }
.tile .note { color: var(--muted); font-size: 12px; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart.loading, .table-wrap.loading { opacity: 0.5; transition: opacity 0.2s; }
.axis text { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.grid line { stroke: var(--grid); stroke-width: 1; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--surface); }
th button { all: unset; cursor: pointer; }
th button[aria-sort]::after { content: " ↓"; color: var(--gold); }
table.apps tbody tr { cursor: pointer; }
table.apps tbody tr:hover, table.apps tbody tr[aria-selected="true"] { background: var(--surface-2); }
.kind { color: var(--muted); font-size: 12px; margin-left: 6px; }
.quiet { color: var(--warn); font-size: 12px; }
.quiet::before { content: "◔ "; }
.spark { vertical-align: middle; }
td.dim { color: var(--muted); }
td.up { color: #6ee7a1; }
td.down { color: #fca5a5; }

.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 140px) 1fr 52px; gap: 10px; align-items: center; font-size: 14px; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.bar-row .track { height: 10px; }
.bar-row .fill { height: 10px; background: var(--gold); border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-row .val { text-align: right; font-variant-numeric: tabular-nums; }

.me-links { display: flex; flex-wrap: wrap; gap: 8px; }
.me-links a {
  color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 14px;
}
.me-links a:hover { border-color: var(--gold); color: var(--gold); }
.pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--text-2); }
.pill.on { border-color: var(--gold); color: var(--gold); }
td button.pill { cursor: pointer; background: none; font: inherit; font-size: 12px; }

.tip {
  position: fixed; z-index: 10; pointer-events: none; background: #0e1015; border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; font-size: 13px; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4); min-width: 120px;
}
.tip .t-val { font-size: 16px; font-weight: 600; }
.tip .t-row { display: flex; align-items: center; gap: 8px; }
.tip .key { width: 12px; height: 2px; background: var(--gold); border-radius: 2px; }
.tip .t-label { color: var(--muted); }
