/* EU AI Act Explorer — Design System */
/* Palette: Deep navy legal document meets clean Swiss UI */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root, [data-theme="light"] {
  /* --- Type Scale (fluid) --- */
  --text-xs:   clamp(0.75rem,  0.7rem  + 0.25vw, 0.875rem);
  --text-sm:   clamp(0.8125rem, 0.75rem + 0.3vw, 0.9375rem);
  --text-base: clamp(0.9375rem, 0.85rem + 0.45vw, 1.0625rem);
  --text-lg:   clamp(1.125rem, 0.95rem + 0.85vw, 1.375rem);
  --text-xl:   clamp(1.375rem, 1rem    + 1.25vw, 1.875rem);
  --text-2xl:  clamp(1.75rem,  1.2rem  + 2vw,    2.5rem);

  /* --- 4px Spacing System --- */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* --- Fonts --- */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-serif: 'Newsreader', 'Georgia', 'Times New Roman', serif;

  /* --- Light Mode: Navy-tinted cool surfaces --- */
  --color-bg:               #f4f5f7;
  --color-surface:          #f8f9fb;
  --color-surface-2:        #ffffff;
  --color-surface-offset:   #eef0f4;
  --color-surface-offset-2: #e6e9ef;
  --color-surface-dynamic:  #dde1e9;
  --color-divider:          #d4d8e2;
  --color-border:           #c8cdd8;

  /* --- Text --- */
  --color-text:           #1a2035;
  --color-text-muted:     #5a6275;
  --color-text-faint:     #9ba3b5;
  --color-text-inverse:   #f8f9fb;

  /* --- Primary accent (EU-blue, professional) --- */
  --color-primary:          #1e40af;
  --color-primary-hover:    #1e3a8a;
  --color-primary-active:   #1e3270;
  --color-primary-highlight: #dbeafe;
  --color-primary-subtle:   color-mix(in oklch, #1e40af 8%, #f8f9fb);

  /* --- Semantic colors --- */
  --color-success:          #15803d;
  --color-success-hover:    #166534;
  --color-success-highlight: #dcfce7;
  --color-warning:          #b45309;
  --color-warning-hover:    #92400e;
  --color-warning-highlight: #fef3c7;
  --color-error:            #b91c1c;
  --color-error-hover:      #991b1b;
  --color-error-highlight:  #fee2e2;

  /* --- Actor colors (from data) --- */
  --color-actor-provider:    #2563eb;
  --color-actor-deployer:    #16a34a;
  --color-actor-importer:    #ea580c;
  --color-actor-distributor: #9333ea;
  --color-actor-authrep:     #0d9488;
  --color-actor-notified:    #dc2626;
  --color-actor-market:      #b45309;
  --color-actor-affected:    #db2777;
  --color-actor-all:         #6b7280;

  /* --- Phase badge colors --- */
  --color-phase-1: #15803d;
  --color-phase-1-bg: #dcfce7;
  --color-phase-2: #b45309;
  --color-phase-2-bg: #fef3c7;
  --color-phase-3: #1e40af;
  --color-phase-3-bg: #dbeafe;
  --color-phase-4: #4b5563;
  --color-phase-4-bg: #f3f4f6;

  /* --- Risk Tier colors --- */
  --color-tier-prohibited: #dc2626;
  --color-tier-prohibited-bg: #fee2e2;
  --color-tier-high-risk: #ea580c;
  --color-tier-high-risk-bg: #fff7ed;
  --color-tier-limited-risk: #ca8a04;
  --color-tier-limited-risk-bg: #fefce8;
  --color-tier-gpai: #7c3aed;
  --color-tier-gpai-bg: #f5f3ff;
  --color-tier-sandbox: #0d9488;
  --color-tier-sandbox-bg: #f0fdfa;
  --color-tier-governance: #1e40af;
  --color-tier-governance-bg: #eff6ff;
  --color-tier-enforcement: #be123c;
  --color-tier-enforcement-bg: #fff1f2;
  --color-tier-general: #6b7280;
  --color-tier-general-bg: #f9fafb;

  /* --- Radius --- */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --transition-fast: 120ms cubic-bezier(0.16, 1, 0.3, 1);
  --transition-interactive: 180ms cubic-bezier(0.16, 1, 0.3, 1);

  /* --- Shadows --- */
  --shadow-sm: 0 1px 2px rgb(26 32 53 / 0.06);
  --shadow-md: 0 4px 12px rgb(26 32 53 / 0.08);
  --shadow-lg: 0 8px 24px rgb(26 32 53 / 0.12);

  /* --- Layout --- */
  --sidebar-width: 280px;
  --topbar-height: 52px;
  --prose-width: 72ch;
}

/* --- Dark mode --- */
[data-theme="dark"] {
  --color-bg:               #0f1117;
  --color-surface:          #141720;
  --color-surface-2:        #191e2b;
  --color-surface-offset:   #1c2030;
  --color-surface-offset-2: #212537;
  --color-surface-dynamic:  #2a2f42;
  --color-divider:          #262b3d;
  --color-border:           #303551;
  --color-text:             #d4d8e8;
  --color-text-muted:       #7580a0;
  --color-text-faint:       #4a5270;
  --color-text-inverse:     #0f1117;
  --color-primary:          #6b8ff0;
  --color-primary-hover:    #8aaaf5;
  --color-primary-active:   #a8c0f8;
  --color-primary-highlight: #1e2a4a;
  --color-primary-subtle:   color-mix(in oklch, #6b8ff0 10%, #141720);
  --color-success:          #4ade80;
  --color-success-hover:    #86efac;
  --color-success-highlight: #14532d;
  --color-warning:          #fbbf24;
  --color-warning-hover:    #fcd34d;
  --color-warning-highlight: #451a03;
  --color-error:            #f87171;
  --color-error-hover:      #fca5a5;
  --color-error-highlight:  #450a0a;
  --color-actor-provider:    #60a5fa;
  --color-actor-deployer:    #4ade80;
  --color-actor-importer:    #fb923c;
  --color-actor-distributor: #c084fc;
  --color-actor-authrep:     #2dd4bf;
  --color-actor-notified:    #f87171;
  --color-actor-market:      #fbbf24;
  --color-actor-affected:    #f472b6;
  --color-actor-all:         #9ca3af;
  --color-phase-1: #4ade80;
  --color-phase-1-bg: #14532d;
  --color-phase-2: #fbbf24;
  --color-phase-2-bg: #451a03;
  --color-phase-3: #60a5fa;
  --color-phase-3-bg: #1e3a5f;
  --color-phase-4: #9ca3af;
  --color-phase-4-bg: #1f2937;
  --color-tier-prohibited: #f87171;
  --color-tier-prohibited-bg: #450a0a;
  --color-tier-high-risk: #fb923c;
  --color-tier-high-risk-bg: #431407;
  --color-tier-limited-risk: #facc15;
  --color-tier-limited-risk-bg: #422006;
  --color-tier-gpai: #c084fc;
  --color-tier-gpai-bg: #2e1065;
  --color-tier-sandbox: #2dd4bf;
  --color-tier-sandbox-bg: #042f2e;
  --color-tier-governance: #60a5fa;
  --color-tier-governance-bg: #172554;
  --color-tier-enforcement: #fb7185;
  --color-tier-enforcement-bg: #4c0519;
  --color-tier-general: #9ca3af;
  --color-tier-general-bg: #1f2937;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.25);
  --shadow-md: 0 4px 12px rgb(0 0 0 / 0.35);
  --shadow-lg: 0 8px 24px rgb(0 0 0 / 0.45);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --color-bg:               #0f1117;
    --color-surface:          #141720;
    --color-surface-2:        #191e2b;
    --color-surface-offset:   #1c2030;
    --color-surface-offset-2: #212537;
    --color-surface-dynamic:  #2a2f42;
    --color-divider:          #262b3d;
    --color-border:           #303551;
    --color-text:             #d4d8e8;
    --color-text-muted:       #7580a0;
    --color-text-faint:       #4a5270;
    --color-text-inverse:     #0f1117;
    --color-primary:          #6b8ff0;
    --color-primary-hover:    #8aaaf5;
    --color-primary-active:   #a8c0f8;
    --color-primary-highlight: #1e2a4a;
    --color-primary-subtle:   color-mix(in oklch, #6b8ff0 10%, #141720);
    --color-success:          #4ade80;
    --color-success-hover:    #86efac;
    --color-success-highlight: #14532d;
    --color-warning:          #fbbf24;
    --color-warning-hover:    #fcd34d;
    --color-warning-highlight: #451a03;
    --color-error:            #f87171;
    --color-error-hover:      #fca5a5;
    --color-error-highlight:  #450a0a;
    --color-actor-provider:    #60a5fa;
    --color-actor-deployer:    #4ade80;
    --color-actor-importer:    #fb923c;
    --color-actor-distributor: #c084fc;
    --color-actor-authrep:     #2dd4bf;
    --color-actor-notified:    #f87171;
    --color-actor-market:      #fbbf24;
    --color-actor-affected:    #f472b6;
    --color-actor-all:         #9ca3af;
    --color-phase-1: #4ade80;
    --color-phase-1-bg: #14532d;
    --color-phase-2: #fbbf24;
    --color-phase-2-bg: #451a03;
    --color-phase-3: #60a5fa;
    --color-phase-3-bg: #1e3a5f;
    --color-phase-4: #9ca3af;
    --color-phase-4-bg: #1f2937;
    --color-tier-prohibited: #f87171;
    --color-tier-prohibited-bg: #450a0a;
    --color-tier-high-risk: #fb923c;
    --color-tier-high-risk-bg: #431407;
    --color-tier-limited-risk: #facc15;
    --color-tier-limited-risk-bg: #422006;
    --color-tier-gpai: #c084fc;
    --color-tier-gpai-bg: #2e1065;
    --color-tier-sandbox: #2dd4bf;
    --color-tier-sandbox-bg: #042f2e;
    --color-tier-governance: #60a5fa;
    --color-tier-governance-bg: #172554;
    --color-tier-enforcement: #fb7185;
    --color-tier-enforcement-bg: #4c0519;
    --color-tier-general: #9ca3af;
    --color-tier-general-bg: #1f2937;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.25);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.35);
    --shadow-lg: 0 8px 24px rgb(0 0 0 / 0.45);
  }
}

/* ============================================================
   BASE RESET
   ============================================================ */

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

html {
  -moz-text-size-adjust: none;
  -webkit-text-size-adjust: none;
  text-size-adjust: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  hanging-punctuation: first last;
  scroll-padding-top: var(--space-16);
}

body {
  min-height: 100dvh;
  line-height: 1.6;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  color: var(--color-text);
  background-color: var(--color-bg);
}

img, picture, video, canvas, svg { display: block; max-width: 100%; height: auto; }
ul[role="list"], ol[role="list"] { list-style: none; }
input, button, textarea, select { font: inherit; color: inherit; }

h1, h2, h3, h4, h5, h6 { text-wrap: balance; line-height: 1.2; }

::selection {
  background: var(--color-primary-highlight);
  color: var(--color-text);
}

:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

button { cursor: pointer; background: none; border: none; }
table { border-collapse: collapse; width: 100%; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0;
}

/* ============================================================
   APP LAYOUT
   ============================================================ */

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--topbar-height);
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  z-index: 100;
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  text-decoration: none;
  color: inherit;
}

