/* GridTwin UI — design tokens, shell, components. No framework, no build step. */
:root {
  --font: "Inter", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, "SFMono-Regular", Menlo, monospace;
  --bg: #f3f4f9; --surface: #ffffff; --surface-2: #f8f9fd; --surface-3: #eef0f7; --hover: #f4f3ff;
  --ink: #131834; --ink-2: #3a4166; --muted: #6c7392; --faint: #9aa0b8;
  --line: #e3e6f0; --line-2: #d6dae8; --grid: #edeff5; --axis: #c8cddc;
  --primary: #5b45e0; --primary-2: #7a66f2; --primary-soft: #ece9ff; --primary-ink: #ffffff;
  --teal: #0e9f8d; --teal-soft: #dcf6f1;
  --good: #12a06e; --good-soft: #def6ec; --warn: #c98510; --warn-soft: #fdf1d9; --major: #e0662a; --major-soft: #fde8dc;
  --crit: #d6334a; --crit-soft: #fde2e6; --info: #2f74d8; --info-soft: #e1ecfc; --stale: #6a7fa3; --stale-soft: #e6ebf3;
  --unknown: #9096ad; --unknown-soft: #eceef4;
  --s1: #5b45e0; --s2: #0e9f8d; --s3: #e0892b; --s4: #d6457a; --s5: #2f74d8; --s6: #8a6d1f;
  --ph-r: #d64545; --ph-y: #d09a12; --ph-b: #2f6fd8;
  --seq-1: #f3d6dc; --seq-2: #f6c58d; --seq-3: #b9d98a; --seq-4: #5fbf8a; --seq-5: #1f9a6e; --seq-6: #0b6b4c;
  --nav-1: #0d1330; --nav-2: #141b45; --nav-ink: #c9cdec; --nav-muted: #7f86b5; --nav-active: rgba(122, 102, 242, .22);
  --radius: 14px; --radius-s: 9px; --shadow: 0 1px 2px rgba(19, 24, 52, .05), 0 6px 18px -8px rgba(19, 24, 52, .10);
  --shadow-l: 0 24px 60px -18px rgba(19, 24, 52, .35);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0b0f22; --surface: #121834; --surface-2: #161d3d; --surface-3: #1d2549; --hover: #1e2350;
  --ink: #eceefe; --ink-2: #c3c7e6; --muted: #8f95bd; --faint: #646b97;
  --line: #262e57; --line-2: #313a68; --grid: #1f2750; --axis: #3a4473;
  --primary: #8a78ff; --primary-2: #a596ff; --primary-soft: #252261; --primary-ink: #0b0f22;
  --teal: #35d2bb; --teal-soft: #0f3a3a;
  --good: #3dd39a; --good-soft: #10392e; --warn: #f0b13d; --warn-soft: #3a2e12; --major: #ff8a4c; --major-soft: #40241a;
  --crit: #ff5f73; --crit-soft: #44182a; --info: #63a1ff; --info-soft: #182c52; --stale: #93a6c9; --stale-soft: #222c47;
  --unknown: #7c83a8; --unknown-soft: #20264a;
  --s1: #8a78ff; --s2: #35d2bb; --s3: #f0a14a; --s4: #ff6f9e; --s5: #63a1ff; --s6: #d6b45a;
  --ph-r: #ff6b6b; --ph-y: #f2c14e; --ph-b: #5fa0ff;
  --seq-1: #4a2433; --seq-2: #6b4a1f; --seq-3: #4e6a2a; --seq-4: #2f7d58; --seq-5: #22a074; --seq-6: #49d6a0;
  --nav-1: #070a1a; --nav-2: #0d1230; --nav-active: rgba(138, 120, 255, .22);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -10px rgba(0, 0, 0, .5);
  color-scheme: dark;
}
* { box-sizing: border-box; }
svg[aria-hidden] { width: 1.15em; height: 1.15em; flex: none; vertical-align: -0.18em; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
.num, td.num, .mono { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.muted { color: var(--muted); } .faint { color: var(--faint); } .ink2 { color: var(--ink-2); }
.small { font-size: 12px; } .tiny { font-size: 11px; } .strong { font-weight: 650; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.row { display: flex; align-items: center; gap: 10px; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; }
.col { display: flex; flex-direction: column; gap: 10px; }
.spacer { flex: 1; }
.hidden { display: none !important; }
::selection { background: var(--primary-soft); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ------------------------------------------------------------------ shell */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.app.collapsed { grid-template-columns: 72px 1fr; }
.side { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; color: var(--nav-ink);
  background: radial-gradient(120% 60% at 0% 0%, #2a2470 0%, transparent 55%), linear-gradient(180deg, var(--nav-2), var(--nav-1));
  border-right: 1px solid rgba(255, 255, 255, .04); z-index: 30; }
.client-slot { margin: 14px 14px 6px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .96); overflow: hidden; }
.client-slot img { max-height: 42px; max-width: 86%; object-fit: contain; }
.client-slot.empty { background: transparent; border: 1.5px dashed rgba(201, 205, 236, .35); color: var(--nav-muted); font-size: 11.5px;
  letter-spacing: .06em; text-transform: uppercase; }
.client-slot .cn { color: #1d2350; font-weight: 700; font-size: 13px; text-align: center; padding: 0 8px; line-height: 1.2; }
.brand { display: flex; align-items: center; gap: 11px; padding: 12px 18px 14px; }
.brand img { width: 34px; height: 34px; flex: none; }
.brand .wm { font-size: 19px; font-weight: 750; letter-spacing: -.02em; color: #fff; line-height: 1.1; }
.brand .wm b { color: #9f92ff; font-weight: 750; }
.brand .ed { font-size: 10.5px; color: var(--nav-muted); letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px 10px; }
.nav .grp { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--nav-muted); padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--nav-ink);
  font-weight: 520; margin: 1px 0; position: relative; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav a.on { background: var(--nav-active); color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: #a596ff; }
.nav svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav .badge { margin-left: auto; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px;
  padding: 0 7px; line-height: 19px; min-width: 20px; text-align: center; }
.side-foot { padding: 12px 14px 14px; border-top: 1px solid rgba(255, 255, 255, .06); }
.me { display: flex; align-items: center; gap: 10px; padding: 6px; border-radius: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, #7a66f2, #0e9f8d); color: #fff; flex: none; }
.me .n { color: #fff; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .r { font-size: 11.5px; color: var(--nav-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 0; cursor: pointer;
  background: transparent; color: inherit; }
.icon-btn:hover { background: rgba(127, 134, 181, .16); }
.icon-btn svg { width: 18px; height: 18px; }
.mirach { display: flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 10.5px; color: var(--nav-muted); letter-spacing: .03em; opacity: .85; }
.mirach img { height: 15px; width: auto; filter: grayscale(.2); }
.app.collapsed .brand .txt, .app.collapsed .nav .grp, .app.collapsed .nav a span, .app.collapsed .nav .badge, .app.collapsed .me .t,
.app.collapsed .mirach span, .app.collapsed .client-slot { display: none; }
.app.collapsed .nav a { justify-content: center; }
.app.collapsed .brand { justify-content: center; padding: 18px 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 12px 26px; min-height: 64px;
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top h1 { font-size: 19px; }
.crumb { font-size: 12px; color: var(--muted); }
.crumb a { color: var(--muted); }
.search { position: relative; width: min(340px, 30vw); }
.search input { width: 100%; padding: 9px 12px 9px 36px; border-radius: 11px; border: 1px solid var(--line); background: var(--surface); }
.search svg { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: var(--faint); }
.search .res { position: absolute; top: 44px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-l); max-height: 380px; overflow: auto; padding: 6px; }
.search .res a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 8px; color: var(--ink); }
.search .res a:hover, .search .res a.sel { background: var(--hover); text-decoration: none; }
.live { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); padding: 6px 10px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 60%, transparent);
  animation: pulse 2.2s infinite; }
.pulse-dot.off { background: var(--unknown); animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.bell { position: relative; }
.bell .n { position: absolute; top: 1px; right: 0; background: var(--crit); color: #fff; font-size: 10px; font-weight: 700; border-radius: 9px;
  padding: 0 5px; line-height: 16px; }
.demo-badge { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; color: #8a5300; background: #ffe7b0; border-radius: 6px; padding: 3px 8px; }
.view { padding: 22px 26px 40px; max-width: 1640px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ------------------------------------------------------------------ cards & grids */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card > .hd { display: flex; align-items: center; gap: 10px; padding: 14px 18px 0; }
.card > .hd h3 { font-size: 14.5px; }
.card > .hd .hint { color: var(--muted); font-size: 12px; }
.card > .bd { padding: 14px 18px 18px; }
.card.pad { padding: 18px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); }
.g-side { grid-template-columns: minmax(0, 1fr) 380px; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; }
@media (max-width: 1280px) { .g6 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(2, 1fr); } .g-main, .g-side { grid-template-columns: 1fr; } }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } .side { display: none; } .g2, .g3 { grid-template-columns: 1fr; } .view { padding: 16px; } .top { padding: 10px 16px; } .search { display: none; } }

/* KPI tiles */
.kpi { position: relative; padding: 16px 18px; overflow: hidden; cursor: default; }
.kpi.link { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.kpi.link:hover { transform: translateY(-2px); box-shadow: 0 14px 30px -14px rgba(19, 24, 52, .35); }
.kpi .lb { font-size: 12px; color: var(--muted); font-weight: 560; display: flex; align-items: center; gap: 7px; }
.kpi .lb i { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.kpi .lb i svg { width: 15px; height: 15px; }
.kpi .v { font-size: 30px; font-weight: 720; letter-spacing: -.03em; margin-top: 8px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi .ft { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.kpi .bar { display: flex; height: 6px; border-radius: 4px; overflow: hidden; background: var(--surface-3); margin-top: 10px; }
.kpi .bar span { display: block; height: 100%; }
.kpi.hero { color: #fff; border: 0; background: radial-gradient(120% 120% at 100% 0%, #3d2fb5 0%, transparent 60%), linear-gradient(135deg, #5b45e0, #2a1f8f); }
.kpi.hero .lb, .kpi.hero .ft, .kpi.hero .v small { color: rgba(255, 255, 255, .78); }
.kpi.hero .bar { background: rgba(255, 255, 255, .18); }
.ic-good { background: var(--good-soft); color: var(--good); } .ic-crit { background: var(--crit-soft); color: var(--crit); }
.ic-major { background: var(--major-soft); color: var(--major); } .ic-warn { background: var(--warn-soft); color: var(--warn); }
.ic-info { background: var(--info-soft); color: var(--info); } .ic-prim { background: var(--primary-soft); color: var(--primary); }
.ic-teal { background: var(--teal-soft); color: var(--teal); } .ic-stale { background: var(--stale-soft); color: var(--stale); }
.kpi.hero .lb i { background: rgba(255, 255, 255, .16); color: #fff; }

/* badges & pills */
.badge-s { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 620; padding: 3px 9px 3px 8px; border-radius: 20px;
  white-space: nowrap; line-height: 1.35; }
.badge-s::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge-s.plain::before { display: none; }
.b-good { background: var(--good-soft); color: var(--good); } .b-crit { background: var(--crit-soft); color: var(--crit); }
.b-major { background: var(--major-soft); color: var(--major); } .b-warn { background: var(--warn-soft); color: var(--warn); }
.b-stale { background: var(--stale-soft); color: var(--stale); } .b-unknown { background: var(--unknown-soft); color: var(--unknown); }
.b-info { background: var(--info-soft); color: var(--info); } .b-prim { background: var(--primary-soft); color: var(--primary); }
.b-teal { background: var(--teal-soft); color: var(--teal); }
.sev { display: inline-flex; align-items: center; font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 6px; }
.sev.critical { background: var(--crit); color: #fff; } .sev.major { background: var(--major); color: #fff; } .sev.warning { background: var(--warn-soft); color: var(--warn); }
.dims { display: inline-flex; gap: 3px; }
.dims b { width: 22px; height: 20px; border-radius: 5px; font-size: 10.5px; font-weight: 750; display: grid; place-items: center; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 560; color: var(--ink-2); user-select: none; }
.chip:hover { border-color: var(--primary-2); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.chip .c { font-weight: 700; font-variant-numeric: tabular-nums; opacity: .8; }
.chip i { width: 8px; height: 8px; border-radius: 50%; }
.tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); color: var(--ink-2); font-weight: 560; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .05s; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 6px 16px -8px var(--primary); }
.btn.primary:hover { background: var(--primary-2); }
.btn.danger { color: var(--crit); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.seg { display: inline-flex; background: var(--surface-3); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 13px; border-radius: 8px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.input, select.input, textarea.input { width: 100%; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface);
  transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
select.input { padding-right: 28px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
label.f { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 5px; }
.field { margin-bottom: 13px; }
.field .help { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a, .tabs button { padding: 10px 14px; border: 0; background: transparent; cursor: pointer; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--ink); text-decoration: none; }
.tabs .on { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .cnt { font-size: 11px; background: var(--surface-3); color: var(--ink-2); border-radius: 10px; padding: 0 7px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .input { width: auto; }

/* tables */
.tbl-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
table.t th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; letter-spacing: .03em; text-transform: uppercase;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
table.t th.sort { cursor: pointer; }
table.t th.sort:hover { color: var(--ink); }
table.t th .ar { opacity: .5; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover td { background: var(--hover); }
table.t td.num, table.t th.num { text-align: right; }
table.t .sub { font-size: 11.5px; color: var(--muted); }
.card .tbl-wrap table.t th:first-child { border-top-left-radius: 0; }
.pager { display: flex; align-items: center; gap: 8px; justify-content: flex-end; padding: 10px 14px; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--grid); }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.empty svg { width: 42px; height: 42px; opacity: .45; display: block; margin: 0 auto 8px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; }
@keyframes sk { to { background-position: -200% 0; } }

/* charts */
.chart { position: relative; }
.chart svg { width: 100%; display: block; overflow: visible; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.chart-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; margin-right: 6px; vertical-align: middle; }
.tt { position: absolute; display: none; pointer-events: none; z-index: 5; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-l); padding: 8px 10px; font-size: 12px; min-width: 150px; }
.tt .h { font-weight: 650; margin-bottom: 4px; color: var(--ink); }
.tt .r { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tt .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.heat { display: grid; gap: 3px; font-size: 11px; }
.heat .hh { text-align: center; color: var(--muted); }
.heat .hc { text-align: center; border-radius: 4px; padding: 5px 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat .hl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 6px; align-self: center; }

/* health dimension stack */
.dimrow { display: grid; grid-template-columns: 92px 1fr 160px; gap: 12px; align-items: center; padding: 8px 0; }
.dimrow + .dimrow { border-top: 1px dashed var(--grid); }
.dimrow .nm { font-weight: 620; font-size: 13px; }
.dimrow .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 11px; }
.stack { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.stack span { display: block; height: 100%; min-width: 3px; }
.dimrow .lg { font-size: 11.5px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.dimrow .lg b { color: var(--ink); }

/* feeder wall */
.wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.wall .gw { border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; background: var(--surface-2); }
.wall .gw .h { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.wall .gw .h b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wall .cells { display: flex; flex-wrap: wrap; gap: 4px; }
.wall .cells a { width: 17px; height: 17px; border-radius: 5px; display: block; transition: transform .1s; }
.wall .cells a:hover { transform: scale(1.35); box-shadow: 0 2px 6px rgba(0, 0, 0, .25); }
.st-HEALTHY { background: var(--good); } .st-SUPPLY_OFF { background: var(--crit); } .st-RF_LOSS { background: var(--major); }
.st-METER_FAULT { background: var(--warn); } .st-STALE { background: var(--stale); } .st-UNKNOWN { background: var(--unknown); opacity: .5; }

/* alarms */
.alist .it { display: grid; grid-template-columns: 26px 4px 1fr auto; gap: 12px; align-items: center; padding: 11px 14px; border-bottom: 1px solid var(--grid); cursor: pointer; }
.alist .it:hover { background: var(--hover); }
.alist .it.sel { background: var(--primary-soft); }
.alist .it .stripe { width: 4px; height: 38px; border-radius: 3px; }
.alist .it .t { font-weight: 620; }
.alist .it .m { font-size: 12px; color: var(--muted); }
.stripe.critical { background: var(--crit); } .stripe.major { background: var(--major); } .stripe.warning { background: var(--warn); }
.timeline { position: relative; margin: 6px 0 0 8px; padding-left: 20px; border-left: 2px solid var(--line); }
.timeline .ev { position: relative; padding: 0 0 14px; }
.timeline .ev::before { content: ""; position: absolute; left: -27px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface);
  border: 2.5px solid var(--faint); }
.timeline .ev.start::before { border-color: var(--crit); } .timeline .ev.restored::before, .timeline .ev.close::before { border-color: var(--good); background: var(--good); }
.timeline .ev.ack::before { border-color: var(--primary); background: var(--primary); } .timeline .ev.notify::before { border-color: var(--info); }
.timeline .ev.note::before, .timeline .ev.suppression::before { border-color: var(--warn); }
.timeline .ev .w { font-size: 11.5px; color: var(--muted); }
.prio .it { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--grid); cursor: pointer; }
.prio .it:last-child { border-bottom: 0; }
.prio .it:hover .t { color: var(--primary); }

/* key-value */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 520; min-width: 0; overflow-wrap: anywhere; }
.statgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--surface-2); border: 1px solid var(--grid); border-radius: 11px; padding: 10px 12px; }
.stat .l { font-size: 11.5px; color: var(--muted); }
.stat .v { font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat .v small { font-size: 12px; color: var(--muted); font-weight: 500; }
.dimcard { border-radius: 12px; padding: 12px 14px; border: 1px solid var(--line); background: var(--surface-2); }
.dimcard .l { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; }
.dimcard .v { font-size: 16px; font-weight: 700; margin: 4px 0 2px; }
.dimcard .s { font-size: 11.5px; color: var(--muted); }
.phase { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.phase .p { border-radius: 10px; padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--grid); }
.phase .p .l { font-size: 11px; font-weight: 700; }
.phase .p .v { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.sig { display: inline-flex; gap: 2px; align-items: flex-end; height: 14px; vertical-align: middle; }
.sig i { width: 4px; border-radius: 1px; background: var(--line-2); display: block; }
.sig i.on { background: currentColor; }
.callout { border-radius: 12px; padding: 12px 14px; background: var(--info-soft); color: var(--ink-2); font-size: 13px; display: flex; gap: 10px; }
.callout.warn { background: var(--warn-soft); } .callout.crit { background: var(--crit-soft); } .callout.good { background: var(--good-soft); }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
details.rules { border: 1px solid var(--line); border-radius: 12px; padding: 0 14px; background: var(--surface-2); }
details.rules summary { cursor: pointer; padding: 11px 0; font-weight: 620; font-size: 13px; }
details.rules ul { margin: 0 0 12px; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; }
details.rules li { margin: 3px 0; }

/* map */
.map { height: 420px; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-3); }
.map.tall { height: 560px; }
/* own stacking context: Leaflet layers (z 200-1000) stay inside the map and never cover drawers, dialogs, toasts or the top bar */
.leaflet-container { font: inherit; background: var(--surface-3); position: relative; z-index: 0; isolation: isolate; }
.gw-pin { display: grid; place-items: center; }
.gw-pin .o { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  border: 3px solid #fff; color: #fff; font-size: 11px; font-weight: 800; }
.leaflet-popup-content-wrapper { border-radius: 12px; background: var(--surface); color: var(--ink); }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 12px 14px; font-size: 12.5px; }

/* drawer / modal / toast */
.scrim { position: fixed; inset: 0; background: rgba(9, 12, 30, .45); z-index: 2000; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 96vw); background: var(--surface); z-index: 2001; box-shadow: var(--shadow-l);
  display: flex; flex-direction: column; animation: slide .22s ease-out; }
.drawer.wide { width: min(760px, 96vw); }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
.drawer .dh { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.drawer .db { padding: 18px 22px; overflow-y: auto; flex: 1; }
.drawer .df { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; gap: 10px; justify-content: flex-end; background: var(--surface-2); }
.modal { position: fixed; left: 50%; top: 12vh; transform: translateX(-50%); width: min(520px, 94vw); background: var(--surface); z-index: 2002;
  border-radius: 16px; box-shadow: var(--shadow-l); animation: pop .18s ease-out; max-height: 78vh; display: flex; flex-direction: column; }
.modal.wide { width: min(820px, 96vw); }
@keyframes pop { from { transform: translateX(-50%) scale(.97); opacity: 0; } }
.modal .dh { padding: 18px 22px 0; } .modal .db { padding: 14px 22px; overflow-y: auto; } .modal .df { padding: 0 22px 18px; display: flex; gap: 10px; justify-content: flex-end; }
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 2100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: var(--surface); padding: 11px 16px; border-radius: 12px; box-shadow: var(--shadow-l); font-size: 13px; max-width: 380px;
  animation: pop2 .2s ease-out; display: flex; gap: 10px; align-items: flex-start; }
.toast.err { background: var(--crit); color: #fff; }
@keyframes pop2 { from { transform: translateY(10px); opacity: 0; } }

/* reports */
.rlib { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .rlib { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rcard { padding: 16px; cursor: pointer; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: border-color .15s, transform .15s; }
.rcard:hover { border-color: var(--primary-2); transform: translateY(-2px); }
.rcard.on { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.rcard .ic { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; margin-bottom: 10px; }
.rcard .ic svg { width: 20px; height: 20px; }
.rcard .cat { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 650; }
.rcard h3 { margin: 2px 0 4px; }
.rcard p { margin: 0; font-size: 12.5px; color: var(--muted); }
.meta-strip { display: flex; flex-wrap: wrap; gap: 8px 22px; padding: 12px 16px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--grid); font-size: 12.5px; }
.meta-strip div span { color: var(--muted); margin-right: 6px; }
.progress { height: 6px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--teal)); }

/* admin */
.perm { font-size: 12.5px; }
.perm li { margin: 3px 0; }
.tree { font-size: 13px; }
.tree .n { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; }
.tree .n:hover { background: var(--hover); }
.tree .c { margin-left: 22px; border-left: 1px dashed var(--line-2); padding-left: 8px; }
.pending-card { border: 1px solid var(--warn); background: var(--warn-soft); border-radius: 12px; padding: 12px 14px; display: flex; gap: 12px; align-items: center; }
.code { font-family: var(--mono); font-size: 12px; background: var(--surface-3); border-radius: 10px; padding: 12px; white-space: pre-wrap; word-break: break-all; max-height: 360px; overflow: auto; }
.guide-item { padding: 16px 18px; }
.guide-item h3 { display: flex; gap: 10px; align-items: center; }
.guide-item ul { margin: 8px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 13px; }

/* twin */
.dt-card { padding: 16px 18px; cursor: pointer; transition: transform .15s; }
.dt-card:hover { transform: translateY(-2px); }
.gauge { position: relative; width: 120px; height: 66px; }
.gauge svg { width: 120px; height: 66px; }
.gauge .gv { position: absolute; left: 0; right: 0; bottom: 0; text-align: center; font-weight: 750; font-size: 20px; font-variant-numeric: tabular-nums; }
.slider { width: 100%; accent-color: var(--primary); }

/* login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login .hero { position: relative; overflow: hidden; color: #fff; padding: 46px 56px; display: flex; flex-direction: column;
  background: radial-gradient(90% 70% at 85% 10%, rgba(63, 224, 197, .18), transparent 60%), radial-gradient(80% 60% at 0% 100%, rgba(139, 124, 255, .35), transparent 60%),
  linear-gradient(160deg, #161d4d 0%, #0b1030 100%); }
.login .hero .brand { padding: 0; }
.login .hero .brand img { width: 44px; height: 44px; }
.login .hero .brand .wm { font-size: 26px; }
.login .hero h2 { font-size: 38px; line-height: 1.12; letter-spacing: -.03em; margin: auto 0 14px; max-width: 540px; font-weight: 720; }
.login .hero h2 em { font-style: normal; background: linear-gradient(90deg, #a596ff, #3fe0c5); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login .hero p.lead { color: #c3c7e6; font-size: 15.5px; max-width: 500px; margin: 0 0 26px; }
.login .hero .feats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 22px; max-width: 560px; margin-bottom: 30px; }
.login .hero .feats div { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: #d7daf3; }
.login .hero .feats i { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .09); flex: none; }
.login .hero .feats svg { width: 16px; height: 16px; color: #3fe0c5; }
.login .hero .net { position: absolute; right: -40px; top: 90px; width: 560px; height: 420px; opacity: .95; pointer-events: none; }
.login .hero .foot { font-size: 12px; color: #8f95bd; display: flex; gap: 10px; align-items: center; }
.login .hero .foot img { height: 18px; }
.login .pane { display: flex; flex-direction: column; padding: 34px 56px; background: var(--bg); }
.login .pane .topline { display: flex; justify-content: space-between; align-items: center; }
.login .box { margin: auto; width: 100%; max-width: 410px; }
.login .client-slot { margin: 0 0 26px; height: 64px; background: var(--surface); border: 1px solid var(--line); }
.login .client-slot.empty { border: 1.5px dashed var(--line-2); color: var(--faint); background: transparent; }
.login .client-slot .cn { color: var(--ink); font-size: 15px; }
.login h1 { font-size: 26px; letter-spacing: -.02em; }
.login .sub { color: var(--muted); margin: 6px 0 24px; }
.login .input { padding: 11px 13px; border-radius: 11px; }
.login .btn.primary { width: 100%; padding: 12px; border-radius: 11px; font-size: 15px; }
.pw { position: relative; }
.pw button { position: absolute; right: 6px; top: 6px; }
.login .err { background: var(--crit-soft); color: var(--crit); border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.login .ok { background: var(--good-soft); color: var(--good); border-radius: 10px; padding: 9px 12px; font-size: 13px; margin-bottom: 14px; }
.login .secure { display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
.login .secure svg { width: 15px; height: 15px; color: var(--good); }
.login .demo { margin-top: 22px; border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; font-size: 12.5px; }
.login .demo b { font-family: var(--mono); font-size: 12px; }
.login .demo a { cursor: pointer; }
.login .legal { font-size: 12px; color: var(--faint); display: flex; gap: 14px; justify-content: center; }
@media (max-width: 980px) { .login { grid-template-columns: 1fr; } .login .hero { display: none; } .login .pane { padding: 24px; } }
@media print { .side, .top, .toolbar, .btn { display: none !important; } .app { display: block; } .card { box-shadow: none; break-inside: avoid; } }

table.t.nw td { white-space: nowrap; }
.map.offline { background-color: var(--surface-2); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px; }
.map.offline .leaflet-tile-pane { display: none; }
.map.tiles-auto-dark .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.88) saturate(.7); }
.map-note { position: absolute; right: 10px; top: 10px; z-index: 500; font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--line);
  border-radius: 7px; padding: 3px 8px; }
