/* Spectrum CIS Analyzer — styles */
:root {
  --bg: #080b11;
  --bg-grad: radial-gradient(1200px 600px at 75% -10%, rgba(34, 211, 238, 0.07), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(167, 139, 250, 0.06), transparent 60%);
  --panel: #0d121a;
  --panel-2: #111822;
  --panel-3: #16202c;
  --border: #1c2633;
  --border-2: #263241;
  --text: #e6edf3;
  --text-2: #b6c2d0;
  --muted: #7d8da1;
  --accent: #22d3ee;
  --accent-2: #a78bfa;
  --accent-ink: #031317;
  --ok: #2dd4bf;
  --warn: #eab308;
  --bad: #ef4444;
  --crit: #ef4444;
  --high: #f97316;
  --med: #eab308;
  --low: #38bdf8;
  --info: #94a3b8;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --glass: rgba(13, 18, 26, 0.82);
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: Inter, system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: dark;
}
:root[data-theme='light'] {
  --bg: #eef2f6;
  --bg-grad: radial-gradient(1200px 600px at 75% -10%, rgba(8, 145, 178, 0.08), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(124, 58, 237, 0.05), transparent 60%);
  --panel: #ffffff;
  --panel-2: #f7f9fb;
  --panel-3: #eef2f6;
  --border: #e2e8f0;
  --border-2: #d3dbe5;
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --accent: #0891b2;
  --accent-2: #7c3aed;
  --accent-ink: #ffffff;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.16);
  --glass: rgba(255, 255, 255, 0.9);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-grad), var(--bg);
  color: var(--text);
  font: 13px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
kbd {
  font: 600 10px var(--mono);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--border-2);
  background: var(--panel-3);
  color: var(--muted);
}
.ic { width: 15px; height: 15px; flex: none; }
.dim { color: var(--muted); }
[hidden] { display: none !important; }

/* ---------------------------------------------------------------- splash */
#splash {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg-grad), var(--bg);
  transition: opacity 0.5s ease, visibility 0.5s;
}
#splash.done { opacity: 0; visibility: hidden; }
.sp-in { width: 340px; text-align: center; }
.sp-logo { width: 72px; height: 72px; margin-bottom: 16px; }
.sp-box { fill: var(--panel-2); stroke: var(--border-2); stroke-width: 1.5; }
.sp-wave { fill: none; stroke: var(--accent); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 120; animation: draw 1.6s ease-in-out infinite; filter: drop-shadow(0 0 6px var(--accent)); }
@keyframes draw { 0% { stroke-dashoffset: 120; } 60% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -120; } }
.sp-title { font-weight: 800; letter-spacing: 0.22em; font-size: 15px; }
.sp-title span { font-weight: 500; letter-spacing: 0.04em; color: var(--muted); margin-left: 6px; }
.sp-bar { height: 3px; margin: 22px 0 12px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.sp-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 12px var(--accent); transition: width 0.3s ease; }
.sp-step { font: 500 11px var(--mono); color: var(--muted); min-height: 16px; }

/* ----------------------------------------------------------------- top */
.top {
  display: flex; align-items: center; gap: 18px;
  height: 56px; padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--glass);
  backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; flex: none; }
.brand .logo { width: 30px; height: 30px; }
.brand .logo rect { fill: var(--panel-3); stroke: var(--border-2); }
.brand .logo path { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px var(--accent)); }
.brand b { display: block; font-weight: 800; letter-spacing: 0.2em; font-size: 12.5px; line-height: 1.1; }
.brand span { font-size: 11px; color: var(--muted); }
.meta { min-width: 0; flex: 1; padding-left: 18px; border-left: 1px solid var(--border); }
.m-line { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.m-line b { font-size: 13.5px; font-weight: 650; }
.m-id { font: 600 11px var(--mono); padding: 2px 8px; border-radius: 6px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.m-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.search-btn {
  display: flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 8px 0 10px; min-width: 300px;
  border: 1px solid var(--border-2); border-radius: 9px;
  background: var(--panel-2); color: var(--muted);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-btn span { flex: 1; text-align: left; font-size: 12.5px; }
.search-btn:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border-2)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.sel-wrap select {
  height: 34px; padding: 0 28px 0 10px; border-radius: 9px;
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text);
  font: 600 12px var(--mono); cursor: pointer; 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) 15px, calc(100% - 10px) 15px;
  background-size: 5px 5px; background-repeat: no-repeat;
}
.icon-btn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--border-2); border-radius: 9px; background: var(--panel-2); color: var(--text-2);
  transition: all 0.15s;
}
.icon-btn:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, var(--border-2)); }
.icon-btn .ic { width: 16px; height: 16px; }

