/* ===============================================================
   VGOS Programme Docs Portal
   Dark editorial • Hydra Teal accent • Instrument Serif + Inter
   =============================================================== */

:root {
  /* Palette (dark mode primary) */
  --bg: #0A0A0A;
  --bg-1: #111110;
  --bg-2: #16161510;
  --panel: #131312;
  --panel-2: #1A1A18;
  --line: #26251F;
  --line-2: #33322B;
  --text: #E8E6DF;
  --text-2: #A8A69C;
  --text-3: #6E6C63;
  --text-4: #4A4842;
  --accent: #4F98A3;
  --accent-2: #7BC0CA;
  --accent-dim: #4F98A340;
  --gold: #D19900;
  --success: #6DAA45;
  --warn: #BB653B;
  --error: #D163A7;

  /* Type */
  --f-display: "Instrument Serif", Georgia, serif;
  --f-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 160ms;
  --dur: 260ms;
  --dur-slow: 520ms;

  /* Layout */
  --sidebar-w: 280px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 56px;
  --gutter: 32px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt";
  overflow: hidden;
}

::selection { background: var(--accent-dim); color: var(--text); }

.skip {
  position: fixed; top: -100px; left: 8px; z-index: 999;
  background: var(--accent); color: var(--bg); padding: 8px 14px;
  border-radius: 6px; font-weight: 500; font-size: 13px;
  transition: top var(--dur) var(--ease);
}
.skip:focus { top: 8px; }

/* ===============================================================
   Background layers
   =============================================================== */
.bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  overflow: hidden;
}
.grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, #1F1E1A 1px, transparent 1px),
    linear-gradient(to bottom, #1F1E1A 1px, transparent 1px);
  background-size: 64px 64px;
  background-position: center center;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, black 15%, transparent 75%);
  opacity: 0.5;
}
.glow {
  position: absolute; top: -30%; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 900px;
  background: radial-gradient(circle at center, rgba(79,152,163,0.14), transparent 55%);
  filter: blur(60px);
}
.noise {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.9 0 0 0 0 0.9 0 0 0 0 0.85 0 0 0 0.06 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: overlay;
  opacity: 0.5;
}

/* ===============================================================
   Layout
   =============================================================== */
.app {
  position: relative; z-index: 1;
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  transition: grid-template-columns var(--dur) var(--ease);
}
.app.is-collapsed { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ===============================================================
   Sidebar
   =============================================================== */
.sidebar {
  display: flex; flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, rgba(19,19,18,0.85), rgba(10,10,10,0.85));
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.sidebar__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 18px 20px;
  border-bottom: 1px solid var(--line);
  min-height: var(--topbar-h);
}
.brand {
  display: flex; align-items: center; gap: 12px;
  color: var(--text); text-decoration: none;
  overflow: hidden; min-width: 0;
}
.brand__mark {
  width: 26px; height: 26px; color: var(--accent);
  flex: 0 0 auto;
  transition: transform var(--dur) var(--ease);
}
.brand:hover .brand__mark { transform: rotate(45deg); }
.brand__text {
  display: flex; flex-direction: column; line-height: 1.1;
  overflow: hidden; white-space: nowrap;
}
.brand__word {
  font-family: var(--f-mono);
  font-size: 13px; font-weight: 500;
  letter-spacing: 0.14em;
}
.brand__sub {
  font-size: 11px; color: var(--text-3);
  letter-spacing: 0.02em; margin-top: 2px;
}

.collapse {
  background: transparent; border: 1px solid var(--line);
  color: var(--text-2);
  width: 28px; height: 28px; border-radius: 6px;
  display: grid; place-items: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease), transform var(--dur) var(--ease);
  flex: 0 0 auto;
}
.collapse:hover { color: var(--accent); border-color: var(--line-2); }
.app.is-collapsed .collapse svg { transform: rotate(180deg); }

