/* ═══ Generated handbook pages (backend/cmd/guidegen) ═══════════════════════
   Layered on guide.css, which was written for the hand-built legacy pages
   and resets every margin/padding to 0. Everything here is scoped to
   body.gpage so the legacy atlas and detail pages are untouched.

   Reading model: paper content column (~70ch) with the section list in a
   sticky left rail on wide screens, a collapsible list on phones. Only the
   blocks that carry a decision or a warning are lifted; prose sits flat. */

.gpage {
  --measure: 46rem;
  --rail: 15.5rem;
  font-size: 1.0625rem;
}

/* ── Chrome header ─────────────────────────────────────────────────────── */
.gpage .ghead {
  padding: 22px 0 30px;
}
.gpage .ghead .wrap {
  display: grid;
  gap: 14px;
}
.gpage .ghead .back {
  justify-self: start;
}
.gpage .ghead h1 {
  margin: 4px 0 0;
  font-size: clamp(1.9rem, 4.6vw, 3rem);
  line-height: 1.15;
  text-wrap: balance;
}
.gpage .ghead .lede-roles {
  color: #b6c2d1;
  font-size: 0.9rem;
}

/* ── Layout: rail + column ─────────────────────────────────────────────── */
.gpage .glayout {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding-top: 28px;
  padding-bottom: 72px;
}
.gpage .gside {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  display: grid;
  gap: 18px;
  padding-bottom: 12px;
}
.gpage .gmain {
  min-width: 0;
  max-width: var(--measure);
}

/* search sits at the top of the rail; results drop under it */
.gpage .searchbar {
  padding: 0;
}
.gpage .searchbar input {
  font-size: 0.92rem;
}

/* section list */
.gpage .toc {
  position: static;
  background: none;
  backdrop-filter: none;
  border: 0;
  padding: 0;
}
.gpage .toc summary {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
  list-style: none;
  padding: 4px 0 8px;
}
.gpage .toc summary::-webkit-details-marker {
  display: none;
}
.gpage .toc .tlist {
  display: grid;
  gap: 1px;
  border-left: 1px solid var(--line-warm);
}
.gpage .toc .tchip {
  display: block;
  background: none;
  border: 0;
  border-radius: 0;
  border-left: 2px solid transparent;
  margin-left: -1px;
  padding: 5px 0 5px 12px;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--ink-soft);
}
.gpage .toc .tchip:hover {
  background: none;
  color: var(--teal);
  border-left-color: var(--teal-deep);
}
.gpage .toc .tchip.on {
  color: var(--teal-ink);
  font-weight: 600;
  border-left-color: var(--teal);
}

/* ── Prose ─────────────────────────────────────────────────────────────── */
.gpage .gmain > p,
.gpage .fsec > p,
.gpage .blk p {
  margin: 0 0 14px;
}
.gpage .gmain > p:first-child {
  font-size: 1.12rem;
  color: var(--ink-soft);
}
.gpage .gmain a {
  color: var(--teal);
  text-decoration: underline;
  text-decoration-color: color-mix(in oklab, var(--teal) 35%, transparent);
  text-underline-offset: 3px;
}
.gpage .gmain a:hover {
  text-decoration-color: var(--teal);
}
.gpage .gmain strong {
  font-weight: 600;
  color: var(--ink);
}
.gpage .gmain ul,
.gpage .gmain ol {
  margin: 0 0 16px;
  padding-left: 1.4em;
  display: grid;
  gap: 6px;
}
.gpage .gmain li > ul,
.gpage .gmain li > ol {
  margin: 6px 0 0;
}
.gpage .gmain code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--paper-deep);
  border: 1px solid var(--line-warm);
  border-radius: 4px;
  padding: 0 5px;
}

/* sections: flat, separated by a rule — not cards */
.gpage .fsec {
  background: none;
  border: 0;
  border-top: 1px solid var(--line-warm);
  border-radius: 0;
  box-shadow: none;
  padding: 34px 0 6px;
  margin: 0;
  scroll-margin-top: 16px;
}
.gpage .gmain > .fsec:first-of-type {
  margin-top: 18px;
}
.gpage .fsec h2 {
  font-size: clamp(1.35rem, 2.6vw, 1.65rem);
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 14px;
  text-wrap: balance;
}
.gpage .fsec h3 {
  font-size: 1.08rem;
  font-weight: 600;
  margin: 24px 0 10px;
  scroll-margin-top: 16px;
}
.gpage .fsec h4 {
  font-size: 0.98rem;
  font-weight: 600;
  margin: 18px 0 8px;
}

