/* ============================================================================
   ASON Intelligence Atlas — Phase 2B shared base
   Reset · three separated semantic color systems · accessibility · drawer ·
   legend · search · disclosure · source modes · Markdown reader.
   Brand rule: the wordmark is always the literal characters "ASON".
   ========================================================================= */

:root {
  /* Domain tints — one per canonical cluster, fixed, subject-agnostic */
  --dom-01: #dcd6f2;
  --dom-02: #f2c9cc;
  --dom-03: #cfd8e3;
  --dom-04: #efd3a0;
  --dom-05: #bcd9ce;
  --dom-06: #e4c9e8;
  --dom-07: #c3d7ef;
  --dom-08: #e8c9b8;
  --dom-09: #c9e0b8;
  --dom-10: #e3ddd2;

  /* Gate ramp — reserved for gates only; never domain tint or brand accent */
  --gate-go:      #1c6b3f;
  --gate-caution: #7a5d00;
  --gate-stop:    #7d2436;
  --gate-go-text: #1c6b3f;
  --gate-stop-text: #7d2436;

  --state-ink:   #26232a;
  --state-muted: #5d5966;
  --state-line:  rgba(38, 35, 42, 0.16);
  --state-bg:    rgba(38, 35, 42, 0.05);

  --mo-fast: 120ms;
  --mo-base: 220ms;
  --mo-slow: 300ms;
  --mo-ease: cubic-bezier(0.2, 0, 0, 1);

  --z-nav: 80;
  --z-banner: 85;
  --z-drawer: 200;
  --z-scrim: 190;
  --z-reader: 210;
  --z-skip: 300;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

:focus-visible { outline: 2px solid var(--state-ink); outline-offset: 2px; border-radius: 2px; }

.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: var(--z-skip);
  background: var(--state-ink); color: #fff;
  padding: 12px 18px; min-height: 44px;
  display: inline-flex; align-items: center;
  border-radius: 4px; font-size: 13px; text-decoration: none;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.skip-link:focus-visible { top: 12px; }

@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;
  }
}

/* Evidence-state chip — glyph + literal label; color never load-bearing */
.state-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--state-ink); background: var(--state-bg);
  border: 1px solid var(--state-line); border-radius: 999px;
  padding: 3px 10px 3px 8px; white-space: nowrap;
}
.state-chip .glyph { font-size: 12px; line-height: 1; }
.state-chip[data-state="verified-absence"],
.state-chip[data-state="verified-gap"],
.state-chip[data-state="unknown"],
.state-chip[data-state="inferred"] { font-style: italic; }
.state-chip[data-state="provisional"] { border-style: dashed; }
.state-chip[data-state="restricted"] { border-style: double; border-width: 3px; padding-top: 1px; padding-bottom: 1px; }
.semantic-chip { position: relative; }
.semantic-chip[data-semantic="workflow"] { border-style: dashed; }
.semantic-chip::after {
  content: attr(data-help); position: absolute; z-index: var(--z-skip);
  right: 0; bottom: calc(100% + 8px); width: min(320px, 75vw);
  padding: 10px 12px; color: #fff; background: var(--state-ink);
  border-radius: 6px; font-size: 11px; font-weight: 500; line-height: 1.45;
  white-space: normal; letter-spacing: 0; opacity: 0; pointer-events: none;
  transform: translateY(4px); transition: opacity 150ms var(--mo-ease), transform 150ms var(--mo-ease);
}
.drawer-state .semantic-chip::after { right: auto; left: 0; }
.semantic-chip:hover::after, .semantic-chip:focus-visible::after { opacity: 1; transform: translateY(0); }

/* Gate chip — reserved ramp + mandatory text label */
.gate-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; border-radius: 4px; padding: 3px 8px; color: #fff;
}
.gate-chip[data-gate="go"]      { background: var(--gate-go); }
.gate-chip[data-gate="caution"] { background: var(--gate-caution); }
.gate-chip[data-gate="stop"]    { background: var(--gate-stop); }

/* Internal fixture banner */
.internal-banner {
  position: sticky; top: 0; z-index: var(--z-banner);
  background: var(--state-ink); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  text-align: center; padding: 8px 14px; line-height: 1.4;
}

