/* ═══════════════════════════════════════════════════════════════
   BLACKBENCH — Dark forge theme
   Colors extracted from logo: black bg, chrome/silver borders,
   orange-amber fire accents, circuit-board trace patterns
   ═══════════════════════════════════════════════════════════════ */

/* ── Self-hosted Inter font (air-gap safe) ── */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/Inter-Bold.woff2') format('woff2');
}

:root {
  /* Core palette */
  --bg-primary: #0a0a0f;
  --bg-secondary: #111118;
  --bg-card: #16161e;
  --bg-card-hover: #1c1c26;
  --bg-input: #1a1a24;

  /* Borders */
  --border-default: #2a2a36;
  --border-chrome: #4a4a5a;
  --border-glow: rgba(255, 140, 0, 0.3);

  /* Text */
  --text-primary: #e8e8ef;
  --text-secondary: #9a9ab0;
  --text-muted: #5c5c72;

  /* Accents — fire/amber */
  --accent: #ff8c00;
  --accent-bright: #ffa033;
  --accent-dim: #cc7000;
  --accent-glow: rgba(255, 140, 0, 0.15);
  --accent-glow-strong: rgba(255, 140, 0, 0.25);

  /* Severity */
  --sev-high: #ff4444;
  --sev-high-bg: rgba(255, 68, 68, 0.1);
  --sev-medium: #ff8c00;
  --sev-medium-bg: rgba(255, 140, 0, 0.1);
  --sev-low: #3b82f6;
  --sev-low-bg: rgba(59, 130, 246, 0.1);

  /* Status */
  --status-compliant: #22c55e;
  --status-compliant-bg: rgba(34, 197, 94, 0.1);
  --status-noncompliant: #ff4444;
  --status-noncompliant-bg: rgba(255, 68, 68, 0.1);
  --status-review: #eab308;
  --status-review-bg: rgba(234, 179, 8, 0.1);
  --status-na: #6b7280;
  --status-na-bg: rgba(107, 114, 128, 0.1);

  /* Diff */
  --diff-add: rgba(34, 197, 94, 0.15);
  --diff-add-text: #4ade80;
  --diff-del: rgba(255, 68, 68, 0.15);
  --diff-del-text: #f87171;

  /* Sizing */
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-width: 260px;
  --topbar-height: 64px;

  /* Transitions */
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-bright); }

/* ── Layout ────────────────────────────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  /* Horizontal lockup: shield on the left, BLACKBENCH + tier badge to its right.
     Tighter padding so the icon dominates the brand area. */
  padding: 10px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-default);
  overflow: visible;
}

.sidebar-brand .brand-mark {
  /* Anchors the brand area without overflowing the 260px sidebar.  Source
     PNG has baked-in transparent padding so the metal edges + ember glow
     never read as clipped. */
  width: 76px;
  height: auto;
  flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255, 140, 0, 0.50));
  transition: transform 220ms ease, filter 220ms ease;
}

.sidebar-brand:hover .brand-mark {
  transform: translateY(-1px) scale(1.03);
  filter: drop-shadow(0 0 13px rgba(255, 140, 0, 0.70));
}

.sidebar-brand .brand-text {
  /* Wordmark + tier in a row.  flex-wrap so the tier badge drops to a new
     line under the title when the sidebar is too narrow to fit both, rather
     than overflowing horizontally. */
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  min-width: 0;
}

.sidebar-brand h1 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-primary);
  margin: 0;
  line-height: 1;
}

/* Reset the inline badge margin since flex-gap already handles spacing. */
.sidebar-brand .brand-text .tier-badge {
  margin-left: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 0.92rem;
  transition: all var(--transition);
}

.nav-link:hover {
  background: var(--accent-glow);
  color: var(--text-primary);
}

.nav-link.active {
  background: var(--accent-glow-strong);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.nav-link svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-link.active svg { opacity: 1; }

/* ── Sidebar section grouping ─────────────────────────────────────────
   The nav is split into "STIGs" (live functionality) and "STP" (coming
   soon).  Each section has a small uppercase label + a subtle divider
   above it.  The "coming soon" section dims its links so they read as
   non-actionable previews. */
.nav-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-top: 12px;
  margin-top: 8px;
  border-top: 1px solid var(--border-default);
}
.nav-section:first-of-type {
  border-top: none;
  margin-top: 4px;
  padding-top: 4px;
}

.nav-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 14px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-muted);
}
.nav-section-label svg {
  width: 12px;
  height: 12px;
  opacity: 0.6;
  flex-shrink: 0;
}

.nav-section-badge {
  margin-left: auto;
  background: rgba(255, 140, 0, 0.10);
  color: var(--accent, #ff8c00);
  border: 1px solid rgba(255, 140, 0, 0.30);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.62rem;
  letter-spacing: 0.5px;
  font-weight: 700;
}

/* ── "Coming soon" nav link state ────────────────────────────────────
   Looks like a real nav item but doesn't navigate.  Slightly dimmer,
   slightly italicized in spirit, and shows a small "soon" badge on the
   right.  Hover keeps the dimmed state — nothing happens on click. */
.nav-section-coming-soon .nav-link-coming-soon {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.92rem;
  opacity: 0.55;
  cursor: not-allowed;
  position: relative;
  user-select: none;
  transition: opacity 180ms ease;
}
.nav-section-coming-soon .nav-link-coming-soon:hover {
  opacity: 0.75;
  background: transparent;
}
.nav-section-coming-soon .nav-link-coming-soon svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.6;
}

