:root {
  --bg: #0c0d10;
  --panel: #131419;
  --panel-2: #1a1c22;
  --line: #24272f;
  --line-2: #2f333c;
  --text: #edeef0;
  --muted: #8d94a0;
  --faint: #5f6672;
  --accent: #f5b83d;
  --accent-ink: #1b1405;
  --ok: #2fbf83;
  --bad: #f05264;
  --warn: #f5b83d;
  --r: 8px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 14px/1.45 Onest, system-ui, sans-serif; font-feature-settings: 'tnum' 1; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.ok { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.right { text-align: right; }

/* Layout */
.layout { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; font-weight: 700; }
.brand small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.side a { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; font-weight: 500; }
.side a:hover { color: var(--text); background: var(--panel); }
.side a.on { color: var(--text); background: var(--panel-2); box-shadow: inset 2px 0 0 var(--accent); }
.side .grp { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; padding: 14px 10px 6px; }
.side .spacer { flex: 1; }
.dotbad { width: 8px; height: 8px; border-radius: 50%; background: var(--bad); }
main { padding: 24px 28px 60px; max-width: 1400px; width: 100%; }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.01em; }
.lead { color: var(--muted); margin: 0 0 20px; }
h2 { font-size: 15px; margin: 0; }

/* Blocks */
.grid { display: grid; gap: 12px; }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.card-b { padding: 14px 16px; }
.stat { padding: 14px 16px; }
.stat .k { color: var(--muted); font-size: 12px; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 2px; letter-spacing: -0.01em; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
.section { margin-top: 22px; }
.section > .title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th.right, td.right { text-align: right; }
.scroll { overflow-x: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); white-space: nowrap; }
.pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.pill.ok::before { background: var(--ok); }
.pill.bad::before { background: var(--bad); }
.pill.warn::before { background: var(--warn); }
.alert { display: flex; gap: 10px; align-items: center; padding: 10px 14px; border-radius: var(--r); border: 1px solid var(--line-2); background: var(--panel); margin-bottom: 8px; }
.alert.bad { border-color: color-mix(in srgb, var(--bad) 50%, transparent); background: color-mix(in srgb, var(--bad) 8%, var(--panel)); }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 7%, var(--panel)); }
.alert.okk { border-color: color-mix(in srgb, var(--ok) 40%, transparent); }
.empty { padding: 26px; text-align: center; color: var(--muted); }

/* Controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn:hover { border-color: var(--faint); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
input.in, select.in, textarea.in { height: 36px; border-radius: 6px; border: 1px solid var(--line-2); background: var(--bg); padding: 0 10px; min-width: 0; }
textarea.in { height: auto; min-height: 180px; padding: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; width: 100%; resize: vertical; }
input.in:focus, select.in:focus, textarea.in:focus { border-color: var(--faint); outline: none; }
label.f { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
label.f .in { color: var(--text); font-size: 14px; }
.form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; align-items: end; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { background: none; border: 1px solid transparent; padding: 6px 12px; border-radius: 6px; color: var(--muted); font-weight: 600; }
.tabs button.on { color: var(--text); background: var(--panel-2); border-color: var(--line-2); }
pre.log { margin: 0; padding: 14px 16px; max-height: 520px; overflow: auto; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; word-break: break-all; color: #c9ced6; background: #08090b; border-radius: 0 0 10px 10px; }
.bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; min-width: 70px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.chart { width: 100%; height: 150px; display: block; }
.chart .ln { fill: none; stroke: var(--accent); stroke-width: 1.8; }
.chart .ar { fill: color-mix(in srgb, var(--accent) 12%, transparent); }
.chart text { fill: var(--faint); font-size: 10px; }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line-2); border-radius: 12px; padding: 0; width: min(520px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
dialog .card-h button { background: none; border: 0; color: var(--muted); font-size: 20px; }
dialog form { padding: 16px; display: grid; gap: 12px; }
.err { color: var(--bad); font-size: 13px; min-height: 1em; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 100; }
.toast { background: var(--panel-2); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 6px; max-width: 420px; transition: opacity 0.4s; }
.toast.error { border-left-color: var(--bad); }
.toast.ok { border-left-color: var(--ok); }
.toast.out { opacity: 0; }
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login form { width: min(380px, 100%); display: grid; gap: 12px; }
.login .in { width: 100%; height: 42px; }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 6px 12px; font-size: 13px; }
.kv span:nth-child(odd) { color: var(--muted); }
.mobile-nav { display: none; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .side { display: none; }
  .mobile-nav { display: flex; gap: 6px; overflow-x: auto; padding: 10px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 10; scrollbar-width: none; }
  .mobile-nav a { padding: 6px 10px; border-radius: 6px; color: var(--muted); text-decoration: none; white-space: nowrap; font-weight: 600; font-size: 13px; }
  .mobile-nav a.on { background: var(--panel-2); color: var(--text); }
  main { padding: 16px 16px 48px; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3, .g2 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; }
  .toasts { left: 16px; right: 16px; }
}
