/* ==========================================================================
   NACSA Act 854 Explorer — Repo-specific styles
   Loaded AFTER base.css. Only contains nacsa-specific overrides, colors,
   and components not covered by the shared base stylesheet.
   ========================================================================== */

/* ===== NACSA-SPECIFIC VARIABLES ===== */
:root {
  --card: #FFFFFF;
  --border-light: #F1F5F9;
  --accent-dark: #155E75;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --green: #16A34A;
  --green-light: #DCFCE7;
  --amber: #D97706;
  --amber-light: #FEF3C7;
  --purple: #7C3AED;
  --purple-light: #EDE9FE;
  --cyan: #0891B2;
  --cyan-light: #CFFAFE;
  --teal: #0D9488;
  --teal-light: #CCFBF1;
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -2px rgba(0,0,0,0.04);
  --mono: 'JetBrains Mono', monospace;
}

/* ===== HEADER (nacsa-specific branded header) ===== */
.header {
  background: var(--accent-dark);
  color: #fff;
  padding: 0.75rem 1.5rem;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: none;
}
.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}
.header-brand { text-decoration: none; color: #fff; }
.header-brand:hover { color: #fff; text-decoration: none; }
.header-brand h1 { font-size: 1.25rem; font-weight: 700; line-height: 1.2; }
.header-subtitle { font-size: 0.75rem; opacity: 0.7; font-weight: 400; }
.header-search { flex: 1; max-width: 400px; }
.header-search input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.1);
  color: #fff;
  font-size: var(--font-size-base);
  font-family: var(--font-sans);
  outline: none;
  transition: all 0.2s;
}
.header-search input::placeholder { color: rgba(255,255,255,0.5); }
.header-search input:focus {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.4);
}

/* ===== NAV (nacsa-specific sticky offset) ===== */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 52px;
  z-index: 90;
  padding: 0;
}
.nav-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  gap: 0;
  overflow-x: auto;
  padding: 0 1.5rem;
  -webkit-overflow-scrolling: touch;
}
.nav-link {
  border-bottom: 2px solid transparent;
  border-radius: 0;
}
.nav-link.active {
  border-bottom-color: var(--accent);
  background: none;
}

/* ===== STATS BANNER ===== */
.stats-banner {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
}
.stat-card {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
}
.stat-number {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  line-height: 1;
}
.stat-label {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-top: 0.25rem;
}