.nav-link-badge {
  margin-left: auto;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.10);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--border-default);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.sidebar-powered-by {
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--text-muted);
  opacity: 0.7;
}

.sidebar-powered-by-link {
  color: var(--accent);
  text-decoration: none;
  opacity: 0.8;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.sidebar-powered-by-link:hover {
  opacity: 1;
  text-decoration: underline;
}

.db-logo {
  width: 16px;
  height: 16px;
  object-fit: contain;
  vertical-align: middle;
}

/* Main content */
.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.page-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border-default);
  background: var(--bg-secondary);
}

.page-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.page-header p {
  color: var(--text-secondary);
  margin-top: 4px;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.page-body {
  padding: 28px 32px;
}

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.card:hover {
  border-color: var(--border-chrome);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
  font-weight: 600;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.card-body {
  padding: 20px;
  overflow-wrap: anywhere;
}

/* ── Collapsible benchmark card on the STIG Browser page ────────────────
   Wraps a <details>/<summary> as our standard card.  Hides the default
   disclosure marker, rotates a chevron based on [open], and keeps the
   summary visually identical to a normal card-header so the page stays
   consistent with other surfaces. */
details.stig-benchmark > summary.stig-benchmark-header {
  list-style: none;          /* Firefox + Chrome */
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}
details.stig-benchmark > summary.stig-benchmark-header::-webkit-details-marker {
  display: none;             /* Safari */
}
details.stig-benchmark > summary.stig-benchmark-header::marker {
  content: '';
}
details.stig-benchmark > summary.stig-benchmark-header:hover {
  background: rgba(255, 140, 0, 0.04);
}
details.stig-benchmark[open] > summary.stig-benchmark-header {
  border-bottom-color: var(--border-default);
}

.stig-benchmark-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.stig-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 200ms ease;
}
details.stig-benchmark[open] > summary.stig-benchmark-header .stig-chevron {
  transform: rotate(90deg);
}

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
}

.stat-card.accent::before { background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.stat-card.danger::before { background: var(--sev-high); }
.stat-card.success::before { background: var(--status-compliant); }
.stat-card.warning::before { background: var(--status-review); }
.stat-card.info::before { background: var(--sev-low); }

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.5px;
}

.stat-label {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* ── Tables ────────────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead th {
  text-align: left;
  padding: 12px 16px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-default);
  font-weight: 600;
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-default);
  font-size: 0.9rem;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover {
  background: var(--bg-card-hover);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* ── Badges ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge-high { background: var(--sev-high-bg); color: var(--sev-high); border: 1px solid rgba(255,68,68,0.2); }
.badge-medium { background: var(--sev-medium-bg); color: var(--sev-medium); border: 1px solid rgba(255,140,0,0.2); }
.badge-low { background: var(--sev-low-bg); color: var(--sev-low); border: 1px solid rgba(59,130,246,0.2); }

.badge-compliant { background: var(--status-compliant-bg); color: var(--status-compliant); border: 1px solid rgba(34,197,94,0.2); }
.badge-non_compliant { background: var(--status-noncompliant-bg); color: var(--status-noncompliant); border: 1px solid rgba(255,68,68,0.2); }
.badge-needs_review { background: var(--status-review-bg); color: var(--status-review); border: 1px solid rgba(234,179,8,0.2); }
.badge-not_applicable { background: var(--status-na-bg); color: var(--status-na); border: 1px solid rgba(107,114,128,0.2); }

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  color: #000;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-bright));
  box-shadow: 0 0 20px var(--accent-glow-strong);
  color: #000;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-chrome);
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
}

.btn-danger {
  background: rgba(255, 68, 68, 0.1);
  color: var(--sev-high);
  border-color: rgba(255, 68, 68, 0.3);
}
.btn-danger:hover {
  background: rgba(255, 68, 68, 0.2);
}

.btn-sm {
  padding: 5px 12px;
  font-size: 0.8rem;
}

