/**
 * Patient-facing product styles (MVP design): dashboard, modules, activities,
 * assessments. PRODUCT stylesheet — loaded by real patient pages and by the
 * proto viewer screens that render those same pages from mock data.
 * Depends on tokens.css + base.css + primitives.css.
 *
 * Metrics from the MVP export: hero gradient card (light #77d3ff at the
 * bottom up to deep #007fbb), white cards radius 32, module tiles radius 24
 * with tinted photo heads and DM Sans 900 labels, gradient progress meters.
 */

.pat-card {
  background: #fff;
  border-radius: 2rem;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
}

.pat-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-6); /* MVP: 24px between dashboard rows */
}

.pat-home {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* --- hero ------------------------------------------------------------------ */

.pat-hero {
  position: relative;
  overflow: hidden;
  border-radius: 2rem;
  background: linear-gradient(0deg, #77d3ff, #007fbb);
  padding: 3rem;
  color: #fff;
}

.pat-hero-started {
  position: absolute;
  right: 3rem;
  top: 2.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.875rem;
}

.pat-hero-content {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.625rem; /* MVP 42px between copy and progress */
}

.pat-hero-copy {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pat-hero-greeting {
  font-weight: 600;
  font-size: 1.375rem; /* MVP 22px */
}

.pat-hero-title {
  margin: 0;
  font-weight: 700;
  font-size: 2.875rem; /* MVP 46px */
  line-height: 1;
  letter-spacing: -0.02em;
  color: #fff;
}

.pat-hero-body {
  font-size: var(--text-md);
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  max-width: 47.5rem; /* MVP 760px */
}

.pat-hero-progress {
  height: 1rem;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.pat-hero-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: #fff;
}

.pat-week-labels {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  column-gap: var(--space-3);
  margin-top: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem; /* MVP 13px */
  color: rgba(255, 255, 255, 0.9);
}

.pat-week-labels > :first-child {
  grid-column: 1;
  justify-self: start;
  white-space: nowrap;
}

.pat-week-labels > :last-child {
  grid-column: 3;
  justify-self: end;
  text-align: right;
  white-space: nowrap;
}

.pat-hero-note {
  grid-column: 2;
  justify-self: center;
  margin: 0;
  text-align: center;
  font-weight: 600;
  font-size: inherit;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.92);
}

/* --- prompt bar (take pre-assessment) -------------------------------------- */

.pat-prompt {
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* --- welcome-module row ----------------------------------------------------- */

.pat-welcome {
  padding: var(--space-6) 2rem;
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-wrap: wrap;
}

.pat-welcome-img {
  width: 7.5rem;
  height: 4.75rem;
  object-fit: cover;
  border-radius: 0.75rem;
  flex-shrink: 0;
}

.pat-welcome-copy {
  flex: 1;
  min-width: 14rem;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.pat-welcome-title {
  font-weight: 700;
  font-size: 1.25rem;
}

.pat-welcome-body {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* --- progress meters (gradient fill, MVP 90deg accent→sky) ------------------ */

.pat-meter {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

/* in a meter row the track takes the remaining width; standalone tracks
   (sidebar cards, column layouts) must NOT flex — a 0-basis in a column
   container collapses their height to nothing */
.pat-meter .pat-progress {
  flex: 1;
}

.pat-progress {
  height: 0.5rem;
  border-radius: var(--radius-pill);
  background: var(--fill);
  overflow: hidden;
}

.pat-progress--md {
  height: 0.625rem; /* MVP 10px on the welcome row */
}

.pat-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent-grad-bar);
}

.pat-meter-pct {
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}

/* --- module tiles ------------------------------------------------------------ */

.pat-section-title {
  margin: var(--space-2) 0 0;
  font-weight: 700;
  font-size: 1.5rem; /* MVP 24px */
}

.pat-tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* MVP: strict 3-up */
  gap: var(--space-6);
}

@media (width < 64rem) {
  .pat-tile-grid {
    grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  }
}

.pat-tile {
  border-radius: var(--radius-xl); /* MVP tiles are 24px, not 32 */
  background: #fff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pat-tile-head {
  position: relative;
  height: 9.375rem; /* MVP 150px */
  overflow: hidden;
}

.pat-tile-head img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pat-tile-tint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
}

.pat-tile-label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 1.625rem; /* MVP 26px */
  line-height: 1.05;
  color: #fff;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* MVP tile tints (180deg photo washes) */
.pat-tile-tint--blue   { background: linear-gradient(180deg, rgba(0, 127, 187, 0.35), rgba(0, 159, 235, 0.65)); }
.pat-tile-tint--green  { background: linear-gradient(180deg, rgba(0, 179, 90, 0.35), rgba(0, 179, 90, 0.62)); }
.pat-tile-tint--slate  { background: linear-gradient(180deg, rgba(84, 95, 113, 0.35), rgba(38, 59, 128, 0.66)); }
.pat-tile-tint--clay   { background: linear-gradient(180deg, rgba(211, 86, 55, 0.35), rgba(211, 86, 55, 0.62)); }
.pat-tile-tint--purple { background: linear-gradient(180deg, rgba(120, 90, 170, 0.4), rgba(90, 60, 150, 0.66)); }
.pat-tile-tint--deep   { background: linear-gradient(180deg, rgba(0, 127, 187, 0.4), rgba(21, 96, 130, 0.7)); }

.pat-tile-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  flex-grow: 1;
}

.pat-tile-week {
  font-weight: 700;
  font-size: var(--text-lg);
}

.pat-tile-body .button {
  margin-top: auto; /* button pinned to tile bottom across unequal bodies */
}

/* --- messages from the clinics, two columns like a mail app (proposal, Micah 2026-11-02) */

.mail {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) 1fr;
  min-height: 32rem;
  overflow: hidden;
}

.mail-list {
  border-right: 1px solid var(--line);
  overflow-y: auto;
}

.pat-inbox-lede {
  margin: var(--space-2) 0 0;
  color: var(--muted);
}

.mail-list ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* rows sit flush, so the open one's highlight has no gap above it */
.mail-list li {
  margin: 0;
}

.mail-row {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: var(--space-4) var(--space-6);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
}

.mail-row:hover {
  background: var(--accent-soft);
}

.mail-row.is-open {
  background: var(--accent-soft);
  box-shadow: inset 4px 0 0 var(--accent);
}

.mail-row-top {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: var(--text-sm);
}

.mail-row-from {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 650;
}

.mail-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: var(--accent-ink);
}

.mail-row-sent {
  color: var(--muted);
  white-space: nowrap;
}

.mail-row-subject {
  font-weight: 600;
}

.mail-row.is-new .mail-row-subject {
  font-weight: 800;
}

.mail-row-snippet {
  color: var(--muted);
  font-size: var(--text-sm);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mail-reader {
  padding: 2rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  overflow-y: auto;
}

.mail-reader--none {
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.mail-back {
  display: none;
}

.mail-reader-body {
  max-width: 42rem;
}

.pat-inbox-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  color: var(--muted);
}

.pat-inbox-from {
  font-weight: 650;
}

.pat-inbox-sent::before {
  content: "\00B7";
  margin-right: var(--space-3);
}

.pat-inbox-subject {
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
}

.pat-inbox-body {
  margin: 0;
  font-size: var(--text-md);
  line-height: 1.6;
}

.pat-inbox-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-6);
  margin-top: var(--space-2);
}

.pat-inbox-empty {
  margin: 0;
  padding: 2rem;
  color: var(--muted);
}

/* phones: the list and the open message take turns */
@media (width < 48rem) {
  .mail {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .mail-list {
    border-right: 0;
  }

  .mail.is-reading .mail-list,
  .mail:not(.is-reading) .mail-reader {
    display: none;
  }

  .mail-reader {
    padding: 1.5rem;
  }

  .mail-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 600;
  }

  .mail-back svg {
    width: 1.1em;
    height: 1.1em;
  }
}

/* --- encouragement ------------------------------------------------------------ */

