:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --border: #e2e1dc;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #8a8984;
  --grid: #e8e7e3;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --s1: #2a78d6;  /* primary   */
  --s2: #eb6834;  /* secondary */
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #008300;
  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;
  --good-ink: #006300;
  --crit-ink: #b42323;
  --warn-ink: #8a5a00;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 1px rgba(0,0,0,.03);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
    --text: #ffffff; --text-2: #c3c2b7; --muted: #8d8c85; --grid: #2a2a28;
    --accent: #3987e5; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --good-ink: #4cc24c; --crit-ink: #f07a7a; --warn-ink: #f2c14e;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --border: #2f2f2c;
  --text: #ffffff; --text-2: #c3c2b7; --muted: #8d8c85; --grid: #2a2a28;
  --accent: #3987e5; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
  --good-ink: #4cc24c; --crit-ink: #f07a7a; --warn-ink: #f2c14e;
  --shadow: none;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.45; }
h1 { font-size: 20px; margin: 0 0 16px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 14px; margin: 0; font-weight: 600; }
a { color: var(--accent); }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- sidebar navigation ---------- */
:root { --side-w: 232px; }
body { padding-left: var(--side-w); }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: var(--side-w); z-index: 40; display: flex; flex-direction: column;
  gap: 12px; padding: 16px 12px 12px; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; }
.brand { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-weight: 700; color: var(--accent); padding: 0 6px 4px; }
.brand #mode-badge:empty { display: none; }

.tabs { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 12px 10px 4px; }
.nav-group:first-child { padding-top: 4px; }
.tabs button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: 0;
  padding: 7px 10px; border-radius: 8px; color: var(--text-2); font: inherit; cursor: pointer; white-space: nowrap; }
