/* ============================================================================
 * Handbook theme — built on the Ryan Colston design system.
 * tokens.css (loaded before this file) provides --p-* / --s-* tokens, the
 * reset, and the body type defaults. This file is layout + components only.
 *
 * Constitution (DESIGN_SYSTEM.md): olive is the only action colour; Fraunces +
 * DM Sans; warm shadows; pill controls; accents are personality not status;
 * NO dark mode. Light, cream surface, always.
 *
 * Legacy class hooks emitted by build.py (.card, .rail, .chip, .gate-row, .tick,
 * .flag, .assets, .toc, …) are preserved and remapped onto design tokens via
 * the alias layer below, so the markup did not have to change.
 * ========================================================================== */

:root {
  /* Alias layer: the names the existing component CSS references, now pointed
     at design-system semantic tokens. Single source of truth = tokens.css. */
  --bg:              var(--s-surface-base);     /* cream */
  --bg-subtle:       var(--s-surface-sunken);
  --fg:              var(--s-text-primary);     /* ink */
  --fg-muted:        var(--s-text-muted);
  --border:          var(--s-border-strong);
  --border-subtle:   var(--s-border-subtle);
  --accent:          var(--s-text-brand);       /* olive — the only action colour */
  --accent-subtle:   var(--p-olive-50);
  --ok:              #3f7a4f;                    /* semantic success (ADR-0007) */
  --warn:            #7a5a12;                    /* semantic caution (ADR-0007) */
  --warn-bg:         #faf3e0;
  --warn-border:     var(--p-accent-yellow);
  --sidebar-bg:      var(--s-surface-base);
  --code-bg:         var(--s-surface-sunken);
  --blockquote-bg:   var(--s-surface-sunken);
  --blockquote-border: var(--s-border-strong);
  --topbar-h:        56px;                       /* global nav bar height */
}

/* ── Layout ───────────────────────────────────────────────────────────────*/
body {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: var(--topbar-h) 1fr;       /* row 1 = global top bar */
  min-height: 100vh;
}

#sidebar {
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-subtle);
  padding: var(--s-space-xl) var(--s-space-lg) var(--s-space-2xl);
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  font-size: var(--p-text-14);
  min-width: 0;
}

/* ── Global top bar (home + breadcrumb + search) ──────────────────────────*/
#topbar {
  grid-column: 1 / -1;                           /* span sidebar + content */
  position: sticky;
  top: 0;
  z-index: var(--p-z-sticky);
  display: flex;
  align-items: center;
  gap: var(--s-space-md);
  height: var(--topbar-h);
  padding: 0 var(--s-space-lg);
  background: var(--s-surface-raised);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 1px 0 var(--p-shadow-warm-sm);
}

.topbar-home {
  display: inline-flex;
  align-items: center;
  gap: var(--s-space-xs);
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}
.topbar-home:hover { color: var(--accent); }
.topbar-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: var(--p-radius-sm);
  background: var(--accent); color: var(--s-action-primary-fg);
  font-size: var(--p-text-16); line-height: 1;
}
.topbar-home-label {
  font-family: var(--p-font-display);
  font-size: var(--p-text-16);
  font-weight: var(--p-weight-semibold);
  letter-spacing: var(--p-ls-snug);
}

.breadcrumb {
  display: flex; align-items: center; gap: var(--s-space-xs);
  min-width: 0; overflow: hidden;
  font-size: var(--p-text-13); color: var(--fg-muted);
}
.breadcrumb a { color: var(--fg-muted); text-decoration: none; white-space: nowrap; }
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.crumb-current {
  color: var(--fg); font-weight: var(--p-weight-medium);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.crumb-sep { color: var(--border); }

.topbar-search { margin-left: auto; position: relative; flex-shrink: 0; }
#site-search {
  width: 240px; max-width: 32vw; height: 36px;
  padding: 0 var(--s-space-md);
  border: 1px solid var(--border);
  border-radius: var(--p-radius-pill);
  background: var(--s-surface-base); color: var(--fg);
  font-family: var(--p-font-body); font-size: var(--p-text-14);
}
#site-search::placeholder { color: var(--fg-muted); }
#site-search:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}
#site-search-results {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 380px; max-width: 80vw; max-height: 60vh; overflow-y: auto;
  margin: 0; padding: var(--s-space-xs); list-style: none;
  background: var(--s-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--p-radius-md);
  box-shadow: var(--s-shadow-lg);
  z-index: var(--p-z-overlay);
}
#site-search-results[hidden] { display: none; }
#site-search-results li { margin: 0; }
#site-search-results a {
  display: block; padding: var(--s-space-xs) var(--s-space-sm);
  border-radius: var(--p-radius-sm); color: var(--fg); text-decoration: none;
}
#site-search-results a:hover, #site-search-results a.active {
  background: var(--accent-subtle); color: var(--accent);
}
.sr-title { display: block; font-weight: var(--p-weight-medium); }
.sr-type {
  display: block; font-size: var(--p-text-11); color: var(--fg-muted);
  text-transform: uppercase; letter-spacing: var(--p-ls-wider);
}
.sr-empty { padding: var(--s-space-xs) var(--s-space-sm); color: var(--fg-muted); font-size: var(--p-text-13); }

