/* =====================================================================
   Rekonr Design System
   Dark-first dual theme. Bloomberg Terminal meets Linear.
   Single-file CSS — no build step. Fonts loaded via <link> in base.html.
   ===================================================================== */


/* =====================================================================
   1. Design Tokens — Dark Theme (default)
   ===================================================================== */

:root,
[data-theme="dark"] {
  --bg-base:      #0a0b0d;
  --bg-surface:   #111318;
  --bg-elevated:  #1a1d24;
  --bg-hover:     #22252e;
  --text-primary: #e8eaf0;
  --text-muted:   #7a8194;
  --text-inverse: #0a0b0d;
  --accent:       #00d4aa;
  --accent-hover: #00b894;
  --accent-muted: rgba(0, 212, 170, 0.15);
  --border:       #252830;
  --border-focus: #00d4aa;
  --shadow:       0 2px 8px rgba(0,0,0,0.4);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.5);

  --coverage-covered-1: #1a5c32;
  --coverage-covered-2: #2a8a48;
  --coverage-covered-3: #3cb860;
  --coverage-covered-4: #4cdc7a;
  --coverage-gap:       #252830;

  --scrollbar-thumb: #2a2d36;
  --scrollbar-track: #111318;

  color-scheme: dark;
}


/* =====================================================================
   2. Design Tokens — Light Theme
   ===================================================================== */

[data-theme="light"] {
  --bg-base:      #f5f6f8;
  --bg-surface:   #ffffff;
  --bg-elevated:  #eceef2;
  --bg-hover:     #e2e5eb;
  --text-primary: #0d0f14;
  --text-muted:   #5a6072;
  --text-inverse: #f5f6f8;
  --accent:       #007a62;
  --accent-hover: #006854;
  --accent-muted: rgba(0, 122, 98, 0.12);
  --border:       #d8dbe3;
  --border-focus: #007a62;
  --shadow:       0 2px 8px rgba(0,0,0,0.08);
  --shadow-lg:    0 8px 32px rgba(0,0,0,0.12);

  --coverage-covered-1: #b8e6c8;
  --coverage-covered-2: #7dcc96;
  --coverage-covered-3: #4ab56c;
  --coverage-covered-4: #2da855;
  --coverage-gap:       #d0d3dc;

  --scrollbar-thumb: #c8cbd4;
  --scrollbar-track: #eceef2;

  color-scheme: light;
}


/* =====================================================================
   3. Design Tokens — Theme-Invariant
   Risk colours, IT domain colours, typography, spacing
   ===================================================================== */

:root {
  /* Risk */
  --risk-critical: #ff3b5c;
  --risk-high:     #ff7a3b;
  --risk-medium:   #f5c842;
  --risk-low:      #4cdc7a;
  --risk-info:     #6ab3ff;

  /* IT Domains */
  --domain-endpoint:    #e05c5c;
  --domain-network:     #5c8ee0;
  --domain-identity:    #c97bff;
  --domain-cloud:       #6cd4f5;
  --domain-application: #f5a623;
  --domain-data:        #9eca6e;
  --domain-ot-ics:      #ff7c3a;
  --domain-email:       #e0c05c;

  /* Typography */
  --font-ui:   "Space Grotesk", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", monospace;
  --text-xs:   0.6875rem;
  --text-sm:   0.8125rem;
  --text-base: 0.875rem;
  --text-lg:   1rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  2rem;
  --lh:        1.5;

  /* Spacing */
  --space-xs:  0.25rem;
  --space-sm:  0.5rem;
  --space-md:  0.75rem;
  --space-lg:  1rem;
  --space-xl:  1.5rem;
  --space-2xl: 2rem;
  --radius:    6px;
  --radius-lg: 10px;
}


/* =====================================================================
   4. Reset & Base Styles
   ===================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: var(--text-base);
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code, pre, .mono { font-family: var(--font-mono); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 4px; }


/* =====================================================================
   5. Shell Layout
   shell, shell-nav, shell-header, shell-main
   ===================================================================== */

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  grid-template-rows: 52px 1fr;
  grid-template-areas: "nav header" "nav main";
  min-height: 100vh;
}

.shell-header {
  grid-area: header;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 var(--space-xl);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  gap: var(--space-lg);
}

.shell-nav {
  grid-area: nav;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  padding: 0;
  display: flex;
  flex-direction: column;
}

.shell-body {
  grid-area: main;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 52px);
  display: flex;
  flex-direction: column;
}

.shell-main {
  padding: var(--space-xl);
  flex: 1;
}

.shell-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
  cursor: pointer;
}

.footer-link:hover { color: var(--accent); }

.footer-bmac {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.footer-sep { opacity: 0.4; }

@media (max-width: 640px) {
  .shell-footer {
    flex-wrap: wrap;
    gap: var(--space-xs);
  }
}


/* =====================================================================
   6. Navigation
   nav-brand, nav-links, nav-link, nav-footer
   ===================================================================== */

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  height: 52px;
  padding: 0 var(--space-lg);
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

.nav-brand:hover { opacity: 0.8; }

.nav-brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 22px;
  letter-spacing: -0.02em;
}

.nav-brand-logo {
  display: flex;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.nav-brand-logo svg {
  width: 100%;
  height: 100%;
}

.nav-separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 var(--space-lg) var(--space-sm);
}

.nav-links { list-style: none; flex: 1; }

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
  cursor: pointer;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-link.active { color: var(--accent); background: var(--accent-muted); }

.nav-footer {
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.header-notif {
  display: flex;
  align-items: center;
  /* Desktop: leftmost in right group — auto margin pushes right */
  order: -1;
  margin-left: auto;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.user-profile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.user-profile:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* =====================================================================
   7. Page Layout
   page-header, page-title, back-link, pagination-bar, empty-state
   ===================================================================== */

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xl);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 700;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
  cursor: pointer;
}
.back-link:hover { color: var(--accent); }

.pagination-bar {
  display: flex;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-xl);
}

.empty-state {
  text-align: center;
  padding: var(--space-2xl);
  color: var(--text-muted);
  font-size: var(--text-sm);
}


/* =====================================================================
   8. Buttons
   btn, btn-accent, btn-sm, btn-ghost
   ===================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 6px 14px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-ui);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); border-color: var(--text-muted); }

.btn-accent {
  background: var(--accent);
  color: var(--text-inverse);
  border-color: var(--accent);
}
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--text-inverse); }

.btn-sm { padding: 3px 10px; font-size: var(--text-xs); }

.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-hover); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }


/* =====================================================================
   9. Badges
   risk, quality, siem, domain, type, mitre-tag
   ===================================================================== */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}

