:root {
  --bg: #f5f6f8; --panel: #ffffff; --text: #1d2330; --muted: #6b7385; --line: #e3e6ec;
  --accent: #2456d6; --accent-weak: #e8eefc; --nav: #141a2a; --nav-text: #c4cad8; --nav-active: #ffffff;
  --ok: #16794a; --ok-bg: #e3f4ea; --warn: #9a6200; --warn-bg: #fff3d6; --bad: #b3261e; --bad-bg: #fde7e5;
  --info: #1f5fb8; --info-bg: #e4eefb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10141d; --panel: #171c28; --text: #e3e7ef; --muted: #98a1b3; --line: #262d3d;
    --accent: #6d97ff; --accent-weak: #1e2a47; --nav: #0b0e15;
    --ok: #5fd19a; --ok-bg: #14301f; --warn: #f0b64a; --warn-bg: #352812; --bad: #ff8a80; --bad-bg: #3a1a18;
    --info: #8db6ff; --info-bg: #182a47;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.shell { display: flex; min-height: 100vh; }
.side { width: 220px; background: var(--nav); color: var(--nav-text); padding: 18px 0; flex-shrink: 0; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { color: #fff; font-weight: 700; font-size: 17px; padding: 0 20px 18px; letter-spacing: .2px; }
.brand small { display: block; color: var(--nav-text); font-weight: 400; font-size: 11px; opacity: .7; }
.side a { display: flex; justify-content: space-between; align-items: center; color: var(--nav-text); padding: 8px 20px; border-left: 3px solid transparent; }
.side a:hover { background: rgba(255,255,255,.05); text-decoration: none; }
.side a.active { color: var(--nav-active); border-left-color: var(--accent); background: rgba(255,255,255,.07); }
.side .sep { margin: 12px 20px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .8px; opacity: .5; }
.side .count { background: var(--bad); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 7px; }
.main { flex: 1; min-width: 0; padding: 24px 32px 60px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; gap: 12px; flex-wrap: wrap; }
.topbar h1 { margin: 0; font-size: 22px; }
.userbox { color: var(--muted); font-size: 13px; display: flex; gap: 10px; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 18px; }
.panel h2 { margin: 0 0 12px; font-size: 16px; }
.panel h3 { margin: 16px 0 8px; font-size: 14px; }
.grid { display: grid; gap: 18px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.stat .v { font-size: 26px; font-weight: 650; }
.stat .l { color: var(--muted); font-size: 12px; }
.stat.ok .v { color: var(--ok); } .stat.bad .v { color: var(--bad); } .stat.warn .v { color: var(--warn); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .4px; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tablewrap { overflow-x: auto; }
.badge { display: inline-block; padding: 1px 9px; border-radius: 10px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.info { background: var(--info-bg); color: var(--info); }
.badge.muted { background: var(--line); color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--info); } .dot.muted { background: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12.5px; }
pre.log { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; max-height: 480px; overflow: auto; white-space: pre-wrap; word-break: break-word; }
.bar { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; min-width: 80px; }
.bar > span { display: block; height: 100%; background: var(--ok); }
.bar.warn > span { background: var(--warn); } .bar.bad > span { background: var(--bad); }
form.inline { display: inline; }
label { display: block; font-weight: 600; font-size: 13px; margin: 12px 0 4px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); font: inherit;
}
textarea { min-height: 90px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
.help { color: var(--muted); font-size: 12px; margin-top: 3px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 16px; }
.btn, button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.btn:hover, button:hover { border-color: var(--accent); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger, button.danger { color: var(--bad); border-color: var(--bad); }
.btn.small, button.small { padding: 3px 10px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; align-items: center; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; background: var(--ok-bg); color: var(--ok); border: 1px solid transparent; }
.flash.err { background: var(--bad-bg); color: var(--bad); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 5px 12px; border-radius: 16px; border: 1px solid var(--line); color: var(--text); }
.tabs a.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.code { font-family: ui-monospace, Consolas, monospace; font-size: 15px; letter-spacing: 1px; background: var(--accent-weak); padding: 2px 8px; border-radius: 5px; }
details summary { cursor: pointer; font-weight: 600; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }
.login h1 { font-size: 20px; margin: 0 0 4px; }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 4px; }
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; display: flex; flex-wrap: wrap; padding: 10px; }
  .side .sep, .brand small { display: none; }
  .brand { padding: 6px 10px; width: 100%; }
  .side a { padding: 6px 10px; border-left: none; }
  .main { padding: 16px; }
  .g2 { grid-template-columns: 1fr; }
}
