:root {
  color-scheme: dark;
  --bg: #0e0e0e;
  --surface-1: #191919;
  --surface-2: #222222;
  --surface-3: #2c2c2c;
  --border: #2f2f2f;
  --text-primary: #efefef;
  --text-secondary: #9c9c9c;
  --text-muted: #6e6e6e;
  --accent: #338ced;
  --good: #0aac23;
  --warning: #fbb315;
  --critical: #dc3c3d;
  --radius: 10px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--text-primary);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: #6fb0f5; }
button, input, select, textarea { font: inherit; color: inherit; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
pre { background: #121212; border: 1px solid var(--border); border-radius: 8px; padding: 12px 14px;
  overflow-x: auto; line-height: 1.45; margin: 8px 0 0; }

header { position: sticky; top: 0; z-index: 5; background: rgba(14,14,14,.92);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.bar { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.brand { font-weight: 650; display: flex; align-items: center; gap: 8px; color: var(--text-primary); text-decoration: none; }
.brand small { color: var(--text-muted); font-weight: 400; }
.spacer { flex: 1; }
nav a { color: var(--text-secondary); text-decoration: none; margin-left: 4px; padding: 5px 9px; border-radius: 6px; }
nav a:hover { color: var(--text-primary); background: var(--surface-2); }

main { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; display: grid; gap: 16px;
  grid-template-columns: minmax(0, 1fr); }
.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.card-body { padding: 14px; }
h1 { font-size: 26px; margin: 0 0 6px; letter-spacing: -.2px; }
.lead { color: var(--text-secondary); margin: 0; max-width: 680px; }

.seg { display: inline-flex; background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 2px; flex-wrap: wrap; }
.seg button { background: none; border: 0; padding: 5px 11px; border-radius: 6px; color: var(--text-secondary); cursor: pointer; font-size: 13px; }
.seg button:hover { color: var(--text-primary); }
.seg button.on { background: var(--surface-3); color: var(--text-primary); }

.btn { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 13px;
  cursor: pointer; font-size: 13px; white-space: nowrap; }
.btn:hover { background: var(--surface-3); }
.btn.primary { background: #1f4f86; border-color: #2a65a8; }
.btn.primary:hover { background: #2660a2; }
.btn.ghost { background: none; border-color: transparent; color: var(--text-secondary); }
.btn.ghost:hover { color: var(--text-primary); background: var(--surface-2); }
.btn.danger:hover { color: #ff8a8a; }
.btn:disabled { opacity: .5; cursor: default; }

input, select, textarea { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #2a65a8; outline-offset: -1px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--text-secondary); }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 180px; }
.err { color: #ff8a8a; font-size: 13px; min-height: 1.2em; }
.ok { color: #6fdc80; font-size: 13px; }
.muted { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { color: var(--text-secondary); font-size: 12px; }
.tile .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .v small { font-size: 13px; color: var(--text-secondary); font-weight: 400; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
th { color: var(--text-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.num { text-align: right; }
tr:last-child td { border-bottom: 0; }

.status { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.dot.up { background: var(--good); box-shadow: 0 0 0 3px rgba(10,172,35,.18); }
.dot.down { background: var(--critical); box-shadow: 0 0 0 3px rgba(220,60,61,.18); }
.dot.wait { background: var(--text-muted); }
.pill { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: var(--surface-3); color: var(--text-secondary);
  display: inline-flex; align-items: center; gap: 6px; }

.keybox { display: flex; gap: 8px; align-items: center; background: #121212; border: 1px solid #2a65a8;
  border-radius: 8px; padding: 10px 12px; margin-top: 10px; flex-wrap: wrap; }
.keybox code { background: none; padding: 0; word-break: break-all; flex: 1 1 260px; font-size: 13px; }

.chart-holder { position: relative; height: 220px; }
.empty-chart { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-muted); font-size: 13px; }
footer { max-width: 1100px; margin: 0 auto; padding: 0 16px 28px; color: var(--text-muted); font-size: 12px; }

@media (max-width: 600px) { h1 { font-size: 22px; } .tiles { grid-template-columns: 1fr 1fr; } .tile .v { font-size: 20px; } }
.pill.good { background: rgba(10,172,35,.15); color: #6fdc80; }
.pill.bad { background: rgba(220,60,61,.18); color: #ff8a8a; font-weight: 600; }
.badbox { background: rgba(220,60,61,.10); border: 1px solid rgba(220,60,61,.45); border-radius: 8px; padding: 10px 12px; color: #f2c4c4; }
nav a.on { color: var(--text-primary); background: var(--surface-2); }