/* Risk badges */
.risk-badge { color: #000; }
.risk-critical { background: var(--risk-critical); }
.risk-high     { background: var(--risk-high); }
.risk-medium   { background: var(--risk-medium); }
.risk-low      { background: var(--risk-low); }
.risk-informational { background: var(--risk-info); }

/* SIEM badges */
.siem-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Domain badges */
.domain-badge {
  color: #000;
  font-weight: 600;
}

/* Vendor badges */
.vendor-badge {
  color: #000;
  font-weight: 600;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Type badges */
.type-badge {
  color: #000;
  font-weight: 600;
}

/* Scope badges */
.scope-behavioral { background: var(--accent); color: #000; }
.scope-tool       { background: var(--domain-application); color: #000; }
.scope-anomaly    { background: var(--risk-info); color: #000; }

/* MITRE technique tags */
.mitre-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: var(--accent-muted);
  color: var(--accent);
  font-weight: 500;
}


/* Kill Chain phase badges */
.kc-badge {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-primary);
  font-size: var(--text-xs);
  font-weight: 500;
}
.kc-recon    { border-color: #6ab3ff; color: #6ab3ff; }
.kc-weapon   { border-color: #c97bff; color: #c97bff; }
.kc-delivery { border-color: #f5a623; color: #f5a623; }
.kc-exploit  { border-color: #ff3b5c; color: #ff3b5c; }
.kc-install  { border-color: #ff7a3b; color: #ff7a3b; }
.kc-c2       { border-color: #e05c5c; color: #e05c5c; }
.kc-actions  { border-color: #f5c842; color: #f5c842; }

/* =====================================================================
   10. Stats Bar
   stats-bar, stat-card, stat-value, stat-label
   ===================================================================== */

.stats-bar {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
  flex-wrap: wrap;
  justify-content: center;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  min-width: 140px;
}

.stat-icon {
  color: var(--accent);
  margin-bottom: var(--space-xs);
  line-height: 0;
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-trend {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-trend-up {
  color: var(--accent);
}


/* =====================================================================
   11. Cards
   card, detection-grid, detection-card
   ===================================================================== */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--text-muted); }
.card-clickable { cursor: pointer; }

.detection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.detection-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  overflow: hidden;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.detection-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.detection-card-head {
  padding: var(--space-lg);
  padding-bottom: var(--space-md);
  flex: 1;
}

.detection-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.detection-card-rating {
  margin-bottom: var(--space-xs);
}

.detection-card-title {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detection-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detection-card-body {
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
}

.detection-card-foot {
  padding: var(--space-sm) var(--space-lg);
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
}

.detection-card-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
  overflow: hidden;
  max-height: 52px;
}


/* =====================================================================
   11b. Actor Cards
   actor-grid, actor-card, campaign-item, motivation-badge
   ===================================================================== */

.actor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.actor-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.actor-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.actor-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.actor-card-name {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.3;
}

.actor-card-aliases {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-style: italic;
  margin-bottom: var(--space-sm);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.actor-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-sm);
}

.actor-card-tags {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.motivation-badge { font-weight: 600; color: #000 !important; }

.actor-aliases {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
  margin-top: var(--space-xs);
}

.actor-link-badge {
  cursor: pointer;
  background: var(--bg-elevated);
  border: 1px solid var(--accent);
  color: var(--accent);
  transition: background 0.15s, color 0.15s;
}
.actor-link-badge:hover {
  background: var(--accent);
  color: #000;
}

.section-collapse > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}
.section-collapse > summary::before {
  content: "\25B6";
  font-size: 10px;
  color: var(--text-muted);
  transition: transform 0.15s;
}
.section-collapse[open] > summary::before {
  transform: rotate(90deg);
}
.section-collapse > summary::-webkit-details-marker { display: none; }

/* Campaign items on actor detail */
.campaign-list { display: flex; flex-direction: column; gap: var(--space-sm); }

.campaign-item {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}

.campaign-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.campaign-item-name {
  font-weight: 600;
  font-size: var(--text-sm);
}

.campaign-item-dates {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

/* Campaign page — grid + cards */
.campaign-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-lg);
}

.campaign-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.campaign-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow);
}

.campaign-card-name {
  font-size: var(--text-base);
  font-weight: 600;
  line-height: 1.3;
}

.campaign-card-dates {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.campaign-card-actors {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}
.campaign-card-actors .badge {
  font-size: var(--text-xs);
}

.campaign-card-summary {
  font-size: var(--text-sm);
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}

.campaign-card-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  display: flex;
  gap: var(--space-md);
  flex-wrap: wrap;
  align-items: center;
  margin-top: auto;
}

/* Campaign detail */
.campaign-stat-row {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  margin-bottom: var(--space-lg);
}

.campaign-stat-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  text-align: center;
  min-width: 100px;
}
.campaign-stat-box .stat-value {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--accent);
}
.campaign-stat-box .stat-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.campaign-timeline-bar {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}
.campaign-timeline-bar .timeline-track {
  flex: 1;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  position: relative;
}
.campaign-timeline-bar .timeline-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.campaign-timeline-bar .timeline-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.campaign-source-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}
.campaign-source-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.campaign-source-item a {
  color: var(--accent);
  text-decoration: none;
  word-break: break-all;
}
.campaign-source-item a:hover {
  text-decoration: underline;
}
.campaign-source-domain {
  font-size: var(--text-xs);
  color: var(--text-muted);
  min-width: 120px;
  flex-shrink: 0;
}

.campaign-actor-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s;
}
.campaign-actor-row:hover {
  border-color: var(--accent);
}

.campaign-threat-item {
  padding: var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
}
.campaign-threat-item + .campaign-threat-item {
  margin-top: var(--space-sm);
}

.active-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  cursor: pointer;
  color: var(--text-muted);
  user-select: none;
}
.active-toggle input {
  accent-color: var(--accent);
}

/* Sort select */
.sort-select {
  padding: 6px 10px;
  font-size: var(--text-xs);
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}

/* Reference list */
.ref-list { list-style: none; padding: 0; }
.ref-list li { padding: var(--space-xs) 0; }
.ref-list a {
  color: var(--accent);
  font-size: var(--text-sm);
  word-break: break-all;
}
.ref-list a:hover { text-decoration: underline; }


/* =====================================================================
   12. Detail View
   detail-grid, detail-full, detail-section, detail-prose
   ===================================================================== */

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}

.detail-full { grid-column: 1 / -1; }

.detail-section {
  margin-bottom: var(--space-xl);
}

.detail-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.detail-prose {
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--text-primary);
}
.detail-prose p { margin-bottom: var(--space-sm); }
.detail-prose strong { color: var(--text-primary); font-weight: 600; }
.detail-prose code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elevated);
  color: var(--accent);
}
.prose-list-num {
  display: inline-block;
  min-width: 1.4em;
  font-weight: 600;
  color: var(--accent);
}


/* =====================================================================
   13. Tables
   data-table
   ===================================================================== */

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}

.data-table th {
  text-align: left;
  padding: var(--space-sm) var(--space-md);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr { cursor: pointer; }


/* =====================================================================
   14. Filters
   filter-bar, filter-select, filter-input, filter-chips, filter-chip
   ===================================================================== */

.filter-search-row {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--border);
}

.filter-search-input {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}
.filter-search-input:focus {
  border-color: var(--border-focus);
}
.filter-search-input::placeholder {
  color: var(--text-muted);
}

.sort-select {
  padding: 8px 12px;
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  cursor: pointer;
  white-space: nowrap;
}
.sort-select:focus {
  border-color: var(--border-focus);
}

.filter-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.filter-row-controls {
  display: contents;
}

.filter-row-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.filter-bar {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
  order: 2;
}

.sort-select { order: 0; }
.filter-row-divider { order: 1; }
.filter-clear-btn { order: 3; }

.filter-clear-btn {
  flex-shrink: 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  white-space: nowrap;
}
.filter-clear-btn:hover { color: var(--accent); }

.filter-select,
.filter-input {
  padding: 5px 10px;
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
}
.filter-select:focus,
.filter-input:focus {
  border-color: var(--border-focus);
}

.filter-input { min-width: 200px; }

.filter-chips {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.filter-chip {
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--text-muted); color: var(--text-primary); }
.filter-chip.active {
  background: var(--accent-muted);
  border-color: var(--accent);
  color: var(--accent);
}


/* ── MultiSelect ──────────────────────────────────── */

.multiselect {
  position: relative;
  display: inline-block;
}

.multiselect-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  min-width: 0;
}
.multiselect-btn:hover { border-color: var(--text-muted); }
.multiselect.open .multiselect-btn { border-color: var(--border-focus); }

.multiselect-label {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.multiselect-chevron {
  flex-shrink: 0;
  transition: transform 0.15s;
}
.multiselect.open .multiselect-chevron { transform: rotate(180deg); }

.multiselect-panel {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 200;
  min-width: 220px;
  max-width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.multiselect.open .multiselect-panel { display: block; }

.multiselect-search {
  width: 100%;
  padding: 8px 10px;
  font-size: var(--text-sm);
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: none;
  border-bottom: 1px solid var(--border);
  outline: none;
  box-sizing: border-box;
}

.multiselect-list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px 0;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
}
.multiselect-option:hover { background: var(--bg-hover); }

.multiselect-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

.multiselect-empty {
  padding: 12px 10px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
}

.multiselect-spinner {
  padding: 6px 10px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-align: center;
}

.multiselect-sentinel {
  flex-shrink: 0;
}

/* ── ThreatFilter (popular chips + grouped search) ──── */

.threat-filter-panel {
  min-width: 340px;
  max-width: 420px;
}

.threat-chips {
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--border);
}

.threat-chips:empty {
  display: none;
}

.threat-chips-header {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.threat-chips-group {
  margin-bottom: 6px;
}

.threat-chips-type {
  font-size: 10px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 3px;
}

.threat-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.threat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 11px;
  font-family: var(--font-ui);
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.1s, background 0.1s;
}

.threat-chip:hover {
  border-color: var(--chip-color, var(--text-muted));
  background: var(--bg-hover);
}

.threat-chip.active {
  border-color: var(--chip-color, var(--accent));
  background: color-mix(in srgb, var(--chip-color, var(--accent)) 12%, var(--bg-elevated));
  color: var(--chip-color, var(--accent));
  font-weight: 600;
}

.threat-chip-count {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.threat-chip.active .threat-chip-count {
  color: inherit;
  opacity: 0.7;
}

/* Search results with type badge + count */
.threat-option {
  justify-content: flex-start;
}

.threat-opt-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.threat-opt-type {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  flex-shrink: 0;
}

.threat-opt-count {
  font-size: 10px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 20px;
  text-align: right;
}


/* =====================================================================
   14b. TreeSelect (hierarchical multiselect)
   ===================================================================== */

.treeselect-panel { min-width: 320px; max-width: 480px; }

.treeselect-node {
  display: flex;
  align-items: center;
  padding: 4px 10px;
  gap: 0;
}
.treeselect-node[data-depth="0"] { padding-left: 8px; }
.treeselect-node[data-depth="1"] { padding-left: 26px; }
.treeselect-node[data-depth="2"] { padding-left: 44px; }

.treeselect-toggle {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: transform 0.12s;
}
.treeselect-toggle svg { transition: transform 0.12s; }
.treeselect-toggle.expanded svg { transform: rotate(90deg); }
.treeselect-toggle.leaf { visibility: hidden; }

.treeselect-children { display: none; }
.treeselect-children.expanded { display: block; }

.treeselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 4px;
  font-size: var(--text-sm);
  color: var(--text-primary);
  cursor: pointer;
  user-select: none;
  flex: 1;
  min-width: 0;
}
.treeselect-option:hover { background: var(--bg-hover); border-radius: var(--radius-sm); }

.treeselect-option input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
}

.treeselect-option span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Parent nodes are slightly bolder */
.treeselect-node[data-depth="0"] .treeselect-option span { font-weight: 600; }