.btn-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Forms ─────────────────────────────────────────────── */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select {
  width: 100%;
  min-width: 0;
  padding: 9px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  font-family: inherit;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-input:focus,
.form-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a9ab0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── Dropdown options ────────────────────────────────────────
   Browsers render <option> with OS-native chrome by default; Chrome on
   Windows defaults to white-on-white when the parent has a dark bg, leaving
   the menu items unreadable.  Forcing background + color on <option> reaches
   into the popup on Chrome, Edge, and Firefox.  Safari ignores it but its
   default popup is already legible. */
select.form-select option,
select.form-select optgroup,
.form-inline select option,
.form-inline select optgroup {
  background: var(--bg-card, #0f1116);
  color: var(--text-primary, #e6edf3);
}
select.form-select option:checked,
.form-inline select option:checked {
  background: var(--accent, #ff8c00);
  color: #0a0a0a;
  font-weight: 600;
}

.form-inline {
  display: flex;
  gap: 12px;
  align-items: end;
  flex-wrap: wrap;
}

/* ── Diff viewer ───────────────────────────────────────── */
.diff-viewer {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  overflow: hidden;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.6;
}

.diff-line {
  display: flex;
  padding: 0;
  border-bottom: 1px solid rgba(42, 42, 54, 0.5);
}

.diff-line-num {
  min-width: 50px;
  padding: 2px 10px;
  text-align: right;
  color: var(--text-muted);
  border-right: 1px solid var(--border-default);
  user-select: none;
  flex-shrink: 0;
}

.diff-line-content {
  padding: 2px 14px;
  white-space: pre-wrap;
  word-break: break-all;
  flex: 1;
}

.diff-add { background: var(--diff-add); }
.diff-add .diff-line-content { color: var(--diff-add-text); }
.diff-del { background: var(--diff-del); }
.diff-del .diff-line-content { color: var(--diff-del-text); }
.diff-hunk {
  background: rgba(59, 130, 246, 0.08);
  color: var(--sev-low);
  font-style: italic;
}

/* ── Loading / HTMX indicators ─────────────────────────── */
.htmx-indicator {
  display: none;
}
.htmx-request .htmx-indicator {
  display: inline-flex;
}
.htmx-request.htmx-indicator {
  display: inline-flex;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border-chrome);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Pulse animation for scanning */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.pulse { animation: pulse 1.5s ease-in-out infinite; }

/* ── Empty state ───────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.empty-state h3 {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ── Progress bar ──────────────────────────────────────── */
.progress-bar {
  height: 6px;
  background: var(--bg-input);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 12px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent), var(--accent-bright));
}

/* ── Detail panels ─────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 8px 16px;
  font-size: 0.9rem;
}

.detail-label {
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.5px;
  padding-top: 2px;
}

.detail-value {
  color: var(--text-primary);
}

/* ── Code blocks ───────────────────────────────────────── */
.code-block {
  background: var(--bg-primary);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-family: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
  font-size: 0.82rem;
  line-height: 1.7;
  overflow-x: auto;
  white-space: pre-wrap;
  color: var(--text-secondary);
}

/* ── Circuit trace decoration ──────────────────────────── */
.circuit-line {
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    var(--border-default) 10%,
    var(--accent-dim) 50%,
    var(--border-default) 90%,
    transparent
  );
  margin: 24px 0;
}

/* ── Alerts ────────────────────────────────────────────── */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius);
  border: 1px solid;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-success {
  background: var(--status-compliant-bg);
  border-color: rgba(34, 197, 94, 0.2);
  color: var(--status-compliant);
}

.alert-error {
  background: var(--status-noncompliant-bg);
  border-color: rgba(255, 68, 68, 0.2);
  color: var(--status-noncompliant);
}

.alert-warning {
  background: var(--status-review-bg);
  border-color: rgba(234, 179, 8, 0.2);
  color: var(--status-review);
}

.alert-info {
  background: var(--sev-low-bg);
  border-color: rgba(59, 130, 246, 0.2);
  color: var(--sev-low);
}

