@font-face { font-family: "Inter"; src: local("Inter"), local("Inter Regular"); }
:root {
  --bg: #0B0F14; --bg2: #0E131A; --panel: #121821; --panel2: #16202C; --line: #1F2733; --line2: #2A3442; --row: #18202A;
  --text: #E6EDF3; --text2: #B6C2D0; --muted: #9AA7B6;
  --accent: #4C9AFF; --accent-ink: #06101C; --link: #8CC0FF;
  --ok: #3FB950; --ok-cell: #2B6E44; --warn: #E3B341; --crit: #F85149; --off: #3A4452;
  --crit-bg: #1A1214; --crit-line: #5A2328; --crit-text: #FFD9D6;
  --sel: #1E3354;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Space Grotesk", var(--sans);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 14px; }
a { color: var(--link); text-decoration: none; }
a:hover { color: #B9D8FF; text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -0.3px; }
h2 { margin: 0; font-size: 15px; font-weight: 600; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr { position: absolute; left: -9999px; }

/* header */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--bg2); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--text); }
.brand b { font-family: var(--display); font-weight: 700; font-size: 19px; letter-spacing: -0.4px; }
.brand b span { color: var(--accent); }
.search { flex: 1 1 260px; max-width: 480px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 0 12px; height: 40px; }
.search input { flex: 1; background: transparent; border: 0; outline: none; min-width: 0; }
.top-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: #1E2A3A; display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; border: 0; cursor: pointer; }

/* layout */
.shell { display: flex; flex-wrap: wrap; align-items: flex-start; }
.side { flex: 1 1 200px; max-width: 232px; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; border-right: 1px solid var(--line); min-height: calc(100vh - 65px); }
.side a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text2); }
.side a:hover { background: var(--panel); text-decoration: none; color: var(--text); }
.side a.on { background: var(--panel2); color: var(--text); font-weight: 600; }
.side a .n { margin-left: auto; font-size: 12px; color: var(--muted); }
.side a .badge { margin-left: auto; }
.side .box { margin-top: 24px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; color: var(--muted); line-height: 1.6; }
.side .box b { color: var(--text); display: block; margin-bottom: 4px; }
main { flex: 999 1 560px; min-width: 0; padding: 24px; display: flex; flex-direction: column; gap: 20px; max-width: 1600px; }
@media (max-width: 760px) { .side { max-width: none; min-height: 0; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); } .side .box { display: none; } main { padding: 16px; } }