.pat-encourage {
  padding: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.pat-encourage-img {
  width: 17.5rem;
  height: 10.625rem;
  object-fit: cover;
  border-radius: var(--radius-lg);
  flex-shrink: 0;
}

.pat-encourage-copy {
  flex: 1;
  min-width: 16rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.pat-encourage-kicker {
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.pat-encourage-title {
  font-weight: 700;
  font-size: 1.5rem;
}

.pat-encourage-body {
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--muted);
}

@media (width < 40rem) {
  .pat-hero {
    padding: var(--space-6);
  }
  .pat-hero-started {
    position: static;
    display: block;
    margin-bottom: var(--space-2);
  }
  .pat-hero-title {
    font-size: 2rem;
  }
  .pat-week-labels {
    font-size: 0.75rem;
  }
  .pat-hero-note {
    display: none;
  }
}

/* --- module + activity page chrome ------------------------------------------ */

.pat-kicker {
  font-size: var(--text-sm);
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.pat-page-header {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  width: 100%;
  position: relative;
}

.pat-page-title {
  margin: 0; /* h1 default scale: MVP 40/600 tracking tight */
}

/* Phones: the page title shares its row with the back button and, on an
   assessment, the "How to answer" button; a notch smaller so it stays on
   one line (Micah 2026-09-30). */
@media (width < 48rem), (height < 32rem) {
  .pat-page-header {
    gap: var(--space-3);
  }

  .pat-page-header .pat-page-title {
    font-size: 1.625rem; /* 26px */
  }

  /* The up link shrinks from a 64px circle to a plain chevron at the start
     of the kicker line, "‹ Conditions of Hearing Loss", like an iOS back
     label; the title below gets the whole width. It stays: it goes up the
     program, not browser back, and a home-screen app has no browser back
     (Micah 2026-09-30). The tap target stays 44px. */
  /* Everywhere: a slim chevron beside the title, no circle. */
  .pat-page-header > .back-button {
    width: 2rem;
    height: 2.75rem;
    margin-left: -0.5rem;
    background: transparent;
    box-shadow: none;
    font-size: 1.125rem;
  }

  .pat-page-header:has(> .back-button) {
    gap: var(--space-2);
  }

  /* With a kicker line above the title, the chevron moves onto that line
     ("‹ Conditions of Hearing Loss") and the title gets the whole row. */
  .pat-page-header:has(> .back-button):has(.pat-kicker) {
    position: relative;
  }

  .pat-page-header:has(.pat-kicker) > .back-button {
    position: absolute;
    top: -0.8rem;
    left: -0.85rem;
    width: 2.75rem;
    margin-left: 0;
    font-size: 1rem;
    z-index: 1;
  }

  .pat-page-header:has(> .back-button) .pat-kicker {
    padding-left: 1.1rem;
  }

  .pat-page-header:has(> .back-button) .pat-page-titles {
    min-width: 0;
  }
}

.pat-page-titles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Taking: where am I? (Back onto an answered item must still orient) */
.pat-qa-position {
  margin: 0;
  font-size: 1.25rem; /* ~20px — readable at a glance */
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--ink, var(--color-text));
}

.pat-qa-taking {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

/* Fixed Back | Next row — both slots always present so the bar does not jump */
.pat-qa-nav {
  margin-top: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  align-items: center;
  min-height: 3rem;
}

.pat-qa-nav-slot {
  display: flex;
  align-items: center;
}

.pat-qa-nav-slot--start {
  justify-content: flex-start;
}

.pat-qa-nav-slot--end {
  justify-content: flex-end;
}

.pat-qa-nav .button {
  min-width: 7.5rem;
  justify-content: center;
}

.pat-qa-nav .button.is-disabled,
.pat-qa-nav .button[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
  cursor: default;
}

.pat-activity-heading {
  margin: 0;
  min-width: 0;
  font-size: 2rem; /* MVP 32px */
  font-weight: 600;
  letter-spacing: var(--tracking-tight);
}

.pat-page-header-action {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  align-items: center;
}

.pat-card-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem; /* MVP module cards: 24px */
}

.pat-module-card {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-learn-strip {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-6);
}

.pat-learn-strip img {
  flex: none;
  width: calc(13.0625rem * 16 / 9);
  max-width: 100%;
  height: 13.0625rem; /* MVP 209px */
  object-fit: cover;
  border-radius: var(--radius-sm);
}

.pat-longform {
  margin: 0;
  font-size: var(--text-md);
  line-height: 2;
  white-space: pre-line;
}

/* --- video rows -------------------------------------------------------------- */

.pat-video-lead {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  flex-grow: 1;
  min-width: 0;
  color: inherit;
}

.pat-video-thumb {
  position: relative;
  width: 12.5rem;  /* MVP 200px */
  height: 6.875rem; /* MVP 110px */
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--fill);
  flex-shrink: 0;
}

.pat-video-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

/* Small, in the lower-left corner, off the presenter's face; it only says
   "video". A bare white play mark, no disc, with a soft shadow so it reads
   on light frames too (Micah 2026-10-01). */
.pat-video-play {
  position: absolute;
  left: 0.375rem;
  bottom: 0.375rem;
  width: 1.75rem;
  height: 1.75rem;
  background: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.55)) drop-shadow(0 0 6px rgba(0, 0, 0, 0.35));
}

.pat-video-duration {
  position: absolute;
  right: 0.5rem;
  bottom: 0.5rem;
  border-radius: var(--radius-lg);
  background: rgba(0, 0, 0, 0.6);
  padding: 0.25rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 500;
  color: #fff;
}

.pat-video-activity {
  font-weight: 700;
  font-size: 0.875rem;
  color: #afafaf; /* MVP's light activity kicker */
  text-transform: uppercase;
}

.pat-video-copy {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
  min-width: 0;
}

.pat-activities {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-activity-cards {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* never wider than the page, whatever a card's min-content is */
  gap: var(--space-4);
}

.pat-activity {
  background: #fff;
  border: 1px solid var(--line, #e8e4e0);
  border-radius: 10px;
  padding: var(--space-4);
}

.pat-activity.is-bonus {
  border-style: dashed;
}

a.pat-activity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  color: inherit;
  text-decoration: none;
}

a.pat-activity:hover,
a.pat-activity:focus-visible {
  border-color: var(--accent-ink);
  background: var(--accent-soft);
}

.pat-activity .pat-video-lead {
  flex: 1;
  min-width: 0;
  width: auto;
}

.pat-activity .pat-activity-title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
}

.pat-activity .pat-activity-title a {
  color: inherit;
  text-decoration: none;
}

@media (width < 40rem) {
  /* Phone: the lead takes the whole first line (smaller thumb, tighter gap)
     and any chip drops to its own line beneath, right-aligned, so a card
     never needs more than the page width. */
  a.pat-activity {
    flex-wrap: wrap;
    gap: var(--space-3);
  }
  .pat-activity .pat-video-lead {
    flex: 1 1 100%;
    gap: var(--space-3);
  }
  .pat-activity .pat-video-thumb {
    width: 7.5rem;
    height: 4.125rem;
  }
  .pat-activity .pat-video-play {
    left: 0.25rem;
    bottom: 0.25rem;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 1.25rem;
  }
  .pat-activity .pat-activity-title {
    font-size: 1.125rem;
  }
  .pat-activity .pat-done-chip,
  .pat-activity .pat-optional-chip {
    margin-left: auto;
  }
}

.pat-done-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  border-radius: var(--radius-lg); /* MVP 16px, squarer than the clin chips */
  background: #fff;
  box-shadow: inset 0 0 0 1px var(--success-strong);
  padding: 0.5rem 1rem 0.5rem 0.75rem;
  font-weight: 700;
  font-size: 0.875rem;
  text-transform: uppercase;
  color: var(--success-strong);
}

/* --- activity done toggle (proto pass) ---------------------------------------- */

.pat-done-block {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: var(--space-2);
  margin: var(--space-4) 0;
}

/* The Completed chip rides the title row; its slot is always reserved
   (visibility, not display) so toggling never shifts the layout. */
.pat-activity-title-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 2.5rem;
}

.pat-activity-number {
  white-space: pre; /* keeps "3 · " as one unit ahead of the icon */
}

.pat-activity-kicker svg {
  /* inline so the kicker wraps word by word on a phone, icon staying with the first word */
  width: 1rem;
  height: 1rem;
  vertical-align: -0.15em;
  margin-right: 0.375rem;
}

.pat-activity-trail {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
}

.pat-activity-trail .pat-activity-kicker {
  font-size: inherit;
  color: inherit;
  letter-spacing: inherit;
}

/* The breadcrumb's module name is the way back to the module page
   (Micah 2026-10-01). */
a.pat-activity-trail-module {
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}

a.pat-activity-trail-module:hover,
a.pat-activity-trail-module:focus-visible {
  text-decoration: underline;
}

.pat-activity-trail-sep {
  color: #afafaf;
}

