/* VulnOps console theme: three themes as CSS variable sets (dark default, light, navy). Components use variables only.
   Dark and light follow the design of the VulnOps_UI branch (palette, Geist type, soft cards); navy stays the high-contrast theme. */
@font-face { font-family: "Geist Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("dist/fonts/geist-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Geist Mono Variable"; font-style: normal; font-display: swap; font-weight: 100 900;
  src: url("dist/fonts/geist-mono-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* tokens every theme needs; navy keeps the flat, high-contrast values */
  --link: var(--accent); --rail: var(--surface); --rail-active: var(--elev-2); --sheen: transparent; --shadow-card: none;
  --glow-a: transparent; --glow-b: transparent; --grid-line: transparent; --btn-grad: var(--accent); --field: var(--bg);
  --fg: var(--ink); --line: var(--hairline);
  --radius: 12px; --radius-card: 20px; --gap: 16px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px;
  --font-mono: "Geist Mono Variable", ui-monospace, "Cascadia Code", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
  --font-sans: "Geist Variable", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif; /* Geist first; system fonts if it cannot load */
  --mono: var(--font-mono); --sans: var(--font-sans);
  --t-xs: 12px; --t-sm: 13px; --t-md: 14px; --t-lg: 16px; --t-xl: 28px;
}
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070a12; --surface: #0e1320; --elev: #151b2b; --elev-2: #19213a; --hairline: rgba(255,255,255,.09);
  --ink: #e9edf7; --muted: #9aa4bb; --faint: #8792ab;
  --brand: #e31937; --danger: #ff6b6b; --positive: #3ec27f; --accent: #3b6ef5; --link: #7b9cff; --on-accent: #ffffff; --on-brand: #ffffff;
  --sev-critical: #f06464; --sev-high: #f39b6e; --sev-medium: #fab219; --sev-low: #5ea3f5; --sev-none: #8792ab;
  --code-bg: #0a0f1b; --code-ink: #c9d3e6; --crown: #e8b800; --scrim: rgba(3,5,10,.62);
  --zebra: transparent; --shadow: 0 8px 28px rgba(0,0,0,.55); --control-border: #5b6a7a; --field: #070a12;
  --rail: #0a0e19; --rail-active: #151d33; --sheen: rgba(255,255,255,.045);
  --shadow-card: 0 1px 2px rgba(0,0,0,.5), 0 16px 32px -16px rgba(0,0,0,.7);
  --glow-a: rgba(59,110,245,.2); --glow-b: rgba(124,92,255,.15); --grid-line: rgba(255,255,255,.035);
  --btn-grad: linear-gradient(135deg, #3b6ef5, #7c5cff);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5fa; --surface: #ffffff; --elev: #edf0f7; --elev-2: #e8edf8; --hairline: rgba(15,23,42,.1);
  --ink: #0b1020; --muted: #5a647d; --faint: #667088;
  --brand: #00549c; --danger: #c23232; --positive: #0b6b3a; --accent: #2f5fe0; --link: #2f5fe0; --on-accent: #ffffff; --on-brand: #ffffff;
  --sev-critical: #c62f2f; --sev-high: #c2571a; --sev-medium: #9a6b00; --sev-low: #2a68c8; --sev-none: #596273;
  --code-bg: #edf0f7; --code-ink: #0b1020; --crown: #8a6a00; --scrim: rgba(11,16,32,.45);
  --zebra: transparent; --shadow: 0 8px 28px rgba(15,23,42,.18); --control-border: #7a8496; --field: #ffffff;
  --rail: #ffffff; --rail-active: #eaeffb; --sheen: rgba(255,255,255,.9);
  --shadow-card: 0 1px 2px rgba(15,23,42,.05), 0 12px 28px -14px rgba(15,23,42,.14);
  --glow-a: rgba(59,110,245,.1); --glow-b: rgba(124,92,255,.08); --grid-line: rgba(15,23,42,.045);
  --btn-grad: linear-gradient(135deg, #2f5fe0, #6b4fe6);
}
:root[data-theme="navy"] {
  color-scheme: dark;
  --bg: #08111f; --surface: #0d1b30; --elev: #132641; --elev-2: #1a3355; --hairline: #35527a;
  --ink: #ffffff; --muted: #c5d2e4; --faint: #aebdd3;
  --brand: #ff6a00; --danger: #ff8a5c; --positive: #5fe0a0; --accent: #ff6a00; --on-accent: #08111f; --on-brand: #08111f;
  --sev-critical: #ff8080; --sev-high: #ffa94d; --sev-medium: #ffe066; --sev-low: #74c0fc; --sev-none: #b6c4d8;
  --code-bg: #050c18; --code-ink: #e4ecf7; --crown: #ffd43b; --scrim: rgba(2,6,14,.7);
  --zebra: rgba(255,255,255,.035); --shadow: 0 8px 28px rgba(0,0,0,.6); --control-border: #6f8ab0; --field: #08111f;
  /* navy stays flat and high contrast: no glow, no grid, no gradient, no card shadow */
  --link: var(--accent); --rail: var(--surface); --rail-active: var(--elev-2); --sheen: transparent; --shadow-card: none;
  --glow-a: transparent; --glow-b: transparent; --grid-line: transparent; --btn-grad: var(--accent);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
button { font-family: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
html:not([data-theme="light"]) :focus-visible { box-shadow: 0 0 0 4px var(--bg); }

.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- App shell ---- */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.rail {
  background: var(--surface);
  border-right: 1px solid var(--hairline);
  display: flex; flex-direction: column; gap: 4px;
  padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand .name { font-weight: 700; letter-spacing: 0.14em; }
.brand .sub { color: var(--faint); font-size: 11px; letter-spacing: 0.1em; }
.navitem {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px; color: var(--muted);
  background: transparent; border: 0; width: 100%; text-align: left; cursor: pointer; font-size: 14px;
}
.navitem:hover { background: var(--elev); color: var(--ink); }
.navitem.active { background: var(--elev-2); color: var(--ink); }
.navitem .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.navitem.active .dot { background: var(--accent); }
.rail .spacer { flex: 1; }
.rail .who { padding: 10px 12px; border-top: 1px solid var(--hairline); color: var(--muted); font-size: 12px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; border-bottom: 1px solid var(--hairline);
}
.topbar h1 { font-size: 17px; margin: 0; font-weight: 650; }
.topbar .purpose { color: var(--muted); font-size: 12.5px; }
.content { padding: 22px 24px; display: flex; flex-direction: column; gap: var(--gap); }

/* ---- Cards ---- */
.card { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
.card.pad { padding: 16px 18px; }
.card .hd { padding: 14px 18px; border-bottom: 1px solid var(--hairline); font-weight: 600; display:flex; align-items:center; justify-content:space-between; }
.card .bd { padding: 16px 18px; }
.grid { display: grid; gap: var(--gap); }

/* ---- KPI tiles ---- */
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 14px 16px; }
.kpi .v { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: 12px; margin-top: 2px; }
.kpi.alert .v { color: var(--sev-critical); }

/* ---- pills / severity ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; border: 1px solid transparent; }
.pill .pdot { width: 7px; height: 7px; border-radius: 50%; }
.sev-critical { color: var(--sev-critical); border-color: color-mix(in srgb, var(--sev-critical) 45%, transparent); background: color-mix(in srgb, var(--sev-critical) 12%, transparent); }
.sev-high { color: var(--sev-high); border-color: color-mix(in srgb, var(--sev-high) 45%, transparent); background: color-mix(in srgb, var(--sev-high) 12%, transparent); }
.sev-medium { color: var(--sev-medium); border-color: color-mix(in srgb, var(--sev-medium) 45%, transparent); background: color-mix(in srgb, var(--sev-medium) 12%, transparent); }
.sev-low { color: var(--sev-low); border-color: color-mix(in srgb, var(--sev-low) 45%, transparent); background: color-mix(in srgb, var(--sev-low) 12%, transparent); }
.sev-none { color: var(--sev-none); border-color: color-mix(in srgb, var(--sev-none) 45%, transparent); background: color-mix(in srgb, var(--sev-none) 12%, transparent); }
.tag { display:inline-flex; align-items:center; padding: 2px 8px; border-radius: 6px; font-size: 11px; border: 1px solid var(--hairline); color: var(--muted); }
.tag.kev { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.tag.sample { color: var(--sev-medium); border-color: color-mix(in srgb, var(--sev-medium) 45%, transparent); }

/* ---- table ---- */
table.findings { width: 100%; border-collapse: collapse; }
table.findings th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12px; padding: 10px 12px; border-bottom: 1px solid var(--hairline); }
table.findings td { padding: 11px 12px; border-bottom: 1px solid var(--hairline); }
table.findings tr { cursor: pointer; }
table.findings tr:hover td { background: var(--elev); }
table.findings tr.selected td { background: var(--elev-2); }
.risk { font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- buttons ---- */
.btn { min-height: 36px; border: 1px solid var(--hairline); background: var(--elev); color: var(--ink); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.btn:hover { background: var(--elev-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.danger { background: var(--brand); border-color: var(--brand); color: var(--on-brand); font-weight: 600; } /* irreversible action = CGI red */
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.ghost { background: transparent; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---- form controls (dark) ---- */
input, select, textarea {
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--control-border); border-radius: 8px;
  padding: 8px 10px; font-size: 13px; font-family: inherit;
}
input::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
select { cursor: pointer; }
select option { background: var(--surface); color: var(--ink); }

/* ---- evidence / logs ---- */
.evidence { font-family: var(--mono); font-size: 12.5px; background: var(--code-bg); border: 1px solid var(--hairline); border-radius: 8px; padding: 12px 14px; color: var(--code-ink); white-space: pre-wrap; }
.kvline { display:flex; justify-content:space-between; gap: 16px; padding: 5px 0; border-bottom: 1px dashed var(--hairline); }
.kvline:last-child { border-bottom: 0; }
.kvline .k { color: var(--muted); }

/* ---- drawer ---- */
.drawer-wrap { position: fixed; inset: 0; background: var(--scrim); display: flex; justify-content: flex-end; z-index: 40; }
.drawer { width: min(460px, 94vw); background: var(--surface); border-left: 1px solid var(--hairline); height: 100%; overflow: auto; padding: 18px 20px; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; place-items: center; }
.login .box { width: 360px; background: var(--surface); border: 1px solid var(--hairline); border-radius: 14px; padding: 28px; }
.login h2 { margin: 12px 0 2px; letter-spacing: 0.16em; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; }
.field label { color: var(--muted); font-size: 12px; }
.field input { background: var(--bg); border: 1px solid var(--control-border); color: var(--ink); border-radius: 8px; padding: 10px 12px; font-size: 14px; }
.field input:focus { border-color: var(--accent); }
.err { color: var(--danger); font-size: 12.5px; min-height: 16px; }

.sectiontitle { color: var(--muted); font-size: 12px; text-transform: none; letter-spacing: .02em; margin: 2px 0 2px; }
.empty { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--hairline); border-radius: var(--radius); }

@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .rail .spacer, .rail .who { display: none; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cockpit { grid-template-columns: 1fr !important; }
}

/* --- alerts: blink, crown, scrolling CVE ticker --- */
@keyframes vo-blink { 0%,100%{opacity:1} 50%{opacity:.25} }
.blink { animation: vo-blink 1s steps(1,end) infinite; }
.tag.alert { color: var(--sev-critical); border-color: var(--sev-critical); }
.crownbadge { color: var(--crown); }
.tickerwrap { overflow: hidden; white-space: nowrap; border:1px solid var(--line); border-radius:8px; padding:6px 0; background:var(--elev); }
.ticker { display:inline-block; padding-left:100%; animation: vo-marquee 28s linear infinite; }
.tickerwrap:hover .ticker { animation-play-state: paused; }
@keyframes vo-marquee { from{transform:translateX(0)} to{transform:translateX(-100%)} }

/* --- live CVE widget: slide-in + 10s progress bar --- */
@keyframes vo-cveslide { from{opacity:0; transform:translateX(14px)} to{opacity:1; transform:translateX(0)} }
.cveslide { animation: vo-cveslide .45s ease both; }
@keyframes vo-cvebar { from{width:0%} to{width:100%} }
.cvebar { animation: vo-cvebar 10s linear both; }

/* --- ingest normalisation funnel --- */
.funnelflow { display:flex; align-items:center; gap:6px; flex-wrap:wrap; }
.funnelnode { flex:1; min-width:86px; text-align:center; border:1px solid var(--line); border-left-width:3px; border-radius:8px; padding:8px 6px; background:var(--elev); }
.funnelarrow { color:var(--muted); font-size:16px; }

/* --- A2: keep wide tables from forcing horizontal page scroll (375px) --- */
.card .bd { overflow-x: auto; }
.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* --- A1: honor reduced-motion; keep the breach cue legible without animation --- */
@media (prefers-reduced-motion: reduce) {
  .blink, .ticker, .cveslide, .cvebar { animation: none !important; }
  .blink { opacity: 1; font-weight: 700; }
}

/* --- A11: skeleton shimmer --- */
@keyframes vo-pulse { 0%,100%{opacity:.5} 50%{opacity:.9} }
.skel { animation: vo-pulse 1.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .skel { animation: none !important; } }

/* ===== Layout: one scroll container per page, sticky header, spacing scale ===== */
html, body { height: 100%; }
.app { height: 100vh; min-height: 0; overflow: hidden; }
.rail { overflow-y: auto; }
.main { height: 100vh; min-height: 0; overflow: hidden; }
.topbar { flex: none; position: sticky; top: 0; z-index: 10; background: var(--bg); padding: var(--s3) var(--s6); }
.content { flex: 1 1 auto; min-height: 0; overflow: auto; padding: var(--s6); gap: var(--s4); scroll-padding-top: var(--s6); }
.card .bd { overflow-x: visible; }
.tablewrap { overflow-x: auto; }
@media (max-width: 860px) { .app, .main { height: auto; overflow: visible; } .content { overflow: visible; padding: var(--s4); } .topbar { padding: var(--s3) var(--s4); } }

/* ===== Kit: page header ===== */
.k-pagehead { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4); flex-wrap: wrap;
  position: sticky; top: calc(-1 * var(--s6)); z-index: 5; background: var(--bg); padding: var(--s6) 0 var(--s3); margin-top: calc(-1 * var(--s6));
  border-bottom: 1px solid var(--hairline); }
.t-xs { font-size: var(--t-xs); } .t-sm { font-size: var(--t-sm); } .t-md { font-size: var(--t-md); } .t-lg { font-size: var(--t-lg); }
.k-pagehead h1 { margin: 0; font-size: var(--t-xl); font-weight: 650; line-height: 1.25; }
.k-pagehead p { margin: var(--s1) 0 0; color: var(--muted); font-size: var(--t-sm); max-width: 70ch; }
.k-actions { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

/* ===== Kit: buttons, icon buttons, fields ===== */
.k-iconbtn { display: inline-grid; place-items: center; min-width: 44px; min-height: 44px; border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: var(--radius); cursor: pointer; }
.k-iconbtn:hover { background: var(--elev); color: var(--ink); border-color: var(--hairline); }
.k-iconbtn[aria-pressed="true"] { background: var(--elev-2); color: var(--ink); }
.k-iconbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.k-field { display: flex; flex-direction: column; gap: var(--s1); margin: var(--s3) 0; }
.k-field > label { color: var(--muted); font-size: var(--t-xs); font-weight: 600; }
.k-field .k-hint { color: var(--faint); font-size: var(--t-xs); }
.k-field .k-err { color: var(--danger); font-size: var(--t-xs); }
.k-summary { padding: var(--s3) var(--s4); border: 1px solid var(--danger); border-left-width: 4px; border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); margin-bottom: var(--s3); }
.k-summary ul { margin: var(--s2) 0 0; padding-left: var(--s4); font-size: var(--t-sm); }
.k-field input, .k-field select, .k-field textarea { min-height: 40px; }
.k-field [aria-invalid="true"] { border-color: var(--danger); }

/* ===== Kit: tabs ===== */
.k-tabs { display: flex; flex-wrap: wrap; gap: 0 var(--s1); border-bottom: 1px solid var(--hairline); }
.k-tab { min-height: 44px; padding: 0 var(--s3); background: transparent; border: 0; border-bottom: 3px solid transparent; color: var(--muted); font-size: var(--t-md); cursor: pointer; white-space: nowrap; }
.k-tab:hover { color: var(--ink); background: var(--elev); }
.k-tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); font-weight: 650; }
.k-tab .k-count { margin-left: var(--s2); color: var(--faint); font-size: var(--t-xs); }

/* ===== Kit: data table ===== */
.k-table { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); min-width: 0; }
.k-toolbar { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; padding: var(--s3) var(--s4); border-bottom: 1px solid var(--hairline); }
.k-scroll { overflow: auto; max-height: min(68vh, 900px); min-width: 0; }
.k-scroll table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--t-sm); }
.k-scroll th { position: sticky; top: 0; z-index: 2; background: var(--elev); color: var(--muted); text-align: left; font-weight: 600; font-size: var(--t-xs); padding: var(--s2) var(--s3); border-bottom: 1px solid var(--hairline); white-space: nowrap; }
.k-scroll th[aria-sort] { cursor: pointer; color: var(--ink); }
.k-scroll td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--hairline); vertical-align: middle; }
.k-scroll tbody tr:nth-child(even) td { background: var(--zebra); }
.k-scroll tbody tr:hover td { background: var(--elev); }
.k-scroll tbody tr[aria-selected="true"] td { background: var(--elev-2); box-shadow: inset 3px 0 0 var(--accent); }
.k-scroll tbody tr[tabindex] { cursor: pointer; }
.k-scroll .num { text-align: right; font-variant-numeric: tabular-nums; }
.k-scroll .ctr { text-align: center; }
.k-sortmark { margin-left: var(--s1); font-size: var(--t-xs); color: var(--accent); }
.k-sortmark.idle { color: var(--faint); }
.k-scroll th[aria-sort]:focus-visible { outline-offset: -2px; }
.k-scroll[aria-busy="true"] { opacity: .6; }
.k-table[data-density="compact"] .k-scroll td, .k-table[data-density="compact"] .k-scroll th { padding: var(--s1) var(--s3); }
.k-pager { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); flex-wrap: wrap; padding: var(--s2) var(--s4); border-top: 1px solid var(--hairline); color: var(--muted); font-size: var(--t-sm); }
.k-pager .k-pgbtns { display: flex; gap: var(--s1); align-items: center; }
.k-pager button { min-width: 44px; min-height: 44px; }
.k-pager select { min-height: 36px; }

