/* ============================================================================
   Threat Navigator — cross-reference register theme
   ========================================================================== */

:root {
  /* Warm-neutral ink base */
  --ink: #14171C;
  --surface-1: #1B1F26;
  --surface-2: #222732;
  --rule: #333A46;
  --rule-strong: #3E4654;

  --text: #E7E5DD;
  --text-muted: #9298A3;

  /* Registry-stamp oxblood accent */
  --accent: #A23B3B;
  --accent-soft: rgba(162, 59, 59, 0.14);
  /* Lightened variant for accent used AS TEXT on dark surfaces (headings,
     IDs, links) — the base --accent fails WCAG AA as foreground text at
     2.5:1; this variant is tuned to clear 4.5:1 against surface-1/-2. */
  --accent-text: #CD7474;

  /* Harmonized taxonomy family (muted, coordinated).
     --{name} is the saturated hue used for borders/backgrounds/edges.
     --{name}-text is a lightened variant for the tag's own foreground text,
     since the saturated hue alone fails AA against its 12%-tint background. */
  --cwe: #5E7A9D;           --cwe-text: #7E95B2;
  --capec: #3E8E86;         --capec-text: #47A298;
  --attack: #B15D45;        --attack-text: #C6826E;
  --d3fend: #5C8A5A;        --d3fend-text: #6E9F6B;
  --mitigation: #7A5C99;    --mitigation-text: #A18AB9;
  --detection: #A67C3D;     --detection-text: #BA8B44;
  --tactic: #4C6FA0;        --tactic-text: #7795BF;

  /* Neutral chip — for informational (non-clickable, non-taxonomy) tags
     like platforms, CVSS metric readouts, and version lists. */
  --neutral-text: #9298A3;
  --neutral-border: rgba(146, 152, 163, 0.4);
  --neutral-bg: rgba(146, 152, 163, 0.12);

  /* Severity — badge base tuned to pass both "text on dark" and "dark ink
     on solid badge" at once; -text variants are for the tinted tag chips. */
  --sev-critical: #C86B6B;   --sev-critical-text: #CE7C7C;
  --sev-high: #C07A4A;       --sev-high-text: #C58458;
  --sev-medium: #B99A4A;     --sev-medium-text: #B99A4A;
  --sev-low: #6E9A6E;        --sev-low-text: #739D73;

  /* Radius by role */
  --radius-sharp: 2px;
  --radius-panel: 5px;

  --font-sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--ink);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============================================================================
   Topbar
   ========================================================================== */

.topbar {
  padding: 0.9rem 2rem;
  border-bottom: 1px solid var(--rule);
  background: var(--ink);
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

/* --- Global search --- */
.global-search {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 420px;
}

#global-search-input {
  width: 100%;
  padding: 0.45rem 0.7rem;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  background: var(--surface-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#global-search-input:focus { border-color: var(--accent); }

.global-search-results {
  position: absolute;
  top: calc(100% + 0.3rem);
  left: 0;
  right: 0;
  background: var(--surface-1);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-panel);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  max-height: 60vh;
  overflow-y: auto;
  z-index: 40;
  padding: 0.3rem;
}

.global-search-results[hidden] { display: none; }

.gs-group {
  margin-bottom: 0.3rem;
}

.gs-group-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.3rem 0.5rem 0.15rem;
}

.gs-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.5rem;
  border-radius: var(--radius-sharp);
  cursor: pointer;
  font-size: 0.82rem;
}

.gs-item:hover { background: var(--surface-2); }

.gs-item .gs-id {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-text);
  font-weight: 600;
  white-space: nowrap;
}

.gs-item .gs-name { color: var(--text); }

.gs-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
  padding: 0.5rem;
}

.logo {
  font-size: 1.15rem;
  color: var(--accent-text);
  font-family: var(--font-mono);
}

.brand h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
}

.brand h1 .wordmark-accent {
  color: var(--accent-text);
}