.topbar-logo svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.topbar-logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.topbar-logo-title {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.topbar-logo-subtitle {
  font-size: 0.65rem;
  color: var(--color-text-muted);
  font-weight: 400;
  white-space: nowrap;
}

.topbar-search-wrap {
  flex: 1;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
}

.topbar-search-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast);
  text-align: left;
}

.topbar-search-btn:hover {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-text);
}

.topbar-search-btn .search-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.topbar-search-btn .search-text { flex: 1; }

.topbar-search-btn .search-kbd {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.topbar-search-btn .search-kbd kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 4px;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-body);
  color: var(--color-text-faint);
  line-height: 1.4;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
  margin-left: auto;
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.icon-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.icon-btn svg { width: 16px; height: 16px; }

.hamburger-btn {
  display: none;
}

/* Body layout */
.app-body {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--transition-interactive), transform var(--transition-interactive);
}

.sidebar-inner {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-4) 0 var(--space-12);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.sidebar-section {
  margin-bottom: var(--space-1);
}

.sidebar-section-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--transition-fast);
  user-select: none;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
}

.sidebar-section-header:hover { color: var(--color-text); }

.sidebar-section-header .chevron {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  margin-left: auto;
}

.sidebar-section-header.collapsed .chevron {
  transform: rotate(-90deg);
}

.sidebar-section-content {
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-section-content.collapsed {
  max-height: 0 !important;
}

/* Chapter items in sidebar */
.chapter-item {}

.chapter-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  user-select: none;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
}

.chapter-header:hover { color: var(--color-text); background: var(--color-surface-offset); }

.chapter-header .ch-num {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-faint);
  min-width: 20px;
}

.chapter-header .ch-title { flex: 1; line-height: 1.3; }

.chapter-header .chevron {
  width: 10px;
  height: 10px;
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.chapter-header.collapsed .chevron { transform: rotate(-90deg); }

.chapter-articles { overflow: hidden; }
.chapter-articles.collapsed { display: none; }

/* Article items in sidebar */
.article-link {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-8);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
  line-height: 1.4;
}

.article-link:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.article-link.active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  font-weight: 500;
}

.article-link .art-num {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-faint);
  flex-shrink: 0;
  min-width: 24px;
}

.article-link.active .art-num { color: var(--color-primary); }

.article-link.filtered-out {
  opacity: 0.3;
}

/* Section sub-header in sidebar */
.section-label {
  padding: var(--space-2) var(--space-4) var(--space-1) var(--space-6);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-faint);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  display: block;
}

/* Sidebar single links (recitals, annexes, etc.) */
.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-8);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  line-height: 1.4;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

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

.sidebar-nav-link.active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
  font-weight: 500;
}

.sidebar-nav-link .item-num {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-faint);
  min-width: 28px;
  flex-shrink: 0;
}