/* Search */
.search {
  position: relative;
  margin: 14px 16px 8px 16px;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-3);
  transition: border-color var(--dur-fast) var(--ease);
}
.search:focus-within { border-color: var(--accent-dim); }
.search svg { flex: 0 0 auto; }
.search input {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: 0;
  color: var(--text); font: inherit;
  font-size: 13px;
}
.search input::placeholder { color: var(--text-3); }
.search kbd {
  font-family: var(--f-mono); font-size: 10px;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-1); color: var(--text-3);
  border: 1px solid var(--line);
}

/* Nav tree */
.nav {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  padding: 8px 8px 16px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

.mod {
  margin-bottom: 2px;
}
.mod__head {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 8px 10px;
  background: transparent;
  border: 0; border-radius: 6px;
  color: var(--text-2);
  font: inherit;
  font-size: 12px;
  font-family: var(--f-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.mod__head:hover { background: var(--panel); color: var(--text); }
.mod__caret {
  width: 10px; height: 10px; flex: 0 0 auto;
  color: var(--text-3);
  transition: transform var(--dur) var(--ease);
}
.mod.is-open .mod__caret { transform: rotate(90deg); color: var(--accent); }
.mod__label { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.mod__badge {
  font-family: var(--f-body); font-size: 10px;
  font-weight: 500; letter-spacing: 0.04em; text-transform: none;
  padding: 2px 6px; border-radius: 10px;
  background: var(--panel); color: var(--text-3);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}
.mod__badge.is-active { background: var(--accent-dim); color: var(--accent-2); border-color: transparent; }
.mod__badge.is-soon { color: var(--text-4); }

.mod__children {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--dur) var(--ease);
}
.mod.is-open .mod__children { grid-template-rows: 1fr; }
.mod__children-inner { overflow: hidden; }
.mod__children ul {
  list-style: none; margin: 4px 0 8px 0;
  padding: 0 0 0 22px;
  border-left: 1px solid var(--line);
  margin-left: 16px;
}
.mod__children li { margin: 1px 0; }

.item {
  display: flex; align-items: center; gap: 8px;
  width: 100%;
  padding: 7px 10px;
  background: transparent;
  border: 0; border-radius: 6px;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
  position: relative;
}
.item:hover { background: var(--panel); color: var(--text); }
.item.is-current {
  background: var(--panel-2); color: var(--text);
}
.item.is-current::before {
  content: ""; position: absolute; left: -22px; top: 50%;
  width: 1px; height: 16px; background: var(--accent);
  transform: translateY(-50%);
}
.item__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item__meta {
  font-family: var(--f-mono);
  font-size: 10px; color: var(--text-3);
  flex: 0 0 auto;
}
.item.is-onhold .item__meta { color: var(--warn); }
.item.is-delivered .item__meta { color: var(--accent-2); }
.item.is-planned { opacity: 0.55; }

.empty-note {
  padding: 6px 10px 10px 10px;
  font-size: 11px; color: var(--text-4);
  font-style: italic;
}

/* Sidebar footer */
.sidebar__foot {
  border-top: 1px solid var(--line);
  padding: 12px 16px;
  font-size: 11px;
  display: flex; flex-direction: column; gap: 6px;
}
.foot-row { display: flex; justify-content: space-between; gap: 8px; }
.foot-label { color: var(--text-3); font-family: var(--f-mono); letter-spacing: 0.06em; text-transform: uppercase; font-size: 10px; }
.foot-val { color: var(--text-2); font-size: 11px; text-align: right; overflow: hidden; text-overflow: ellipsis; }

/* Collapsed sidebar */
.app.is-collapsed .sidebar__head { padding: 18px 12px; }
.app.is-collapsed .brand__text,
.app.is-collapsed .search input,
.app.is-collapsed .search kbd,
.app.is-collapsed .mod__label,
.app.is-collapsed .mod__badge,
.app.is-collapsed .item__label,
.app.is-collapsed .item__meta,
.app.is-collapsed .sidebar__foot,
.app.is-collapsed .empty-note,
.app.is-collapsed .mod__caret,
.app.is-collapsed .mod__children {
  display: none;
}
.app.is-collapsed .search {
  padding: 8px; margin: 14px 12px 8px 12px;
  justify-content: center;
}
.app.is-collapsed .brand { justify-content: center; }
.app.is-collapsed .mod__head {
  justify-content: center;
  padding: 10px 8px;
}
.app.is-collapsed .mod__head::before {
  content: attr(data-tag);
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--text-2);
}
.app.is-collapsed .collapse { margin: 0 auto; }

/* ===============================================================
   Main
   =============================================================== */
.main {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
  overflow: hidden;
}
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 0 var(--gutter);
  min-height: var(--topbar-h);
  border-bottom: 1px solid var(--line);
  background: rgba(10,10,10,0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.menu {
  display: none;
  background: transparent; border: 1px solid var(--line);
  color: var(--text-2);
  width: 32px; height: 32px; border-radius: 6px;
  align-items: center; justify-content: center;
  cursor: pointer;
}
.crumbs {
  display: flex; align-items: center; gap: 8px;
  flex: 1; min-width: 0;
  font-size: 13px; color: var(--text-2);
  overflow: hidden;
}
.crumb {
  display: inline-flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.crumb + .crumb::before {
  content: "/"; color: var(--text-4);
  padding: 0 4px;
  font-family: var(--f-mono);
}
.crumb.is-current { color: var(--text); }

.topbar__right { display: flex; align-items: center; gap: 12px; }
.status {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-2);
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* Document area */
.doc {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 56px var(--gutter) 96px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
  outline: none;
}
.doc::-webkit-scrollbar { width: 10px; }
.doc::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; }

.doc-wrap { max-width: 820px; margin: 0 auto; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 12px;
  font-family: var(--f-mono);
  font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 20px;
}
.eyebrow__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(79,152,163,0.15);
}

.doc h1 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: clamp(40px, 6vw, 68px);
  line-height: 1.05; letter-spacing: -0.02em;
  margin: 0 0 20px 0;
  color: var(--text);
}
.doc h1 em { color: var(--accent-2); font-style: italic; }
.doc .lead {
  font-size: 18px; line-height: 1.6;
  color: var(--text-2);
  margin: 0 0 40px 0;
  max-width: 640px;
}

.doc h2 {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 32px; line-height: 1.2;
  margin: 56px 0 16px 0;
  color: var(--text);
}
.doc h3 {
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 36px 0 12px 0;
}
.doc p { margin: 0 0 16px 0; color: var(--text); }
.doc a { color: var(--accent-2); text-decoration: none; border-bottom: 1px solid var(--accent-dim); }
.doc a:hover { border-bottom-color: var(--accent-2); }
.doc code {
  font-family: var(--f-mono); font-size: 0.88em;
  background: var(--panel); padding: 2px 6px; border-radius: 4px;
  color: var(--accent-2);
  border: 1px solid var(--line);
}
.doc ul { padding-left: 22px; margin: 0 0 24px 0; }
.doc li { margin: 6px 0; color: var(--text); }
.doc li::marker { color: var(--text-4); }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  margin: 32px 0;
}
.card {
  padding: 20px 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color var(--dur-fast) var(--ease), transform var(--dur) var(--ease);
  text-decoration: none;
  color: inherit;
  display: flex; flex-direction: column; gap: 8px;
}
.card:hover { border-color: var(--line-2); transform: translateY(-1px); }
.card__label {
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3);
}
.card__title {
  font-family: var(--f-display);
  font-size: 24px; line-height: 1.15;
  color: var(--text);
}
.card__meta {
  font-size: 12px; color: var(--text-3);
  margin-top: auto;
}
.card__meta strong { color: var(--accent-2); font-weight: 500; }