/* ----------------------------------------------------------------- KPIs */
.kpis {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px;
  padding: 12px 16px 0;
}
.kpi {
  position: relative; overflow: hidden;
  padding: 10px 14px; border-radius: 12px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  min-height: 76px;
}
.kpi::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 1px; background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 45%, transparent), transparent); }
.kpi.warn::after { background: linear-gradient(90deg, transparent, rgba(234, 179, 8, 0.6), transparent); }
.kpi.crit::after { background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.7), transparent); }
.k-lbl { display: flex; align-items: center; gap: 6px; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; }
.k-lbl .ic { width: 13px; height: 13px; color: var(--accent); opacity: 0.85; }
.k-val { font: 700 22px/1.25 var(--mono); letter-spacing: -0.02em; margin-top: 3px; }
.k-val small { font-size: 12px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.k-sub { font-size: 11px; color: var(--muted); margin-top: 2px; }
.k-note { display: block; margin-top: 3px; font-size: 10.5px; }
.k-bar { height: 4px; border-radius: 4px; background: var(--panel-3); overflow: hidden; margin-top: 4px; }
.k-bar i { display: block; height: 100%; border-radius: 4px; transition: width 1s cubic-bezier(.2, .8, .2, 1); }
.k-sev { display: flex; gap: 8px; margin-top: 3px; }
.sv { display: inline-flex; align-items: center; gap: 4px; font: 600 11px var(--mono); color: var(--text-2); }
.sv i { width: 7px; height: 7px; border-radius: 2px; }
.sv-critical i, .sv-t.sv-critical { background: var(--crit); }
.sv-high i { background: var(--high); }
.sv-medium i { background: var(--med); }
.sv-low i { background: var(--low); }
.kpi.health { display: flex; align-items: center; gap: 12px; }
.ring { width: 54px; height: 54px; transform: rotate(-90deg); flex: none; }
.ring-bg { fill: none; stroke: var(--panel-3); stroke-width: 5; }
.ring-fg { fill: none; stroke-width: 5; stroke-linecap: round; transition: stroke-dashoffset 1.4s cubic-bezier(.2, .8, .2, 1); filter: drop-shadow(0 0 4px currentColor); }

/* --------------------------------------------------------------- layout */
.layout {
  display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 12px;
  padding: 12px 16px 16px;
  height: calc(100vh - 56px - 88px);
  min-height: 640px;
}
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: 14px; min-height: 0; }
.chart-panel { display: flex; flex-direction: column; overflow: hidden; }
.side { display: flex; flex-direction: column; gap: 12px; min-height: 0; }