/* ============================================================
   FILTER BAR (collapsible in sidebar)
   ============================================================ */

.filter-bar-wrap {
  flex-shrink: 0;
  border-bottom: 1px solid var(--color-divider);
  background: var(--color-surface);
}

.filter-bar-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: color var(--transition-fast), background var(--transition-fast);
  user-select: none;
  background: none;
  border: none;
  text-align: left;
  position: relative;
}

.filter-bar-toggle:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.filter-bar-toggle-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  opacity: 0.6;
}

.filter-bar-toggle-label {
  flex: 1;
}

.filter-bar-toggle-chevron {
  flex-shrink: 0;
  transition: transform var(--transition-fast);
  transform: rotate(-90deg);
}

.filter-bar-toggle.open .filter-bar-toggle-chevron {
  transform: rotate(0deg);
}

/* Active-filter indicator dot */
.filter-bar-toggle.has-active-filters::after {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-primary);
  position: absolute;
  right: var(--space-8);
  top: 50%;
  transform: translateY(-50%);
}

.filter-bar {
  overflow: hidden;
  transition: max-height 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.filter-bar.collapsed {
  max-height: 0 !important;
}

.filter-bar-inner {
  padding: 0 var(--space-3) var(--space-3);
}

.filter-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
  display: block;
}

.actor-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.actor-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.5;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

.actor-filter-btn:hover { 
  background: var(--actor-color);
  color: white;
  border-color: var(--actor-color);
}

.actor-filter-btn.active {
  background: var(--actor-color);
  color: white;
  border-color: var(--actor-color);
}

.actor-filter-btn .actor-count {
  font-size: 0.6rem;
  opacity: 0.8;
}

.phase-filters {
  display: flex;
  gap: var(--space-1);
  flex-wrap: wrap;
}

.phase-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.5;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

.phase-filter-btn:hover {
  background: var(--phase-bg);
  color: var(--phase-color);
  border-color: var(--phase-color);
}

.phase-filter-btn.active {
  background: var(--phase-bg);
  color: var(--phase-color);
  border-color: var(--phase-color);
  font-weight: 600;
}

/* ============================================================
   MAIN CONTENT AREA
   ============================================================ */

.main-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--color-bg);
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.content-inner {
  max-width: calc(var(--prose-width) + var(--space-16));
  padding: var(--space-8) var(--space-10);
  margin: 0 auto;
}

/* ============================================================
   BREADCRUMB
   ============================================================ */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-6);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex-wrap: wrap;
}

.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.breadcrumb a:hover { color: var(--color-primary); }

.breadcrumb .sep {
  color: var(--color-text-faint);
  user-select: none;
}

.breadcrumb .current {
  color: var(--color-text);
  font-weight: 500;
}

/* ============================================================
   ARTICLE VIEW
   ============================================================ */

.article-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-6);
  border-bottom: 1px solid var(--color-divider);
}

.article-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.article-number {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.article-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-4);
}

.article-title-row {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.copy-link-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-md);
  color: var(--color-text-faint);
  background: none;
  border: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
}

.copy-link-btn:hover {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.copy-link-btn svg { width: 14px; height: 14px; }

/* ============================================================
   BADGES
   ============================================================ */

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

.badge-phase {
  color: var(--phase-color);
  background: var(--phase-bg);
}

.badge-actor {
  color: white;
  background: var(--actor-color);
}

.badge-actor-light {
  color: var(--actor-color);
  background: color-mix(in oklch, var(--actor-color) 12%, var(--color-surface));
}

.badge-published {
  color: var(--color-success);
  background: var(--color-success-highlight);
}

.badge-planned {
  color: var(--color-warning);
  background: var(--color-warning-highlight);
}

/* ============================================================
   LEGAL TEXT
   ============================================================ */

.legal-text {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--color-text);
  max-width: var(--prose-width);
}

.legal-text p {
  margin-bottom: var(--space-4);
  max-width: none;
}

.legal-text .para-block {
  margin-bottom: var(--space-4);
}

.para-num {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  min-width: 24px;
  display: inline-block;
}

.legal-text .text-block {
  white-space: pre-wrap;
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.75;
}

/* ============================================================
   EXPANDABLE SECTIONS
   ============================================================ */

.expand-section {
  margin-top: var(--space-8);
  border-top: 1px solid var(--color-divider);
}

.expand-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) 0;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-muted);
  transition: color var(--transition-fast);
  user-select: none;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
}

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

.expand-header .chevron {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-fast);
  margin-left: auto;
  flex-shrink: 0;
}

.expand-header.open .chevron { transform: rotate(180deg); }

.expand-body {
  padding-bottom: var(--space-6);
}

.expand-body.hidden { display: none; }

/* ============================================================
   RECITAL CARDS in article view
   ============================================================ */

.recital-card {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}

.recital-card-num {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

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

.recital-card-link {
  font-size: var(--text-xs);
  color: var(--color-primary);
  text-decoration: none;
  margin-top: var(--space-2);
  display: inline-block;
}

.recital-card-link:hover { text-decoration: underline; }

/* ============================================================
   GUIDANCE CARDS
   ============================================================ */

.guidance-card {
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-primary);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-3);
}

.guidance-card.planned {
  border-left-color: var(--color-warning);
}

.guidance-card-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}

.guidance-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  flex: 1;
  line-height: 1.4;
}

.guidance-card-meta {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.guidance-card-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-3);
}

.guidance-card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.guidance-card-link:hover { color: var(--color-primary-hover); text-decoration: underline; }

/* ============================================================
   PREV / NEXT NAVIGATION
   ============================================================ */

.article-nav {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-12);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-divider);
}

.article-nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-text);
}

.article-nav-btn:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-primary);
}

.article-nav-btn.next { text-align: right; }

.article-nav-label {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.article-nav-btn.next .article-nav-label { justify-content: flex-end; }

.article-nav-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.35;
}

/* ============================================================
   RECITAL VIEW
   ============================================================ */

.recital-header {
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.recital-number {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-faint);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: var(--space-2);
}

.recital-text {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--color-text);
  max-width: var(--prose-width);
}

/* ============================================================
   ANNEX VIEW
   ============================================================ */

.annex-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin-bottom: var(--space-6);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

/* ── Annex Metadata Panel ── */
.annex-meta-panel {
  background: var(--color-surface-raised, var(--color-surface));
  border: 1px solid var(--color-divider);
  border-radius: var(--radius-md, 8px);
  padding: var(--space-5, 20px) var(--space-6, 24px);
  margin-bottom: var(--space-6, 24px);
  font-size: var(--text-sm, 14px);
  line-height: 1.6;
}

.annex-meta-header {
  display: flex;
  align-items: center;
  gap: var(--space-3, 12px);
  flex-wrap: wrap;
  margin-bottom: var(--space-3, 12px);
  padding-bottom: var(--space-3, 12px);
  border-bottom: 1px solid var(--color-divider);
}