.sidebar-header {
  padding-bottom: var(--s-space-md);
  margin-bottom: var(--s-space-md);
  border-bottom: 1px solid var(--border-subtle);
}

.agent-row { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s-space-sm); }

.agent-name {
  font-family: var(--p-font-display);
  font-size: var(--p-text-22);
  font-weight: var(--p-weight-semibold);
  letter-spacing: var(--p-ls-snug);
  color: var(--fg);
}

.site-label {
  font-size: var(--p-text-12);
  font-weight: var(--p-weight-semibold);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: var(--p-ls-wider);
  margin-top: var(--p-size-1);
}

/* ── Table of contents ────────────────────────────────────────────────────*/
.toc-title {
  font-size: var(--p-text-11) !important;
  text-transform: uppercase;
  letter-spacing: var(--p-ls-wider);
  color: var(--fg-muted) !important;
  margin: var(--s-space-md) 0 var(--s-space-xs) 0 !important;
  border: none !important;
  padding: 0 !important;
  font-weight: var(--p-weight-semibold);
}

.toc ul { list-style: none; padding: 0; margin: 0; }

.toc a {
  display: block;
  padding: var(--p-size-1) var(--s-space-sm);
  color: var(--fg);
  text-decoration: none;
  border-radius: var(--s-radius-control);
  transition: background-color var(--s-motion-hover), color var(--s-motion-hover);
}
.toc a:hover { background: var(--accent-subtle); color: var(--accent); }
.toc a.active { background: var(--accent); color: var(--s-action-primary-fg); font-weight: var(--p-weight-semibold); }

.toc-row { display: flex; align-items: center; gap: var(--p-size-1); margin-top: var(--p-size-1); }
.toc-expand {
  background: transparent; border: none; color: var(--fg-muted); cursor: pointer;
  padding: 2px 4px; font-size: var(--p-text-11); line-height: 1; flex-shrink: 0;
  width: 20px; text-align: center; border-radius: var(--p-radius-sm);
  transition: background-color var(--s-motion-hover), color var(--s-motion-hover);
}
.toc-expand:hover { background: var(--accent-subtle); color: var(--accent); }
.toc-row > a { flex: 1; }
.toc-l2 > .toc-row > a { font-weight: var(--p-weight-semibold); }
.toc-sublist { margin: 2px 0 var(--s-space-xs) 20px !important; padding-left: 0 !important; }
.toc-subsublist { margin: 2px 0 2px var(--s-space-md) !important; padding-left: 0 !important; }
.toc-l3 > a { font-weight: var(--p-weight-regular); color: var(--fg-muted); }
.toc-l3 > a:hover, .toc-l3 > a.active { color: var(--accent); }
.toc-l3 > a.active { color: var(--s-action-primary-fg); }
.toc-l4 > a { padding-left: var(--s-space-lg); font-size: var(--p-text-13); color: var(--fg-muted); }

/* ── Main content ─────────────────────────────────────────────────────────*/
#content {
  padding: var(--s-space-2xl) var(--s-space-3xl) var(--s-space-section-y);
  max-width: 820px;
  margin: 0;
  min-width: 0;               /* P0: let the grid track shrink below content */
  overflow-wrap: break-word;
}