/* the page's "one idea" and any other quote = key callout */
.gpage blockquote {
  margin: 4px 0 20px;
  padding: 14px 18px;
  background: var(--teal-wash);
  color: var(--teal-ink);
  border-radius: var(--r-md);
}
.gpage blockquote p {
  margin: 0;
}
.gpage blockquote strong {
  color: var(--teal-ink);
}

/* ── Tables ───────────────────────────────────────────────────────────── */
.gpage .gmain table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 20px;
  font-size: 0.93rem;
  line-height: 1.55;
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--r-md);
  overflow: hidden;
  display: table;
}
.gpage .gmain th,
.gpage .gmain td {
  text-align: left;
  vertical-align: top;
  padding: 9px 12px;
  border-top: 1px solid var(--line-warm);
}
.gpage .gmain thead th {
  border-top: 0;
  background: var(--paper-deep);
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.gpage .gmain th[align='center'],
.gpage .gmain td[align='center'] {
  text-align: center;
}

/* ── Directive blocks ─────────────────────────────────────────────────── */
.gpage .blk {
  margin: 6px 0 22px;
}
.gpage .blk > h3 {
  margin: 0 0 10px;
}
/* block labels are Thai: no letter-spacing or uppercase (both damage Thai) */
.gpage .blk::before {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 8px;
}

/* steps: numbered discs */
.gpage .blk.steps ol {
  list-style: none;
  padding: 0;
  counter-reset: st;
  gap: 10px;
}
.gpage .blk.steps ol > li {
  counter-increment: st;
  position: relative;
  padding-left: 40px;
  min-height: 28px;
}
.gpage .blk.steps ol > li::before {
  content: counter(st);
  position: absolute;
  left: 0;
  top: 1px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

/* decision: the state → action table is the whole point, so it's lifted */
.gpage .blk.decision::before {
  content: 'เลือกตามสถานะตอนนี้';
  color: var(--teal);
}
.gpage .blk.decision table {
  box-shadow: var(--shadow);
  border-color: var(--line-strong);
}
.gpage .blk.decision td:first-child {
  font-weight: 600;
  background: color-mix(in oklab, var(--paper-deep) 55%, var(--card));
}

/* gotcha */
.gpage .blk.got {
  background: var(--amber-wash);
  border: 1px solid color-mix(in oklab, var(--amber) 40%, transparent);
  border-radius: var(--r-md);
  padding: 14px 18px;
}
.gpage .blk.got::before {
  content: '⚠ ระวัง';
  color: var(--amber-ink);
}
.gpage .blk.got,
.gpage .blk.got strong {
  color: var(--amber-ink);
}
.gpage .blk.got p:last-child,
.gpage .blk.got ul:last-child {
  margin-bottom: 0;
}

/* scenario: a worked example */
.gpage .blk.scenario {
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--r);
  padding: 18px 20px 6px;
  box-shadow: var(--shadow-sm);
}
.gpage .blk.scenario::before {
  content: 'ตัวอย่างจริง';
  color: var(--cyan);
}

/* flow: one line of arrows, scrolls sideways on a phone instead of wrapping */
.gpage .blk.flow {
  background: var(--paper-deep);
  border-radius: var(--r-md);
  padding: 12px 16px;
  overflow-x: auto;
}
.gpage .blk.flow p {
  margin: 0;
  white-space: nowrap;
  font-weight: 500;
}

/* ── Report footer ─────────────────────────────────────────────────────── */
.gpage footer.report {
  margin-top: 40px;
  padding: 22px 24px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--r);
  color: var(--ink);
  font-size: 0.95rem;
  display: grid;
  gap: 12px;
}
.gpage footer.report h3 {
  font-size: 1.1rem;
}
.gpage footer.report ol {
  margin: 0;
  padding-left: 1.3em;
  display: grid;
  gap: 8px;
}
.gpage footer.report .btn {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  text-decoration: none;
  border-radius: var(--r-md);
  padding: 8px 16px;
  font-weight: 600;
}
.gpage footer.report .btn:hover {
  background: var(--teal-deep);
}
.gpage footer.report code {
  font-family: var(--font-mono);
  font-size: 0.85em;
}