.annex-meta-heading {
  font-family: var(--font-sans, 'Inter', sans-serif);
  font-size: var(--text-sm, 14px);
  font-weight: 600;
  color: var(--color-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.annex-meta-category {
  display: inline-block;
  font-size: var(--text-xs, 12px);
  font-weight: 500;
  color: var(--color-text-muted, #6b7280);
  background: color-mix(in oklch, var(--color-text-muted, #6b7280) 10%, transparent);
  padding: 2px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.annex-meta-desc {
  color: var(--color-text);
  font-size: var(--text-sm, 14px);
  line-height: 1.6;
  margin: 0 0 var(--space-4, 16px) 0;
  max-width: var(--prose-width, 65ch);
}

.annex-meta-row {
  display: flex;
  gap: var(--space-3, 12px);
  align-items: baseline;
  padding: var(--space-2, 8px) 0;
}

.annex-meta-row + .annex-meta-row {
  border-top: 1px solid color-mix(in oklch, var(--color-divider) 50%, transparent);
}

.annex-meta-label {
  flex: 0 0 140px;
  font-size: var(--text-xs, 12px);
  font-weight: 600;
  color: var(--color-text-muted, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 2px;
}

.annex-meta-value {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1, 4px) var(--space-2, 8px);
  align-items: center;
}

.annex-meta-tag {
  display: inline-block;
  font-size: var(--text-xs, 12px);
  font-weight: 500;
  color: var(--color-primary, #1e3a5f);
  background: color-mix(in oklch, var(--color-primary, #1e3a5f) 8%, var(--color-surface, #fff));
  border: 1px solid color-mix(in oklch, var(--color-primary, #1e3a5f) 15%, transparent);
  padding: 2px 10px;
  border-radius: 99px;
  white-space: nowrap;
}

.annex-meta-refs {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.annex-meta-refs li {
  font-size: var(--text-sm, 14px);
  color: var(--color-text);
  padding: 3px 0;
  line-height: 1.5;
}

.annex-meta-refs li + li {
  border-top: 1px solid color-mix(in oklch, var(--color-divider) 30%, transparent);
}

.annex-meta-refs a {
  color: var(--color-link, #1e40af);
  text-decoration: none;
  font-weight: 500;
}

.annex-meta-refs a:hover {
  text-decoration: underline;
}

.annex-meta-cc-note {
  display: block;
  font-size: var(--text-xs, 12px);
  color: var(--color-text-muted, #6b7280);
  margin-top: 2px;
  font-style: italic;
}

.annex-meta-value a {
  color: var(--color-link, #1e40af);
  text-decoration: none;
  font-weight: 500;
}

.annex-meta-value a:hover {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .annex-meta-row {
    flex-direction: column;
    gap: var(--space-1, 4px);
  }
  .annex-meta-label {
    flex: none;
  }
  .annex-meta-panel {
    padding: var(--space-4, 16px);
  }
}

.annex-text {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--color-text);
  max-width: var(--prose-width);
  white-space: pre-wrap;
}

/* ============================================================
   DEFINITIONS VIEW
   ============================================================ */

.definitions-search {
  position: relative;
  margin-bottom: var(--space-6);
}

.definitions-search input {
  width: 100%;
  padding: var(--space-2) var(--space-3) var(--space-2) 36px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text);
  transition: border-color var(--transition-fast);
}

.definitions-search input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.definitions-search .search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: var(--color-text-faint);
  pointer-events: none;
}

.definition-item {
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--color-divider);
}

.definition-term {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-2);
}

.definition-num {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  font-weight: 500;
  margin-right: var(--space-2);
}

.definition-text {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.65;
  max-width: none;
}

/* ============================================================
   SEARCH OVERLAY
   ============================================================ */

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgb(0 0 0 / 0.4);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 15vh;
  backdrop-filter: blur(4px);
}

.search-overlay.hidden { display: none; }

.search-modal {
  width: 90%;
  max-width: 600px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--color-divider);
}

.search-input-wrap svg {
  width: 18px;
  height: 18px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  font-size: var(--text-base);
  color: var(--color-text);
  caret-color: var(--color-primary);
}

.search-input::placeholder { color: var(--color-text-faint); }

.search-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  color: var(--color-text-faint);
  transition: color var(--transition-fast), background var(--transition-fast);
}

.search-close-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.search-results {
  max-height: 400px;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.search-empty {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.search-group-label {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.search-result-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.search-result-item:hover,
.search-result-item.focused {
  background: var(--color-primary-subtle);
}

.search-result-type {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  flex-shrink: 0;
  margin-top: 2px;
}

.search-result-type.type-article { background: var(--color-primary-highlight); color: var(--color-primary); }
.search-result-type.type-recital { background: color-mix(in oklch, var(--color-success) 15%, var(--color-surface)); color: var(--color-success); }
.search-result-type.type-annex { background: color-mix(in oklch, var(--color-warning) 15%, var(--color-surface)); color: var(--color-warning); }
.search-result-type.type-definition { background: color-mix(in oklch, var(--color-actor-distributor) 15%, var(--color-surface)); color: var(--color-actor-distributor); }

.search-result-content { flex: 1; min-width: 0; }

.search-result-title {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.35;
  margin-bottom: 2px;
}

.search-result-preview {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.search-result-preview mark {
  background: var(--color-primary-highlight);
  color: var(--color-primary);
  border-radius: 2px;
  padding: 0 1px;
}

.search-footer {
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--color-divider);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.search-footer kbd {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  font-size: 10px;
  font-family: var(--font-body);
}

/* ============================================================
   LOADING STATE
   ============================================================ */

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 50vh;
  gap: var(--space-4);
  color: var(--color-text-muted);
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* ============================================================
   WELCOME/HOME VIEW
   ============================================================ */

.home-view {
  padding: var(--space-12) var(--space-10);
  max-width: 900px;
  margin: 0 auto;
}

.home-eyebrow {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.home-title {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.home-desc {
  font-size: var(--text-base);
  line-height: 1.7;
  color: var(--color-text-muted);
  margin-bottom: var(--space-8);
  max-width: 60ch;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-10);
}

.home-stat {
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.home-stat-num {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  letter-spacing: -0.02em;
  margin-bottom: var(--space-1);
}

.home-stat-label {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

.home-phases {
  margin-bottom: var(--space-8);
}

.home-phases-title {
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
}

.home-phase-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-2);
  cursor: pointer;
  transition: all var(--transition-fast);
  text-decoration: none;
  color: inherit;
}

.home-phase-item:hover {
  background: var(--color-surface-offset);
  border-color: var(--phase-color);
}

.home-phase-date {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--phase-color);
  min-width: 90px;
}

.home-phase-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  flex: 1;
  line-height: 1.4;
}

/* ============================================================
   ACTOR LEGEND
   ============================================================ */

.actor-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

/* ============================================================
   COPY TOAST
   ============================================================ */

.copy-toast {
  position: fixed;
  bottom: var(--space-6);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-text);
  color: var(--color-text-inverse);
  font-size: var(--text-xs);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  opacity: 0;
  transition: all var(--transition-interactive);
  pointer-events: none;
  z-index: 2000;
  white-space: nowrap;
}

.copy-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }
  .content-inner {
    padding: var(--space-6) var(--space-6);
  }
}

@media (max-width: 768px) {
  .hamburger-btn { display: flex; }
  
  .sidebar {
    position: fixed;
    left: 0;
    top: var(--topbar-height);
    bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    box-shadow: var(--shadow-lg);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    top: var(--topbar-height);
    z-index: 199;
    background: rgb(0 0 0 / 0.4);
    display: none;
  }
  
  .sidebar-backdrop.show { display: block; }
  
  .topbar-search-wrap {
    max-width: 200px;
  }
  
  .topbar-logo-subtitle { display: none; }
  
  .home-stats {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .content-inner {
    padding: var(--space-6) var(--space-4);
  }
  
  .article-nav {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .topbar-search-wrap { display: none; }
  
  .search-overlay { padding-top: 5vh; }
  
  .search-modal { width: 95%; }

  .home-stats { grid-template-columns: repeat(2, 1fr); }
}

/* Cross-reference links */
a.cross-ref {
  color: var(--color-primary);
  text-decoration: underline;
  text-decoration-color: oklch(from var(--color-primary) l c h / 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease, color 0.15s ease;
  cursor: pointer;
}
a.cross-ref:hover {
  text-decoration-color: var(--color-primary);
  color: var(--color-primary-hover, var(--color-primary));
}
a.cross-ref.external::after {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 2px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center / contain;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center / contain;
}

/* Better annex text formatting */
.annex-text .legal-text {
  font-size: var(--text-sm);
  line-height: 1.75;
}
.annex-text .legal-text .para-block {
  margin-bottom: var(--space-3);
}

/* Definition text with better formatting */
.definition-text {
  line-height: 1.7;
}
.definition-text a.cross-ref {
  font-size: inherit;
}

/* ============================================================
   TABLE OF CONTENTS (Home View)
   ============================================================ */

.toc-wrapper {
  margin-top: var(--space-2);
}

.toc-chapter {
  margin-bottom: var(--space-1);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
}

.toc-chapter-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.toc-chapter-header:hover {
  background: var(--color-surface-offset);
}

.toc-chapter-num {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-primary);
  white-space: nowrap;
  min-width: 80px;
}

.toc-chapter-title {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  line-height: 1.35;
}

.toc-chapter-count {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  white-space: nowrap;
  flex-shrink: 0;
}

.toc-section {
  border-top: 1px solid var(--color-divider);
}

.toc-section-header {
  padding: var(--space-2) var(--space-4) var(--space-2) var(--space-8);
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.03em;
  background: var(--color-surface-offset);
}

.toc-articles {
  display: flex;
  flex-direction: column;
}

.toc-article {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4) var(--space-1) var(--space-8);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
  cursor: pointer;
  border-top: 1px solid color-mix(in oklch, var(--color-divider) 40%, transparent);
  min-height: 32px;
}

.toc-article:first-child {
  border-top: 1px solid var(--color-divider);
}

.toc-article:hover {
  background: var(--color-primary-subtle);
}

.toc-article-num {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-text-faint);
  min-width: 28px;
  flex-shrink: 0;
}

.toc-article-title {
  flex: 1;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toc-article:hover .toc-article-title {
  color: var(--color-text);
}

.toc-article-phase {
  flex-shrink: 0;
  font-size: 0.6rem;
  padding: 1px 6px;
}

.toc-recitals-header {
  /* No special styles needed beyond .toc-chapter-header */
}

@media (max-width: 768px) {
  .toc-article {
    padding-left: var(--space-4);
  }
  .toc-section-header {
    padding-left: var(--space-4);
  }
  .home-view {
    padding: var(--space-8) var(--space-4);
  }
}

/* ============================================================
   RISK TIER BADGE
   ============================================================ */

.badge-tier {
  color: var(--tier-color);
  background: var(--tier-bg);
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

/* TOC tier dot */
.toc-tier-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* ============================================================
   TIER FILTER PILLS (sidebar)
   ============================================================ */

.tier-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.tier-filter-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px var(--space-2);
  border-radius: var(--radius-full);
  font-size: 0.65rem;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.5;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
}

.tier-filter-btn:hover {
  background: var(--tier-bg);
  color: var(--tier-color);
  border-color: var(--tier-color);
}

.tier-filter-btn.active {
  background: var(--tier-bg);
  color: var(--tier-color);
  border-color: var(--tier-color);
  font-weight: 600;
}

/* ============================================================
   DEFINED TERM HIGHLIGHTING & POPOVER
   ============================================================ */

/* When toggle is OFF, defined-term spans are invisible */
.defined-term {
  /* no visual styling by default */
}

/* When toggle is ON */
body.defs-active .defined-term {
  border-bottom: 1.5px dotted var(--color-primary);
  cursor: help;
  transition: background var(--transition-fast);
}

body.defs-active .defined-term:hover {
  background: var(--color-primary-highlight);
}

/* Popover */
.def-popover {
  position: fixed;
  z-index: 1100;
  max-width: 380px;
  max-height: 220px;
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-3) var(--space-4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 1;
  transition: opacity 0.15s ease;
}

.def-popover.hidden {
  display: none;
  opacity: 0;
}

.def-popover-term {
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
  flex-shrink: 0;
}

.def-popover-text {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  max-height: 140px;
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

.def-popover-link {
  font-size: 0.65rem;
  color: var(--color-primary);
  text-decoration: none;
  margin-top: var(--space-2);
  flex-shrink: 0;
  font-weight: 500;
}

.def-popover-link:hover {
  text-decoration: underline;
}

/* Toggle button for defined terms */
.defs-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  transition: color var(--transition-fast), background var(--transition-fast);
  cursor: pointer;
  background: none;
  border: none;
  position: relative;
}

.defs-toggle-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-offset);
}

.defs-toggle-btn.active {
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.defs-toggle-btn svg { width: 16px; height: 16px; }

/* ============================================================
   COMPLIANCE CHECKER
   ============================================================ */

/* ── Wrapper ── */
.cc-wrapper {
  max-width: 860px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-4) var(--space-16);
}

/* ── Header ── */
.cc-header {
  margin-bottom: var(--space-8);
}

.cc-title {
  font-family: var(--font-serif);
  font-size: var(--text-xl);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--color-text);
  margin-bottom: var(--space-2);
  margin-top: var(--space-3);
}

.cc-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  max-width: 65ch;
  line-height: 1.6;
  margin-bottom: var(--space-4);
}

.cc-disclaimer {
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: var(--color-warning-highlight);
  border: 1px solid color-mix(in oklch, var(--color-warning) 30%, transparent);
  border-radius: var(--radius-lg);
  font-size: var(--text-xs);
  color: var(--color-warning);
  line-height: 1.5;
}

.cc-disclaimer svg {
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Progress ── */
.cc-progress {
  margin-bottom: var(--space-6);
}

.cc-progress-bar {
  height: 4px;
  background: var(--color-surface-offset);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-3);
}

.cc-progress-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: var(--radius-full);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.cc-phases {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.cc-phase {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-faint);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.cc-phase.done {
  color: var(--color-success);
  background: var(--color-success-highlight);
}

.cc-phase.active {
  color: var(--color-primary);
  background: var(--color-primary-highlight);
  font-weight: 600;
}

/* ── Question Card ── */
.cc-question-card {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-8);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 600px) {
  .cc-question-card {
    padding: var(--space-4) var(--space-4);
  }
}

.cc-question-phase-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: var(--space-2);
}

.cc-question-text {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--color-text);
  margin-bottom: var(--space-4);
  line-height: 1.3;
}

/* ── Hint ── */
.cc-hint {
  background: var(--color-primary-subtle);
  border: 1px solid color-mix(in oklch, var(--color-primary) 20%, transparent);
  border-radius: var(--radius-lg);
  padding: var(--space-3) var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.65;
  margin-bottom: var(--space-4);
}

.cc-hint p {
  margin: 0 0 var(--space-2);
}

.cc-hint p:last-child {
  margin: 0;
}

.cc-hint ul {
  margin: var(--space-2) 0 0 var(--space-4);
  padding: 0;
}

.cc-hint ul li {
  margin-bottom: var(--space-1);
  line-height: 1.5;
}

.cc-hint-block {
  font-size: var(--text-xs);
  line-height: 1.65;
}

.cc-hint-block p {
  margin: 0 0 var(--space-2);
}

.cc-hint-block ul {
  margin: var(--space-2) 0 var(--space-3) var(--space-4);
  padding: 0;
}

.cc-hint-block ul li {
  margin-bottom: var(--space-1);
}

.cc-critical-note {
  margin-top: var(--space-3);
  padding: var(--space-3) var(--space-3);
  background: var(--color-error-highlight);
  border: 1px solid color-mix(in oklch, var(--color-error) 30%, transparent);
  border-radius: var(--radius-md);
  color: var(--color-error);
  font-weight: 500;
  line-height: 1.5;
}

/* ── Source Citation ── */
.cc-source {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
  margin-bottom: var(--space-4);
}

.cc-source a,
.cc-ref {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.cc-source a:hover,
.cc-ref:hover {
  text-decoration: underline;
}

/* ── Options ── */
.cc-options {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.cc-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: all var(--transition-interactive);
  background: var(--color-surface);
  user-select: none;
}

.cc-option:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}

.cc-option.selected {
  border-color: var(--color-primary);
  background: var(--color-primary-highlight);
}

.cc-option-input {
  display: flex;
  align-items: center;
  padding-top: 2px;
  flex-shrink: 0;
}

.cc-option-input input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

.cc-option-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 0;
}

.cc-option-label {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.cc-option-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.cc-option.selected .cc-option-label {
  color: var(--color-primary);
}

/* ── Validation ── */
.cc-validation-msg {
  font-size: var(--text-xs);
  color: var(--color-error);
  margin-bottom: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--color-error-highlight);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklch, var(--color-error) 20%, transparent);
}