/* ── Sidebar user chip (auth) ──────────────────────────────────────── */
.sidebar-user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(255, 140, 0, 0.05);
  border: 1px solid rgba(255, 140, 0, 0.18);
  border-radius: var(--radius);
}
.sidebar-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent, #ff8c00), var(--accent-bright, #ffb347));
  color: #0a0a0a;
  font-weight: 800;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-user-meta {
  flex: 1;
  min-width: 0;
  line-height: 1.1;
}
.sidebar-user-name {
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-username {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.sidebar-user-signout {
  margin: 0;
}
.sidebar-user-signout button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  padding: 6px;
  cursor: pointer;
  display: inline-flex;
  transition: color 150ms ease, background 150ms ease, border-color 150ms ease;
}
.sidebar-user-signout button:hover {
  color: var(--danger, #ef4444);
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.30);
}

/* ── Login page ────────────────────────────────────────────────────────
   Standalone — no sidebar, no top nav.  Centered card with the shield
   above the wordmark, then the form, then the "Use demo credentials"
   block.  Same visual language as the rest of the app. */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background:
    radial-gradient(60% 50% at 50% 30%, rgba(255, 140, 0, 0.10), transparent 65%),
    var(--bg, #0a0e14);
}
.login-shell {
  width: 100%;
  max-width: 440px;
}
.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 36px 32px 24px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 140, 0, 0.08);
}
.login-header {
  text-align: center;
  margin-bottom: 24px;
}
.login-shield {
  width: 96px;
  height: auto;
  filter: drop-shadow(0 0 16px rgba(255, 140, 0, 0.45));
}
.login-wordmark {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin: 8px 0 4px;
  color: var(--text-primary);
}
.login-tagline {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}
.login-alert {
  margin: 0 0 18px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-form .form-group {
  margin: 0;
}
.login-submit {
  width: 100%;
  padding: 11px 14px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

/* Demo-credentials block sits below the divider. */
.login-demo {
  margin-top: 26px;
  padding-top: 0;
}
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 16px;
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.login-divider::before,
.login-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-default);
}
.login-demo-text {
  margin: 0 0 14px;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.login-demo-btn {
  width: 100%;
  padding: 9px 12px;
  background: rgba(255, 140, 0, 0.08);
  border: 1px dashed rgba(255, 140, 0, 0.35);
  color: var(--accent, #ff8c00);
  transition: background 180ms ease, border-color 180ms ease;
}
.login-demo-btn:hover {
  background: rgba(255, 140, 0, 0.14);
  border-color: rgba(255, 140, 0, 0.55);
}
.login-demo-btn-filled {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.45);
  color: var(--success, #22c55e);
}

.login-footer {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--border-default);
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}
.login-footer a {
  color: var(--accent, #ff8c00);
  text-decoration: none;
}

/* ── Audit log page ────────────────────────────────────────────────── */
.audit-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 14px;
  align-items: end;
}
.audit-filter-grid .audit-filter-actions {
  grid-column: span 4;
}
@media (max-width: 980px) {
  .audit-filter-grid { grid-template-columns: repeat(2, 1fr); }
  .audit-filter-grid .audit-filter-actions { grid-column: span 2; }
}
@media (max-width: 560px) {
  .audit-filter-grid { grid-template-columns: 1fr; }
  .audit-filter-grid .audit-filter-actions { grid-column: span 1; }
}

.audit-table {
  font-size: 0.83rem;
}
.audit-table th, .audit-table td {
  vertical-align: top;
  padding: 8px 12px;
}

/* Severity tint — left-edge stripe so the table scans quickly. */
.audit-row { border-left: 3px solid transparent; }
.audit-row.sev-info     { border-left-color: var(--border-default); }
.audit-row.sev-notice   { border-left-color: #60a5fa; }
.audit-row.sev-warning  { border-left-color: var(--warning, #f59e0b); }
.audit-row.sev-critical { border-left-color: var(--danger, #ef4444); }

.audit-severity {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.audit-severity-info     { background: rgba(255, 255, 255, 0.06); color: var(--text-secondary); border: 1px solid rgba(255, 255, 255, 0.10); }
.audit-severity-notice   { background: rgba(96, 165, 250, 0.10); color: #60a5fa;            border: 1px solid rgba(96, 165, 250, 0.25); }
.audit-severity-warning  { background: rgba(245, 158, 11, 0.10); color: var(--warning, #f59e0b); border: 1px solid rgba(245, 158, 11, 0.30); }
.audit-severity-critical { background: rgba(239, 68, 68, 0.12);  color: var(--danger, #ef4444);  border: 1px solid rgba(239, 68, 68, 0.30); }

.audit-details summary {
  cursor: pointer;
  font-size: 0.78rem;
  color: var(--text-secondary);
  outline: none;
}
.audit-details summary:hover { color: var(--text-primary); }
.audit-details-body {
  margin: 6px 0 0;
  padding: 8px 10px;
  background: rgba(0, 0, 0, 0.30);
  border: 1px solid var(--border-default);
  border-radius: 4px;
  font-size: 0.74rem;
  white-space: pre-wrap;
  max-height: 260px;
  overflow: auto;
}

.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 20px;
  border-top: 1px solid var(--border-default);
}

/* ── Confirmation modal + loading overlay ─────────────────────────────
   Single shared chrome in base.html, driven by app.js.  Modal replaces the
   native confirm() popup; loading overlay covers the viewport during
   long-running navigations (bulk remediate, AI-assess) so the user has a
   clear "work is in flight" signal. */

body.bb-modal-open {
  overflow: hidden;
}

.bb-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.bb-modal[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.bb-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.66);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.bb-modal-dialog {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 140, 0, 0.08);
  overflow: hidden;
  transform: translateY(10px) scale(0.985);
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
.bb-modal[aria-hidden="false"] .bb-modal-dialog {
  transform: translateY(0) scale(1);
}

.bb-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-default);
}
.bb-modal-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.3px;
}
.bb-modal-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  display: inline-flex;
  border-radius: 4px;
  transition: color 150ms ease, background 150ms ease;
}
.bb-modal-close:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.bb-modal-body {
  padding: 18px 20px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.bb-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border-default);
  background: rgba(0, 0, 0, 0.18);
}

/* ── Loading overlay ──────────────────────────────────────────────── */
.bb-loading {
  position: fixed;
  inset: 0;
  z-index: 1100;          /* above the modal in case both ever show */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 10, 14, 0.84);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.bb-loading[aria-hidden="false"] {
  opacity: 1;
  pointer-events: auto;
}

.bb-loading-card {
  text-align: center;
  padding: 32px 36px 28px;
  max-width: 420px;
}

.bb-loading-spinner {
  display: inline-block;
  margin-bottom: 14px;
  filter: drop-shadow(0 0 12px rgba(255, 140, 0, 0.45));
}
.bb-loading-spinner svg {
  animation: bb-spin 1.05s linear infinite;
}
@keyframes bb-spin {
  to { transform: rotate(360deg); }
}

.bb-loading-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.4px;
}
.bb-loading-subtitle {
  margin: 0 0 16px;
  font-size: 0.86rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* Indeterminate progress bar — visual heartbeat under the spinner. */
.bb-loading-progress {
  height: 4px;
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
  overflow: hidden;
  margin: 4px 0 12px;
}
.bb-loading-progress-bar {
  display: block;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--accent, #ff8c00) 40%,
    var(--accent-bright, #ffb347) 50%,
    var(--accent, #ff8c00) 60%,
    transparent 100%);
  animation: bb-indeterminate 1.5s ease-in-out infinite;
}
@keyframes bb-indeterminate {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(280%); }
}

.bb-loading-warn {
  margin: 4px 0 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
}

/* ── Bulk remediation pre-run page ───────────────────────────────────
   Severity-tinted stat cards + numbered pipeline visualization replace the
   bare prose list.  The pipeline is a flex row with circular numbered
   badges connected by a horizontal line at the badge midpoint.  Collapses
   to a vertical timeline below 760px. */

.bulk-severity-card {
  border-left: 3px solid var(--border-default);
  transition: border-color 200ms ease, transform 200ms ease;
}
.bulk-severity-card.sev-high { border-left-color: var(--danger, #ef4444); }
.bulk-severity-card.sev-medium { border-left-color: var(--warning, #f59e0b); }
.bulk-severity-card.sev-low { border-left-color: var(--info, #60a5fa); }
.bulk-severity-card:hover { transform: translateY(-1px); }

.bulk-pipeline-body { padding: 24px 20px 18px; }

.bulk-pipeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  position: relative;
}
/* The horizontal connector line behind the numbered badges. */
.bulk-pipeline::before {
  content: '';
  position: absolute;
  top: 22px;
  left: calc(100% / 8);
  right: calc(100% / 8);
  height: 2px;
  background: linear-gradient(
    to right,
    var(--border-default) 0%,
    var(--accent, #ff8c00) 50%,
    var(--border-default) 100%
  );
  opacity: 0.4;
  z-index: 0;
}

.bulk-pipeline-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  z-index: 1;
}

.bulk-pipeline-num {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--accent, #ff8c00);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent, #ff8c00);
  box-shadow: 0 0 14px rgba(255, 140, 0, 0.18);
  margin-bottom: 12px;
  flex-shrink: 0;
}

.bulk-pipeline-text h4 {
  margin: 0 0 4px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}
.bulk-pipeline-text p {
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--text-secondary);
}

.bulk-pipeline-note {
  margin-top: 22px;
  padding: 10px 14px;
  background: rgba(245, 158, 11, 0.06);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.83rem;
}

/* Stack the pipeline vertically on narrow screens — the horizontal connector
   line is hidden because it makes no sense in a single-column layout. */
@media (max-width: 760px) {
  .bulk-pipeline {
    grid-template-columns: 1fr;
    gap: 18px;
  }
  .bulk-pipeline::before { display: none; }
  .bulk-pipeline-step { flex-direction: row; text-align: left; gap: 14px; }
  .bulk-pipeline-num { margin-bottom: 0; }
}

/* Run-options form — tighter spacing + readable hint text. */
.bulk-run-form .form-group {
  margin-bottom: 18px;
}
.bulk-run-form .form-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.bulk-force-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  transition: background 150ms ease, border-color 150ms ease;
}
.bulk-force-toggle:hover {
  background: rgba(255, 140, 0, 0.04);
  border-color: rgba(255, 140, 0, 0.35);
}
.bulk-force-toggle input[type=checkbox] {
  accent-color: var(--accent, #ff8c00);
  margin-top: 3px;
  flex-shrink: 0;
}

/* ── Dashboard analytics row (trend chart + donut) ────────────────────
   2-col on wide screens, stacks below 960px so the donut doesn't crush.
   Trend takes 2/3, donut 1/3 — the time-series wants horizontal room and
   the donut is square-bounded.  `min-width: 0` on both children stops the
   inner SVG from pushing the grid wider than the viewport. */
.analytics-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.analytics-row .analytics-card {
  min-width: 0;
}
@media (max-width: 960px) {
  .analytics-row {
    grid-template-columns: 1fr;
  }
}

/* ── Compliance Trend Chart ────────────────────────────── */
.trend-chart {
  width: 100%;
}
.trend-svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
}

/* ── Latest-Scan Donut ────────────────────────────────────
   Donut SVG centered, legend below.  Color swatches in the legend mirror
   the segment colors so the operator can read the chart without a tooltip. */
.donut-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 16px 20px 18px;
}
.donut-wrap {
  width: 180px;
  max-width: 100%;
}
.donut-svg {
  display: block;
  width: 100%;
  height: auto;
  /* The center text uses font-family: inherit so it matches the rest of
     the dashboard typography.  font-feature-settings ensures tabular nums
     so the big % doesn't shift width as it animates / re-renders. */
  font-feature-settings: "tnum" 1;
}
.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
}
.donut-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}
.donut-legend-label {
  flex: 1;
  min-width: 0;
}
.donut-legend-count {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.donut-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}
.donut-legend-total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-default);
  justify-content: space-between;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── Responsive ────────────────────────────────────────── */
.mobile-nav-bar { display: none; }

@media (max-width: 768px) {
  .app-layout { flex-direction: column; }
  .sidebar { position: static; width: 100%; height: auto; }
  .nav-ready .mobile-nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-default);
  }
  .nav-ready:not(.mobile-nav-open) .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .finding-stat-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 100px minmax(0, 1fr); }
  .page-body { padding: 16px; }
}

/* ── Scrollbar styling ─────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-chrome); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent-dim); }

/* ── Utility ───────────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-right { text-align: right; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 16px; }
.gap-1 { gap: 8px; }
.mono { font-family: 'JetBrains Mono', 'Fira Code', monospace; font-size: 0.85rem; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 300px; }

/* ══════════════════════════════════════════════════════════════
   LICENSING UI
   ══════════════════════════════════════════════════════════════ */

/* ── License banner (top of every page) ───────────────────── */
.license-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 1px solid var(--border-default);
  letter-spacing: 0.02em;
}
.license-banner a { font-weight: 600; }
.license-banner .license-banner-icon { flex-shrink: 0; }

.license-banner-valid {
  background: rgba(34, 197, 94, 0.06);
  color: var(--status-compliant);
  border-bottom-color: rgba(34, 197, 94, 0.15);
}
.license-banner-warning {
  background: rgba(234, 179, 8, 0.08);
  color: var(--status-review);
  border-bottom-color: rgba(234, 179, 8, 0.2);
}
.license-banner-expired {
  background: rgba(255, 68, 68, 0.08);
  color: var(--status-noncompliant);
  border-bottom-color: rgba(255, 68, 68, 0.2);
}
.license-banner-missing {
  background: var(--bg-secondary);
  color: var(--text-muted);
}
.license-banner-invalid {
  background: rgba(255, 68, 68, 0.12);
  color: var(--status-noncompliant);
  border-bottom-color: rgba(255, 68, 68, 0.3);
  font-weight: 600;
}

/* ── Tier badge in sidebar ─────────────────────────────────── */
.tier-badge {
  display: inline-block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.tier-badge-community {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.tier-badge-standard {
  background: rgba(59, 130, 246, 0.12);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}
.tier-badge-enterprise {
  background: rgba(255, 140, 0, 0.12);
  color: var(--accent-bright);
  border: 1px solid rgba(255, 140, 0, 0.25);
}

/* ── Feature lock icons (nav links with gated features) ────── */
.nav-link-locked {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.nav-link-locked .lock-icon {
  color: var(--text-muted);
  margin-left: auto;
}

/* ── License page ──────────────────────────────────────────── */
.license-status-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  margin-bottom: 24px;
}
.license-status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1.6rem;
}
.license-status-icon-valid   { background: rgba(34,197,94,0.12); color: var(--status-compliant); }
.license-status-icon-expired { background: rgba(255,68,68,0.12); color: var(--status-noncompliant); }
.license-status-icon-missing { background: var(--bg-card-hover); color: var(--text-muted); }
.license-status-icon-invalid { background: rgba(255,68,68,0.15); color: var(--status-noncompliant); }

.license-status-details { flex: 1; }
.license-status-details h3 { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.license-status-details p { color: var(--text-secondary); font-size: 0.9rem; }

.license-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.license-meta-item label {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.license-meta-item span {
  font-size: 0.95rem;
  color: var(--text-primary);
}

.fingerprint-box {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  word-break: break-all;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition);
}
.fingerprint-box:hover { border-color: var(--accent); }

/* ── Tier comparison table ─────────────────────────────────── */
.tier-table { width: 100%; border-collapse: collapse; }
.tier-table th {
  text-align: center;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 2px solid var(--border-default);
}
.tier-table th.tier-col-community { color: var(--text-muted); }
.tier-table th.tier-col-standard  { color: #60a5fa; }
.tier-table th.tier-col-enterprise { color: var(--accent-bright); }
.tier-table td {
  padding: 9px 16px;
  border-bottom: 1px solid var(--border-default);
  font-size: 0.9rem;
}
.tier-table td.tier-check { text-align: center; }
.tier-table tr:last-child td { border-bottom: none; }
.tier-check-yes { color: var(--status-compliant); font-size: 1rem; }
.tier-check-no  { color: var(--text-muted); }

/* ── Admin panel ───────────────────────────────────────────── */
.admin-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.admin-form-grid .form-group-full { grid-column: 1 / -1; }

.key-textarea {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.75rem;
  resize: vertical;
  min-height: 120px;
}
.preview-box {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  padding: 16px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  white-space: pre;
  overflow-x: auto;
  color: var(--text-secondary);
  max-height: 300px;
  overflow-y: auto;
}

/* ── Upgrade prompt (shown on gated feature pages) ─────────── */
.upgrade-prompt {
  text-align: center;
  padding: 60px 24px;
}
.upgrade-prompt .lock-glyph {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.4;
}
.upgrade-prompt h3 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.upgrade-prompt p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.upgrade-prompt .btn { margin: 4px; }

/* ── Days-remaining pill ───────────────────────────────────── */
.days-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.days-pill-ok      { background: rgba(34,197,94,0.12); color: var(--status-compliant); }
.days-pill-warning { background: rgba(234,179,8,0.12); color: var(--status-review); }
.days-pill-expired { background: rgba(255,68,68,0.12); color: var(--status-noncompliant); }

/* ── Docs page ─────────────────────────────────────────────── */
.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.docs-toc {
  position: sticky;
  top: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.docs-toc-heading {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
}

.docs-toc-link {
  display: block;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 3px 0;
  border-left: 2px solid transparent;
  padding-left: 8px;
  transition: color 0.15s, border-color 0.15s;
}
.docs-toc-link:hover {
  color: var(--text-primary);
  border-left-color: var(--accent-bright);
}

.docs-content {
  display: flex;
  min-width: 0;
  overflow-wrap: anywhere;
  flex-direction: column;
  gap: 0;
}

.docs-section {
  scroll-margin-top: 1.5rem;
  padding: 0.25rem 0 1.5rem;
}

.docs-section h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.75rem;
}

.docs-section h4 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 1.25rem 0 0.5rem;
}

.docs-section p {
  color: var(--text-secondary);
  line-height: 1.7;
  margin: 0 0 0.75rem;
}

.docs-section a {
  color: var(--accent-bright);
  text-decoration: none;
}
.docs-section a:hover { text-decoration: underline; }

.docs-divider {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: 0.5rem 0 1.5rem;
}

.docs-list {
  color: var(--text-secondary);
  line-height: 1.8;
  padding-left: 1.4rem;
  margin: 0 0 0.75rem;
}
.docs-list li { margin-bottom: 0.25rem; }
.docs-list strong { color: var(--text-primary); }
.docs-list code {
  background: var(--bg-hover);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.82rem;
}

.docs-list-ordered { list-style: decimal; }

.docs-callout {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0.75rem 0;
}
.docs-callout svg { flex-shrink: 0; margin-top: 2px; }

.docs-callout-info {
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  color: #93c5fd;
}
.docs-callout-tip {
  background: rgba(255,140,0,0.08);
  border: 1px solid rgba(255,140,0,0.2);
  color: var(--accent-bright);
}

.docs-table-wrapper {
  overflow-x: auto;
  margin: 0.75rem 0;
}
.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.docs-table th {
  text-align: left;
  padding: 8px 12px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-default);
}
.docs-table td {
  padding: 9px 12px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.docs-table td strong { color: var(--text-primary); }
.docs-table td code {
  background: var(--bg-hover);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.8rem;
}
.docs-table td.text-center { text-align: center; }

.docs-field-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.75rem 0;
}
.docs-field {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.6rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 6px;
}
.docs-field-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
}
.docs-field-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.6;
}
.docs-field-desc code {
  background: var(--bg-hover);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.78rem;
}