.pat-activity-media {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-activity-media .pat-player {
  border-radius: var(--radius-sm);
}

.pat-activity-title-row .pat-optional-chip {
  margin-left: var(--space-3);
}

.pat-activity-dot.is-optional:not(.is-done):not(.is-current) {
  box-shadow: none;
  box-sizing: border-box;
  border: 2px dashed #d4d2e3; /* the ring is a box-shadow elsewhere; a dashed ring needs a real border */
}

.pat-activity-optional svg {
  margin-right: 0.3em;
  vertical-align: -0.125em;
}

.pat-activity-optional::before {
  content: "\00a0\00B7\00a0"; /* glued to the word before it, so a wrapped line never starts with the dot */
}

.pat-activity--optional {
  border-style: dashed;
}

a.pat-activity--optional:hover,
a.pat-activity--optional:focus-visible {
  background: var(--accent-soft);
  border-color: var(--accent-ink);
}

/* Bonus: the same chip shape, outlined and lettered in warm gold — colored
   border and text, never a solid fill (Micah 2026-09-11). */
.pat-done-chip--bonus {
  background: #fff;
  color: var(--bonus-ink-strong);
  box-shadow: inset 0 0 0 1px var(--bonus-ink-strong);
  padding-left: 1rem;
}

.admin-content-crumb .pat-activity-optional {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.admin-content-crumb .pat-activity-optional svg {
  width: 1rem;
  height: 1rem;
}

.pat-activity-title-row .pat-done-chip {
  visibility: hidden;
}

.pat-stack:has(.pat-switch-input:checked) .pat-page-header .pat-done-chip {
  visibility: visible;
}

.pat-done-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.pat-done-question {
  font-weight: 600;
}

.pat-switch-input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.pat-switch {
  position: relative;
  display: inline-block;
  flex-shrink: 0;
  width: 3.25rem;
  height: 1.75rem;
  border-radius: 999px;
  background: var(--border-strong, #c8d2d6);
  cursor: pointer;
  transition: background 0.15s ease;
}

.pat-switch::after {
  content: "";
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: left 0.15s ease;
}

.pat-switch-input:checked + .pat-switch {
  background: var(--success-strong);
}

.pat-switch-input:checked + .pat-switch::after {
  left: 1.7rem;
}

.pat-switch-input:focus-visible + .pat-switch {
  outline: 2px solid var(--focus, #2d828c);
  outline-offset: 2px;
}


/* The phone lettering on the done switch and the phone module bar; the
   desktop keeps the bare switch and the always-open sidebar. */
.pat-done-mark,
.pat-done-completed,
.pat-activity-side-toggle,
.pat-activity-sheet-overview,
.pat-activity-sheet-done,
.pat-activity-sheet-head,
.pat-activity-sheet-backdrop,
.pat-activity-sheet-handle {
  display: none;
}

/* Desktop: the sheet wrapper is invisible to layout; the sidebar reads as before. */
.pat-activity-sheet {
  display: contents;
}

.pat-done-completed {
  align-items: center;
  gap: var(--space-2);
}

/* --- activity player ----------------------------------------------------------- */

.pat-activity-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23.75rem;
  gap: var(--space-6);
  align-items: start;
}

@media (width < 50rem) {
  .pat-activity-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Phones: the lesson is the video (Micah 2026-09-30). The title gets the
   whole row (the Completed chip takes no room until the lesson is done) at a
   phone size, and the video runs edge to edge inside its card instead of
   losing 48px to padding. */
@media (width < 48rem), (height < 32rem) {
  .pat-activity-title-row {
    flex-wrap: wrap;
    row-gap: var(--space-1);
    min-height: 0; /* no chip slot to reserve on a phone */
  }

  /* The done control itself reads "Completed" on a phone, so the chip
     would only repeat it (the kicker already says Bonus). */
  .pat-activity-title-row .pat-done-chip,
  .pat-stack:has(.pat-switch-input:checked) .pat-page-header .pat-done-chip {
    display: none;
  }

  .pat-activity-heading {
    font-size: 1.5rem; /* 24px */
    line-height: var(--leading-tight);
  }

  /* The video is the page (Micah 2026-09-30): no cards on a lesson. One
     white ground, and the video breaks out of the page padding to run the
     full width of the screen, edge to edge. */
  body:has(#activity-root) {
    background: var(--surface);
  }

  #activity-root .pat-card {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }

  #activity-body-card .pat-player {
    margin-inline: calc(var(--space-4) * -1);
    border-radius: 0;
  }

  .layout-main {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  /* Phone order (Micah 2026-10-01): module bar, title, Mark as done, video,
     description, Previous / Next. The grid, main column and media card step
     aside (display: contents) so their pieces line up in one column and
     `order` places them. The DOM keeps the title first for a screen reader;
     the module bar is a compact strip, the done control follows the lesson. */
  body:has(#activity-root) .layout-main {
    padding-top: var(--space-4); /* the module bar moved to the bottom */
  }

  #activity-root .pat-stack {
    gap: var(--space-4);
  }

  #activity-root .pat-activity-grid,
  #activity-root .pat-activity-main,
  #activity-root #activity-body-card {
    display: contents;
  }

  #activity-root .pat-activity-side {
    order: -1;
  }

  #activity-root #activity-new {
    order: 1;
  }

  #activity-root #activity-body-card > * {
    order: 2;
  }

  /* Done follows the lesson, just above Previous / Next: under the title it
     scrolled away while the patient watched and read, so they tapped Next
     without marking it (Jake 2026-10-19 #5, Micah 2026-10-20). */
  #activity-root #activity-done-row {
    order: 3;
  }

  #activity-root #activity-body {
    margin-top: calc(var(--space-1) * -1);
  }

  #activity-root .pat-activity-nav {
    order: 4;
    padding-bottom: var(--space-4);
  }

  /* The running time is for a screen reader; sighted, the player shows it. */
  #activity-root #activity-video-duration {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  /* Module bar: pinned to the bottom of the screen while in an activity,
     in thumb reach; tap it and the module sheet rises from the same spot
     (Micah 2026-10-01). The page keeps room so the bar never covers it. */
  #activity-root .pat-activity-side {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20; /* under the header's layer, so the open account menu covers it */
    margin: 0;
    padding: 0 0 env(safe-area-inset-bottom);
    gap: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06);
  }

  /* open, the sheet and its backdrop sit over everything, header included */
  #activity-root .pat-activity-side.is-open {
    z-index: 45;
  }

  body:has(#activity-root) .layout-main {
    padding-bottom: calc(5rem + env(safe-area-inset-bottom));
  }

  /* the bar takes a swipe up (to open) instead of scrolling the page */
  #activity-root .pat-activity-side-toggle {
    touch-action: none;
  }

  /* closed, the caret points up: the menu opens upward */
  #activity-root .pat-activity-side:not(.is-open) .pat-activity-side-toggle > svg {
    transform: rotate(180deg);
  }

  #activity-root .pat-activity-side-heading,
  #activity-root #activity-progress {
    display: none;
  }

  #activity-root .pat-activity-side:not(.is-open) .pat-activity-list {
    display: none;
  }

  /* Open: a bottom sheet over the dimmed lesson. The module bar stays put. */
  #activity-root .pat-activity-side:not(.is-open) .pat-activity-sheet {
    display: none;
  }

  #activity-root .pat-activity-side.is-open .pat-activity-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 44;
    background: rgba(15, 23, 42, 0.45);
  }

  #activity-root .pat-activity-side.is-open .pat-activity-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 45;
    display: flex;
    flex-direction: column;
    max-height: 80dvh;
    background: var(--surface);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: 0 -8px 30px rgba(15, 23, 42, 0.18);
    animation: pat-sheet-up 0.2s ease-out;
  }

  @keyframes pat-sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
  }

  /* the handle and header take the swipe; the list keeps its own scroll */
  #activity-root .pat-activity-side.is-open .pat-activity-sheet-handle,
  #activity-root .pat-activity-side.is-open .pat-activity-sheet-head {
    touch-action: none;
  }

  #activity-root .pat-activity-side.is-open .pat-activity-sheet-handle {
    display: block;
    flex: none;
    width: 2.5rem;
    height: 0.3rem;
    margin: var(--space-2) auto var(--space-1);
    border-radius: 999px;
    background: var(--line);
  }

  #activity-root .pat-activity-side.is-open .pat-activity-list {
    display: block;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
  }


  #activity-root .pat-activity-side.is-open .pat-activity-sheet-head {
    flex: none;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-5) var(--space-3);
    border-bottom: 1px solid var(--line);
  }

  .pat-activity-sheet-title {
    min-width: 0;
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--ink);
  }

  #activity-root .pat-activity-side.is-open .pat-activity-sheet-overview {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
    color: var(--accent-ink);
    font-size: var(--text-sm);
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
  }

  .pat-activity-sheet-overview svg {
    width: 0.9rem;
    height: 0.9rem;
  }


  /* the sheet replaces the lesson's back chevron on phones */
  #activity-root .pat-page-header > .back-button {
    display: none;
  }

  #activity-root .pat-page-header .pat-kicker {
    padding-left: 0;
  }

  #activity-root .pat-activity-side .pat-activity-list {
    padding: 0 var(--space-3) var(--space-3);
  }

  .pat-activity-side-toggle {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    width: 100%;
    min-height: 3.5rem;
    padding: var(--space-3) var(--space-4);
    border: 0;
    background: none;
    font: inherit;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
  }

  .pat-activity-side-toggle:focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: -2px;
  }

  .pat-activity-side-toggle-copy {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
  }

  #activity-root .pat-activity-side-place {
    display: block;
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: -0.25rem;
  }

  .pat-activity-side-module {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: var(--text-sm);
  }

  .pat-activity-side-toggle .pat-progress {
    display: block;
    height: 0.375rem;
  }

  .pat-activity-side-toggle .pat-progress-fill {
    display: block;
  }

  .pat-activity-side-done {
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.8125rem;
    color: var(--accent-ink);
    font-variant-numeric: tabular-nums;
  }

  .pat-activity-side-toggle > svg {
    flex-shrink: 0;
    width: 1.25rem;
    height: 1.25rem;
    color: var(--muted);
  }

  .pat-activity-side.is-open .pat-activity-side-toggle > svg {
    color: var(--ink);
  }

  #activity-root .pat-activity-side.is-open .pat-activity-sheet-done {
    flex: none;
    display: flex;
    justify-content: center;
    margin: var(--space-2) var(--space-4) calc(var(--space-4) + env(safe-area-inset-bottom));
    min-height: 3rem;
  }

  /* One full-width control above Previous / Next: "Mark as done", then
     "Completed" once done. Still the same switch underneath. */
  #activity-root .pat-done-block {
    margin: 0;
    align-items: stretch;
  }

  /* Done is a full-width toggle row, like an iOS setting (Micah 2026-10-01:
     a button read as one-way; the switch says it goes back and forth). */
  #activity-root .pat-done-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    width: 100%;
    box-sizing: border-box;
    min-height: 3.25rem;
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface);
  }

  #activity-root .pat-done-row:has(.pat-switch-input:checked) {
    border-color: var(--success-strong);
  }

  #activity-root .pat-done-question {
    font-size: var(--text-md);
    color: var(--ink);
  }

  /* Landscape phone: the screen is short (~393px), so a full-width 16:9
     video would be taller than the screen. Fit it to the height instead,
     centered (Micah 2026-10-01). */
  @media (orientation: landscape) {
    #activity-body-card .pat-player {
      margin-inline: auto;
      width: auto;
      max-width: 100%;
      height: calc(100dvh - 3.5rem - var(--space-4));
      aspect-ratio: 16 / 9;
      border-radius: var(--radius-md);
    }
  }

  /* the module bar names the module; the kicker keeps "‹ 1 · Lesson", and
     My program stays, the way back (DRAFT 2026-10-24) */
  #activity-root .pat-activity-trail-module:not(.pat-crumb-program),
  #activity-root .pat-activity-trail-sep:not(.pat-crumb-sep) {
    display: none;
  }
}

.pat-activity-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

#activity-body-card {
  min-width: 0;
  padding: var(--space-6);
}

.pat-player-card {
  border-radius: var(--radius-xl); /* MVP 24px */
  background: #fff;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.02);
  padding: var(--space-4);
}

.pat-player-title {
  margin: 0.375rem 0 0.875rem;
  font-weight: 700;
  font-size: 1.375rem; /* MVP 22px */
}

.pat-player {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #000;
}

