:root {
  color-scheme: light;
  --ink: #17201e;
  --ink-2: #2f3a37;
  --muted: #68736f;
  --muted-2: #8d9793;
  --line: #dce3df;
  --line-strong: #c9d1cd;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --nav: #17201e;
  --nav-2: #222c29;
  --lime: #c8f75a;
  --lime-dark: #567d00;
  --lime-soft: #eefbd2;
  --red: #b82e24;
  --red-soft: #fdebe9;
  --amber: #a46509;
  --amber-soft: #fff3d8;
  --green: #267548;
  --green-soft: #e8f6ed;
  --blue: #315f87;
  --blue-soft: #eaf2f8;
  --shadow: 0 12px 36px rgba(23, 32, 30, .10);
  --sidebar: 248px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; font-size: 14px; line-height: 1.45; letter-spacing: 0; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
:focus-visible { outline: 3px solid rgba(113, 158, 13, .35); outline-offset: 2px; }
[hidden] { display: none !important; }

.boot-screen { min-height: 100vh; display: grid; place-content: center; gap: 18px; justify-items: center; }
.boot-line { width: 132px; height: 3px; overflow: hidden; background: var(--line); }
.boot-line::after { content: ""; display: block; width: 45%; height: 100%; background: var(--lime-dark); animation: boot 1s ease-in-out infinite; }
@keyframes boot { from { transform: translateX(-120%); } to { transform: translateX(260%); } }

.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 480px) 1fr; background: var(--surface); }
.login-panel { display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; padding: clamp(32px, 5vw, 72px); border-right: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; text-decoration: none; font-weight: 720; font-size: 18px; }
.brand img { width: 32px; height: 32px; }
.login-form-wrap { width: 100%; max-width: 350px; margin: 70px 0; }
.eyebrow { margin: 0 0 10px; color: var(--muted); font-size: 11px; font-weight: 750; text-transform: uppercase; }
.login-form-wrap h1 { margin: 0; font-size: clamp(30px, 3vw, 42px); line-height: 1.08; font-weight: 680; }
.login-form-wrap > p { margin: 14px 0 28px; color: var(--muted); }
.login-foot { color: var(--muted); font-size: 12px; }
.login-context { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; min-height: 100vh; padding: clamp(42px, 7vw, 110px); color: white; background: var(--nav); }
.login-context::before { content: ""; position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(to bottom, transparent, black 25%, black); }
.login-context > * { position: relative; z-index: 1; }
.login-context strong { display: block; max-width: 760px; font-size: clamp(36px, 5vw, 76px); line-height: 1.03; font-weight: 620; }
.login-context p { max-width: 620px; margin: 24px 0 0; color: #bfcbc6; font-size: clamp(16px, 1.5vw, 21px); }
.signal-path { display: flex; align-items: center; gap: 0; margin-bottom: 44px; }
.signal-step { min-width: 90px; padding: 11px 14px; border: 1px solid #52605b; color: #dce6e2; font-size: 12px; text-align: center; }
.signal-step.verified { border-color: var(--lime); color: var(--lime); }
.signal-arrow { width: 28px; height: 1px; background: #52605b; }

.field { display: grid; gap: 7px; margin-bottom: 18px; }
.field label { color: var(--ink-2); font-size: 12px; font-weight: 680; }
.input, .select, .textarea { width: 100%; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--ink); padding: 9px 11px; transition: border-color .15s, box-shadow .15s; }
.textarea { min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.input:hover, .select:hover, .textarea:hover { border-color: #aab4af; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: #719e0d; box-shadow: 0 0 0 3px rgba(113,158,13,.14); }
.field-help { margin: 0; color: var(--muted); font-size: 11px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.button { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 4px; padding: 8px 13px; background: var(--lime); color: var(--ink); font-weight: 710; text-decoration: none; white-space: nowrap; transition: transform .12s, background .12s, border-color .12s; }
.button:hover { background: #baf043; }
.button:active { transform: translateY(1px); }
.button.secondary { background: var(--surface); border-color: var(--line-strong); }
.button.secondary:hover { background: var(--canvas); }
.button.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.button.ghost:hover { color: var(--ink); background: var(--canvas); }
.button.danger { background: var(--surface); color: var(--red); border-color: #ecc1bd; }
.button.full { width: 100%; }
.button.compact { min-height: 32px; padding: 5px 9px; font-size: 12px; }
.icon-button { width: 38px; height: 38px; display: inline-grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 4px; background: var(--surface); color: var(--ink); }
.icon-button:hover { background: var(--canvas); }

.app-shell { min-height: 100vh; padding-left: var(--sidebar); }
.sidebar { position: fixed; z-index: 40; inset: 0 auto 0 0; width: var(--sidebar); display: flex; flex-direction: column; background: var(--nav); color: white; border-right: 1px solid #2b3532; }
.sidebar-head { height: 72px; display: flex; align-items: center; padding: 0 22px; border-bottom: 1px solid #303a37; }
.sidebar-head .brand { color: white; }
.nav { padding: 18px 12px; overflow-y: auto; }
.nav-group-label { padding: 13px 11px 7px; color: #77837f; font-size: 10px; font-weight: 740; text-transform: uppercase; }
.nav-link { position: relative; min-height: 39px; display: flex; align-items: center; gap: 11px; margin: 2px 0; padding: 8px 11px; border-radius: 4px; color: #aebbb6; text-decoration: none; font-size: 13px; font-weight: 570; }
.nav-link:hover { background: var(--nav-2); color: white; }
.nav-link.selected { background: #2b3532; color: white; }
.nav-link.selected::before { content: ""; position: absolute; left: 0; width: 3px; height: 18px; background: var(--lime); }
.nav-icon { width: 18px; color: #899691; text-align: center; font-size: 14px; }
.nav-link.selected .nav-icon { color: var(--lime); }
.nav-count { margin-left: auto; min-width: 21px; padding: 1px 6px; border: 1px solid #46524e; border-radius: 10px; color: #b9c5c0; font-size: 10px; text-align: center; }
.sidebar-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 20px; border-top: 1px solid #303a37; color: #93a09b; font-size: 11px; }
.sidebar-foot strong { display: block; overflow: hidden; color: white; font-size: 12px; text-overflow: ellipsis; }
.sidebar-logout { border: 0; padding: 5px 0; background: transparent; color: #aebbb6; font-size: 11px; }
.sidebar-logout:hover { color: white; }

.topbar { position: sticky; z-index: 30; top: 0; height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 clamp(20px, 3vw, 38px); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.94); backdrop-filter: blur(12px); }
.page-heading { min-width: 0; }
.page-heading h1 { overflow: hidden; margin: 0; font-size: 18px; line-height: 1.2; font-weight: 680; text-overflow: ellipsis; white-space: nowrap; }
.page-heading p { overflow: hidden; margin: 3px 0 0; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { display: flex; align-items: center; gap: 9px; }
.topbar > .topbar-actions:first-child { min-width: 0; flex: 1; }
.topbar > .topbar-actions:last-child { flex: 0 0 auto; }
.narrow-label { display: none; }
.mobile-menu-button { display: none; }
.main { width: 100%; max-width: 1560px; margin: 0 auto; padding: clamp(22px, 3vw, 40px); }
.page { animation: page-in .24s ease-out both; }
@keyframes page-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.metric-grid { display: grid; grid-template-columns: 1.35fr repeat(4, minmax(130px, 1fr)); border: 1px solid var(--line); background: var(--line); gap: 1px; }
.metric-grid.system-metrics { grid-template-columns: repeat(4, 1fr); }
.metric { min-height: 132px; padding: 18px; background: var(--surface); }
.metric-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-value { display: block; margin-top: 22px; font-size: 34px; line-height: 1; font-weight: 680; }
.metric small { display: block; margin-top: 9px; color: var(--muted); font-size: 11px; }
.metric.score-metric { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 12px; }
.score-ring { --score: 0; width: 82px; aspect-ratio: 1; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--lime-dark) calc(var(--score) * 1%), #e4e9e6 0); }
.score-ring::before { content: ""; width: 64px; aspect-ratio: 1; border-radius: 50%; background: white; }
.score-ring strong { position: absolute; font-size: 24px; }

.section { margin-top: 30px; }
.section-head { min-height: 42px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 10px; }
.section-head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.section-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.section-actions { display: flex; align-items: center; gap: 8px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .8fr); gap: 24px; }
.workspace-grid > * { min-width: 0; }
.panel { border: 1px solid var(--line); background: var(--surface); }
.panel-head { min-height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.panel-head h3 { margin: 0; font-size: 13px; }
.panel-body { padding: 16px; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); background: var(--surface); }
.data-table { width: 100%; min-width: 780px; border-collapse: collapse; table-layout: auto; }
.data-table th { height: 38px; padding: 7px 12px; border-bottom: 1px solid var(--line); background: #f8faf9; color: var(--muted); font-size: 10px; font-weight: 740; text-align: left; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 52px; padding: 8px 12px; border-bottom: 1px solid #e8ecea; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr[data-clickable] { cursor: pointer; }
.data-table tbody tr[data-clickable]:hover { background: #f8faf9; }
.cell-title { max-width: 390px; font-weight: 630; }
.cell-subtitle { max-width: 420px; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }

.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 23px; max-width: 100%; padding: 3px 8px; border: 1px solid var(--line); border-radius: 3px; background: var(--canvas); color: var(--ink-2); font-size: 10px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; flex: 0 0 auto; border-radius: 50%; background: var(--muted-2); }
.badge.pass, .badge.ready, .badge.connected, .badge.completed, .badge.resolved { color: var(--green); border-color: #b9dfc7; background: var(--green-soft); }
.badge.pass::before, .badge.ready::before, .badge.connected::before, .badge.completed::before, .badge.resolved::before { background: var(--green); }
.badge.fail, .badge.cannot_fire, .badge.error, .badge.critical { color: var(--red); border-color: #efc4c0; background: var(--red-soft); }
.badge.fail::before, .badge.cannot_fire::before, .badge.error::before, .badge.critical::before { background: var(--red); }
.badge.partial, .badge.attention, .badge.high, .badge.acknowledged { color: var(--amber); border-color: #ead0a6; background: var(--amber-soft); }
.badge.partial::before, .badge.attention::before, .badge.high::before, .badge.acknowledged::before { background: var(--amber); }
.badge.unknown, .badge.never, .badge.queued, .badge.running, .badge.open { color: var(--blue); border-color: #c6d9e8; background: var(--blue-soft); }
.badge.unknown::before, .badge.never::before, .badge.queued::before, .badge.running::before, .badge.open::before { background: var(--blue); }
.badge.authorized, .badge.info, .badge.healthy, .badge.observed { color: var(--green); border-color: #b9dfc7; background: var(--green-soft); }
.badge.authorized::before, .badge.info::before, .badge.healthy::before, .badge.observed::before { background: var(--green); }
.badge.denied, .badge.suspicious, .badge.failed, .badge.degraded { color: var(--red); border-color: #efc4c0; background: var(--red-soft); }
.badge.denied::before, .badge.suspicious::before, .badge.failed::before, .badge.degraded::before { background: var(--red); }
.badge.none { color: var(--muted); background: var(--canvas); }
.severity-line { width: 3px; height: 30px; display: block; border-radius: 2px; background: var(--line-strong); }
.severity-line.critical { background: var(--red); }
.severity-line.high { background: #d58b1d; }
.severity-line.medium { background: #6287a6; }
.severity-line.low { background: #8a9691; }

.finding-list { border: 1px solid var(--line); background: var(--surface); }
.finding-row { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 14px; align-items: center; min-height: 78px; padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: pointer; }
.finding-row:last-child { border-bottom: 0; }
.finding-row:hover { background: #f8faf9; }
.finding-row h3 { overflow: hidden; margin: 0; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.finding-row p { overflow: hidden; margin: 5px 0 0; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.finding-meta { color: var(--muted); font-size: 10px; text-align: right; }

.domain-bars { display: grid; gap: 15px; }
.domain-bar-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font-size: 11px; }
.domain-bar-track { height: 8px; display: flex; overflow: hidden; background: #edf1ef; }
.domain-segment.pass { background: #4a9468; }
.domain-segment.partial { background: #d79a3e; }
.domain-segment.fail { background: #ca4a40; }
.domain-segment.unknown { background: #93a7b8; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters .select, .filters .input { width: auto; min-width: 145px; min-height: 36px; padding: 6px 9px; font-size: 12px; }
.search-input { min-width: min(100%, 260px) !important; }
.summary-line { display: flex; flex-wrap: wrap; gap: 18px; margin: 0 0 16px; color: var(--muted); font-size: 11px; }
.summary-line strong { color: var(--ink); }

.live-signal-strip { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 12px; border: 1px solid var(--line); background: var(--surface); }
.live-signal-strip a { min-width: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-right: 1px solid var(--line); text-decoration: none; }
.live-signal-strip a:last-child { border-right: 0; }
.live-signal-strip a:hover { background: #f8faf9; }
.live-signal-strip span { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.live-signal-strip strong { font-size: 11px; white-space: nowrap; }
.topology-metrics, .access-metrics, .network-metrics { grid-template-columns: repeat(4, 1fr); }
.topology-head { align-items: center; }
.segmented { display: inline-flex; min-height: 34px; border: 1px solid var(--line-strong); background: var(--surface); }
.segment { min-height: 32px; border: 0; border-right: 1px solid var(--line); padding: 5px 10px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; }
.segment:last-child { border-right: 0; }
.segment:hover { color: var(--ink); background: var(--canvas); }
.segment.selected { color: var(--ink); background: var(--lime-soft); box-shadow: inset 0 -2px var(--lime-dark); }
.topology-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.topology-toolbar .input { width: min(360px, 100%); min-height: 36px; }
.topology-zoom { display: flex; gap: 5px; }
.topology-zoom .icon-button { width: 34px; height: 34px; font-size: 12px; }
.topology-canvas { width: 100%; height: min(70vh, 720px); min-height: 520px; overflow: auto; border: 1px solid var(--line); background-color: #f8faf9; background-image: linear-gradient(#e8ecea 1px, transparent 1px), linear-gradient(90deg, #e8ecea 1px, transparent 1px); background-size: 24px 24px; overscroll-behavior: contain; }
#topology-svg { display: block; min-width: 100%; min-height: 100%; }
.topology-column-label { fill: var(--muted); font-size: 10px; font-weight: 750; text-transform: uppercase; }
.topology-edge { fill: none; stroke: #bdc8c3; stroke-width: 1.25; opacity: .7; vector-effect: non-scaling-stroke; }
.topology-edge.active { stroke: #719e0d; stroke-width: 1.8; stroke-dasharray: 7 6; animation: edge-flow 1.4s linear infinite; opacity: .9; }
.topology-edge.degraded { stroke: var(--red); }
@keyframes edge-flow { to { stroke-dashoffset: -26; } }
.topology-node { cursor: pointer; outline: none; }
.topology-node .node-body { fill: white; stroke: #ccd5d1; filter: url(#node-shadow); transition: stroke .15s, fill .15s; }
.topology-node:hover .node-body, .topology-node:focus .node-body { fill: var(--lime-soft); stroke: #83a92d; }
.node-status { fill: #8d9793; }
.status-healthy .node-status, .status-observed .node-status, .status-completed .node-status { fill: var(--green); }
.status-degraded .node-status, .status-failed .node-status { fill: var(--red); }
.risk-critical .node-body, .risk-high .node-body { stroke: #df8f88; }
.risk-medium .node-body { stroke: #e1bd82; }
.node-kind { fill: var(--ink); }
.node-name { fill: var(--ink); font-size: 11px; font-weight: 680; }
.node-subtitle { fill: var(--muted); font-size: 9px; }
.event-pulse { fill: var(--red); transform-origin: center; animation: event-pulse 1.35s ease-out infinite; }
@keyframes event-pulse { 0% { opacity: 1; transform: scale(.7); } 75%, 100% { opacity: 0; transform: scale(2.5); } }
.event-stream { border: 1px solid var(--line); background: var(--surface); }
.event-row { min-height: 56px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 13px; border-bottom: 1px solid var(--line); }
.event-row:last-child { border-bottom: 0; }
.event-row.clickable { cursor: pointer; }
.event-row.clickable:hover { background: #f8faf9; }
.event-row strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.event-row p { overflow: hidden; margin: 2px 0 0; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.event-row > span:last-child { color: var(--muted); font-size: 10px; white-space: nowrap; }
.event-dot { width: 8px; height: 8px; display: block; border-radius: 50%; background: var(--muted-2); }
.event-dot.authorized { background: var(--green); }
.event-dot.denied, .event-dot.suspicious { background: var(--red); }
.event-dot.warning { background: var(--amber); }
.compact-empty { min-height: 132px; }
.metric-value.positive { color: var(--green); }
.metric-value.negative { color: var(--red); }
.metric-value.warning { color: var(--amber); }
.network-grid { grid-template-columns: minmax(0, 1.6fr) minmax(260px, .65fr); }
.policy-list, .source-list { border: 1px solid var(--line); background: var(--surface); }
.policy-list > div, .source-list > div { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 11px; border-bottom: 1px solid var(--line); font-size: 11px; }
.policy-list > div:last-child, .source-list > div:last-child { border-bottom: 0; }
.policy-list > div { justify-content: flex-start; }
.source-list code { font-size: 10px; }
.source-list span { color: var(--muted); font-size: 10px; }

.path { display: grid; grid-template-columns: repeat(5, minmax(85px, 1fr)); gap: 1px; margin-top: 10px; background: var(--line); border: 1px solid var(--line); }
.path-step { min-height: 58px; display: grid; place-content: center; padding: 8px; background: var(--surface); color: var(--muted); font-size: 10px; text-align: center; }
.path-step.done { background: var(--green-soft); color: var(--green); }
.path-step.failed { background: var(--red-soft); color: var(--red); }
.path-step.pending { background: var(--canvas); }

.empty { min-height: 220px; display: grid; place-content: center; justify-items: center; padding: 30px; border: 1px solid var(--line); background: var(--surface); text-align: center; }
.empty strong { font-size: 15px; }
.empty p { max-width: 420px; margin: 7px 0 18px; color: var(--muted); font-size: 12px; }
.loading-block { min-height: 360px; border: 1px solid var(--line); background: linear-gradient(90deg,#fff,#f2f5f3,#fff); background-size: 200% 100%; animation: loading 1.2s linear infinite; }
@keyframes loading { to { background-position: -200% 0; } }

.modal { width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; padding: 0; border: 1px solid var(--line-strong); border-radius: 6px; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(16, 24, 21, .55); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-head p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.modal-body { padding: 22px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #f8faf9; }

.drawer-backdrop { position: fixed; z-index: 69; inset: 0; background: rgba(16,24,21,.35); }
.drawer { position: fixed; z-index: 70; top: 0; right: 0; width: min(540px, 100vw); height: 100vh; overflow-y: auto; padding: 0; border-left: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); transform: translateX(105%); transition: transform .22s ease; }
.drawer.open { transform: translateX(0); }
.drawer-head { position: sticky; z-index: 2; top: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 22px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(10px); }
.drawer-head h2 { margin: 0; font-size: 18px; line-height: 1.25; }
.drawer-head p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.drawer-body { padding: 22px; }
.detail-section { padding: 18px 0; border-bottom: 1px solid var(--line); }
.detail-section:first-child { padding-top: 0; }
.detail-section:last-child { border-bottom: 0; }
.detail-section h3 { margin: 0 0 10px; font-size: 12px; text-transform: uppercase; }
.detail-section p { margin: 8px 0; color: var(--ink-2); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; }
.detail-item span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.detail-item strong { display: block; margin-top: 4px; font-size: 12px; overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 7px; border: 1px solid var(--line); background: var(--canvas); color: var(--ink-2); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.evidence-code { max-height: 210px; overflow: auto; margin: 0; padding: 12px; background: var(--nav); color: #d5e0dc; font: 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; gap: 8px; width: min(360px, calc(100vw - 36px)); }
.toast { display: grid; grid-template-columns: 4px 1fr; gap: 12px; padding: 13px; border: 1px solid var(--line-strong); background: var(--surface); box-shadow: var(--shadow); animation: toast-in .2s ease both; }
.toast::before { content: ""; background: var(--green); }
.toast.error::before { background: var(--red); }
.toast strong { display: block; font-size: 12px; }
.toast p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

.mobile-nav-backdrop { display: none; }

@media (max-width: 1120px) {
  :root { --sidebar: 216px; }
  .metric-grid { grid-template-columns: 1.4fr repeat(2, 1fr); }
  .metric-grid.system-metrics { grid-template-columns: repeat(2, 1fr); }
  .metric:nth-child(4), .metric:nth-child(5) { min-height: 105px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .topology-metrics, .access-metrics, .network-metrics { grid-template-columns: repeat(2, 1fr); }
  .network-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  :root { --sidebar: 268px; }
  .login-page { grid-template-columns: 1fr; }
  .login-panel { min-height: 100vh; border-right: 0; }
  .login-context { display: none; }
  .app-shell { padding-left: 0; }
  .sidebar { transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.mobile-open { transform: translateX(0); }
  .mobile-nav-backdrop { position: fixed; z-index: 35; inset: 0; display: block; background: rgba(16,24,21,.52); }
  .mobile-menu-button { display: inline-grid; }
  .topbar { height: 64px; padding: 0 14px; }
  .page-heading p { display: none; }
  .topbar-actions .last-run-label { display: none; }
  .main { padding: 18px 14px 34px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid.system-metrics { grid-template-columns: 1fr 1fr; }
  .metric.score-metric { grid-column: 1 / -1; }
  .field-row { grid-template-columns: 1fr; gap: 0; }
  .live-signal-strip { grid-template-columns: 1fr 1fr; }
  .live-signal-strip a:nth-child(2) { border-right: 0; }
  .live-signal-strip a:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .topology-head .section-actions { width: 100%; overflow-x: auto; }
  .topology-canvas { min-height: 450px; height: 64vh; }
}

@media (max-width: 520px) {
  .login-panel { padding: 26px 22px; }
  .login-form-wrap { margin: 48px 0; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric { min-height: 110px; padding: 14px; }
  .metric.score-metric { min-height: 120px; }
  .metric-value { margin-top: 18px; font-size: 28px; }
  .topbar-actions .secondary { display: none; }
  #logout-button { display: none; }
  .wide-label { display: none; }
  .narrow-label { display: inline; }
  .section-head { align-items: flex-start; flex-direction: column; }
  .section-actions { width: 100%; overflow-x: auto; }
  .filters { display: grid; grid-template-columns: 1fr 1fr; }
  .filters .select, .filters .input { width: 100% !important; min-width: 0 !important; }
  .filters .search-input { grid-column: 1 / -1; }
  .finding-row { grid-template-columns: 4px minmax(0, 1fr); }
  .finding-meta { display: none; }
  .path { grid-template-columns: 1fr; }
  .path-step { min-height: 42px; }
  .detail-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions .button { width: 100%; }
  .topology-metrics, .access-metrics, .network-metrics { grid-template-columns: 1fr 1fr; }
  .topology-toolbar { align-items: stretch; flex-direction: column; }
  .topology-toolbar .input { width: 100%; }
  .topology-zoom { align-self: flex-end; }
  .segmented { min-width: max-content; }
  .event-row { grid-template-columns: 9px minmax(0, 1fr); }
  .event-row > span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