.docs-code-block {
  margin: 0.75rem 0;
  border: 1px solid var(--border-default);
  border-radius: 6px;
  overflow: hidden;
}
.docs-code-label {
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border-default);
}
.docs-code-block pre {
  margin: 0;
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  overflow-x: auto;
}
.docs-code-block code {
  font-size: 0.82rem;
  color: #e2e8f0;
  line-height: 1.7;
}

.sev-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 700;
}
.sev-high   { background: rgba(255,68,68,0.12); color: var(--status-noncompliant); }
.sev-medium { background: rgba(234,179,8,0.12); color: var(--status-review); }
.sev-low    { background: rgba(59,130,246,0.12); color: #60a5fa; }

@media (max-width: 900px) {
  .docs-layout { grid-template-columns: minmax(0, 1fr); }
  .docs-toc { position: static; }
  .docs-field { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* ── Scan source toggle ─────────────────────────────────────── */
.scan-source-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border-default);
  border-radius: 6px;
  padding: 3px;
  width: fit-content;
  max-width: 100%;
}

.scan-path-group { flex: 1; min-width: min(320px, 100%); margin-bottom: 0; }
.scan-path-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: stretch; }
.scan-path-picker .form-input { flex: 1 1 200px; }
.scan-path-picker .btn { min-height: 36px; }
@media (max-width: 768px) {
  .scan-path-picker .form-input { flex-basis: 100%; }
}
.scan-source-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.scan-source-btn:hover {
  color: var(--text-primary);
}
.scan-source-btn.active {
  background: var(--bg-card);
  color: var(--accent-bright);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* ── Settings page ──────────────────────────────────────────── */
.settings-backend-panel {
  border-top: 1px solid var(--border-default);
  padding-top: 1rem;
  margin-top: 0.25rem;
}
.settings-section-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}
.settings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}
.settings-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 0.6rem;
}
.settings-hint code {
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 0.8rem;
  color: var(--accent-bright);
}
.settings-env-hint {
  font-size: 0.73rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-left: 4px;
}
.alert {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  border: 1px solid transparent;
}
.alert-success {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #86efac;
}
.alert-danger {
  background: rgba(255, 68, 68, 0.1);
  border-color: rgba(255, 68, 68, 0.3);
  color: #fca5a5;
}
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }

/* ──────────────────────────────────────────────────────────────────
   First-run setup wizard
   ────────────────────────────────────────────────────────────────── */
.setup-body {
  background: radial-gradient(ellipse at top, #14141c 0%, var(--bg-primary) 60%);
  min-height: 100vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 3rem 1.5rem;
}
.setup-shell { width: 100%; max-width: 880px; }
.setup-card {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  padding: 2.25rem 2.5rem 2rem;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,0.6),
              0 0 0 1px rgba(255,140,0,0.04);
}
.setup-header {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.9rem;
  align-items: center;
  margin-bottom: 1.5rem;
}
.setup-shield { width: 48px; height: 48px; }
.setup-header-text { line-height: 1.2; }
.setup-wordmark {
  font-size: 1.4rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: 0.5px;
}
.setup-tagline {
  margin: 2px 0 0 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.setup-step-counter {
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 4px 10px;
  border: 1px solid var(--border-default);
  border-radius: 999px;
}
.setup-progress {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 0.75rem;
}
.setup-progress-segment {
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  transition: background 200ms ease, border-color 200ms ease;
}
.setup-progress-done {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
}
.setup-progress-current {
  background: linear-gradient(90deg, var(--accent), var(--accent-bright));
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(255,140,0,0.45);
}
.setup-step-titles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 1.75rem;
}
.setup-step-active { color: var(--accent-bright); font-weight: 600; }
.setup-step-sep { opacity: 0.4; }
.setup-alert { margin-bottom: 1.25rem; }
.setup-h2 {
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 0.4rem 0;
  letter-spacing: -0.2px;
}
.setup-h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 0.6rem 0;
  color: var(--text-primary);
}
.setup-lead {
  font-size: 0.98rem;
  color: var(--text-secondary);
  margin: 0 0 1.5rem 0;
  line-height: 1.55;
}
.setup-muted {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin: 0.25rem 0 0.9rem 0;
  line-height: 1.5;
}
.setup-section {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.5rem;
}
.setup-fingerprint {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-input);
  border: 1px dashed var(--border-chrome);
  border-radius: 6px;
  padding: 0.65rem 0.85rem;
  margin-bottom: 0.75rem;
}
.setup-fingerprint code {
  flex: 1;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 0.82rem;
  color: var(--accent-bright);
  word-break: break-all;
}
.setup-copy-btn { flex-shrink: 0; }
.setup-callout {
  background: rgba(255, 140, 0, 0.05);
  border-left: 3px solid var(--accent);
  padding: 0.6rem 0.85rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  border-radius: 0 4px 4px 0;
  margin: 0;
}
.setup-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1.25rem;
}
@media (max-width: 720px) {
  .setup-grid-2 { grid-template-columns: 1fr; }
  .setup-card { padding: 1.5rem 1.25rem; }
}
.setup-card-inner {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 10px;
  padding: 1.25rem 1.35rem;
  display: flex;
  flex-direction: column;
}
.setup-card-muted { background: var(--bg-primary); }
.setup-card-inner .setup-form { margin-top: auto; }
.setup-feature-list {
  list-style: none;
  padding: 0;
  margin: 0.5rem 0 1rem 0;
  font-size: 0.86rem;
}
.setup-feature-list li {
  padding: 0.25rem 0;
  color: var(--text-secondary);
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.setup-feature-ok { color: #86efac; font-weight: 700; }
.setup-feature-locked { color: #6a6a7a; font-weight: 700; }
.setup-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-default);
}
.setup-actions-back { padding-top: 0.5rem; border-top: none; }
.setup-back {
  color: var(--text-secondary);
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
}
.setup-back:hover { color: var(--accent-bright); }
.setup-form { margin: 0; }
.setup-form-stacked .form-group { margin-bottom: 1.15rem; }
.setup-form-stacked .form-input { width: 100%; box-sizing: border-box; }
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
}
@media (max-width: 580px) {
  .form-row { grid-template-columns: 1fr; }
}
.form-help {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.setup-optional {
  font-weight: 400;
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-transform: none;
  letter-spacing: 0;
}
.setup-backend-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 720px) {
  .setup-backend-grid { grid-template-columns: 1fr; }
}
.setup-backend-option {
  position: relative;
  display: block;
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease;
}
.setup-backend-option:hover { border-color: var(--border-chrome); }
.setup-backend-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.setup-backend-selected {
  border-color: var(--accent);
  background: rgba(255,140,0,0.06);
  box-shadow: 0 0 0 1px rgba(255,140,0,0.25);
}
.setup-backend-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-size: 0.95rem;
}
.setup-backend-tag {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--accent-glow);
  color: var(--accent-bright);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}