.pat-player--empty {
  background: var(--fill, #ececec);
  color: var(--muted, #545f71);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pat-player--empty #activity-video-empty {
  margin: 0;
  font-size: var(--text-md, 1rem);
}

.pat-player-iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.pat-player-card > #activity-video-duration {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.pat-player img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pat-activity-nav {
  display: flex;
  justify-content: space-between;
}

/* --- activity sidebar ------------------------------------------------------------ */

/* Module position belongs to the phone bar, not the desktop sidebar. */
.pat-activity-side-place {
  display: none;
}

.pat-activity-side {
  border-radius: var(--radius-xl); /* MVP sidebar card is 24px */
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-activity-side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pat-activity-side-title {
  margin: 0;
  font-weight: 700;
  font-size: 1.25rem;
}

.pat-activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pat-activity-item {
  border-radius: var(--radius-lg);
  padding: 0.75rem 0.875rem;
  display: flex;
  gap: var(--space-3);
  align-items: flex-start;
  margin: 0;
  position: relative;
  transition: background-color 0.15s;
}

.pat-activity-item.is-active {
  background: rgba(0, 159, 235, 0.08);
}

/* The whole row of another activity is its link, and hover says so: a
   neutral tint (the selected row keeps the blue one) and an ink-blue title
   (Micah 2026-11-23). */
.pat-activity-item a.pat-activity-title::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.pat-activity-item:has(a.pat-activity-title:hover),
.pat-activity-item:has(a.pat-activity-title:focus-visible) {
  background: var(--paper);
}

.pat-activity-item a.pat-activity-title:hover,
.pat-activity-item a.pat-activity-title:focus-visible {
  color: var(--accent-ink);
}

.pat-activity-item a.pat-activity-title:focus-visible {
  outline: none;
}

.pat-activity-item:has(a.pat-activity-title:focus-visible) {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

.pat-activity-dot {
  width: 1.375rem;
  height: 1.375rem;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 0 0 2px #d4d2e3;
  color: #fff;
  font-size: 0.75rem;
}

.pat-activity-dot.is-done {
  background: var(--success);
  box-shadow: none;
}

.pat-activity-dot.is-current {
  background: var(--accent-ink);
  box-shadow: none;
}

.pat-activity-copy {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.pat-activity-copy .pat-video-activity {
  font-size: 0.75rem; /* MVP list kickers run smaller than video rows */
}

.pat-activity-title {
  font-size: var(--text-sm);
  color: var(--ink);
}

/* --- onboarding ---------------------------------------------------------------- */

#qa-root {
  max-width: 46rem;
  margin-inline: auto;
}

.pat-onboarding-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23.75rem;
  gap: var(--space-6);
  align-items: start;
}

@media (width < 50rem) {
  .pat-onboarding-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

#qa-root .pat-onboarding-grid {
  grid-template-columns: minmax(0, 1fr);
}

.pat-question-card {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem; /* headrow sits close to the question (Micah 2026-09-01) */
}

/* The question count occupies the card's first row. */
.pat-qa-headrow {
  display: flex;
  align-items: flex-start;
}

.qa-intro-lede {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--ink);
}

.qa-intro-list {
  margin: 0;
  padding-left: 1.25rem;
  display: grid;
  gap: var(--space-3);
  font-size: var(--text-lg);
  color: var(--ink);
}

.pat-question-block {
  display: flex;
  flex-direction: column;
  gap: 1.5rem; /* keep question + answers tight */
}

.pat-question {
  margin: 0;
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.3;
  letter-spacing: var(--tracking-tight);
}

/* The card holds its height so Back/Next stay put between questions; the
   question and answers sit at the top and the slack falls below them,
   not between the number and the question (Micah 2026-10-01). */
.pat-qa-taking .pat-question-card {
  min-height: 27rem;
}

.pat-radios {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pat-radio {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  text-align: left;
}

.pat-radio-ring {
  width: 1.5rem;
  height: 1.5rem;
  flex-shrink: 0;
  border-radius: 50%;
  border: 2px solid #d4d2e3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pat-radio-ring.is-selected {
  border-color: var(--accent-ink);
}

.pat-radio-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--accent-ink);
}

.pat-radio-label {
  font-size: var(--text-lg);
  color: var(--ink);
}

/* --- HHIE-S Q&A (tono-zxul) ------------------------------------------ */

.pat-qa-answer-form {
  margin: 0;
}

/* Each answer is a full-width button: a big target for any thumb
   (Micah 2026-10-01). Chosen fills soft blue with a blue ring. */
.pat-qa-answer-form .pat-radio {
  width: 100%;
  min-height: 3.5rem;
  background: #fff;
  border: 2px solid #d4d2e3;
  border-radius: var(--radius-lg);
  padding: 0.75rem 1rem;
  font: inherit;
  color: inherit;
  transition: border-color 0.15s, background-color 0.15s;
}

.pat-qa-answer-form .pat-radio:hover {
  border-color: var(--accent-ink);
}

.pat-qa-answer-form .pat-radio:focus-visible {
  outline: 2px solid var(--accent-ink);
  outline-offset: 2px;
}

.pat-qa-answer-form .pat-radio.is-selected {
  border-color: var(--accent-ink);
  background: #e9f6fd;
}

.pat-qa-answer-form .pat-radio.is-selected .pat-radio-label {
  font-weight: 600;
}

/* .pat-qa-nav layout lives with taking styles above (tono-7vsi). */

.pat-qa-review-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-qa-review-answer {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--accent-ink);
}

/* Checkpoint after the last answer: Go back left, Submit right. */
.pat-qa-ready {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.pat-qa-ready-actions {
  display: flex;
  flex-wrap: wrap; /* never past the card's edge on a phone */
  justify-content: space-between;
  align-items: center;
  gap: var(--space-4);
}

.pat-qa-ready-actions .button {
  min-width: 7.5rem;
  justify-content: center;
  white-space: nowrap;
}

.pat-qa-ready-form {
  margin: 0;
}

.pat-onboarding-side {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.pat-side-card {
  padding: var(--space-6) 2rem 2rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-progress--lg {
  height: 0.875rem; /* MVP 14px onboarding meter */
}

.pat-progress-count {
  font-weight: 700;
  font-size: var(--text-md);
}

.pat-goodknow-heading {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.pat-goodknow-icon {
  display: inline-flex;
  font-size: 1.375rem;
  color: #deae61; /* MVP's warm-gold lightbulb */
}

.pat-goodknow-title {
  font-weight: 700;
  font-size: var(--text-lg);
}

.pat-goodknow-body {
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--muted);
}

.pat-goodknow-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 0.75rem;
  background: #ead1c1;
}

.pat-next {
  align-self: flex-end;
}

/* --- claim page (public short-link landing) ---------------------------------- */

.pat-claim {
  max-width: 34rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-5);
  text-align: center;
}

.pat-claim-brand {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  align-items: center;
}

/* Product auth pages (sign-in family): breathe at the top of the viewport.
   Proto specimens render the card inside frames and skip this wrapper.
   clamp: never cramped on laptops, never a chasm on tall monitors. */
.auth-main {
  padding-top: clamp(3rem, 14vh, 9rem);
  padding-bottom: var(--space-7, 2.5rem);
}

/* The brand block is the HEAD OF THE CARD, not a row on the page tint
   (Micah 2026-09-10, fixed in product 2026-09-14). The header's
   <logo | tagline> row is built for a full-width bar; on the single-column
   auth pages it shares the card's centre line and its white ground. These
   rules were proto-only, which is why the live page put the logo hard left
   while the card sat centered. */
.auth-brand {
  position: relative; /* anchor for Back */
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  width: 100%;
  max-width: 34rem;
  margin: 0 auto -1rem;
  padding: var(--space-6) var(--space-6) var(--space-4);
  background: var(--surface);
  border-radius: 2rem 2rem 0 0;
}

/* Back sits at the head's edge; the lockup keeps the card's centre line and
   leaves Back its room on both sides. */
.auth-brand .header-back {
  position: absolute;
  left: var(--space-4);
  top: 50%;
  margin: 0;
  transform: translateY(-50%);
}

.auth-brand:has(.header-back:not([hidden])) {
  padding-inline: 4rem;
}

.auth-brand .brand {
  min-width: 0;
}

.auth-brand .brand img {
  max-width: min(14rem, 100%);
  object-fit: contain;
}

/* The card tucks under the head: no top corners, no top padding. */
.auth-main .pat-claim-card {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.auth-main .pat-claim {
  padding-top: 0;
}

/* The flash rides above the whole panel, on the page tint, at the card's
   width — never inside the white ground (Micah 2026-09-14). */
.auth-main > #-flash-region {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto var(--space-5);
}

/* The help line under the card shares the card's centre line and its cap,
   and sits at the bottom of the screen (Micah 2026-09-30): the page is a
   full-height column and the help line takes the slack above it. */
body.pat-claim-page .auth-main {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* In the column, an auto-margined child shrinks to its content unless it
   claims the width: the card body must match the brand head (34rem cap). */
body.pat-claim-page .auth-main > .pat-claim {
  width: 100%;
}

.auth-main > .pat-claim-help {
  margin: auto auto 0;
  padding-top: var(--space-6);
  text-align: center;
}

/* Phones: one ground, no floating panel (tono-kx4s, Micah 2026-09-30).
   Every public card page (sign-in, invitation setup, claim, reset) goes
   through public-card-document, so the tint, the card's rounded white
   ground and its shadow all give way to a single white page. */
@media (width < 48rem), (height < 32rem) {
  body.pat-claim-page {
    background: var(--surface);
  }

  body.pat-claim-page .auth-main {
    padding-top: var(--space-6);
  }

  body.pat-claim-page .auth-brand,
  body.pat-claim-page .pat-claim-card {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
  }

  body.pat-claim-page .pat-claim-card {
    padding: var(--space-4) var(--space-5) var(--space-6);
  }
}

.pat-claim-card {
  width: 100%;
  padding: 2.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-claim-title {
  margin: 0;
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
}

/* The team invitation's welcome (Micah 2026-11-20): an invitation, then
   the person by name, then what's ahead. */
.invite-kicker {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.invite-card .pat-claim-title {
  font-size: var(--text-3xl);
}

.pat-claim-copy {
  margin: 0;
  font-size: var(--text-lg); /* elder-friendly body */
  line-height: 1.6;
  color: var(--muted);
}

.pat-claim-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-claim-label {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--muted-strong);
}

.pat-claim-input {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  text-indent: 0.4em; /* recenters: letter-spacing trails the last glyph */
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  max-width: 100%;
}

/* The DOB field keeps the big friendly size but not the access-code
   letterspacing theatrics (native date input). */
.pat-claim-input--dob {
  font-size: 1.25rem;
  letter-spacing: normal;
  text-indent: 0;
  text-transform: none;
  font-weight: 600;
}

.pat-claim-input:focus {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: var(--shadow-focus);
}

.pat-claim-input[aria-invalid="true"] {
  border-color: var(--danger);
}

.layout-main .pat-claim-error,
.pat-claim-error {
  margin: 0;
  font-size: var(--text-md);
  color: var(--danger);
}

.pat-claim-help {
  margin: 0;
  font-size: var(--text-md);
  color: var(--muted);
  max-width: 26rem;
}

.pat-claim-help a,
.pat-claim-help a:visited {
  color: var(--accent-ink);
}

.pat-claim-powered {
  font-size: var(--text-xs);
  color: var(--muted);
  opacity: 0.7;
}

/* --- SMS consent step ----------------------------------------------------------- */

.pat-consent {
  max-width: 34rem;
}

.pat-consent-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pat-consent-mobile {
  font-size: var(--text-lg);
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  max-width: 18rem;
}

.pat-consent-mobile:focus {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: var(--shadow-focus);
}

.pat-consent-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  cursor: pointer;
}

.pat-consent-checkbox {
  width: 1.375rem;
  height: 1.375rem;
  margin-top: 0.125rem;
  accent-color: var(--accent-ink);
  flex-shrink: 0;
}

.pat-consent-label {
  font-weight: 700;
  font-size: var(--text-lg);
}

.pat-consent-copy {
  margin: 0;
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--muted);
}

/* Recovery flow (tono-1bc2 item 8): ordinary text inputs in the claim
   family, the proof-of-work widget, and the honeypot. */
.pat-claim-input--text {
  font-family: inherit;
  font-size: 1.15rem;
  font-weight: 500;
  text-align: left;
  text-transform: none;
  letter-spacing: normal;
  text-indent: 0;
}

/* A shared form field (label + input in a .field wrapper, e.g. the masked
   phone input) dressed like the claim family's bare label and input: no
   box around the pair, the label reads like "Email" (tono-kx4s, Micah
   2026-09-30). */
.field.pat-claim-field {
  display: contents;
}

.field.pat-claim-field > label {
  font-weight: 600;
  font-size: var(--text-md);
  color: var(--muted-strong);
  margin: 0;
}

.field.pat-claim-field input {
  width: 100%;
  /* the primitive caps field inputs at 24rem; in the card the field spans
     the form like the email input does (the phone box sat left of centre,
     Micah 2026-10-09) */
  max-width: none;
  box-sizing: border-box;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 500;
}

.field.pat-claim-field input:focus {
  outline: none;
  border-color: var(--accent-ink);
  box-shadow: var(--shadow-focus);
}

/* A phone number is short and all digits: bigger and centered. */
.field.pat-claim-field--phone input {
  font-size: 1.6rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.04em;
}

/* --- universal sign-in (platform, claim-family chrome) ---------------------- */

.pat-signin-notice {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-lg);
  background: var(--surface-soft, #fbf6f3);
  border: 1px solid var(--line);
  color: var(--muted-strong, #2c4c5c);
  font-size: var(--text-md);
  line-height: 1.45;
  text-align: left;
}

/* Six-box code in the claim family (tono-dldq): the label keeps the
   claim label's size (.pat-claim-label wins over .field label), and the
   boxes sit centered in the form. */
.pat-claim-form .field label.pat-claim-label {
  font-size: var(--text-md);
  color: var(--muted-strong);
}

.pat-claim-form .code-input-boxes {
  margin-inline: auto;
  justify-content: center;
}

/* the boxes' own error line sits centred under them, like the boxes
   (it hung off the boxes' left edge, Micah 2026-10-10) */
.pat-claim-form .field > p.error {
  max-width: none;
  text-align: center;
}

/* Didn't get it? Send a new code: its own form under the Sign in button
   (tono-dldq; moved out of the code form, Micah 2026-10-09). The button
   is a link in the sentence. */
.pat-signin-resend {
  margin: var(--space-3) 0 0;
  text-align: center;
  font-size: var(--text-md);
}

.pat-signin-resend .pat-claim-copy {
  margin: 0;
}

#-forgot-resend {
  display: inline;
}

.pat-signin-resend-button {
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--accent-ink);
  text-decoration: underline;
  cursor: pointer;
}