/* ===== PART COLORS (framework part border accents) ===== */
.control-card[data-part="I"]    { border-left-color: #7C3AED; }
.control-card[data-part="II"]   { border-left-color: #0E7490; }
.control-card[data-part="III"]  { border-left-color: #0891B2; }
.control-card[data-part="IV"]   { border-left-color: #DC2626; }
.control-card[data-part="V"]    { border-left-color: #D97706; }
.control-card[data-part="VI"]   { border-left-color: #16A34A; }
.control-card[data-part="VII"]  { border-left-color: #EA580C; }
.control-card[data-part="VIII"] { border-left-color: #4F46E5; }
.control-card[data-part="IX"]   { border-left-color: #64748B; }

/* ===== SECTION LINKS ===== */
.section-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.625rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: inherit;
  transition: background 0.15s;
}
.section-link:hover { background: var(--surface-hover); text-decoration: none; }
.section-link-id {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  font-weight: 500;
  color: var(--accent);
  min-width: 3rem;
}
.section-link-title {
  font-size: var(--font-size-sm);
  flex: 1;
}
.section-link-badges { display: flex; gap: 0.375rem; }

/* ===== NACSA-SPECIFIC BADGES ===== */
.badge-administrative { background: var(--surface-hover); color: var(--text-secondary); }
.badge-procedural { background: var(--warning-light); color: var(--warning); }
.badge-enabling { background: var(--success-light); color: var(--success); }
.badge-definitional { background: var(--info-light); color: var(--info); }
.badge-prohibitive { background: var(--danger-light); color: var(--danger); }
.badge-penalty { background: var(--danger-light); color: var(--danger); }
.badge-type { background: var(--success-light); color: var(--success); }
.badge-layer { background: #EDE9FE; color: #7C3AED; }
.badge-mandatory-doc { background: var(--danger-light); color: var(--danger); }
.badge-sector { background: var(--teal-light); color: var(--teal); }

/* Source badges */
.badge-source-act { background: #DBEAFE; color: #1E40AF; }
.badge-source-regulation { background: #DCFCE7; color: #166534; }
.badge-source-directive { background: #FEF3C7; color: #92400E; }
.badge-source-code-of-practice { background: #EDE9FE; color: #5B21B6; }

/* AI / Example inline badges */
.badge-ai { background: #EFF6FF; color: #1D4ED8; font-size: 0.6rem; font-weight: 600; font-style: italic; padding: 1px 6px; border-radius: 999px; margin-left: 6px; cursor: help; vertical-align: middle; }
.badge-example { background: #F0FDF4; color: #15803D; font-size: 0.6rem; font-weight: 600; font-style: italic; padding: 1px 6px; border-radius: 999px; margin-left: 6px; cursor: help; vertical-align: middle; }

/* ===== PAGE TITLE ===== */
.page-title {
  font-size: var(--font-size-xl);
  font-weight: 700;
  margin-bottom: 0.25rem;
}
.page-subtitle {
  font-size: var(--font-size-base);
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

/* ===== LEGACY TABS (inside section detail, risk management) ===== */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.tab-btn {
  padding: 0.625rem 1rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font-sans);
  transition: all 0.2s;
}
.tab-btn:hover { color: var(--accent); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ===== VERBATIM / TRANSLATION BLOCKS ===== */
.verbatim-block {
  background: #ECFEFF;
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1rem;
  font-size: var(--font-size-base);
  line-height: 1.7;
  white-space: pre-wrap;
}
.translation-block {
  background: #F0FDF4;
  border-left: 4px solid var(--success);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1rem;
  font-size: var(--font-size-base);
  line-height: 1.7;
}
.block-label {
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

/* ===== CARDS (generic nacsa cards) ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card-title {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.card-meta {
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.card-body { font-size: var(--font-size-sm); color: var(--text-secondary); line-height: 1.6; }

/* ===== EVIDENCE CARD (legacy, used in section detail) ===== */
.evidence-card { margin-bottom: 1rem; }
.evidence-card .good-list, .evidence-card .gap-list {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
  font-size: var(--font-size-sm);
}
.evidence-card .good-list li { color: var(--success); margin-bottom: 0.25rem; }
.evidence-card .good-list li span { color: var(--text-secondary); }
.evidence-card .gap-list li { color: var(--danger); margin-bottom: 0.25rem; }
.evidence-card .gap-list li span { color: var(--text-secondary); }

/* ===== AUDITOR FOCUS ===== */
.auditor-focus {
  background: var(--warning-light);
  border-left: 4px solid var(--warning);
  padding: 1rem 1.25rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1rem;
  font-size: var(--font-size-sm);
  line-height: 1.6;
}
.auditor-focus .block-label { color: #92400E; }

/* ===== REQUIREMENT COLUMNS (legacy section detail view) ===== */
.req-columns {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.req-column {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.req-column-header {
  padding: 0.625rem 0.75rem;
  font-size: var(--font-size-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.req-column-header.legal { background: #DBEAFE; color: #1E40AF; }
.req-column-header.technical { background: #DCFCE7; color: #166534; }
.req-column-header.governance { background: #EDE9FE; color: #5B21B6; }
.req-column-body { padding: 0.75rem; }
.req-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--font-size-sm);
}
.req-item:last-child { border-bottom: none; }
.req-item-id {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--accent);
  margin-bottom: 0.125rem;
}
.req-item-text { color: var(--text-secondary); margin-bottom: 0.25rem; }
.req-item-meta {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.req-item-priority { font-weight: 600; }
.priority-critical { color: var(--danger); }
.priority-high { color: var(--warning); }
.priority-medium { color: var(--success); }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filter-chip {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: var(--font-size-xs);
  font-weight: 500;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  transition: all 0.15s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ===== PENALTY CARD ===== */
.penalty-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
}
.penalty-card.severe { border-left: 4px solid var(--danger); }
.penalty-section {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--accent);
  margin-bottom: 0.25rem;
}
.penalty-offence {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.5rem;
}
.penalty-amounts {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.penalty-amount {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  background: var(--danger-light);
  color: var(--danger);
  font-weight: 600;
}
.penalty-corporate {
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-sm);
  background: var(--warning-light);
  color: #92400E;
}

/* ===== CONTROL-SPECIFIC (nacsa overrides) ===== */
.control-card-name { font-weight: 600; font-size: 0.9375rem; }
.control-activities {
  padding-left: 1.25rem;
  font-size: var(--font-size-sm);
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}
.control-activities li { margin-bottom: 0.25rem; }
.control-frameworks {
  display: flex;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* ===== SUPPLEMENT CARD ===== */
.supplement-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.2s;
}
.supplement-card:hover { box-shadow: var(--shadow-lg); }
.supplement-type {
  font-size: var(--font-size-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.25rem;
}
.supplement-title { font-weight: 600; font-size: var(--font-size-md); margin-bottom: 0.5rem; }
.supplement-meta { font-size: var(--font-size-xs); color: var(--text-secondary); }

/* ===== CROSS-REF TABLE ===== */
.xref-row {
  display: flex;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
  font-size: var(--font-size-sm);
  align-items: flex-start;
}
.xref-section {
  font-family: var(--font-mono);
  font-weight: 500;
  color: var(--accent);
  min-width: 4rem;
  cursor: pointer;
}
.xref-section:hover { text-decoration: underline; }
.xref-targets { flex: 1; }
.xref-tag {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  background: var(--surface-hover);
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  margin: 0.125rem;
  cursor: pointer;
  transition: background 0.15s;
}
.xref-tag:hover { background: var(--accent-light); color: var(--accent); }

/* ===== DATA TABLE ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
  margin-bottom: 1rem;
}
.data-table th {
  background: var(--surface-hover);
  text-align: left;
  padding: 0.625rem 0.75rem;
  font-weight: 600;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 0.625rem 0.75rem;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.data-table tr:hover td { background: var(--surface-hover); }

/* ===== SECTOR CARD ===== */
.sector-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.sector-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); text-decoration: none; }
.sector-card-name { font-size: var(--font-size-md); font-weight: 600; margin-bottom: 0.25rem; }
.sector-card-lead { font-size: var(--font-size-sm); color: var(--text-secondary); margin-bottom: 0.5rem; }
.sector-card-meta { font-size: var(--font-size-xs); color: var(--text-muted); }

/* ===== FRAMEWORK FLOW ===== */
.framework-flow {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  align-items: center;
}
.framework-step {
  flex: 1;
  min-width: 140px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}
.framework-step:not(:last-child)::after {
  content: '\2192';
  position: absolute;
  right: -0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.25rem;
}
.framework-step:hover { border-color: var(--accent); }
.framework-step-label { font-weight: 600; font-size: var(--font-size-base); }
.framework-step-count { font-family: var(--font-mono); font-size: var(--font-size-xs); color: var(--text-secondary); margin-top: 0.25rem; }

/* ===== FRAMEWORK GRID (cross-refs) ===== */
.framework-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.framework-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
.framework-card-nacsa { font-weight: 600; font-size: var(--font-size-sm); margin-bottom: 0.25rem; }
.framework-card-foreign { font-size: var(--font-size-sm); color: var(--text-secondary); margin-bottom: 0.25rem; }
.framework-card-notes { font-size: var(--font-size-xs); color: var(--text-muted); margin-top: 0.25rem; }
.similarity-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: var(--font-size-xs);
  font-weight: 500;
}
.similarity-high { background: var(--success-light); color: var(--success); }
.similarity-medium { background: var(--warning-light); color: var(--warning); }
.similarity-low { background: var(--surface-hover); color: var(--text-secondary); }

/* ===== SEARCH ===== */
.search-result {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.search-result:hover { box-shadow: var(--shadow-lg); text-decoration: none; }
.search-result-id {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--accent);
  margin-bottom: 0.125rem;
}
.search-result-title { font-weight: 600; font-size: var(--font-size-base); margin-bottom: 0.25rem; }
.search-result-snippet { font-size: var(--font-size-sm); color: var(--text-secondary); }
.search-highlight {
  background: #FEF3C7;
  padding: 0 0.125rem;
  border-radius: 2px;
}

/* ===== DISCLAIMER ===== */
.disclaimer {
  background: var(--warning-light);
  border: 1px solid #FDE68A;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: var(--font-size-xs);
  color: #92400E;
  line-height: 1.5;
}

/* ===== LEGACY ACCORDION (nacsa-specific) ===== */
.accordion-trigger {
  padding: 0.75rem 1rem;
  font-size: var(--font-size-base);
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
  transition: background 0.15s;
}
.accordion-trigger:hover { background: var(--surface-hover); }
.chevron {
  font-size: var(--font-size-xs);
  transition: transform 0.2s;
  color: var(--text-muted);
}
.accordion-item.open > .accordion-trigger .chevron { transform: rotate(90deg); }
.accordion-content {
  display: none;
  padding: 0 1rem 0.75rem;
}
.accordion-item.open > .accordion-content { display: block; }
.accordion-content[role="region"] { display: block; }
.accordion-trigger[aria-expanded="false"] + .accordion-content[role="region"] { display: none; }

/* ===== RISK MANAGEMENT ===== */
.risk-matrix-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.risk-matrix-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
}
.risk-matrix-corner { width: 100px; background: var(--surface); }
.risk-matrix-col-header {
  text-align: center;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 0.5rem;
  color: var(--text-secondary);
}
.risk-matrix-row-header {
  text-align: right;
  font-size: var(--font-size-xs);
  font-weight: 600;
  padding: 0.5rem 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
}
.risk-matrix-level {
  font-family: var(--font-mono);
  font-size: var(--font-size-xs);
  color: var(--text-muted);
}
.risk-matrix-cell {
  text-align: center;
  padding: 0.625rem 0.5rem;
  border: 2px solid var(--surface);
  border-radius: var(--radius-sm);
  font-weight: 600;
  min-width: 72px;
  transition: transform 0.1s;
}
.risk-matrix-cell:hover { transform: scale(1.05); }
.risk-matrix-score { font-size: 1.125rem; line-height: 1.2; }
.risk-matrix-band { font-size: 0.625rem; text-transform: uppercase; letter-spacing: 0.05em; }
.risk-matrix-legend {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}
.risk-matrix-legend-item {
  display: flex;
  align-items: center;
  gap: 0.375rem;
  font-size: var(--font-size-xs);
  color: var(--text-secondary);
}
.risk-matrix-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* Risk level colors */
.risk-critical { background: #dc2626; color: #fff; }
.risk-high { background: #f97316; color: #fff; }
.risk-medium { background: #eab308; color: #000; }
.risk-low { background: #22c55e; color: #fff; }

/* Risk card */
.risk-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
  transition: box-shadow 0.15s;
}
.risk-card:hover { box-shadow: var(--shadow-lg); }
.risk-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.risk-card-title { font-weight: 600; font-size: 0.9375rem; margin-bottom: 0.375rem; }
.risk-card-desc { font-size: var(--font-size-sm); color: var(--text-secondary); line-height: 1.6; }

/* Sort buttons */
.risk-sort-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 0.5rem;
  font-size: var(--font-size-xs);
  font-family: var(--font-sans);
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.risk-sort-btn:hover { border-color: var(--accent); color: var(--accent); }
.risk-sort-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Treatment grid */
.treatment-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.treatment-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

/* ===== LEGACY EVIDENCE (used in section detail, not control detail) ===== */
.evidence-checklist-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.75rem 1rem; margin-bottom: 0.5rem; }
.evidence-checklist-item-header { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 0.25rem; }
.evidence-checklist-item-name { font-weight: 600; font-size: var(--font-size-sm); }
.evidence-checklist-item-desc { font-size: var(--font-size-xs); color: var(--text-muted); line-height: 1.5; margin-bottom: 0.375rem; }
.evidence-checklist-item-sources { font-size: var(--font-size-xs); color: var(--text-muted); margin-bottom: 0.375rem; line-height: 1.5; }
.evidence-checklist-item-sources strong { color: var(--text-secondary); }

/* Legacy evidence good/gap lists (used in section detail evidence panel) */
.evidence-card .evidence-good,
.evidence-card .evidence-gap { margin: 0; padding-left: 1.25rem; font-size: var(--font-size-xs); line-height: 1.6; list-style: none; }

/* Legacy audit package overrides */
.audit-package .accordion { margin-bottom: 0.5rem; }
.audit-package .accordion-item { border-color: var(--border); }
.audit-package .accordion-trigger { font-size: var(--font-size-sm); }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
  .req-columns { grid-template-columns: 1fr; }
  .framework-grid { grid-template-columns: 1fr; }
  .treatment-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; }
  .header-search { max-width: 100%; }
  .nav-inner { padding: 0 0.75rem; }
  .stats-banner { flex-direction: column; }
  .framework-flow { flex-direction: column; }
  .framework-step::after { display: none; }
  .risk-card-header { flex-direction: column; align-items: flex-start; }
  .risk-card > div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .treatment-grid { grid-template-columns: 1fr; }
}

/* ===== PRINT ===== */
@media print {
  .header, .nav, .header-search, .tabs { display: none; }
  #app { max-width: 100%; padding: 0; }
  .control-card, .card, .artifact-card, .penalty-card, .risk-card { break-inside: avoid; }
}

/* ===== COMPLIANCE CHAIN VISUALIZATION ===== */
.compliance-chain { margin-top: 1rem; }
.compliance-chain-select { margin-bottom: 1.25rem; }
.compliance-chain-select select {
  width: 100%; max-width: 480px; padding: 0.5rem 0.75rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 0.875rem; background: var(--bg); color: var(--text-primary);
}
.compliance-chain-select select:focus { outline: none; border-color: var(--accent); }
.chain-flow {
  display: flex; align-items: flex-start; gap: 0; flex-wrap: nowrap;
  overflow-x: auto; padding: 0.5rem 0 1rem;
}
.chain-step { display: flex; align-items: flex-start; }
.chain-node {
  min-width: 200px; max-width: 260px; border-radius: var(--radius);
  border: 2px solid var(--border); background: var(--card);
  padding: 0.875rem 1rem; cursor: pointer; transition: box-shadow 0.15s, border-color 0.15s;
  position: relative;
}
.chain-node:hover { box-shadow: var(--shadow-md); }
.chain-node-framework {
  font-size: 0.6875rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; margin-bottom: 0.375rem; padding: 0.125rem 0.5rem;
  border-radius: 3px; display: inline-block; color: #fff;
}
.chain-node-id { font-size: 0.9375rem; font-weight: 600; color: var(--text-primary); margin-bottom: 0.25rem; font-family: var(--mono); }
.chain-node-title { font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.4; }
.chain-node-detail {
  display: none; margin-top: 0.75rem; padding-top: 0.625rem; border-top: 1px solid var(--border);
  font-size: 0.8125rem; color: var(--text-secondary); line-height: 1.5;
}
.chain-node.expanded .chain-node-detail { display: block; }
.chain-arrow {
  display: flex; align-items: center; padding: 0 0.375rem; color: var(--text-muted);
  font-size: 1.5rem; flex-shrink: 0; min-height: 60px;
}
.chain-arrow::after { content: '\2192'; }

/* Framework-specific node colors */
.chain-node.fw-nacsa { border-color: #155E75; }
.chain-node.fw-nacsa .chain-node-framework { background: #155E75; }
.chain-node.fw-rmit { border-color: #1E40AF; }
.chain-node.fw-rmit .chain-node-framework { background: #1E40AF; }
.chain-node.fw-nist { border-color: #0E7490; }
.chain-node.fw-nist .chain-node-framework { background: #0E7490; }
.chain-node.fw-iso { border-color: #7C3AED; }
.chain-node.fw-iso .chain-node-framework { background: #7C3AED; }
.chain-node.fw-pdpa { border-color: #D97706; }
.chain-node.fw-pdpa .chain-node-framework { background: #D97706; }
.chain-node.fw-cis { border-color: #16A34A; }
.chain-node.fw-cis .chain-node-framework { background: #16A34A; }
.chain-node.fw-other { border-color: #D97706; }
.chain-node.fw-other .chain-node-framework { background: #D97706; }

.chain-empty { font-size: 0.875rem; color: var(--text-muted); padding: 1rem 0; }
.chain-legend {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1rem; padding-top: 0.75rem;
  border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-secondary);
}
.chain-legend-item { display: flex; align-items: center; gap: 0.375rem; }
.chain-legend-swatch { width: 12px; height: 12px; border-radius: 2px; }

@media (max-width: 640px) {
  .chain-flow { flex-direction: column; align-items: stretch; }
  .chain-step { flex-direction: column; align-items: stretch; }
  .chain-node { max-width: 100%; min-width: 0; }
  .chain-arrow { justify-content: center; min-height: auto; padding: 0.25rem 0; font-size: 1.25rem; }
  .chain-arrow::after { content: '\2193'; }
}

/* ===== DARK MODE ===== */
@media (prefers-color-scheme: dark) {
  :root {
    --card: #1E293B;
    --border-light: #283548;
    --accent-dark: #0E7490;
    --red: #F87171;
    --red-light: #3B1C1C;
    --green: #4ADE80;
    --green-light: #1A3326;
    --amber: #FBBF24;
    --amber-light: #3A2E10;
    --purple: #A78BFA;
    --purple-light: #2E2750;
    --cyan: #22D3EE;
    --cyan-light: #153038;
    --teal: #2DD4BF;
    --teal-light: #14322C;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.2);
  }

  /* Header */
  .header { background: #164E63; }

  /* Part card colors — vivid in dark mode */
  .control-card[data-part="I"]    { border-left-color: #A78BFA; }
  .control-card[data-part="II"]   { border-left-color: #22D3EE; }
  .control-card[data-part="III"]  { border-left-color: #22D3EE; }
  .control-card[data-part="IV"]   { border-left-color: #F87171; }
  .control-card[data-part="V"]    { border-left-color: #FBBF24; }
  .control-card[data-part="VI"]   { border-left-color: #4ADE80; }
  .control-card[data-part="VII"]  { border-left-color: #FB923C; }
  .control-card[data-part="VIII"] { border-left-color: #818CF8; }
  .control-card[data-part="IX"]   { border-left-color: #94A3B8; }

  /* Verbatim / Translation blocks */
  .verbatim-block { background: #153038; border-left-color: var(--accent); }
  .translation-block { background: #1A3326; border-left-color: var(--green); }

  /* Auditor focus */
  .auditor-focus { background: #3A2E10; border-left-color: var(--amber); }
  .auditor-focus .block-label { color: #FBBF24; }

  /* Disclaimer */
  .disclaimer { background: #3A2E10; border-color: #5C4A1E; color: #FBBF24; }

  /* Table hover */
  .data-table th { background: #283548; }
  .data-table tr:hover td { background: #283548; }

  /* Source badges */
  .badge-source-act { background: #1E2D4A; color: #93C5FD; }
  .badge-source-regulation { background: #1A3326; color: #6EE7B7; }
  .badge-source-directive { background: #3A2E10; color: #FDE68A; }
  .badge-source-code-of-practice { background: #2E2750; color: #C4B5FD; }

  /* AI / Example badges */
  .badge-ai { background: #1E2D4A; color: #93C5FD; }
  .badge-example { background: #1A3326; color: #6EE7B7; }

  /* Requirement column headers */
  .req-column-header.legal { background: #1E2D4A; color: #93C5FD; }
  .req-column-header.technical { background: #1A3326; color: #6EE7B7; }
  .req-column-header.governance { background: #2E2750; color: #C4B5FD; }

  /* Filter chips */
  .filter-chip { background: var(--surface); border-color: var(--border); color: var(--text-secondary); }
  .filter-chip:hover { border-color: var(--accent); color: var(--accent); }
  .filter-chip.active { background: var(--accent); color: #0F172A; border-color: var(--accent); }

  /* Penalty card */
  .penalty-amount { background: #3B1C1C; color: var(--red); }
  .penalty-corporate { background: #3A2E10; color: #FBBF24; }

  /* Similarity badges */
  .similarity-high { background: #1A3326; color: var(--green); }
  .similarity-medium { background: #3A2E10; color: var(--amber); }
  .similarity-low { background: #283548; color: var(--text-secondary); }

  /* Cross-ref tags */
  .xref-tag { background: #283548; }
  .xref-tag:hover { background: var(--accent-light); color: var(--accent); }

  /* Search highlight */
  .search-highlight { background: #3A2E10; color: #FBBF24; }

  /* Risk matrix */
  .risk-matrix-corner { background: var(--surface); }
  .risk-matrix-cell { border-color: var(--surface); }

  /* Risk sort buttons */
  .risk-sort-btn { border-color: var(--border); color: var(--text-secondary); }
  .risk-sort-btn:hover { border-color: var(--accent); color: var(--accent); }
  .risk-sort-btn.active { background: var(--accent); color: #0F172A; border-color: var(--accent); }

  /* Framework step arrow */
  .framework-step:not(:last-child)::after { color: var(--text-muted); }
  .framework-step:hover { border-color: var(--accent); }

  /* Compliance chain dark mode */
  .compliance-chain-select select { background: var(--surface); border-color: var(--border); color: var(--text-primary); }
  .chain-node { background: var(--surface); }
}