#content h1, #content h2, #content h3 {
  font-family: var(--p-font-display);
  letter-spacing: var(--p-ls-snug);
  line-height: var(--p-lh-heading);
  color: var(--fg);
}
#content h1 {
  font-size: clamp(28px, 4vw, var(--p-text-38));
  font-weight: var(--p-weight-semibold);
  margin: 0 0 var(--s-space-lg);
  letter-spacing: var(--p-ls-tight);
}
#content h2 {
  font-size: var(--p-text-26);
  font-weight: var(--p-weight-medium);
  margin-top: var(--s-space-2xl);
  margin-bottom: var(--s-space-sm);
}
#content h3 {
  font-size: var(--p-text-20);
  font-weight: var(--p-weight-medium);
  margin-top: var(--s-space-xl);
  margin-bottom: var(--s-space-xs);
}
#content h4 {
  font-family: var(--p-font-body);
  font-size: var(--p-text-16);
  margin-top: var(--s-space-lg);
  font-weight: var(--p-weight-semibold);
  color: var(--fg-muted);
}
/* A heading (or any element) that LEADS a card must not stack its top margin
   on the card's own 32px padding — that doubled the dead space above every
   card title (~80px). The card padding already provides the breathing room. */
#content .card > :first-child { margin-top: 0; }

#content p { margin: 0.7em 0; }
#content ul, #content ol { padding-left: 1.5em; margin: 0.6em 0; }
#content li { margin: 0.3em 0; }

/* Inline links: olive + always underlined. Underline-on-hover-only made links
   indistinguishable from surrounding text (Ry, 2026-06-10); matches the
   practice-offers convention (underline, 2px offset). */
#content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-weight: var(--p-weight-medium); }
#content a:hover { text-decoration-thickness: 2px; }

/* CTA links: a standalone link on its own line becomes an olive pill button
   (Button.md spec). This auto-upgrades every "Open … →" call to action. */
#content p > a:only-child {
  display: inline-flex;
  align-items: center;
  gap: var(--s-space-xs);
  min-height: 44px;
  padding: var(--s-space-sm) var(--s-space-lg);
  margin-top: var(--p-size-1);
  background: var(--s-action-primary-bg);
  color: var(--s-action-primary-fg);
  font-weight: var(--p-weight-semibold);
  font-size: var(--p-text-15);
  line-height: 1;
  border-radius: var(--s-radius-control);
  box-shadow: var(--s-shadow-sm);
  text-decoration: none;
  transition: background-color var(--s-motion-hover), box-shadow var(--s-motion-hover), transform var(--s-motion-press);
}
#content p > a:only-child:hover {
  background: var(--s-action-primary-bg-hover);
  box-shadow: var(--s-shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
}
#content p > a:only-child:active { transform: translateY(0); box-shadow: var(--s-shadow-sm); }

#content blockquote {
  margin: 1em 0;
  padding: var(--s-space-sm) var(--s-space-md);
  background: var(--blockquote-bg);
  border-left: 3px solid var(--accent);
  color: var(--fg-muted);
  border-radius: 0 var(--s-radius-subtle) var(--s-radius-subtle) 0;
}

#content code {
  background: var(--code-bg);
  padding: 2px 6px;
  border-radius: var(--p-radius-sm);
  font-size: 0.9em;
  font-family: "SF Mono", Menlo, Monaco, monospace;
}
#content pre {
  background: var(--code-bg);
  padding: var(--s-space-md);
  border-radius: var(--s-radius-subtle);
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
}

/* Tables — P0: confine wide tables to their own scroll box instead of blowing
   out the page. display:block makes the element scrollable while children keep
   their table layout. */
#content table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: var(--p-text-14);
}
#content th, #content td {
  border: 1px solid var(--border-subtle);
  padding: var(--s-space-xs) var(--s-space-sm);
  text-align: left;
  vertical-align: top;
}
#content th { background: var(--bg-subtle); font-weight: var(--p-weight-semibold); }

/* Section rule — lighter and airier than the old hard rules (hierarchy via
   space, not borders). */
#content hr { border: none; border-top: 1px solid var(--border-subtle); margin: var(--s-space-2xl) 0; }

/* ── Mobile toggle (pill, design-system) ──────────────────────────────────*/
#toc-toggle {
  display: none;
  position: fixed;
  top: var(--s-space-md);
  right: var(--s-space-md);
  z-index: var(--p-z-sticky);
  min-height: 40px;
  background: var(--s-surface-raised);
  color: var(--fg);
  border: 1px solid var(--border);
  padding: var(--s-space-xs) var(--s-space-md);
  border-radius: var(--s-radius-control);
  font-size: var(--p-text-14);
  font-weight: var(--p-weight-semibold);
  cursor: pointer;
  box-shadow: var(--s-shadow-sm);
}

