:root {
  --bg: #0d1117; --panel: #151b23; --panel2: #1b2330; --line: #2a3442; --text: #e6edf3; --muted: #8b98a8;
  --accent: #5cd65c; --accent2: #3fb5ff; --warn: #f0b429; --bad: #f2555a; --radius: 10px;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); height: 100%; }
[hidden] { display: none !important; }
a { color: var(--accent2); cursor: pointer; text-decoration: none; }
.muted { color: var(--muted); }
.err { color: var(--bad); margin: 8px 0 0; }
.ok { color: var(--accent); }
button, input, select, textarea { font: inherit; color: var(--text); }
input, select, textarea { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent2); border-color: transparent; }
label { display: block; color: var(--muted); font-size: 12px; margin: 12px 0 0; }
label input, label select, label textarea { margin-top: 4px; }
button { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); color: #062006; border-color: transparent; font-weight: 600; }
button.danger { color: var(--bad); }
button.link { background: none; border: none; color: var(--accent2); padding: 0 4px; }
button:disabled { opacity: .5; cursor: default; }
.pill { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px; background: var(--panel2); border: 1px solid var(--line); color: var(--muted); }
.pill.good { color: var(--accent); border-color: #2f5f2f; }
.pill.bad { color: var(--bad); border-color: #6b2c2f; }
.pill.warn { color: var(--warn); border-color: #6b5520; }

.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.login-card { width: 100%; max-width: 360px; }
.login-card button { width: 100%; margin-top: 16px; }
.brand { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: .5px; }
.logo b { color: var(--accent); }

.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 12px; position: sticky; top: 0; height: 100vh; }
.side nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { color: var(--text); padding: 8px 10px; border-radius: 8px; }
.side nav a:hover { background: var(--panel2); }
.side nav a.on { background: var(--panel2); color: var(--accent); }
.me { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; border-top: 1px solid var(--line); padding-top: 10px; }
main { padding: 20px 24px; min-width: 0; }
.top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.top h1 { font-size: 20px; margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat .n { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .l { color: var(--muted); font-size: 12px; }
.bar { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.bar i { display: block; height: 100%; background: var(--accent); }
.bar i.warn { background: var(--warn); }
.bar i.bad { background: var(--bad); }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row.spread { justify-content: space-between; }
.toolbar { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar input { max-width: 320px; }
h2 { font-size: 15px; margin: 20px 0 8px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12px; background: var(--panel); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel); }
tr.click { cursor: pointer; }
td.wrap { white-space: normal; min-width: 240px; }
.empty { padding: 24px; text-align: center; color: var(--muted); }
pre.log { background: #05080c; border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 60vh; overflow: auto; font-size: 12px; white-space: pre-wrap; }

.drawer { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; justify-content: flex-end; z-index: 10; }
.drawer-body { width: min(640px, 100%); height: 100%; overflow: auto; background: var(--panel); border-left: 1px solid var(--line); padding: 20px; }
.close { float: right; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 8px 0; }
.kv span:nth-child(odd) { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; align-items: center; }
.actions input, .actions select, .row input, .row select { width: auto; flex: 1 1 150px; min-width: 0; }
.secret { background: #05080c; border: 1px dashed var(--warn); border-radius: 8px; padding: 10px; font-family: ui-monospace, monospace; word-break: break-all; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; z-index: 20; max-width: 420px; }
.toast.bad { border-color: var(--bad); }

@media (max-width: 800px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  main { padding: 16px; }
}
.alerts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.alert { border: 1px solid var(--line); border-left-width: 4px; border-radius: 8px; padding: 10px 12px; background: var(--panel); }
.alert.critical { border-left-color: var(--bad); }
.alert.warning { border-left-color: var(--warn); }
.alert.info { border-left-color: var(--accent2); }
.alert.ok { border-left-color: var(--accent); }
