:root {
  --bg: #0b1120;
  --panel: #111827;
  --panel2: #1a2335;
  --border: #243047;
  --fg: #e5ecf6;
  --mut: #8b9bb4;
  --pri: #3b82f6;
  --pri-hover: #2563eb;
  --ok: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --chip: #1e2c46;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font: 14px/1.5 system-ui, -apple-system, Segoe UI, Roboto, sans-serif; }
.hidden { display: none !important; }
.mut { color: var(--mut); font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, Menlo, monospace; font-size: 12px; }
.break { word-break: break-all; }

.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 28px; width: 390px; max-width: 100%; box-shadow: 0 20px 50px rgba(0,0,0,.45); }
.brand-lg { display: flex; gap: 12px; align-items: center; margin-bottom: 18px; }
.brand-lg h1 { margin: 0; font-size: 19px; }
.brand-lg p { margin: 2px 0 0; }
.logo { width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, #06b6d4, #0284c7); color: #fff; font-weight: 800; display: grid; place-items: center; font-size: 13px; flex-shrink: 0; }

.app-shell { display: grid; grid-template-columns: 235px 1fr; min-height: 100vh; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 16px 12px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 10px; align-items: center; padding: 4px 8px 16px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.brand-title { font-weight: 700; font-size: 14px; }
.brand-sub { color: var(--mut); font-size: 11px; }
#sideNav { display: flex; flex-direction: column; gap: 3px; flex: 1; overflow: auto; }
#sideNav a { display: flex; justify-content: space-between; align-items: center; padding: 9px 11px; border-radius: 8px; color: var(--fg); text-decoration: none; cursor: pointer; font-weight: 500; font-size: 13px; }
#sideNav a:hover { background: var(--panel2); }
#sideNav a.active { background: var(--pri); color: #fff; }
#sideNav .badge { background: rgba(239,68,68,.2); color: #fca5a5; border-radius: 12px; padding: 0 7px; font-size: 11px; }
#sideNav .badge:empty { display: none; }
.sidebar-footer { border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.who { font-size: 12px; color: var(--mut); }

.main { padding: 20px 26px; max-width: 1480px; width: 100%; overflow-x: auto; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.topbar h2 { margin: 0; font-size: 20px; }
.topbar-right { align-items: center; gap: 10px; }
.tz-picker { display: flex; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--border); border-radius: 9px; padding: 4px 9px; }
.tz-picker-lbl { color: var(--mut); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.tz-picker select { width: auto; min-width: 200px; max-width: 290px; padding: 4px 8px; font-size: 12px; border-radius: 6px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(185px, 1fr)); gap: 12px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: 11px; padding: 14px; }
.stat .lbl { color: var(--mut); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.stat .val { font-size: 24px; font-weight: 700; margin-top: 4px; }
.stat.ok .val { color: var(--ok); }
.stat.warn .val { color: var(--warn); }
.stat.danger .val { color: var(--danger); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card h3 { margin: 0; font-size: 15px; }

label { display: block; color: var(--mut); font-size: 12px; margin: 8px 0 4px; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; width: 100%; }
input[type="checkbox"] { width: auto; accent-color: var(--pri); }
textarea { min-height: 90px; resize: vertical; }
button { font: inherit; background: var(--pri); color: #fff; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
button:hover { background: var(--pri-hover); }
button.ghost { background: var(--chip); color: var(--fg); border: 1px solid var(--border); }
button.ghost:hover { background: #263859; }
button.danger { background: var(--danger); }
button.ok { background: #16a34a; }
button.sm { padding: 5px 10px; font-size: 12px; }
button:disabled { opacity: .5; cursor: not-allowed; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.check-row { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; color: var(--fg); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
th { text-align: left; color: var(--mut); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 7px 9px; border-bottom: 1px solid var(--border); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(59, 130, 246, .04); }

.chip { display: inline-block; background: var(--chip); border-radius: 999px; padding: 1px 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.chip.ok { background: rgba(34,197,94,.16); color: #6ee7a0; }
.chip.warn { background: rgba(245,158,11,.16); color: #fcd34d; }
.chip.danger { background: rgba(239,68,68,.16); color: #fca5a5; }
.chip.info { background: rgba(59,130,246,.16); color: #93c5fd; }

.alert { border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 13px; border: 1px solid var(--border); }
.alert.danger { background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.35); color: #fca5a5; }
.alert.warn { background: rgba(245,158,11,.12); border-color: rgba(245,158,11,.35); color: #fde68a; }
.alert.ok { background: rgba(34,197,94,.12); border-color: rgba(34,197,94,.35); color: #86efac; }
.alert.info { background: rgba(59,130,246,.12); border-color: rgba(59,130,246,.35); color: #bfdbfe; }

.spark { width: 100%; height: 110px; display: block; }
.chart-svg { width: 100%; height: 175px; display: block; }
.chart-grid { stroke: #243047; stroke-width: 1; stroke-dasharray: 3 3; }
.chart-axis { fill: #8b9bb4; font-size: 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12px; color: var(--mut); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.sw-blue { background: #3b82f6; }
.sw-cyan { background: #06b6d4; }
.sw-green { background: #22c55e; }
.sw-amber { background: #f59e0b; }
.sw-violet { background: #a855f7; }
.sw-slate { background: #64748b; }
.sw-red { background: #ef4444; }
.seg-tabs { display: inline-flex; background: var(--panel2); border: 1px solid var(--border); border-radius: 8px; padding: 2px; gap: 2px; }
.seg-tabs button { background: transparent; color: var(--mut); border: 0; padding: 3px 9px; font-size: 11.5px; border-radius: 6px; font-weight: 600; }
.seg-tabs button:hover { color: var(--fg); background: rgba(255,255,255,.05); }
.seg-tabs button.active { background: var(--pri); color: #fff; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; padding: 6px 0; }
.donut-svg { width: 142px; height: 142px; flex-shrink: 0; }
.donut-center-num { fill: #e5ecf6; font-size: 16px; font-weight: 700; text-anchor: middle; }
.donut-center-lbl { fill: #8b9bb4; font-size: 9.5px; text-anchor: middle; text-transform: uppercase; letter-spacing: .05em; }
.proto-list { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 7px; }
.proto-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; gap: 8px; }
.hbar-list { display: flex; flex-direction: column; gap: 8px; }
.hbar-item { display: flex; flex-direction: column; gap: 4px; padding: 5px 7px; border-radius: 8px; transition: background .12s; }
.hbar-item.clickable { cursor: pointer; }
.hbar-item.clickable:hover { background: rgba(59,130,246,.1); }
.hbar-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; }
.hbar-lbl { display: flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-rank { color: var(--mut); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; min-width: 20px; }
.hbar-val { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
.hbar-svg { width: 100%; height: 6px; display: block; }
.hbar-bg { fill: #1a2335; }
.hbar-fg-blue { fill: #3b82f6; }
.hbar-fg-cyan { fill: #06b6d4; }
.hbar-fg-green { fill: #22c55e; }
.hbar-fg-amber { fill: #f59e0b; }
.hbar-fg-violet { fill: #a855f7; }
.hbar-fg-red { fill: #ef4444; }
.sev-strip { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.section-hd { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 8px; }
.section-hd h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); }
.hm-wrap { overflow-x: auto; }
.hm-grid { display: grid; grid-template-columns: 78px repeat(24, minmax(22px, 1fr)); gap: 3px; align-items: center; }
.hm-day { font-size: 11px; color: var(--mut); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; white-space: nowrap; }
.hm-hr { font-size: 10px; color: var(--mut); text-align: center; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.hm-cell { height: 22px; border-radius: 4px; border: 1px solid rgba(255,255,255,.04); cursor: default; }
.hm-0 { background: #141d2e; }
.hm-1 { background: #16325b; }
.hm-2 { background: #1d4ed8; }
.hm-3 { background: #0284c7; }
.hm-4 { background: #06b6d4; }
.hm-5 { background: #22c55e; }
.alert-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; margin-bottom: 16px; }
.alert-card { background: var(--panel); border: 1px solid var(--border); border-left-width: 4px; border-radius: 11px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.alert-card.crit { border-left-color: var(--danger); background: rgba(239,68,68,.06); }
.alert-card.warn { border-left-color: var(--warn); background: rgba(245,158,11,.06); }
.alert-card.ok { border-left-color: var(--ok); background: rgba(34,197,94,.06); }
.alert-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.alert-card-title { font-weight: 700; font-size: 13.5px; }
.alert-card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--mut); }
.channel-strip { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.split-bar { width: 100%; height: 12px; display: block; border-radius: 6px; overflow: hidden; margin: 8px 0; }
.sub-search-bar { display: flex; gap: 8px; align-items: center; }
.sub-search-bar input { width: 220px; padding: 5px 9px; font-size: 12.5px; }
.click-row { cursor: pointer; }
.click-row:hover td { background: rgba(59,130,246,.12); }
.pager-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 9px 0; }
.pager-bar.top { border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.pager-bar.bot { border-top: 1px solid var(--border); margin-top: 8px; }
.pager-info { color: var(--mut); font-size: 12px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.pager-btns { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pager-btn { background: var(--chip); color: var(--fg); border: 1px solid var(--border); border-radius: 7px; padding: 4px 9px; font-size: 12px; font-weight: 600; min-width: 32px; text-align: center; cursor: pointer; }
.pager-btn:hover:not(:disabled) { background: #263859; }
.pager-btn.active { background: var(--pri); border-color: var(--pri); color: #fff; }
.pager-btn.ahead { opacity: .82; border-style: dashed; }
.pager-btn:disabled { opacity: .4; cursor: not-allowed; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); display: flex; align-items: flex-start; justify-content: center; padding: 36px 16px; overflow: auto; z-index: 100; }
.modal-card { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; padding: 20px; width: 620px; max-width: 100%; }
.modal-card.wide { width: 920px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 10px; }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.modal-toolbar input { flex: 1; min-width: 220px; }
.modal-scroll { max-height: 68vh; overflow: auto; border: 1px solid var(--border); border-radius: 9px; }
.card-link { cursor: pointer; }
.card-link:hover { color: #93c5fd; }
.col-toggles { display: flex; gap: 10px; flex-wrap: wrap; padding: 8px 0; font-size: 12px; color: var(--mut); }
.col-toggles label { display: inline-flex; align-items: center; gap: 5px; margin: 0; color: var(--fg); cursor: pointer; }
.m-0 { margin: 0; }
.mt-6 { margin-top: 6px; }
.mt-10 { margin-top: 10px; }
.mt-12 { margin-top: 12px; }
.mt-14 { margin-top: 14px; }
.mb-4 { margin-bottom: 4px; }
.mb-10 { margin-bottom: 10px; }
.mb-12 { margin-bottom: 12px; }
.sub-h4 { margin: 0 0 6px; font-size: 12.5px; color: var(--mut); text-transform: uppercase; letter-spacing: .04em; }
.sub-h4.mt-10 { margin-top: 10px; }
.lnk-sub { color: inherit; text-decoration: underline; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}