/* ── Navigation Actions ── */
.cc-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

/* ── Buttons ── */
.cc-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-interactive);
  border: 1px solid transparent;
  white-space: nowrap;
}

.cc-btn-primary {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.cc-btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.cc-btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}

.cc-btn-secondary:hover {
  background: var(--color-surface-offset);
  border-color: var(--color-text-muted);
}

/* ── Result Wrapper ── */
.cc-result-wrapper {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* ── Result Header ── */
.cc-result-header {
  border-radius: var(--radius-xl);
  padding: var(--space-6) var(--space-8);
  border: 1px solid;
}

.cc-result-header-general {
  background: var(--color-primary-subtle);
  border-color: color-mix(in oklch, var(--color-primary) 20%, transparent);
}

.cc-result-header-highrisk {
  background: var(--color-warning-highlight);
  border-color: color-mix(in oklch, var(--color-warning) 30%, transparent);
}

.cc-result-header-prohibited {
  background: var(--color-error-highlight);
  border-color: color-mix(in oklch, var(--color-error) 30%, transparent);
}

.cc-result-header-gpai {
  background: var(--color-tier-gpai-bg);
  border-color: color-mix(in oklch, var(--color-tier-gpai) 30%, transparent);
}

.cc-result-header-outofscope {
  background: var(--color-surface-offset);
  border-color: var(--color-border);
}

@media (max-width: 600px) {
  .cc-result-header {
    padding: var(--space-4) var(--space-4);
  }
}

.cc-result-icon {
  font-size: 2rem;
  margin-bottom: var(--space-2);
}

.cc-result-title {
  font-family: var(--font-serif);
  font-size: var(--text-lg);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--space-4);
}