/* ===== Kit: states ===== */
.k-empty { padding: var(--s8) var(--s6); text-align: center; color: var(--muted); }
.k-empty strong { display: block; color: var(--ink); font-size: var(--t-md); margin-bottom: var(--s1); }
.k-error { display: flex; gap: var(--s3); align-items: flex-start; justify-content: space-between; padding: var(--s3) var(--s4); border: 1px solid var(--danger); border-left-width: 4px; border-radius: var(--radius); background: color-mix(in srgb, var(--danger) 10%, var(--surface)); }
.k-error .k-etitle { font-weight: 650; }
.k-error .k-ebody { color: var(--muted); font-size: var(--t-sm); }
.k-skelrow { display: flex; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--hairline); }
.k-skelcell { height: 12px; border-radius: 4px; background: var(--elev-2); flex: 1; }
.k-skelcell:first-child { flex: 0 0 18%; }

/* ===== Kit: status badge (icon + text, never colour alone) ===== */
.k-badge { --c: var(--sev-none); display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 6px; font-size: var(--t-xs); font-weight: 600; border: 1px solid color-mix(in srgb, var(--c) 50%, transparent); color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); white-space: nowrap; }
.k-badge[data-tone="ok"] { --c: var(--positive); } .k-badge[data-tone="bad"] { --c: var(--sev-critical); }
.k-badge[data-tone="warn"] { --c: var(--sev-high); } .k-badge[data-tone="info"] { --c: var(--sev-low); } .k-badge[data-tone="idle"] { --c: var(--sev-none); }
.k-badge svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Kit: scroll panel, drawer, dialog, split layout ===== */
.k-panel { overflow: auto; max-height: var(--max, 60vh); min-height: 0; padding-bottom: var(--s4); }
.k-scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 40; display: flex; justify-content: flex-end; }
.k-scrim.center { justify-content: center; align-items: center; }
.k-drawer { width: min(480px, 100vw); height: 100%; background: var(--surface); border-left: 1px solid var(--hairline); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.k-dialog { width: min(560px, 94vw); max-height: 88vh; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; }
.k-dhead { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s4); border-bottom: 1px solid var(--hairline); }
.k-dhead h2 { margin: 0; font-size: var(--t-lg); }
.k-dbody { padding: var(--s4); overflow: auto; flex: 1; min-height: 0; }
.k-dfoot { padding: var(--s3) var(--s4); border-top: 1px solid var(--hairline); display: flex; justify-content: flex-end; gap: var(--s2); }
.k-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 440px); gap: var(--s4); align-items: start; }
.k-split > aside { position: sticky; top: var(--s4); max-height: calc(100vh - 140px); overflow: auto; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
@media (max-width: 1100px) { .k-split { grid-template-columns: minmax(0, 1fr); } .k-split > aside { position: static; max-height: none; } }

/* ===== Kit: theme switcher ===== */
.k-themes { display: inline-flex; border: 1px solid var(--hairline); border-radius: var(--radius); overflow: hidden; }
.k-themes button { min-height: 44px; min-width: 44px; padding: 0 var(--s3); background: transparent; color: var(--muted); border: 0; cursor: pointer; font-size: var(--t-sm); display: inline-flex; align-items: center; gap: var(--s2); }
.k-themes button:hover { background: var(--elev); color: var(--ink); }
.k-themes button[aria-checked="true"] { background: var(--elev-2); color: var(--ink); font-weight: 650; box-shadow: inset 0 -3px 0 var(--accent); }
.k-swatch { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--hairline); }
.k-swatch[data-t="dark"] { background: linear-gradient(135deg, #070a12 50%, #3b6ef5 50%); }
.k-swatch[data-t="light"] { background: linear-gradient(135deg, #f3f5fa 50%, #2f5fe0 50%); }
.k-swatch[data-t="navy"] { background: linear-gradient(135deg, #08111f 50%, #ff6a00 50%); }
@media (max-width: 700px) { .k-themes .k-tlabel { display: none; } }

/* ===== Table density for existing views ===== */
table.findings thead th { position: sticky; top: 0; background: var(--elev); z-index: 2; }
table.findings tbody tr:nth-child(even) td { background: var(--zebra); }
table.findings td, table.findings th { padding: var(--s2) var(--s3); }
.skel { background: var(--elev-2); }
.skip-link { position: absolute; left: var(--s2); top: -48px; background: var(--accent); color: var(--on-accent); padding: var(--s2) var(--s3); border-radius: var(--radius); z-index: 100; }
.skip-link:focus { top: var(--s2); }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } .skel { animation: none !important; } }

/* ===== Layout polish: dashboard grid, fluid tiles, compact header, responsive tables ===== */
.d-grid { display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); align-items: stretch; }
.d-grid > * { min-width: 0; }
.d-panel { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); }
.d-panel > .d-hd { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s2) var(--s4); min-height: 48px; border-bottom: 1px solid var(--hairline); }
.d-panel > .d-hd h2 { margin: 0; font-size: var(--t-md); font-weight: 600; }
.d-panel > .d-bd { padding: var(--s3) var(--s4); flex: 1 1 auto; min-width: 0; }
.d-panel .k-empty { padding: var(--s6) var(--s3); }
.k-empty-act { margin-top: var(--s3); }
.d-tiles { display: grid; gap: var(--s2); grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.d-tile { text-align: left; cursor: pointer; min-width: 0; min-height: 72px; padding: var(--s2) var(--s3); background: var(--elev); border: 1px solid var(--hairline); border-left: 3px solid var(--accent); border-radius: var(--radius); color: var(--ink); font: inherit; }
.d-tile.alert { border-left-color: var(--sev-critical); }
.d-tile .v { font-size: 22px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.d-tile.alert .v { color: var(--sev-critical); }
.d-tile .l { font-size: var(--t-xs); color: var(--muted); overflow-wrap: anywhere; }
.d-sub { font-size: var(--t-xs); color: var(--muted); margin: var(--s3) 0 var(--s1); }

/* Content scrolls as the only area; paged lists size to their rows. */
.k-panel { max-height: none; overflow: visible; }
.k-scroll { overflow-x: auto; overflow-y: auto; }
.k-table { max-width: 100%; }

/* Header: segmented theme control collapses to swatches; user role shows when wide. */
.sh-head, .sh-tools { min-width: 0; }
.sh-role { color: var(--muted); font-size: var(--t-xs); }
@media (max-width: 1279px) {
  .k-themes .k-tlabel { display: none; }
  .k-themes button { padding: 0 var(--s2); min-width: 40px; justify-content: center; }
  .sh-role { display: none; }
  .content { padding: var(--s4); }
  .topbar, .sh-head { padding-left: var(--s4); padding-right: var(--s4); }
}
@media (max-width: 1100px) { .app { grid-template-columns: 200px minmax(0, 1fr); } }
@media (max-width: 860px) { .app { grid-template-columns: 1fr; } .sh-user .sh-uname { display: none; } }


/* ===== VulnOps_UI skin: shapes, surfaces, type and page style of the VulnOps_UI branch, drawn with the tokens above ===== */
a { color: var(--link); }
h1, h2, h3 { letter-spacing: -0.015em; }
::selection { background: color-mix(in srgb, var(--accent) 35%, transparent); }
html { scrollbar-color: var(--hairline) transparent; }
.mono, code, pre { font-family: var(--mono); }

/* page backdrop: two soft glows and a faint grid that fades out downwards (dark and light; navy stays plain) */
body { background-image: radial-gradient(1100px 520px at 12% -8%, var(--glow-a), transparent 62%), radial-gradient(900px 480px at 100% -4%, var(--glow-b), transparent 58%); background-attachment: fixed; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 30%, transparent 75%); }

/* shell */
.app { grid-template-columns: 256px minmax(0, 1fr); }
.rail { background: var(--rail); padding: 0 12px 16px; gap: 0; }
.brand { height: 64px; padding: 0 8px; margin: 0 0 4px; }
.brand .name { font-weight: 650; letter-spacing: -0.01em; font-size: var(--t-lg); }
.navitem { border-radius: var(--radius); font-weight: 500; }
.navitem:hover { background: var(--rail-active); }
.navitem.active { background: var(--rail-active); }
.content { padding: var(--s8); }
.content > * { width: 100%; max-width: 100rem; align-self: center; }
.content > .k-tabs { width: auto; align-self: flex-start; }
.topbar { background: transparent; }

/* page header: bigger title, calm description, no sticky bar */
.k-pagehead { position: static; margin-top: 0; padding: 0 0 var(--s2); border-bottom: 0; background: transparent; align-items: flex-end; }
.k-pagehead h1 { font-size: var(--t-xl); font-weight: 600; line-height: 1.2; }
.k-pagehead p { font-size: var(--t-md); line-height: 1.55; max-width: 42rem; margin-top: 6px; }

/* cards and panels: soft depth, hairline border, top sheen */
.card, .kpi, .d-panel, .k-table, .k-split > aside, .login .box, .k-dialog, .k-drawer { border-radius: var(--radius-card); box-shadow: var(--shadow-card); background-image: linear-gradient(180deg, var(--sheen), transparent 38%); }
.k-table { overflow: hidden; }
.k-drawer { border-radius: var(--radius-card) 0 0 var(--radius-card); }
.d-panel > .d-hd { padding: var(--s3) var(--s4); }
.d-panel > .d-hd h2 { font-size: var(--t-lg); font-weight: 600; }
.d-tile, .k-error, .k-summary, .evidence, .tickerwrap, .funnelnode, .empty { border-radius: var(--radius); }
.d-tile .v, .kpi .v { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; }

/* tabs: one rounded track with a filled pill for the open tab */
.k-tabs { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; max-width: 100%; border: 1px solid var(--hairline); border-radius: var(--radius-card); background: color-mix(in srgb, var(--surface) 60%, transparent); }
.k-tab { min-height: 40px; padding: 0 14px; border-bottom: 0; border-radius: 14px; font-weight: 500; }
.k-tab:hover { background: var(--elev); }
.k-tab[aria-selected="true"] { background: var(--btn-grad); color: var(--on-accent); font-weight: 600; border-bottom-color: transparent; }
.k-tab[aria-selected="true"] .k-count { color: inherit; opacity: .85; }

/* buttons */
.btn { border-radius: var(--radius); font-weight: 500; }
.btn.primary { background: var(--btn-grad); border-color: transparent; color: var(--on-accent); }
:root:not([data-theme="navy"]) .btn.primary { box-shadow: inset 0 1px 0 rgba(255,255,255,.22), 0 6px 18px -8px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.k-iconbtn { border-radius: var(--radius); }
.k-themes { border-radius: var(--radius); }

/* forms */
input, select, textarea { background: var(--field); border-radius: var(--radius); }
.field input { background: var(--field); border-radius: var(--radius); }

/* chips, badges and severity pills: tinted, with a dot and a text label (text keeps full contrast) */
.pill { padding: 2px 10px; font-size: var(--t-xs); font-weight: 500; text-transform: capitalize; color: var(--ink); }
.pill[class*="sev-"] { color: var(--ink); }
.tag, .k-badge { border-radius: 999px; }

/* tables */
.k-scroll th, table.findings th, .k-scroll thead th { background: var(--surface); text-transform: uppercase; letter-spacing: .06em; font-size: 11px; font-weight: 600; padding: var(--s3) var(--s4); }
.k-scroll td, table.findings td { padding: var(--s3) var(--s4); }
.k-table[data-density="compact"] .k-scroll td, .k-table[data-density="compact"] .k-scroll th { padding: var(--s2) var(--s3); }
.k-scroll tbody tr:hover td, table.findings tr:hover td { background: var(--elev); }
.k-pager { padding: var(--s3) var(--s4); }

/* dialogs, menus and sign-in */
.login .box { border-radius: var(--radius-card); }
.k-dialog { border-radius: var(--radius-card); }

@media (max-width: 1100px) { .app { grid-template-columns: 220px minmax(0, 1fr); } .content { padding: var(--s6); } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .rail { padding: 8px; flex-direction: row; align-items: center; gap: 4px; flex-wrap: nowrap; }
  .rail > [role=group] { display: flex; flex-direction: row; align-items: center; flex: none; }
  .rail .sh-nav { flex-direction: row; }
  .rail .sh-group { display: none; }
  .rail .navitem { width: auto; white-space: nowrap; flex: none; }
  .brand { height: auto; padding: 4px 8px; margin: 0; flex: none; white-space: nowrap; }
  .content { padding: var(--s4); }
  .k-tabs { display: flex; }
}
