
:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface2: #243044;
  --text: #e8eef4;
  --muted: #8b9cb3;
  --accent: #3d8bfd;
  --accent2: #22c55e;
  --border: #2d3a4f;
  --card: #151d28;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}
html[data-theme="light"] {
  --bg: #eef1f7;
  --surface: #ffffff;
  --surface2: #e4e9f2;
  --text: #15202b;
  --muted: #5a6978;
  --border: #c5d0df;
  --card: #f8fafc;
}
* { box-sizing: border-box; }
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 200;
  padding: 0.45rem 0.9rem;
  background: var(--accent);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}
.skip-link:focus {
  left: 0.75rem;
  outline: none;
}
.menu-toggle {
  display: none;
  position: fixed;
  top: 0.55rem;
  right: 0.75rem;
  z-index: 120;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 98;
}
body.menu-open .sidebar-backdrop { display: block; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
.layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  min-height: 100vh;
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .menu-toggle { display: block; }
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: min(300px, 88vw);
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    overflow-y: auto;
    border-right: 1px solid var(--border);
    border-bottom: none;
    box-shadow: 4px 0 24px rgba(0,0,0,0.25);
  }
  body.menu-open .sidebar { transform: translateX(0); }
  .main { padding-top: 3.5rem; padding-left: 1.25rem; padding-right: 1.25rem; }
}
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1.25rem 1rem 2rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}
.brand-mark {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), #6366f1);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.1rem;
}
.brand-sub { display: block; font-size: 0.75rem; color: var(--muted); }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}
.nav a:hover { background: var(--surface2); }
.nav a.active {
  background: rgba(61, 139, 253, 0.15);
  color: var(--accent);
  font-weight: 600;
}
.nav a:focus-visible,
.menu-toggle:focus-visible,
.theme-toggle:focus-visible,
.skip-link:focus,
.breadcrumbs a:focus-visible,
a.module-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.sidebar-tools {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.sidebar-tools .site-search {
  max-width: none;
  width: 100%;
  margin-bottom: 0.5rem;
}
.site-search-results[hidden] { display: none !important; }
.site-search-results:not([hidden]) {
  display: block;
  max-height: 14rem;
  overflow-y: auto;
  margin-bottom: 0.65rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card);
  font-size: 0.8rem;
}
.site-search-results a {
  display: block;
  padding: 0.45rem 0.65rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.site-search-results a:last-child { border-bottom: none; }
.site-search-results a:hover,
.site-search-results a:focus-visible {
  background: var(--surface2);
  outline: none;
}
.theme-toggle {
  width: 100%;
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.84rem;
}
.sidebar-foot {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2rem;
  line-height: 1.4;
}
.main {
  padding: 2rem 2.5rem 4rem;
  max-width: 1100px;
}
.page-head h1 {
  margin: 0 0 0.5rem;
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.65rem;
  line-height: 1.4;
}
.breadcrumbs a { color: var(--accent); text-decoration: none; }
.breadcrumbs a:hover { text-decoration: underline; }
.bc-sep { margin: 0 0.45rem; color: var(--border); user-select: none; }
.bc-current { color: var(--text); font-weight: 600; }
.lead {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 65ch;
}
.content .block { margin-bottom: 2.5rem; }
.content h2 {
  font-size: 1.15rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 1rem;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}
.module-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, transform 0.15s;
}
.module-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}
.module-card h3 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.module-card .stat { color: var(--accent2); font-weight: 600; }
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}
.data-table th, .data-table td {
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table th {
  background: var(--surface2);
  color: var(--muted);
  font-weight: 600;
}
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.toolbar { margin-bottom: 1.5rem; }
.search-input {
  width: 100%;
  max-width: 420px;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
}
.search-input::placeholder { color: var(--muted); }
.entity-block { margin-bottom: 2.5rem; scroll-margin-top: 1rem; }
.entity-title {
  font-size: 1.35rem;
  margin: 0 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}
.feature-grid {
  display: grid;
  gap: 1rem;
}
.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.feature-title { margin: 0 0 0.5rem; font-size: 1.05rem; font-weight: 600; }
.feature-card .notes {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.55;
}
.spreadsheet-primary {
  font-size: 0.95rem;
  line-height: 1.62;
  color: var(--text);
  margin: 0 0 0.25rem;
}
.spreadsheet-gap .gap-fill-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 0.35rem;
}
.spreadsheet-gap .gap-fill-note {
  font-size: 0.8rem;
  margin: 0.5rem 0 0;
  line-height: 1.45;
}
.analysis-supplement {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-left: 3px solid var(--border);
  background: rgba(255,255,255,0.03);
  font-size: 0.84rem;
  line-height: 1.52;
}
.analysis-supplement-label {
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.35rem;
}
.workbook-authority strong { color: var(--text); }
.feature-desc {
  font-size: 0.92rem;
  line-height: 1.55;
  margin: 0 0 0.55rem;
  color: var(--text);
}
.feature-desc-fallback { color: var(--muted); }
.workbook-notes {
  font-size: 0.85rem;
  margin-top: 0.35rem;
  padding-top: 0.55rem;
  border-top: 1px dashed var(--border);
  color: var(--muted);
}
.notes-label {
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-right: 0.4rem;
}
.module-intro { max-width: 72ch; }
.entity-intro { font-size: 0.9rem; margin: -0.25rem 0 1rem; max-width: 68ch; line-height: 1.5; }
.module-card-teaser { margin: 0 0 0.65rem; font-size: 0.87rem; line-height: 1.42; }
.cat-primary {
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--text);
}
.cat-gap .gap-fill-label { margin-bottom: 0.35rem; }
.cat-gap .gap-fill-note { margin-top: 0.4rem; font-size: 0.8rem; }
.cat-analysis-ref {
  font-size: 0.82rem;
  line-height: 1.45;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
}
.cat-enriched { font-size: 0.87rem; line-height: 1.52; color: var(--text); }
.cat-enriched-fallback { color: var(--muted); }
.cat-workbook { font-size: 0.82rem; line-height: 1.45; margin-top: 0.35rem; }
.notes-stack { display: flex; flex-direction: column; gap: 0.2rem; }
.catalogue-table .notes-cell {
  min-width: 16rem;
  max-width: 42rem;
  white-space: normal;
  color: var(--text);
  font-size: 0.9rem;
}
.callout-secondary {
  border-color: var(--border);
  background: rgba(255,255,255,0.04);
}
.domain-list li { margin-bottom: 0.75rem; }
.callout {
  margin: 0 0 1.75rem;
  padding: 1rem 1.15rem;
  border-radius: var(--radius);
  border: 1px solid var(--accent);
  background: rgba(61, 139, 253, 0.08);
  font-size: 0.95rem;
  line-height: 1.55;
}
.callout strong { color: var(--text); }
.callout a { color: var(--accent); font-weight: 600; }
.muted { color: var(--muted); font-size: 0.9rem; }
code {
  background: var(--surface2);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-size: 0.88em;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); border: 0;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }
.tight-list { font-size: 0.88rem; line-height: 1.45; max-height: 70vh; overflow-y: auto; padding-left: 1.2rem; }
.tight-list li { margin-bottom: 0.35rem; }
.cross-nav { margin-bottom: 1.25rem; }
.pill {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  background: rgba(61, 139, 253, 0.15);
  border: 1px solid var(--accent);
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}
.pill:hover { background: rgba(61, 139, 253, 0.25); }
.card-meta { margin: 0 0 0.5rem; font-size: 0.8rem; }
a.deep-link { color: var(--accent); text-decoration: none; font-weight: 600; }
a.deep-link:hover { text-decoration: underline; }
.md-content {
  font-size: 0.95rem;
  line-height: 1.65;
  max-width: 52rem;
}
.md-content h4 { color: var(--accent); margin: 1.5rem 0 0.5rem; font-size: 1rem; }
.md-content h3 { margin: 2rem 0 0.75rem; font-size: 1.15rem; }
.md-content h2 { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 1.25rem; }
.md-content ul, .md-content ol { padding-left: 1.25rem; }
.md-content li { margin-bottom: 0.35rem; }
.md-content pre {
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
}
.md-content code { background: transparent; padding: 0; }
.md-content pre code { color: #a6c9ff; }
.md-content table { border-collapse: collapse; width: 100%; font-size: 0.85rem; margin: 1rem 0; }
.md-content th, .md-content td { border: 1px solid var(--border); padding: 0.45rem 0.6rem; }
.md-content th { background: var(--surface2); }
.md-content blockquote {
  border-left: 3px solid var(--accent);
  margin: 1rem 0;
  padding-left: 1rem;
  color: var(--muted);
}
.deep-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 200px;
  gap: 2rem;
  align-items: start;
}
.deep-layout .md-main { min-width: 0; }
.page-toc {
  position: sticky;
  top: 1rem;
  font-size: 0.78rem;
  border-left: 1px solid var(--border);
  padding-left: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}
.page-toc .toc-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  color: var(--muted);
}
.page-toc ul { list-style: none; margin: 0; padding: 0; }
.page-toc li { margin-bottom: 0.35rem; line-height: 1.35; }
.page-toc a { color: var(--muted); text-decoration: none; }
.page-toc a:hover { color: var(--accent); }
.page-toc .toc-lvl3 { padding-left: 0.55rem; }
.page-toc .toc-lvl4 { padding-left: 1rem; }
@media (max-width: 960px) {
  .deep-layout { grid-template-columns: 1fr; }
  .page-toc {
    position: static;
    max-height: none;
    border-left: none;
    padding-left: 0;
    padding-top: 1rem;
    margin-top: 1.25rem;
    border-top: 1px solid var(--border);
  }
}
pre.mermaid {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.8rem;
}
.site-foot {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
}
.site-foot p { margin: 0.4rem 0; max-width: 70ch; }
.site-foot code { font-size: 0.88em; }
@media print {
  .menu-toggle,
  .sidebar-backdrop,
  .sidebar-tools .site-search,
  .site-search-results,
  .theme-toggle { display: none !important; }
  .sidebar { display: none; }
  .layout { grid-template-columns: 1fr; }
  .main { max-width: none; padding: 1rem; }
  body { background: #fff; color: #111; }
  .nav, .toolbar, .search-input { display: none !important; }
  .callout { border-color: #999; background: #f5f5f5; }
  .callout a, a.deep-link, .pill { color: #000; text-decoration: underline; }
  .feature-card, .md-content pre, .table-wrap { break-inside: avoid; }
  .data-table { font-size: 0.8rem; }
  .tight-list { max-height: none; overflow: visible; }
}
