/* =========================================================================
   AQQAL — design tokens
   ========================================================================= */
:root {
  --bg: #f3f5f4;
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --surface-3: #eceff0;
  --border: rgba(11, 20, 18, 0.09);
  --border-strong: rgba(11, 20, 18, 0.16);
  --ink: #0d1614;
  --ink-2: #4b5653;
  --muted: #7d8784;
  --accent: #0a9a5f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(10, 154, 95, 0.1);
  --grid-line: rgba(11, 20, 18, 0.045);
  --glow: rgba(10, 154, 95, 0.1);
  --map-land: #e3ece7;
  --map-stroke: #0a9a5f;
  --seq: #eb6834;
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a;
  --map-prov: rgba(10,154,95,.28);
  --map-side: #b9cfc4; --map-shadow: rgba(16,60,40,.28); --map-bg: #e9efec; --heat: #e34948;
  --display: 'Space Grotesk', Inter, system-ui, sans-serif;
  --good: #0ca30c; --warning: #fab219; --serious: #ec835a; --critical: #d03b3b;
  --good-ink: #006300;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #060a0d; --surface: #0c1318; --surface-2: #101920; --surface-3: #16222b;
    --border: rgba(255,255,255,.07); --border-strong: rgba(255,255,255,.14);
    --ink: #e9f0ee; --ink-2: #a6b3b0; --muted: #6c7a77;
    --accent: #2ee59d; --accent-ink: #04130c; --accent-soft: rgba(46,229,157,.1);
    --grid-line: rgba(46,229,157,.035); --glow: rgba(46,229,157,.13);
    --map-land: #0d1c17; --map-stroke: #2ee59d; --seq: #d95926; --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --map-prov: rgba(46,229,157,.2); --map-side: #05140e; --map-shadow: rgba(0,0,0,.75); --map-bg: #050b0e; --heat: #e66767; --good-ink: #0ca30c;
    --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px rgba(0,0,0,.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #060a0d; --surface: #0c1318; --surface-2: #101920; --surface-3: #16222b;
  --border: rgba(255,255,255,.07); --border-strong: rgba(255,255,255,.14);
  --ink: #e9f0ee; --ink-2: #a6b3b0; --muted: #6c7a77;
  --accent: #2ee59d; --accent-ink: #04130c; --accent-soft: rgba(46,229,157,.1);
  --grid-line: rgba(46,229,157,.035); --glow: rgba(46,229,157,.13);
  --map-land: #0d1c17; --map-stroke: #2ee59d; --seq: #d95926; --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --map-prov: rgba(46,229,157,.2); --map-side: #05140e; --map-shadow: rgba(0,0,0,.75); --map-bg: #050b0e; --heat: #e66767; --good-ink: #0ca30c;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 12px 32px rgba(0,0,0,.35);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
.mono, code { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.tnum { font-variant-numeric: tabular-nums; }

.bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 60% 0%, #000 30%, transparent 75%);
}
.bg-glow {
  position: fixed; inset: -20% -10% auto auto; width: 70vw; height: 70vh; pointer-events: none; z-index: 0;
  background: radial-gradient(closest-side, var(--glow), transparent);
  filter: blur(20px);
}

/* =========================================================================
   Layout
   ========================================================================= */
.app { position: relative; z-index: 1; display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 14px; border-right: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 82%, transparent);
  backdrop-filter: blur(14px);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 8px; }
.logo svg { width: 38px; height: 38px; display: block; filter: drop-shadow(0 0 10px rgba(46,229,157,.35)); }
.brand-name { font: 700 16px/1.2 var(--display); letter-spacing: .16em; }
.urdu { font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", serif; letter-spacing: 0; color: var(--accent); font-weight: 600; margin-left: 4px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: .02em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 10px 12px; border-radius: 10px; border: 1px solid transparent; background: none;
  color: var(--ink-2); font-weight: 500; transition: background .15s, color .15s;
}
.nav-item .ni { width: 18px; display: grid; place-items: center; color: var(--muted); }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--ink); border-color: color-mix(in oklab, var(--accent) 25%, transparent); }
.nav-item.active .ni { color: var(--accent); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.mini-risk { padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.mini-risk .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.mini-risk .val { display: flex; align-items: baseline; gap: 8px; margin-top: 4px; }
.mini-risk .num { font-size: 26px; font-weight: 700; }
.ghost-btn { background: none; border: 1px solid var(--border); border-radius: 10px; padding: 8px; color: var(--ink-2); }
.ghost-btn:hover { border-color: var(--border-strong); color: var(--ink); }
.sim-note { font-size: 11px; color: var(--muted); text-align: center; }

.main { min-width: 0; padding-block: 0 48px; padding-left: max(28px, env(safe-area-inset-left, 0px)); padding-right: max(28px, env(safe-area-inset-right, 0px)); }
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 18px 0 14px; margin-bottom: 8px;
  background: linear-gradient(var(--bg) 70%, transparent);
}
.tb-title h1 { margin: 0; font: 600 22px/1.2 var(--display); letter-spacing: -.01em; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.crumbs b { color: var(--ink-2); font-weight: 500; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.clock { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: ping 2s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 60%, transparent); } 100% { box-shadow: 0 0 0 10px transparent; } }
.hamburger { display: none; background: none; border: 1px solid var(--border); border-radius: 10px; width: 38px; height: 38px; }

.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 8px; padding: 9px 14px; border-radius: 10px;
  border: 1px solid var(--border-strong); background: var(--surface); font-weight: 600; font-size: 13px;
  transition: transform .12s, border-color .15s, background .15s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.big { padding: 14px 22px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.icon-btn { background: none; border: 1px solid var(--border); width: 32px; height: 32px; border-radius: 8px; }

.view { display: none; animation: rise .45s cubic-bezier(.2,.8,.2,1); }
.view.active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* =========================================================================
   Cards & grid
   ========================================================================= */
.grid { display: grid; gap: 16px; }
.g-kpi { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.mt { margin-top: 16px; }

.card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); min-width: 0;
}
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h3 { margin: 0; font: 600 14.5px/1.3 var(--display); letter-spacing: -.005em; }
.card-h .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.tag.live::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--critical); animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* status pill: icon + label, never color alone */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; white-space: nowrap; }
.pill .dot { width: 7px; height: 7px; border-radius: 2px; }
.pill.good { background: color-mix(in oklab, var(--good) 16%, transparent); color: var(--ink); }
.pill.warning { background: color-mix(in oklab, var(--warning) 20%, transparent); color: var(--ink); }
.pill.serious { background: color-mix(in oklab, var(--serious) 20%, transparent); color: var(--ink); }
.pill.critical { background: color-mix(in oklab, var(--critical) 22%, transparent); color: var(--ink); }
.pill.good .dot { background: var(--good); } .pill.warning .dot { background: var(--warning); }
.pill.serious .dot { background: var(--serious); } .pill.critical .dot { background: var(--critical); }

/* KPI tiles */
.kpi .lbl { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.kpi .num { font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 6px 0 2px; line-height: 1.1; }
.kpi .foot { font-size: 12px; color: var(--ink-2); }
.kpi .up { color: var(--critical); font-weight: 600; }
.kpi .down { color: var(--good-ink); font-weight: 600; }
.kpi.hero { background:
  radial-gradient(120% 140% at 0% 0%, color-mix(in oklab, var(--lvl, var(--critical)) 22%, transparent), transparent 60%), var(--surface); }
.kpi.hero .num { font-size: 34px; }

/* =========================================================================
   Map
   ========================================================================= */
.map-wrap { position: relative; }
.map-svg { width: 100%; height: auto; display: block; }
.map-land { fill: var(--map-land); stroke: var(--map-stroke); stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 0 12px color-mix(in oklab, var(--map-stroke) 35%, transparent)); }
.map-scan { fill: url(#scanGrad); }
.city-core { fill: var(--accent); }
.city-label { font-size: 11px; fill: var(--ink-2); font-weight: 500; pointer-events: none; }
.city-ring { fill: none; stroke: var(--critical); stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ring 2.4s ease-out infinite; }
@keyframes ring { from { transform: scale(.4); opacity: .9; } to { transform: scale(2.6); opacity: 0; } }
.city-hit { fill: transparent; cursor: pointer; }
.arc { fill: none; stroke-width: 1.6; stroke-linecap: round; }
.arc-head { filter: drop-shadow(0 0 6px currentColor); }
.src-label { font-size: 10px; fill: var(--muted); font-family: "JetBrains Mono", monospace; letter-spacing: .04em; }
.map-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.map-legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* Feed */
.feed { display: flex; flex-direction: column; gap: 8px; max-height: 620px; overflow: hidden; position: relative; }
.feed::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 60px; background: linear-gradient(transparent, var(--surface)); pointer-events: none; }
.feed-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 10px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); animation: slideIn .5s cubic-bezier(.2,.8,.2,1); }
@keyframes slideIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.feed-item .bar { width: 3px; border-radius: 3px; }
.feed-item .t { font-size: 13px; font-weight: 500; line-height: 1.35; }
.feed-item .meta { font-size: 11px; color: var(--muted); display: flex; gap: 8px; margin-top: 4px; flex-wrap: wrap; align-items: center; }

