/* Sysadmin — UI */
:root {
  --bg: #0a0c11;
  --bg2: #0e1117;
  --panel: #12161e;
  --panel2: #171c26;
  --hover: #1c2230;
  --line: #222937;
  --line2: #2b3445;
  --text: #e7eaf0;
  --text2: #c3c9d5;
  --muted: #8a93a6;
  --faint: #5b6476;
  --accent: #7c6cff;
  --accent2: #a197ff;
  --accent-bg: rgba(124, 108, 255, .14);
  --ok: #2ec27e;
  --ok-bg: rgba(46, 194, 126, .13);
  --warn: #f2a43a;
  --warn-bg: rgba(242, 164, 58, .14);
  --crit: #f2545b;
  --crit-bg: rgba(242, 84, 91, .14);
  --info: #3fa7ff;
  --info-bg: rgba(63, 167, 255, .13);
  --chart1: #7c6cff;
  --chart2: #3fa7ff;
  --chart-grid: #1f2633;
  --term-bg: #07090d;
  --term-text: #cfd6e3;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --radius: 12px;
  --radius-sm: 8px;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f8; --bg2: #eef0f4; --panel: #ffffff; --panel2: #f7f8fb; --hover: #f0f2f7;
    --line: #e3e6ee; --line2: #d4d9e3; --text: #151a24; --text2: #2c3443; --muted: #667086; --faint: #9aa3b5;
    --accent: #5b4bff; --accent2: #4a3be8; --accent-bg: rgba(91, 75, 255, .1);
    --ok: #12945a; --ok-bg: rgba(18, 148, 90, .1); --warn: #c77a0a; --warn-bg: rgba(199, 122, 10, .1);
    --crit: #d93a43; --crit-bg: rgba(217, 58, 67, .1); --info: #1a7fd4; --info-bg: rgba(26, 127, 212, .1);
    --chart1: #5b4bff; --chart2: #1a8fe6; --chart-grid: #eceef3; --term-bg: #0d1117; --term-text: #d6dce7;
    --shadow: 0 10px 30px rgba(20, 26, 40, .12);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
h3 { font-size: 13px; color: var(--text2); }
p { margin: 0 0 12px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
code { background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; }
.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.i.xl { width: 40px; height: 40px; stroke-width: 1.5; }
.logo { width: 28px; height: 28px; color: var(--accent); fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ shell */
.shell { display: flex; min-height: 100vh; }
.side { width: 232px; flex: none; background: var(--bg2); border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 30; }
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: var(--text); font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand b { font-weight: 800; letter-spacing: .04em; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; flex: 1; overflow-y: auto; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav a:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-bg); color: var(--text); }
.nav a.active .i { color: var(--accent2); }
.nav a span { flex: 1; }
.nav-sep { margin: 16px 10px 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; }
.pill { font-style: normal; font-size: 11px; font-weight: 700; padding: 0 7px; border-radius: 999px; line-height: 18px; background: var(--panel2); color: var(--text2); }
.pill.crit { background: var(--crit-bg); color: var(--crit); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.info { background: var(--info-bg); color: var(--info); }
.side-foot { display: flex; align-items: center; gap: 6px; padding: 12px; border-top: 1px solid var(--line); }
.side-foot form { margin: 0; }
.me { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; padding: 6px; border-radius: 8px; color: var(--text); }
.me:hover, .me.active { background: var(--hover); text-decoration: none; }
.me-txt { min-width: 0; }
.me-txt b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { text-transform: capitalize; }
.avatar { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--accent), #3fa7ff); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.avatar.sm { width: 28px; height: 28px; font-size: 12px; border-radius: 8px; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 14px; padding: 18px 28px 10px; }
.top-title { min-width: 0; }
.top-right { margin-left: auto; display: flex; gap: 8px; }
.crumbs { display: flex; gap: 6px; font-size: 12px; color: var(--faint); }
.crumbs a { color: var(--muted); }
.content { padding: 8px 28px 40px; display: flex; flex-direction: column; gap: 18px; max-width: 1500px; width: 100%; }
.top .menu-btn { display: none; }
.scrim { display: none; }

/* ------------------------------------------------------------ primitives */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.card.flush { overflow: hidden; }
.card.narrow { max-width: 760px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head.sub { border-top: 1px solid var(--line); padding: 10px 18px; }
.card > .table-wrap:last-child, .card > table:last-child { border-bottom-left-radius: var(--radius); border-bottom-right-radius: var(--radius); }
.pad { padding: 16px 18px; }
.pad-x { padding-left: 18px; padding-right: 18px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: -6px; }
.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.span-2 { grid-column: span 2; }
.row { display: flex; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.gap { gap: 8px; }
.grow { flex: 1; }
.center { text-align: center; justify-content: center; }
.mt { margin-top: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-crit { color: var(--crit); } .t-info { color: var(--info); }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0; }
.dim { opacity: .55; }

.btn { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); font: 600 13px var(--sans); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: var(--hover); border-color: var(--faint); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn.ghost.danger { background: transparent; color: var(--crit); border-color: color-mix(in srgb, var(--crit) 45%, transparent); }
.btn.ghost.danger:hover { background: var(--crit-bg); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn.block { width: 100%; justify-content: center; height: 40px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.danger-hover:hover { color: var(--crit); background: var(--crit-bg); }
.link-btn { background: none; border: 0; color: var(--muted); cursor: pointer; font: inherit; margin-top: 10px; }
.link-btn:hover { color: var(--text); text-decoration: underline; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 999px; background: var(--panel2); color: var(--text2); border: 1px solid var(--line); white-space: nowrap; line-height: 18px; }
.b-ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.b-warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.b-crit { background: var(--crit-bg); color: var(--crit); border-color: transparent; }
.b-info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.b-accent { background: var(--accent-bg); color: var(--accent2); border-color: transparent; }
.b-muted { color: var(--muted); }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 7px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--line); color: var(--text2); font-family: var(--mono); margin: 1px 0; }
.tag.on { color: var(--ok); }
.tag.off { color: var(--crit); text-decoration: line-through; opacity: .8; }
.tag.sec { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 35%, transparent); }
.chips-static { display: flex; flex-wrap: wrap; gap: 5px; }

.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; display: inline-block; }
.dot.big { width: 12px; height: 12px; margin-top: 7px; }
.st-online .dot, .dot.st-online { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }
.st-stale .dot, .dot.st-stale { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.st-offline .dot, .dot.st-offline { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-bg); }
.st-rebooting .dot, .dot.st-rebooting { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); animation: pulse 1.2s infinite; }
.st-pending .dot, .dot.st-pending { background: var(--faint); }
@keyframes pulse { 50% { opacity: .35; } }
.sev { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; margin-top: 6px; background: var(--faint); }
.sev-critical { background: var(--crit); box-shadow: 0 0 0 3px var(--crit-bg); }
.sev-warning { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.sev-info { background: var(--info); box-shadow: 0 0 0 3px var(--info-bg); }
.sev-ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); }

/* ------------------------------------------------------------ forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.field > span i { font-style: normal; font-weight: 400; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line2); border-radius: 8px; padding: 8px 11px; outline: none; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.field input, .field select, .field textarea { width: 100%; }
input:disabled, select:disabled { opacity: .6; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); padding: 0; vertical-align: -3px; }
fieldset { border: 0; padding: 0; margin: 0; }
.check { display: flex; align-items: center; gap: 9px; margin: 6px 0 14px; color: var(--text2); cursor: pointer; }
.check.inline { display: inline-flex; margin: 0 12px 0 0; }
.check.small { margin: 0; font-size: 12px; }
.form-error { display: flex; gap: 8px; align-items: center; background: var(--crit-bg); color: var(--crit); padding: 10px 12px; border-radius: 9px; margin-bottom: 14px; font-weight: 500; }
.code-input { font-family: var(--mono); font-size: 20px; letter-spacing: .2em; text-align: center; }

.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.card .toolbar.pad-x { padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line2); border-radius: 9px; padding: 0 10px; color: var(--muted); min-width: 240px; }
.search input { border: 0; background: transparent; padding: 7px 0; flex: 1; box-shadow: none; }
.search.sm { min-width: 180px; }
.search.sm input { padding: 5px 0; font-size: 13px; }
.seg { display: inline-flex; background: var(--bg2); border: 1px solid var(--line2); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button, .seg a { border: 0; background: transparent; color: var(--muted); font: 600 12px var(--sans); padding: 5px 11px; border-radius: 7px; cursor: pointer; }
.seg button:hover, .seg a:hover { color: var(--text); text-decoration: none; }
.seg .on { background: var(--panel2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 999px; padding: 4px 11px; font: 600 12px var(--sans); cursor: pointer; }
.chip.on { background: var(--accent-bg); border-color: transparent; color: var(--accent2); }

/* ------------------------------------------------------------ flash / toasts / notes */
.flash { display: flex; align-items: center; gap: 10px; margin: 6px 28px 0; padding: 11px 14px; border-radius: 10px; font-weight: 500; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--crit-bg); color: var(--crit); }
.bare .flash { margin: 0 0 14px; }
.note { display: flex; gap: 10px; align-items: center; margin: 12px 18px; padding: 10px 12px; border-radius: 9px; }
.note.info { background: var(--info-bg); color: var(--info); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; z-index: 100; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 3px solid var(--accent); box-shadow: var(--shadow); border-radius: 10px; padding: 11px 14px; max-width: 380px; animation: slidein .2s ease-out; }
.toast.error { border-left-color: var(--crit); }
.toast.ok { border-left-color: var(--ok); }
.toast a { font-weight: 600; }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------ KPIs + tiles + meters */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { display: flex; align-items: center; gap: 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text); }
a.kpi:hover { border-color: var(--line2); background: var(--panel2); text-decoration: none; }
.kpi b { font-size: 26px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.kpi small { display: inline; margin-left: 4px; font-size: 13px; }
.kpi-icon { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.kpi-icon .i { width: 20px; height: 20px; }
.kpi-icon.ok { background: var(--ok-bg); color: var(--ok); }
.kpi-icon.warn { background: var(--warn-bg); color: var(--warn); }
.kpi-icon.crit { background: var(--crit-bg); color: var(--crit); }
.kpi-icon.info { background: var(--info-bg); color: var(--info); }
.tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.tile-top { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.tile b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .meter { margin-top: 6px; }
.meter { height: 6px; background: var(--panel2); border-radius: 999px; overflow: hidden; flex: 1; min-width: 40px; }
.meter > span { display: block; height: 100%; border-radius: 999px; background: var(--ok); transition: width .5s ease; }
.meter.warn > span { background: var(--warn); }
.meter.crit > span { background: var(--crit); }
.meter.empty > span { background: transparent; }

/* ------------------------------------------------------------ fleet cards */
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.hcard { display: flex; flex-direction: column; gap: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; color: var(--text); transition: border-color .15s, transform .15s, background .15s; position: relative; }
.hcard:hover { text-decoration: none; border-color: var(--line2); background: var(--panel2); transform: translateY(-1px); }
.hcard.st-offline { border-color: color-mix(in srgb, var(--crit) 40%, var(--line)); }
.hc-head { display: flex; align-items: center; gap: 10px; }
.hc-name { font-size: 15px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-status { font-size: 11.5px; color: var(--muted); text-transform: capitalize; }
.st-offline .hc-status { color: var(--crit); }
.hc-sub { color: var(--muted); font-size: 12.5px; margin-top: -6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hc-meters { display: flex; flex-direction: column; gap: 7px; }
.hm { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.hm label { width: 34px; color: var(--muted); font-weight: 600; font-size: 11px; letter-spacing: .04em; }
.hm span { width: 38px; text-align: right; font-variant-numeric: tabular-nums; color: var(--text2); }
.hc-stats { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--muted); }
.hc-stats span { display: inline-flex; align-items: center; gap: 5px; }
.hc-stats i { font-style: normal; color: var(--text2); font-variant-numeric: tabular-nums; }
.hc-stats .i { width: 13px; height: 13px; }
.hc-foot { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; }
.hc-foot:empty { display: none; }

/* ------------------------------------------------------------ feeds + key/values */
.feed { list-style: none; margin: 0; padding: 6px 0; }
.feed li { display: flex; gap: 12px; align-items: flex-start; padding: 9px 18px; }
.feed li + li { border-top: 1px solid var(--line); }
.feed li > div { min-width: 0; flex: 1; }
.feed .badge { margin-top: 1px; }
.kvs { margin: 0; padding: 6px 0; }
.kv { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 7px 18px; }
.kv + .kv { border-top: 1px solid var(--line); }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; }
.table-wrap.tall { max-height: 640px; overflow-y: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--hover); }
.table.compact td { padding: 7px 14px; }
.table.compact th { padding: 8px 14px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table td small { margin-top: 1px; }
.table tr[data-href] { cursor: pointer; }
.table th[data-sort] { cursor: pointer; user-select: none; }
.table th[data-sort]:hover { color: var(--text); }
.table th.asc::after { content: " ↑"; }
.table th.desc::after { content: " ↓"; }
.ellipsis { max-width: 340px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ellipsis.wide { max-width: 480px; }
.w-check { width: 36px; }
.w-actions { width: 48px; text-align: right; }
.w-meter { width: 32%; }
.w-meter .meter { margin-bottom: 3px; }
.cell-host { display: flex; align-items: center; gap: 11px; }
.indent-1 { padding-left: 14px; } .indent-2 { padding-left: 28px; } .indent-3 { padding-left: 42px; } .indent-4 { padding-left: 56px; }
tr.expand td { background: var(--bg2); }
.pkg-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; }

/* ------------------------------------------------------------ host page */
.host-head { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; flex-wrap: wrap; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.hh-main { display: flex; gap: 14px; min-width: 0; }
.hh-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 18px; }
.hh-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.hh-meta b { color: var(--text2); font-weight: 600; }
.hh-desc { color: var(--text2); margin-top: 6px; font-size: 13px; }
.hh-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; margin-bottom: -4px; }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 10px 13px; color: var(--muted); font-weight: 600; font-size: 13px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs a.on .i { color: var(--accent2); }
.active-jobs { display: flex; flex-wrap: wrap; gap: 8px; }
.active-jobs a { display: inline-flex; gap: 8px; align-items: center; background: var(--info-bg); color: var(--info); padding: 6px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.spinner { width: 12px; height: 12px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* charts */
.charts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 18px; padding: 12px 18px 16px; }
.chart { margin: 0; min-width: 0; }
.chart figcaption { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.chart figcaption .legend { font-weight: 500; display: flex; gap: 10px; }
.chart figcaption .legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; }
.plot { position: relative; height: 130px; }
.plot svg { width: 100%; height: 100%; display: block; overflow: visible; }
.plot .tip { position: absolute; top: 0; pointer-events: none; background: var(--panel2); border: 1px solid var(--line2); border-radius: 7px; padding: 5px 8px; font-size: 11.5px; white-space: nowrap; box-shadow: var(--shadow); z-index: 5; }
.plot .empty-chart { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: 12px; }

.sensors { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 18px; }
.sensor { background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 13px; min-width: 120px; }
.sensor b { font-size: 20px; display: block; }
.sensor.warn b { color: var(--warn); } .sensor.crit b { color: var(--crit); } .sensor.ok b { color: var(--ok); }
.sensor span { font-size: 12px; color: var(--text2); }

/* menus */
.menu { position: relative; display: inline-block; }
.menu-list { position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; box-shadow: var(--shadow); padding: 5px; z-index: 40; display: none; }
.menu-list.right { left: auto; right: 0; }
.menu.open .menu-list { display: block; }
.menu-list button, .menu-list a { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); font: 500 13px var(--sans); padding: 7px 10px; border-radius: 7px; cursor: pointer; }
.menu-list button:hover, .menu-list a:hover { background: var(--hover); text-decoration: none; }
.menu-list [data-danger] { color: var(--crit); }

/* modal */
dialog.modal { border: 1px solid var(--line2); border-radius: 14px; background: var(--panel); color: var(--text); padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog.modal.wide { width: min(980px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(5, 7, 12, .6); backdrop-filter: blur(2px); }
dialog.modal header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
dialog.modal header .muted { font-size: 12px; }
.modal-body { padding: 18px; }
dialog.modal footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
dialog.modal form { margin: 0; }

/* terminal */
.term { background: var(--term-bg); color: var(--term-text); border-radius: 0 0 var(--radius) var(--radius); min-height: 220px; max-height: 520px; overflow: auto; padding: 14px 16px; font: 12.5px/1.55 var(--mono); }
.term.tall { max-height: 70vh; min-height: 320px; }
dialog .term { border-radius: 0; max-height: 60vh; }
.term pre, .term-out { margin: 0; white-space: pre-wrap; word-break: break-word; font: inherit; }
.term .term-empty { color: #5b6476; }
.term .t-head { color: #8a93a6; }
.term .t-cmd { color: #a197ff; }
.term .t-end-ok { color: #2ec27e; }
.term .t-end-fail { color: #f2545b; }
.pre { margin: 0; padding: 12px 18px; font: 12px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; color: var(--text2); max-height: 320px; overflow: auto; }
.pre.cmdline { background: var(--bg2); border-bottom: 1px solid var(--line); color: var(--text); }
.console .console-form { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.console textarea { width: 100%; resize: vertical; min-height: 70px; background: var(--term-bg); color: var(--term-text); border-color: var(--line); font-size: 13px; }
.console-prompt { color: var(--accent2); font-size: 12.5px; }
.console-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.console-bar select { padding: 4px 8px; }
.cmd { display: flex; align-items: center; gap: 10px; background: var(--term-bg); border: 1px solid var(--line2); border-radius: 10px; padding: 12px 12px 12px 16px; margin: 12px 0; }
.cmd code { background: none; border: 0; color: var(--term-text); flex: 1; white-space: pre-wrap; word-break: break-all; font-size: 13px; padding: 0; }
.ticks { padding-left: 18px; color: var(--text2); }
.ticks li { margin: 4px 0; }
.danger-zone { border-color: color-mix(in srgb, var(--crit) 35%, var(--line)); }
.danger-zone input { min-width: 240px; }

/* empty states */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .i { color: var(--faint); margin-bottom: 10px; }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 6px; }
.empty p { max-width: 520px; margin: 0 auto; }

/* ------------------------------------------------------------ bare / auth */
body.bare { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, var(--accent-bg), transparent 60%), var(--bg); }
.bare-wrap { width: 100%; max-width: 440px; padding: 32px 16px; }
.bare-wrap:has(.wide) { max-width: 560px; }
.bare-brand { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 18px; margin-bottom: 22px; }
.bare-brand .logo { width: 36px; height: 36px; }
.bare-brand b { font-weight: 800; letter-spacing: .04em; }
.auth-card { padding: 28px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 6px; }
.auth-card > .muted { margin-bottom: 20px; }
.bare-foot { text-align: center; color: var(--faint); font-size: 12px; margin-top: 18px; }
.err-code { font-size: 54px; font-weight: 800; color: var(--accent); letter-spacing: -.03em; }
.steps { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0 0 22px; counter-reset: s; }
.steps li { flex: 1; font-size: 12px; color: var(--faint); font-weight: 600; border-top: 3px solid var(--line2); padding-top: 7px; counter-increment: s; }
.steps li::before { content: counter(s) ". "; }
.steps li.on { color: var(--text); border-color: var(--accent); }
.steps li.done { color: var(--ok); border-color: var(--ok); }
.totp-setup { display: flex; gap: 18px; align-items: center; margin: 14px 0 18px; flex-wrap: wrap; }
.qr { background: #fff; border-radius: 10px; padding: 6px; width: 200px; height: 200px; image-rendering: pixelated; }
.label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.secret { display: block; font-size: 13px; padding: 8px 10px; margin-bottom: 8px; word-break: break-all; letter-spacing: .05em; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.codes code { text-align: center; padding: 8px; font-size: 14px; letter-spacing: .06em; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .cols-2 { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.side-open .side { transform: none; }
  body.side-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 25; }
  .top .menu-btn { display: inline-grid; }
  .top { padding: 14px 16px 8px; }
  .content { padding: 6px 16px 32px; }
  .flash { margin: 6px 16px 0; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .charts { grid-template-columns: minmax(0, 1fr); }
  .kpis { grid-template-columns: minmax(0, 1fr); }
  .kv { grid-template-columns: 120px minmax(0, 1fr); }
  .search { min-width: 0; flex: 1; }
  .hgrid { grid-template-columns: minmax(0, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .hh-actions .btn span { display: none; }
}

/* meter widths (CSP forbids inline styles) */
.w0{width:0%}.w1{width:1%}.w2{width:2%}.w3{width:3%}.w4{width:4%}.w5{width:5%}.w6{width:6%}.w7{width:7%}.w8{width:8%}.w9{width:9%}
.w10{width:10%}.w11{width:11%}.w12{width:12%}.w13{width:13%}.w14{width:14%}.w15{width:15%}.w16{width:16%}.w17{width:17%}.w18{width:18%}.w19{width:19%}
.w20{width:20%}.w21{width:21%}.w22{width:22%}.w23{width:23%}.w24{width:24%}.w25{width:25%}.w26{width:26%}.w27{width:27%}.w28{width:28%}.w29{width:29%}
.w30{width:30%}.w31{width:31%}.w32{width:32%}.w33{width:33%}.w34{width:34%}.w35{width:35%}.w36{width:36%}.w37{width:37%}.w38{width:38%}.w39{width:39%}
.w40{width:40%}.w41{width:41%}.w42{width:42%}.w43{width:43%}.w44{width:44%}.w45{width:45%}.w46{width:46%}.w47{width:47%}.w48{width:48%}.w49{width:49%}
.w50{width:50%}.w51{width:51%}.w52{width:52%}.w53{width:53%}.w54{width:54%}.w55{width:55%}.w56{width:56%}.w57{width:57%}.w58{width:58%}.w59{width:59%}
.w60{width:60%}.w61{width:61%}.w62{width:62%}.w63{width:63%}.w64{width:64%}.w65{width:65%}.w66{width:66%}.w67{width:67%}.w68{width:68%}.w69{width:69%}
.w70{width:70%}.w71{width:71%}.w72{width:72%}.w73{width:73%}.w74{width:74%}.w75{width:75%}.w76{width:76%}.w77{width:77%}.w78{width:78%}.w79{width:79%}
.w80{width:80%}.w81{width:81%}.w82{width:82%}.w83{width:83%}.w84{width:84%}.w85{width:85%}.w86{width:86%}.w87{width:87%}.w88{width:88%}.w89{width:89%}
.w90{width:90%}.w91{width:91%}.w92{width:92%}.w93{width:93%}.w94{width:94%}.w95{width:95%}.w96{width:96%}.w97{width:97%}.w98{width:98%}.w99{width:99%}
.w100{width:100%}