.setup-backend-tag-air {
  background: rgba(34,197,94,0.12);
  color: #86efac;
}
.setup-backend-option p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.setup-backend-fields {
  background: var(--bg-secondary);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.setup-backend-fields legend {
  padding: 0 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.setup-test-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1.25rem 0 0.25rem 0;
  flex-wrap: wrap;
}
.setup-test-result {
  font-size: 0.85rem;
  padding: 4px 10px;
  border-radius: 4px;
}
.setup-test-pending { color: var(--text-secondary); }
.setup-test-ok {
  color: #86efac;
  background: rgba(34,197,94,0.08);
  border: 1px solid rgba(34,197,94,0.3);
}
.setup-test-fail {
  color: #fca5a5;
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.3);
}
.setup-done { text-align: center; padding: 1.5rem 0 0.5rem; }
.setup-done-icon { color: var(--accent); margin-bottom: 0.75rem; }
.setup-summary {
  list-style: none;
  padding: 0;
  margin: 1.25rem auto;
  max-width: 460px;
  text-align: left;
  font-size: 0.88rem;
  color: var(--text-secondary);
}
.setup-summary li {
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border-default);
}
.setup-summary li:last-child { border-bottom: none; }
.setup-cta { font-size: 0.98rem; padding: 0.75rem 1.5rem; }
.setup-body-content { min-height: 280px; }
.setup-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-default);
  font-size: 0.78rem;
  color: var(--text-secondary);
  text-align: center;
}
.setup-footer a { color: var(--accent); }