/* -------------------------------------------------------------- toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.legend { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  height: 26px; padding: 0 9px; border-radius: 7px;
  border: 1px solid transparent; background: transparent;
  font-size: 11.5px; color: var(--muted); white-space: nowrap;
  transition: all 0.15s;
}
.chip.on { color: var(--text); background: var(--panel-2); border-color: var(--border); }
.chip:hover { border-color: var(--border-2); }
.chip .ln { width: 16px; height: 0; border-top: 2px solid var(--c); opacity: 0.35; }
.chip.on .ln { opacity: 1; }
.chip .ln.dot { border-top-style: dotted; }
.chip .ln.dash { border-top-style: dashed; }
.ref-chip { cursor: default; color: var(--muted); }
.ref-chip .ln { opacity: 1; }
.tools { display: flex; align-items: center; gap: 6px; }
.tgroup { display: flex; padding: 2px; gap: 2px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; }
.tbtn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; min-width: 28px; padding: 0 7px; justify-content: center;
  border: 0; border-radius: 7px; background: transparent; color: var(--text-2);
  transition: all 0.15s;
}
.tbtn:hover { background: var(--panel-3); color: var(--text); }
.tbtn.on { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.tbtn.primary, .btn.primary {
  height: 32px; padding: 0 12px; font-weight: 600; font-size: 12px;
  color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  box-shadow: 0 4px 18px color-mix(in srgb, var(--accent) 30%, transparent);
}
.tbtn.primary:hover, .btn.primary:hover { filter: brightness(1.1); color: var(--accent-ink); }
.tbtn.ai {
  height: 32px; padding: 0 11px; font-weight: 600; font-size: 12px;
  border: 1px solid color-mix(in srgb, var(--accent-2) 45%, transparent);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent); color: var(--accent-2);
}
.tbtn.ai:hover { background: color-mix(in srgb, var(--accent-2) 22%, transparent); color: var(--accent-2); }

/* ---------------------------------------------------------------- chart */
.chart-wrap { position: relative; flex: 1; min-height: 0; user-select: none; }
#chart { position: absolute; inset: 0; }
.chart-wrap.select-mode, .chart-wrap.select-mode canvas { cursor: crosshair !important; }
.ov { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.ov > div { position: absolute; left: 0; top: 0; will-change: transform; }
.xh-v, .xh-h, .xh-pill, .xh-dot { opacity: 0; transition: opacity 0.12s; }
.ov.hovering .xh-v, .ov.hovering .xh-h, .ov.hovering .xh-pill, .ov.hovering .xh-dot { opacity: 1; }
.xh-v { width: 1px; margin-left: -0.5px; background: linear-gradient(180deg, transparent, var(--accent) 6%, var(--accent) 94%, transparent); box-shadow: 0 0 8px var(--accent); }
.xh-h { height: 1px; border-top: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); }
.xh-pill { padding: 1px 6px; border-radius: 5px; font: 600 10.5px var(--mono); background: var(--accent); color: var(--accent-ink); white-space: nowrap; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); }
.xh-dot { width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; border: 2px solid var(--panel); box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 10px var(--c, var(--accent)); background: var(--c, var(--accent)); }
.d-on { --c: #ff4d5e; }
.d-off { --c: #6b9bff; }
.d-stat { --c: #a3acb9; width: 7px !important; height: 7px !important; margin: -3.5px 0 0 -3.5px !important; }
.d-crit { --c: #4ade80; width: 7px !important; height: 7px !important; margin: -3.5px 0 0 -3.5px !important; }
.d-oOn, .d-oOff { --c: #cbd5e1; width: 6px !important; height: 6px !important; margin: -3px 0 0 -3px !important; }
.d-score { --c: #eab308; }
.d-doc { --c: #7dd3fc; }
:root[data-theme='light'] .d-off { --c: #2563eb; }
:root[data-theme='light'] .d-oOn, :root[data-theme='light'] .d-oOff { --c: #334155; }

.hl-anom {
  border-left: 1px solid var(--c); border-right: 1px solid var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 16%, transparent), color-mix(in srgb, var(--c) 4%, transparent));
  opacity: 0; transition: opacity 0.18s;
}
.hl-anom.on { opacity: 1; }
.sel {
  display: none;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left: 1.5px solid var(--accent); border-right: 1.5px solid var(--accent);
  box-shadow: inset 0 0 40px color-mix(in srgb, var(--accent) 10%, transparent);
}
.sel-lbl {
  position: absolute; top: -1px; left: 50%; transform: translate(-50%, -100%);
  padding: 2px 8px; border-radius: 6px 6px 0 0; white-space: nowrap;
  font: 600 10.5px var(--mono); color: var(--accent-ink); background: var(--accent);
}
.sel.narrow .sel-lbl { left: 0; transform: translate(0, -100%); }
.ref { display: none; width: 0; border-left: 1.5px dashed #e879f9; }
.ref span {
  position: absolute; top: 0; left: 0; transform: translate(-50%, -100%);
  padding: 1px 6px; border-radius: 5px 5px 0 0; font: 700 10px var(--mono);
  background: #e879f9; color: #1a0420; white-space: nowrap;
}
.scan {
  display: none; width: 90px; margin-left: -90px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent-2) 22%, transparent) 80%, var(--accent-2));
  border-right: 2px solid var(--accent-2);
  box-shadow: 6px 0 24px var(--accent-2);
}
.flash {
  border: 1.5px solid var(--c); border-radius: 3px;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  animation: flash 0.8s ease-in-out 3;
}
.flash span {
  position: absolute; left: 50%; top: -2px; transform: translate(-50%, -100%);
  font: 700 10px var(--mono); padding: 1px 6px; border-radius: 5px;
  background: var(--c); color: #0b0b0b; white-space: nowrap;
}
@keyframes flash { 0%, 100% { opacity: 0.25; box-shadow: 0 0 0 0 var(--c); } 50% { opacity: 1; box-shadow: 0 0 22px 2px var(--c); } }

.hud {
  position: absolute; top: 10px; left: 50%; transform: translate(-50%, -12px); z-index: 6;
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; border-radius: 10px; font: 600 11.5px var(--mono);
  background: var(--glass); border: 1px solid color-mix(in srgb, var(--accent-2) 45%, var(--border));
  color: var(--accent-2); box-shadow: var(--shadow); backdrop-filter: blur(10px);
  opacity: 0; pointer-events: none; transition: all 0.25s;
}
.hud.on { opacity: 1; transform: translate(-50%, 0); }
.hud-spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--accent-2) 30%, transparent); border-top-color: var(--accent-2); animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* tooltip */
.tip {
  position: absolute; left: 0; top: 0; z-index: 5; width: 300px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--glass); border: 1px solid var(--border-2);
  box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(1.2);
  pointer-events: none; opacity: 0; transition: opacity 0.12s;
  font-size: 11.5px;
}
.tip.on { opacity: 1; }
.tip-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 7px; }
.tip-st { font: 700 15px var(--mono); letter-spacing: -0.02em; }
.tip-sub, .tip-time { font: 500 10px var(--mono); color: var(--muted); }
.tip-time { padding: 2px 6px; border-radius: 5px; background: var(--panel-3); white-space: nowrap; }
.tip-grid { display: grid; grid-template-columns: 12px auto 1fr auto; gap: 3px 7px; align-items: center; }
.tip-grid .sw { width: 10px; height: 2px; background: var(--c); border-radius: 2px; }
.tip-grid .sw.oOff { background: none; border-top: 2px dotted var(--c); height: 0; }
.tip-grid .nm { color: var(--text-2); }
.tip-grid b { font: 600 11.5px var(--mono); text-align: right; }
.tip-grid em { font: 500 10px var(--mono); font-style: normal; color: var(--muted); text-align: right; min-width: 54px; }
.tip-grid em i { font-style: normal; }
.tip-grid em i.w { color: var(--warn); }
.tip-badges { display: flex; gap: 5px; margin: 8px 0 6px; flex-wrap: wrap; }
.badge { font: 600 10px var(--mono); padding: 2px 7px; border-radius: 20px; border: 1px solid; }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.bad { color: #ff6b6b; border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.badge.warn { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); background: color-mix(in srgb, var(--accent-2) 12%, transparent); }
.tip-kv { display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; font-size: 10.5px; color: var(--muted); }
.tip-kv b { font: 600 10.5px var(--mono); color: var(--text); }
.tip-kv b.sc { color: var(--s); }
.tip-lens-wrap { position: relative; margin-top: 8px; border-radius: 8px; background: var(--panel-3); border: 1px solid var(--border); overflow: hidden; }
.tip-lens { display: block; width: 100%; height: 54px; }
.tip-lens-cap { position: absolute; top: 3px; right: 6px; font: 600 8.5px var(--mono); color: var(--muted); letter-spacing: 0.06em; }
.tip-feat { margin-bottom: 8px; padding: 7px 9px; border-radius: 8px; border-left: 3px solid var(--c); background: color-mix(in srgb, var(--c) 9%, transparent); }
.tf-h { display: flex; justify-content: space-between; font: 600 9.5px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--c); }
.tip-feat b { display: block; font-size: 12.5px; margin-top: 1px; }
.tf-d { color: var(--text-2); font-size: 11px; margin-top: 2px; }
.tf-r { font: 500 10.5px var(--mono); margin-top: 4px; color: var(--text-2); }
.tip-gap { padding: 8px; border-radius: 8px; border: 1px dashed var(--border-2); color: var(--muted); text-align: center; }
.tip-anom { margin-top: 8px; padding: 7px 9px; border-radius: 8px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 11%, transparent); }
.ta-h { display: flex; align-items: center; gap: 7px; }
.ta-h b { font: 700 11px var(--mono); color: var(--c); }
.ta-h span { flex: 1; font-weight: 600; }
.ta-h em { font: 700 9px var(--mono); font-style: normal; padding: 1px 5px; border-radius: 4px; background: var(--c); color: #111; }
.ta-b { font: 500 10.5px var(--mono); color: var(--text-2); margin-top: 3px; }
.tip-ref { margin-top: 7px; font-size: 11px; color: #f0abfc; }
.tip-ref b { font-family: var(--mono); }
.tip-foot { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--border); font-size: 10px; color: var(--muted); }

/* ------------------------------------------------------------ statusbar */
.statusbar {
  display: flex; align-items: center; gap: 18px; height: 30px; padding: 0 12px;
  border-top: 1px solid var(--border); background: var(--panel-2);
  font: 500 11px var(--mono); color: var(--text-2); white-space: nowrap; overflow: hidden;
}
.statusbar > span { display: inline-flex; align-items: center; gap: 6px; }
.statusbar .ic { width: 13px; height: 13px; color: var(--accent); }
.statusbar .sb-r { margin-left: auto; color: var(--muted); }

/* ----------------------------------------------------------------- side */
.map-panel { isolation: isolate; display: flex; flex-direction: column; height: 42%; min-height: 240px; overflow: hidden; }
.panel-h { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.ph-t { font-weight: 650; font-size: 12px; }
.map-legend { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); }
.map-legend i { width: 14px; height: 4px; border-radius: 3px; margin-left: 6px; }
#map { flex: 1; background: var(--panel-2); }
.leaflet-container { font: 12px var(--sans); background: var(--panel-2); }
.leaflet-bar a, .leaflet-control-layers { background: var(--panel) !important; color: var(--text) !important; border-color: var(--border-2) !important; }
.leaflet-control-layers { border-radius: 9px !important; box-shadow: var(--shadow) !important; }
.leaflet-control-layers-expanded { padding: 8px 10px; }
.leaflet-bar { border: 1px solid var(--border-2) !important; border-radius: 9px !important; overflow: hidden; box-shadow: none !important; }
.leaflet-control-attribution { background: color-mix(in srgb, var(--panel) 80%, transparent) !important; color: var(--muted) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.map-follow {
  display: flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 8px;
  border: 1px solid var(--border-2); background: var(--panel); color: var(--muted); font: 600 11px var(--sans);
}
.map-follow span { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.map-follow.on { color: var(--accent); }
.map-follow.on span { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.map-tip { background: var(--glass) !important; color: var(--text) !important; border: 1px solid var(--border-2) !important; border-radius: 8px !important; box-shadow: var(--shadow) !important; font-size: 11.5px; }
.map-tip::before { display: none; }
.mt-sub { font: 500 10.5px var(--mono); color: var(--muted); }
.amk-wrap { background: none; border: 0; }
.amk { width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center; font: 800 10px var(--mono); color: #fff; border: 2px solid rgba(0, 0, 0, 0.55); }
.amk.sev-critical { background: var(--crit); box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.25), 0 0 14px var(--crit); animation: pulse 1.6s infinite; }
.amk.sev-high { background: var(--high); box-shadow: 0 0 10px var(--high); }
.amk.sev-medium { background: var(--med); }
.amk.sev-low { background: var(--low); }
.amk.sev-info { background: var(--info); }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5), 0 0 14px var(--crit); } 70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0), 0 0 14px var(--crit); } }
.cur-wrap { background: none; border: 0; }
.cur-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid #fff; box-shadow: 0 0 0 0 var(--accent); animation: curpulse 1.4s infinite; }
@keyframes curpulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 70%, transparent); } 100% { box-shadow: 0 0 0 14px transparent; } }