.pat-signin-methods {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.25rem;
}

.pat-signin-methods-label {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
  font-weight: 600;
}

.pat-signin-methods-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}

.pat-signin-method {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface, #fff);
  color: var(--ink, #2c4c5c);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
}

/* "or" lines between two ways on a claim card */
.pat-signin-or {
  margin: var(--space-4) 0 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* The invitation's "or" goes with its passkey when the browser cannot make
   one (Micah 2026-11-20). */
#setup-passkey[hidden] + .pat-signin-or {
  display: none;
}

/* the passkey stage's status lines under Continue */
.pat-signin-wait {
  margin: var(--space-3) 0 0;
  text-align: center;
}

.pat-signin-method:hover {
  border-color: var(--accent, #2d828c);
  color: var(--accent, #2d828c);
}

.pat-signin-method-icon {
  display: inline-flex;
  width: 1rem;
  height: 1rem;
  color: inherit;
}

.pat-signin-method-icon svg {
  width: 1rem;
  height: 1rem;
}

.pat-signin-alt {
  margin: 0.5rem 0 0;
  font-size: var(--text-sm);
}

.pat-signin-alt a,
.pat-signin-alt button {
  color: var(--accent, #2d828c);
  font-weight: 600;
  text-decoration: none;
}

.pat-signin-alt button {
  display: inline;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
}

.pat-signin-alt a:hover,
.pat-signin-alt button:hover {
  text-decoration: underline;
}

.pat-signin-hint {
  margin: 0 0 0.85rem;
  text-align: center;
}

.pat-signin-hinted {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--ink, #2c4c5c);
}

.pat-signin-not-you-form {
  margin: 0.25rem 0 0;
}

.pat-signin-not-you {
  display: inline;
  padding: 0;
  border: none;
  background: none;
  color: var(--accent, #2d828c);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.pat-signin-not-you:hover {
  text-decoration: underline;
}

/* honeypot: out of flow and out of sight, but still in the form for bots */
.pat-hp {
  position: absolute;
  left: -624.9375rem;
}

/* .pat-pow is an alias of .pow (primitives.css) during cutover (tono-et13). */
.pat-pow {
  /* inherits .pow when both classes are present on the widget */
}

/* Sign-in setup chooser (tono-1bc2 items 9-10) */
.pat-setup-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pat-setup-option {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
}

.pat-setup-option:hover {
  border-color: var(--accent-ink);
}

/* Live product posts each method as a form.pat-setup-option wrapping a
   submit button. Flex layout must live on the button (icon | copy), not only
   on the form — otherwise icons stack/disappear next to the title. */
form.pat-setup-option {
  padding: 0;
  overflow: hidden;
}

form.pat-setup-option .pat-setup-option-btn {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  margin: 0;
  padding: 1rem 1.1rem;
  border: 0;
  border-radius: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.pat-setup-option-icon {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 159, 235, 0.12);
  color: var(--accent-ink);
  font-size: 1.25rem;
}

.pat-setup-option-copy {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.pat-setup-option-title {
  font-weight: 700;
  font-size: var(--text-lg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.pat-setup-chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-pill);
  background: rgba(0, 159, 235, 0.12);
  color: var(--accent-ink);
}

.pat-setup-option-body {
  font-size: var(--text-sm);
  color: var(--muted);
}

/* SMS consent (the onboarding and agreements consent box) */
.pat-consent-check {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 1.25rem 0 1rem;
  text-align: left;
}

.pat-consent-check input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  margin-top: 0.1rem;
  accent-color: var(--teal-700, #2d828c);
}

.pat-consent-check label {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Required agreement clickwrap (proto viewer screen everyone/agreements). */
.pat-agreement-check {
  margin: 0;
}

.pat-agreement-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.agreement-read {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.4;
  color: var(--accent, #2d828c);
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.agreement-read:hover {
  color: var(--ink);
}

button.agreement-read {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.4;
  font-weight: 600;
  color: var(--accent, #2d828c);
  text-decoration: underline;
  text-underline-offset: 0.15em;
  cursor: pointer;
  text-align: left;
}

button.agreement-read:hover {
  color: var(--ink);
}

/* Same modal as the rest of the app, sized as a reading window.
   The head (title and Close) stays put. The agreement scrolls.
   I agree stays at the bottom of the panel. */
.modal.agreement-dialog-panel {
  width: min(68rem, calc(100vw - 2.5rem));
  height: calc(100dvh - 2 * var(--space-6));
  text-align: left;
}

.agreement-dialog-scroll {
  min-height: 0;
}

.agreement-dialog-actions {
  flex: none;
  margin-top: 0;
  padding-top: 0;
  background: var(--surface);
}

.agreement-dialog-actions .button {
  width: 100%;
}

/* Phones: the agreement dialog is full-screen like every modal, and "I agree"
   sits pinned at the very bottom while the text scrolls above it (Micah
   2026-09-30: always visible, no scroll-to-agree). */
@media (width < 48rem), (height < 32rem) {
  .modal.agreement-dialog-panel {
    width: 100%;
    height: 100%;
  }

  .modal.agreement-dialog-panel .modal-body {
    padding: 0;
  }

  .agreement-dialog-scroll {
    padding: var(--space-4);
  }

  .modal.agreement-dialog-panel .modal-actions {
    padding-bottom: 0;
  }

  .agreement-dialog-actions {
    padding: 0 var(--space-4) calc(var(--space-6) + env(safe-area-inset-bottom));
  }
}

/* Published date is the version. .layout-main p would otherwise mute it. */
.layout-main p.pat-agreement-date,
.pat-agreement-date {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink);
}

.pat-agreement-doc {
  text-align: left;
  align-items: stretch;
}

.pat-agreement-doc .pat-claim-title {
  text-align: left;
}

.pat-agreement-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

/* Room above each section heading so the document breathes (Micah 2026-09-30). */
.pat-agreement-intro + .pat-agreement-section,
.pat-agreement-section + .pat-agreement-section,
.pat-agreement-date + .pat-agreement-section {
  margin-top: 1.75rem;
}

.pat-agreement-section h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.pat-agreement-intro {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.pat-agreement-section h3 {
  margin: 0.9rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}

.layout-main .pat-agreement-intro p,
.layout-main .pat-agreement-section p,
.pat-agreement-intro p,
.pat-agreement-section p {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
}

.pat-agreement-section ul {
  margin: 0;
  padding-left: 1.4rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
}

.pat-agreement-section ol {
  margin: 0;
  padding-left: 1.6rem;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink);
  list-style-type: lower-alpha;
}

.pat-agreement-section li + li {
  margin-top: 0.25rem;
}

/* The Privacy Policy's "what we collect" table (tono-g30l). */
.pat-agreement-table table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  line-height: 1.45;
  color: var(--ink);
}

.pat-agreement-table th,
.pat-agreement-table td {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.pat-agreement-table th {
  background: var(--paper);
  font-weight: 700;
}

/* Phones: each row becomes a small card, every cell led by its column. */
@media (width < 48rem), (height < 32rem) {
  .pat-agreement-table thead {
    display: none;
  }

  .pat-agreement-table table,
  .pat-agreement-table tbody,
  .pat-agreement-table tr,
  .pat-agreement-table td {
    display: block;
  }

  .pat-agreement-table tr {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.7rem;
  }

  .pat-agreement-table tr + tr {
    margin-top: 0.6rem;
  }

  .pat-agreement-table td {
    border: 0;
    padding: 0.2rem 0;
  }

  .pat-agreement-table td::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--muted);
  }
}

.pat-agreement-section a,
.pat-agreement-intro a {
  color: var(--accent-ink);
  text-decoration: underline;
}

/* Locked module tiles (tono-ifon): the whole card reads closed, not just
   the button — dimmed + desaturated until the pre-assessment completes. */
.pat-tile[aria-disabled="true"] {
  opacity: 0.55;
  filter: saturate(0.5);
}
.pat-tile[aria-disabled="true"] .pat-tile-head img {
  filter: grayscale(0.5);
}

/* Completion celebration (tono-p6hb): note above the journey; canvas overlay. */

#confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

/* --- journey tracker (sketch, 2026-09-01) ------------------------------------ */

/* pat-card carries no padding of its own — the tracker brings its inset. */
.journey-card {
  padding: 1.5rem 1.75rem;
}

/* Horizontal track: three nodes joined by a line; labels under the dots. */
.journey-track {
  list-style: none;
  margin: var(--space-4) 0 0;
  padding: 0;
  display: flex;
  align-items: flex-start;
}

.journey-node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  text-align: center;
  flex: 1;
  position: relative;
}

/* First and last landmarks hug the edges so the track spans the surface. */
.journey-node:first-child {
  align-items: flex-start;
  text-align: left;
}

.journey-node:last-child {
  align-items: flex-end;
  text-align: right;
}


/* Connectors: each node after the first draws a line back to its neighbor.
   --journey-fill lights the segment fractionally (module progress keeps the
   old bar's continuity inside the track). */
.journey-node + .journey-node::before {
  content: "";
  position: absolute;
  top: calc(0.875rem - 2px); /* dot center minus half the bar */
  right: calc(50% + 0.875rem); /* stop at this node's dot edge */
  left: calc(-50% + 0.875rem); /* start at the previous dot's edge */
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg,
    var(--success) var(--journey-fill, 0%),
    #d4d2e3 var(--journey-fill, 0%));
  z-index: 0;
}

/* The outer dots sit at the box edges (flex-start/flex-end), so the line
   must run box-edge to box-edge, not center to center. AFTER the base rule:
   equal specificity, source order decides. */
.journey-node:nth-child(2)::before {
  left: calc(-100% + 1.75rem); /* first dot sits at the box's left edge */
}

/* End at the final dot's edge — hollow (locked) dots are transparent, so a
   bar running under them leaks through. */
.journey-node:last-child::before {
  right: 1.75rem;
}

/* Journey landmarks run bigger than the sidebar dots they borrow, and are
   always opaque — the bar must never show through a hollow marker. */
.journey-node .pat-activity-dot {
  width: 1.75rem;
  height: 1.75rem;
  font-size: 0.9rem;
  background: var(--surface, #fff);
}

.journey-node .pat-activity-dot {
  position: relative;
  z-index: 1;
}

.journey-node-label {
  font-weight: 700;
  font-size: var(--text-sm);
}

.journey-node-fact,
.journey-node-band {
  font-size: var(--text-sm);
}

/* Locked mutes via color, never opacity — opacity would fade the dot fill
   and let the bar ghost through. */
.journey-node[data-journey-state="locked"] .journey-node-label,
.journey-node[data-journey-state="locked"] .journey-node-fact {
  color: var(--muted-strong);
}

/* The active stage speaks below the track: copy + the single CTA. */
.journey-active {
  margin-top: var(--space-4);
  text-align: center;
}

.journey-detail {
  margin: 0;
}

/* Up next: a small label over the next activity's name (Micah 2026-10-01). */
.journey-kicker {
  margin: 0 0 0.25rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.journey-detail--named {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
}

.journey-sub {
  margin: 0.25rem 0 0;
  font-size: var(--text-sm);
}

.journey-cta-row {
  margin-top: var(--space-3);
}

/* --- journey track inside the hero (sketch) ----------------------------------
   Same component; the blue surface restyles it. White carries the states. */

/* Inside the hero the tracker sheds its card chrome: the hero IS the card,
   and it already carries the title. */
.pat-hero .journey-card {
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.pat-hero .journey-card .pat-card-title {
  display: none;
}

.pat-hero .journey-track {
  margin-top: 0;
}

.pat-hero .journey-node + .journey-node::before {
  background: linear-gradient(90deg,
    #fff var(--journey-fill, 0%),
    rgba(255, 255, 255, 0.55) var(--journey-fill, 0%));
}

/* Hero landmarks: the gradient IS the fill (solid-blue look), white ring.
   Safe now that the bar clips at dot edges (2026-09-01, Micah). */
.pat-hero .pat-activity-dot {
  box-shadow: inset 0 0 0 2px #fff;
  background: transparent;
  color: #fff;
}

/* Done: success green in a white ring, white check. */
.pat-hero .pat-activity-dot.is-done {
  background: var(--success);
  color: #fff;
  box-shadow: inset 0 0 0 2px #fff;
}

/* Current: solid white with the soft halo. */
.pat-hero .pat-activity-dot.is-current {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.35);
}

.pat-hero .journey-node-label {
  color: #fff;
}

.pat-hero .journey-node-fact {
  color: rgba(255, 255, 255, 0.85);
}

.pat-hero .journey-node[data-journey-state="locked"] .journey-node-label,
.pat-hero .journey-node[data-journey-state="locked"] .journey-node-fact {
  color: rgba(255, 255, 255, 0.65);
}

.pat-hero .journey-node[data-journey-state="locked"] .pat-activity-dot {
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.pat-hero .journey-active,
.pat-hero .journey-active p {
  color: #fff;
}

.pat-hero .journey-active .journey-kicker {
  color: rgba(255, 255, 255, 0.85);
}

.pat-hero .journey-active .journey-sub {
  color: rgba(255, 255, 255, 0.85);
}

.pat-hero .journey-node-band {
  color: rgba(255, 255, 255, 0.85);
}

/* --------------------------------------------------------------------------
 * Your Hearing (program dashboard): the clinician's hearing-loss record,
 * read-only, the full width of the patient column (Micah 2026-09-03).
 * Facts run across in one row; asymmetric ears stack as two full-width
 * blocks (Micah 2026-09-10: the patient view need not mirror the chart's
 * matrix). The audio-* pieces are shared with the clinician chart.
 * ------------------------------------------------------------------------ */

.pat-audio {
  padding: 2rem;
}

.pat-audio-on-dashboard {
  margin-top: var(--space-6);
}

.pat-audio .pat-section-title {
  margin: 0;
}

.pat-audio-body {
  margin: var(--space-2) 0 0;
  font-size: var(--text-md);
  line-height: 1.6;
  color: var(--muted);
}

.pat-audio .audio-cols,
.pat-audio .audio-matrix {
  margin-top: var(--space-5);
}

.pat-audio-recorded {
  margin: var(--space-4) 0 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

.pat-audio .audio-facts {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-4);
}

.pat-audio .audio-col + .audio-col {
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
}

@media (max-width: 56rem) {
  .pat-audio .audio-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* --- Clinic support page (tono-5vv1) -------------------------------------- */

.support-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-8);
}

.support-clinic-face {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.support-logo {
  height: 3.5rem;
  width: auto;
  max-width: 18rem;
  object-fit: contain;
  align-self: flex-start;
}

.support-clinic-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
}

.support-lede {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--muted);
}

.support-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-4);
}

.support-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: 0;
}

.support-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-ink);
}

.support-row-icon svg {
  width: 1.375rem;
  height: 1.375rem;
}

.support-row-copy {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  min-width: 0;
}

.support-row-label {
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
}

.support-row-value {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.support-row-value:hover { color: var(--accent-ink); }

/* Phone and email are links and must look it, visited or not: blue and
   underlined, tap to call or write (Micah 2026-09-30). */
a.support-row-value,
a.support-row-value:visited {
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.support-note {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
}

/* --- program home: finished modules, phone list (Micah 2026-10-01) --- */

/* A finished module keeps its credit: full green bar, Completed in place of
   the percent; activities added since are counted as new beneath. */
.pat-meter--done .pat-progress-fill {
  background: var(--success);
}

.pat-meter-done {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  font-size: 0.8125rem;
  color: var(--success);
  white-space: nowrap;
}

.pat-meter-done svg {
  width: 0.9rem;
  height: 0.9rem;
}

.pat-tile-new {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--accent-ink);
}

/* The tracker's facts: the long form on wide screens, the short on phones. */
.journey-node-fact--short {
  display: none;
}

@media (width < 48rem), (height < 32rem) {
  .journey-node-fact--long {
    display: none;
  }

  .journey-node-fact--short {
    display: inline;
  }

  /* Modules as a compact list: tint square, name, meter, the row is the link. */
  .pat-tile-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .pat-tile {
    position: relative;
    flex-direction: row;
    align-items: center;
    border-radius: var(--radius-lg);
  }

  .pat-tile-head {
    flex: none;
    width: 3.5rem;
    height: 3.5rem;
    margin: 0.75rem 0 0.75rem 0.75rem;
    border-radius: var(--radius-md);
  }

  .pat-tile-label {
    display: none;
  }

  .pat-tile-body {
    min-width: 0;
    padding: 0.75rem 2.5rem 0.75rem 0.875rem;
    gap: 0.375rem;
  }

  .pat-tile-week {
    font-size: var(--text-base);
    line-height: 1.3;
  }

  /* The Welcome Module reads as the list's first row. */
  .pat-welcome {
    position: relative;
    flex-wrap: nowrap;
    gap: 0.875rem;
    padding: 0.75rem 2.5rem 0.75rem 0.75rem;
    border-radius: var(--radius-lg);
  }

  .pat-welcome-img {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: var(--radius-md);
  }

  .pat-welcome-copy {
    min-width: 0;
    gap: 0.375rem;
  }

  .pat-welcome-title {
    font-size: var(--text-base);
    line-height: 1.3;
  }

  .pat-welcome-body {
    display: none;
  }

  .pat-welcome .pat-progress--md {
    height: 0.5rem;
  }

  /* Open Module stretches invisibly over the row; a chevron marks it. It
     stays clear on hover and press, or its fill would cover the row. */
  .pat-tile-body a.button,
  .pat-welcome > a.button {
    position: absolute;
    inset: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: inherit;
    background: transparent;
    box-shadow: none;
    font-size: 0;
  }

  /* as specific as primitives' .button.soft:hover:not(:disabled):not(.disabled) */
  .pat-tile-body a.button.soft:is(:hover, :active):not(:disabled):not(.disabled),
  .pat-welcome > a.button.soft:is(:hover, :active):not(:disabled):not(.disabled) {
    background: transparent;
    box-shadow: none;
  }

  .pat-tile-body a.button:focus-visible,
  .pat-welcome > a.button:focus-visible {
    outline: 2px solid var(--accent-ink);
    outline-offset: 2px;
  }

  .pat-tile:not([aria-disabled="true"]):hover,
  .pat-welcome:hover {
    box-shadow: 0 0 0 2px var(--accent-soft);
  }

  .pat-welcome::after,
  .pat-tile:not([aria-disabled="true"])::after {
    content: "";
    position: absolute;
    right: 1.125rem;
    top: 50%;
    width: 0.5rem;
    height: 0.5rem;
    border-top: 2px solid var(--muted);
    border-right: 2px solid var(--muted);
    transform: translateY(-50%) rotate(45deg);
    pointer-events: none;
  }

  .pat-tile-body span.button.disabled {
    margin: 0;
    padding: 0;
    width: auto;
    min-height: 0;
    background: none;
    border: 0;
    font-size: var(--text-sm);
    color: var(--muted-strong);
    text-align: left;
    justify-content: flex-start;
  }
}

/* --- module page (Micah 2026-10-01) ------------------------------------------
   One head panel (Module, name, meter, up next); what you'll learn and the
   week's reminders side by side; then the activities, whose status rides
   the kicker line rather than a chip on its own row. */

.pat-module-head {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: 1.5rem 1.75rem;
}

.pat-module-head .pat-page-title {
  margin: 0;
}

.pat-module-progress {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-4);
}

.pat-module-meter {
  flex: 1 1 14rem;
  max-width: 24rem;
}

#module-progress,
#module-time {
  font-size: var(--text-sm);
  color: var(--muted);
}

.pat-module-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--line, #e6e8ef);
}