/* Paired customer proposals reuse the existing review and diff components. */
.comparison-toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.comparison-identity { display: flex; flex-wrap: wrap; gap: 24px; margin: 24px 0; padding: 18px 0; border-top: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); }
.comparison-identity > div { min-width: 0; flex: 1 1 220px; }
.comparison-identity span, .comparison-label { display: block; color: var(--text-secondary); font-size: 0.8rem; margin-bottom: 6px; }
.comparison-identity code, .comparison-facts dd { overflow-wrap: anywhere; }
.comparison-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; margin-top: 28px; }
.comparison-proposal { min-width: 0; border-top: 1px solid var(--border-default); padding-top: 20px; }
.comparison-proposal h3 { overflow-wrap: anywhere; font-size: 1.1rem; margin: 0 0 10px; }
.comparison-proposal .diff-view { max-height: 440px; overflow: auto; font-size: 0.8rem; white-space: pre; }
.comparison-proposal form { display: flex; flex-wrap: wrap; gap: 8px; }
.comparison-facts { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(0, 1.4fr); gap: 8px 12px; margin: 18px 0; font-size: 0.85rem; }
.comparison-facts dt { color: var(--text-secondary); }
.comparison-facts dd { margin: 0; }
.comparison-missing { min-height: 100px; padding: 18px; background: var(--bg-secondary); }
.comparison-choices { margin: 24px 0; padding: 18px; border: 1px solid var(--border-default); }
.comparison-choice { display: flex; gap: 12px; padding: 14px 0; align-items: flex-start; }
.comparison-choice span { min-width: 0; overflow-wrap: anywhere; }
.comparison-choice input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 3px; }
@media (max-width: 1050px) { .comparison-grid { grid-template-columns: minmax(0, 1fr); } }