.pagehead { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.pagehead p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: 13px; color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card.crit { background: var(--crit-bg); border-color: var(--crit-line); }
.cardhead { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
@media (max-width: 520px) { .grid2, .grid4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.grid3 { grid-template-columns: 1fr; } }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; }
.kpi .l { font-size: 12px; color: var(--muted); }
.kpi .v { font-family: var(--mono); font-size: 26px; font-weight: 600; margin-top: 6px; }
.kpi .s { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.crit { background: var(--crit-bg); border-color: var(--crit-line); }
.kpi.crit .l, .kpi.crit .s { color: #F2A5A0; }
.kpi.crit .v { color: #FF8A83; }
a.kpi:hover { text-decoration: none; border-color: var(--line2); }
a.kpi { color: var(--text); }

/* controls */
.btn { height: 36px; padding: 0 14px; background: var(--panel2); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.btn:hover { border-color: #3A4658; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border: 0; font-weight: 600; }
.btn.primary:hover { background: #6AAEFF; }
.btn.danger { color: #FF8A83; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12px; }
.btn.ghost { background: transparent; color: var(--link); }
.btn:disabled { opacity: .5; cursor: default; }
.pill { height: 32px; padding: 0 12px; background: transparent; color: var(--text2); border: 1px solid var(--line2); border-radius: 999px; cursor: pointer; font-size: 12px; }
.pill.on { background: #1E2A3A; color: var(--text); border-color: #2F4058; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; color: var(--muted); }
.input, select.input { height: 40px; padding: 0 12px; background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: 8px; min-width: 0; }
.input:focus, .btn:focus-visible, .pill:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.check { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* tags */
.sev { display: inline-block; font-size: 11px; font-weight: 700; border-radius: 4px; padding: 3px 8px; white-space: nowrap; }
.sev.critical { color: var(--crit-text); background: var(--crit-line); }
.sev.warning { color: #1A1405; background: var(--warn); }
.sev.info { color: #D6E6FF; background: #1E3354; }
.sev.ok { color: #D8F5DE; background: #1F4A2C; }
.sev.offline { color: #C9D1DA; background: var(--off); }
.status { font-size: 11px; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.c-ok { color: var(--ok); } .c-warn { color: var(--warn); } .c-crit { color: var(--crit); } .c-off { color: var(--muted); } .c-accent { color: var(--accent); }
.badge { font-size: 11px; font-weight: 700; background: var(--crit); color: #fff; border-radius: 9px; padding: 1px 7px; }

/* tables */
.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 10px 8px; border-bottom: 1px solid var(--row); vertical-align: middle; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #141C27; }
table.t td.num, table.t th.num { text-align: right; font-family: var(--mono); font-size: 12px; }
.sub { font-size: 11px; color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; min-width: 50px; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.meter { display: flex; flex-direction: column; gap: 4px; min-width: 70px; }
.meter span { font-family: var(--mono); font-size: 12px; }

.heat { display: grid; grid-template-columns: repeat(25, minmax(0, 1fr)); gap: 3px; }
.heat a, .heat span { aspect-ratio: 1; border-radius: 2px; display: block; }
.heat .ok { background: var(--ok-cell); } .heat .warning { background: var(--warn); } .heat .critical { background: var(--crit); } .heat .offline { background: var(--off); }
.legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12px; color: var(--text2); }
.legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

.gw { display: grid; grid-template-columns: minmax(120px, 1.2fr) minmax(0, 2fr) 92px 96px; gap: 12px; align-items: center; }
.vlist { display: flex; flex-direction: column; gap: 10px; }
.vrow { display: grid; grid-template-columns: minmax(90px, 160px) minmax(0, 1fr) 120px; gap: 12px; align-items: center; }

.chart { width: 100%; display: block; }
.chart text { fill: var(--muted); font-size: 10px; font-family: var(--sans); }
.timeline { display: flex; gap: 2px; height: 26px; border-radius: 6px; overflow: hidden; }
.timeline i { flex: 1; }

.banner { display: flex; align-items: center; gap: 10px; background: var(--crit-bg); border: 1px solid var(--crit-line); border-radius: 10px; padding: 10px 14px; }
.notice { background: #13233A; border: 1px solid #2F4058; border-radius: 10px; padding: 12px 14px; }
.notice code, .copy { font-family: var(--mono); background: var(--bg); padding: 2px 6px; border-radius: 4px; word-break: break-all; }
pre.cmd { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-family: var(--mono); font-size: 12px; margin: 0; white-space: pre-wrap; word-break: break-all; }

.tabs { display: flex; gap: 2px; flex-direction: column; }
.tabs a { padding: 10px 12px; border-radius: 8px; color: var(--text2); }
.tabs a.on { background: var(--panel2); color: var(--text); font-weight: 600; }
.split { display: flex; flex-wrap: wrap; gap: 24px; align-items: flex-start; }
.split > nav { flex: 1 1 180px; max-width: 220px; }
.split > section { flex: 999 1 520px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.opts { display: flex; flex-wrap: wrap; gap: 8px; }
.opt { min-width: 92px; height: 44px; padding: 0 16px; border-radius: 10px; font-weight: 600; cursor: pointer; background: var(--bg2); color: var(--text2); border: 1px solid var(--line2); }
.opt.on { background: var(--sel); color: var(--text); border-color: var(--accent); }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.stat .l { font-size: 12px; color: var(--muted); } .stat .v { font-family: var(--mono); font-size: 18px; margin-top: 6px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.roles ul { margin: 10px 0 0; padding-left: 18px; color: var(--text2); line-height: 1.8; }

.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login form { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 28px; display: flex; flex-direction: column; gap: 16px; }
.err { color: #FF8A83; font-size: 13px; min-height: 18px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.toast { position: fixed; bottom: 20px; right: 20px; background: var(--panel2); border: 1px solid var(--line2); border-radius: 10px; padding: 12px 16px; z-index: 50; max-width: 420px; box-shadow: 0 8px 24px rgba(0,0,0,.4); }
.toast.bad { border-color: var(--crit-line); }
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 14px; padding: 22px; max-width: 520px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 13px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; font-family: var(--mono); font-size: 12px; word-break: break-word; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