/* Drawer */
.atlas-scrim {
  position: fixed; inset: 0; z-index: var(--z-scrim);
  background: rgba(20, 18, 24, 0.42);
  opacity: 0; pointer-events: none;
  transition: opacity var(--mo-base) var(--mo-ease);
}
.atlas-scrim.open { opacity: 1; pointer-events: auto; }
.atlas-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-drawer);
  width: min(680px, 100vw);
  background: #fff; color: var(--state-ink);
  transform: translateX(102%);
  transition: transform var(--mo-slow) var(--mo-ease);
  display: flex; flex-direction: column;
  box-shadow: -12px 0 40px rgba(20, 18, 24, 0.18);
}
.atlas-drawer.open { transform: translateX(0); }
.atlas-drawer .drawer-head { padding: 24px 30px 16px; border-bottom: 1px solid var(--state-line); display: flex; align-items: flex-start; gap: 12px; }
.atlas-drawer .drawer-titles { flex: 1; min-width: 0; }
.atlas-drawer .drawer-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--state-muted); margin: 0 0 6px; }
.atlas-drawer .drawer-title { font-size: 24px; line-height: 1.15; font-weight: 700; margin: 0 0 8px; overflow-wrap: break-word; }
.atlas-drawer .drawer-close {
  flex: none; width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--state-bg);
  font-size: 18px; line-height: 1;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.atlas-drawer .drawer-close:hover { transform: scale(1.06); }