/* KPI row */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  margin: 32px 0;
}
.kpi {
  padding: 20px 22px;
  background: var(--panel);
  display: flex; flex-direction: column; gap: 4px;
}
.kpi__num {
  font-family: var(--f-display);
  font-size: 40px; line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.kpi__label {
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-3);
  margin-top: 4px;
}

/* Coming-soon placeholder for empty modules */
.placeholder {
  padding: 80px 40px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  background: linear-gradient(180deg, rgba(19,19,18,0.4), transparent);
}
.placeholder__mark {
  width: 48px; height: 48px; margin: 0 auto 20px auto;
  color: var(--text-4);
}
.placeholder p { color: var(--text-3); }

/* Home hero */
.hero {
  margin-bottom: 56px;
}

/* Table */
.table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 32px 0;
  font-size: 13px;
}
.table th, .table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.table th {
  font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-3);
  font-weight: 500;
}
.table td { color: var(--text-2); }
.table td strong { color: var(--text); font-weight: 500; }

.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--text-2);
}
.pill.is-open { color: var(--warn); border-color: var(--warn); }
.pill.is-closed { color: var(--success); border-color: var(--success); }
.pill.is-live { color: var(--accent-2); border-color: var(--accent); }
.pill.is-delivered { color: var(--accent-2); border-color: var(--accent); background: var(--accent-dim); }
.pill.is-onhold { color: var(--warn); border-color: var(--warn); }
.pill.is-planned { color: var(--text-3); }
.pill.is-soon { color: var(--text-4); border-style: dashed; }