/* Bars */
.hbars { display: flex; flex-direction: column; gap: 12px; }
.hbar { display: grid; grid-template-columns: 140px 1fr 44px; align-items: center; gap: 10px; font-size: 13px; }
.hbar .name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar .track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; position: relative; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; width: 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.hbar .v { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.hbar .target { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); opacity: .55; }

/* Line chart */
.lc svg { width: 100%; height: auto; display: block; overflow: visible; }
.lc .grid-l { stroke: var(--border); }
.lc .axis-t { font-size: 10px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.lc .line { fill: none; stroke: var(--accent); stroke-width: 2; }
.lc .area { fill: url(#areaGrad); }
.lc .xh { stroke: var(--ink-2); stroke-dasharray: 3 3; }

/* =========================================================================
   Modeler
   ========================================================================= */
.model-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; }
.step-h { display: flex; align-items: center; gap: 10px; margin: 4px 0 10px; font-weight: 600; font-size: 13px; }
.step-n { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700; }
.inst-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 18px; }
.inst {
  text-align: left; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2);
  display: flex; flex-direction: column; gap: 6px; transition: border-color .15s, transform .15s;
}
.inst:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.inst .ic { font-size: 18px; }
.inst .nm { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.inst.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 15%, transparent); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 7px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface-2);
  font-size: 12.5px; color: var(--ink-2); transition: all .15s;
}
.chip:hover { border-color: var(--border-strong); color: var(--ink); }
.chip.on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft); }
.chip.on::before { content: '✓ '; color: var(--accent); font-weight: 700; }
.scn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; margin-bottom: 18px; }
.scn { text-align: left; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.scn b { font-size: 12.5px; display: block; }
.scn span { font-size: 11.5px; color: var(--muted); line-height: 1.35; display: block; margin-top: 2px; }
.scn.on { border-color: var(--accent); background: var(--accent-soft); }
.run-row { display: flex; align-items: center; gap: 14px; margin-top: 20px; flex-wrap: wrap; }

/* Console */
.console {
  background: #05090b; color: #c9f7e2; border-radius: 12px; border: 1px solid rgba(46,229,157,.18);
  font: 12.5px/1.65 "JetBrains Mono", monospace; padding: 14px 16px; height: 380px; overflow-y: auto;
  box-shadow: inset 0 0 40px rgba(46,229,157,.05);
}
.console .ln { white-space: pre-wrap; }
.console .c-mut { color: #5d7a6e; }
.console .c-acc { color: #2ee59d; }
.console .c-warn { color: #fab219; }
.console .c-crit { color: #ff6b6b; }
.console .c-info { color: #7cc4ff; }
.console .cursor { display: inline-block; width: 8px; height: 14px; background: #2ee59d; vertical-align: -2px; animation: blink 1s steps(1) infinite; }
.console-h { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.console-h i { width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); display: inline-block; }
.progress { height: 3px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #7cc4ff); transition: width .3s; }

.results { display: none; }
.results.show { display: block; animation: rise .6s cubic-bezier(.2,.8,.2,1); }

.score-card { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: center; }
.ring { position: relative; width: 200px; height: 200px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .trk { fill: none; stroke: var(--surface-3); stroke-width: 12; }
.ring .val { fill: none; stroke-width: 12; stroke-linecap: round; transition: stroke-dashoffset 1.4s cubic-bezier(.2,.8,.2,1), stroke .4s; }
.ring .ghost { fill: none; stroke-width: 12; stroke-linecap: round; opacity: .18; transition: stroke-dashoffset 1.4s; }
.ring .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .big { font-family: var(--display); font-size: 46px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.ring .cap { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; margin-top: 4px; }
.narrative { font-size: 14px; line-height: 1.65; color: var(--ink-2); }
.narrative b { color: var(--ink); }
.stat-row { display: flex; gap: 22px; margin-top: 14px; flex-wrap: wrap; }
.stat-row .s .n { font-size: 20px; font-weight: 700; }
.stat-row .s .l { font-size: 11px; color: var(--muted); }

/* Heatmap */
.heat { display: grid; gap: 2px; font-size: 11px; }
.heat .hd { color: var(--muted); font-weight: 500; padding: 4px; display: flex; align-items: flex-end; line-height: 1.2; }
.heat .hd.col { writing-mode: vertical-rl; transform: rotate(180deg); height: 110px; justify-content: flex-start; padding: 4px 0; align-items: center; }
.heat .rh { color: var(--ink-2); padding: 0 8px 0 0; display: flex; align-items: center; font-weight: 500; white-space: nowrap; }
.heat .cell { aspect-ratio: 1; min-height: 26px; border-radius: 4px; display: grid; place-items: center; font-weight: 600; font-variant-numeric: tabular-nums; cursor: default; transition: transform .12s, outline-color .12s; outline: 2px solid transparent; }
.heat .cell:hover { outline-color: var(--ink); transform: scale(1.06); z-index: 1; }
.heat-legend { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted); margin-top: 10px; }
.heat-legend .ramp { height: 8px; width: 140px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-3), var(--seq)); }

/* Risk matrix */
.matrix-wrap { display: grid; grid-template-columns: 22px 1fr; grid-template-rows: 1fr 22px; gap: 6px; }
.matrix-y { writing-mode: vertical-rl; transform: rotate(180deg); text-align: center; font-size: 11px; color: var(--muted); }
.matrix-x { grid-column: 2; text-align: center; font-size: 11px; color: var(--muted); }
.matrix { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); grid-template-rows: repeat(5, 1fr); gap: 2px; aspect-ratio: 1.25; }
.matrix .mc { border-radius: 4px; }
.matrix .mc.good { background: color-mix(in oklab, var(--good) 22%, var(--surface-2)); }
.matrix .mc.warning { background: color-mix(in oklab, var(--warning) 28%, var(--surface-2)); }
.matrix .mc.serious { background: color-mix(in oklab, var(--serious) 36%, var(--surface-2)); }
.matrix .mc.critical { background: color-mix(in oklab, var(--critical) 44%, var(--surface-2)); }
.mdot {
  position: absolute; transform: translate(-50%, 50%); min-width: 30px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--ink); color: var(--surface); font: 600 10px/20px "JetBrains Mono", monospace; text-align: center;
  box-shadow: 0 0 0 2px var(--surface); cursor: pointer; transition: left 1s cubic-bezier(.2,.8,.2,1), bottom 1s cubic-bezier(.2,.8,.2,1), transform .12s;
}
.mdot:hover { transform: translate(-50%, 50%) scale(1.15); z-index: 3; }
.mdot.ghost { background: transparent; color: var(--muted); box-shadow: 0 0 0 1px var(--border-strong) inset; pointer-events: none; }
.m-legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11px; color: var(--muted); }
.m-legend span { display: inline-flex; gap: 6px; align-items: center; }
.m-legend i { width: 18px; height: 10px; border-radius: 5px; display: inline-block; }

/* Threat list */
.tlist { display: flex; flex-direction: column; gap: 8px; }
.trow { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.trow-h { display: grid; grid-template-columns: 34px 1fr auto auto; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; width: 100%; background: none; border: 0; text-align: left; }
.trow-h:hover { background: var(--surface-3); }
.rank { font: 600 12px "JetBrains Mono", monospace; color: var(--muted); }
.trow .nm { font-weight: 600; font-size: 13.5px; }
.trow .tags { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }
.mitre { font: 500 10.5px "JetBrains Mono", monospace; padding: 2px 6px; border-radius: 5px; background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); }
.score-pair { text-align: right; font-variant-numeric: tabular-nums; }
.score-pair .r { font-weight: 700; font-size: 16px; }
.score-pair .i { font-size: 11px; color: var(--muted); }
.trow-b { display: none; padding: 0 14px 14px 60px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.trow.open .trow-b { display: block; }
.pk-box { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); display: flex; gap: 10px; align-items: flex-start; border: 1px solid color-mix(in oklab, var(--accent) 22%, transparent); }
.pk-box b { color: var(--ink); }
.pk { flex: none; font: 700 10px/1 "JetBrains Mono", monospace; letter-spacing: .06em; padding: 4px 5px; border-radius: 4px; background: #01411c; color: #fff; box-shadow: inset 4px 0 0 #fff; padding-left: 9px; margin-top: 1px; }

/* =========================================================================
   Attack paths
   ========================================================================= */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 8px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); font-weight: 600; font-size: 13px; color: var(--ink-2); }
.tab.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.chain-svg { width: 100%; height: auto; display: block; }
.chain-node rect { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.2; }
.chain-node.blocked rect { stroke: var(--good); stroke-width: 2; }
.chain-node.dead { opacity: .32; }
.chain-node .tac { font-size: 10px; fill: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.chain-node .nm { font-size: 12.5px; fill: var(--ink); font-weight: 600; }
.chain-node .mt { font: 500 10.5px "JetBrains Mono", monospace; fill: var(--accent); }
.chain-link { stroke: var(--border-strong); stroke-width: 2; fill: none; }
.chain-link.hot { stroke: var(--critical); stroke-dasharray: 6 6; animation: dash 1s linear infinite; }
@keyframes dash { to { stroke-dashoffset: -12; } }
.verdict { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; border: 1px solid var(--border); }
.verdict.bad { background: color-mix(in oklab, var(--critical) 12%, var(--surface)); border-color: color-mix(in oklab, var(--critical) 40%, transparent); }
.verdict.ok { background: color-mix(in oklab, var(--good) 10%, var(--surface)); border-color: color-mix(in oklab, var(--good) 40%, transparent); }
.verdict .ic { font-size: 26px; }
.verdict b { font-size: 15px; }
.step-list { display: flex; flex-direction: column; gap: 8px; }
.step { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.step .no { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 600 12px "JetBrains Mono", monospace; background: var(--surface-3); }
.step.blocked { border-color: color-mix(in oklab, var(--good) 50%, transparent); }
.step.blocked .no { background: var(--good); color: #fff; }
.step .ctrls { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.ctl-btn { font-size: 11.5px; padding: 4px 9px; border-radius: 8px; border: 1px dashed var(--border-strong); background: none; color: var(--ink-2); }
.ctl-btn.on { border-style: solid; border-color: var(--good); color: var(--ink); background: color-mix(in oklab, var(--good) 12%, transparent); }
.ctl-btn.on::before { content: '⛨ '; color: var(--good); }

/* =========================================================================
   Actors
   ========================================================================= */
.actor { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.actor::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--c); }
.actor-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.actor-h h3 { margin: 0; font-size: 16px; }
.soph { display: flex; gap: 3px; }
.soph i { width: 14px; height: 6px; border-radius: 2px; background: var(--surface-3); }
.soph i.on { background: var(--ink-2); }
.kv { display: grid; grid-template-columns: 90px 1fr; gap: 4px 10px; font-size: 12.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; color: var(--ink); }
.linked { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 10px; }
.linked .li { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; }

/* =========================================================================
   Security controls
   ========================================================================= */
.hero-nums { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.hero-nums .hn .n { font-family: var(--display); font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-nums .hn .l { font-size: 12px; color: var(--muted); margin-top: 6px; }
.hero-nums .arrow { font-size: 26px; color: var(--muted); }
.delta-good { color: var(--good-ink); font-weight: 700; }
.ctl-group h4 { margin: 14px 0 8px; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.ctl-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 6px; }
.ctl-row .nm { font-size: 13px; font-weight: 500; }
.ctl-row .meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.switch { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: background .2s; flex: none; padding: 0; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .2s, background .2s; }
.switch.on { background: var(--accent); border-color: transparent; }
.switch.on::after { transform: translateX(18px); background: var(--accent-ink); }
.reco { display: flex; flex-direction: column; gap: 8px; }
.reco-item { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent); background: var(--accent-soft); }
.reco-item .no { font: 700 13px "JetBrains Mono", monospace; color: var(--accent); }
.reco-item .nm { font-weight: 600; font-size: 13px; }
.reco-item .meta { font-size: 11.5px; color: var(--ink-2); }
.pair-bars { display: flex; flex-direction: column; gap: 9px; }
.pb { display: grid; grid-template-columns: 150px 1fr 70px; gap: 10px; align-items: center; font-size: 12.5px; }
.pb .name { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb .track { position: relative; height: 10px; border-radius: 4px; background: var(--surface-3); }
.pb .inh { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; background: color-mix(in oklab, var(--muted) 40%, transparent); transition: width .8s; }
.pb .res { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; transition: width .8s cubic-bezier(.2,.8,.2,1), background .3s; box-shadow: 2px 0 0 var(--surface); }
.pb .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.pb .v span { color: var(--muted); font-weight: 400; }
.legend-row { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-bottom: 12px; flex-wrap: wrap; }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.legend-row i { width: 14px; height: 8px; border-radius: 2px; display: inline-block; }

/* Compliance */
.fw { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.fw-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.fw-h b { font-size: 14px; }
.fw-h .pct { font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.fw .full { font-size: 11.5px; color: var(--muted); margin: 2px 0 10px; }
.fw .track { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.fw .fill { height: 100%; border-radius: 0 4px 4px 0; transition: width 1s cubic-bezier(.2,.8,.2,1); }
.fw .gaps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.gap { font-size: 11px; padding: 3px 8px; border-radius: 6px; background: color-mix(in oklab, var(--critical) 12%, transparent); color: var(--ink); cursor: pointer; border: 0; }
.gap:hover { background: color-mix(in oklab, var(--critical) 22%, transparent); }
.gap.ok { background: color-mix(in oklab, var(--good) 14%, transparent); cursor: default; }

/* =========================================================================
   Drawer / chat
   ========================================================================= */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); z-index: 60;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -20px 0 60px rgba(0,0,0,.3);
  transform: translateX(105%); transition: transform .35s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 18px; border-bottom: 1px solid var(--border); }
.chat { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.msg { max-width: 92%; padding: 10px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 4px; }
.msg.ai { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg.ai ul { margin: 6px 0 0; padding-left: 18px; }
.msg.ai .who { font-size: 11px; color: var(--accent); font-weight: 700; margin-bottom: 3px; letter-spacing: .04em; }
.typing span { display: inline-block; width: 6px; height: 6px; margin-right: 3px; border-radius: 50%; background: var(--muted); animation: bounce 1s infinite; }
.typing span:nth-child(2) { animation-delay: .15s; } .typing span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 50% { transform: translateY(-4px); opacity: .4; } }
#chatChips { padding: 0 18px 10px; }
.chat-form { display: flex; gap: 8px; padding: 14px 18px 18px; border-top: 1px solid var(--border); }
.chat-form input { flex: 1; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--ink); font: inherit; }
.chat-form input:focus { outline: 2px solid color-mix(in oklab, var(--accent) 50%, transparent); }

/* Tooltip & toast */
.tooltip {
  position: fixed; z-index: 100; pointer-events: none; opacity: 0; transition: opacity .12s;
  background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 9px 11px; font-size: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); max-width: 280px;
}
.tooltip.show { opacity: 1; }
.tooltip .tt-h { font-weight: 700; margin-bottom: 4px; }
.tooltip .tt-r { display: flex; justify-content: space-between; gap: 14px; color: var(--ink-2); }
.tooltip .tt-r b { color: var(--ink); font-variant-numeric: tabular-nums; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; z-index: 90;
  background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  transition: all .3s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ic { font-size: 34px; margin-bottom: 8px; }

/* Report modal */
.report { display: none; position: fixed; inset: 0; z-index: 80; background: rgba(0,0,0,.55); backdrop-filter: blur(4px);
  padding: max(24px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.report.open { display: grid; place-items: start center; }
.report-card { width: min(860px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.4); animation: rise .35s; }
.report-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); border-radius: 16px 16px 0 0; }
.report-body { padding: 8px 22px 24px; font-size: 13px; color: var(--ink-2); overflow-x: auto; }
.report-body h1 { font-size: 20px; color: var(--ink); margin: 14px 0 4px; text-wrap: balance; }
.report-body h2 { font-size: 14px; color: var(--ink); margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--accent); }
.report-body b { color: var(--ink); }
.report-body .meta { color: var(--muted); font-size: 12px; }
.report-body table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.report-body th, .report-body td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.report-body th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}


/* =========================================================================
   Refinements & Command Center v2
   ========================================================================= */
.icon { display: block; flex: none; }
.btn .icon, .ghost-btn .icon { margin-right: -2px; }
.ghost-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.nav-label { font-size: 10.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .12em; padding: 14px 12px 6px; }
.nav-label:first-child { padding-top: 4px; }
.nav-badge { margin-left: auto; font: 600 10.5px/1 "JetBrains Mono", monospace; padding: 4px 6px; border-radius: 6px; background: color-mix(in oklab, var(--critical) 22%, transparent); color: var(--ink); }
.shift { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); }
.avatar { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; font: 700 10px var(--display); letter-spacing: .06em; background: var(--accent-soft); color: var(--accent); border: 1px solid color-mix(in oklab, var(--accent) 30%, transparent); }
.shift-n { font-size: 12.5px; font-weight: 600; }
.shift-s { font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot-ok { width: 6px; height: 6px; border-radius: 50%; background: var(--good); }
.crumb-i { display: inline-flex; align-items: center; gap: 5px; }
.crumb-i .icon { color: var(--accent); }
.search { flex: 1; max-width: 420px; margin-left: 12px; display: flex; align-items: center; gap: 8px; padding: 0 10px; height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--muted); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 15%, transparent); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; color: var(--ink); font: inherit; font-size: 13px; }
.search kbd { font: 500 11px "JetBrains Mono", monospace; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-strong); color: var(--muted); }
.tab { display: inline-flex; align-items: center; gap: 8px; }
.tab-st.ok { color: var(--good); } .tab-st.bad { color: var(--critical); }
.tab.on .tab-st { color: inherit; }
.verdict .ic { display: grid; place-items: center; }
.verdict.ok .ic { color: var(--good); } .verdict.bad .ic { color: var(--critical); }
.empty .ic { display: grid; place-items: center; color: var(--accent); }
.inst .ic { color: var(--accent); }

/* advisory */
.advisory { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px;
  background: linear-gradient(90deg, color-mix(in oklab, var(--critical) 16%, var(--surface)), var(--surface) 70%);
  border: 1px solid color-mix(in oklab, var(--critical) 35%, var(--border)); }
.adv-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--critical); background: color-mix(in oklab, var(--critical) 16%, transparent); }
.adv-body { flex: 1; min-width: 0; }
.adv-t { font-size: 13.5px; line-height: 1.45; }
.adv-m { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* KPI strip */
.kpis { display: grid; grid-template-columns: 1.15fr repeat(5, minmax(0, 1fr)); gap: 12px; }
.kpis .kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; min-width: 0; box-shadow: var(--shadow); }
.kpi-l { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi-n { font: 600 24px/1.15 var(--display); letter-spacing: -.01em; white-space: nowrap; }
.kpi-n small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 1px; }
.kpi-f { font-size: 11.5px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.kpi-f .up { color: var(--critical); font-weight: 600; }
.kpi-f .down { color: var(--good-ink); font-weight: 600; }
.spark { width: 100%; height: 30px; display: block; }
.kpi-gauge { background: radial-gradient(120% 120% at 0% 0%, color-mix(in oklab, var(--lvl) 18%, transparent), transparent 60%), var(--surface) !important; }
.kg { position: relative; height: 74px; }
.gauge { width: 136px; height: 79px; display: block; }
.kg-v { position: absolute; left: 0; width: 136px; bottom: 4px; text-align: center; font: 700 24px/1 var(--display); }
.kg-v small { font-size: 11px; color: var(--muted); font-weight: 500; }
.sevbar { display: flex; gap: 2px; height: 8px; margin: 10px 0 6px; }
.sevbar i { border-radius: 2px; min-width: 3px; cursor: default; }
.sevleg { gap: 10px; color: var(--ink-2); }
.sevleg span { display: inline-flex; align-items: center; gap: 4px; }
.sevleg i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }

/* main grid */
.cc-main { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 16px; }
.cc-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; font-size: 12px; font-weight: 600; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.seg button i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.map-stage { display: grid; grid-template-columns: minmax(0, 1fr) 230px; gap: 14px; align-items: start; }
.map-wrap { position: relative; border-radius: 12px; background: radial-gradient(70% 60% at 55% 45%, color-mix(in oklab, var(--accent) 7%, transparent), transparent 70%); }
.graticule line { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; }
.map-outline { fill: none; stroke: var(--map-stroke); stroke-width: 2.2; opacity: .75; filter: drop-shadow(0 0 10px color-mix(in oklab, var(--map-stroke) 45%, transparent)); }
.prov { fill: var(--map-land); stroke: var(--map-prov); stroke-width: 1; transition: fill .2s; }
.prov:hover { fill: color-mix(in oklab, var(--map-stroke) 14%, var(--map-land)); }
.prov-label { font: 600 9.5px var(--display); letter-spacing: .22em; fill: var(--muted); opacity: .75; pointer-events: none; }
.src circle:first-child { fill: var(--ink-2); }
.src-ring { fill: none; stroke: var(--ink-2); stroke-width: 1; opacity: .4; }
.src-label { font: 600 9.5px "JetBrains Mono", monospace; letter-spacing: .06em; fill: var(--ink-2); }
.src-sub { font: 500 9px "JetBrains Mono", monospace; fill: var(--muted); }
.city-core { fill: var(--ink); stroke: var(--surface); stroke-width: 1.5; }
.city-label { font: 600 11px Inter, sans-serif; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.city-sel { fill: none; stroke: var(--accent); stroke-width: 1.6; opacity: 0; transition: opacity .2s; stroke-dasharray: 3 3; }
.city.sel .city-sel { opacity: 1; animation: spin 8s linear infinite; transform-box: fill-box; transform-origin: center; }
.city.sel .city-core { fill: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }
.arc { stroke-width: 1.5; opacity: .9; }
.hud { position: absolute; left: 10px; top: 10px; padding: 9px 12px; border-radius: 10px; background: color-mix(in oklab, var(--surface) 82%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--border); font-size: 11.5px; display: flex; flex-direction: column; gap: 4px; }
.hud-row { display: flex; align-items: center; gap: 6px; }
.hud-row b { font: 600 15px var(--display); color: var(--ink); }
.city-panel { border: 1px solid var(--border); background: var(--surface-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 8px; animation: rise .35s; }
.cp-h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cp-name { font: 600 17px var(--display); }
.cp-num { display: flex; align-items: baseline; gap: 6px; }
.cp-num .tnum { font: 700 26px var(--display); }
.cp-spark .spark { height: 36px; }
.cp-sub { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; margin-top: 4px; }
.cp-bar { display: grid; grid-template-columns: 1fr 60px 32px; gap: 8px; align-items: center; font-size: 12px; color: var(--ink-2); }
.cp-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-bar .track { height: 5px; border-radius: 3px; background: var(--surface-3); }
.cp-bar .track div { height: 100%; border-radius: 0 3px 3px 0; background: var(--cat-2); }
.cp-bar b { text-align: right; font-size: 11.5px; color: var(--ink); }
.cp-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 4px; }
.cp-foot div { display: flex; flex-direction: column; }
.cp-foot b { font: 600 16px var(--display); }
.cp-foot span { font-size: 11px; color: var(--muted); }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; }

.evt { width: 100%; height: auto; display: block; }
.evt .grid-l { stroke: var(--border); }
.evt .base-l { stroke: var(--border-strong); }
.evt .axis-t { font-size: 9.5px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.evt g:hover rect:not([fill="transparent"]) { filter: brightness(1.25); }
.hbars.tight { gap: 9px; }
.hbars.tight .hbar { grid-template-columns: 130px 1fr 44px; font-size: 12.5px; }

/* alert table */
.table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
.alerts { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.alerts th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.alerts th:first-child, .alerts td:first-child { padding-left: 18px; }
.alerts td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.alerts td:nth-child(3) { white-space: normal; min-width: 240px; }
.alerts tbody tr { transition: background .2s; }
.alerts tbody tr:hover { background: var(--surface-2); }
.alerts tr.fresh { animation: flash 1.8s ease-out; }
@keyframes flash { 0% { background: color-mix(in oklab, var(--accent) 18%, transparent); } 100% { background: transparent; } }
.al-t { font-weight: 500; color: var(--ink); line-height: 1.35; }
.al-s { font-size: 11px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 6px; }
.type-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.status.st-new::before { background: var(--cat-1); box-shadow: 0 0 0 3px color-mix(in oklab, var(--cat-1) 25%, transparent); }
.status.st-tri::before { background: var(--warning); }
.status.st-esc::before { background: var(--critical); }
.status.st-ok::before { background: var(--good); }

.infra, .telemetry { display: flex; flex-direction: column; }
.infra-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.infra-row:last-child, .tel-row:last-child { border-bottom: 0; }
.infra-row .mono { font-size: 12px; }
.tel-row { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.tel-ic { color: var(--muted); }
.tel-n { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


/* =========================================================================
   Command Center v3 — hero map + live coverage rail
   ========================================================================= */
.cc-hero { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 16px; height: calc(100vh - 104px); min-height: 640px; }
.map-hero { padding: 0; display: flex; flex-direction: column; overflow: hidden; background: var(--map-bg); border-color: color-mix(in oklab, var(--accent) 16%, var(--border)); }
.mh-top { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid var(--border); background: color-mix(in oklab, var(--surface) 70%, transparent); position: relative; z-index: 2; }
.mh-title { display: flex; align-items: center; gap: 10px; flex: none; }
.mh-title h3 { margin: 0; font: 600 16px var(--display); }
.mh-adv { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 10px 6px 6px; border-radius: 10px; text-align: left;
  border: 1px solid color-mix(in oklab, var(--critical) 35%, transparent); background: color-mix(in oklab, var(--critical) 10%, transparent); }
.mh-adv:hover { background: color-mix(in oklab, var(--critical) 16%, transparent); }
.adv-dot { width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center; color: var(--critical); background: color-mix(in oklab, var(--critical) 18%, transparent); flex: none; animation: blink 2s infinite; }
.mh-adv-t { flex: 1; min-width: 0; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
.mh-adv-t b { color: var(--critical); margin-right: 6px; text-transform: uppercase; font-size: 11px; letter-spacing: .08em; }
.mh-adv-go { font-size: 12px; font-weight: 600; color: var(--ink); flex: none; }

.map-hero .map-wrap { flex: 1; min-height: 0; position: relative; border-radius: 0;
  background:
    radial-gradient(60% 55% at 52% 48%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 70%),
    radial-gradient(120% 90% at 50% 50%, transparent 55%, color-mix(in oklab, #000 35%, transparent)); }
.map-hero .map-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.arc-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.m-shadow { fill: var(--map-shadow); }
.m-ext { fill: var(--map-side); stroke: color-mix(in oklab, var(--map-stroke) 30%, transparent); stroke-width: .6; }
.map-hero .map-outline { fill: none; stroke: var(--map-stroke); stroke-width: 1.8; opacity: .9; filter: none; }
.map-hero .prov { fill: color-mix(in oklab, var(--heat) var(--h), var(--map-land)); stroke: var(--map-prov); stroke-width: 1; cursor: default; }
.map-hero .prov:hover { fill: color-mix(in oklab, var(--heat) calc(var(--h) + 10%), var(--map-land)); }
.sweep { animation: sweep 7s linear infinite; transform-box: view-box; }
@keyframes sweep { to { transform: rotate(360deg); } }
.src path { fill: var(--ink-2); }
.spike { pointer-events: none; transition: fill .3s; }
.spike-cap { fill: var(--critical); filter: drop-shadow(0 0 4px var(--critical)); }
.city.sel .spike-cap { fill: var(--accent); filter: drop-shadow(0 0 5px var(--accent)); }
/* values appear on hover / selection only */
.spike-v { opacity: 0; transition: opacity .2s; }
.city:hover .spike-v, .city.sel .spike-v { opacity: 1; }
.spike-v { font: 600 10px "JetBrains Mono", monospace; fill: var(--ink); paint-order: stroke; stroke: var(--map-bg); stroke-width: 3px; pointer-events: none; }
.city-ring { stroke: var(--critical); }
.city.hit .spike-cap { animation: capHit .6s ease-out; }
@keyframes capHit { 0% { r: 2; } 40% { r: 5; } 100% { r: 2; } }
.city-sel { stroke-dasharray: none; }
.city.sel .city-sel { animation: none; opacity: 1; }
.map-hero .city-label { stroke: var(--map-bg); }

.hb { position: absolute; width: 18px; height: 18px; border-color: color-mix(in oklab, var(--accent) 55%, transparent); border-style: solid; pointer-events: none; }
.hb.tl { top: 12px; left: 12px; border-width: 1.5px 0 0 1.5px; } .hb.tr { top: 12px; right: 12px; border-width: 1.5px 1.5px 0 0; }
.hb.bl { bottom: 12px; left: 12px; border-width: 0 0 1.5px 1.5px; } .hb.br { bottom: 12px; right: 12px; border-width: 0 1.5px 1.5px 0; }

.mh-stats { position: absolute; left: 24px; top: 22px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.ms-big { display: flex; align-items: baseline; gap: 8px; }
.ms-big b { font: 700 40px/1 var(--display); letter-spacing: -.02em; color: var(--ink); text-shadow: 0 0 24px color-mix(in oklab, var(--accent) 40%, transparent); }
.ms-big span { font-size: 12px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }
.ms-row { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.ms-row b { color: var(--ink); font-weight: 600; }
.ms-leg { display: flex; gap: 12px; font-size: 11.5px; color: var(--ink-2); margin-top: 4px; flex-wrap: wrap; }
.ms-leg span { display: inline-flex; align-items: center; gap: 6px; }
.ms-leg i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 8px currentColor; }
.ms-leg .spike-i { width: 3px; height: 12px; border-radius: 2px; background: linear-gradient(to top, var(--critical), transparent); box-shadow: none; }

.city-brief { position: absolute; right: 22px; bottom: 22px; width: 248px; padding: 14px; border-radius: 14px; display: flex; flex-direction: column; gap: 8px;
  background: color-mix(in oklab, var(--surface) 80%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-strong); box-shadow: 0 20px 50px rgba(0,0,0,.35); }
.city-brief.pop { animation: rise .35s cubic-bezier(.2,.8,.2,1); }
.cb-h { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.cb-name { font: 600 17px var(--display); }
.cb-prov { font-size: 11.5px; color: var(--muted); }
.cb-num { display: flex; align-items: baseline; gap: 6px; }
.cb-num b { font: 700 26px var(--display); }
.cb-num span { font-size: 11.5px; color: var(--muted); }
.city-brief .spark { height: 30px; }
.cb-bar { display: grid; grid-template-columns: 1fr 56px 30px; gap: 8px; align-items: center; font-size: 11.5px; color: var(--ink-2); }
.cb-bar span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cb-bar .track { height: 4px; border-radius: 2px; background: var(--surface-3); }
.cb-bar .track div { height: 100%; border-radius: 0 2px 2px 0; background: var(--cat-2); }
.cb-bar b { text-align: right; color: var(--ink); }
.cb-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); padding-top: 8px; }
.cb-foot b { color: var(--ink); font-size: 12.5px; }

.mh-ticker { display: flex; align-items: center; gap: 12px; height: 38px; padding: 0 14px; border-top: 1px solid var(--border); background: color-mix(in oklab, var(--surface) 70%, transparent); overflow: hidden; position: relative; z-index: 2; }
.tk-l { display: inline-flex; align-items: center; gap: 7px; font: 600 10.5px "JetBrains Mono", monospace; letter-spacing: .1em; color: var(--ink-2); flex: none; }
.tk-items { flex: 1; min-width: 0; display: flex; gap: 22px; overflow: hidden; mask-image: linear-gradient(90deg, #000 85%, transparent); }
.tk-i { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); white-space: nowrap; animation: tkIn .5s cubic-bezier(.2,.8,.2,1); }
@keyframes tkIn { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
.tk-i i { width: 7px; height: 7px; border-radius: 50%; }
.tk-i b { color: var(--ink); font-weight: 600; }
.tk-i .mono { font-size: 11px; }
.tk-arrow { color: var(--muted); }
.tk-i em { font-style: normal; color: var(--good-ink); font-weight: 600; }
.tk-i time { color: var(--muted); font-size: 11px; }
.tk-src { font-size: 10.5px; flex: none; }

/* rail */
.rail { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.rail-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 14px 16px 10px; }
.rail-h h3 { margin: 0; font: 600 16px var(--display); }
.rail-h .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rail-tabs { display: flex; gap: 2px; padding: 0 10px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.rail-tabs button { position: relative; border: 0; background: none; padding: 9px 9px 11px; font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.rail-tabs button:hover { color: var(--ink); }
.rail-tabs button.on { color: var(--ink); }
.rail-tabs button.on::after { content: ''; position: absolute; left: 8px; right: 8px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }
.al-badge { font: 700 10px/1 "JetBrains Mono", monospace; padding: 3px 5px; border-radius: 5px; background: var(--critical); color: #fff; }
.rail-body { flex: 1; min-height: 0; overflow-y: auto; padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 14px; animation: rise .3s; }
.rs-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.rs-h .muted { font-weight: 400; font-size: 11px; }
.rs-l { font-size: 10.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.rail-sec { border-top: 1px solid var(--border); padding-top: 12px; }
.link-btn { border: 0; background: none; color: var(--accent); font-size: 12px; font-weight: 600; padding: 0; }
.ov-level { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 12px; border: 1px solid var(--border);
  background: radial-gradient(120% 140% at 0% 0%, color-mix(in oklab, var(--lvl) 20%, transparent), transparent 65%), var(--surface-2); }
.ov-level .kg { height: 66px; flex: none; }
.ov-level .gauge { width: 116px; height: 68px; }
.ov-level .kg-v { width: 116px; bottom: 2px; font-size: 22px; }
.ov-lv { font: 700 22px/1.1 var(--display); margin: 2px 0; }
.mini-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mk { padding: 10px 11px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.mk-n { font: 600 18px/1.15 var(--display); white-space: nowrap; }
.mk-n small { font: 600 10.5px Inter, sans-serif; margin-left: 4px; }
.mk-n .up { color: var(--critical); }
.mk .spark { height: 22px; }
.mk .sevbar { margin: 6px 0 2px; height: 6px; }
.sevbar.big { height: 10px; margin: 4px 0 8px; }
.ov-foot { display: flex; gap: 12px; font-size: 12px; color: var(--muted); flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 12px; }
.ov-foot b { color: var(--ink); }
.ov-foot .down { color: var(--good-ink); font-weight: 600; margin-left: auto; }
.rail .hbars.tight .hbar { grid-template-columns: 128px 1fr 40px; font-size: 12px; }
.rail .lc svg { width: 100%; height: auto; }
.al-list { display: flex; flex-direction: column; gap: 6px; }
.al { display: grid; grid-template-columns: 3px 1fr auto; gap: 10px; align-items: center; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); }
.al.fresh { animation: slideIn .5s cubic-bezier(.2,.8,.2,1), flash 2s ease-out; }
.al-bar { align-self: stretch; border-radius: 3px; }
.al-main { min-width: 0; }
.al .al-t { font-size: 12.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.al .al-s { margin-top: 2px; }
.al-r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.al-r time { font-size: 11px; color: var(--muted); }
.al-r .status { font-size: 11px; }
.rail .infra-row { font-size: 12px; }
.rail .tel-row { grid-template-columns: 20px 1fr auto auto; font-size: 12px; }

@media (max-width: 1180px) {
  .cc-hero { grid-template-columns: 1fr; height: auto; }
  .map-hero .map-wrap { flex: none; aspect-ratio: 7 / 6; }
  .rail-body { max-height: none; }
}
@media (max-width: 720px) {
  .mh-top { flex-wrap: wrap; }
  .mh-adv { order: 3; flex-basis: 100%; }
  .mh-stats { left: 14px; top: 12px; }
  .ms-big b { font-size: 28px; }
  .ms-row, .ms-leg { display: none; }
  .city-brief { position: static; width: auto; margin: 0; border-radius: 0; border-width: 1px 0 0; box-shadow: none; backdrop-filter: none; }
  .map-hero .map-wrap { aspect-ratio: auto; display: flex; flex-direction: column; }
  .map-hero .map-svg { position: relative; inset: auto; aspect-ratio: 7 / 6; height: auto; }
  .arc-canvas { height: auto; bottom: auto; aspect-ratio: 7 / 6; }
  .hb, .tk-src { display: none; }
}


/* =========================================================================
   Living graphs — swarm, constellation, attack graph, adversary network
   ========================================================================= */
.split-view { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.split-view .rail { position: sticky; top: 92px; max-height: calc(100vh - 108px); }
.graph-card { display: flex; flex-direction: column; overflow: hidden; background:
  radial-gradient(70% 60% at 50% 50%, color-mix(in oklab, var(--accent) 6%, transparent), transparent 70%), var(--surface); }
.graph-wrap { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; }
.graph-wrap > svg { width: 100%; height: auto; display: block; overflow: visible; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.side-panel { border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); padding: 14px; }
.side-panel.pop, #entPanel.pop { animation: rise .35s cubic-bezier(.2,.8,.2,1); }
.fdot { pointer-events: none; }
.gi .icon, .an-i .icon, .ag-i .icon { display: block; }

/* hover / focus dimming */
.g-dim [data-n]:not(.hl), .g-dim [data-e]:not(.hl) { opacity: .1; }
.g-focus [data-n]:not(.fo), .g-focus [data-e]:not(.fo) { opacity: .16; }
[data-n], [data-e] { transition: opacity .25s; }
.gn { cursor: pointer; }

/* --- agent swarm --- */
.swarm-card { display: flex; flex-direction: column; }
.swarm-wrap { position: relative; margin: -4px -6px 6px; }
.swarm { width: 100%; height: auto; display: block; overflow: visible; }
.sw-orbit { fill: none; stroke: var(--border-strong); stroke-dasharray: 2 6; }
.sw-orbit.o2 { stroke: var(--border); animation: dash 3s linear infinite; }
.sw-ring { fill: none; stroke: color-mix(in oklab, var(--accent) 22%, transparent); stroke-width: 1; stroke-dasharray: 4 6; animation: dash 2.4s linear infinite; }
.sw-spoke { stroke: color-mix(in oklab, var(--accent) 18%, transparent); stroke-width: 1; fill: none; }
.orch-c { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.orch-ring { fill: none; stroke: var(--accent); stroke-width: 1; stroke-dasharray: 3 5; opacity: .6; transform-box: fill-box; transform-origin: center; animation: spin 14s linear infinite; }
.orch.run .orch-ring { animation-duration: 2.5s; opacity: 1; }
.orch-glow { animation: breathe 3s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.orch.run .orch-glow { animation-duration: .9s; }
@keyframes breathe { 50% { transform: scale(1.12); opacity: .7; } }
.orch-i { color: var(--accent); }
.orch-t { font: 700 8.5px var(--display); letter-spacing: .2em; fill: var(--accent); }
.ag-c { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.4; transition: stroke .3s, fill .3s; }
.ag-i { color: var(--muted); transition: color .3s; }
.ag-prog { fill: none; stroke: var(--accent); stroke-width: 2; stroke-dasharray: 40 150; opacity: 0; transform-box: fill-box; transform-origin: center; }
.ag-n { font: 600 11px Inter, sans-serif; fill: var(--ink-2); }
.ag-o { font-size: 10px; fill: var(--accent); font-weight: 600; }
.ag.run .ag-prog { opacity: 1; animation: spin 1s linear infinite; }
.ag.run .ag-c { stroke: var(--accent); fill: color-mix(in oklab, var(--accent) 12%, var(--surface-2)); }
.ag.run .ag-i, .ag.done .ag-i { color: var(--accent); }
.ag.run .ag-n, .ag.done .ag-n { fill: var(--ink); }
.ag.done .ag-c { stroke: color-mix(in oklab, var(--accent) 60%, transparent); }
.pkt { pointer-events: none; }
.console.mini { height: 150px; font-size: 11.5px; padding: 10px 12px; }
.ag-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.ag-dot.run { background: var(--accent); animation: ping 1.2s infinite; }
.ag-dot.ok { background: var(--good); }
#swarmState { gap: 7px; }

/* --- constellation --- */
.const { width: 100%; height: auto; max-height: 640px; }
.c-orbit { fill: none; stroke: var(--border-strong); stroke-dasharray: 2 6; }
.c-orbit.o2 { stroke: color-mix(in oklab, var(--accent) 30%, transparent); }
.c-orbit.o3 { stroke: color-mix(in oklab, var(--accent) 16%, transparent); stroke-dasharray: 1 10; stroke-width: 2; }
.c-rot { animation: spin 60s linear infinite; transform-box: view-box; }
.c-spoke { stroke: color-mix(in oklab, var(--accent) 22%, transparent); stroke-width: 1; }
.ce { fill: none; stroke-width: 1.1; opacity: .35; }
.ce.critical, .ce.serious { opacity: .55; stroke-width: 1.4; }
.c-core { fill: var(--surface); stroke: var(--accent); stroke-width: 1.6; }
.c-ci { color: var(--accent); }
.c-ct { font: 700 8.5px var(--display); letter-spacing: .16em; fill: var(--accent); }
.ca-c { fill: var(--accent); }
.ca-r { fill: none; stroke: var(--accent); opacity: .35; }
.ca-l { font: 600 11px Inter, sans-serif; fill: var(--ink-2); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.c-asset.off .ca-c { fill: var(--muted); } .c-asset.off { opacity: .45; }
.ct-c { stroke: var(--surface); stroke-width: 2; transition: transform .2s; transform-box: fill-box; transform-origin: center; }
.c-thr:hover .ct-c { transform: scale(1.15); }
.ct-id { font: 700 8.5px "JetBrains Mono", monospace; fill: #fff; pointer-events: none; }
.c-thr.warning .ct-id { fill: #0b0b0b; }
.ct-l { font: 600 11px Inter, sans-serif; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.ct-pulse { fill: none; stroke-width: 1.5; transform-box: fill-box; transform-origin: center; animation: ring 2.4s ease-out infinite; }
.ct-sel { fill: none; stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 3 3; opacity: 0; transform-box: fill-box; transform-origin: center; }
.c-thr.sel .ct-sel { opacity: 1; animation: spin 6s linear infinite; }

/* --- shared detail panel --- */
.tp { display: flex; flex-direction: column; gap: 10px; }
.tp-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.tp-n { font: 600 17px/1.3 var(--display); text-wrap: balance; }
.tp-d { margin: 0; font-size: 13px; color: var(--ink-2); line-height: 1.55; }
.tp-scores { display: flex; gap: 18px; flex-wrap: wrap; }
.tp-scores div { display: flex; flex-direction: column; }
.tp-scores b { font: 600 18px var(--display); }
.tp-scores span { font-size: 11px; color: var(--muted); }
.tp-bar { position: relative; height: 8px; border-radius: 4px; background: var(--surface-3); }
.tp-bar .inh, .tp-bar .res { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; }
.tp-bar .inh { background: color-mix(in oklab, var(--muted) 40%, transparent); }
.tp-bar .res { box-shadow: 2px 0 0 var(--surface-2); }
.tp .tags { display: flex; gap: 5px; flex-wrap: wrap; }
.tp .kv { grid-template-columns: 80px 1fr; }
.tp .ctrls { display: flex; flex-wrap: wrap; gap: 6px; }
.tp .pk-box { margin-top: 0; }
.mini-list { display: flex; flex-direction: column; gap: 4px; }
.ml { display: grid; grid-template-columns: 8px 1fr auto 36px; gap: 8px; align-items: center; padding: 7px 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); text-align: left; font-size: 12.5px; }
.ml:hover { border-color: var(--border-strong); }
.ml .dot { width: 8px; height: 8px; border-radius: 50%; }
.ml b { text-align: right; }
.jewel { font-size: 11.5px; padding: 4px 9px; border-radius: 999px; background: color-mix(in oklab, var(--critical) 14%, transparent); border: 1px solid color-mix(in oklab, var(--critical) 30%, transparent); }
.soph.big i { width: 22px; height: 7px; }

/* --- attack graph --- */
.ag-wrap { padding: 4px 6px 8px; }
.agraph .lane { fill: color-mix(in oklab, var(--surface-2) 55%, transparent); stroke: var(--border); }
.agraph .lane.obj { fill: color-mix(in oklab, var(--critical) 5%, var(--surface-2)); stroke: color-mix(in oklab, var(--critical) 18%, var(--border)); }
.col-h { font: 600 10px var(--display); letter-spacing: .14em; fill: var(--muted); }
.ge-base { fill: none; stroke: var(--border-strong); stroke-width: 1.2; }
.ge.hot .ge-base { stroke: color-mix(in oklab, var(--critical) 45%, transparent); stroke-width: 1.6; }
.ge-flow { fill: none; stroke: var(--critical); stroke-width: 1.6; stroke-dasharray: 3 9; animation: dash .9s linear infinite; opacity: .8; }
.ge.cut .ge-base { stroke: color-mix(in oklab, var(--good) 45%, transparent); stroke-dasharray: 4 5; }
.ge.cold .ge-base { opacity: .45; }
.ge.breach .ge-base { stroke: var(--critical); stroke-width: 3; filter: drop-shadow(0 0 6px var(--critical)); }
.an-bg { fill: var(--surface-2); stroke: var(--border-strong); stroke-width: 1.4; transition: stroke .3s, fill .3s; }
.an-halo { fill: none; stroke: transparent; }
.an-glow { fill: none; stroke: transparent; stroke-width: 2; }
.an-i { color: var(--ink-2); }
.an-l { font: 600 11px Inter, sans-serif; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.an-m { font: 500 9.5px "JetBrains Mono", monospace; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.an.hot .an-bg { stroke: var(--critical); fill: color-mix(in oklab, var(--critical) 16%, var(--surface-2)); }
.an.hot .an-i { color: var(--critical); }
.an.hot .an-halo { stroke: color-mix(in oklab, var(--critical) 40%, transparent); stroke-dasharray: 2 4; transform-box: fill-box; transform-origin: center; animation: spin 10s linear infinite; }
.an.blk .an-bg { stroke: var(--good); fill: color-mix(in oklab, var(--good) 14%, var(--surface-2)); }
.an.blk .an-i { color: var(--good); }
.an.cold { opacity: .45; }
.an-sh circle { fill: var(--good); stroke: var(--surface); stroke-width: 2; }
.an-shi { color: #fff; }
.an.sel .an-glow { stroke: var(--ink); stroke-dasharray: 3 3; }
.an.vis .an-glow { stroke: var(--cat-1); stroke-width: 2.5; filter: drop-shadow(0 0 6px var(--cat-1)); }
.an.breach .an-bg { stroke-width: 2.4; }
.an.breach .an-glow { stroke: var(--critical); stroke-width: 2.5; filter: drop-shadow(0 0 8px var(--critical)); animation: blink 1.4s infinite; }
.an.denied .an-glow { stroke: var(--good); stroke-width: 3.5; filter: drop-shadow(0 0 10px var(--good)); }
.an:hover .an-bg { stroke-width: 2.2; }
.orb { pointer-events: none; opacity: 0; transition: opacity .3s; }
.orb.on { opacity: 1; }
.orb-halo { fill: var(--cat-1); opacity: .55; }
.orb-ring { fill: none; stroke: var(--cat-1); stroke-width: 1.5; stroke-dasharray: 3 3; transform-box: fill-box; transform-origin: center; animation: spin 1.4s linear infinite; }
.orb-core { fill: #fff; stroke: var(--cat-1); stroke-width: 2; }
.gh-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.gh-right .gh-big span { line-height: 1.15; font-size: 11px; }
.g-hud { position: absolute; left: 18px; bottom: 10px; display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.gh-big { display: flex; align-items: baseline; gap: 8px; }
.gh-big b { font: 700 34px/1 var(--display); }
.gh-big span { font-size: 12px; color: var(--ink-2); }
.crit { color: var(--critical); } .okc { color: var(--good); }
.gh-leg { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.gh-leg span { display: inline-flex; align-items: center; gap: 6px; }
.gh-leg i { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.l-hot { background: var(--critical); } .l-cut { background: var(--good); } .l-cold { background: var(--border-strong); }
.gh-leg .l-orb { width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--cat-1), 0 0 8px var(--cat-1); }
.ag-status { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ag-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ag-kpis div { padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; }
.ag-kpis b { font: 700 22px var(--display); }
.ag-kpis span { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.ag-jewels { display: flex; flex-direction: column; gap: 6px; }
.ag-jewels.ok { font-size: 12.5px; color: var(--good-ink); font-weight: 600; }
.choke { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px; border-radius: 12px; border: 1px solid color-mix(in oklab, var(--accent) 35%, transparent); background: var(--accent-soft); }
.ch-n { font-weight: 600; font-size: 13px; margin: 2px 0; }
.ag-log { font: 11.5px/1.5 "JetBrains Mono", monospace; display: flex; flex-direction: column; gap: 3px; max-height: 300px; overflow-y: auto; padding: 10px; border-radius: 10px; background: #05090b; border: 1px solid rgba(46,229,157,.16); }
.lg { display: grid; grid-template-columns: 58px 1fr; gap: 6px; color: #b9d6ca; animation: slideIn .35s; }
.lg time { color: #5d7a6e; }
.lg b { color: #fff; font-weight: 600; }
.lg.k-step span { color: #7cc4ff; }
.lg.k-block span { color: #2ee59d; }
.lg.k-crit span { color: #ff6b6b; }
.lg.k-ok span { color: #2ee59d; }
.chain-list { display: flex; flex-direction: column; gap: 6px; }
.cl { display: grid; grid-template-columns: 24px 1fr auto; gap: 10px; align-items: center; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); text-align: left; }
.cl:hover { border-color: var(--border-strong); }
.cl.on { border-color: var(--accent); background: var(--accent-soft); }
.cl-st { display: grid; place-items: center; }
.cl-st.ok { color: var(--good); } .cl-st.bad { color: var(--critical); }
.cl-m { display: flex; flex-direction: column; min-width: 0; }
.cl-m b { font-size: 12.5px; }
.cl-m span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cl-steps { display: flex; gap: 3px; }
.cl-steps i { width: 6px; height: 14px; border-radius: 2px; background: var(--critical); }
.cl-steps i.blk { background: var(--good); } .cl-steps i.dead { background: var(--surface-3); }

/* --- adversary network --- */
.anet { width: 100%; height: auto; }
.ne path { fill: none; opacity: .38; }
.ne.n2 path { stroke-width: 1; opacity: .25; }
.act-aura { opacity: .1; transform-box: fill-box; transform-origin: center; animation: breathe 3.4s ease-in-out infinite; }
.act-trk { fill: none; stroke: var(--surface-3); stroke-width: 4; }
.act-cap { fill: none; stroke-width: 4; stroke-linecap: round; }
.act-orbit { fill: none; stroke: var(--border-strong); stroke-dasharray: 2 5; transform-box: fill-box; transform-origin: center; animation: spin 18s linear infinite; }
.act-c { fill: var(--surface-2); stroke: var(--border-strong); }
.act-i { font: 700 13px var(--display); fill: var(--ink); letter-spacing: .04em; }
.act-l { font: 600 11.5px var(--display); fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.act-s { font-size: 9.5px; fill: var(--muted); paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.act.sel .act-c { stroke: var(--ink); stroke-width: 2; }
.pill-bg { fill: var(--surface-2); stroke: var(--border-strong); }
.pill-fill { opacity: .14; }
.pl { font: 500 11.5px Inter, sans-serif; fill: var(--ink); }
.pv { font: 600 11px "JetBrains Mono", monospace; fill: var(--ink-2); }
.thr:hover .pill-bg, .ast:hover .pill-bg { stroke: var(--ink-2); }
.thr.sel .pill-bg, .ast.sel .pill-bg { stroke: var(--ink); stroke-width: 1.6; }
.ast-bar { fill: var(--accent); }
.ast.off { opacity: .45; } .ast.off .ast-bar { fill: var(--muted); }

@media (max-width: 1180px) {
  .split-view { grid-template-columns: 1fr; min-height: 0; }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .graph-wrap { overflow-x: auto; display: block; }
  .agraph { min-width: 900px; }
  .anet { min-width: 860px; max-height: none; }
  .g-hud { position: static; padding: 8px 4px; }
}

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 1280px) {
  .g-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .model-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1024px) {
  .g-main, .g-2, .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 70; transform: translateX(-105%); transition: transform .3s; background: var(--surface); }
  .sidebar.open { transform: none; box-shadow: 20px 0 60px rgba(0,0,0,.35); }
  .hamburger { display: grid; place-items: center; }
  .main { padding-block: 0 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .clock, #askBtn { display: none; }
  .score-card { grid-template-columns: 1fr; justify-items: center; }
  .hbar { grid-template-columns: 110px 1fr 40px; }
  .pb { grid-template-columns: 100px 1fr 60px; }
  .tb-title h1 { font-size: 18px; }
}
@media (max-width: 520px) {
  .g-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .g-kpi .kpi.hero { grid-column: span 2; }
  .kpi { padding: 14px; }
  .kpi .num { font-size: 22px; }
  .kpi .foot { font-size: 11px; }
  #reportBtn { padding: 8px 10px; font-size: 12px; }
  .trow-h { grid-template-columns: 26px 1fr auto; }
  .trow-h .pill { display: none; }
  .trow-b { padding-left: 14px; }
}

/* =========================================================================
   Print — board report
   ========================================================================= */
@media print {
  body { background: #fff; color: #111; }
  .app, .bg-grid, .bg-glow, .drawer, .tooltip, .toast { display: none !important; }
  .report, .report.open { display: block; position: static; background: none; padding: 24px; }
  .report-bar { display: none; }
  .report-card { border: 0; box-shadow: none; }
  .report-body { font: 12px/1.55 Inter, system-ui, sans-serif; color: #111; }
  .report h1 { font-size: 22px; margin: 0 0 4px; }
  .report h2 { font-size: 15px; margin: 22px 0 8px; border-bottom: 2px solid #0a9a5f; padding-bottom: 4px; }
  .report table { width: 100%; border-collapse: collapse; }
  .report th, .report td { text-align: left; padding: 6px 8px; border-bottom: 1px solid #ddd; vertical-align: top; }
  .report th { background: #f2f5f4; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
  .report .meta { color: #555; }
}

@media (max-width: 1440px) {
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1280px) {
  .cc-main { grid-template-columns: 1fr; }
  .cc-side { display: grid; grid-template-columns: 1fr 1fr; }
  .search { display: none; }
}
@media (max-width: 860px) {
  .map-stage { grid-template-columns: 1fr; }
  .cc-side { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .advisory { flex-wrap: wrap; }
  .alerts td:nth-child(3) { min-width: 180px; }
}
@media (max-width: 520px) {
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpis .kpi-gauge { grid-column: span 2; }
  .kpi-n { font-size: 19px; }
  .hud { display: none; }
  .seg button { padding: 5px 8px; }
}

@media (max-width: 860px) {
  .advisory .btn { width: 100%; justify-content: center; }
  .map-card .card-h { flex-wrap: wrap; }
}
@media (max-width: 520px) {
  .crumbs { display: none; }
  .kpis .kpi:last-child { grid-column: span 2; }
  .adv-t { font-size: 13px; }
}
.ag-wrap .g-hud { position: static; padding: 2px 6px 8px; justify-self: start; }
.swarm-card .console.mini { flex: 1; min-height: 150px; }