.atlas-drawer .drawer-close:active { transform: scale(0.94); }
.atlas-drawer .drawer-body { flex: 1; overflow-y: auto; padding: 20px 30px 36px; font-size: 14px; line-height: 1.6; }
.atlas-drawer .drawer-summary { margin: 0 0 16px; font-size: 15px; }
.overview-card .card-label,
.drawer-brief-label {
  display: block; margin: 0; color: var(--state-muted);
  font-size: 11px; font-weight: 800; line-height: 1.25;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.overview-card .card-takeaway {
  display: block; color: inherit; font-size: 13px; font-weight: 700; line-height: 1.42;
}
.overview-card:not(.structured-card) .card-takeaway {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  color: var(--state-muted); font-weight: 550;
}
.track-row.overview-card:not(.structured-card) .t-main { display: flex; flex-direction: column; gap: 2px; }
.track-row.overview-card:not(.structured-card) .card-label { opacity: 0.88; }
.shelf-card.overview-card:not(.structured-card) .card-takeaway { flex: 1; }
.structured-card .card-facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px;
  width: 100%; overflow: hidden; border: 1px solid var(--state-line); border-radius: 8px;
}
.structured-card .card-fact {
  min-width: 0; padding: 9px 8px; background: rgba(127, 127, 127, 0.055);
}
.structured-card .card-fact strong,
.structured-card .card-fact span { display: block; overflow-wrap: anywhere; }
.structured-card .card-fact strong { font-size: 14px; line-height: 1.15; }
.structured-card .card-fact span { margin-top: 3px; color: var(--state-muted); font-size: 11px; line-height: 1.2; }
.structured-card .card-callout {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 7px;
  align-items: baseline; padding: 7px 9px; border-left: 3px solid var(--state-muted);
  background: rgba(127, 127, 127, 0.055); font-size: 11px; line-height: 1.35;
}
.structured-card .card-callout b { white-space: nowrap; }
.structured-card .card-callout[data-tone="opportunity"] { border-left-color: var(--gate-go); }
.structured-card .card-callout[data-tone="caution"] { border-left-color: var(--gate-caution); }
.structured-card .card-callout[data-tone="gap"] { border-left-color: var(--gate-stop); }
.structured-card .source-count {
  color: var(--state-muted); font-size: 11px; font-weight: 700; white-space: nowrap;
}
.atlas-map { padding: 34px 24px 14px; }
.atlas-map-head { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.atlas-map-head p { margin: 0 0 5px; color: var(--state-muted); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.atlas-map-head h2 { margin: 0; font-size: 28px; line-height: 1.1; }
.atlas-map-head > span { max-width: 38em; color: var(--state-muted); font-size: 12px; line-height: 1.5; }
.atlas-map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(205px, 1fr)); gap: 10px; }
.atlas-map-card {
  min-width: 0; min-height: 164px; padding: 14px;
  display: flex; flex-direction: column; gap: 7px;
  color: inherit; text-decoration: none; border: 1px solid var(--state-line); border-top: 4px solid var(--dom);
  border-radius: 10px; transition: transform var(--mo-fast) var(--mo-ease), background-color var(--mo-fast) ease;
}
.atlas-map-card:hover { transform: translateY(-2px); }
.atlas-map-card:active { transform: translateY(0); }
.atlas-map-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.atlas-map-num { font-size: 11px; font-weight: 800; }
.atlas-map-count, .atlas-map-meta { color: var(--state-muted); font-size: 11px; line-height: 1.3; }
.atlas-map-card > strong { font-size: 14px; line-height: 1.25; }
.atlas-map-read { flex: 1; font-size: 12px; font-weight: 650; line-height: 1.42; }
.atlas-map-meta b { color: inherit; }
.track-row.structured-card {
  grid-template-columns: 34px minmax(230px, 1.15fr) minmax(260px, 0.85fr) auto;
  align-items: stretch; padding-block: 12px;
}
.track-row.structured-card .t-main { display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.track-row.structured-card .card-facts { align-self: center; }
.track-row.structured-card .card-callout { margin-top: 5px; }
.track-row.structured-card .t-side { align-content: center; max-width: 190px; }

.drawer-brief {
  margin: 0 0 20px; padding: 18px; border: 1px solid var(--state-line);
  border-top: 4px solid var(--state-muted); border-radius: 12px;
}
.drawer-brief[data-card-family="thesis"] { border-top-color: var(--dom-02); }
.drawer-brief[data-card-family="cohort"] { border-top-color: var(--dom-03); }
.drawer-brief[data-card-family="brand-fit"] { border-top-color: var(--dom-07); }
.drawer-brief[data-card-family="signal"] { border-top-color: var(--dom-04); }
.drawer-brief[data-card-family="risk-gap"] { border-top-color: var(--dom-08); }
.drawer-brief[data-card-family="provenance"] { border-top-color: var(--dom-10); }
.drawer-takeaway { margin: 6px 0 16px; font-size: 19px; font-weight: 750; line-height: 1.32; letter-spacing: -0.01em; }
.drawer-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.drawer-fact { min-width: 0; padding: 10px; background: rgba(127, 127, 127, 0.06); border-radius: 8px; }
.drawer-fact strong, .drawer-fact span { display: block; overflow-wrap: anywhere; }
.drawer-fact strong { font-size: 18px; line-height: 1.15; }
.drawer-fact span { margin-top: 4px; color: var(--state-muted); font-size: 11px; line-height: 1.3; }
.drawer-callout { margin: 0 0 18px; padding: 14px 16px; border-left: 4px solid var(--state-muted); background: rgba(127, 127, 127, 0.06); }
.drawer-callout[data-tone="opportunity"] { border-left-color: var(--gate-go); }
.drawer-callout[data-tone="caution"] { border-left-color: var(--gate-caution); }
.drawer-callout[data-tone="gap"] { border-left-color: var(--gate-stop); }
.atlas-drawer .drawer-callout h3 { margin: 0 0 5px; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.atlas-drawer .drawer-callout h3::after { display: none; }
.atlas-drawer .drawer-callout p { margin: 0; }
.drawer-next-step { padding: 14px 16px; border: 1px solid var(--state-line); border-radius: 8px; }
.drawer-context { color: var(--state-muted); }
.atlas-drawer h3 {
  font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--state-muted); margin: 24px 0 8px;
  display: flex; align-items: center; gap: 10px;
}
.atlas-drawer h3::after { content: ""; flex: 1; height: 1px; background: var(--state-line); }
.atlas-drawer .drawer-section p { margin: 0 0 10px; }
.atlas-drawer .drawer-section ul { margin: 0 0 10px 18px; padding: 0; }
.atlas-drawer .drawer-section li { margin: 0 0 6px; }
.atlas-drawer .excerpt {
  border-left: 3px solid var(--state-line);
  background: rgba(38, 35, 42, 0.03);
  border-radius: 0 8px 8px 0;
  padding: 12px 14px 12px 16px; margin: 0 0 14px;
  font-size: 13px; white-space: pre-wrap; overflow-wrap: break-word;
}
.atlas-drawer .excerpt .excerpt-src {
  display: block; margin-top: 8px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; color: var(--state-muted); font-style: normal;
}
.atlas-drawer .related-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.atlas-drawer .related-list button {
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--state-line); border-radius: 999px;
  padding: 8px 14px; min-height: 44px; background: #fff;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.atlas-drawer .related-list button:hover { transform: translateY(-1px); }
.atlas-drawer .drawer-hash {
  margin-top: 24px; padding-top: 14px; border-top: 1px solid var(--state-line);
  font-size: 11px; color: var(--state-muted);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  overflow-wrap: break-word;
}

/* Source rows + modes (non-color-redundant: label text carries the mode) */
.source-row {
  font-size: 12.5px; line-height: 1.55;
  border: 1px solid var(--state-line); border-radius: 8px;
  padding: 10px 12px; margin: 0 0 8px;
  background: rgba(38, 35, 42, 0.025);
  overflow-wrap: break-word;
}
.source-row strong { display: block; margin-bottom: 3px; }
.source-row .src-file {
  display: block; margin-top: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; color: var(--state-muted);
}
.source-row .src-note { display: block; margin-top: 3px; font-style: italic; color: var(--state-muted); }
.src-mode {
  display: inline-block; font-size: 11px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid var(--state-line); border-radius: 4px;
  padding: 2px 7px; margin: 2px 8px 2px 0; color: var(--state-ink);
}
.src-mode[data-mode="restricted"] { border-style: double; border-width: 3px; }
.src-mode[data-mode="missing-receipt"] { border-style: dashed; }
.source-row[data-source-mode="missing-receipt"] { border-style: dashed; }
.source-row[data-source-mode="restricted"] { border-style: double; border-width: 3px; }
.src-open {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--state-ink); border-radius: 999px;
  padding: 7px 14px; min-height: 44px; margin-top: 4px;
  background: #fff;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.src-open:hover { transform: translateY(-1px); }

/* Legend */
.atlas-legend { font-size: 12px; line-height: 1.5; }
.atlas-legend .legend-group { margin: 0 0 14px; }
.atlas-legend .legend-heading {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--state-muted); margin: 0 0 6px;
}
.atlas-legend .legend-items { display: flex; flex-wrap: wrap; gap: 6px 12px; margin: 0; padding: 0; list-style: none; }
.atlas-legend .legend-items li { display: inline-flex; align-items: center; gap: 6px; }
.atlas-legend .swatch { width: 12px; height: 12px; border-radius: 3px; border: 1px solid rgba(38, 35, 42, 0.25); flex: none; }
.legend-details { border-top: 1px solid var(--state-line); padding: 8px 0 0; margin: 8px 0 0; }
.legend-details summary { min-height: 44px; cursor: pointer; display: flex; align-items: center; font-size: 11px; font-weight: 700; }
.legend-details summary::before { content: "＋"; margin-right: 6px; }
.legend-details[open] summary::before { content: "−"; }
.legend-definitions { display: block !important; }
.legend-definitions li { display: grid !important; grid-template-columns: 18px 1fr; align-items: start !important; margin: 0 0 10px; }
.legend-definitions b { display: block; font-size: 11px; }
.legend-definitions small, .legend-rule { display: block; color: var(--state-muted); font-size: 11px; line-height: 1.45; }
.legend-glyph { width: 14px; text-align: center; }
.workflow-mark { width: 8px; height: 8px; margin: 4px 0 0 3px; border: 1px dashed currentColor; }
.legend-rule { margin: 4px 0 12px; }