/* =====================================================================
   15. Drawer
   drawer-overlay, drawer, drawer-header, drawer-body, drawer-section
   ===================================================================== */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(560px, 90vw);
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 101;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.drawer.open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg-surface);
  z-index: 1;
}

.drawer-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.drawer-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: var(--text-xl);
  cursor: pointer;
  padding: var(--space-xs);
}
.drawer-close:hover { color: var(--text-primary); }

.drawer-body { padding: var(--space-lg); flex: 1; }

.drawer-section {
  margin-bottom: var(--space-xl);
}

.drawer-section-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-sm);
}


/* =====================================================================
   16. KV Pairs & Tag List
   kv-row, kv-label, kv-value, tag-list
   ===================================================================== */

.kv-row {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-xs) 0;
  font-size: var(--text-sm);
}

.kv-label {
  color: var(--text-muted);
  min-width: 120px;
  flex-shrink: 0;
}

.kv-value { color: var(--text-primary); word-break: break-all; }

.tag-list {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

/* Collapsible tag list */
.tag-list-collapsible .tag-list-hidden {
  display: none;
}

.tag-list-collapsible.expanded .tag-list-hidden {
  display: contents;
}

.tag-list-toggle {
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--accent);
  cursor: pointer;
}


/* =====================================================================
   17. Query Viewer
   query-viewer, query-viewer-header, query-viewer-lang, query-viewer-code
   ===================================================================== */