.nav {
  display: flex;
  gap: 0.15rem;
  flex-wrap: wrap;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sharp);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover { color: var(--text); background: var(--surface-2); }

.nav-link.active {
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--rule);
}

/* --- Nav dropdown groups --- */
.nav-group {
  position: relative;
  display: inline-block;
}

.nav-group-btn {
  color: var(--text-muted);
  background: transparent;
  border: none;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sharp);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.nav-group-btn:hover { color: var(--text); background: var(--surface-2); }

.nav-group-btn .caret {
  font-size: 0.7rem;
  margin-left: 0.2rem;
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.3rem;
  background: var(--surface-1);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-panel);
  padding: 0.3rem;
  min-width: 160px;
  z-index: 30;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
}

.nav-dropdown.open { display: flex; }

.nav-dropdown .nav-link {
  display: block;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sharp);
}

.nav-dropdown .nav-link:hover { background: var(--surface-2); }

/* ============================================================================
   Layout
   ========================================================================== */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.75rem 1.5rem 4rem;
}

/* ============================================================================
   Search
   ========================================================================== */

.search-card {
  background: var(--surface-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 1.25rem;
}

.search-card label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.input-row {
  display: flex;
  gap: 0.6rem;
}

#cve-input {
  flex: 1;
  padding: 0.7rem 0.9rem;
  font-size: 0.95rem;
  font-family: var(--font-mono);
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

#cve-input:focus { border-color: var(--accent); }

#search-btn {
  padding: 0.7rem 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text);
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sharp);
  cursor: pointer;
  transition: opacity 0.15s;
}

#search-btn:hover { opacity: 0.88; }
#search-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.error {
  margin: 0.7rem 0 0;
  color: var(--sev-critical);
  font-size: 0.85rem;
}

.loading {
  text-align: center;
  padding: 3rem 0;
  color: var(--text-muted);
}

.spinner {
  width: 2.2rem;
  height: 2.2rem;
  margin: 0 auto 0.9rem;
  border: 2px solid var(--rule);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================================
   Cards
   ========================================================================== */

.card {
  background: var(--surface-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 1.25rem;
  margin-top: 1rem;
}

.summary-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

.summary-head h2 {
  margin: 0;
  font-size: 1.3rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-text);
}

.badge {
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-sharp);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.badge.critical { background: var(--sev-critical); }
.badge.high { background: var(--sev-high); }
.badge.medium { background: var(--sev-medium); }
.badge.low { background: var(--sev-low); }
.badge.unknown { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--rule); }

.description {
  color: var(--text);
  line-height: 1.6;
  margin: 0.9rem 0;
  font-size: 0.92rem;
}

.meta-grid {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meta-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}

.meta-value {
  font-weight: 600;
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.metrics {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.9rem;
}

.metric-chip {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 0.4rem 0.7rem;
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

/* ============================================================================
   Tabs
   ========================================================================== */

.tabs {
  display: flex;
  gap: 0;
  margin-top: 1.25rem;
  border-bottom: 1px solid var(--rule);
}

.tab {
  padding: 0.6rem 1.1rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font-sans);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.tab:hover { color: var(--text); }

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.tab-panel {
  display: none;
  margin-top: 1rem;
}

.tab-panel.active { display: block; }

/* ============================================================================
   Tree
   ========================================================================== */

.tree {
  font-size: 0.9rem;
}

.tree-node {
  border-left: 1px solid var(--rule);
  margin-left: 0.5rem;
  padding-left: 0.9rem;
}

.tree-root {
  border-left: none;
  margin-left: 0;
  padding-left: 0;
}

.tree-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  cursor: pointer;
  user-select: none;
}

.tree-label:hover .tree-name { color: var(--text); }

.tree-toggle {
  width: 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  transition: transform 0.15s;
}

.tree-toggle.open { transform: rotate(90deg); }

.tree-toggle.leaf { visibility: hidden; }

.tree-id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 600;
}

.tree-name { font-size: 0.88rem; color: var(--text-muted); }