.evidence-basis { margin: 16px 0 20px; border: 1px solid var(--state-line); border-radius: 8px; }
.evidence-basis summary { min-height: 44px; padding: 10px 14px; cursor: pointer; font-weight: 700; }
.evidence-basis-row { padding: 10px 14px; border-top: 1px solid var(--state-line); }
.evidence-basis-row h4 { margin: 0 0 4px; font-size: 12.5px; }
.evidence-basis-row p { margin: 0 0 4px; font-size: 12px; color: var(--state-muted); }

@media (max-width: 1180px) {
  .track-row.structured-card { grid-template-columns: 34px minmax(230px, 1fr) minmax(230px, 0.8fr); }
  .track-row.structured-card .t-side { grid-column: 2 / -1; max-width: none; justify-content: flex-start; }
}

@media (max-width: 720px) {
  .track-row.structured-card { grid-template-columns: 28px minmax(0, 1fr); }
  .track-row.structured-card .card-facts,
  .track-row.structured-card .t-side { grid-column: 2; }
  .structured-card .card-callout { grid-template-columns: 1fr; }
  .drawer-facts { grid-template-columns: 1fr; }
  .atlas-map { padding-inline: 18px; }
  .atlas-map-head { align-items: start; flex-direction: column; gap: 8px; }
  .atlas-map-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .atlas-map-card { min-height: 190px; }
}

@media (max-width: 420px) {
  .atlas-map-grid { grid-template-columns: 1fr; }
  .atlas-map-card { min-height: 0; }
}

/* Search */
.atlas-search input {
  font: inherit; font-size: 13px; color: var(--state-ink);
  border: 1px solid var(--state-line); border-radius: 6px;
  padding: 9px 12px; min-height: 44px; width: 100%; background: #fff;
}
.atlas-search input::placeholder { color: var(--state-muted); }
.search-count { font-size: 11.5px; color: var(--state-muted); margin: 4px 0 0; min-height: 16px; }
.node-hit-hidden { display: none !important; }
.cluster-no-hits { opacity: 0.35; }
.cluster-no-hits .cluster-empty-note { display: block; }
.cluster-empty-note { display: none; font-size: 12px; font-style: italic; color: var(--state-muted); }

