:root {
  --bg: #0b0d11; --panel: #12151b; --panel2: #171b22; --line: #232832; --line2: #2e3542;
  --fg: #e7eaf0; --muted: #8a93a3; --dim: #5c6575;
  --accent: #7cf0c5; --accent-ink: #062a1e; --warn: #f5c062; --bad: #ff6b7a; --info: #7fb3ff;
  --radius: 10px; --mono: ui-monospace, "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); font: 14px/1.45 var(--sans); }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .dim { color: var(--dim); } .mono { font-family: var(--mono); font-size: 12.5px; }
.err { color: var(--bad); min-height: 1.2em; }

.login { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 500px at 50% -10%, #12352a55, transparent); }
.login-card { width: 340px; display: flex; flex-direction: column; gap: 12px; padding: 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; }
.login-card p { margin: 0 0 6px; }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; border-right: 1px solid var(--line); background: #0d1014; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; letter-spacing: .2px; padding: 0 8px 18px; }
.brand.big { font-size: 20px; padding: 0; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }
nav { display: flex; flex-direction: column; gap: 2px; }
nav a { color: var(--muted); padding: 8px 10px; border-radius: 8px; }
nav a:hover { color: var(--fg); background: var(--panel); }
nav a.active { color: var(--fg); background: var(--panel2); box-shadow: inset 2px 0 0 var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 6px; }
.main { padding: 26px 32px 60px; max-width: 1400px; width: 100%; }

h1 { font-size: 22px; margin: 0; font-weight: 650; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.grid { display: grid; gap: 14px; }
.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)); }
@media (max-width: 1100px) { .g4, .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g2 { grid-template-columns: 1fr; } }
@media (max-width: 760px) { .app { grid-template-columns: 1fr; } .side { position: static; height: auto; } .main { padding: 18px; } .g4, .g3 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.stat .v { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .s { color: var(--muted); font-size: 12px; margin-top: 2px; }

.btn { font: inherit; border: 1px solid var(--line2); background: var(--panel2); color: var(--fg); padding: 8px 14px; border-radius: 8px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #3d4656; } .btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { color: var(--bad); } .btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; }
input, select, textarea { font: inherit; color: var(--fg); background: #0d1015; border: 1px solid var(--line2); border-radius: 8px; padding: 8px 10px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { font-family: var(--mono); font-size: 12.5px; width: 100%; resize: vertical; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); }
label.chk { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; } tr.click:hover td { background: #151922; }
td.num, th.num { text-align: right; }
.tbl-wrap { overflow-x: auto; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 99px; font-size: 12px; background: var(--panel2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--accent); border-color: #1f5a46; background: #0e221c; }
.pill.bad { color: var(--bad); border-color: #5a1f2a; background: #22100f; }
.pill.warn { color: var(--warn); border-color: #5a4a1f; background: #221c0e; }
.pill.info { color: var(--info); border-color: #1f3a5a; background: #0e1722; }

.bar { position: relative; height: 8px; background: #0d1015; border: 1px solid var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.bar > i.warn { background: var(--warn); } .bar > i.bad { background: var(--bad); }
.bar > b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--fg); opacity: .8; }
.stack { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: #0d1015; border: 1px solid var(--line); }
.stack > span { height: 100%; }

.chart { width: 100%; height: 160px; display: block; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.models { max-height: 340px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 2px; }
.models label { padding: 4px 6px; border-radius: 6px; font-family: var(--mono); font-size: 12px; display: flex; gap: 7px; align-items: center; }
.models label:hover { background: var(--panel2); }
.models .live { color: var(--accent); font-size: 10px; }

pre.code { margin: 0; background: #0a0c10; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; overflow: auto; font: 12.5px/1.5 var(--mono); max-height: 440px; white-space: pre; }
.snip-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button { font: inherit; background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 6px 12px; border-radius: 99px; cursor: pointer; }
.tabs button.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.modal { position: fixed; inset: 0; background: #000a; display: grid; place-items: start center; padding: 6vh 16px; z-index: 50; overflow: auto; }
.modal-card { width: min(860px, 100%); background: var(--panel); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; }
.modal-card .head { margin-bottom: 14px; }
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--panel2); border: 1px solid var(--line2); padding: 11px 16px; border-radius: 10px; z-index: 60; max-width: 420px; }
.toast.bad { border-color: #5a1f2a; color: var(--bad); }
.logbox { height: 460px; overflow: auto; background: #08090c; border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: 12px/1.45 var(--mono); white-space: pre-wrap; color: #b9c0cc; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; font-size: 13px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.section { margin-top: 18px; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.qgrid { display: grid; grid-template-columns: 110px 90px 1fr; gap: 8px 12px; align-items: center; }
.small { font-size: 12px; }