.tree-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 0.05rem 0.4rem;
  font-family: var(--font-mono);
}

.tree-children { display: none; }
.tree-children.open { display: block; }

.tree-empty {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
  padding: 0.3rem 0;
}

/* ============================================================================
   Section titles / lists
   ========================================================================== */

.section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 1.1rem 0 0.5rem;
}

.section-title:first-child { margin-top: 0; }

.list-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  margin-bottom: 0.4rem;
  background: var(--surface-2);
}

.list-item .id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.list-item .name { font-size: 0.88rem; }

.list-item .desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.4;
}

.empty {
  color: var(--text-muted);
  font-size: 0.85rem;
  font-style: italic;
}

/* ============================================================================
   Technique cards
   ========================================================================== */

.tech-card {
  background: var(--surface-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 1.1rem;
  margin-bottom: 0.9rem;
}

.tech-card .tech-id {
  font-family: var(--font-mono);
  color: var(--accent-text);
  font-size: 0.8rem;
  font-weight: 600;
}

.tech-card h3 {
  margin: 0.2rem 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.tech-section { margin-top: 0.9rem; }

.tech-section h4 {
  margin: 0 0 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

/* ============================================================================
   Tags — tinted/outlined register chips (not solid pills)
   ========================================================================== */

.tag {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  border-radius: var(--radius-sharp);
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
  cursor: pointer;
  border: 1px solid;
  background: transparent;
  line-height: 1.25;
}

.tag .tag-id {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tag .tag-name {
  font-family: var(--font-sans);
  font-size: 0.76rem;
}

/* Taxonomy hues — border/background keep the saturated hue; text uses the
   lightened -text variant so every tag clears 4.5:1 against its own tint
   (verified: see design notes). */
.tag.cwe { color: var(--cwe-text); border-color: rgba(94, 122, 157, 0.5); background: rgba(94, 122, 157, 0.12); }
.tag.capec { color: var(--capec-text); border-color: rgba(62, 142, 134, 0.5); background: rgba(62, 142, 134, 0.12); }
.tag.attack { color: var(--attack-text); border-color: rgba(177, 93, 69, 0.5); background: rgba(177, 93, 69, 0.12); }
.tag.d3fend { color: var(--d3fend-text); border-color: rgba(92, 138, 90, 0.5); background: rgba(92, 138, 90, 0.12); }
.tag.mitigation { color: var(--mitigation-text); border-color: rgba(122, 92, 153, 0.5); background: rgba(122, 92, 153, 0.12); }
.tag.detection { color: var(--detection-text); border-color: rgba(166, 124, 61, 0.5); background: rgba(166, 124, 61, 0.12); }
.tag.tactic { color: var(--tactic-text); border-color: rgba(76, 111, 160, 0.5); background: rgba(76, 111, 160, 0.12); }
.tag.critical { color: var(--sev-critical-text); border-color: rgba(194, 91, 91, 0.5); background: rgba(194, 91, 91, 0.12); }
.tag.high { color: var(--sev-high-text); border-color: rgba(192, 122, 74, 0.5); background: rgba(192, 122, 74, 0.12); }
.tag.medium { color: var(--sev-medium-text); border-color: rgba(185, 154, 74, 0.5); background: rgba(185, 154, 74, 0.12); }
.tag.low { color: var(--sev-low-text); border-color: rgba(110, 154, 110, 0.5); background: rgba(110, 154, 110, 0.12); }

/* Neutral — informational, non-taxonomy tags (platforms, CVSS readouts,
   version lists). Previously these silently borrowed a taxonomy hue
   (usually "attack"), which made unrelated data look like ATT&CK entities. */
.tag.neutral { color: var(--neutral-text); border-color: var(--neutral-border); background: var(--neutral-bg); cursor: default; }

.tag:hover { filter: brightness(1.2); }
.tag.neutral:hover { filter: none; }

/* ============================================================================
   Atomic tests
   ========================================================================== */

.atomic-test {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 0.7rem;
  margin-top: 0.5rem;
}

.atomic-test .name { font-weight: 600; font-size: 0.88rem; }
.atomic-test .executor { color: var(--text-muted); font-size: 0.75rem; margin-top: 0.15rem; }

pre.command {
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 0.55rem;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  overflow-x: auto;
  margin: 0.45rem 0 0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* ============================================================================
   Defense correlation
   ========================================================================== */

.corr-row {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  margin-bottom: 0.4rem;
  background: var(--surface-2);
}

.corr-row .tech {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-text);
  font-weight: 600;
  white-space: nowrap;
  min-width: 5.5rem;
  cursor: pointer;
}

.corr-row .tech-name {
  font-size: 0.8rem;
  color: var(--text);
  font-weight: 600;
}

.corr-row .defs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* ============================================================================
   Expandable description
   ========================================================================== */

.desc-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.desc-clamp.expanded {
  -webkit-line-clamp: unset;
  display: block;
}

.desc-ellipsis {
  color: var(--accent-text);
  font-size: 0.8rem;
  cursor: pointer;
  user-select: none;
}

/* ============================================================================
   Overlay (detail pages)
   ========================================================================== */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.overlay[hidden] { display: none; }

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 12, 15, 0.7);
  backdrop-filter: blur(2px);
  animation: fade-in 0.18s ease;
}

.overlay-panel {
  position: relative;
  width: min(720px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  background: var(--surface-1);
  border: 1px solid var(--rule-strong);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-panel);
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
  animation: overlay-in 0.2s ease;
}

/* Taxonomy accent edges for the overlay top border */
.overlay-panel.edge-cwe { border-top-color: var(--cwe); }
.overlay-panel.edge-capec { border-top-color: var(--capec); }
.overlay-panel.edge-attack { border-top-color: var(--attack); }
.overlay-panel.edge-d3fend { border-top-color: var(--d3fend); }
.overlay-panel.edge-mitigation { border-top-color: var(--mitigation); }
.overlay-panel.edge-detection { border-top-color: var(--detection); }
.overlay-panel.edge-tactic { border-top-color: var(--tactic); }

@keyframes overlay-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.overlay-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.overlay-close:hover { color: var(--text); }

.overlay-back {
  display: block;
  margin: 0 0 0.9rem;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-sans);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.overlay-back:hover {
  color: var(--text);
  background: var(--surface-1);
  border-color: var(--rule-strong);
}

.overlay-back[hidden] { display: none; }

.detail-head {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.detail-head .id {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--accent-text);
  font-weight: 600;
}

.detail-head h2 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.detail-meta {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 0.9rem;
}

.detail-section {
  margin-top: 1rem;
}

.detail-section h3 {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.detail-section p {
  margin: 0;
  line-height: 1.6;
  font-size: 0.9rem;
}

/* ============================================================================
   Linkable items
   ========================================================================== */

.linkable {
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.linkable:hover {
  border-color: var(--rule-strong);
  background: var(--accent-soft);
}

/* ============================================================================
   Overview single-pane
   ========================================================================== */

.pane-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.9rem;
}

.pane {
  background: var(--surface-1);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 1rem;
}

.pane h3 {
  margin: 0 0 0.6rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.pane .count {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--text);
  font-family: var(--font-mono);
}

.pane .count-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.pane .pane-items {
  margin-top: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.pane-item {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
  padding: 0.3rem 0.4rem;
  border-radius: var(--radius-sharp);
  cursor: pointer;
}

.pane-item:hover { background: var(--surface-2); }

.pane-item .id {
  font-family: var(--font-mono);
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.pane-item .name { color: var(--text); }

/* ============================================================================
   Relationship-grouped mapping (D3FEND detail)
   ========================================================================== */

.rel-group {
  margin-bottom: 1rem;
}

.rel-group .rel-head {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text);
  margin-bottom: 0.4rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--rule);
}

.rel-group .rel-items {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.rel-item {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  background: var(--surface-2);
  cursor: pointer;
}

.rel-item:hover { background: var(--accent-soft); }

.rel-item .id {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--accent-text);
  font-weight: 600;
  white-space: nowrap;
}

.rel-item .name { font-size: 0.85rem; }

/* ============================================================================
   CVSS score colour
   ========================================================================== */

.meta-value.cvss-critical { color: var(--sev-critical); }
.meta-value.cvss-high { color: var(--sev-high); }
.meta-value.cvss-medium { color: var(--sev-medium); }
.meta-value.cvss-low { color: var(--sev-low); }

/* ============================================================================
   Table pages
   ========================================================================== */

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

#table-search {
  flex: 1;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  font-family: var(--font-mono);
  background: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  color: var(--text);
  outline: none;
}

#table-search:focus { border-color: var(--accent); }

.table-count {
  color: var(--text-muted);
  font-size: 0.8rem;
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* --- Pagination --- */
.table-pagination {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.page-btn {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  color: var(--text-muted);
  font-size: 0.8rem;
  font-family: var(--font-mono);
  padding: 0.3rem 0.6rem;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.page-btn:hover:not(:disabled) {
  color: var(--text);
  background: var(--surface-1);
  border-color: var(--rule-strong);
}

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

.page-btn.active {
  color: var(--text);
  background: var(--accent);
  border-color: var(--accent);
}

.page-ellipsis {
  color: var(--text-muted);
  font-size: 0.8rem;
  padding: 0 0.2rem;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  background: var(--surface-1);
}

table.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
  table-layout: fixed;
}

.data-table th {
  position: relative;
  text-align: left;
  padding: 0.6rem 0.75rem;
  background: var(--surface-2);
  border-bottom: 1px solid var(--rule);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}

.data-table th .th-inner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.data-table th .th-label {
  cursor: pointer;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table th .th-remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1;
  padding: 0 0.2rem;
}

.data-table th .th-remove:hover { color: var(--text); }

.data-table th .resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}

.data-table th .resizer:hover { background: var(--rule-strong); }

.data-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
}

.data-table tr:hover td { background: var(--surface-2); }

.data-table .cell-id {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent-text);
  cursor: pointer;
}

.data-table .cell-id:hover { text-decoration: underline; }

.data-table .cell-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

.data-table .cell-tags .tag { font-size: 0.7rem; padding: 0.15rem 0.4rem; }

.data-table .tag-more {
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
}

.data-table .tag-more:hover { color: var(--text); background: var(--surface-2); }

.data-table .cell-desc.expandable { cursor: pointer; }
.data-table .cell-desc.expanded {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

.data-table .cell-desc {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Column visibility menu */
.col-menu {
  position: relative;
  display: inline-block;
}

.col-menu-btn {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  color: var(--text);
  font-size: 0.8rem;
  padding: 0.4rem 0.7rem;
  cursor: pointer;
}

.col-menu-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 0.3rem;
  background: var(--surface-1);
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-panel);
  padding: 0.4rem;
  z-index: 20;
  min-width: 180px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.col-menu-dropdown label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: var(--radius-sharp);
}

.col-menu-dropdown label:hover { background: var(--surface-2); }

/* ============================================================================
   Keyboard focus
   ========================================================================== */

/* Catch-all: every real button/link/input plus every element we've made
   keyboard-operable via role="button" gets a visible ring. Previously only
   the two text inputs had any focus style, so nothing else (tags, tree
   nodes, table cells, correlation rows...) was reachable in a way you could
   actually see. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid var(--accent-text);
  outline-offset: 2px;
  border-radius: var(--radius-sharp);
}

/* ============================================================================
   Atomic Red Team test disclosure
   ========================================================================== */

.atomic-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  cursor: pointer;
}