.pat-module-next-copy {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.pat-module-next-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  line-height: 1.25;
}

.pat-module-next-kind {
  font-size: var(--text-sm);
  color: var(--muted);
}

#module-continue {
  flex-shrink: 0;
}

/* a finished module names the program's next stop (Jake 2026-10-14) */
.pat-module-complete::before {
  content: "✓ ";
  color: var(--success);
}

.pat-module-about {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: var(--space-4);
  align-items: start;
}

.pat-module-about .pat-module-card {
  padding: 1.5rem 1.75rem;
}

.pat-module-about .pat-longform {
  line-height: 1.6;
}

.pat-module-about .pat-longform :is(p, ul, ol) {
  margin: 0 0 var(--space-3);
}

.pat-module-about .pat-longform li + li {
  margin-top: 0.375rem;
}

.pat-learn-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.pat-learn-photo {
  width: 100%;
  aspect-ratio: 5 / 2;
  object-fit: cover;
  border-radius: var(--radius-sm);
}

/* Status on the kicker line: phones show it (Completed in green, Bonus in
   purple) in place of the row's chip; desktop keeps the chips. */
.pat-activity .pat-activity-status,
.pat-activity .pat-activity-kicker .pat-activity-optional {
  display: none;
}

.pat-activity-status {
  display: inline-flex;
  gap: 0.25rem;
  font-size: inherit;
  font-weight: 700;
  color: var(--success-strong);
}