@media (max-width: 1023px) {
  body { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; top: var(--topbar-h); left: 0;
    width: 300px; max-width: 85vw; height: calc(100vh - var(--topbar-h));
    transform: translateX(-100%);
    transition: transform var(--s-motion-hover);
    z-index: var(--p-z-overlay);
    box-shadow: var(--s-shadow-lg);
  }
  #sidebar.open { transform: translateX(0); }
  /* The TOC drawer toggle seats inside the top bar on the right; search is a
     desktop affordance and hides here so it can't collide with the toggle. */
  #toc-toggle {
    display: inline-flex; align-items: center;
    top: calc((var(--topbar-h) - 40px) / 2);
    z-index: var(--p-z-overlay);
  }
  .topbar-search { display: none; }
  #content { padding: var(--s-space-xl) var(--s-space-lg) var(--s-space-3xl); }
  #content h1 { font-size: var(--p-text-30); }
  #content h2 { font-size: var(--p-text-22); margin-top: var(--s-space-xl); }
}

@media (max-width: 480px) {
  .topbar-home-label { display: none; }   /* keep just the mark on tiny screens */
  .breadcrumb { font-size: var(--p-text-12); }
}

/* ── Setter home: the two doors as cards ──────────────────────────────────*/
.doors { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-space-md); margin: var(--s-space-lg) 0; }
.door {
  background: var(--s-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--s-radius-panel);
  box-shadow: var(--s-shadow-sm);
  padding: var(--s-space-xl);
  display: flex;
  flex-direction: column;
}
.door h2 {
  margin-top: 0 !important;
  margin-bottom: var(--s-space-xs);
  font-size: var(--p-text-22);
  border: none;
}
.door p { color: var(--fg-muted); margin-top: 0; flex: 1; }
.door p > a:only-child { margin-top: var(--s-space-sm); }
@media (max-width: 700px) { .doors { grid-template-columns: 1fr; } }

/* ── Setter home: the date-anchored "Today" card ──────────────────────────*/
.today-card {
  background: var(--accent-subtle);
  border: 1px solid var(--s-border-subtle);
  border-radius: var(--s-radius-panel);
  padding: var(--s-space-lg) var(--s-space-xl);
  margin: var(--s-space-lg) 0;
}
.today-head { display: flex; align-items: center; gap: var(--s-space-md); }
.today-ring { flex-shrink: 0; line-height: 0; }
.today-lede { flex: 1; min-width: 0; }
.today-day {
  font-family: var(--p-font-display);
  font-size: var(--p-text-22);
  font-weight: var(--p-weight-semibold);
  color: var(--fg);
}
.today-week {
  font-size: var(--p-text-13);
  font-weight: var(--p-weight-semibold);
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: var(--p-ls-wider);
  margin-top: var(--p-size-1);
}
.today-done {
  flex-shrink: 0;
  min-height: 38px;
  padding: var(--s-space-xs) var(--s-space-md);
  border: 1px solid var(--accent);
  border-radius: var(--p-radius-pill);
  background: var(--s-surface-base);
  color: var(--accent);
  font-family: var(--p-font-body);
  font-size: var(--p-text-14);
  font-weight: var(--p-weight-semibold);
  cursor: pointer;
}
.today-done[aria-pressed="true"] { background: var(--accent); color: var(--s-action-primary-fg); }
.today-targets {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--p-size-1) var(--s-space-md);
  margin: var(--s-space-md) 0 0;
  font-size: var(--p-text-14);
}
.today-targets dt { color: var(--fg-muted); }
.today-targets dd { margin: 0; color: var(--fg); font-weight: var(--p-weight-medium); }
.today-check { margin: var(--s-space-md) 0 0; font-size: var(--p-text-14); color: var(--fg-muted); }
.today-check a { color: var(--accent); font-weight: var(--p-weight-semibold); }