/* Disclosure */
.disclosure-hidden { display: none !important; }
.disclosure-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--state-line); border-radius: 999px;
  padding: 9px 16px; min-height: 44px; margin: 10px 0 4px;
  background: #fff; color: var(--state-ink);
  transition: transform var(--mo-fast) var(--mo-ease);
}
.disclosure-toggle:hover { transform: translateY(-1px); }
.disclosure-toggle::before { content: "＋"; font-size: 13px; }

/* Coverage disclosure (lean honesty) */
.coverage-disclosure {
  margin: 18px 0 0; max-width: 46em;
  border: 1px dashed var(--state-line); border-radius: 8px;
  font-size: 13px;
}
.coverage-disclosure summary {
  cursor: pointer; padding: 12px 16px; min-height: 44px;
  display: flex; align-items: center;
  font-weight: 600; list-style: none;
}
.coverage-disclosure summary::before { content: "▸"; margin-right: 8px; transition: transform var(--mo-fast) var(--mo-ease); }
.coverage-disclosure[open] summary::before { transform: rotate(90deg); }
.coverage-disclosure .coverage-note { margin: 0 16px 8px; font-style: italic; color: var(--state-muted); font-size: 12.5px; }
.coverage-disclosure ul { margin: 0 16px 14px 32px; padding: 0; }
.coverage-disclosure li { margin: 0 0 8px; font-size: 12.5px; line-height: 1.55; }

/* Honest absence */
.absence-note {
  font-size: 12.5px; font-style: italic; color: var(--state-muted);
  border: 1px dashed var(--state-line); border-radius: 6px;
  padding: 8px 12px; margin: 0 0 12px; max-width: 52em;
}

/* Markdown reader */
.md-reader {
  position: fixed; inset: 0; z-index: var(--z-reader);
  background: rgba(20, 18, 24, 0.5);
  display: none; align-items: center; justify-content: center;
  padding: 24px;
}
.md-reader.open { display: flex; }
.md-reader-panel {
  background: #fff; color: var(--state-ink);
  width: min(760px, 100%); max-height: min(84vh, 900px);
  border-radius: 12px; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.md-reader-head { padding: 18px 24px 12px; border-bottom: 1px solid var(--state-line); position: relative; }
.md-reader-kicker { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--state-muted); margin: 0 0 6px; }
.md-reader-head h2 { font-size: 17px; line-height: 1.3; margin: 0; padding-right: 52px; }
.md-reader-close {
  position: absolute; top: 14px; right: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--state-bg); font-size: 16px;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.md-reader-close:hover { transform: scale(1.06); }
.md-reader-body { overflow-y: auto; padding: 20px 26px 30px; font-size: 14px; line-height: 1.65; }
.md-reader-body h1 { font-size: 22px; margin: 0 0 14px; line-height: 1.2; }
.md-reader-body h2 { font-size: 17px; margin: 24px 0 8px; }
.md-reader-body h3 { font-size: 14.5px; margin: 18px 0 6px; }
.md-reader-body p { margin: 0 0 10px; }
.md-reader-body ul, .md-reader-body ol { margin: 0 0 12px 20px; padding: 0; }
.md-reader-body li { margin: 0 0 6px; }
.md-reader-body blockquote {
  border-left: 3px solid var(--state-line); margin: 0 0 14px;
  padding: 8px 0 8px 14px; color: var(--state-muted); font-style: italic;
}
.md-reader-body code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; background: var(--state-bg);
  border-radius: 4px; padding: 1px 5px;
}
.md-reader-body hr { border: 0; border-top: 1px solid var(--state-line); margin: 18px 0; }
.md-reader-body .md-target { background: rgba(239, 211, 160, 0.35); border-radius: 4px; }
.md-loading { color: var(--state-muted); font-style: italic; }

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

/* ============================================================================
   PHASE 2C ADDITIONS — Full Source Reader v2, governed actions, view modes
   ========================================================================= */