.pat-activity-status svg {
  width: 0.9em;
  height: 0.9em;
}

.pat-activity-kicker .pat-activity-optional {
  color: var(--bonus-ink-strong);
}

@media (width < 48rem), (height < 32rem) {
  .pat-module-head,
  .pat-module-about .pat-module-card {
    padding: 1.25rem;
  }

  .pat-module-next-title {
    font-size: var(--text-base);
  }

  /* Phones: the kicker's Bonus and Completed share one line under the
     type, in place of the chips. The kicker wraps as a flex row; a
     full-width spacer ordered between the type and the statuses starts
     their line (Micah 2026-10-01). */
  .pat-activity .pat-activity-kicker {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 0;
    row-gap: 0.125rem;
  }

  .pat-activity .pat-activity-kicker::after {
    content: "";
    flex-basis: 100%;
    order: 1;
  }

  .pat-activity .pat-activity-status,
  .pat-activity .pat-activity-kicker .pat-activity-optional {
    margin-right: 0.5rem;
  }

  .pat-activity .pat-activity-status,
  .pat-activity .pat-activity-kicker .pat-activity-optional,
  .pat-activity .pat-activity-minutes {
    display: inline-flex;
    align-items: center;
    order: 2;
    margin: 0;
  }

  /* Phones say Exercise, so the time stays on the type's line */
  .pat-activity .pat-activity-type-long {
    display: none;
  }

  .pat-activity .pat-activity-minutes {
    order: 0;
  }

  .pat-activity .pat-activity-minutes .pat-activity-sep {
    padding: 0 0.3em; /* a flex item trims its spaces */
  }

  .pat-activity .pat-activity-kicker .pat-activity-optional {
    margin-right: 0.5rem;
  }

  .pat-activity .pat-activity-kicker .pat-activity-optional::before {
    content: none;
  }

  .pat-activity > .pat-done-chip {
    display: none;
  }

  /* downloads take the card's width */
  #module-extras .button-group {
    flex-direction: column;
    align-items: stretch;
  }

  #module-extras .button-group .button {
    justify-content: center;
    text-align: center;
  }
}

/* --- assessment, phone pass (Micah 2026-10-01) ------------------------------ */

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

/* answered progress as a thin bar under Question N of M */
.pat-qa-meter .pat-progress {
  height: 0.375rem;
}

@media (width < 48rem), (height < 32rem) {
  .pat-question-card {
    padding: 1.25rem;
  }

  .pat-qa-taking .pat-question-card {
    min-height: 0;
  }

  .pat-question {
    font-size: 1.25rem;
  }

  /* Back and Next pinned at the bottom of the screen: they never move and
     sit in thumb reach, like the lesson's module bar */
  .pat-qa-taking .pat-qa-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    padding: 0.75rem var(--space-4) calc(0.75rem + env(safe-area-inset-bottom));
    background: #fff;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }

  body:has(#qa-root .pat-qa-taking) .layout-main {
    padding-bottom: 6rem;
  }


}


/* The answers, including question 9's long text, clear the fixed nav on phones. */
@media (width < 48rem), (height < 32rem) {
  body:has(#qa-root .pat-qa-taking) .layout-main {
    padding-top: var(--space-4);
  }

  #qa-root .pat-stack {
    gap: var(--space-3);
  }

  #qa-root .pat-page-header .pat-page-title {
    font-size: 1.375rem;
  }

  #qa-root .pat-question-card {
    padding: var(--space-4) var(--space-5) var(--space-5);
    gap: var(--space-3);
  }

  #qa-root .pat-qa-position {
    font-size: 1rem;
  }

  #qa-root .pat-question-block {
    gap: var(--space-4);
  }

  #qa-root .pat-radios {
    gap: var(--space-2);
  }

  #qa-root .pat-radio {
    padding-block: 0.5625rem;
  }
}

/* The pit stop's journey strip and finished card (TON-553). */

.pat-transition {
  max-width: 40rem;
  margin-inline: auto;
  width: 100%;
  /* The strip sits on paper; its unfilled stops need a visible ring. */
  --transition-ring: #7d8a9c;
  --transition-rail: #b4bfcd;
}

/* The finale uses the same head as the card being finished. */
.pat-transition-card {
  padding: 0;
  overflow: hidden;
}

.pat-transition-head {
  position: relative;
  height: 9.375rem;
}

.pat-transition-head img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* an assessment or the results: no photo, a mark on the brand blue */
.pat-transition-head.is-assessment,
.pat-transition-head.is-finished {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: linear-gradient(180deg, var(--accent-ink), var(--accent));
  color: #fff;
}

.pat-transition-head.is-finished {
  background: linear-gradient(180deg, var(--accent), var(--accent-sky));
}

.pat-transition-head-mark {
  display: grid;
  place-items: center;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
}

.pat-transition-head-mark svg {
  width: 1.75rem;
  height: 1.75rem;
}

.pat-transition-head-label {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.pat-transition-body {
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.75rem 1.75rem;
}

.pat-transition-module-body {
  gap: var(--space-3);
}


.pat-transition-card-title {
  margin: 0;
  font-size: var(--text-xl);
}

.pat-transition-summary {
  margin: 0;
  font-size: var(--text-lg);
  color: var(--muted);
}

/* what the module added up to, in place of a row per activity: a module
   can run past a dozen (Micah 2026-10-27) */
.pat-transition-tallies {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.pat-transition-tally-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr));
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.pat-transition-tally {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--success-soft);
  text-align: center;
}