/* Script focus + daily recording quota */
.today-script {
  margin: var(--s-space-md) 0 0;
  padding: var(--s-space-md);
  background: var(--s-surface-base);
  border: 1px solid var(--s-border-subtle);
  border-radius: var(--s-radius-control);
}
.today-scripts { display: flex; flex-direction: column; gap: var(--s-space-xs); }
.today-script-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-space-sm); }
.today-script-name { font-family: var(--p-font-display); font-size: var(--p-text-16); font-weight: var(--p-weight-semibold); color: var(--fg); }
.today-script-count { font-size: var(--p-text-14); font-weight: var(--p-weight-semibold); color: var(--fg-muted); white-space: nowrap; }
.today-script-count.is-met { color: var(--ok); }
.today-script-cta { display: inline-block; margin-top: var(--s-space-sm); color: var(--accent); font-weight: var(--p-weight-semibold); font-size: var(--p-text-14); text-decoration: underline; text-underline-offset: 2px; }
.today-script-cta:hover { text-decoration-thickness: 2px; }

/* ── Live Rep Pace strip (agent Path home) ────────────────────────────────*/
/* Hidden by default in markup; personalization.js reveals it only for a fresh,
   identified pace payload. Olive-accented like the rest of the Path surfaces. */
.pace-strip {
  background: var(--accent-subtle);
  border: 1px solid var(--accent);
  border-radius: var(--s-radius-panel);
  padding: var(--s-space-lg) var(--s-space-xl);
  margin: 0 0 var(--s-space-md);
  box-shadow: var(--s-shadow-sm);
}
.pace-row { display: flex; align-items: center; gap: var(--s-space-xl); flex-wrap: wrap; }
.pace-cell { min-width: 0; }
.pace-lab {
  font-size: var(--p-text-12);
  font-weight: var(--p-weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--p-ls-wide);
  color: var(--fg-muted);
}
.pace-num {
  font-family: var(--p-font-display);
  font-size: var(--p-text-22);
  font-weight: var(--p-weight-semibold);
  color: var(--fg);
  line-height: 1.15;
}
.pace-num small { font-size: var(--p-text-14); font-weight: var(--p-weight-medium); color: var(--fg-muted); }
.pace-chip {
  display: inline-block;
  font-size: var(--p-text-13);
  font-weight: var(--p-weight-semibold);
  padding: var(--s-space-xs) var(--s-space-md);
  border-radius: var(--p-radius-pill);
  white-space: nowrap;
  color: var(--fg-muted);
}
.pace-chip.behind { background: var(--warn-subtle, #f7ecd7); color: var(--warn, #a8742a); }
.pace-chip.ahead { background: var(--ok-subtle, #e4efe2); color: var(--ok); }
.pace-chip.on { background: var(--ok-subtle, #e4efe2); color: var(--ok); }
.pace-bar { flex: 1; min-width: 140px; }
.pace-track {
  height: 8px;
  border-radius: var(--p-radius-pill);
  background: var(--s-border-subtle);
  overflow: hidden;
}
.pace-fill { height: 100%; border-radius: var(--p-radius-pill); background: var(--accent); width: 0; }
.pace-asof {
  font-size: var(--p-text-12);
  color: var(--fg-muted);
  margin-top: var(--s-space-sm);
}

/* ── Persistent setter nav ────────────────────────────────────────────────*/
.setter-nav { padding: var(--s-space-sm) var(--s-space-md); border-bottom: 1px solid var(--border-subtle); }
.setter-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--p-size-1); }
.setter-nav a { color: var(--fg); display: block; font-weight: var(--p-weight-semibold); text-decoration: none; padding: var(--p-size-1) 0; }
.setter-nav a:hover { color: var(--accent); }

/* ── Path home: level rail + blocks ───────────────────────────────────────*/
.crumb { font-size: var(--p-text-12); color: var(--fg-muted); text-transform: uppercase; letter-spacing: var(--p-ls-wide); margin-bottom: var(--p-size-1); font-weight: var(--p-weight-semibold); }
.ident { font-size: var(--p-text-17); color: var(--fg-muted); margin-bottom: var(--s-space-lg); }

.card {
  background: var(--s-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--s-radius-panel);
  padding: var(--s-space-xl) var(--s-space-xl);
  margin: 0 0 var(--s-space-md);
  box-shadow: var(--s-shadow-sm);
}
.card h2 {
  margin-top: 0;
  font-family: var(--p-font-body);
  font-size: var(--p-text-12);
  text-transform: uppercase;
  letter-spacing: var(--p-ls-wide);
  color: var(--fg-muted);
  margin-bottom: var(--s-space-sm);
  font-weight: var(--p-weight-semibold);
}

#sidebar .rail { list-style: none; margin: var(--s-space-xs) 0 0; padding: 0; }
#sidebar .rail li { position: relative; padding: 11px 12px 11px 34px; border-radius: var(--p-radius-sm); font-size: var(--p-text-14); color: var(--fg-muted); }
#sidebar .rail li .lv { font-weight: var(--p-weight-semibold); color: var(--fg); }
#sidebar .rail li::before { content: ""; position: absolute; left: 13px; top: 15px; width: 9px; height: 9px; border-radius: 50%; background: var(--border); }
#sidebar .rail li.done::before { background: var(--ok); }
#sidebar .rail li.done .lv { color: var(--ok); }
#sidebar .rail li.cur { background: var(--accent-subtle); }
#sidebar .rail li.cur::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }
#sidebar .rail li.cur .lv { color: var(--accent); }
#sidebar .rail li a { color: inherit; text-decoration: none; display: block; margin: -11px -12px -11px -34px; padding: 11px 12px 11px 34px; border-radius: var(--p-radius-sm); }
#sidebar .rail li.viewing { outline: 2px solid var(--ok); outline-offset: -2px; }

.phase { font-weight: var(--p-weight-semibold); font-size: var(--p-text-17); margin-bottom: var(--p-size-1); }
.phase-desc { color: var(--fg-muted); font-size: var(--p-text-15); }
.goal { font-size: var(--p-text-16); }
.wydh ol { list-style: none; margin: 0; padding: 0; }
.wydh > ol > li { font-weight: var(--p-weight-semibold); margin-bottom: var(--p-size-1); }
.wydh ul { list-style: none; margin: var(--p-size-1) 0 var(--s-space-xs) var(--s-space-md); padding: 0; font-weight: var(--p-weight-regular); }
.wydh ul li { margin: var(--p-size-1) 0; position: relative; padding-left: 0.9rem; }
.wydh ul li::before { content: "•"; position: absolute; left: 0; color: var(--accent); }

.gate-row { display: flex; align-items: flex-start; gap: var(--s-space-xs); margin: 7px 0; font-size: var(--p-text-15); }
.gate-row.muted { color: var(--fg-muted); }
.tick { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; font-size: 0.7rem; color: #fff; margin-top: 1px; }
.tick.ok { background: var(--ok); }
.tick.no { background: var(--border); color: var(--fg-muted); }

.flag { margin-top: var(--s-space-sm); padding: 11px 14px; border: 1px solid var(--warn-border); background: var(--warn-bg); color: var(--warn); font-size: var(--p-text-14); border-radius: var(--s-radius-subtle); }
.flag b { color: var(--warn); }

.assets { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-space-sm); }
.asset { border: 1px solid var(--border-subtle); border-radius: var(--p-radius-sm); padding: var(--s-space-md); font-size: var(--p-text-15); background: var(--s-surface-raised); }
.asset b { display: block; margin-bottom: 3px; }
.asset a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; font-size: var(--p-text-14); font-weight: var(--p-weight-medium); }
.asset a:hover { text-decoration-thickness: 2px; }
@media (max-width: 560px) { .assets { grid-template-columns: 1fr; } }

/* Chips — pill capsules. Ghost by default; .chip.primary is the one blessed
   action (olive). Keeps the dashboard from showing competing CTAs. */
.always { display: flex; gap: var(--s-space-xs); flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center;
  margin: var(--p-size-1) var(--p-size-1) var(--p-size-1) 0;
  padding: var(--p-size-2) var(--s-space-md);
  border: 1px solid var(--border-subtle);
  border-radius: var(--s-radius-control);
  font-size: var(--p-text-14);
  font-weight: var(--p-weight-semibold);
  color: var(--fg);
  text-decoration: none;
  background: var(--s-surface-sunken);
  transition: background-color var(--s-motion-hover), color var(--s-motion-hover), border-color var(--s-motion-hover);
}
.chip:hover { border-color: var(--s-border-strong); color: var(--accent); }
.chip.primary { background: var(--s-action-primary-bg); color: var(--s-action-primary-fg); border-color: transparent; box-shadow: var(--s-shadow-sm); }
.chip.primary:hover { background: var(--s-action-primary-bg-hover); color: var(--s-action-primary-fg); }
/* Chip text color must out-specify the broad `#content a` link rule (ID-level,
   olive --accent). Without this, every chip is forced to olive — fine on the
   cream ghost chips, but olive-on-olive (invisible) on the .primary chip. Re-
   assert the intended chip colors at #content specificity. */
#content .chip { color: var(--fg); text-decoration: none; }
#content .chip:hover { color: var(--accent); }
#content .chip.primary,
#content .chip.primary:hover { color: var(--s-action-primary-fg); }

.next { border: 1px dashed var(--border); border-radius: var(--s-radius-panel); padding: var(--s-space-md) var(--s-space-xl); margin: 0 0 var(--s-space-md); background: transparent; }
.next .lv { font-weight: var(--p-weight-semibold); font-size: var(--p-text-16); margin: var(--p-size-1) 0; }
.lad { font-size: var(--p-text-14); margin: 9px 0; }
.lad b { color: var(--fg); }

/* ── SOP reference (/sops/): search + situation index + cards ─────────────*/
.sop-toolbar { margin: var(--s-space-lg) 0 var(--s-space-md); }
#sop-search {
  width: 100%;
  font-family: var(--p-font-body);
  font-size: var(--p-text-16);
  padding: var(--s-space-sm) var(--s-space-lg);
  min-height: 48px;
  color: var(--fg);
  background: var(--s-surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--s-radius-control);
  box-shadow: var(--s-shadow-sm);
}
#sop-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-subtle); }

.situations {
  background: var(--s-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--s-radius-panel);
  box-shadow: var(--s-shadow-sm);
  padding: var(--s-space-lg) var(--s-space-xl) var(--s-space-sm);
  margin: 0 0 var(--s-space-2xl);
}
#content .situations h2 {
  margin: 0 0 var(--s-space-sm);
  font-size: var(--p-text-12);
  text-transform: uppercase;
  letter-spacing: var(--p-ls-wide);
  color: var(--fg-muted);
  font-weight: var(--p-weight-semibold);
  font-family: var(--p-font-body);
}
.sit-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-space-md);
  padding: var(--s-space-sm) 0;
  border-top: 1px solid var(--border-subtle);
  color: var(--fg);
  text-decoration: none;
}
.situations h2 + .sit-row { border-top: none; }
.sit-row:hover { color: var(--accent); }
.sit-what { flex: 1; min-width: 0; font-weight: var(--p-weight-medium); }
.sit-go { color: var(--accent); font-weight: var(--p-weight-semibold); font-size: var(--p-text-14); white-space: nowrap; }
@media (max-width: 700px) {
  .sit-row { flex-direction: column; align-items: flex-start; gap: 2px; }
  .sit-go { white-space: normal; }
}

