:root {
  --bg: #0f1419;
  --panel: #1a222c;
  --text: #e7eef7;
  --muted: #8b9bb0;
  --accent: #3d8bfd;
  --border: #2a3544;
  --error: #f07178;
  --ok: #7fd99a;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: linear-gradient(160deg, #0f1419 0%, #15202b 50%, #0f1419 100%);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.muted { color: var(--muted); }
.error { color: var(--error); }
.ok-msg { color: var(--ok); }
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(0,0,0,.25);
}
.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns .2s ease;
}
.app-shell.sidebar-collapsed {
  grid-template-columns: 64px 1fr;
}
.sidebar {
  position: relative;
  background: #0b1016;
  border-right: 1px solid var(--border);
  padding: 1.25rem .75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
  z-index: 5;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .35rem;
  min-height: 2.5rem;
  padding-right: .5rem;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 0 .35rem;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.sidebar-brand:hover { text-decoration: none; color: #fff; }
.sidebar-collapse-btn {
  position: absolute;
  top: 1.35rem;
  right: -0.7rem;
  z-index: 6;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  margin: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #121820;
  color: var(--muted);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.sidebar-collapse-btn:hover {
  color: var(--text);
  border-color: var(--accent);
  background: #15202b;
}
.sidebar.is-collapsed .sidebar-collapse-btn svg {
  transform: rotate(180deg);
}
.nav-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  opacity: .95;
}
.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notif-nav-btn {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  background: transparent !important;
  border: none !important;
  border-radius: 6px;
  color: inherit;
  margin: 0 !important;
  padding: .45rem .6rem;
}
.notif-nav-btn:hover { background: #15202b !important; }
.notif-nav-label {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-width: 0;
}
.notif-icon { flex-shrink: 0; opacity: .9; }
.notif-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.15rem;
  height: 1.15rem;
  padding: 0 .28rem;
  border-radius: 999px;
  background: var(--error);
  color: #fff;
  font-size: .7rem;
  line-height: 1;
  font-weight: 700;
}
.notif-badge-inline { position: static; }
.notif-trigger-header {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin: 0;
  padding: .45rem .7rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.notif-trigger-header:hover { border-color: var(--accent); }
.results-header-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .5rem;
}
.security-score {
  display: flex;
  align-items: baseline;
  gap: .45rem;
  padding: .4rem .7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #121820;
  line-height: 1.1;
}
.security-score-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
}
.security-score-value {
  font-size: 1.45rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.security-score-band {
  font-size: .85rem;
  font-weight: 600;
}
.security-score.band-excellent { border-color: #7fd99a; color: #7fd99a; }
.security-score.band-good { border-color: #59c2ff; color: #59c2ff; }
.security-score.band-fair { border-color: #ffb454; color: #ffb454; }
.security-score.band-poor { border-color: #f07178; color: #f07178; }
.security-score.band-excellent .security-score-label,
.security-score.band-good .security-score-label,
.security-score.band-fair .security-score-label,
.security-score.band-poor .security-score-label { color: inherit; opacity: .75; }
.score-cell {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  font-variant-numeric: tabular-nums;
}
.score-cell .score-num { font-weight: 700; }
.score-cell.band-excellent { color: #7fd99a; }
.score-cell.band-good { color: #59c2ff; }
.score-cell.band-fair { color: #ffb454; }
.score-cell.band-poor { color: #f07178; }
.notif-panel {
  z-index: 50;
  width: min(22rem, calc(100vw - 2rem));
  max-height: min(70vh, 28rem);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.35);
}
.notif-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem .9rem;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--panel);
}
.notif-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.notif-item {
  border-bottom: 1px solid var(--border);
}
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: rgba(61, 139, 253, .08); }
.notif-form { margin: 0; }
.notif-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: .75rem .9rem;
  color: inherit;
  text-decoration: none;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  margin: 0;
  font: inherit;
}
.notif-link:hover { background: rgba(255,255,255,.04); text-decoration: none; }
.notif-type {
  display: inline-block;
  margin-right: .4rem;
  font-size: .75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.notif-title {
  margin: .35rem 0 .2rem;
  font-weight: 600;
  line-height: 1.3;
}
.notif-body {
  font-size: .85rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.notif-time { margin-top: .35rem; font-size: .75rem; }
.notif-empty { margin: 0; padding: 1rem .9rem; }
.sev.info { color: var(--muted); border-color: var(--muted); }
.kev-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  margin-left: .35rem;
  padding: .1rem .4rem;
  border-radius: 4px;
  border: 1px solid #ff8a4c;
  color: #ff8a4c;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  vertical-align: middle;
}
.kev-flame { color: #ff8a4c; flex-shrink: 0; }
.filter-kev {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.kev-cve { margin-bottom: .85rem; }
.kev-cve:last-child { margin-bottom: 0; }

.brand-logo {
  display: block;
  width: auto;
  height: 40px;
  max-width: 180px;
  object-fit: contain;
  flex-shrink: 0;
}
.brand-logo-lg {
  height: 56px;
  max-width: 240px;
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: .5rem;
}
.auth-brand h1 { margin: 0; }
.auth-brand .brand-logo { width: auto; height: 56px; }
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  flex: 1;
  min-height: 0;
  overflow: auto;
}
.nav-link, .nav-sublink {
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .45rem .6rem;
  border-radius: 6px;
  color: var(--text);
  text-decoration: none;
  position: relative;
}
.nav-link:hover, .nav-sublink:hover { background: #15202b; text-decoration: none; }
.nav-link.active, .nav-sublink.active {
  background: #1c2b3d;
  color: #fff;
}
.nav-group {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  margin: .15rem 0 .5rem .5rem;
  padding-left: .35rem;
  border-left: 1px solid var(--border);
}
.nav-sublink { font-size: .92rem; color: var(--muted); }
.nav-sublink.active { color: #fff; }
.nav-empty {
  padding: .35rem .6rem;
  color: var(--muted);
  font-size: .85rem;
}
.nav-customer-select {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  margin: .15rem 0 .55rem;
  padding: .35rem .5rem;
  border-radius: 6px;
  position: relative;
}
.nav-customer-select .nav-icon {
  margin-top: .55rem;
}
.nav-select-body {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
  flex: 1;
}
.nav-customer-select .nav-empty {
  display: block;
  padding: 0;
  font-size: .75rem;
}
.nav-customer-select select {
  width: 100%;
  margin: 0;
  font-size: .9rem;
  padding: .3rem .4rem;
}
.sidebar-nav .notif-nav-btn {
  margin-top: auto;
}
.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: .75rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.sidebar-footer .sidebar-logout {
  width: 100%;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.sidebar-footer .sidebar-logout:hover {
  background: #15202b;
  text-decoration: none;
}
.sidebar-user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 .35rem;
}

/* Collapsed icon rail */
.sidebar.is-collapsed {
  padding-left: .45rem;
  padding-right: .45rem;
  overflow: visible;
}
.sidebar.is-collapsed .sidebar-nav {
  overflow: visible;
}
.sidebar.is-collapsed .sidebar-top {
  justify-content: center;
  padding-right: 0;
}
.sidebar.is-collapsed .sidebar-brand {
  justify-content: center;
  padding: 0;
}
.sidebar.is-collapsed .brand-logo {
  height: 28px;
  max-width: 36px;
}
.sidebar.is-collapsed .sidebar-user {
  display: none;
}
.sidebar.is-collapsed .nav-label,
.sidebar.is-collapsed .nav-select-body {
  position: absolute;
  left: calc(100% + .45rem);
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
  padding: .35rem .55rem;
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  opacity: 0;
  pointer-events: none;
  z-index: 40;
  color: var(--text);
  font-size: .85rem;
}
.sidebar.is-collapsed .nav-select-body {
  top: 0;
  transform: none;
  min-width: 12rem;
  padding: .5rem;
}
.sidebar.is-collapsed .nav-link,
.sidebar.is-collapsed .notif-nav-btn,
.sidebar.is-collapsed .sidebar-logout,
.sidebar.is-collapsed .nav-customer-select {
  justify-content: center;
  padding-left: .55rem;
  padding-right: .55rem;
}
.sidebar.is-collapsed .notif-nav-btn {
  justify-content: center !important;
  position: relative;
}
.sidebar.is-collapsed .notif-nav-label {
  gap: 0;
}
.sidebar.is-collapsed .nav-link:hover .nav-label,
.sidebar.is-collapsed .sidebar-logout:hover .nav-label,
.sidebar.is-collapsed .notif-nav-btn:hover .nav-label,
.sidebar.is-collapsed .nav-customer-select:hover .nav-select-body {
  opacity: 1;
  pointer-events: auto;
}
.sidebar.is-collapsed .nav-customer-select:hover {
  background: #15202b;
}
.sidebar.is-collapsed .notif-badge-inline {
  position: absolute;
  top: .15rem;
  right: .15rem;
  min-width: .85rem;
  height: .85rem;
  font-size: .6rem;
  padding: 0 .2rem;
}
.content {
  min-width: 0;
  min-height: 0;
  height: 100vh;
  overflow: auto;
}
.wrap { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }
.wrap.customer-page {
  max-width: 1400px;
  width: 100%;
  box-sizing: border-box;
  padding: 1rem 1.25rem;
}
.wrap.results-page {
  max-width: 1400px;
  width: 100%;
  height: auto;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: 1rem 1.25rem;
  overflow: visible;
}
.page-tabs {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: .25rem;
  flex-shrink: 0;
}
.page-tabs a {
  padding: .5rem 0;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.page-tabs a:hover { color: var(--text); text-decoration: none; }
.page-tabs a.active {
  color: #fff;
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.history-banner {
  flex-shrink: 0;
  padding: .75rem 1rem;
  border: 1px solid #ffb454;
  border-radius: 8px;
  background: rgba(255, 180, 84, 0.1);
  color: #ffd580;
}
.history-banner a { margin-left: .5rem; }
.estate-note { margin: 0; flex-shrink: 0; }
.appliance-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  padding: .7rem .9rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-shrink: 0;
}
.appliance-filter button { margin-top: 0; }
.past-scans { flex-shrink: 0; }
.results-workspace {
  flex: none;
  height: min(68vh, 780px);
  min-height: 420px;
  display: grid;
  grid-template-columns: minmax(300px, 380px) 1fr;
  gap: 1rem;
  overflow: hidden;
}
.crumb { color: var(--muted); margin: 0 0 1rem; }
.pill {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .8rem;
  text-transform: lowercase;
  border: 1px solid var(--border);
}
.pill.online { color: var(--ok); border-color: var(--ok); }
.pill.offline { color: var(--error); border-color: var(--error); }
.pill.never { color: var(--muted); }
.error-banner { border-color: var(--error); }

@media (max-width: 800px) {
  .app-shell,
  .app-shell.sidebar-collapsed {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .sidebar,
  .sidebar.is-collapsed {
    border-right: none;
    border-bottom: 1px solid var(--border);
    overflow: visible;
  }
  .sidebar-collapse-btn { display: none; }
  .sidebar.is-collapsed .nav-label,
  .sidebar.is-collapsed .nav-select-body,
  .sidebar.is-collapsed .sidebar-user {
    position: static;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    white-space: nowrap;
  }
  .sidebar.is-collapsed .sidebar-user { display: block; }
  .sidebar.is-collapsed .nav-link,
  .sidebar.is-collapsed .notif-nav-btn,
  .sidebar.is-collapsed .sidebar-logout,
  .sidebar.is-collapsed .nav-customer-select {
    justify-content: flex-start;
  }
  .sidebar.is-collapsed .notif-nav-label { gap: .55rem; }
}

section { margin: 2rem 0; padding: 1.25rem; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.banner { border-color: var(--ok); }
.token {
  display: block;
  margin-top: .75rem;
  padding: .75rem 1rem;
  background: #0b1016;
  border-radius: 6px;
  word-break: break-all;
  font-size: 1.05rem;
}
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .85rem; }
label { display: block; margin: .75rem 0; }
input, textarea, select, button {
  font: inherit;
  color: var(--text);
  background: #0b1016;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .5rem .65rem;
}
textarea { width: 100%; }
button {
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  cursor: pointer;
  margin-top: .5rem;
}
button.linkish {
  background: transparent;
  border: none;
  color: var(--accent);
  padding: 0;
  margin: 0;
}
button.linkish.danger { color: var(--error); }
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
}
.inline-action { display: inline; margin: 0; }
.check-label {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}
.check-label input { width: auto; margin: 0; }
.row-editing { background: rgba(61, 139, 253, 0.08); }
.inline { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; }
.inline label { margin: 0; }
.actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0 1.25rem;
}
.actions-row form.inline { display: inline; }
.error-banner { border-color: var(--danger, #f87171); color: #fecaca; }

button.danger,
button.danger:disabled {
  background: #7f1d1d;
  border-color: #991b1b;
  color: #fecaca;
}
button.danger:hover:not(:disabled) {
  background: #991b1b;
}
button.danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.hv-dialog {
  border: 1px solid var(--border, #334155);
  border-radius: 0.75rem;
  padding: 0;
  background: var(--surface, #0f172a);
  color: inherit;
  max-width: 32rem;
  width: calc(100% - 2rem);
}
.hv-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}
.hv-dialog-body {
  padding: 1.25rem 1.5rem 1.5rem;
}
.hv-dialog-body h2 {
  margin-top: 0;
}
.hv-dialog-ack {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  margin: 1rem 0 1.25rem;
  font-size: 0.95rem;
}
.hv-dialog-ack input {
  margin-top: 0.2rem;
}
.hv-dialog-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.row { display: flex; gap: 1rem; align-items: center; }
.auth { display: grid; place-items: center; }
.auth-card {
  width: min(380px, 92vw);
  padding: 2rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.auth-card h1 { margin: 0 0 .25rem; letter-spacing: .04em; }
.auth-card label { width: 100%; }
.auth-card input { width: 100%; margin-top: .35rem; }
.auth-card button { width: 100%; margin-top: 1rem; }
.auth-card button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}
.login-cooldown {
  margin: 0 0 .75rem;
  font-size: .92rem;
}
.auth-card-wide { max-width: 28rem; }
.totp-steps { margin: .75rem 0 1rem; padding-left: 1.2rem; }
.totp-setup {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
  padding: .75rem;
  background: #0b1016;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.totp-qr {
  display: block;
  background: #fff;
  border-radius: 6px;
  padding: .35rem;
}
.totp-secret {
  display: inline-block;
  word-break: break-all;
  font-size: .9rem;
}
.grid { display: grid; grid-template-columns: 10rem 1fr; gap: .4rem 1rem; }
.grid dt { color: var(--muted); }
.grid dd { margin: 0; }
.card { margin: 1rem 0; padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: #121820; }
.current-scan-card { border-color: #3d8bfd55; }
.current-scan-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem 1.25rem;
  margin-bottom: .75rem;
}
.current-scan-head h3 {
  margin: 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: 1rem;
}
.scan-progress-wrap {
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 10rem;
  flex: 1 1 14rem;
  max-width: 22rem;
}
.scan-progress {
  position: relative;
  flex: 1 1 auto;
  height: 0.7rem;
  border: 1px solid #5a6f88;
  border-radius: 999px;
  background: #0a121c;
  overflow: hidden;
}
.scan-progress-bar {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width .3s ease;
}
.scan-progress-label {
  flex: 0 0 auto;
  min-width: 2.75rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text, #e8eef6);
  font-variant-numeric: tabular-nums;
}
.pill {
  display: inline-block;
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .8rem;
  text-transform: lowercase;
  border: 1px solid var(--border);
}
.pill.online { color: var(--ok); border-color: var(--ok); }
.pill.offline { color: var(--error); border-color: var(--error); }
.pill.never { color: var(--muted); }
.error-banner { border-color: var(--error); }
.pill.running, .pill.scanning, .pill.assigned, .pill.acknowledged { color: #ffd580; border-color: #ffd580; }
.pill.completed, .pill.uploaded, .pill.ok, .pill.merged { color: var(--ok); border-color: var(--ok); }
.pill.partial { color: #ffb454; border-color: #ffb454; }
.pill.failed { color: var(--error); border-color: var(--error); }
.pill.queued { color: var(--muted); border-color: var(--border); }
.pill.matches { color: var(--ok); border-color: var(--ok); }
.pill.behind, .pill.updating { color: #ffd580; border-color: #ffd580; }
.pill.canary { color: #7dd3fc; border-color: #7dd3fc; }
.pill.none { color: var(--muted); }
.checkbox-group {
  border: none;
  margin: 0 0 1rem;
  padding: 0;
}
.checkbox-group legend {
  color: var(--muted);
  font-size: .9rem;
  margin-bottom: .5rem;
}
.checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .35rem 0;
  font-weight: normal;
}
.checkbox-label input { width: auto; margin: 0; }
.charts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 2rem 0;
}
.chart-card {
  margin: 0;
  padding: 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chart-card h2 { margin: 0 0 .5rem; font-size: 1rem; }
.chart-card canvas {
  display: block;
  width: 100% !important;
  height: 220px !important;
  max-height: none;
  flex: none;
}
.chart-doughnut-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  flex: none;
}
.chart-doughnut-wrap canvas {
  height: 100% !important;
}
.doughnut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  line-height: 1.05;
}
.doughnut-score {
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.doughnut-band {
  margin-top: .15rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  opacity: .9;
}
.doughnut-center.band-excellent { color: #7fd99a; }
.doughnut-center.band-good { color: #59c2ff; }
.doughnut-center.band-fair { color: #ffb454; }
.doughnut-center.band-poor { color: #f07178; }
.score-breakdown {
  margin: .45rem 0 0;
  font-size: .78rem;
  line-height: 1.35;
}
time[datetime] {
  font: inherit;
  color: inherit;
}
.sev-legend { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; }
.sev {
  display: inline-block;
  padding: .12rem .45rem;
  border-radius: 4px;
  font-size: .8rem;
  font-family: inherit;
  line-height: 1.25;
  background: #121820;
  border: 1px solid var(--border);
  color: inherit;
}
button.sev {
  cursor: pointer;
  user-select: none;
}
button.sev:hover { filter: brightness(1.12); }
button.sev.is-off {
  opacity: 0.35;
  text-decoration: line-through;
}
.sev.critical { color: #f07178; border-color: #f07178; }
.sev.high { color: #ffb454; border-color: #ffb454; }
.sev.medium { color: #ffd580; border-color: #ffd580; }
.sev.low { color: #59c2ff; border-color: #59c2ff; }
.sev.log { color: var(--muted); }
.tabs { display: flex; gap: 1rem; margin-bottom: 1rem; }
.tabs a.active { color: #fff; font-weight: 600; }
td.desc { max-width: 28rem; color: var(--muted); font-size: .9rem; }

.results-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-shrink: 0;
}
.results-header h1 { margin: 0 0 .35rem; font-size: 1.35rem; }
.results-meta { margin: 0; color: var(--muted); font-size: .92rem; }
.results-counts { margin: 0; white-space: nowrap; }
.results-extras {
  flex-shrink: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .55rem .9rem;
}
.results-extras summary {
  cursor: pointer;
  color: var(--muted);
  user-select: none;
}
.results-extras-body {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
  margin-top: .85rem;
  padding-top: .85rem;
  border-top: 1px solid var(--border);
}
.trend-panel h2 { margin: 0 0 .5rem; font-size: 1rem; }
.results-charts {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  min-height: 0;
  height: 100%;
  overflow: hidden;
}
.results-charts .chart-card {
  flex: 1 1 0;
  min-height: 0;
  padding: .75rem;
  overflow: hidden;
}
.results-charts .chart-card h2 {
  margin: 0 0 .35rem;
  flex-shrink: 0;
}
.results-charts .chart-doughnut-wrap,
.results-charts .chart-canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  width: 100%;
  position: relative;
}
.results-charts .chart-doughnut-wrap canvas,
.results-charts .chart-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-height: none;
}
.results-charts .score-breakdown {
  flex-shrink: 0;
  margin: .35rem 0 0;
}
.results-charts .sev-legend {
  flex-shrink: 0;
  margin-top: .4rem;
  gap: .35rem;
}
.results-list {
  margin: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .65rem 1rem;
  padding: .7rem .9rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.filter-label { color: var(--muted); font-size: .85rem; }
.filter-check {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  margin: 0;
  font-size: .9rem;
  cursor: pointer;
}
.filter-check input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.filter-host {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}
.filter-host select,
.filter-qod select {
  width: auto;
  min-width: 9rem;
  max-width: 16rem;
  margin: 0;
  padding: .3rem .5rem;
  font-size: .85rem;
}
.filter-qod {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}
.filter-qod select {
  min-width: 4.5rem;
}
.filter-group {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  margin: 0;
}
.filter-group select {
  width: auto;
  min-width: 6.5rem;
  margin: 0;
  padding: .3rem .5rem;
  font-size: .85rem;
}
.filter-reset {
  margin: 0;
  padding: .3rem .65rem;
  font-size: .85rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
}
.filter-reset:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.results-table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0 .5rem .5rem;
}
.results-table-scroll thead th {
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 1;
}
.finding-group td {
  padding: .45rem .4rem;
  border-bottom: 1px solid var(--border);
  background: rgba(61, 139, 253, 0.07);
  vertical-align: middle;
}
.finding-group[hidden] {
  display: none;
}
.finding-group-toggle {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem .65rem;
  margin: 0;
  padding: .15rem .2rem;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
}
.finding-group-toggle:hover,
.finding-group-toggle:focus-visible {
  color: var(--accent);
}
.finding-group-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
.finding-group-chevron {
  display: inline-block;
  width: .9em;
  font-size: .75em;
  color: var(--muted);
  transition: transform .12s ease;
}
.finding-group[aria-expanded="false"] .finding-group-chevron {
  transform: rotate(-90deg);
}
.finding-group-label {
  font-weight: 700;
  color: var(--text);
}
.finding-group-meta {
  color: var(--muted);
  font-size: .85rem;
}
.finding-row.is-grouped-child td:first-child {
  padding-left: 1.1rem;
}
.th-sort {
  display: inline-flex;
  align-items: center;
  gap: .28rem;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}
.th-sort:hover,
.th-sort:focus-visible {
  color: var(--accent);
}
.th-sort:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
.th-sort .sort-ind {
  display: inline-block;
  width: .7em;
  font-size: .7em;
  line-height: 1;
  color: var(--muted);
  opacity: .55;
}
.th-sort .sort-ind::before {
  content: "↕";
}
.th-sort[aria-sort="ascending"] .sort-ind,
.th-sort[aria-sort="descending"] .sort-ind {
  color: var(--accent);
  opacity: 1;
}
.th-sort[aria-sort="ascending"] .sort-ind::before {
  content: "▲";
}
.th-sort[aria-sort="descending"] .sort-ind::before {
  content: "▼";
}

@media (max-width: 900px) {
  .charts { grid-template-columns: 1fr; }
  .content { height: auto; overflow: visible; }
  .wrap.results-page {
    height: auto;
    overflow: visible;
  }
  .results-workspace {
    grid-template-columns: 1fr;
    height: auto;
    overflow: visible;
  }
  .results-charts {
    flex-direction: row;
    overflow: visible;
    height: auto;
  }
  .results-charts .chart-card {
    flex: 1 1 0;
    min-height: 280px;
  }
  .results-charts .chart-doughnut-wrap,
  .results-charts .chart-canvas-wrap {
    min-height: 180px;
    height: 180px;
  }
  .results-charts .chart-doughnut-wrap canvas,
  .results-charts .chart-canvas-wrap canvas {
    position: absolute;
  }
  .results-list { min-height: 50vh; }
  .results-extras-body { grid-template-columns: 1fr; }
}
pre {
  overflow: auto;
  background: #0b1016;
  padding: 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  font-size: .85rem;
}

body.modal-open { overflow: hidden; }
.finding-row { cursor: pointer; }
.finding-row:hover { background: rgba(61, 139, 253, 0.08); }
.finding-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.modal[hidden] { display: none !important; }
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 1rem;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}
.modal-panel {
  position: relative;
  z-index: 1;
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.45);
  padding: 1.1rem 1.25rem 1.25rem;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}
.modal-header h2 {
  margin: .15rem 0 0;
  font-size: 1.15rem;
  line-height: 1.35;
}
.modal-eyebrow { margin: 0; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  width: 2rem;
  height: 2rem;
  border-radius: 6px;
  padding: 0;
  margin: 0;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover { border-color: var(--accent); }
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .75rem;
  align-items: center;
  margin: .85rem 0 1rem;
  padding-bottom: .85rem;
  border-bottom: 1px solid var(--border);
}
.modal-body section { margin: 0 0 1.1rem; padding: 0; background: transparent; border: none; }
.modal-body h3 { margin: 0 0 .45rem; font-size: .95rem; }
.modal-pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
}
.ref-list { margin: 0; padding-left: 1.1rem; }
.ref-list li { margin: .25rem 0; }
.nvd-enrichment .nvd-cve {
  margin: 0 0 1rem;
  padding: .75rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121820;
}
.nvd-enrichment .nvd-cve h4 { margin: 0 0 .5rem; font-size: .95rem; }
.nvd-enrichment .nvd-cve:last-child { margin-bottom: 0; }
.nvd-disclaimer {
  margin: .75rem 0 0;
  font-size: .8rem;
  line-height: 1.35;
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1rem 0 2rem;
}
.action-card {
  margin: 0;
  padding: 1rem 1.15rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.action-card-header {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
}
.action-card-header h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.4;
}
.action-meta { margin: .55rem 0 .75rem; }
.action-summary {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .75rem .85rem;
  font-size: .9rem;
  max-height: 220px;
  overflow: auto;
}
.action-cves { margin: .65rem 0 0; font-size: .9rem; }
.action-findings { margin-top: .75rem; }
.action-findings summary { cursor: pointer; color: var(--muted); }
.action-findings ul { margin: .5rem 0 0; padding-left: 1.2rem; }

.target-builder {
  margin: .75rem 0 1rem;
  padding: .85rem 1rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.target-builder-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .65rem;
}
.target-rows {
  display: flex;
  flex-direction: column;
  gap: .65rem;
}
.target-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .65rem;
}
.target-row .target-type {
  flex: 0 0 7.5rem;
}
.target-fields {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  flex: 1 1 14rem;
}
.target-fields input {
  min-width: 12rem;
  flex: 1 1 12rem;
}
.target-row .target-remove {
  flex: 0 0 auto;
  margin: 0;
}
.target-preview {
  margin: .75rem 0 0;
  font-size: .9rem;
}
.target-builder #targetBuilderError {
  margin: .5rem 0 0;
  font-size: .9rem;
}

@media (max-width: 720px) {
  .target-row .target-type {
    flex: 1 1 100%;
  }
  .target-fields {
    flex: 1 1 100%;
  }
}

.schedule-panel {
  margin: .75rem 0 1rem;
  padding: .85rem 1rem;
  background: #121820;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.schedule-time-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
}
.schedule-time-row label { flex: 1 1 10rem; }
.weekday-row {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem .75rem;
  align-items: center;
  margin: .5rem 0 .75rem;
}

.diff-section {
  margin: 1.25rem 0 1.75rem;
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #121820;
}
.diff-section-header {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: .75rem;
}
.diff-section-header h2 {
  margin: 0 0 .25rem;
  font-size: 1.15rem;
}
.diff-summary-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin: 0;
}
.diff-panel {
  margin: 1rem 0 0;
}
.diff-panel h3 {
  margin: 0 0 .5rem;
  font-size: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: baseline;
}
.diff-panel h4 {
  margin: 0 0 .4rem;
  font-size: .9rem;
}
.diff-hosts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1rem 1.5rem;
}
.diff-host-list {
  margin: 0;
  padding-left: 1.1rem;
}
.diff-host-list li { margin: .2rem 0; }

.exception-create {
  margin: 1rem 0 1.5rem;
}
.exception-form,
.exception-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1rem;
  align-items: flex-end;
}
.exception-form label,
.exception-inline-form label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin: 0;
  font-size: .85rem;
  color: var(--muted);
}
.exception-form input,
.exception-form select,
.exception-form textarea,
.exception-inline-form select,
.exception-inline-form textarea {
  min-width: 10rem;
}
.exception-reason {
  flex: 1 1 16rem;
}
.exception-cve-row {
  margin: 0 0 1rem;
  padding: .75rem 0 0;
  border-top: 1px solid var(--border);
}
.exception-cve-row:first-child {
  border-top: none;
  padding-top: 0;
}
.banner.ok {
  border-color: #7fd99a;
  color: #7fd99a;
}
.banner.error {
  border-color: #f07178;
  color: #f07178;
}

/* —— Customer report —— */
.report-page .report-eyebrow {
  margin: 0 0 .25rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .75rem;
}
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 1rem 0;
}
.report-stat {
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.report-stat-label {
  color: var(--muted);
  font-size: .8rem;
}
.report-stat-value {
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.1;
}
.report-sev-row {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: .25rem;
}
.report-charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}
.report-chart-card {
  min-height: 0;
}
.report-chart-card h3 {
  flex-shrink: 0;
}
.report-chart-wrap {
  position: relative;
  width: 100%;
  flex: none;
}
.report-doughnut-wrap {
  height: 320px;
}
.report-trend-wrap {
  height: 300px;
}
/* Override global .chart-card canvas { height: 220px !important } for report charts. */
.report-page .report-chart-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  max-height: none;
}
.report-trend {
  margin-top: 0;
}
.report-section {
  margin: 1.75rem 0;
}
.report-section h2 {
  margin: 0 0 .5rem;
  font-size: 1.15rem;
}
.report-section h3 {
  margin: 0 0 .5rem;
  font-size: 1rem;
}
.report-host-block {
  margin: 1rem 0 1.5rem;
  padding: 0 0 .5rem;
  border-bottom: 1px solid var(--border);
  break-inside: avoid;
  page-break-inside: avoid;
}
.report-host-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .5rem 1rem;
  margin-bottom: .5rem;
}
.report-host-header h3 {
  margin: 0;
}
.report-findings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
.report-findings-table th,
.report-findings-table td {
  text-align: left;
  vertical-align: top;
  padding: .35rem .5rem;
  border-bottom: 1px solid var(--border);
}
.report-findings-table th {
  color: var(--muted);
  font-weight: 500;
}
.report-action-list .action-card {
  break-inside: avoid;
  page-break-inside: avoid;
}
.report-page-break {
  break-before: page;
  page-break-before: always;
}
.report-keep-together {
  break-inside: avoid;
  page-break-inside: avoid;
}

@media (max-width: 900px) {
  .report-summary-grid,
  .report-charts-grid {
    grid-template-columns: 1fr;
  }
  .report-doughnut-wrap {
    height: 280px;
  }
  .report-trend-wrap {
    height: 260px;
  }
}

@media print {
  @page {
    size: portrait;
    margin: 0.5in;
  }

  /* Print the report as shown on screen (dark theme), not a forced light sheet. */
  html,
  body {
    height: auto !important;
    overflow: visible !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }
  body.app-shell {
    background: var(--bg) !important;
    color: var(--text) !important;
  }
  .sidebar,
  .page-tabs,
  .crumb,
  .no-print,
  .notif-panel,
  [data-notif-trigger],
  .sidebar-footer {
    display: none !important;
  }
  /* Viewport-locked shell clips print to one screen; expand for full document. */
  .app-shell {
    display: block !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    grid-template-columns: none !important;
    background: var(--bg) !important;
    color: var(--text) !important;
  }
  .content {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    background: transparent !important;
  }
  .wrap.customer-page,
  .report-page {
    max-width: none !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    height: auto !important;
    overflow: visible !important;
    color: var(--text) !important;
  }
  .report-stat,
  .chart-card,
  .action-card,
  .report-findings-table,
  .action-summary,
  .report-chart-wrap,
  canvas {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  /* Stack charts so each box stays on one page (side-by-side often splits doughnuts). */
  .report-summary-grid,
  .report-charts-grid {
    display: block !important;
  }
  .report-summary-grid .report-stat {
    break-inside: avoid;
    page-break-inside: avoid;
    margin-bottom: .75rem;
  }
  .report-charts .report-chart-card,
  .report-charts .report-trend,
  .report-chart-wrap {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .report-charts .report-chart-card {
    margin-bottom: 1rem;
  }
  .report-doughnut-wrap {
    height: 260px !important;
  }
  .report-trend-wrap {
    height: 240px !important;
  }
  .report-section {
    break-inside: auto;
  }
  .report-section > h2 {
    break-after: avoid;
    page-break-after: avoid;
  }
  .report-host-block,
  .report-action-list .action-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  a {
    color: var(--accent);
    text-decoration: none;
  }
  .report-page-break {
    break-before: page;
    page-break-before: always;
  }
}