.tabs-panel { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.tabs { display: flex; gap: 2px; padding: 6px 6px 0; border-bottom: 1px solid var(--border); }
.tabs button {
  position: relative; display: flex; align-items: center; gap: 6px;
  padding: 7px 12px 9px; border: 0; background: none; color: var(--muted); font-weight: 600; font-size: 12px;
}
.tabs button.on { color: var(--text); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.cnt { font: 700 10px var(--mono); padding: 1px 6px; border-radius: 10px; background: var(--panel-3); color: var(--text-2); }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }
.tab-body { flex: 1; overflow-y: auto; padding: 10px; scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }

.flt { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.seg { display: flex; gap: 3px; flex-wrap: wrap; }
.seg button {
  display: inline-flex; align-items: center; gap: 5px; height: 25px; padding: 0 8px;
  border-radius: 7px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); font-size: 11px; font-weight: 600;
}
.seg button b { font: 700 10px var(--mono); color: var(--text-2); }
.seg button.on { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.seg .sg-critical::before, .seg .sg-high::before, .seg .sg-medium::before, .seg .sg-low::before, .seg .sg-info::before { content: ''; width: 6px; height: 6px; border-radius: 2px; }
.sg-critical::before { background: var(--crit); }
.sg-high::before { background: var(--high); }
.sg-medium::before { background: var(--med); }
.sg-low::before { background: var(--low); }
.sg-info::before { background: var(--info); }
.flt-row { display: flex; align-items: center; gap: 10px; }
.flt-q {
  flex: 1; min-width: 0; height: 28px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text); font: 12px var(--sans); outline: none;
}
.flt-q:focus { border-color: var(--accent); }
.sw-tog { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.sw-tog input { display: none; }
.sw-tog span { position: relative; width: 26px; height: 15px; border-radius: 10px; background: var(--panel-3); border: 1px solid var(--border-2); transition: 0.2s; }
.sw-tog span::after { content: ''; position: absolute; left: 2px; top: 2px; width: 9px; height: 9px; border-radius: 50%; background: var(--muted); transition: 0.2s; }
.sw-tog input:checked + span { background: color-mix(in srgb, var(--accent) 25%, transparent); border-color: var(--accent); }
.sw-tog input:checked + span::after { left: 13px; background: var(--accent); }

.alist { display: flex; flex-direction: column; gap: 6px; }
.acard {
  --c: var(--info);
  border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: 9px;
  background: var(--panel-2); overflow: hidden; transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.acard:hover { border-color: color-mix(in srgb, var(--c) 50%, var(--border)); border-left-color: var(--c); transform: translateX(2px); }
.acard.sev-critical { --c: var(--crit); }
.acard.sev-high { --c: var(--high); }
.acard.sev-medium { --c: var(--med); }
.acard.sev-low { --c: var(--low); }
.acard.st-dismissed { opacity: 0.5; }
.acard.open { background: color-mix(in srgb, var(--c) 7%, var(--panel-2)); border-color: color-mix(in srgb, var(--c) 45%, var(--border)); }
.ac-main { padding: 8px 10px; cursor: pointer; }
.ac-top { display: flex; align-items: center; gap: 6px; }
.ac-id { font: 700 11px var(--mono); color: var(--c); }
.ac-sev { font: 700 9px var(--mono); text-transform: uppercase; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--c) 18%, transparent); color: var(--c); }
.ac-status { font: 700 9px var(--mono); text-transform: uppercase; padding: 1px 5px; border-radius: 4px; background: var(--panel-3); color: var(--text-2); }
.ac-metric { margin-left: auto; font: 600 10.5px var(--mono); color: var(--text-2); }
.ac-title { font-weight: 600; font-size: 12.5px; margin-top: 2px; }
.ac-sub { font: 500 10.5px var(--mono); color: var(--muted); }
.ac-conf { height: 2px; margin-top: 6px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.ac-conf i { display: block; height: 100%; background: var(--c); opacity: 0.8; }
.ac-more { display: none; padding: 0 10px 10px; font-size: 11.5px; color: var(--text-2); }
.acard.open .ac-more { display: block; animation: fadeIn 0.2s; }
.ac-more p { margin: 6px 0; }
.ac-act { display: flex; gap: 6px; color: var(--text); }
.ac-act .ic { color: var(--accent-2); margin-top: 1px; }
.ac-btns { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.ac-btns button, .btn {
  display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px;
  border-radius: 7px; border: 1px solid var(--border-2); background: var(--panel); color: var(--text-2); font-size: 11px; font-weight: 600;
  transition: all 0.15s;
}
.ac-btns button:hover, .btn:hover { color: var(--text); border-color: var(--accent); }
.ac-btns .ic, .btn .ic { width: 13px; height: 13px; }
.ac-btns.col { flex-direction: column; align-items: stretch; margin-top: 12px; }
.ac-btns.col .btn { height: 32px; justify-content: center; }
.btn.wide { width: 100%; justify-content: center; margin-top: 12px; }
.empty { padding: 18px; text-align: center; color: var(--muted); font-size: 12px; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-3px); } }

.tchips { display: flex; flex-wrap: wrap; gap: 4px; }
.tchips button { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); font-size: 11px; }
.tchips button i { width: 7px; height: 7px; border-radius: 2px; }
.tchips button b { font: 700 10px var(--mono); }
.tchips button.on { color: var(--text); border-color: var(--accent); }
.elist { display: flex; flex-direction: column; }
.erow { display: grid; grid-template-columns: 8px 74px 1fr; gap: 8px; align-items: center; padding: 6px 6px; border-radius: 7px; cursor: pointer; }
.erow:hover { background: var(--panel-2); }
.erow i { width: 8px; height: 8px; border-radius: 2px; }
.e-st { font: 600 11px var(--mono); color: var(--text-2); }
.e-lbl { font-size: 12px; min-width: 0; }
.e-lbl small { display: block; color: var(--muted); font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ins-h { display: flex; align-items: center; gap: 8px; font: 600 12px var(--mono); margin-bottom: 10px; }
.live { display: inline-flex; align-items: center; gap: 5px; font: 800 9px var(--mono); color: var(--ok); padding: 2px 6px; border-radius: 4px; background: color-mix(in srgb, var(--ok) 12%, transparent); }
.live i { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); animation: blink 1.4s infinite; }
.itiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.it { padding: 7px 8px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.it span { display: block; font-size: 10px; color: var(--muted); }
.it b { font: 650 12px var(--mono); }
.it b.warn, .rt.warn b { color: var(--warn); }
.it b.bad, .rt.bad b { color: #ff6b6b; }
.ig { margin-bottom: 7px; }
.ig-h { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-2); }
.ig-h b { font-family: var(--mono); }
.ins-sec { margin: 14px 0 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.ins-p { margin: 0; font-size: 12px; color: var(--text-2); line-height: 1.6; }
.ins-p b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.ins-p .bad { color: #ff6b6b; }
.ins-p .warn { color: var(--warn); }
.ins-p a { color: var(--accent); cursor: pointer; text-decoration: underline dotted; }
.sdist { display: flex; align-items: flex-end; gap: 2px; height: 48px; padding: 4px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--border); }
.sdist i { flex: 1; border-radius: 2px 2px 0 0; opacity: 0.85; transition: height 0.4s; }
.ins-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ichip { font: 600 10px var(--mono); padding: 3px 7px; border-radius: 6px; cursor: pointer; border: 1px solid; }
.ichip.sev-critical { color: #ff6b6b; border-color: color-mix(in srgb, var(--crit) 40%, transparent); }
.ichip.sev-high { color: var(--high); border-color: color-mix(in srgb, var(--high) 40%, transparent); }
.ichip.sev-medium { color: var(--med); border-color: color-mix(in srgb, var(--med) 40%, transparent); }
.ichip.sev-low { color: var(--low); border-color: color-mix(in srgb, var(--low) 40%, transparent); }
.ichip.sev-info { color: var(--info); border-color: var(--border-2); }

/* ---------------------------------------------------------- context menu */
.ctx {
  position: fixed; z-index: 60; min-width: 270px; padding: 5px;
  border-radius: 12px; background: var(--glass); border: 1px solid var(--border-2);
  box-shadow: var(--shadow), 0 0 0 1px rgba(0, 0, 0, 0.2); backdrop-filter: blur(16px) saturate(1.3);
  opacity: 0; transform: scale(0.97) translateY(-4px); transform-origin: top left; transition: opacity 0.12s, transform 0.12s;
  font-size: 12.5px;
}
.ctx.in { opacity: 1; transform: none; }
.ctx-head { padding: 7px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.ctx-head b { display: block; font: 700 13px var(--mono); color: var(--accent); }
.ctx-head span { font: 500 10.5px var(--mono); color: var(--muted); }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--border); }
.ctx-item {
  position: relative; display: flex; align-items: center; gap: 9px;
  height: 30px; padding: 0 9px; border-radius: 7px; cursor: pointer; color: var(--text-2); white-space: nowrap;
}
.ctx-item > .ic { color: var(--muted); }
.ctx-item:hover { background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent) 6%, transparent)); color: var(--text); }
.ctx-item:hover > .ic { color: var(--accent); }
.ctx-lbl { flex: 1; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.ctx-item kbd { margin-left: 8px; }
.ctx-item .chev { width: 13px; height: 13px; color: var(--muted); }
.ctx-badge { display: inline-flex; align-items: center; gap: 3px; font: 800 9px var(--mono); padding: 1px 6px; border-radius: 5px; color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 15%, transparent); }
.ctx-badge .ic { width: 10px; height: 10px; }
.ctx-item.sev { color: var(--text); font-weight: 600; }
.ctx-item.sev > .ic { color: var(--c); }
.ctx-item.sev-critical { --c: var(--crit); }
.ctx-item.sev-high { --c: var(--high); }
.ctx-item.sev-medium { --c: var(--med); }
.ctx-item.sev-low { --c: var(--low); }
.ctx-item.sev-info { --c: var(--info); }
.ctx-sub {
  position: absolute; left: calc(100% + 4px); top: -6px; min-width: 250px; padding: 5px;
  border-radius: 12px; background: var(--glass); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  backdrop-filter: blur(16px); visibility: hidden; opacity: 0; transform: translateX(-4px); transition: all 0.12s 0.05s;
}
.ctx-sub::before { content: ''; position: absolute; left: -10px; top: 0; bottom: 0; width: 10px; }
.ctx.flip .ctx-sub { left: auto; right: calc(100% + 4px); transform: translateX(4px); }
.ctx.flip .ctx-sub::before { left: auto; right: -10px; }
.ctx-item.has-sub:hover > .ctx-sub { visibility: visible; opacity: 1; transform: none; }