.cc-result-summary-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
  align-items: flex-start;
}

.cc-result-summary-block {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.cc-result-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.cc-status-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.cc-status-pill {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
}

.cc-risk-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 600;
  white-space: nowrap;
}

.cc-risk-general { background: var(--color-tier-general-bg); color: var(--color-tier-general); }
.cc-risk-high-risk { background: var(--color-tier-high-risk-bg); color: var(--color-tier-high-risk); }
.cc-risk-prohibited { background: var(--color-tier-prohibited-bg); color: var(--color-tier-prohibited); }
.cc-risk-gpai { background: var(--color-tier-gpai-bg); color: var(--color-tier-gpai); }
.cc-risk-limited { background: var(--color-tier-limited-risk-bg); color: var(--color-tier-limited-risk); }

.cc-result-count {
  font-size: var(--text-xl);
  font-family: var(--font-serif);
  font-weight: 500;
  color: var(--color-primary);
}

/* ── Obligation Groups ── */
.cc-result-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.cc-obligation-group {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border-left-width: 3px;
}

.cc-type-universal { border-left-color: var(--color-primary); }
.cc-type-high_risk { border-left-color: var(--color-tier-high-risk); }
.cc-type-gpai { border-left-color: var(--color-tier-gpai); }
.cc-type-gpai_systemic { border-left-color: #7c3aed; }
.cc-type-transparency { border-left-color: var(--color-warning); }
.cc-type-auth_rep { border-left-color: var(--color-actor-authrep); }
.cc-type-warning { border-left-color: var(--color-error); }
.cc-type-prohibited { border-left-color: var(--color-tier-prohibited); background: var(--color-error-highlight); }
.cc-type-excluded { border-left-color: var(--color-text-faint); }
.cc-type-general { border-left-color: var(--color-text-faint); }

.cc-group-header {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-divider);
}

.cc-group-icon {
  font-size: 1.25rem;
  line-height: 1;
  flex-shrink: 0;
  padding-top: 2px;
}

.cc-group-header-text {
  flex: 1;
  min-width: 0;
}

.cc-group-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
  line-height: 1.3;
}

.cc-group-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
}

.cc-group-desc a,
.cc-group-title a {
  color: var(--color-primary);
  text-decoration: none;
}

.cc-group-desc a:hover,
.cc-group-title a:hover {
  text-decoration: underline;
}

/* ── Obligations List ── */
.cc-obligations-list {
  padding: var(--space-3) var(--space-5);
}

.cc-obligation {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-divider);
}

.cc-obligation:last-child {
  border-bottom: none;
}

.cc-obligation-num {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.cc-obligation-body {
  flex: 1;
  min-width: 0;
}

.cc-obligation-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
  line-height: 1.3;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.cc-actor-tag {
  display: inline-flex;
  padding: 2px var(--space-2);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.cc-obligation-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-2);
}