.atomic-header .name { font-weight: 600; font-size: 0.88rem; }

.atomic-header .executor {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.15rem;
}

.atomic-header .executor .platforms {
  border-left: 1px solid var(--rule-strong);
  padding-left: 0.5rem;
}

.atomic-toggle {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.atomic-toggle.open { transform: rotate(90deg); }

.atomic-body { display: none; margin-top: 0.5rem; }
.atomic-body.open { display: block; }

.atomic-header .executor .elevation {
  color: var(--sev-high);
  border: 1px solid rgba(192, 122, 74, 0.5);
  border-radius: var(--radius-sharp);
  padding: 0.05rem 0.4rem;
  font-size: 0.68rem;
}

.atomic-desc {
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 0.5rem;
}

.atomic-desc a { color: var(--accent); }

.atomic-guid {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  margin-bottom: 0.5rem;
}

.atomic-subtitle {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0.6rem 0 0.3rem;
}

.atomic-args {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.atomic-arg {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: baseline;
  font-size: 0.78rem;
}

.atomic-arg .arg-name {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 600;
}

.atomic-arg .arg-type {
  color: var(--text-muted);
  font-size: 0.68rem;
  border: 1px solid var(--rule);
  border-radius: var(--radius-sharp);
  padding: 0.05rem 0.35rem;
}

.atomic-arg .arg-desc { color: var(--text-muted); }

.atomic-arg .arg-default {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text);
  word-break: break-all;
}

.atomic-arg .arg-default a { color: var(--accent); }

.atomic-dep {
  margin-top: 0.4rem;
}

.atomic-dep .dep-desc {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-bottom: 0.3rem;
}

.atomic-dep .dep-desc a { color: var(--accent); }

.atomic-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.atomic-toolbar button {
  background: transparent;
  border: 1px solid var(--rule);
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sharp);
  cursor: pointer;
}