/* --------------------------------------------------------------- modals */
.modal-root, .palette-root { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px; }
.m-back { position: absolute; inset: 0; background: rgba(3, 6, 10, 0.55); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.2s; }
.modal-root.in .m-back, .palette-root.in .m-back { opacity: 1; }
.m-card {
  position: relative; width: min(680px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  border-radius: 16px; background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(10px) scale(0.98); transition: all 0.22s cubic-bezier(.2, .8, .2, 1);
}
.m-card.wide { width: min(1080px, 100%); }
.modal-root.in .m-card { opacity: 1; transform: none; }
.m-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 1px; border-radius: 16px 16px 0 0; background: linear-gradient(90deg, transparent, var(--accent), var(--accent-2), transparent); }
.m-card.sev-critical::before { background: linear-gradient(90deg, transparent, var(--crit), transparent); }
.m-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.m-ic { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); }
.m-ic .ic { width: 18px; height: 18px; }
.m-ttl { flex: 1; min-width: 0; }
.m-ttl b { display: block; font-size: 15px; }
.m-ttl span { font: 500 11px var(--mono); color: var(--muted); }
.m-body { padding: 16px; overflow-y: auto; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.m-foot .btn { height: 32px; padding: 0 12px; }
.m-note { display: flex; gap: 8px; align-items: flex-start; color: var(--muted); font-size: 11.5px; margin: 12px 0 0; }
.m-note .ic { color: var(--accent-2); flex: none; margin-top: 1px; }

.pipe { padding: 6px 4px; }
.pipe-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 16px; margin-bottom: 14px; }
.ps { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.ps-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border-2); flex: none; }
.ps.run { color: var(--text); }
.ps.run .ps-dot { border-color: color-mix(in srgb, var(--accent) 30%, transparent); border-top-color: var(--accent); animation: spin 0.7s linear infinite; }
.ps.ok { color: var(--text-2); }
.ps.ok .ps-dot { border-color: var(--ok); background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.pipe-log {
  height: 190px; margin: 0; padding: 12px; overflow: auto; border-radius: 10px;
  background: #05080c; border: 1px solid var(--border); color: #7ee2b8; font: 500 11px/1.6 var(--mono);
}
:root[data-theme='light'] .pipe-log { background: #0f172a; }
.pipe-bar { height: 3px; margin-top: 12px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.pipe-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.25s; }

.rtiles { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.rtiles.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rt { padding: 9px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); animation: rise 0.4s both; }
.rt:nth-child(2) { animation-delay: 0.04s; } .rt:nth-child(3) { animation-delay: 0.08s; } .rt:nth-child(4) { animation-delay: 0.12s; }
.rt:nth-child(5) { animation-delay: 0.16s; } .rt:nth-child(6) { animation-delay: 0.2s; } .rt:nth-child(7) { animation-delay: 0.24s; } .rt:nth-child(8) { animation-delay: 0.28s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.rt span { display: block; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.rt b { display: block; font: 700 15px var(--mono); margin-top: 2px; }
.rt small { font: 500 10px var(--mono); color: var(--muted); }
.rt.ok b { color: var(--ok); }
.rgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.rgrid.three { grid-template-columns: 1.1fr 1fr 1.2fr; }
.rbox { padding: 10px 12px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); min-width: 0; }
.rbox h5 { margin: 0 0 8px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.rbox h5 b { color: var(--text); font-family: var(--mono); }
.mc { height: 220px; }
.mc.tall { height: 320px; }
.rfind { display: flex; flex-direction: column; gap: 3px; max-height: 200px; overflow-y: auto; }
.rf { --c: var(--info); display: grid; grid-template-columns: 46px 1fr auto; gap: 6px; padding: 5px 7px; border-radius: 6px; border-left: 2px solid var(--c); background: var(--panel); cursor: pointer; font-size: 11.5px; }
.rf:hover { background: var(--panel-3); }
.rf b { font: 700 10.5px var(--mono); color: var(--c); }
.rf em { font: 500 10px var(--mono); color: var(--muted); font-style: normal; }
.rf.sev-critical, .rec.sev-critical { --c: var(--crit); }
.rf.sev-high, .rec.sev-high { --c: var(--high); }
.rf.sev-medium, .rec.sev-medium { --c: var(--med); }
.rf.sev-low, .rec.sev-low { --c: var(--low); }
.rnotes { margin: 0; padding-left: 16px; font-size: 12px; color: var(--text-2); line-height: 1.7; }
.rnotes b { color: var(--text); font-family: var(--mono); }
.recs { display: flex; flex-direction: column; gap: 6px; }
.rec { --c: var(--ok); display: flex; gap: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12px; background: color-mix(in srgb, var(--c) 8%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent); }
.rec .ic { color: var(--c); flex: none; margin-top: 1px; }

.rep { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
.rep-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; }
.rep-r { display: flex; flex-direction: column; gap: 6px; }
.prio { --c: var(--info); padding: 12px; border-radius: 12px; border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); background: color-mix(in srgb, var(--c) 10%, transparent); margin-bottom: 4px; }
.prio.sev-critical { --c: var(--crit); } .prio.sev-high { --c: var(--high); } .prio.sev-medium { --c: var(--med); } .prio.sev-low { --c: var(--low); }
.prio span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.prio b { display: block; font-size: 20px; color: var(--c); }
.prio small { color: var(--text-2); }
.kv { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--border); font-size: 12px; }
.kv span { color: var(--muted); }
.kv b { font: 600 11.5px var(--mono); text-align: right; }
.pill { padding: 1px 7px; border-radius: 10px; background: var(--panel-3); text-transform: uppercase; font-size: 10px; }

.help { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; }
.help p { color: var(--text-2); line-height: 1.65; margin: 0 0 12px; }
.help h5 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.help h5:not(:first-child) { margin-top: 14px; }
.hk { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--border); }
.hk em { font-style: normal; color: var(--text-2); }
.c850 { color: #e879f9; font-weight: 600; }
.c100 { color: #4ade80; font-weight: 600; }

/* -------------------------------------------------------------- palette */
.palette-root { place-items: start center; padding-top: 12vh; }
.pal {
  position: relative; width: min(620px, 100%); border-radius: 14px; overflow: hidden;
  background: var(--panel); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-8px); transition: all 0.18s;
}
.palette-root.in .pal { opacity: 1; transform: none; }
.pal-in { display: flex; align-items: center; gap: 10px; padding: 0 14px; border-bottom: 1px solid var(--border); }
.pal-in .ic { color: var(--accent); width: 18px; height: 18px; }
.pal-in input { flex: 1; height: 50px; border: 0; outline: none; background: transparent; color: var(--text); font: 15px var(--sans); }
.pal-list { max-height: 50vh; overflow-y: auto; padding: 6px; }
.pal-g { padding: 8px 10px 4px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 700; }
.pal-it { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--text-2); }
.pal-it span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-it em { font: 500 10.5px var(--mono); font-style: normal; color: var(--muted); white-space: nowrap; }
.pal-it.on { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--text); }
.pal-it.on .ic { color: var(--accent); }
.sv-t { padding: 0 5px; border-radius: 4px; color: #111; font-weight: 700; }
.sv-t.sv-high { background: var(--high); } .sv-t.sv-medium { background: var(--med); } .sv-t.sv-low { background: var(--low); } .sv-t.sv-info { background: var(--info); }

/* --------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 10px 12px;
  border-radius: 11px; background: var(--glass); border: 1px solid var(--border-2); box-shadow: var(--shadow);
  backdrop-filter: blur(14px); font-size: 12.5px; color: var(--text-2); pointer-events: auto;
  opacity: 0; transform: translateY(10px) scale(0.98); transition: all 0.25s cubic-bezier(.2, .8, .2, 1);
}
.toast.in { opacity: 1; transform: none; }
.toast b { color: var(--text); }
.t-ic { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; flex: none; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.toast.err .t-ic { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.t-msg { flex: 1; }
.t-act { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 12px; padding: 4px 6px; border-radius: 6px; }
.t-act:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }

.note-pop {
  position: fixed; z-index: 75; width: 290px; padding: 10px; border-radius: 12px;
  background: var(--glass); border: 1px solid #e879f9; box-shadow: var(--shadow), 0 0 24px rgba(232, 121, 249, 0.25); backdrop-filter: blur(14px);
}
.np-h { display: flex; align-items: center; gap: 6px; font-size: 12px; margin-bottom: 8px; color: var(--text-2); }
.np-h .ic { color: #e879f9; }
.np-h b { font-family: var(--mono); color: var(--text); }
.note-pop input { width: 100%; height: 32px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text); outline: none; font: 12.5px var(--sans); }
.note-pop input:focus { border-color: #e879f9; }
.np-f { margin-top: 6px; font-size: 10.5px; color: var(--muted); }

/* ----------------------------------------------------------- responsive */
@media (max-width: 1380px) {
  .search-btn { min-width: 0; }
  .search-btn span { display: none; }
  .rtiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .layout { grid-template-columns: 1fr; height: auto; }
  .chart-panel { height: 78vh; min-height: 560px; }
  .side { display: grid; grid-template-columns: 1fr 1fr; }
  .map-panel { height: 460px; }
  .tabs-panel { height: 460px; }
  .rgrid.three { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .top { height: auto; flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .meta { order: 3; flex-basis: 100%; padding-left: 0; border-left: 0; }
  .top-actions { margin-left: auto; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout { padding: 12px 16px; }
  .side { grid-template-columns: 1fr; }
  .legend { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tools { flex: 1 1 100%; justify-content: space-between; }
  .tools .tgroup:nth-child(3) { display: none; }
  .tbtn span { display: none; }
  .statusbar #sbPts, .statusbar .sb-r { display: none; }
  .rgrid, .rep, .help { grid-template-columns: 1fr; }
  .rtiles, .rtiles.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pipe-steps { grid-template-columns: 1fr 1fr; }
  .tip { width: 250px; }
}