/* ── Phone / tablet ────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .gpage {
    font-size: 1rem;
  }
  .gpage .glayout {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding-top: 18px;
  }
  .gpage .gside {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .gpage .toc {
    background: var(--card);
    border: 1px solid var(--line-warm);
    border-radius: var(--r-md);
    padding: 4px 14px;
  }
  .gpage .toc summary {
    padding: 10px 0;
    min-height: 44px;
    display: flex;
    align-items: center;
  }
  .gpage .toc summary::after {
    content: '▾';
    margin-left: auto;
  }
  .gpage .toc[open] summary::after {
    content: '▴';
  }
  .gpage .toc .tlist {
    padding-bottom: 10px;
  }
  .gpage .toc .tchip {
    padding: 8px 0 8px 12px;
  }
  /* wide tables scroll inside themselves, never the page */
  .gpage .gmain table {
    display: block;
    overflow-x: auto;
  }
}

@media print {
  .gpage .gside,
  .gpage footer.report .btn {
    display: none;
  }
  .gpage .glayout {
    display: block;
  }
}

/* ═══ Round 2: type, signposts, doors, related ═════════════════════════════ */

/* Self-hosted IBM Plex Sans Thai (OFL, fonts/LICENSE-OFL.txt). Thai and
   Latin subsets split by unicode-range so a page only fetches what it uses;
   swap keeps text readable on slow clinic wifi before the font lands. */