.query-viewer {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.query-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.query-viewer-lang {
  font-size: var(--text-xs);
  font-weight: 600;
  font-family: var(--font-mono);
  text-transform: uppercase;
  color: var(--text-muted);
}

.query-viewer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.query-viewer-actions .source-link {
  color: var(--accent);
  text-decoration: none;
  font-size: var(--text-xs);
}

.query-viewer-actions .source-link:hover {
  text-decoration: underline;
}

.query-viewer-code {
  padding: var(--space-md);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
  color: var(--text-primary);
}

/* Pseudocode syntax highlighting */
.pseudocode-hl { font-size: var(--text-sm); line-height: 1.8; }
.pseudocode-hl .pl-keyword  { color: #ff7b72; font-weight: 600; }
.pseudocode-hl .pl-operator { color: #d2a8ff; }
.pseudocode-hl .pl-string   { color: #a5d6ff; }
.pseudocode-hl .pl-field    { color: #7ee787; }
.pseudocode-hl .pl-number   { color: #f5c842; }
.pseudocode-hl .pl-func     { color: #79c0ff; }

[data-theme="light"] .pseudocode-hl .pl-keyword  { color: #cf222e; font-weight: 600; }
[data-theme="light"] .pseudocode-hl .pl-operator { color: #8250df; }
[data-theme="light"] .pseudocode-hl .pl-string   { color: #0a3069; }
[data-theme="light"] .pseudocode-hl .pl-field    { color: #116329; }
[data-theme="light"] .pseudocode-hl .pl-number   { color: #953800; }
[data-theme="light"] .pseudocode-hl .pl-func     { color: #0550ae; }


/* =====================================================================
   18. Logging Requirements
   logging-item, logging-source, logging-events, logging-table
   ===================================================================== */

.logging-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
}
.logging-item:last-child { border-bottom: none; }

.logging-source { font-weight: 600; min-width: 180px; }
.logging-events { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--text-muted); }
.logging-table  { font-family: var(--font-mono); font-size: var(--text-xs); color: var(--accent); }


/* =====================================================================
   19. Remediation Panel
   remediation-panel, remediation-mermaid
   ===================================================================== */

.remediation-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-xl);
}
.remediation-panel.no-diagram { grid-template-columns: 1fr; max-width: 720px; }

.remediation-mermaid {
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.remediation-mermaid svg { max-width: 100%; height: auto; }


/* =====================================================================
   20. MITRE ATT&CK Matrix
   Column-based heatmap: one column per tactic, technique cells stacked
   ===================================================================== */

/* ── Right-edge scroll fade (sibling of matrix, not a wrapper) ── */
.mm-scroll-fade {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 40px;
  background: linear-gradient(to right, transparent, var(--bg-base));
  pointer-events: none;
  z-index: 3;
  transition: opacity 0.2s;
}
.mm-scroll-fade.hidden { opacity: 0; }

/* ── Top scrollbar (synced with matrix) ── */
.mm-top-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  height: 10px;
  margin-bottom: var(--space-xs);
}
.mm-top-scroll::-webkit-scrollbar { height: 6px; }
.mm-top-scroll::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb, var(--border)); border-radius: 3px; }
.mm-top-scroll::-webkit-scrollbar-track { background: transparent; }
.mm-top-scroll-spacer { height: 1px; }

.mitre-matrix {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  padding-bottom: var(--space-md);
  position: relative;
  -webkit-overflow-scrolling: touch;
}
.mitre-matrix::-webkit-scrollbar { height: 6px; }
.mitre-matrix::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb, var(--border)); border-radius: 3px; }
.mitre-matrix::-webkit-scrollbar-track { background: transparent; }

/* ── Column (one per tactic) ── */
.mm-column {
  flex: 0 0 auto;
  width: 180px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

/* ── Tactic header ── */
.mm-tactic-header {
  background: var(--bg-elevated);
  padding: var(--space-sm) var(--space-xs);
  border-radius: var(--radius) var(--radius) 0 0;
  text-align: center;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 2px solid var(--border);
}
.mm-tactic-name {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.mm-tactic-meta {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  justify-content: center;
  gap: 6px;
}
.mm-tactic-count {
  font-variant-numeric: tabular-nums;
}
.mm-tactic-detections {
  color: var(--accent);
  font-weight: 600;
}
.mm-tactic-bar {
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  margin-top: 4px;
  overflow: hidden;
}
.mm-tactic-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s;
}

/* ── Cell container ── */
.mm-cells {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.mm-cell-group {
  display: flex;
  flex-direction: column;
}

/* ── Technique cell ── */
.mm-cell {
  padding: 4px 6px;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  min-height: 28px;
  transition: filter 0.1s;
}
.mm-cell:hover { filter: brightness(1.15); }

/* Coverage background colours */
.mm-cell.covered-1 { background: var(--coverage-covered-1); color: var(--text-primary); }
.mm-cell.covered-2 { background: var(--coverage-covered-2); color: #000; }
.mm-cell.covered-3 { background: var(--coverage-covered-3); color: #000; }
.mm-cell.covered-4 { background: var(--coverage-covered-4); color: #000; }
.mm-cell.gap       { background: var(--coverage-gap);       color: var(--text-muted); }

.mm-cell-name {
  font-size: 10px;
  font-weight: 500;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ── Detection count badge ── */
.mm-count-badge {
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  min-width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 0 4px;
}

/* ── Sub-technique toggle + container ── */
.mm-sub-toggle {
  background: none;
  border: none;
  font-size: 9px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  text-align: left;
  width: 100%;
}
.mm-sub-toggle:hover { color: var(--text-primary); }
.mm-sub-toggle::before { content: "+ "; font-family: var(--font-mono); }
.mm-sub-toggle.expanded::before { content: "- "; }

.mm-sub-cells {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding-left: 6px;
  border-left: 2px solid var(--border);
  margin-left: 4px;
}
.mm-sub-cells.expanded { display: flex; }

/* ── Popover ── */
.mm-popover {
  position: absolute;
  z-index: 50;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: var(--space-sm) var(--space-md);
  min-width: 220px;
  max-width: 300px;
  transform: translateX(-50%);
}
.mm-popover-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
}
.mm-popover-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
}
.mm-popover-close {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  background: none;
  border: none;
  padding: 0;
}
.mm-popover-close:hover { color: var(--text-primary); }
.mm-popover-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}
.mm-popover-meta {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}
.mm-coverage-label {
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 600;
}
.mm-coverage-label.covered-1 { background: var(--coverage-covered-1); color: var(--text-primary); }
.mm-coverage-label.covered-2 { background: var(--coverage-covered-2); color: #000; }
.mm-coverage-label.covered-3 { background: var(--coverage-covered-3); color: #000; }
.mm-coverage-label.covered-4 { background: var(--coverage-covered-4); color: #000; }
.mm-coverage-label.gap       { background: var(--coverage-gap);       color: var(--text-muted); }
.mm-popover-links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mm-popover-links a {
  font-size: var(--text-xs);
  color: var(--accent);
  text-decoration: none;
}
.mm-popover-links a:hover { text-decoration: underline; }

.heatmap-legend {
  display: flex;
  gap: var(--space-lg);
  margin-bottom: var(--space-lg);
  align-items: center;
}

.heatmap-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.heatmap-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}


/* =====================================================================
   21. Toast & Modal
   ===================================================================== */

/* Toast */
.toast-container {
  position: fixed;
  top: var(--space-lg);
  right: var(--space-lg);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.toast {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md) var(--space-lg);
  font-size: var(--text-sm);
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.2s ease;
  max-width: 360px;
}
.toast.toast-error   { border-color: var(--risk-critical); }
.toast.toast-success { border-color: var(--risk-low); }
.toast.toast-warning { border-color: var(--risk-medium); }
.toast.toast-info    { border-color: var(--risk-info); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  min-width: 360px;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-md);
}

.modal-body {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-xl);
}

.modal-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
}


/* =====================================================================
   22. Skeleton Loaders
   ===================================================================== */

.skeleton {
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: var(--radius);
}

.skeleton-line { height: 14px; margin-bottom: var(--space-sm); }
.skeleton-line:last-child { width: 60%; }
.skeleton-card { height: 120px; }

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* =====================================================================
   23. Theme Toggle (single cycle button)
   theme-cycle-btn
   ===================================================================== */

.theme-cycle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}
.theme-cycle-btn svg { display: block; }
.theme-cycle-btn:hover { color: var(--text-primary); }


/* =====================================================================
   24. Mobile Nav Toggle & Overlay
   nav-toggle, nav-overlay
   ===================================================================== */

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
.nav-toggle:hover { color: var(--text-primary); }
.nav-toggle svg { display: block; }

.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 149;
}
.nav-overlay.open { display: block; }

/* Header brand — visible only on mobile/tablet when sidebar is hidden */
.header-brand {
  display: none;
  align-items: center;
  gap: 0.375rem;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.header-brand:hover { opacity: 0.8; }
.header-brand-logo { display: flex; width: 24px; height: 24px; flex-shrink: 0; }
.header-brand-logo svg { width: 100%; height: 100%; }
.header-brand-name {
  font-family: 'Syne', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}


/* =====================================================================
   25. Tabs
   tab-bar, tab-btn, tab-pane, tab-content-wrap
   ===================================================================== */

.tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: var(--space-sm) var(--space-md);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.tab-content-wrap { min-height: 200px; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }


/* =====================================================================
   26. Star Rating
   star-rating, star, star-avg, star-count
   ===================================================================== */

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
}

.star-rating .star {
  font-size: 18px;
  color: var(--border);
  transition: color 0.1s;
  line-height: 1;
  user-select: none;
}

.star-rating .star.filled { color: var(--risk-medium); }
.star-rating .star.user-filled { color: var(--accent); }

.star-rating .star[role="button"] { cursor: pointer; }
.star-rating .star[role="button"]:hover { color: var(--accent); }

.star-avg {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.star-count {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.star-rating-compact .star { font-size: 14px; }
.star-rating-compact .star-avg { font-size: var(--text-xs); }


/* =====================================================================
   27. Logging Cards (Telemetry tab)
   logging-cards, logging-card, logging-card-header, etc.
   ===================================================================== */

.logging-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: var(--space-md);
}

.logging-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.logging-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: var(--text-sm);
}

.logging-card-body {
  padding: var(--space-sm) var(--space-md);
}

.logging-card-row {
  display: flex;
  gap: var(--space-sm);
  padding: 4px 0;
  font-size: var(--text-xs);
  border-bottom: 1px solid var(--border);
}
.logging-card-row:last-child { border-bottom: none; }

.logging-card-label {
  color: var(--text-muted);
  min-width: 70px;
  flex-shrink: 0;
  font-weight: 500;
}

.logging-card-value {
  color: var(--text-primary);
  font-family: var(--font-mono);
  word-break: break-all;
}

.logging-card-events {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.logging-card-events .tag {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
}

.logging-card-notes {
  font-size: var(--text-xs);
  color: var(--text-muted);
  padding-top: var(--space-xs);
  font-style: italic;
}

.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--accent-muted);
  padding: 2px 8px;
  border-radius: 3px;
}


/* =====================================================================
   28. Detail Header & Badges
   detail-header-badges, detail-header-rating
   ===================================================================== */

.detail-header {
  margin-bottom: var(--space-lg);
}

.detail-header h1 {
  font-size: var(--text-xl);
  font-weight: 700;
  margin-bottom: var(--space-sm);
}

.detail-header-badges {
  display: flex;
  align-items: flex-end;
  gap: var(--space-md);
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}

.badge-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.badge-group-label {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.badge-group-items {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.badge-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  align-self: flex-end;
}

.detail-header-rating {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.detail-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
  flex-wrap: wrap;
}

.detail-header-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.detail-version-trigger {
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-weight: 600;
  transition: border-color 0.15s;
}
.detail-version-trigger:hover { border-color: var(--accent); color: var(--accent); }

.detail-share-btn { padding: 4px; }
.detail-share-btn:hover { color: var(--accent); }


/* ── Detection detail header — two-column layout ─────────────── */

.detection-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-lg);
}

.detection-detail-header-left { flex: 1; min-width: 0; }

.detection-detail-header-right {
  flex-shrink: 0;
  width: 280px;
  min-height: 70px;
}


/* ── SVG sparkline chart ─────────────────────────────────────── */

.detail-sparkline {
  width: 100%;
  height: 80px;
  display: block;
}


/* ── Version banner ──────────────────────────────────────────── */

.version-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.version-banner svg { color: var(--accent); flex-shrink: 0; }
.version-banner-link { color: var(--accent); cursor: pointer; margin-left: auto; }
.version-banner-link:hover { text-decoration: underline; }

.incomplete-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
  background: var(--bg-elevated);
  border: 1px solid var(--risk-medium);
  border-left: 3px solid var(--risk-medium);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.incomplete-banner svg { color: var(--risk-medium); flex-shrink: 0; }


/* ── Version dropdown ────────────────────────────────────────── */

.detail-version-dropdown {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-height: 240px;
  overflow-y: auto;
  margin-bottom: var(--space-md);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.version-loading,
.version-empty {
  padding: var(--space-md);
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.version-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  font-size: var(--text-sm);
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.1s;
}
.version-item:last-child { border-bottom: none; }
.version-item:hover { background: var(--bg-elevated); }
.version-item.active { border-left: 2px solid var(--accent); background: var(--bg-elevated); }

.version-item-num {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  min-width: 28px;
}
.version-item-time { color: var(--text-muted); }
.version-item-hash {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.6;
}


/* ── Responsive: hide chart on mobile ────────────────────────── */

@media (max-width: 768px) {
  .detection-detail-header { flex-direction: column; }
  .detection-detail-header-right { display: none; }
}


/* =====================================================================
   29. Threat & IOC Cards
   threat-card, ioc-summary, ioc-list, ioc-item
   ===================================================================== */

.threat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  margin-bottom: var(--space-sm);
}

.threat-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-bottom: var(--space-xs);
}

.threat-card-ts {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
}

.show-all-threats {
  margin-top: var(--space-sm);
  width: 100%;
  text-align: center;
}

.threat-card-name {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.threat-card-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: var(--space-xs);
}

.threat-card-sources {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.threat-source-link {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-decoration: none;
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color 0.15s, border-color 0.15s;
}
.threat-source-link::before { content: "↗ "; }
.threat-source-link:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.threat-card-iocs {
  margin-top: var(--space-sm);
}
.threat-card-iocs summary {
  font-size: var(--text-xs);
  color: var(--text-muted);
  cursor: pointer;
}
.threat-card-iocs summary:hover { color: var(--text-primary); }

.badge-muted {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.threat-card .tag-list { margin-top: var(--space-xs); }

.subdomain-badge {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: var(--text-xs);
}

.industry-badge {
  background: var(--accent-muted);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: var(--text-xs);
}

.badge-overflow {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.ioc-summary {
  margin-top: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.ioc-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: var(--space-sm);
  max-height: 300px;
  overflow-y: auto;
}

.ioc-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  border-radius: 2px;
}
.ioc-item:hover { background: var(--bg-elevated); }

.ioc-type {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 60px;
  text-transform: uppercase;
  font-size: 10px;
}

.ioc-value {
  color: var(--text-primary);
  word-break: break-all;
}


/* =====================================================================
   30. MITRE Mitigation Tag
   ===================================================================== */

.mitre-mitigation-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
}

.mitre-mitigation-tag a {
  color: var(--accent);
  text-decoration: none;
}
.mitre-mitigation-tag a:hover { text-decoration: underline; }


/* =====================================================================
   31. Responsive — Tablet & Below (≤ 1024px)
   Collapsible sidebar, tighter grids
   ===================================================================== */

@media (max-width: 1024px) {
  /* Shell: collapse sidebar into off-canvas overlay */
  .shell {
    grid-template-columns: 1fr;
    grid-template-areas: "header" "main";
  }

  .shell-nav {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    box-shadow: none;
  }
  .shell-nav.nav-open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .shell-body {
    max-height: calc(100vh - 52px);
  }

  .nav-toggle { display: flex; margin-right: auto; }
  .header-brand { display: flex; }
  .header-notif {
    order: unset;
    margin-left: 0;
  }

  /* Cards: allow narrower */
  .detection-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  /* Detail: stack columns */
  .detail-grid {
    grid-template-columns: 1fr;
  }

  /* Remediation: stack */
  .remediation-panel {
    grid-template-columns: 1fr;
  }

  /* Drawer: slightly narrower */
  .drawer { width: min(480px, 92vw); }

  /* Modal: don't overflow */
  .modal {
    min-width: unset;
    max-width: calc(100vw - 2rem);
  }

  /* MITRE matrix: narrower columns */
  .mm-column { width: 160px; }
}


/* =====================================================================
   32. Responsive — Mobile (≤ 640px)
   Single column, bottom-sheet multiselects, compact everything
   ===================================================================== */

@media (max-width: 640px) {
  /* Shell: tighter padding */
  .shell-header {
    padding: 0 var(--space-md);
    gap: var(--space-sm);
  }

  /* Notifications: move to left side on mobile */
  .header-notif {
    order: 0;
    margin-left: 0;
  }

  .shell-main {
    padding: var(--space-md);
  }

  /* Hide tagline on mobile */
  .shell-header > div:first-child {
    display: none;
  }

  /* Page header: stack if needed */
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .page-title { font-size: var(--text-lg); }

  /* Filters: compact layout */
  .filter-row {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-xs);
  }

  .filter-row-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding-bottom: var(--space-xs);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-xs);
  }

  .sort-select {
    flex: 1;
    min-width: 0;
  }

  .filter-row-divider {
    display: none;
  }

  .filter-bar {
    gap: var(--space-xs);
    order: unset;
  }

  .filter-clear-btn { order: unset; }

  .filter-search-input {
    font-size: var(--text-xs);
    padding: 6px 10px;
  }

  .multiselect-btn {
    font-size: var(--text-xs);
    padding: 4px 8px;
  }
  .multiselect-label { max-width: 100px; }

  /* Multiselect panel: bottom sheet on mobile */
  .multiselect-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    min-width: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 60vh;
    display: none;
  }
  .multiselect.open .multiselect-panel { display: block; }
  .multiselect-list { max-height: 50vh; }

  .threat-filter-panel { min-width: 100%; max-width: 100%; }
  .threat-chips { max-height: 30vh; overflow-y: auto; }

  /* Domain chips: horizontal scroll */
  .filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: var(--space-xs);
    -webkit-overflow-scrolling: touch;
  }
  .filter-chip { flex-shrink: 0; }

  /* Cards: single column */
  .detection-grid,
  .actor-grid,
  .campaign-grid {
    grid-template-columns: 1fr;
  }

  /* Stats: 3 per row grid */
  .stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
  }
  .stat-card { min-width: unset; padding: var(--space-sm); }

  /* Tables: horizontal scroll */
  .data-table { display: block; overflow-x: auto; }

  /* Logging: stack */
  .logging-item {
    flex-direction: column;
    gap: var(--space-xs);
  }
  .logging-source { min-width: unset; }

  /* KV: stack */
  .kv-row {
    flex-direction: column;
    gap: var(--space-xs);
  }
  .kv-label { min-width: unset; }

  /* MITRE matrix: tighter on mobile */
  .mm-column { width: 140px; }
  .mm-cell { min-height: 24px; padding: 3px 4px; }
  .mm-cell-name { font-size: 9px; }
  .heatmap-legend { flex-wrap: wrap; gap: var(--space-sm); }

  /* Toast: full width */
  .toast-container {
    left: var(--space-sm);
    right: var(--space-sm);
  }
  .toast { max-width: 100%; }

  /* Tabs: horizontal scroll */
  .tab-btn { padding: var(--space-xs) var(--space-sm); font-size: var(--text-xs); }

  /* Star rating: slightly smaller */
  .star-rating .star { font-size: 16px; }

  /* Logging cards: single column */
  .logging-cards { grid-template-columns: 1fr; }

  /* Detail header: stack */
  .detail-header-badges { gap: 4px; }
  .detail-header-actions { flex-wrap: wrap; }

  /* IOC items: stack */
  .ioc-item { flex-direction: column; align-items: flex-start; gap: 2px; }
  .ioc-type { min-width: unset; }

  /* Remediation: stack */
  .remediation-panel { grid-template-columns: 1fr; }
}