.sop-card {
  background: var(--s-surface-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--s-radius-panel);
  box-shadow: var(--s-shadow-sm);
  padding: var(--s-space-lg) var(--s-space-xl) var(--s-space-xl);
  margin: 0 0 var(--s-space-lg);
  scroll-margin-top: 24px;
}
.sop-head { display: flex; flex-direction: column; gap: var(--s-space-xs); margin-bottom: var(--s-space-sm); }
#content .sop-head h2 { margin: 0; border: none; }
.sop-badge {
  align-self: flex-start;
  font-size: var(--p-text-11); font-weight: var(--p-weight-semibold);
  text-transform: uppercase; letter-spacing: var(--p-ls-wide);
  padding: 3px 10px; border-radius: var(--s-radius-control);
}
.sop-badge--ok   { color: #2f6b3d; background: #e6f0e6; }
.sop-badge--wait { color: var(--warn); background: var(--warn-bg); }
.sop-badge--stop { color: var(--s-accent-strong); background: #f6e3df; }
.sop-card .sop-xref { font-weight: var(--p-weight-semibold); }
.sop-empty { color: var(--fg-muted); font-style: italic; }
@media (max-width: 700px) { .sop-card { scroll-margin-top: 72px; } }

/* ── Inline audio play buttons (olive, design-system) ─────────────────────*/
.audio-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; margin-right: 6px; padding: 0;
  border: 1px solid var(--accent);
  border-radius: 50%;
  background: var(--s-surface-raised);
  color: var(--fg);
  font-size: 11px; line-height: 1; cursor: pointer; vertical-align: middle;
  transition: background-color var(--s-motion-hover), transform var(--s-motion-press);
}
.audio-btn:hover { background: var(--accent-subtle); }
.audio-btn:active { transform: scale(0.95); }
.audio-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.audio-btn[data-playing="true"] { background: var(--accent); color: var(--s-action-primary-fg); }