@font-face {
  font-family: 'Plex Thai';
  font-weight: 400;
  font-display: swap;
  src: url(fonts/plex-thai-thai-400.woff2) format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Plex Thai';
  font-weight: 500;
  font-display: swap;
  src: url(fonts/plex-thai-thai-500.woff2) format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Plex Thai';
  font-weight: 600;
  font-display: swap;
  src: url(fonts/plex-thai-thai-600.woff2) format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Plex Thai';
  font-weight: 700;
  font-display: swap;
  src: url(fonts/plex-thai-thai-700.woff2) format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Plex Thai';
  font-weight: 400;
  font-display: swap;
  src: url(fonts/plex-thai-latin-400.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plex Thai';
  font-weight: 500;
  font-display: swap;
  src: url(fonts/plex-thai-latin-500.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plex Thai';
  font-weight: 600;
  font-display: swap;
  src: url(fonts/plex-thai-latin-600.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plex Thai';
  font-weight: 700;
  font-display: swap;
  src: url(fonts/plex-thai-latin-700.woff2) format('woff2');
  unicode-range:
    U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC,
    U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

.gpage {
  --font-sans: 'Plex Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Plex Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-family: var(--font-sans);
  line-height: 1.75;
}
.gpage h1,
.gpage h2,
.gpage h3,
.gpage h4 {
  letter-spacing: 0; /* negative tracking crowds Thai tone marks */
}

/* header: who the page is for */
.gpage .ghead .for {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: #b6c2d1;
  font-size: 0.9rem;
}
.gpage .ghead .rchip {
  background: rgba(45, 212, 191, 0.12);
  color: #ccfbf1;
  border: 1px solid rgba(45, 212, 191, 0.28);
  border-radius: 999px;
  padding: 1px 10px;
  font-size: 0.84rem;
}

/* signposts: where to go next, and what if it didn't go that way */
.gpage p.next,
.gpage p.ifnot {
  padding: 10px 14px;
  border-radius: var(--r-md);
  font-size: 0.97rem;
}
.gpage p.next {
  background: var(--teal-wash);
  color: var(--teal-ink);
}
.gpage p.next strong {
  color: var(--teal-ink);
}
.gpage p.ifnot {
  background: var(--paper-deep);
}

/* section copy-link: quiet until the heading is hovered or focused */
.gpage .copylink {
  margin-left: 10px;
  vertical-align: middle;
  font: 500 0.74rem/1 var(--font-sans);
  color: var(--ink-faint);
  background: none;
  border: 1px solid var(--line-warm);
  border-radius: 999px;
  padding: 5px 10px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.gpage .fsec h2:hover .copylink,
.gpage .copylink:focus-visible {
  opacity: 1;
}
.gpage .copylink:hover {
  color: var(--teal);
  border-color: var(--teal-deep);
}
@media (hover: none) {
  .gpage .copylink {
    opacity: 1;
  }
}

/* doors: the front door's four roles as big tap targets */
.gpage .blk[data-kind='doors'] ul {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.gpage .blk[data-kind='doors'] li {
  position: relative;
  display: grid;
  gap: 6px;
  align-content: start;
  padding: 18px 20px 20px;
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--r);
  color: var(--ink-soft);
  font-size: 0.92rem;
  line-height: 1.6;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}
.gpage .blk[data-kind='doors'] li a {
  font-size: 1.18rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.35;
}
.gpage .blk[data-kind='doors'] li a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.gpage .blk[data-kind='doors'] li:hover,
.gpage .blk[data-kind='doors'] li:focus-within {
  border-color: var(--teal-deep);
  box-shadow: var(--shadow);
}
.gpage .blk[data-kind='doors'] li:hover a {
  color: var(--teal);
}

/* related pages at the end of every page */
.gpage .related {
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--line-warm);
  display: grid;
  gap: 12px;
}
.gpage .related h2 {
  font-size: 1.15rem;
  font-weight: 700;
}
.gpage .related .rgrid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.gpage .related a {
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--r-md);
  padding: 8px 14px;
  font-size: 0.93rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
}
.gpage .related a:hover {
  border-color: var(--teal-deep);
  color: var(--teal);
}

@media (max-width: 640px) {
  .gpage .blk[data-kind='doors'] ul {
    grid-template-columns: minmax(0, 1fr);
  }
}
.gpage p.ifnot-label {
  margin: 18px 0 8px;
  font-size: 1rem;
}
/* the heading above already names it; the block label would repeat it */
.gpage p.ifnot-label + .blk.decision::before {
  display: none;
}
.gpage .ghead .wrap > h1:first-child {
  margin-top: 26px;
}

/* ═══ Task cards + role paths (backend/cmd/guidegen: task.html / path.html) ═══
   Task cards: NO left search/TOC rail — a single centered column, search
   moved into a compact header input (results drop as an overlay beneath
   it). Per stage: screenshot on top at full column width (this is what
   keeps on-screen text legible — the shot is captured at ~the same width
   it's displayed, not shrunk into a side-by-side layout), numbered steps
   below it, in a two-column grid once the column is wide enough. Orange
   (not a --token) is deliberate: it's the one accent this system reserves
   for "tap here", never reused for status/semantic colour elsewhere in
   the guide. */

.gpage .wrap.task {
  max-width: 64rem;
}
/* the content wrap only (the header's own .wrap.task sits inside .ghead,
   which owns its own padding) — no more rail, so this replaces the
   padding .glayout used to supply. */
.gpage > .wrap.task {
  padding-top: 28px;
  padding-bottom: 72px;
}
.gpage .wrap.path {
  max-width: 60rem;
}
.gpage .ghead .wrap.task {
  display: grid;
  gap: 10px;
}
.gpage .ghead-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.gpage .ghead-titles {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.gpage .ghead .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: #b6c2d1;
  font-size: 0.9rem;
  margin-top: 6px;
}
.gpage .ghead .meta span {
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.28);
  color: #ccfbf1;
  border-radius: 999px;
  padding: 1px 10px;
}
.gpage .ghead .crumb {
  margin: 8px 0 0;
  color: #b6c2d1;
  font-size: 0.85rem;
}

/* header search: compact input, results as a floating overlay panel so the
   header never grows to fit them (task.html keeps the #guide-q/#guide-results
   ids search.js expects — only their position moved). */
.gpage .searchbar-compact {
  position: relative;
  width: min(21rem, 100%);
  flex: 0 0 auto;
}
.gpage .searchbar-compact input {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(182, 194, 209, 0.35);
  color: #fff;
}
.gpage .searchbar-compact input::placeholder {
  color: #b6c2d1;
}
.gpage .searchbar-compact #guide-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 40;
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  max-height: 60vh;
  overflow-y: auto;
  text-align: left;
  color: var(--ink);
}
.gpage .searchbar-compact #guide-results:empty {
  display: none;
  border: 0;
  padding: 0;
  box-shadow: none;
}

/* The base .gmain rule caps prose measure at --measure (46rem) — exactly
   the bug this wave fixes: that cap was silently shrinking every task
   screenshot to 46rem regardless of the page's own 64rem column. Task
   pages aren't prose, so they opt out of the measure cap entirely. */
.gpage .gmain.task {
  max-width: none;
}
.gpage .gmain.task .goal {
  font-size: 1.15rem;
  margin: 0 0 22px;
  color: var(--ink-soft);
}
.gpage .gmain.task .goal b {
  color: var(--ink);
}