/* =====================================================================
   33. Responsive — 4K / Ultra-wide (≥ 2560px)
   Constrain content width, slight scale-up
   ===================================================================== */

@media (min-width: 2560px) {
  html { font-size: 18px; }

  .shell-main {
    max-width: 1800px;
    margin-inline: auto;
  }

  .mm-column { width: 220px; }
}


/* =====================================================================
   34. Auth Pages — entrance + manage layouts (outside SPA shell)
   ===================================================================== */

/* Full-page auth layout */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  position: relative;
  overflow: hidden;
  background: var(--bg-base);
}

/* Radar-grid background */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.auth-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, transparent 99px, var(--border) 100px, transparent 101px),
    radial-gradient(circle at 50% 50%, transparent 199px, var(--border) 200px, transparent 201px),
    radial-gradient(circle at 50% 50%, transparent 299px, var(--border) 300px, transparent 301px),
    radial-gradient(circle at 50% 50%, transparent 399px, var(--border) 400px, transparent 401px);
  opacity: 0.25;
}
.auth-bg::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.03;
  filter: blur(60px);
}

/* Auth card */
.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  padding: var(--space-2xl, 40px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Auth logo */
.auth-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
  text-decoration: none;
  color: var(--text-primary);
}
.auth-logo img,
.auth-logo svg { width: 40px; height: 40px; }
.auth-logo-text {
  font-family: "Syne", var(--font-ui);
  font-weight: 800;
  font-size: 22px;
  letter-spacing: 1px;
}

/* Auth headings */
.auth-title {
  font-size: var(--text-xl, 20px);
  font-weight: 700;
  text-align: center;
  margin-bottom: var(--space-sm);
}
.auth-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  margin-bottom: var(--space-xl);
}

/* Auth divider (or) */
.auth-divider {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin: var(--space-lg) 0;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Auth footer / below-card links */
.auth-footer {
  text-align: center;
  margin-top: var(--space-xl);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.auth-footer a {
  color: var(--accent);
  text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

.auth-below-card {
  position: relative;
  z-index: 1;
  text-align: center;
  margin-top: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.auth-below-card a {
  color: var(--accent);
  text-decoration: none;
}
.auth-below-card a:hover { text-decoration: underline; }

/* Django messages list */
.messages-list {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-lg);
}
.messages-list li {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius, 6px);
  font-size: var(--text-sm);
  margin-bottom: var(--space-xs);
}
.messages-list .success {
  background: rgba(76, 220, 122, 0.1);
  border: 1px solid rgba(76, 220, 122, 0.25);
  color: var(--risk-low);
}
.messages-list .error {
  background: rgba(255, 59, 92, 0.1);
  border: 1px solid rgba(255, 59, 92, 0.25);
  color: var(--risk-critical);
}
.messages-list .info {
  background: rgba(0, 212, 170, 0.08);
  border: 1px solid rgba(0, 212, 170, 0.25);
  color: var(--accent);
}
.messages-list .warning {
  background: rgba(245, 200, 66, 0.1);
  border: 1px solid rgba(245, 200, 66, 0.25);
  color: var(--risk-medium);
}

/* Style bare Django form widgets inside auth pages */
.auth-card input[type="text"],
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="number"],
.auth-card input[type="url"],
.auth-card input[type="tel"],
.auth-card select,
.auth-card textarea,
.manage-container input[type="text"],
.manage-container input[type="email"],
.manage-container input[type="password"],
.manage-container input[type="number"],
.manage-container select,
.manage-container textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: var(--text-base, 14px);
  font-family: var(--font-ui);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.auth-card input:focus,
.auth-card select:focus,
.auth-card textarea:focus,
.manage-container input:focus,
.manage-container select:focus,
.manage-container textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.15);
}
.auth-card input::placeholder,
.manage-container input::placeholder {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Auth form group */
.auth-form-group {
  margin-bottom: var(--space-lg, 20px);
}
.auth-form-group label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: var(--space-xs, 4px);
}

/* Auth form errors */
.auth-form-error {
  font-size: var(--text-xs);
  color: var(--risk-critical);
  margin-top: var(--space-xs);
}
.auth-alert {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius, 6px);
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
}
.auth-alert-error {
  background: rgba(255, 59, 92, 0.1);
  border: 1px solid rgba(255, 59, 92, 0.25);
  color: var(--risk-critical);
}

/* Auth buttons — full-width primary */
.auth-card .btn-primary,
.auth-card .btn-accent {
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
  font-size: var(--text-base, 14px);
}
.auth-card .btn-outline {
  width: 100%;
  justify-content: center;
  padding: 10px 14px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-primary);
}
.auth-card .btn-outline:hover {
  background: var(--bg-hover);
  border-color: var(--text-muted);
}
.auth-card .btn-link,
.manage-container .btn-link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: var(--text-sm);
  cursor: pointer;
  text-decoration: none;
}
.auth-card .btn-link:hover,
.manage-container .btn-link:hover {
  text-decoration: underline;
}
.btn-danger {
  background: var(--risk-critical);
  color: #fff;
  border-color: var(--risk-critical);
}
.btn-danger:hover {
  opacity: 0.9;
}

/* Manage layout */
.manage-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
}
.manage-header-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
}
.manage-header-brand img,
.manage-header-brand svg { width: 24px; height: 24px; }
.manage-header-brand span {
  font-family: "Syne", var(--font-ui);
  font-weight: 800;
  font-size: 16px;
}
.manage-container {
  max-width: 640px;
  margin: var(--space-2xl, 40px) auto;
  padding: 0 var(--space-xl);
}

/* Recovery code grid */
.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: var(--text-base, 14px);
  padding: var(--space-lg);
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius, 6px);
  margin-bottom: var(--space-lg);
}
.recovery-code {
  padding: var(--space-xs) var(--space-sm);
  text-align: center;
}

/* TOTP QR code */
.totp-qr {
  display: flex;
  justify-content: center;
  padding: var(--space-lg);
  background: #fff;
  border-radius: var(--radius, 6px);
  margin-bottom: var(--space-lg);
}
.totp-qr img,
.totp-qr svg { max-width: 200px; }