.tabs button:hover { background: var(--surface-2); color: var(--text); }
.tabs button.active { color: var(--text); background: var(--surface-2); font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.tabs .ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.tabs button.active .ico { color: var(--accent); opacity: 1; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.side-foot { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.side-foot .usermenu { flex: 1; min-width: 0; }
.side-foot #btn-user { width: 100%; justify-content: flex-start; overflow: hidden; text-overflow: ellipsis; }
.sidebar .menu { top: auto; bottom: calc(100% + 6px); right: auto; left: 0; }    /* opens upwards from the foot */

/* sub-views of one sidebar entry (Logs: scans · events) */
.subnav { display: flex; gap: 2px; margin: -4px 0 16px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.subnav[hidden] { display: none; }
.subnav button { background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 8px 14px;
  font: inherit; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.subnav button:hover { color: var(--text); }
.subnav button.active { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.subnav button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.mobilebar { display: none; }
.nav-backdrop { position: fixed; inset: 0; z-index: 35; background: rgb(0 0 0 / .35); }
.nav-backdrop[hidden] { display: none; }
@media (max-width: 900px) {
  body { padding-left: 0; }
  .mobilebar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
    background: var(--surface); border-bottom: 1px solid var(--border); }
  .sidebar { transform: translateX(-100%); transition: transform .18s ease; box-shadow: 0 0 24px rgb(0 0 0 / .18); }
  body.nav-open .sidebar { transform: none; }
}

main { max-width: 1400px; margin: 0 auto; padding: 20px; }
.tab { display: none; }
.tab.active { display: block; }
.row { display: flex; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; gap: 12px; }
.row.gap { gap: 10px; flex-wrap: wrap; }

/* ---------- controls ---------- */
.btn { font: inherit; font-weight: 550; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); padding: 7px 12px; border-radius: 8px; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: progress; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; }
input[type=search] { min-width: 280px; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 6px 12px; font: inherit; color: var(--text-2); cursor: pointer; }
.seg button.active { background: var(--surface-2); color: var(--text); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chips button { border: 1px solid var(--border); background: var(--surface); color: var(--text-2); border-radius: 999px;
  padding: 5px 12px; font: inherit; cursor: pointer; }
.chips button.active { background: var(--text); color: var(--surface); border-color: var(--text); }
.chips.small { margin: 0; }
.chips.small button { padding: 3px 10px; font-size: 12.5px; }
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; color: var(--text-2); font-size: 13px; }
.form label.check { display: flex; align-items: center; gap: 8px; }
.hint { color: var(--muted); font-size: 12.5px; flex: 1; min-width: 200px; }

/* ---------- cards / grid ---------- */
.grid { display: grid; gap: 16px; margin-bottom: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g2-1 { grid-template-columns: 2fr 1fr; }
@media (max-width: 1000px) { .g2, .g3, .g2-1 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 16px; min-width: 0; }
.grid > .card { margin-bottom: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-h.pad { padding: 14px 16px 0; }
.sub { color: var(--muted); font-size: 12.5px; }
.link { font-size: 13px; text-decoration: none; }
.chart { position: relative; height: 240px; }

/* ---------- KPI tiles ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow); cursor: pointer; text-align: left; font: inherit; color: inherit; }
.kpi:hover { border-color: var(--text-2); }
.kpi .label { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 28px; font-weight: 650; letter-spacing: -.02em; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi .delta { font-size: 12px; color: var(--muted); }
.delta.up-bad, .delta.down-bad { color: var(--crit-ink); }
.delta.up-good, .delta.down-good { color: var(--good-ink); }
.kpi svg.spark { width: 100%; height: 28px; display: block; margin-top: 6px; }

/* ---------- horizontal bars ---------- */
.hbars { display: grid; gap: 8px; }
.hbar { display: grid; grid-template-columns: minmax(90px, 40%) 1fr 36px; gap: 10px; align-items: center; font-size: 13px; }
.hbar .k { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 6px; align-items: center; }
.hbar .track, .hbar .fill { display: block; }
.hbar .track { height: 10px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--s1); }
.hbar .n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }
.empty { color: var(--muted); font-size: 13px; padding: 12px 0; }

/* ---------- tables ---------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; background: var(--surface); font-size: 12.5px; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl.compact td, .tbl.compact th { padding: 7px 8px; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.dim { color: var(--muted); }
.crit-text { color: var(--crit-ink); }
.warn-text { color: var(--warn-ink, var(--text-2)); }
#ns-form p[hidden] { display: none; }
#ai-card[hidden], #ai-form [data-prov][hidden] { display: none; }
#int-form [data-tr][hidden], #int-form label[hidden], #met-once[hidden] { display: none; }

/* ---------- badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px;
  font-weight: 550; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.pill.muted { font-weight: 500; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.st-ok .dot, .dot.good { background: var(--good); }
.st-rec .dot, .dot.warning { background: var(--warning); }
.st-req .dot, .dot.critical { background: var(--critical); }
.dot.serious { background: var(--serious); }
.dot.s1 { background: var(--s1); } .dot.s2 { background: var(--s2); }
.risk { display: inline-block; min-width: 34px; text-align: center; font-weight: 650; border-radius: 6px; padding: 2px 6px;
  font-variant-numeric: tabular-nums; font-size: 12.5px; border: 1px solid var(--border); }
.risk.r-crit { color: var(--crit-ink); border-color: color-mix(in srgb, var(--critical) 50%, transparent); background: color-mix(in srgb, var(--critical) 10%, transparent); }
.risk.r-high { color: var(--warn-ink); border-color: color-mix(in srgb, var(--serious) 55%, transparent); background: color-mix(in srgb, var(--serious) 10%, transparent); }
.risk.r-med { color: var(--text-2); }
.risk.r-low { color: var(--muted); }
.ports { display: flex; gap: 4px; flex-wrap: wrap; }
.port { font-family: ui-monospace, monospace; font-size: 11.5px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); }
.port.risky { color: var(--crit-ink); border-color: color-mix(in srgb, var(--critical) 45%, transparent); }

/* ---------- feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 140px 20px 1fr; gap: 10px; padding: 9px 4px; border-bottom: 1px solid var(--grid); align-items: start; }
.feed li:last-child { border-bottom: 0; }
.feed .t { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.feed .m { font-size: 13.5px; }
.feed .ty { color: var(--muted); font-size: 12px; }
.sev { width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 50%; font-size: 11px; font-weight: 700; color: #fff; margin-top: 1px; }
.sev.high { background: var(--critical); } .sev.medium { background: var(--serious); } .sev.info { background: var(--muted); }
@media (max-width: 700px) { .feed li { grid-template-columns: 1fr; } }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .15s; z-index: 40; }
.scrim.open { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 100vw); background: var(--surface); z-index: 50;
  border-left: 1px solid var(--border); transform: translateX(100%); transition: transform .18s ease; display: flex; flex-direction: column; }
.drawer.open { transform: none; }
.drawer-h { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.drawer-b { overflow-y: auto; padding: 16px 18px 40px; }
.drawer-b h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 20px 0 8px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text-2); }
.kv dd { margin: 0; word-break: break-word; }
.timeline { display: flex; gap: 2px; height: 22px; align-items: stretch; margin: 4px 0; }
.timeline span { flex: 1; border-radius: 2px; min-width: 3px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--surface);
  padding: 10px 16px; border-radius: 8px; opacity: 0; transition: all .2s; pointer-events: none; z-index: 60; font-weight: 550; }
.toast.show { opacity: 1; transform: translateX(-50%); }
.tooltip { position: fixed; pointer-events: none; background: var(--text); color: var(--surface); font-size: 12px;
  padding: 5px 8px; border-radius: 6px; opacity: 0; z-index: 70; white-space: nowrap; }

/* ---------- v2 ---------- */
.callout { border: 1px solid color-mix(in srgb, var(--serious) 55%, var(--border)); background: color-mix(in srgb, var(--serious) 8%, var(--surface));
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: 13px; line-height: 1.55; }
.form .seg { justify-self: start; }
.lc { display: inline-flex; align-items: center; gap: 5px; }
.conf { font-size: 11px; color: var(--muted); }
.conf.low { color: var(--warn-ink); }
.tbl input.inline, .tbl select.inline { padding: 3px 6px; font-size: 12.5px; width: 80px; }
.tbl input.inline.wide { width: 120px; }
.agebar { position: relative; height: 8px; background: var(--surface-2); border-radius: 4px; width: 110px; overflow: hidden; }
.agebar span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.vres { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; font-size: 13px; }
.vres .h { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.vres pre { margin: 6px 0 0; white-space: pre-wrap; word-break: break-all; font-size: 12px; color: var(--text-2); max-height: 160px; overflow: auto; }
.vres details summary { cursor: pointer; color: var(--text-2); font-size: 12px; margin-top: 4px; }
.brand-name { color: var(--text); letter-spacing: .06em; font-size: 13.5px; font-weight: 600; }
.kpi .label { min-height: 2.9em; align-items: flex-start; } .kpi .label .dot { margin-top: .45em; }

/* official partner logo (dropped into data/brand/) */
.brand-logo { height: 22px; width: auto; display: block; }
.brand.has-logo .brand-name { padding-left: 10px; border-left: 1px solid var(--border); }
.brand.has-logo > svg { display: none; }

.disclaimer { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.pill.dev { border-color: color-mix(in srgb, var(--warning) 60%, var(--border)); }
.md h2 { font-size: 16px; margin: 22px 0 6px; } .md h3 { font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 12px 0 4px; }
.md ul { margin: 4px 0 8px; padding-left: 20px; } .md li { margin: 3px 0; font-size: 13px; } .md p { font-size: 13px; }
.brand-logo[hidden] { display: none; }

/* ---------- v2.2: accounts ---------- */
body[data-role="viewer"] .op-only { display: none !important; }
body:not([data-role="admin"]) .admin-only { display: none !important; }
.btn.danger { color: var(--crit-ink); border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); }
.btn.danger:hover { background: color-mix(in srgb, var(--critical) 10%, var(--surface)); }
.btn.block { width: 100%; justify-content: center; padding: 9px 12px; }
.pill.role-admin { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.pill.role-operator { color: var(--text); }

.usermenu { position: relative; }
.usermenu #btn-user { padding: 4px 10px 4px 4px; }
.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 12px;
  font-weight: 700; background: var(--accent); color: var(--accent-ink); }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--surface); z-index: 30;
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 6px; }
.menu[hidden] { display: none; }
.menu-h { display: grid; padding: 6px 10px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 13px; }
.menu-h .dim { font-size: 12px; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--text);
  padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }

/* login page */
/* background: dark "network map" (login-bg.js) in both themes; the card follows the theme */
.auth-page { min-height: 100vh; margin: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  background: radial-gradient(ellipse at 30% 50%, #0f2440 0%, #0a1526 45%, #060b14 100%); overflow-x: hidden; }
#cyber-bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.auth-hero { position: relative; z-index: 1; padding: 48px clamp(24px, 6vw, 96px); color: #e8eef7; max-width: 620px; }
.auth-hero-brand { display: flex; align-items: center; gap: 12px; color: #6aa8f0; font-weight: 700; letter-spacing: .14em; font-size: 15px; }
.auth-hero-title { margin: 28px 0 10px; font-size: clamp(28px, 3.2vw, 42px); line-height: 1.15; font-weight: 700; color: #fff; }
.auth-hero-sub { margin: 0 0 26px; font-size: 16px; line-height: 1.55; color: #a9b8cc; }
.auth-hero-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; color: #c9d4e3; font-size: 14px; }
.auth-hero-list li { display: flex; align-items: center; gap: 10px; }
.auth-hero-list .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.auth-hero-list .d1 { background: #3987e5; box-shadow: 0 0 10px #3987e5; }
.auth-hero-list .d2 { background: #eb6834; box-shadow: 0 0 10px #eb6834; }
.auth-hero-list .d3 { background: #1baf7a; box-shadow: 0 0 10px #1baf7a; }
.auth-wrap { position: relative; z-index: 1; width: 440px; max-width: 100%; box-sizing: border-box;
  padding: 24px clamp(16px, 5vw, 72px) 24px 16px; }
.auth-page .auth-card { box-shadow: 0 20px 60px rgba(0,0,0,.45), 0 0 0 1px rgba(120,170,240,.12); }
.auth-page .auth-foot { color: #8fa1b8; }
@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; justify-items: center; }
  .auth-hero { display: none; }
  .auth-wrap { width: 100%; max-width: 420px; padding: 24px 16px; }
}
.auth-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px 28px 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 12px 32px rgba(0,0,0,.06); }
.auth-brand { margin-bottom: 22px; }
.auth-card h1 { margin: 0 0 4px; }
.auth-card .sub { margin: 0; line-height: 1.5; }
.auth-card form[hidden] { display: none; }
.auth-card .hint { margin: -4px 0 0; }
.auth-err { color: var(--crit-ink); font-size: 13px; min-height: 1em; }
.auth-err:empty { display: none; }
.auth-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 16px; }

/* ---------- v2.2: device-type fingerprint ---------- */
:root {
  --cat-computer: var(--s1); --cat-network: var(--s3); --cat-iot: var(--s2); --cat-ot: var(--critical);
  --cat-printer: var(--s4); --cat-storage: var(--s5); --cat-mobile: var(--s6); --cat-unknown: var(--muted);
}
.dot.cat-computer { background: var(--cat-computer); } .dot.cat-network { background: var(--cat-network); }
.dot.cat-iot { background: var(--cat-iot); } .dot.cat-ot { background: var(--cat-ot); }
.dot.cat-printer { background: var(--cat-printer); } .dot.cat-storage { background: var(--cat-storage); }
.dot.cat-mobile { background: var(--cat-mobile); } .dot.cat-unknown { background: var(--cat-unknown); }
.conf.medium { color: var(--text-2); }
.evidence { margin: 6px 0 0; padding-left: 18px; color: var(--text-2); font-size: 12.5px; }
.evidence li { margin: 1px 0; }
.hbars.cols { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); column-gap: 32px; }
.hbar.clickable { cursor: pointer; border-radius: 6px; }
.hbar.clickable:hover .k { color: var(--text); }
.card-h .cat-filter { padding: 3px 8px; font-size: 12.5px; }
#cred-form p.hint { margin: 0; }

/* ---------- v2.2: risk explanation ---------- */
.rk { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 4px; margin-right: 4px;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.rk-protection { color: var(--crit-ink); border-color: color-mix(in srgb, var(--critical) 40%, var(--border)); }
.rk-visibility { color: var(--warn-ink); border-color: color-mix(in srgb, var(--serious) 50%, var(--border)); }
.rk-exposure { color: var(--s2); border-color: color-mix(in srgb, var(--s2) 45%, var(--border)); }
.rk-lifecycle { color: var(--text-2); }
.reason { font-size: 12.5px; line-height: 1.4; }
.tbl.riskf td { vertical-align: top; }
.tbl.riskf .pts { width: 44px; font-weight: 650; color: var(--text); }
.tbl.riskf tfoot td { border-bottom: 0; border-top: 1px solid var(--border); }
.tbl.riskf tbody tr { cursor: default; }

/* ---------- v2.2: PDF report dialog ---------- */
fieldset.sections { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; margin: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 12px; }
fieldset.sections legend { color: var(--text-2); font-size: 13px; padding: 0 4px; }

/* ---------- v2.2: two-factor authentication ---------- */
.qr { display: flex; justify-content: center; padding: 10px; margin: 6px 0; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; width: fit-content; }
.qr svg { display: block; }
.auth-card .qr { margin: 0 auto; }
code.secret { font-size: 13px; letter-spacing: .06em; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 6px; padding: 4px 8px; display: inline-block; word-break: break-all; user-select: all; }
details.manual summary { cursor: pointer; color: var(--text-2); font-size: 13px; }
details.manual { font-size: 13px; }
input.otp { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 18px; letter-spacing: .18em; text-align: center; }
ol.codes { columns: 2; column-gap: 24px; margin: 4px 0; padding-left: 26px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 14px; line-height: 1.9; }
ol.steps { padding-left: 18px; margin: 12px 0 0; } ol.steps > li { margin-bottom: 14px; }
.menu button .dim { font-size: 12px; }
label.grow { flex: 1; display: grid; gap: 4px; color: var(--text-2); font-size: 13px; }

/* ---------- v2.2: re-authentication dialog ---------- */
dialog.reauth { border: 1px solid var(--border); border-radius: 14px; padding: 22px; width: min(400px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
dialog.reauth::backdrop { background: rgba(0,0,0,.4); }
dialog.reauth h2 { font-size: 16px; }
dialog.reauth label[hidden] { display: none; }

/* ---------- v2.2: OS lifecycle ---------- */
.kpi.sel { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.tbl tr.sel td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.past-critical { color: var(--crit-ink) !important; }
.past-serious { color: var(--warn-ink) !important; }

/* ---------- v2.2: known vulnerabilities (osv.dev) ---------- */
.rk-vulnerability { color: var(--crit-ink); border-color: color-mix(in srgb, var(--critical) 40%, var(--border)); }
.pill.sev-critical { color: var(--crit-ink); border-color: color-mix(in srgb, var(--critical) 45%, var(--border)); }
.pill.sev-high { color: var(--warn-ink); border-color: color-mix(in srgb, var(--serious) 50%, var(--border)); }
.drawer-b h3 .src { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 11.5px; color: var(--muted);
  border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.tbl.vulns td { vertical-align: top; }
.tbl.vulns a { text-decoration: none; }
/* selected lifecycle tile: clearly "on" (it filters the tables below) */
.kpi.sel { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.kpi.sel .label { color: var(--text); font-weight: 600; }
.kpis .kpi[data-os]::after, .kpis .kpi[data-lc]::after { content: "Show devices ↓"; display: block; font-size: 11.5px; color: var(--accent); margin-top: 6px; opacity: 0; transition: opacity .12s; }
.kpis .kpi[data-os]:hover::after, .kpis .kpi[data-lc]:hover::after, .kpis .kpi.sel::after { opacity: 1; }
.kpis .kpi.sel::after { content: "Showing ↓ · click again to clear"; }
/* BIOS standard row in the age-standard table */
.tbl tr.bios-row td { border-top: 1px solid var(--border); background: var(--surface-2); }
/* possible-duplicate notice in the asset drawer */
.callout.dup { border-color: color-mix(in srgb, var(--warning) 55%, var(--border)); background: color-mix(in srgb, var(--warning) 8%, var(--surface)); }

/* ---------- v3.1: service / title (what a host announces) ---------- */
.svccell { min-width: 220px; max-width: 360px; font-size: 12.5px; }
.svcline { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.55; }
.svc { display: inline-block; min-width: 34px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px;
  color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px;
  margin-right: 6px; text-align: center; }
.svc-tbl td { vertical-align: top; font-size: 12.5px; }
pre.code { margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-x: auto; white-space: pre; }
.token-once { padding: 10px 12px; border: 1px dashed var(--border); border-radius: 8px; display: grid; gap: 8px; }

/* software inventory: product rows open the list of devices that have it */
#inv-table tr[data-sw] { cursor: pointer; }
#inv-table tr.sw-devs > td { background: var(--surface-2); padding: 6px 12px 12px; }
.tbl.sub { font-size: 12.5px; }
.tbl.sub th { font-size: 11px; }
#sw-bar { margin: 4px 0 10px; gap: 8px; }
#sw-cover { font-size: 12.5px; }
#inv-cat[hidden], #inv-views[hidden], #sw-bar[hidden] { display: none; }
#sw-pager { padding: 10px 14px; border-top: 1px solid var(--border); gap: 8px; font-size: 13px; }
#sw-pager[hidden] { display: none; }
#sw-pager .btn:disabled { opacity: .4; cursor: default; }

/* ---------- AI assistant: floating chat widget ---------- */
.ai-fab { position: fixed; right: 22px; bottom: 22px; z-index: 46; width: 58px; height: 58px; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: var(--accent); color: var(--accent-ink); cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.22), 0 2px 6px rgba(0,0,0,.12); transition: transform .15s ease, filter .15s; }
.ai-fab:hover { transform: translateY(-2px); filter: brightness(1.08); }
.ai-fab:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 3px; }
.ai-fab[hidden] { display: none; }
.ai-fab .ico { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ai-fab .i-close { display: none; }
.ai-fab[aria-expanded="true"] .i-chat { display: none; }
.ai-fab[aria-expanded="true"] .i-close { display: block; }
.ai-fab-tip { position: fixed; right: 90px; bottom: 36px; z-index: 46; background: var(--text); color: var(--bg); font-size: 12.5px;
  font-weight: 550; padding: 6px 10px; border-radius: 8px; pointer-events: none; opacity: 0; transform: translateX(6px);
  transition: opacity .15s, transform .15s; white-space: nowrap; }
.ai-fab:hover + .ai-fab-tip { opacity: 1; transform: none; }
.ai-fab[aria-expanded="true"] + .ai-fab-tip { display: none; }
.ai-panel { position: fixed; right: 22px; bottom: 92px; z-index: 45; width: min(400px, calc(100vw - 32px));
  height: min(620px, calc(100vh - 120px)); background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 18px 48px rgba(0,0,0,.22), 0 4px 12px rgba(0,0,0,.1);
  transform-origin: bottom right; transform: translateY(12px) scale(.96); opacity: 0; visibility: hidden;
  transition: transform .16s ease, opacity .16s ease, visibility 0s linear .16s; }
.ai-panel.open { transform: none; opacity: 1; visibility: visible; transition: transform .16s ease, opacity .16s ease; }
.ai-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: var(--accent); color: var(--accent-ink); }
.ai-head h2 { font-size: 15px; margin: 0; color: inherit; }
.ai-head .ai-sub { font-size: 11.5px; opacity: .85; display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.ai-head .ai-sub .dot { width: 7px; height: 7px; border-radius: 50%; background: #7ee2a8; display: inline-block; }
.ai-head .ai-sub .dot.off { background: #ffd27a; }
.ai-head .btn { color: inherit; border-color: transparent; }
.ai-head .btn:hover { background: rgba(255,255,255,.16); }
.ai-avatar { width: 34px; height: 34px; border-radius: 50%; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.18); }
.ai-avatar .ico, .ai-bot-ava .ico { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.ai-msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); }
.ai-row { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.ai-row.user { justify-content: flex-end; }
.ai-bot-ava { width: 26px; height: 26px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); }
.ai-msg { max-width: 85%; font-size: 13.5px; line-height: 1.5; overflow-wrap: anywhere; }
.ai-msg.user { background: var(--accent); color: var(--accent-ink); padding: 8px 12px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.ai-msg.bot { background: var(--surface); border: 1px solid var(--border); padding: 9px 12px; border-radius: 14px 14px 14px 4px; }
.ai-msg.bot p { margin: 0 0 6px; } .ai-msg.bot p:last-child { margin-bottom: 0; }
.ai-msg.bot ul, .ai-msg.bot ol { margin: 4px 0 6px; padding-left: 18px; }
.ai-msg.bot a[data-dev] { color: var(--accent); font-weight: 550; text-decoration: none; }
.ai-msg.bot a[data-dev]:hover { text-decoration: underline; }
.ai-msg.err { background: color-mix(in srgb, var(--critical) 10%, var(--surface)); border-color: color-mix(in srgb, var(--critical) 35%, var(--border)); }
.ai-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ai-acts .btn { border-radius: 999px; }
.ai-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.ai-typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: ai-bounce 1.2s infinite ease-in-out; }
.ai-typing i:nth-child(2) { animation-delay: .15s; } .ai-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.ai-sugg { display: flex; flex-wrap: wrap; gap: 6px; padding-left: 34px; }
.ai-sugg button { border-radius: 999px; background: var(--surface); }
.ai-compose { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); align-items: flex-end; background: var(--surface); }
.ai-compose textarea { flex: 1; resize: none; font: inherit; font-size: 13.5px; padding: 9px 12px; border-radius: 18px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text); max-height: 120px; }
.ai-compose textarea:disabled { opacity: .6; }
.ai-send { width: 38px; height: 38px; border-radius: 50%; padding: 0; display: grid; place-items: center; flex: none; }
.ai-send .ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ai-note { margin: 0; padding: 0 12px 10px; font-size: 11px; color: var(--muted); background: var(--surface); }
@media (prefers-reduced-motion: reduce) { .ai-panel, .ai-panel.open, .ai-fab, .ai-fab-tip { transition: none; } .ai-typing i { animation: none; } }
@media (max-width: 640px) {
  .ai-fab { right: 14px; bottom: 14px; width: 54px; height: 54px; }
  .ai-fab-tip { display: none; }
  .ai-panel { right: 0; bottom: 0; width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
  .ai-panel.open ~ .ai-fab, body.ai-open .ai-fab { display: none; }
}
#ai-p-clear[hidden] { display: none; }
.ai-head .ai-sub span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