.gpage .stage {
  display: grid;
  gap: 18px;
  padding: 26px 0;
  border-top: 1px solid var(--line-warm);
}
.gpage .gmain.task > .stage:first-of-type {
  margin-top: 0;
  border-top: 0;
  padding-top: 4px;
}
.gpage .stage h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0 0 4px;
}
.gpage .stage .where {
  color: var(--ink-faint);
  font-size: 0.9rem;
  margin: 0 0 14px;
}
.gpage .stage .where b {
  color: var(--ink-soft);
}
.gpage .shot {
  position: relative;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  background: #fff;
  width: 100%;
}
.gpage .shot img {
  display: block;
  width: 100%;
  height: auto;
}
.gpage .pin {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  display: grid;
  place-items: center;
  box-shadow:
    0 0 0 4px rgba(249, 115, 22, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.25);
}
.gpage .ring {
  position: absolute;
  border: 3px solid #f97316;
  border-radius: 8px;
  box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.18);
  pointer-events: none;
}
.gpage .steps2 {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px 28px;
  counter-reset: s;
}
/* two-column grid once the single centered column is wide enough to hold
   it without cramping either step (spec: "steps under it in a two-column
   grid on wide screens"). */
@media (min-width: 1100px) {
  .gpage .steps2 {
    grid-template-columns: 1fr 1fr;
  }
}
.gpage .steps2 li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  font-size: 1.02rem;
  line-height: 1.6;
}
.gpage .steps2 .n {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #f97316;
  color: #fff;
  font-weight: 700;
  display: grid;
  place-items: center;
  font-size: 0.92rem;
}
.gpage .steps2 small {
  display: block;
  color: var(--ink-faint);
  font-size: 0.86rem;
}
.gpage .wrap.task b,
.gpage .wrap.path b,
.gpage .gmain.task b,
.gpage .gmain.path b {
  font-weight: 700;
  color: var(--ink);
}
.gpage p.done {
  background: var(--teal-wash);
  color: var(--teal-ink);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 8px 0 22px;
  font-size: 1.02rem;
}
.gpage p.done b {
  color: var(--teal-ink);
}
.gpage p.done .nextline {
  font-size: 0.93rem;
}
.gpage details.stuck {
  border: 1px solid var(--line-warm);
  border-radius: 10px;
  background: var(--card);
  margin: 0 0 12px;
}
.gpage details.stuck summary {
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  min-height: 44px;
}
.gpage details.stuck > div {
  padding: 0 16px 14px;
  color: var(--ink-soft);
}
.gpage p.more {
  font-size: 0.95rem;
}
.gpage .tasknav {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 24px 0 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line-warm);
}
.gpage .tasknav a {
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-warm);
  border-radius: var(--r-md);
  padding: 10px 16px;
  font-size: 0.93rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.gpage .tasknav a:hover {
  border-color: var(--teal-deep);
  color: var(--teal);
}
.gpage .tasknav .next {
  margin-left: auto;
}

/* Level-0 journey strip: one clinic day. A 5-column grid on desktop (no
   horizontal scroll ≥ 900px — spec) that collapses to the old
   horizontal-scroll strip on phones (same technique as .blk.flow), since
   5 equal columns would crush to illegibility on a phone width. */
.gpage .blk[data-kind='journey'] {
  margin: 6px 0 26px;
}
.gpage .blk[data-kind='journey'] .jsteps {
  list-style: none;
  margin: 0;
  padding: 4px 2px 10px;
  display: flex;
  gap: 18px;
  overflow-x: auto;
  scroll-snap-type: x proximity;
}
.gpage .blk[data-kind='journey'] .jstep {
  flex: 0 0 auto;
  width: 9.5rem;
  display: grid;
  gap: 6px;
  scroll-snap-align: start;
}
@media (min-width: 900px) {
  .gpage .blk[data-kind='journey'] .jsteps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding-bottom: 4px;
    overflow-x: visible;
  }
  .gpage .blk[data-kind='journey'] .jstep {
    width: auto;
  }
}
.gpage .blk[data-kind='journey'] .jstep a {
  display: grid;
  gap: 8px;
  text-decoration: none;
  color: var(--ink);
}
.gpage .blk[data-kind='journey'] .jthumb {
  display: block;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--line-warm);
  box-shadow: var(--shadow-sm);
  aspect-ratio: 16 / 10;
  background: var(--paper-deep);
}
.gpage .blk[data-kind='journey'] .jthumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
/* every step now always renders a .jthumb — a real screenshot, or a
   placeholder tile when no task card has been captured for it yet (spec:
   "steps without a task thumbnail get a neutral placeholder tile ... so
   the row stays aligned"). */