.atomic-toolbar button:hover { color: var(--text); border-color: var(--rule-strong); }

/* ============================================================================
   Skeleton loading (technique cards) — holds layout still while individual
   technique fetches resolve, instead of a spinner that collapses/expands
   the card once data arrives.
   ========================================================================== */

.tech-skeleton { min-height: 168px; }

.skel-bar {
  background: var(--surface-2);
  border-radius: var(--radius-sharp);
  animation: skel-pulse 1.3s ease-in-out infinite;
}

.skel-bar.title { width: 40%; height: 0.9rem; margin: 0.4rem 0 1rem; }
.skel-bar.line { width: 90%; height: 0.7rem; margin-bottom: 0.5rem; }
.skel-bar.line.short { width: 55%; }
.skel-bar.tags { width: 30%; height: 1.4rem; display: inline-block; margin: 0.2rem 0.4rem 0.2rem 0; }

@keyframes skel-pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 0.9; }
}

/* ============================================================================
   Responsive
   ========================================================================== */

@media (max-width: 720px) {
  .topbar { padding: 0.75rem 1rem; gap: 0.75rem; }
  .brand h1 { font-size: 1rem; }
  main { padding: 1.25rem 1rem 3rem; }

  .nav { gap: 0; }
  .nav-link, .nav-group-btn { font-size: 0.8rem; padding: 0.3rem 0.5rem; }

  .nav-dropdown,
  .col-menu-dropdown {
    left: 0;
    right: auto;
    max-width: calc(100vw - 2rem);
  }

  .meta-grid { gap: 1.1rem; }
  .summary-head h2 { font-size: 1.1rem; }

  .tabs { overflow-x: auto; }
  .tab { padding: 0.55rem 0.8rem; font-size: 0.8rem; white-space: nowrap; }

  .overlay { padding: 0; align-items: flex-end; }
  .overlay-panel { width: 100%; max-height: 90vh; border-radius: var(--radius-panel) var(--radius-panel) 0 0; }

  table.data-table { font-size: 0.78rem; }
  .data-table th, .data-table td { padding: 0.45rem 0.55rem; }

  .pane-grid { grid-template-columns: 1fr 1fr; }
  .corr-row { flex-direction: column; }
}

@media (max-width: 460px) {
  .pane-grid { grid-template-columns: 1fr; }
}