.cc-obligation-desc a {
  color: var(--color-primary);
  text-decoration: none;
}

.cc-obligation-desc a:hover {
  text-decoration: underline;
}

.cc-obligation-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
}

.cc-obligation-basis {
  font-size: var(--text-xs);
  color: var(--color-text-faint);
}

.cc-obligation-basis a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.cc-obligation-basis a:hover {
  text-decoration: underline;
}

.cc-obligation-deadline {
  font-size: var(--text-xs);
  color: var(--color-warning);
  font-weight: 500;
}

.cc-no-obligations {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  padding: var(--space-4) var(--space-5);
}

/* ── Exception Note ── */
.cc-exception-note {
  display: block;
  font-size: var(--text-xs);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-top: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--color-success-highlight);
  border-radius: var(--radius-md);
  border: 1px solid color-mix(in oklch, var(--color-success) 20%, transparent);
  line-height: 1.5;
}

.cc-exception-note a {
  color: var(--color-success);
}

/* ── Result Actions ── */
.cc-result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: flex-end;
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-divider);
}

/* ── Home page compliance banner ── */
.cc-home-banner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-5) var(--space-6);
  background: linear-gradient(135deg, var(--color-primary-subtle) 0%, var(--color-surface-2) 100%);
  border: 1.5px solid color-mix(in oklch, var(--color-primary) 25%, transparent);
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-6);
  cursor: pointer;
  transition: all var(--transition-interactive);
  text-decoration: none;
  color: inherit;
}

.cc-home-banner:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.cc-home-banner-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: var(--radius-lg);
  background: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.cc-home-banner-body {
  flex: 1;
  min-width: 0;
}

.cc-home-banner-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.cc-home-banner-desc {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.5;
}

.cc-home-banner-arrow {
  color: var(--color-primary);
  flex-shrink: 0;
}

/* ── Topbar Compliance link ── */
.topbar-checker-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.topbar-checker-btn:hover {
  background: var(--color-primary-hover);
}

@media (max-width: 640px) {
  .topbar-checker-btn span {
    display: none;
  }
  .topbar-checker-btn {
    padding: var(--space-1) var(--space-2);
  }
}

/* ── Your Answers Summary ── */
.cc-answers-section {
  margin-top: var(--space-6);
}

.cc-answers-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast);
}

.cc-answers-header:hover {
  background: var(--color-surface-hover);
}

.cc-answers-header-icon {
  font-size: var(--text-base);
}

.cc-answers-header h3 {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

.cc-answers-toggle {
  color: var(--color-text-muted);
  transition: transform 0.2s ease;
}

.cc-answers-toggle.collapsed {
  transform: rotate(-90deg);
}

.cc-answers-body {
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow: hidden;
}

.cc-answers-body.collapsed {
  display: none;
}

.cc-answer-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--transition-fast);
}

.cc-answer-card:last-child {
  border-bottom: none;
}

.cc-answer-card:hover {
  background: var(--color-surface-hover);
}

.cc-answer-step {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-size: var(--text-xs);
  font-weight: 700;
  font-family: var(--font-mono, monospace);
}

.cc-answer-body {
  flex: 1;
  min-width: 0;
}

.cc-answer-question {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
  line-height: 1.4;
}

.cc-answer-values {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

.cc-answer-tag {
  display: inline-block;
  padding: 2px var(--space-2);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--color-text-muted);
  line-height: 1.5;
}

.cc-answer-edit {
  flex-shrink: 0;
  align-self: center;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-2);
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 11px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  opacity: 0;
}

.cc-answer-card:hover .cc-answer-edit {
  opacity: 1;
}

.cc-answer-edit:hover {
  background: var(--color-surface-raised);
  color: var(--color-primary);
  border-color: var(--color-primary);
}

/* ── Permalink bar ── */
.cc-permalink-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-raised);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  margin-top: var(--space-4);
}

.cc-permalink-bar label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  white-space: nowrap;
}

.cc-permalink-input {
  flex: 1;
  padding: var(--space-2) var(--space-3);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-family: var(--font-mono, monospace);
  color: var(--color-text);
  min-width: 0;
}

.cc-permalink-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.cc-copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  font-size: var(--text-xs);
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition-fast);
  white-space: nowrap;
}

.cc-copy-btn:hover {
  background: var(--color-primary-hover);
}

.cc-copy-btn.copied {
  background: var(--color-success, #16a34a);
}

/* ── Restored-from-link banner ── */
.cc-restored-banner {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: oklch(0.95 0.03 250);
  border: 1px solid oklch(0.85 0.05 250);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-primary);
}

.cc-restored-banner svg {
  flex-shrink: 0;
}

/* ── Print styles ── */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt !important;
  }
  .cc-actions,
  .cc-result-actions,
  .cc-permalink-bar,
  .cc-answer-edit,
  .cc-restored-banner,
  .cc-disclaimer,
  .topbar,
  .sidebar,
  .sidebar-backdrop {
    display: none !important;
  }
  .app-body {
    grid-template-columns: 1fr !important;
    display: block !important;
  }
  #content {
    overflow: visible !important;
    height: auto !important;
  }
  #contentInner {
    padding: 0 !important;
  }
  .cc-wrapper {
    padding: 0 !important;
    max-width: 100% !important;
  }
  .cc-result-wrapper {
    max-width: 100% !important;
  }
  .cc-result-header {
    break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .cc-obligation-group {
    break-inside: avoid;
    page-break-inside: avoid;
    border: 1px solid #ccc !important;
    margin-bottom: 8pt !important;
  }
  .cc-obligation {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .cc-group-header {
    break-after: avoid;
  }
  .cc-obligations-list {
    break-before: avoid;
  }
  .cc-ref {
    color: black !important;
    text-decoration: underline !important;
  }
  .cc-status-pill,
  .cc-risk-badge,
  .cc-answer-tag {
    border: 1px solid #999 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .cc-answers-body.collapsed {
    display: block !important;
  }
  .cc-answers-toggle {
    display: none !important;
  }
  /* Ensure all text visible */
  * {
    overflow: visible !important;
  }
  /* Annex meta panel print styles */
  .annex-meta-panel {
    border: 1px solid #ccc !important;
    break-inside: avoid;
    page-break-inside: avoid;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .annex-meta-tag,
  .annex-meta-category,
  .badge-phase {
    border: 1px solid #999 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .annex-meta-refs a {
    color: black !important;
    text-decoration: underline !important;
  }
  .annex-meta-value a {
    color: black !important;
    text-decoration: underline !important;
  }
}

/* ════════════════════════════════════════════════════════════════
   DEEP LINK HIGHLIGHT ANIMATION
   ════════════════════════════════════════════════════════════════ */

@keyframes deep-link-highlight {
  0%   { background: color-mix(in oklch, var(--color-primary) 20%, transparent); }
  100% { background: transparent; }
}

.deep-link-highlight {
  animation: deep-link-highlight 2s ease-out forwards;
  border-radius: var(--radius-sm);
}

/* ════════════════════════════════════════════════════════════════
   TOPBAR MATRIX BUTTON
   ════════════════════════════════════════════════════════════════ */

.topbar-matrix-btn {
  background: var(--color-tier-gpai);
}

.topbar-matrix-btn:hover {
  background: color-mix(in oklch, var(--color-tier-gpai) 85%, black);
}

/* ════════════════════════════════════════════════════════════════
   OBLIGATION MATRIX — CC-OM-LINK (in Compliance Checker results)
   ════════════════════════════════════════════════════════════════ */

.cc-om-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-tier-gpai);
  background: color-mix(in oklch, var(--color-tier-gpai) 8%, transparent);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.cc-om-link:hover {
  background: color-mix(in oklch, var(--color-tier-gpai) 16%, transparent);
  color: color-mix(in oklch, var(--color-tier-gpai) 85%, black);
}

.cc-om-link svg {
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════════════
   OBLIGATION MATRIX PAGE
   ════════════════════════════════════════════════════════════════ */

.om-wrapper {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6);
}

.om-header {
  margin-bottom: var(--space-8);
}

.om-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-3);
  line-height: 1.2;
}