/* Auth checkbox */
.auth-check {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: var(--text-sm);
  cursor: pointer;
  margin-bottom: var(--space-lg);
}
.auth-check input[type="checkbox"] {
  accent-color: var(--accent);
  width: 16px;
  height: 16px;
}

/* Auth table (security key list) */
.auth-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.auth-table th {
  text-align: left;
  font-weight: 600;
  color: var(--text-muted);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}
.auth-table td {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

/* Auth card sections (for manage pages) */
.manage-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 12px);
  margin-bottom: var(--space-lg);
  overflow: hidden;
}
.manage-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.manage-card-body {
  padding: var(--space-lg);
}

/* Header auth links */
.header-auth-link {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  transition: color 0.15s;
  cursor: pointer;
}
.header-auth-link:hover { color: var(--text-primary); }
/* User menu dropdown */
.user-menu {
  position: relative;
}
.user-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
}
.user-menu-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 200;
  padding: var(--space-xs) 0;
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.user-menu-item:hover {
  background: var(--bg-hover);
}
.user-menu-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-xs) 0;
}

/* Favorite button */
.favorite-btn {
  gap: var(--space-xs);
}
.favorite-btn svg {
  transition: fill 0.15s, color 0.15s;
}
.favorite-btn.is-favorited svg {
  fill: var(--risk-high);
  color: var(--risk-high);
}

/* Favorites tab — nested sub-tabs */
.favorites-subtabs {
  margin-bottom: var(--space-md);
}
.fav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s;
}
.fav-item:hover {
  border-color: var(--accent);
}
.fav-item + .fav-item {
  margin-top: var(--space-sm);
}
.fav-item-info {
  flex: 1;
  min-width: 0;
}
.fav-item-name {
  font-weight: 600;
  font-size: var(--text-sm);
}
.fav-item-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}
.fav-remove-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  border-radius: var(--radius);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.fav-remove-btn:hover {
  color: var(--risk-high);
  background: var(--bg-hover);
}

/* Auth page responsive */
@media (max-width: 480px) {
  .auth-page { padding: var(--space-md); }
  .auth-card { padding: var(--space-xl, 24px); }
  .recovery-codes { grid-template-columns: 1fr; }
}

/* ─── Comments ────────────────────────────────────────────────── */

.comment-section {
  max-width: 800px;
}

.comment-new {
  margin-bottom: var(--space-xl);
}

.comment-editor-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: var(--space-sm);
}

.comment-editor-inline {
  margin-top: var(--space-sm);
}

.comment-submit-btn {
  margin-top: var(--space-xs);
}

.comment-signin-prompt {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-bottom: var(--space-lg);
}

.comment-signin-prompt a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.comment-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-lg) 0;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.comment-item {
  border-left: 2px solid var(--border);
  padding-left: var(--space-md);
}

.comment-reply {
  margin-left: var(--space-xl);
  margin-top: var(--space-sm);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.comment-author {
  font-weight: 600;
  color: var(--text-primary);
  font-size: var(--text-sm);
}

.comment-time {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.comment-edited-badge {
  color: var(--text-muted);
  font-size: var(--text-xs);
  font-style: italic;
}

.comment-body {
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: var(--space-xs);
}

.comment-body p {
  margin: 0 0 var(--space-xs);
}

.comment-body p:last-child {
  margin-bottom: 0;
}

.comment-body code {
  background: var(--bg-elevated);
  padding: 1px 4px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
}

.comment-body pre {
  background: var(--bg-elevated);
  padding: var(--space-sm);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-family: "JetBrains Mono", monospace;
  font-size: var(--text-xs);
}

.comment-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: var(--space-sm);
  color: var(--text-muted);
  margin: var(--space-xs) 0;
}

.comment-deleted {
  color: var(--text-muted);
  font-style: italic;
}

.comment-footer {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-xs);
}

.comment-actions {
  display: flex;
  gap: var(--space-sm);
}

.comment-action-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: var(--text-xs);
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
}

.comment-action-btn:hover {
  color: var(--accent);
}

.comment-action-danger:hover {
  color: var(--risk-critical);
}

.comment-inline-actions {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
}

.comment-replies {
  margin-top: var(--space-sm);
}

.comment-replies-hidden {
  display: none;
}

.comment-replies-visible {
  display: block;
}

.comment-show-more {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: var(--text-xs);
  padding: var(--space-xs) 0;
  margin-left: var(--space-xl);
}

.comment-show-more:hover {
  text-decoration: underline;
}

/* ─── Vote buttons ────────────────────────────────────────────── */

.vote-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.vote-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 2px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
}

.vote-btn:hover {
  color: var(--text-primary);
}

.vote-btn.active-up {
  color: var(--accent);
}

.vote-btn.active-down {
  color: var(--risk-high);
}

.vote-score {
  font-size: var(--text-xs);
  font-weight: 600;
  min-width: 2ch;
  text-align: center;
  color: var(--text-primary);
}

/* ─── Mention highlight ───────────────────────────────────────── */

.mention {
  color: var(--accent);
  font-weight: 500;
}

/* ─── Comment skeleton ────────────────────────────────────────── */

.comment-skeleton-item {
  padding: var(--space-md) 0;
  border-left: 2px solid var(--border);
  padding-left: var(--space-md);
  margin-bottom: var(--space-md);
}

/* ─── Notification bell ───────────────────────────────────────── */

.notification-bell {
  position: relative;
}

.notification-bell-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.15s;
  position: relative;
}

.notification-bell-btn:hover {
  color: var(--text-primary);
}

.notification-badge {
  position: absolute;
  top: -2px;
  right: -4px;
  background: var(--risk-critical);
  color: #fff;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0 3px;
}

.notification-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 360px;
  max-height: 400px;
  overflow-y: auto;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 200;
}

.notification-dropdown-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
}

.notification-dropdown-title {
  font-weight: 600;
  font-size: var(--text-sm);
  color: var(--text-primary);
}

.notification-mark-all {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--accent);
  font-size: var(--text-xs);
}

.notification-mark-all:hover {
  text-decoration: underline;
}

.notification-list {
  padding: 0;
}

.notification-empty,
.notification-loading {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-md);
  text-align: center;
}

.notification-item {
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--bg-surface);
}

.notification-item.unread {
  border-left: 3px solid var(--accent);
}

.notification-item-text {
  font-size: var(--text-sm);
  color: var(--text-primary);
  line-height: 1.4;
}

.notification-item-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 2px;
}

/* ─── Quill dark mode overrides ───────────────────────────────── */

[data-theme="dark"] .ql-toolbar {
  border-color: var(--border);
  background: var(--bg-elevated);
}

[data-theme="dark"] .ql-container {
  border-color: var(--border);
  background: var(--bg-surface);
  color: var(--text-primary);
}

[data-theme="dark"] .ql-editor.ql-blank::before {
  color: var(--text-muted);
}

[data-theme="dark"] .ql-stroke {
  stroke: var(--text-muted) !important;
}

[data-theme="dark"] .ql-fill {
  fill: var(--text-muted) !important;
}

[data-theme="dark"] .ql-picker-label {
  color: var(--text-muted);
}

[data-theme="dark"] .ql-picker-options {
  background: var(--bg-elevated);
  border-color: var(--border);
}

[data-theme="dark"] .ql-toolbar button:hover .ql-stroke,
[data-theme="dark"] .ql-toolbar button.ql-active .ql-stroke {
  stroke: var(--accent) !important;
}

[data-theme="dark"] .ql-toolbar button:hover .ql-fill,
[data-theme="dark"] .ql-toolbar button.ql-active .ql-fill {
  fill: var(--accent) !important;
}

[data-theme="dark"] .ql-tooltip {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .ql-tooltip input[type="text"] {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--text-primary);
}

/* Light mode — Quill defaults are fine, just fix border alignment */
[data-theme="light"] .ql-toolbar {
  border-color: var(--border);
}

[data-theme="light"] .ql-container {
  border-color: var(--border);
}

/* Quill editor sizing */
.ql-editor {
  min-height: 80px;
  max-height: 300px;
  overflow-y: auto;
  font-family: "Space Grotesk", sans-serif;
  font-size: var(--text-sm);
}

.comment-editor-inline .ql-editor {
  min-height: 60px;
  max-height: 200px;
}

/* Notification dropdown responsive */
@media (max-width: 480px) {
  .notification-dropdown {
    width: calc(100vw - 32px);
    right: -8px;
  }
}

/* ── Profile page ────────────────────────────────────────────────── */

.profile-auth-prompt {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--text-muted);
}

.profile-auth-prompt .btn {
  margin-top: var(--space-md);
}

.profile-section {
  margin-bottom: var(--space-xl);
}

.profile-section-title {
  font-size: var(--text-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.profile-avatar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.profile-avatar-circle {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-placeholder {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-muted);
  user-select: none;
}

.profile-avatar-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.profile-upload-label {
  cursor: pointer;
}

.profile-field {
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  max-width: 400px;
}

.profile-input {
  flex: 1;
  padding: var(--space-xs) var(--space-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
}

.profile-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.profile-link-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--border);
  border-radius: 8px;
  overflow: hidden;
  max-width: 480px;
}

.profile-link-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  color: var(--text-primary);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: background 0.15s;
}