.pat-transition-tally-value {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: var(--text-2xl);
  line-height: 1;
  color: var(--ink); /* no green holds 3:1 on the soft green; the fill says done */
}

.pat-transition-tally-label {
  font-size: var(--text-sm);
  color: var(--muted-strong);
}

.pat-transition-bonus {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--muted);
  text-align: center;
}

/* one dot per module, joined by a line that fills as far as they've come */
/* under the title, on the page: the program, not part of the module */
.pat-transition-journey {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0 var(--space-2);
  list-style: none;
}

.pat-transition-stop {
  position: relative;
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  min-width: 0;
}

.pat-transition-stop + .pat-transition-stop::before {
  content: "";
  position: absolute;
  top: 0.75rem;
  right: 50%;
  width: 100%;
  height: 3px;
  background: var(--transition-rail);
  transition: background-color 500ms ease;
}

.pat-transition-stop.is-done + .pat-transition-stop::before {
  background: var(--success);
}

.pat-transition-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--transition-ring);
  color: #fff;
  transition: background-color 500ms ease, box-shadow 500ms ease;
}

.pat-transition-dot svg {
  width: 0.875rem;
  height: 0.875rem;
  opacity: 0;
  transition: opacity 500ms ease;
}

.pat-transition-stop.is-done .pat-transition-dot {
  background: var(--success);
  box-shadow: none;
}

.pat-transition-stop.is-done .pat-transition-dot svg {
  opacity: 1;
}

.pat-transition-stop.is-next .pat-transition-dot {
  background: var(--surface);
  box-shadow: inset 0 0 0 3px var(--accent), 0 0 0 4px var(--accent-soft);
}

.pat-transition-stop-label {
  font-size: var(--text-xs);
  color: var(--muted);
  white-space: nowrap;
}

.pat-transition-stop.is-next .pat-transition-stop-label {
  font-weight: 700;
  color: var(--accent-ink);
}

/* the button and the mark share one slot at the button's height */
.pat-transition-action {
  display: grid;
  min-height: 3.25rem;
  margin-top: var(--space-2);
}

.pat-transition-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-xl);
  background: var(--success-soft);
  color: var(--success-strong);
  font-size: var(--text-lg);
  font-weight: 700;
  animation: pat-transition-settle 400ms ease-out both;
}

.pat-transition-mark svg {
  width: 1.25rem;
  height: 1.25rem;
}

@keyframes pat-transition-settle {
  from { transform: scale(0.96); }
  to   { transform: none; }
}

/* Up next: there from the start, black and white until the module is done */
.pat-transition-next {
  transition: filter 700ms ease, opacity 700ms ease;
}

.pat-transition-next.is-waiting {
  filter: grayscale(1);
  opacity: 0.6;
}

.pat-transition-next-body {
  gap: var(--space-2);
}

.pat-transition-next-copy {
  margin: 0;
  color: var(--muted);
}

.pat-transition-meta {
  font-size: var(--text-sm);
  color: var(--muted);
}

.pat-transition-next-body .button {
  margin-top: var(--space-3);
}

.pat-transition-gone {
  visibility: hidden;
}

@media (prefers-reduced-motion: reduce) {
  .pat-transition-next,
  .pat-transition-dot,
  .pat-transition-dot svg,
  .pat-transition-stop + .pat-transition-stop::before { transition: none; }
  .pat-transition-mark { animation: none; }
}

@media (width < 48rem), (height < 32rem) {
  .pat-transition-body {
    padding: 1.25rem;
  }
}

/* Public front door (tono-32fq). */
#front-door a.pat-setup-option { color: inherit; text-decoration: none; }
#front-door .front-door-new { display: flex; flex-direction: column; gap: var(--space-3);
  padding-top: var(--space-5); border-top: 1px solid var(--line); }
#front-door .front-door-new h2 { margin: 0; font-size: var(--text-lg); font-weight: 700; }
#front-door .front-door-tagline { margin: 0; text-align: center; color: var(--muted); font-size: var(--text-sm); }
@media (width < 48rem), (height < 32rem) {
  #front-door .pat-claim-card { padding-bottom: 0; }
}

/* --- the pit stop (TON-553 option D, proto, Micah 2026-11-19) ------------
   The transition in a dialog over the program page: the strip and the card
   being finished, on the page's own paper so the card reads as it does on
   the transition page. On a desktop it is the centred dialog and fades out
   as it closes (160ms). */

.modal.pat-pit-stop {
  width: min(36rem, 100%);
  background: var(--paper);
}

.modal.pat-pit-stop .modal-actions {
  background: var(--paper);
}

.pat-pit-stop-body {
  max-width: none;
}

.modal-backdrop:has(> .modal.pat-pit-stop.is-closing) {
  animation: pat-pit-stop-fade 160ms ease-in both;
}

@keyframes pat-pit-stop-fade {
  to { opacity: 0; }
}

/* Phones: a sheet, not a full-screen dialog. It slides up from the bottom
   (340ms, decelerating) and stops short of the top, so the top of the
   program page (its header and greeting) stays in view behind it, dimmed.
   Closing, it slides back down (260ms, accelerating) and the dimming lifts
   with it; only then does the page move. */
@media (width < 48rem), (height < 32rem) {
  .modal-backdrop:has(> .modal.pat-pit-stop) {
    align-items: flex-end;
    padding-top: max(4.5rem, 16dvh);
    background: rgba(15, 23, 42, 0.45);
    animation: pat-pit-stop-dim 340ms ease-out both;
  }

  .modal.pat-pit-stop {
    height: auto;
    max-height: 100%;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
    animation: pat-pit-stop-up 340ms cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  .modal.pat-pit-stop > .modal-head {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .modal-backdrop:has(> .modal.pat-pit-stop.is-closing) {
    animation: pat-pit-stop-undim 260ms ease-in both;
  }

  .modal.pat-pit-stop.is-closing {
    animation: pat-pit-stop-down 260ms cubic-bezier(0.4, 0, 1, 1) both;
  }
}

@keyframes pat-pit-stop-up {
  from { transform: translateY(100%); }
}

@keyframes pat-pit-stop-down {
  to { transform: translateY(100%); }
}

@keyframes pat-pit-stop-dim {
  from { background-color: rgba(15, 23, 42, 0); }
}

@keyframes pat-pit-stop-undim {
  to { background-color: rgba(15, 23, 42, 0); }
}

/* The next step, lit once the pit stop has closed and the page has brought
   it into view: the light arrives as the patient looks (650ms: the ring
   draws in with a halo that swells and fades, then it settles). The next
   module's tile takes a ring in the brand ink, lifts, gains a play mark on
   its picture (popping in 250ms later) and a filled Open Module. No words:
   the hero's Continue is the one place that says Up next. */
.pat-tile.is-next {
  position: relative;
  box-shadow: 0 0 0 3px var(--accent-ink), 0 0 0 3px rgba(0, 114, 181, 0), 0 12px 32px rgba(0, 114, 181, 0.22);
  transform: translateY(-4px);
  animation: pat-tile-light 650ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes pat-tile-light {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 114, 181, 0), 0 0 0 0 rgba(0, 114, 181, 0), 0 4px 24px rgba(0, 0, 0, 0.02);
    transform: none;
  }

  50% {
    box-shadow: 0 0 0 3px var(--accent-ink), 0 0 0 14px rgba(0, 114, 181, 0.22), 0 12px 32px rgba(0, 114, 181, 0.22);
    transform: translateY(-6px);
  }
}

.pat-tile-go {
  position: absolute;
  right: 0.875rem;
  bottom: 0.875rem;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: #fff;
  color: var(--accent-ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  animation: pat-tile-go-in 400ms 250ms cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes pat-tile-go-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

.pat-tile-go svg {
  width: 1.25rem;
  height: 1.25rem;
  margin-left: 0.15rem; /* the triangle's weight sits left of its box */
}

/* After the last module the next step has no tile: the hero's Take Final
   Assessment lights instead, a white ring drawn in around it on the hero's
   blue (650ms, the same curve as the tile). */
.journey-cta-row.is-next .button {
  outline: 3px solid #fff;
  outline-offset: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  animation: pat-cta-light 650ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes pat-cta-light {
  0% {
    outline-color: rgba(255, 255, 255, 0);
    outline-offset: 16px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
  }
}

/* Phones: the tiles are rows, so the lit row takes a blue wash, the play
   mark sits on its thumbnail and its chevron turns blue. The light draws
   in without the lift. */
@media (width < 48rem), (height < 32rem) {
  .pat-tile.is-next {
    transform: none;
    background: linear-gradient(var(--accent-soft), var(--accent-soft)), #fff;
    animation-name: pat-tile-light-row;
  }

  .pat-tile-go {
    inset: 0;
    margin: auto;
    width: 2rem;
    height: 2rem;
  }

  .pat-tile-go svg {
    width: 0.875rem;
    height: 0.875rem;
  }

  .pat-tile.is-next::after {
    border-color: var(--accent-ink);
  }

  .pat-tile.is-next .pat-tile-body a.button.primary:is(:hover, :active):not(:disabled):not(.disabled) {
    background: transparent;
    box-shadow: none;
  }
}

@keyframes pat-tile-light-row {
  0% {
    box-shadow: 0 0 0 0 rgba(0, 114, 181, 0), 0 0 0 0 rgba(0, 114, 181, 0), 0 4px 24px rgba(0, 0, 0, 0.02);
  }

  50% {
    box-shadow: 0 0 0 3px var(--accent-ink), 0 0 0 10px rgba(0, 114, 181, 0.22), 0 12px 32px rgba(0, 114, 181, 0.22);
  }
}

/* Reduced motion: the sheet and the dialog simply appear and go, and the
   light is simply there. */
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop:has(> .modal.pat-pit-stop),
  .modal.pat-pit-stop,
  .pat-tile.is-next,
  .pat-tile-go,
  .journey-cta-row.is-next .button {
    animation: none !important;
  }
}