.om-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
  max-width: 65ch;
}

/* ── Filter Bar ── */

.om-filter-bar {
  display: flex;
  align-items: flex-end;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  background: var(--color-surface-offset);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.om-filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  flex: 1;
  min-width: 160px;
}

.om-filter-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.om-filter-select {
  appearance: none;
  -webkit-appearance: none;
  padding: var(--space-2) var(--space-3);
  padding-right: var(--space-8);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  transition: border-color var(--transition-fast);
}

.om-filter-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px color-mix(in oklch, var(--color-primary) 20%, transparent);
}

.om-filter-reset {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.om-filter-reset:hover {
  background: var(--color-surface-offset);
  color: var(--color-text);
  border-color: var(--color-text-muted);
}

/* ── Scenario Count ── */

.om-scenario-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  font-weight: 500;
}

/* ── Scenario Cards ── */

.om-scenarios {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-10);
}

.om-scenario-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  overflow: hidden;
  transition: border-color var(--transition-fast);
}

.om-scenario-card:hover {
  border-color: color-mix(in oklch, var(--color-primary) 30%, var(--color-border));
}

.om-scenario-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-4) var(--space-5);
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  gap: var(--space-4);
  transition: background var(--transition-fast);
}

.om-scenario-header:hover {
  background: var(--color-surface-offset);
}

.om-scenario-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
  flex: 1;
}

.om-scenario-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}

.om-scenario-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.om-modifier-badge {
  display: inline-flex;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted);
  background: var(--color-surface-offset);
  border: 1px solid var(--color-border);
}

.om-scenario-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.om-ob-count {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.om-scenario-header .chevron {
  color: var(--color-text-muted);
  transition: transform var(--transition-fast);
  flex-shrink: 0;
}

.om-scenario-header.open .chevron {
  transform: rotate(180deg);
}

/* ── Scenario Body ── */

.om-scenario-body {
  padding: 0 var(--space-5) var(--space-5);
  border-top: 1px solid var(--color-border);
}

.om-scenario-desc {
  font-size: var(--text-sm);
  color: var(--color-text);
  line-height: 1.65;
  margin-top: var(--space-4);
  margin-bottom: var(--space-3);
}

.om-scenario-conditions {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface-offset);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--color-border);
}

.om-scenario-conditions strong {
  font-weight: 600;
  color: var(--color-text);
}

/* ── Obligations Table ── */

.om-obligations-table {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.om-obligations-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-xs);
}

.om-obligations-table thead {
  background: var(--color-surface-offset);
}

.om-obligations-table th {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}

.om-obligations-table td {
  padding: var(--space-3);
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
  color: var(--color-text);
  line-height: 1.5;
}

.om-obligations-table tr:last-child td {
  border-bottom: none;
}

.om-obligations-table tr:hover td {
  background: color-mix(in oklch, var(--color-primary) 3%, transparent);
}

.om-ob-id {
  font-family: var(--font-mono, 'SF Mono', 'Cascadia Mono', monospace);
  font-size: 11px;
  color: var(--color-text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.om-ob-title {
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.om-ob-desc {
  color: var(--color-text-muted);
  font-size: 12px;
  line-height: 1.5;
}

.om-guidance-note {
  display: flex;
  align-items: flex-start;
  gap: var(--space-1);
  margin-top: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: color-mix(in oklch, var(--color-warning) 8%, transparent);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: var(--color-warning);
  line-height: 1.4;
}

.om-guidance-note svg {
  flex-shrink: 0;
  margin-top: 1px;
}

.om-ob-basis {
  font-size: 12px;
  white-space: nowrap;
}

.om-ob-basis .cross-ref {
  font-size: inherit;
}

.om-ob-deadline {
  font-size: 12px;
  white-space: nowrap;
  color: var(--color-text-muted);
}

.om-ob-type {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 500;
  background: var(--color-surface-offset);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  white-space: nowrap;
}

.om-no-results {
  padding: var(--space-8) var(--space-4);
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.om-no-obligations {
  color: var(--color-text-muted);
  font-size: var(--text-xs);
  font-style: italic;
}

/* ── Timeline Section ── */

.om-timeline-section {
  margin-bottom: var(--space-10);
}

.om-section-title {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-5);
}

.om-timeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  position: relative;
  padding-left: var(--space-6);
}

.om-timeline::before {
  content: '';
  position: absolute;
  left: 5px;
  top: var(--space-3);
  bottom: var(--space-3);
  width: 2px;
  background: var(--color-border);
  border-radius: 1px;
}

.om-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  position: relative;
}

.om-timeline-item::before {
  content: '';
  position: absolute;
  left: calc(-1 * var(--space-6) + 2px);
  top: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--phase-color, var(--color-primary));
  border: 2px solid var(--color-surface);
  box-shadow: 0 0 0 2px var(--phase-color, var(--color-primary));
}

.om-timeline-marker {
  flex-shrink: 0;
}

.om-timeline-content {
  flex: 1;
}

.om-timeline-date {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: var(--space-1);
}

.om-timeline-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  line-height: 1.6;
}

/* ── Footer ── */

.om-footer {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-6);
}

.om-disclaimer {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  line-height: 1.6;
  margin-bottom: var(--space-2);
}

.om-copyright {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
}

/* ── Responsive ── */

@media (max-width: 768px) {
  .om-wrapper {
    padding: var(--space-5) var(--space-4);
  }

  .om-filter-bar {
    flex-direction: column;
    gap: var(--space-3);
  }

  .om-filter-group {
    min-width: 100%;
  }

  .om-scenario-header {
    padding: var(--space-3) var(--space-4);
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .om-scenario-header-right {
    width: 100%;
    justify-content: space-between;
  }

  .om-scenario-body {
    padding: 0 var(--space-4) var(--space-4);
  }

  .om-obligations-table {
    font-size: 11px;
  }

  .om-obligations-table th,
  .om-obligations-table td {
    padding: var(--space-2);
  }

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

/* ── OM Home Banner accent ── */

.om-home-banner .cc-home-banner-title {
  color: var(--color-tier-gpai);
}