.profile-link-row:hover {
  background: var(--bg-hover);
}

.profile-link-row svg {
  flex-shrink: 0;
  color: var(--text-muted);
}

.profile-link-meta {
  margin-left: auto;
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.profile-mfa-badge {
  margin-left: auto;
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
}

.profile-mfa-on {
  background: rgba(76, 220, 122, 0.15);
  color: var(--risk-low);
}

.profile-mfa-off {
  background: rgba(255, 122, 59, 0.15);
  color: var(--risk-high);
}

.profile-meta {
  color: var(--text-muted);
  font-size: var(--text-xs);
}

.profile-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-lg) 0;
}

/* ── Profile comment history ─────────────────────────────────────── */

.profile-comment-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.profile-comment-item {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.profile-comment-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-xs);
}

.profile-comment-detection {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}

.profile-comment-detection:hover {
  text-decoration: underline;
}

.profile-comment-time {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.profile-comment-excerpt {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.profile-comment-meta {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-xs);
  font-size: var(--text-xs);
  color: var(--text-muted);
}

.profile-comment-edited {
  font-style: italic;
}

.profile-load-more {
  margin-top: var(--space-md);
  align-self: center;
}

/* ── Comment avatars ─────────────────────────────────────────────── */

.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.comment-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  user-select: none;
}

/* ── Header avatar ───────────────────────────────────────────────── */

.header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.header-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-elevated);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}


/* Cloudflare Turnstile */
.cf-turnstile {
  margin: 0.75rem auto;
  text-align: center;
}


/* =====================================================================
   Home / Landing Page
   ===================================================================== */

.home-page {
  animation: fade-in-up 0.4s ease-out;
}

@keyframes fade-in-up {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* ── AI disclaimer ────────────────────────────────────────────────── */

.home-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius);
  border: 1px solid var(--risk-medium);
  background: color-mix(in srgb, var(--risk-medium) 8%, transparent);
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.5;
  margin-bottom: var(--space-lg);
}

.home-disclaimer svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--risk-medium);
}

.home-disclaimer strong {
  color: var(--text-primary);
}

/* ── Hero ─────────────────────────────────────────────────────────── */

.home-hero {
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
  align-items: center;
  margin-bottom: var(--space-2xl);
}

.home-hero-text {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  align-items: center;
  text-align: center;
  max-width: 640px;
  width: 100%;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-sm);
}

.home-brand-logo {
  width: 58px;
  height: 58px;
  color: var(--accent);
  line-height: 0;
}

.home-brand-logo svg {
  width: 58px;
  height: 58px;
}

.home-brand-name {
  font-family: 'Syne', sans-serif;
  font-size: 36px;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.home-headline {
  font-family: var(--font-ui);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.home-headline-accent {
  color: var(--accent);
}

.home-subtitle {
  color: var(--text-muted);
  font-size: var(--text-base);
  line-height: 1.6;
  max-width: 440px;
}

.home-audience {
  font-size: var(--text-sm);
  color: var(--text-muted);
  border-left: 2px solid var(--accent);
  padding-left: var(--space-md);
  margin-top: var(--space-sm);
}

.home-cta {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  max-width: 100%;
}

.home-cta .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.home-cta .btn svg {
  flex-shrink: 0;
}

/* ── Pipeline visualisation (spectacular) ───────────────────────── */

.pl-wrap {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl) var(--space-xl);
  overflow: hidden;
  position: relative;
  width: 100%;
}

.pl-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% 20%, var(--accent-muted) 0%, transparent 70%),
    radial-gradient(ellipse 60% 40% at 80% 80%, var(--accent-muted) 0%, transparent 70%);
  opacity: 0.08;
  pointer-events: none;
}

.pl-header {
  text-align: center;
  margin-bottom: var(--space-2xl);
  position: relative;
}

.pl-title {
  font-family: var(--font-ui);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.pl-subtitle {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

.pl-canvas {
  position: relative;
  min-height: 320px;
}

.pl-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

.pl-stages {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-2xl);
}

.pl-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.pl-row-bottom {
  direction: rtl; /* reverse visual order so flow curves from right → left */
}

.pl-row-bottom > .pl-stage {
  direction: ltr; /* reset text direction inside cards */
}

.pl-stage {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  transition: border-color 0.4s, box-shadow 0.4s;
  animation: pl-stage-enter 0.6s ease-out both;
}

.pl-stage:nth-child(1) { animation-delay: 0s; }
.pl-stage:nth-child(2) { animation-delay: 0.1s; }
.pl-stage:nth-child(3) { animation-delay: 0.2s; }

.pl-row-bottom .pl-stage:nth-child(1) { animation-delay: 0.3s; }
.pl-row-bottom .pl-stage:nth-child(2) { animation-delay: 0.4s; }
.pl-row-bottom .pl-stage:nth-child(3) { animation-delay: 0.5s; }

.pl-stage:hover {
  border-color: var(--accent);
  box-shadow: 0 0 24px var(--accent-muted), inset 0 0 12px var(--accent-muted);
}

.pl-stage-glow {
  position: absolute;
  inset: -1px;
  border-radius: var(--radius-lg);
  pointer-events: none;
  opacity: 0;
  box-shadow: 0 0 20px var(--accent-muted), 0 0 40px var(--accent-muted);
  animation: pl-glow-pulse 4s ease-in-out infinite;
}

.pl-stage:nth-child(1) .pl-stage-glow { animation-delay: 0s; }
.pl-stage:nth-child(2) .pl-stage-glow { animation-delay: 0.8s; }
.pl-stage:nth-child(3) .pl-stage-glow { animation-delay: 1.6s; }

.pl-row-bottom .pl-stage:nth-child(1) .pl-stage-glow { animation-delay: 2.4s; }
.pl-row-bottom .pl-stage:nth-child(2) .pl-stage-glow { animation-delay: 3.2s; }
.pl-row-bottom .pl-stage:nth-child(3) .pl-stage-glow { animation-delay: 4.0s; }

.pl-stage-num {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--accent);
  opacity: 0.5;
  font-weight: 600;
}

.pl-stage-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1.5px solid var(--border);
  color: var(--accent);
  margin: 0 auto var(--space-sm);
  transition: border-color 0.4s, box-shadow 0.4s;
}

.pl-stage:hover .pl-stage-icon {
  border-color: var(--accent);
  box-shadow: 0 0 16px var(--accent-muted);
}

.pl-stage-icon svg {
  width: 28px;
  height: 28px;
}

.pl-stage-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.pl-stage-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  line-height: 1.4;
}

@keyframes pl-stage-enter {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pl-glow-pulse {
  0%, 100% { opacity: 0; }
  40%, 60% { opacity: 0.6; }
}

/* ── Home sections ────────────────────────────────────────────────── */

.home-section {
  margin-top: var(--space-2xl);
}

.home-section-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: var(--space-lg);
}

.home-section-title {
  font-size: var(--text-lg);
  font-weight: 600;
  text-align: center;
}

.home-section-link {
  font-size: var(--text-sm);
  color: var(--accent);
}

.home-section-link:hover {
  color: var(--accent-hover);
}

/* ── Audience cards ───────────────────────────────────────────────── */

.home-audience-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.home-audience-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.home-audience-card-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  background: var(--accent-muted);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-xs);
}

.home-audience-card-icon svg {
  width: 18px;
  height: 18px;
}

.home-audience-card-title {
  font-size: var(--text-base);
  font-weight: 600;
}

.home-audience-card-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Home — charts ────────────────────────────────────────────────── */

.home-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.home-chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  min-height: 240px;
}

.home-chart-title {
  font-size: var(--text-sm);
  font-weight: 600;
  margin-bottom: var(--space-lg);
}

.home-chart-body {
  display: flex;
  align-items: flex-start;
  gap: var(--space-lg);
}

/* Doughnut chart */
.chart-doughnut-wrap {
  flex-shrink: 0;
}

.chart-doughnut path {
  transition: opacity 0.15s;
  cursor: default;
}

.chart-doughnut path:hover {
  opacity: 1 !important;
}

.chart-empty {
  color: var(--text-muted);
  font-size: var(--text-sm);
  padding: var(--space-xl) 0;
  text-align: center;
}

/* Legend */
.chart-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  font-size: var(--text-sm);
  min-width: 0;
  flex: 1;
}

.chart-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.chart-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.chart-legend-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  text-transform: capitalize;
}

.chart-legend-value {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Bar chart */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  width: 100%;
}

.chart-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 48px;
  gap: var(--space-sm);
  align-items: center;
}

.chart-bar-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: capitalize;
}

.chart-bar-track {
  height: 16px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.6s ease-out;
  min-width: 2px;
}

.chart-bar-value {
  font-size: var(--text-xs);
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Pipeline stats pills */
.pl-stats {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  flex-wrap: wrap;
  margin-top: var(--space-sm);
}

.pl-stat-pill {
  font-size: var(--text-xs);
  color: var(--text-muted);
  background: var(--bg-elevated);
  padding: 2px var(--space-sm);
  border-radius: var(--radius-sm);
}

/* Recent activity grid */
.home-recent-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.home-recent-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: color 0.15s;
}

.home-recent-item:last-child {
  border-bottom: none;
}

.home-recent-item:hover {
  color: var(--accent);
}

.home-recent-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--text-sm);
}