.gpage .blk[data-kind='journey'] .jthumb-placeholder {
  display: grid;
  place-items: center;
  padding: 10px;
  text-align: center;
  border-style: dashed;
}
.gpage .blk[data-kind='journey'] .jph-role {
  font-size: 0.74rem;
  line-height: 1.35;
  font-weight: 600;
  color: var(--ink-faint);
}
.gpage .blk[data-kind='journey'] .jn {
  position: relative;
  margin-top: -22px;
  margin-left: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 700;
  font-size: 0.8rem;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.3);
}
.gpage .blk[data-kind='journey'] .jlabel {
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.35;
}
.gpage .blk[data-kind='journey'] .jstep a:hover .jlabel {
  color: var(--teal);
}
.gpage .blk[data-kind='journey'] .jrole {
  display: block;
  color: var(--ink-faint);
  font-size: 0.82rem;
  line-height: 1.4;
}

/* Level-1 role path: numbered checklist + thumbnail per task row. Numbers
   are rendered server-side (pathRowView.Idx), continuous across every
   stage's own <ol> — a per-<ol> CSS counter-reset (the previous approach)
   restarted at 1 each stage instead of matching a task card's own
   "งานที่ n จาก N" breadcrumb, which counts across the whole path. */
.gpage .gmain.path .intro {
  font-size: 1.12rem;
  color: var(--ink-soft);
  margin: 0 0 4px;
}
.gpage .gmain.path .progress {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 22px;
  padding: 6px 14px;
  background: var(--teal-wash);
  color: var(--teal-ink);
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.gpage .pathlist {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2px;
}
.gpage .pathrow {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 10px;
  border-radius: var(--r-md);
  cursor: pointer;
}
.gpage .pathrow:hover {
  background: var(--paper-deep);
}
.gpage .pathrow input[type='checkbox'] {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  accent-color: var(--teal);
}
.gpage .pathrow-idx {
  flex: 0 0 auto;
  width: 22px;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  font-size: 0.85rem;
}
.gpage .pathrow .thumb {
  flex: 0 0 auto;
  display: block;
  width: 64px;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line-warm);
  background: var(--paper-deep);
}
.gpage .pathrow .thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}
.gpage .pathrow-body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  min-width: 0;
}
.gpage .pathrow-title {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}
.gpage .pathrow-title:hover {
  color: var(--teal);
  text-decoration: underline;
}
.gpage .pathrow-min {
  color: var(--ink-faint);
  font-size: 0.85rem;
}
.gpage .path-stage h2 {
  font-size: clamp(1.2rem, 2.4vw, 1.4rem);
}
@media (max-width: 640px) {
  .gpage .pathrow .thumb {
    display: none;
  }
}

/* ═══ Start page (Level 0 — the front door): no rail, its own wrap/gmain
   width so the journey grid and door cards get real room. Reuses
   .searchbar-compact / .ghead-row from the task-card header (same
   pattern: search moves out of a left rail into the header). ═══ */
.gpage .wrap.start {
  max-width: 76rem;
}
.gpage .ghead .wrap.start .ghead-row {
  align-items: center;
}
.gpage .gmain.start {
  max-width: none;
}
.gpage > .wrap.start {
  padding-top: 28px;
  padding-bottom: 72px;
}
.gpage .gmain.start > .fsec:first-of-type {
  margin-top: 18px;
}

/* search results in the rail */
.gpage #guide-results h4 {
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-faint);
}
.gpage #guide-results li a {
  display: grid;
  gap: 2px;
  line-height: 1.45;
}
.gpage #guide-results .gs-page {
  font-size: 0.76rem;
  color: var(--ink-faint);
  font-weight: 400;
}

/* task card: the stage says what this screen is for BEFORE showing it */
.gpage .stage-head {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
}
.gpage .stage-head .stage-n {
  font-size: 0.82rem;
  font-weight: 600;
  color: #c2410c;
}
.gpage .stage-head h2 {
  margin: 0;
}
.gpage .stage-head .where {
  margin: 0;
}