/* ===============================================================
   Responsive
   =============================================================== */
@media (max-width: 900px) {
  :root { --gutter: 24px; }
  .doc { padding: 40px var(--gutter) 80px; }
  .doc h1 { font-size: clamp(36px, 8vw, 52px); }
}

@media (max-width: 720px) {
  .app {
    grid-template-columns: 1fr;
  }
  .app.is-collapsed { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 300px; max-width: 88vw; z-index: 20;
    transform: translateX(-100%);
    transition: transform var(--dur) var(--ease);
    border-right: 1px solid var(--line);
  }
  .app.is-menu-open .sidebar {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0,0,0,0.6);
  }
  .app.is-menu-open::after {
    content: "";
    position: fixed; inset: 0; z-index: 10;
    background: rgba(0,0,0,0.5);
  }
  .menu { display: inline-flex; }
  .collapse { display: none; }
  .app.is-collapsed .sidebar__head,
  .app.is-collapsed .brand__text,
  .app.is-collapsed .search input,
  .app.is-collapsed .search kbd,
  .app.is-collapsed .mod__label,
  .app.is-collapsed .mod__badge,
  .app.is-collapsed .item__label,
  .app.is-collapsed .item__meta,
  .app.is-collapsed .sidebar__foot,
  .app.is-collapsed .mod__children,
  .app.is-collapsed .mod__caret { display: initial; }
  .app.is-collapsed .mod__head { justify-content: flex-start; }
  .app.is-collapsed .mod__head::before { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ===============================================================
   BRD render — downloads, PDF viewer, anchors, register cards
   =============================================================== */

/* Downloads band */
.dl {
  display: flex; flex-wrap: wrap; gap: 20px 28px;
  align-items: center; justify-content: space-between;
  padding: 22px 24px; margin: 8px 0 32px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line-2); border-radius: 10px;
}
.dl__title { font-family: var(--f-display); font-size: 22px; margin: 0 0 4px; color: var(--text); }
.dl__meta { margin: 0; font-size: 12.5px; color: var(--text-3); }
.dl__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 8px;
  border: 1px solid var(--line-2); background: var(--bg-1);
  color: var(--text) !important; font-size: 13.5px; font-weight: 500;
  text-decoration: none; transition: all var(--dur-fast) var(--ease);
  border-bottom: 1px solid var(--line-2) !important;
}
.btn:hover { border-color: var(--accent) !important; color: var(--accent-2) !important; transform: translateY(-1px); }
.btn--primary { background: var(--accent); border-color: var(--accent) !important; color: #06201f !important; }
.btn--primary:hover { background: var(--accent-2); color: #06201f !important; }
.btn--ghost { background: transparent; color: var(--text-2) !important; }
.btn__size { font-family: var(--f-mono); font-size: 10.5px; opacity: .75; }

/* Meta band */
.metaband {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden; margin: 24px 0 32px;
}
.metaband > div { background: var(--panel); padding: 14px 16px; }
.metaband span {
  display: block; font-family: var(--f-mono); font-size: 9.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); margin-bottom: 5px;
}
.metaband strong { font-weight: 500; font-size: 13px; color: var(--text-2); }

/* PDF viewer */
.pdfwrap { margin: 32px 0 40px; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--panel); }
.pdfwrap__bar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel-2);
}
.pdfwrap__label { font-family: var(--f-mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.pdfwrap__open { font-size: 12px; }
.pdfframe { display: block; width: 100%; height: 800px; border: 0; background: #1b1b1a; }
.pdfwrap__fallback { margin: 0; padding: 10px 14px; font-size: 12px; color: var(--text-3); border-top: 1px solid var(--line); }

/* Flags */
.flag {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .06em;
  text-transform: uppercase; white-space: nowrap;
  border: 1px solid var(--gold); color: var(--gold); background: #d1990015;
}
.flag.is-assume { border-color: var(--warn); color: #d98a5e; background: #bb653b15; }

/* Anchors */
.anchor {
  margin-left: 8px; font-family: var(--f-mono); font-size: 12px;
  color: var(--text-4) !important; border-bottom: 0 !important;
  opacity: 0; transition: opacity var(--dur-fast) var(--ease);
  text-decoration: none;
}
.brd-h:hover .anchor, tr:hover .anchor, .rcard:hover .anchor, .anchor:focus { opacity: 1; }
.anchor:hover { color: var(--accent-2) !important; }
.anchor-alias { display: block; height: 0; scroll-margin-top: 80px; }

/* Table of contents */
.toc { margin: 24px 0 32px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.toc__sum {
  cursor: pointer; padding: 12px 16px; list-style: none;
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
}
.toc__sum::-webkit-details-marker { display: none; }
.toc__list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 2px 20px; padding: 4px 16px 16px; }
.toc__link { font-size: 13px; padding: 3px 0; border-bottom: 0 !important; color: var(--text-2) !important; }
.toc__link:hover { color: var(--accent-2) !important; }
.toc__link.lvl-3 { padding-left: 14px; font-size: 12.5px; color: var(--text-3) !important; }

/* BRD body */
.brdbody { margin-top: 8px; }
.brdbody h2.brd-h {
  font-family: var(--f-display); font-size: 30px; font-weight: 400;
  margin: 56px 0 14px; padding-top: 22px; border-top: 1px solid var(--line);
  color: var(--text); scroll-margin-top: 80px;
}
.brdbody h3.brd-h { font-size: 19px; font-weight: 600; margin: 36px 0 10px; color: var(--text); scroll-margin-top: 80px; }
.brdbody h4.brd-h { font-size: 14px; font-weight: 600; margin: 26px 0 8px; color: var(--accent-2); scroll-margin-top: 80px; }
.brdbody p { color: var(--text-2); font-size: 14.5px; }
.brdbody ul, .brdbody ol { color: var(--text-2); font-size: 14.5px; padding-left: 20px; }
.brdbody li { margin: 6px 0; }
.brd-table tbody tr:nth-child(odd) { background: #ffffff05; }
.brd-table tbody tr:hover { background: var(--accent-dim); }
.brd-table th { background: var(--panel-2); border-bottom: 1px solid var(--line-2); color: var(--text-2); }
.brd-table td { border-bottom: 1px solid var(--line); }
.brd-table td.rid { white-space: nowrap; width: 1%; }
.rid__id { font-family: var(--f-mono); font-size: 11.5px; color: var(--accent-2); font-weight: 500; }
.req-row { scroll-margin-top: 80px; }
tr.is-target, .rcard.is-target {
  animation: flash 2.4s var(--ease);
  outline: 1px solid var(--accent); outline-offset: 0;
}
@keyframes flash { 0% { background: var(--accent-dim); } 100% { background: transparent; } }
.hint { font-size: 12.5px; color: var(--text-3); }
.mono { font-family: var(--f-mono); }
.rule { border-top: 1px solid var(--line); padding-top: 24px; }

/* Register cards */
.rcards { display: grid; gap: 14px; margin: 24px 0 40px; }
.rcard {
  border: 1px solid var(--line); border-left: 2px solid var(--line-2);
  border-radius: 8px; background: var(--panel); padding: 16px 18px;
  scroll-margin-top: 80px; transition: border-color var(--dur-fast) var(--ease);
}
.rcard:hover { border-color: var(--line-2); border-left-color: var(--accent); }
.rcard.is-contra { border-left-color: var(--warn); }
.rcard.is-decision { border-left-color: var(--success); }
.rcard.is-decision.is-unknown { border-left-color: var(--gold); }
.rcard.is-int { border-left-color: var(--accent); }
.rcard.is-risk.sev-high { border-left-color: var(--error); }
.rcard__head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.rcard__id { font-family: var(--f-mono); font-size: 12px; color: var(--accent-2); font-weight: 500; }
.rcard__date { font-family: var(--f-mono); font-size: 11px; color: var(--text-3); }
.rcard__title { font-size: 15.5px; font-weight: 500; margin: 0 0 8px; color: var(--text); line-height: 1.45; }
.rcard__body { font-size: 14px; color: var(--text-2); margin: 0 0 10px; }
.rcard__grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 24px; margin: 10px 0 0; }
.rcard__grid dt {
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3); margin-bottom: 3px;
}
.rcard__grid dd { margin: 0; font-size: 13.5px; color: var(--text-2); }
.xref { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 12px; color: var(--text-3); }
.xref__label { margin-right: 8px; }
.xref__chip {
  display: inline-block; margin: 3px 4px 0 0; padding: 2px 9px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font-family: var(--f-mono); font-size: 11px;
  color: var(--accent-2) !important; border-bottom: 1px solid var(--line-2) !important;
}
.xref__chip:hover { border-color: var(--accent) !important; background: var(--accent-dim); }

@media (max-width: 860px) {
  .dl { flex-direction: column; align-items: flex-start; }
  .dl__actions { width: 100%; }
  .btn { flex: 1 1 100%; justify-content: center; }
  .pdfframe { height: 480px; }
  .brdbody h2.brd-h { font-size: 24px; }
  .brd-table, .brdbody table { display: block; overflow-x: auto; }
  .anchor { opacity: 1; }
}
.brdbody figure { margin: 24px 0; }
.brdbody img { max-width: 100%; height: auto; display: block; border: 1px solid var(--line-2); border-radius: 8px; background: #fbfbf9; padding: 8px; }
.brdbody figcaption { font-size: 12px; color: var(--text-3); margin-top: 8px; }
.rcard__title { text-transform: none; letter-spacing: 0; font-family: var(--f-body); }
.brdbody h3.brd-h, .brdbody h4.brd-h { text-transform: none; letter-spacing: 0; }
.brdbody h3.brd-h { color: var(--text); }
.doc .rcard__title { text-transform: none; letter-spacing: 0; font-family: var(--f-body); font-size: 15.5px; font-weight: 500; color: var(--text); margin: 0 0 8px; }
.doc .brdbody h3.brd-h { text-transform: none; letter-spacing: 0; color: var(--text); font-size: 19px; }
.doc .brdbody h4.brd-h { text-transform: none; letter-spacing: 0; }

/* PDF.js canvas viewer */
.pdfjs {
  height: 800px; overflow-y: auto; overscroll-behavior: contain;
  background: #100f0e; padding: 16px 12px; scroll-behavior: smooth;
}
.pdfjs__status { color: var(--text-3); font-size: 13px; text-align: center; padding: 32px 0; }
.pdfpage { display: flex; flex-direction: column; align-items: center; margin: 0 auto 18px; }
.pdfpage canvas { display: block; border: 1px solid var(--line-2); border-radius: 4px; background: #fff; box-shadow: 0 6px 22px #0008; }
.pdfpage__no {
  order: 2; margin-top: 6px; font-family: var(--f-mono); font-size: 9.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--text-4);
}
@media (max-width: 860px) { .pdfjs { height: 520px; } }