/* Reader v2 layout: larger panel, tools row, TOC column */
.md-reader-panel {
  width: min(1080px, 100%);
  max-height: min(90vh, 1000px);
}
.md-reader-head { padding: 18px 24px 14px; }
.md-reader-status { font-size: 12px; color: var(--state-muted); margin: 6px 0 0; }
.md-reader-status .src-mode { margin-right: 8px; }
.md-reader-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
  margin-top: 12px;
}
.md-tabs { display: inline-flex; border: 1px solid var(--state-line); border-radius: 999px; overflow: hidden; }
.md-tab {
  font-size: 12px; font-weight: 600; padding: 10px 16px; min-height: 44px;
  transition: opacity var(--mo-fast) var(--mo-ease);
}
.md-tab[aria-selected="true"] { background: var(--state-ink); color: #fff; }
.md-search { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 220px; }
.md-search input {
  font: inherit; font-size: 12.5px; border: 1px solid var(--state-line);
  border-radius: 6px; padding: 9px 10px; min-height: 44px; flex: 1; min-width: 120px;
}
.md-search-count { font-size: 11.5px; color: var(--state-muted); min-width: 64px; }
.md-search-nav {
  width: 44px; height: 44px; border: 1px solid var(--state-line); border-radius: 6px;
  display: inline-flex; align-items: center; justify-content: center; font-size: 14px;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.md-search-nav:hover { transform: translateY(-1px); }
.md-copy-link {
  font-size: 12px; font-weight: 600; border: 1px solid var(--state-line);
  border-radius: 999px; padding: 10px 16px; min-height: 44px;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.md-copy-link:hover { transform: translateY(-1px); }

.md-reader-columns { display: grid; grid-template-columns: 230px 1fr; min-height: 0; flex: 1; }
.md-toc {
  border-right: 1px solid var(--state-line); overflow-y: auto;
  padding: 14px 12px 20px; font-size: 12px;
}
.md-toc-label, .md-foot-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--state-muted); margin: 0 0 8px;
}
.md-toc ul { list-style: none; margin: 0; padding: 0; }
.md-toc li { margin: 0; }
.md-toc button {
  display: block; width: 100%; text-align: left;
  padding: 8px 8px; min-height: 44px; border-radius: 5px;
  font-size: 12px; line-height: 1.35; color: var(--state-ink);
  transition: opacity var(--mo-fast) var(--mo-ease);
}
.md-toc button:hover { background: var(--state-bg); }
.md-toc-h2 button { padding-left: 16px; }
.md-toc-h3 button { padding-left: 26px; color: var(--state-muted); }
.md-toc-empty { font-size: 12px; font-style: italic; color: var(--state-muted); }

.md-reader-body table { border-collapse: collapse; margin: 0 0 14px; font-size: 12.5px; width: 100%; }
.md-reader-body th, .md-reader-body td {
  border: 1px solid var(--state-line); padding: 6px 9px; text-align: left; vertical-align: top;
}
.md-reader-body th { background: var(--state-bg); font-weight: 700; }
.md-reader-body .md-code {
  background: #f4f3f6; border: 1px solid var(--state-line); border-radius: 8px;
  padding: 12px 14px; overflow-x: auto; font-size: 12px; line-height: 1.55; margin: 0 0 14px;
}
.md-reader-body .md-code code { background: none; padding: 0; font-size: 12px; }
.md-raw {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: break-word; margin: 0;
}
.md-inert-link { color: var(--state-muted); font-size: 0.92em; }
mark.md-hit { background: rgba(239, 211, 160, 0.7); padding: 0 1px; border-radius: 2px; }
mark.md-hit-current { background: var(--gate-caution); color: #fff; }
.md-reader-foot {
  border-top: 1px solid var(--state-line); padding: 12px 24px 16px;
  font-size: 12px; max-height: 180px; overflow-y: auto;
}
.md-foot-note { margin: 0 0 8px; color: var(--state-muted); font-style: italic; }
.md-backlinks { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.md-backlinks button {
  font-size: 12px; font-weight: 600; border: 1px solid var(--state-line);
  border-radius: 999px; padding: 8px 14px; min-height: 44px; background: #fff;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.md-backlinks button:hover { transform: translateY(-1px); }
.adapter-state { display: block; font-style: normal; font-weight: 600; margin-top: 2px; }
.depth-note {
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em; text-transform: none;
  color: var(--state-muted); margin-left: 6px;
}

@media (max-width: 900px) {
  .md-reader { padding: 0; }
  .md-reader-panel { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .md-reader-columns { grid-template-columns: 1fr; }
  .md-toc { display: none; }
}

/* View-mode chrome */
.u-mode { display: inline-flex; align-items: center; gap: 8px; }
.mode-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 4px; border: 1px solid var(--state-line);
}
.mode-badge[data-mode="internal"] { background: var(--state-ink); color: #fff; border-color: var(--state-ink); }
.mode-badge[data-mode="client"] { background: #fff; color: var(--state-ink); }
.mode-switch {
  font-size: 12px; font-weight: 600; text-decoration: underline; color: inherit;
  min-height: 44px; display: inline-flex; align-items: center;
}
.theme-selector { display: inline-flex; align-items: center; gap: 8px; }
.theme-selector .theme-switch {
  min-height: 44px; padding: 8px;
  justify-content: center; white-space: nowrap;
}
.launcher-theme-selector { margin: 20px 0; }
@media (max-width: 900px) {
  .u-mode { width: 100%; flex-wrap: wrap; }
  .u-mode > .theme-selector { width: 100%; gap: 3px; }
  .u-mode > .theme-selector .theme-switch { flex: 1; min-width: 0; padding-inline: 4px; }
}

/* Ship-with-gap receipt */
.ship-receipt {
  margin: 18px 0 0; max-width: 52em;
  border: 1px solid var(--state-line); border-left: 4px solid var(--state-ink);
  border-radius: 8px; padding: 14px 18px;
  background: rgba(38, 35, 42, 0.03);
  font-size: 13px;
}
.sr-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--state-muted); margin: 0 0 8px;
}
.sr-approved { color: var(--gate-go-text); }
.sr-disclosure { margin: 0 0 8px; }
.sr-meta, .sr-note { font-size: 11.5px; color: var(--state-muted); margin: 0 0 4px; overflow-wrap: break-word; }
.sr-meta code, .sr-note code { font-size: 11px; }

/* Governed actions */
.action-row { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0 4px; }
.action-launch {
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--state-ink); border-radius: 999px;
  padding: 10px 16px; min-height: 44px; background: #fff;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.action-launch:hover { transform: translateY(-1px); }
.action-launch:active { transform: translateY(0); }
.action-note { font-size: 11.5px; font-style: italic; color: var(--state-muted); margin: 0 0 4px; }

.actions-panel {
  margin: 30px 32px 10px; padding: 20px 24px 18px;
  border: 1px dashed var(--state-line); border-radius: 12px;
  background: rgba(38, 35, 42, 0.02);
}
.ap-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ap-head h2 { font-size: 18px; font-weight: 700; margin: 0; }
.ap-noexec, .as-noexec, .ah-noexec {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gate-stop-text); border: 1px dashed var(--gate-stop);
  border-radius: 4px; padding: 3px 8px;
}
.ap-sub { font-size: 12.5px; color: var(--state-muted); max-width: 62em; margin: 8px 0 6px; }
.ap-history { margin-top: 14px; border-top: 1px solid var(--state-line); padding-top: 12px; }
.ap-history-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ap-history h3 { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--state-muted); margin: 0; }
.ap-clear {
  font-size: 12px; font-weight: 600; text-decoration: underline;
  min-height: 44px; padding: 0 8px;
}
.ah-empty { font-size: 12.5px; font-style: italic; color: var(--state-muted); margin: 8px 0 0; }
.ah-list { list-style: none; margin: 10px 0 0; padding: 0; font-size: 12.5px; }
.ah-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 0; border-bottom: 1px solid var(--state-line);
}
.ah-list code { font-size: 11px; }
.ah-status {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  border: 1px solid var(--state-line); border-radius: 4px; padding: 2px 7px;
}
.ah-status[data-status="queued-demo"] { border-style: dashed; }
.ah-status[data-status="preflight-ready"] { border-color: var(--gate-go); }
.ah-status[data-status="preflight-blocked"] { border-color: var(--gate-stop); }
.ah-status[data-status="dispatch-accepted"] { border-color: var(--gate-go); background: rgba(0, 143, 80, 0.12); }

/* Action sheet */
.action-sheet {
  position: fixed; inset: 0; z-index: var(--z-reader);
  background: rgba(20, 18, 24, 0.5);
  display: none; align-items: center; justify-content: center; padding: 24px;
}
.action-sheet.open { display: flex; }
.action-sheet-panel {
  background: #fff; color: var(--state-ink);
  width: min(720px, 100%); max-height: min(86vh, 900px);
  border-radius: 12px; display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
.action-sheet-head { padding: 18px 24px 12px; border-bottom: 1px solid var(--state-line); position: relative; }
.as-kicker {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--state-muted); margin: 0 0 6px;
}
.action-sheet-head h2 { font-size: 19px; margin: 0 0 10px; padding-right: 52px; }
.as-lifecycle { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.as-lifecycle .lc {
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  border-radius: 4px; padding: 3px 8px; border: 1px solid var(--state-line);
}
.as-lifecycle .lc.done { background: var(--state-bg); }
.as-lifecycle .lc.active { background: var(--state-ink); color: #fff; border-color: var(--state-ink); }
.as-lifecycle .lc.blocked { border-style: dashed; color: var(--gate-stop-text); border-color: var(--gate-stop); }
.as-lifecycle .lc.pending { font-style: italic; }
.as-lifecycle .lc.never { text-decoration: line-through; color: var(--state-muted); }
.as-close {
  position: absolute; top: 14px; right: 16px;
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--state-bg); font-size: 16px;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.as-close:hover { transform: scale(1.06); }
.action-sheet-body { overflow-y: auto; padding: 16px 24px; font-size: 13px; line-height: 1.6; }
.as-meta { font-size: 12px; color: var(--state-muted); margin: 0 0 12px; overflow-wrap: break-word; }
.as-meta code { font-size: 11px; }
.as-row { margin: 0 0 12px; }
.as-row h3 {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--state-muted); margin: 0 0 4px;
}
.as-row p, .as-row ul { margin: 0 0 4px; }
.as-row ul { padding-left: 18px; }
.action-sheet-foot {
  border-top: 1px solid var(--state-line); padding: 12px 24px 16px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px; justify-content: space-between;
}
.as-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.as-btn {
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--state-line); border-radius: 999px;
  padding: 10px 16px; min-height: 44px; background: #fff;
  transition: transform var(--mo-fast) var(--mo-ease);
}
.as-btn:hover { transform: translateY(-1px); }
.as-btn:active, .src-open:active, .disclosure-toggle:active, .md-copy-link:active,
.md-search-nav:active, .md-tab:active, .atlas-drawer .related-list button:active,
.md-backlinks button:active { transform: scale(0.97); }
.as-btn.primary { background: var(--state-ink); color: #fff; border-color: var(--state-ink); }
.proposal-review { margin: 20px 0 4px; padding-top: 16px; border-top: 2px solid var(--state-ink); }
.proposal-review > h3 { margin: 0 0 4px; font-size: 17px; }
.proposal-status { margin: 0 0 12px; color: var(--state-muted); font-size: 11.5px; }
.proposal-cell { padding: 12px 0; border-top: 1px solid var(--state-line); }
.proposal-cell h4 { margin: 0 0 6px; text-transform: capitalize; font-size: 14px; }
.proposal-cell h4 span { margin-left: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.proposal-cell p { margin: 0 0 6px; }
.proposal-evidence { color: var(--state-muted); font-size: 11.5px; }
.proposal-unresolved { padding: 12px; background: var(--state-bg); }
.proposal-unresolved h4 { margin: 0 0 6px; }
.proposal-unresolved ul { margin: 0; padding-left: 18px; }
.dispatcher-card {
  margin: 20px 0 4px; padding: 16px;
  border: 1px solid var(--state-line); border-left: 4px solid var(--state-muted);
  background: var(--state-bg);
}
.dispatcher-card[data-state="ready"], .dispatcher-card[data-state="accepted"] { border-left-color: var(--gate-go); }
.dispatcher-card[data-state="unavailable"] { border-left-color: var(--gate-stop); }
.dispatcher-card h3 { margin: 0 0 6px; font-size: 16px; }
.dispatcher-card p { margin: 0 0 12px; }
.dispatcher-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0; }
.dispatcher-auth { display: grid; grid-template-columns: minmax(160px, 1fr) auto; gap: 8px; align-items: end; }
.dispatcher-auth label { grid-column: 1 / -1; font-size: 11.5px; font-weight: 700; }
.dispatcher-auth input {
  min-height: 44px; width: 100%; padding: 9px 12px;
  color: var(--state-ink); background: #fff; border: 1px solid var(--state-line);
  font: inherit;
}
.dispatcher-consent { display: flex; gap: 10px; align-items: flex-start; margin: 14px 0; font-weight: 650; }
.dispatcher-consent input { width: 20px; height: 20px; flex: 0 0 auto; }
.dispatcher-error { color: var(--gate-stop-text); font-weight: 700; }
.as-btn:disabled { opacity: 0.48; cursor: not-allowed; transform: none; }
.review-decision { margin: 16px 0; padding: 16px; border: 1px solid var(--state-line); border-left: 4px solid var(--gate-caution); }
.review-decision h4, .review-decision p { margin: 0 0 8px; }
.review-field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.review-summary { margin: 16px 0; border: 1px solid var(--state-line); }
.review-summary summary { display: flex; align-items: center; min-height: 44px; padding: 10px 14px; cursor: pointer; font-weight: 700; }
.review-summary pre { max-height: 520px; margin: 0; padding: 16px; overflow: auto; border-top: 1px solid var(--state-line); white-space: pre-wrap; overflow-wrap: anywhere; font: 12px/1.6 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.review-boundary { margin: 16px 0 0; padding: 12px 16px; border: 1px dashed var(--gate-stop); color: var(--gate-stop-text); }
@media (max-width: 900px) {
  .action-sheet { padding: 0; }
  .action-sheet-panel { width: 100%; height: 100vh; max-height: 100vh; border-radius: 0; }
  .actions-panel { margin: 24px 16px 8px; }
  .dispatcher-auth { grid-template-columns: 1fr; }
  .review-field-grid { grid-template-columns: 1fr; }
}