.home-recent-meta {
  font-size: var(--text-xs);
  color: var(--text-muted);
  flex-shrink: 0;
}

.home-recent-risk-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ── CTA footer ───────────────────────────────────────────────────── */

.home-cta-footer {
  margin-top: var(--space-2xl);
  padding: var(--space-2xl);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
}

.home-cta-footer-text {
  font-size: var(--text-base);
  color: var(--text-muted);
}

/* ── Responsive — mobile ─────────────────────────────────────────── */

@media (max-width: 900px) {
  .home-audience-grid {
    grid-template-columns: 1fr;
  }

  .home-charts-grid {
    grid-template-columns: 1fr;
  }

  .home-recent-grid {
    grid-template-columns: 1fr;
  }

  .pl-row {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .pl-wrap {
    padding: var(--space-lg) var(--space-md);
  }

  .pl-canvas {
    min-height: auto;
  }

  .pl-svg {
    display: none; /* hide SVG paths on mobile — use CSS flow instead */
  }

  .pl-row {
    grid-template-columns: 1fr;
    gap: var(--space-md);
  }

  .pl-row-bottom {
    direction: ltr;
  }

  .pl-stage {
    display: grid;
    grid-template-columns: 48px 1fr;
    grid-template-rows: auto auto;
    text-align: left;
    gap: 0 var(--space-md);
    padding: var(--space-md);
  }

  .pl-stage-icon {
    width: 48px;
    height: 48px;
    margin: 0;
    grid-row: 1 / 3;
  }

  .pl-stage-num {
    position: static;
    font-size: 0.6rem;
    margin-bottom: 2px;
  }

  .pl-stage-label {
    grid-column: 2;
  }

  .pl-stage-desc {
    grid-column: 2;
  }

  .pl-stages {
    gap: var(--space-md);
  }

  /* Vertical connection indicators between cards */
  .pl-row + .pl-row {
    position: relative;
  }

  .pl-row + .pl-row::before {
    content: "";
    display: block;
    width: 2px;
    height: 16px;
    background: var(--border);
    margin: -8px auto 8px 23px;
  }

  .pl-stage + .pl-stage::before {
    content: "";
    display: block;
    position: absolute;
    width: 2px;
    height: 8px;
    background: var(--border);
    left: 23px;
    top: -12px;
  }

  .home-brand { display: none; }

  .home-hero-text { order: 1; }
  .pl-wrap  { order: 2; }

  .home-chart-body {
    flex-direction: column;
    align-items: center;
  }

  .chart-bar-row {
    grid-template-columns: 80px 1fr 40px;
  }
}

/* =====================================================================
   WIZARD — multi-step detection filter wizard
   ===================================================================== */

/* Overlay */
.wiz-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Container */
.wiz {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 90vw;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: wiz-enter 0.2s ease-out;
}

@keyframes wiz-enter {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: scale(1); }
}

/* Header */
.wiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border);
}

.wiz-title {
  font-size: var(--text-lg);
  font-weight: 700;
}

.wiz-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  line-height: 0;
  border-radius: var(--radius);
  transition: color 0.15s;
}
.wiz-close:hover { color: var(--text-primary); }

/* Progress dots */
.wiz-progress {
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: var(--space-md) var(--space-xl) 0;
}

.wiz-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.2s, box-shadow 0.2s;
}
.wiz-dot.active {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(0, 212, 170, 0.4);
}
.wiz-dot.completed {
  background: var(--accent);
  opacity: 0.5;
}

/* Step info */
.wiz-step-info {
  padding: var(--space-md) var(--space-xl) 0;
  text-align: center;
}
.wiz-step-label {
  font-size: var(--text-xs);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  margin-bottom: 2px;
}
.wiz-step-title {
  font-size: var(--text-base);
  font-weight: 600;
}
.wiz-step-hint {
  font-size: var(--text-xs);
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* Body — scrollable step content */
.wiz-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg) var(--space-xl);
}

/* Footer — nav buttons */
.wiz-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) var(--space-xl);
  border-top: 1px solid var(--border);
}
.wiz-footer-right {
  display: flex;
  gap: var(--space-sm);
}

/* Selectable card grid (Industry, Domain) */
.wiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-sm);
}

.wiz-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-md);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}
.wiz-card:hover {
  border-color: var(--text-muted);
}
.wiz-card.selected {
  border-color: var(--accent);
  background: rgba(0, 212, 170, 0.08);
}

/* Colour bar for domain cards */
.wiz-card-bar {
  width: 3px;
  height: 24px;
  border-radius: 2px;
  flex-shrink: 0;
}

.wiz-card-label {
  font-size: var(--text-sm);
  font-weight: 600;
}

/* Risk pills row */
.wiz-risk-row {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  justify-content: center;
}

.wiz-risk-pill {
  padding: 10px 20px;
  border-radius: 999px;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.15s;
  user-select: none;
  text-transform: capitalize;
}
.wiz-risk-pill:hover { filter: brightness(1.15); }
.wiz-risk-pill.selected {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.3);
}

/* Kill chain horizontal flow */
.wiz-chain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.wiz-chain-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  cursor: pointer;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: all 0.15s;
  user-select: none;
  min-width: 70px;
}
.wiz-chain-node:hover {
  background: var(--bg-elevated);
}
.wiz-chain-node.selected {
  border-color: var(--accent);
  background: rgba(0, 212, 170, 0.08);
}
.wiz-chain-num {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.wiz-chain-node.selected .wiz-chain-num {
  color: var(--accent);
}
.wiz-chain-label {
  font-size: 11px;
  text-align: center;
  line-height: 1.2;
}
.wiz-chain-arrow {
  color: var(--text-muted);
  font-size: var(--text-xs);
  padding: 0 2px;
  flex-shrink: 0;
}

/* Summary step */
.wiz-summary-group {
  margin-bottom: var(--space-lg);
}
.wiz-summary-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.wiz-summary-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}
.wiz-summary-none {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-style: italic;
}

/* Welcome step */
.wiz-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  gap: var(--space-md);
}
.wiz-welcome-icon { opacity: 0.8; }
.wiz-welcome-title {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0;
}
.wiz-welcome-desc {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.6;
  max-width: 400px;
}

/* Responsive — full-screen on mobile */
@media (max-width: 768px) {
  .wiz {
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
  }
  .wiz-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .wiz-chain {
    gap: var(--space-xs);
  }
  .wiz-chain-node {
    min-width: 60px;
    padding: var(--space-xs) var(--space-sm);
  }
}

/* ── About page ──────────────────────────────────────────────────── */

.about-page {
  max-width: 800px;
  margin: 0 auto;
  padding: var(--space-xl) 0;
}

.about-hero {
  display: flex;
  gap: var(--space-xl);
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.about-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  border: 2px solid var(--border);
  border: 2px solid var(--accent);
}

.about-name {
  font-size: var(--text-xl);
  font-weight: 700;
  margin: 0;
}

.about-role {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: 2px;
}

.about-location {
  color: var(--text-muted);
  font-size: var(--text-sm);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.about-location svg {
  flex-shrink: 0;
}

.about-bio {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-top: var(--space-md);
  max-width: 560px;
}

.about-links {
  display: flex;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.about-section {
  margin-bottom: var(--space-2xl);
}

.about-section-title {
  font-size: var(--text-lg);
  font-weight: 700;
  margin-bottom: var(--space-lg);
}

.about-section p {
  color: var(--text-muted);
  line-height: 1.7;
  font-size: var(--text-sm);
}

/* Timeline */
.about-timeline {
  position: relative;
  padding-left: 24px;
  border-left: 2px solid var(--border);
}

.about-timeline-item {
  position: relative;
  padding-bottom: var(--space-xl);
}

.about-timeline-item:last-child {
  padding-bottom: 0;
}

.about-timeline-dot {
  position: absolute;
  left: -29px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-base);
}

.about-timeline-item:first-child .about-timeline-dot {
  box-shadow: 0 0 0 3px var(--accent-muted, rgba(0, 212, 170, 0.2));
}

.about-timeline-period {
  font-size: var(--text-xs);
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.about-timeline-title {
  font-weight: 600;
  font-size: var(--text-base);
  margin-top: 2px;
}

.about-timeline-org {
  color: var(--accent);
  font-size: var(--text-sm);
}

.about-timeline-desc {
  color: var(--text-muted);
  font-size: var(--text-sm);
  margin-top: var(--space-xs);
  line-height: 1.6;
}

/* Skills grid */
.about-skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.about-skill-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  transition: border-color 0.15s;
}

.about-skill-card:hover {
  border-color: var(--accent);
}

.about-skill-icon {
  color: var(--accent);
  line-height: 0;
}

.about-skill-title {
  font-weight: 600;
  font-size: var(--text-sm);
}

.about-skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

/* Support closing note */
.about-support {
  text-align: center;
  padding: var(--space-xl) 0;
  border-top: 1px solid var(--border);
}

.about-support-note {
  color: var(--text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
  margin-bottom: var(--space-md);
  max-width: 480px;
  margin-inline: auto;
}

/* Contact section */
.about-contact {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
}

/* Responsive */
@media (max-width: 768px) {
  .about-hero {
    flex-direction: column;
    text-align: center;
  }
  .about-location {
    justify-content: center;
  }
  .about-links {
    justify-content: center;
  }
  .about-skills-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .about-skills-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

