:root {
  color-scheme: dark;
  --bg: #0d0e12; --surface: #15171d; --surface-2: #1c1f27; --line: #272b35;
  --text: #eceef2; --muted: #9298a6; --accent: #6d7cff; --series: #3987e5;
  --good: #2fbf71; --warn: #f0b13b; --bad: #ef5a5a;
  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}
* { box-sizing: border-box; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 14px; font-weight: 600; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12.5px; }
.error { color: var(--bad); min-height: 21px; }

input, select, button { font: inherit; color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-height: 38px; }
button { cursor: pointer; }
button:hover { border-color: #3a4050; }
button.primary { background: var(--accent); border-color: var(--accent); color: #0b0c14; font-weight: 600; }
button.ghost { background: none; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); box-shadow: inset 0 0 0 6px #23284d; }

.login { display: grid; place-items: center; padding: 20px; }
.login .card { width: min(380px, 100%); padding: 32px; }
.login h1 { margin: 28px 0 4px; }
.login form { display: grid; gap: 10px; margin-top: 24px; }

.app { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
aside { border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; position: sticky; top: 0; height: 100vh; }
aside .brand { padding: 0 8px; }
nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
nav a { padding: 8px 10px; border-radius: 8px; color: var(--muted); }
nav a:hover { color: var(--text); background: var(--surface); }
nav a[aria-current] { color: var(--text); background: var(--surface-2); box-shadow: inset 2px 0 var(--accent); }
main { padding: 28px clamp(16px, 3vw, 40px) 60px; }
.app header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }

.badge { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 99px; padding: 4px 12px; background: var(--surface); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.good { background: var(--good); } .dot.bad { background: var(--bad); } .dot.warn { background: var(--warn); }

#view { display: grid; gap: 16px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; min-width: 0; }
.card > h2 { margin-bottom: 12px; }
.stat b { display: block; font-size: 28px; font-weight: 600; letter-spacing: -.02em; margin: 2px 0; }
a.card:hover { border-color: #3a4050; }

.chart { width: 100%; height: 130px; display: block; touch-action: pan-y; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .area { fill: var(--series); opacity: .12; }
.chart .line { fill: none; stroke: var(--series); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .cross { stroke: var(--muted); stroke-width: 1; vector-effect: non-scaling-stroke; }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); }
.head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
#tip { position: fixed; pointer-events: none; background: #0a0b0f; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; z-index: 9; white-space: nowrap; }

.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type=search] { flex: 1; min-width: 180px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.check input { min-height: 0; accent-color: var(--accent); }
.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
tr:last-child td { border-bottom: 0; }
td.nowrap { white-space: nowrap; }
td.detail { word-break: break-all; min-width: 240px; }
td a { color: #a9b2ff; }
.tag { display: inline-block; border: 1px solid var(--line); border-radius: 6px; padding: 0 7px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.tag.good { color: var(--good); } .tag.bad { color: var(--bad); } .tag.warn { color: var(--warn); }
.empty { color: var(--muted); padding: 20px 0; text-align: center; }
.bars { display: flex; gap: 2px; align-items: stretch; height: 28px; margin: 10px 0 4px; }
.bars i { flex: 1; max-width: 8px; border-radius: 2px; background: var(--good); }
.bars i.bad { background: var(--bad); height: 50%; align-self: flex-end; }
.notice { border-color: #5a4620; background: #1e1a10; }

@media (max-width: 760px) {
  .app { display: block; }
  aside { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px; }
  nav { order: 3; flex: 0 0 100%; flex-direction: row; overflow-x: auto; }
  nav a { white-space: nowrap; }
  nav a[aria-current] { box-shadow: inset 0 -2px var(--accent); }
  .grid.wide { grid-template-columns: minmax(0, 1fr); }
}
