/* ============================================================================
 * BABYWEEKS — Complete stylesheet
 * Cream paper + serif display + teal accent + deep green hero + fixed tabs
 * Fraunces (display) + Inter (body) + Schibsted Grotesk (eyebrows/labels/nav,
 * D-429) + IBM Plex Mono (code/data/numbers only)
 * ========================================================================== */

/* All design values live in /styles/tokens.css (D-421) — loaded before this
 * file. The aliases below keep un-migrated selectors (and progress.css /
 * weaning.css) working on the old names while sections move to the semantic
 * names directly. Remove each alias once nothing references it. Do NOT add
 * new literal values here — new values go in tokens.css primitives.
 * (--font-display / --font-body / --font-mono now come straight from
 * tokens.css under the same names — no alias needed.) */
:root {
  --paper:        var(--surface-ground);
  --paper-2:      var(--surface-sunken);
  --paper-card:   var(--surface-card);
  --ink:          var(--text-primary);
  --ink-soft:     var(--text-secondary);
  --ink-mute:     var(--text-tertiary);
  --rule:         var(--border-hairline);
  --hero:         var(--surface-hero);
  --hero-2:       var(--surface-hero-2);
  --hero-soft:    var(--ornament);
  --warm:         var(--accent);
  --warm-soft:    var(--accent-soft);
  --col-max:      var(--layout-col-max);
  --r-sm:         var(--radius-control);
  --r-md:         var(--radius-card);
  --r-lg:         var(--radius-card-lg);
  --shadow-soft:  var(--shadow-card);
}

/* ============================================================================
 * Reset & Baseline
 * ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

/* Accessibility: remove focus ring on mouse/touch, keep it for keyboard navigation */
:focus:not(:focus-visible) { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-2); }

html, body {
  font-family: var(--font-body);
  background: var(--surface-ground);
  color: var(--text-primary);
  font-size: 100%; /* user's text size = the root unit (Dynamic Type, D-423) — never a fixed px */
  line-height: var(--leading-150);
  font-feature-settings: 'kern' on, 'liga' on;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior: none;
}

body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  max-width: var(--layout-col-max);
  margin: 0 auto;
  /* Bottom clearance so the last card isn't swallowed by the tab bar:
   * tab bar (~46px + safe area) + footer-tag (~32px) + breathing room.
   * Was 120px before the Phase 0/1 footer tag landed; was a raw 150px until D-511
   * snapped it to the grid (152 = 38 × 4) and gave it a name. */
  padding: 0 var(--space-24) var(--scroll-clear);
  position: relative;
}

/* ────────────────────────────────────────────────────────────────────────────
 * 🔴 THE COLUMN, FOR THINGS THAT ARE NOT INSIDE #app. (D-711)
 *
 * `#app` above holds the column for ordinary surfaces. A FULL-SCREEN DRILL-IN is not
 * inside it: every one of them mounts `position: fixed; inset: 0` from its view file, which
 * takes it out of #app's box entirely. So each drill-in had to REMEMBER to restate the
 * column for itself. Seven did. Two did not — and the two that did not were found by Andrew,
 * one at a time, on consecutive days:
 *
 *     2026-07-30  603 timeline        Gate 2, item 1
 *     2026-07-31  701 search          "the dev, search pages are still full width"
 *     2026-07-31  405 About           "about is fine for now but rendered full screen"
 *     2026-07-31  COLL not-found      text against the window edge, no chrome at all
 *
 * Four instances of ONE defect in two days is a missing mechanism, not sloppy execution
 * (D-706). This is the mechanism. The column is now a NAMED THING a host carries, not a
 * declaration a card has to remember — and check 47 fails the build when a full-screen host
 * is mounted without it.
 *
 * ── WHY IT IS ON THE HOST AND COLUMNS THE CONTENT, RATHER THAN ON THE HOST ITSELF ────────
 * The host is the full-bleed scroll container AND the background plane; the card root inside
 * it carries the column and the card colour (phase.js documents this deliberately: "ground,
 * not card … the read's own root carries the card background inside its column"). Columning
 * the HOST would pull `--surface-ground` into a centred strip and leave raw <body> at the
 * window edges on all seven surfaces that were already right. So: `.appcol` goes on the
 * host, and the column lands on what the host renders.
 *
 * `width: 100%` is load-bearing, not decoration. Search's host is a column FLEX container,
 * and on a flex item `margin-inline: auto` overrides `align-items: stretch` — without an
 * explicit width its children would shrink to fit their text.
 *
 * ── `.appcol-self` — THE ONE HOST THAT IS ALSO ITS OWN CONTENT ROOT ──────────────────────
 * `search.js` mounts `.ssf` directly as the fixed host; there is no wrapper to put `.appcol`
 * on. It takes the column on itself. Two placements, ONE declaration — which is the whole
 * point: the token is written here and nowhere else.
 * ────────────────────────────────────────────────────────────────────────────────────── */
.appcol > *,
.appcol-self {
  width: 100%;
  max-width: var(--layout-col-max);
  margin-inline: auto;
}

/* ============================================================================
 * Links & basic elements
 * ========================================================================== */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: inherit;
}

/* Used on <button> elements that visually behave as cards / rows / tiles.
 * The global button reset above handles font/border/background/color;
 * this adds full-width, left text alignment, and inherited line-height —
 * the remaining defaults that differ from <div>. Apply to converted
 * div-as-button surfaces (V2 a11y migration) so layout matches the
 * pre-migration <div> rendering. Tabs/pills don't need this — they have
 * their own sized layouts via existing classes. */
button.as-card {
  width: 100%;
  text-align: left;
  line-height: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

input:not([type="checkbox"]):not([type="radio"]):not([type="range"]) {
  min-height: 44px;
}

/* ============================================================================
 * Typography
 * ========================================================================== */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: var(--tracking-neg-01);
  line-height: var(--leading-110);
}

h1 {
  font-size: var(--size-44);
}

h2 {
  font-size: var(--size-28);
}

h3 {
  font-size: var(--size-22);
}

h4 {
  font-size: var(--size-18);
}

p {
  margin: 0 0 var(--space-12);
}

.heading {
  font-size: var(--size-28);
  font-family: var(--font-display);
  font-weight: 500;
  margin-bottom: var(--space-8);
}

.sub-heading {
  font-size: var(--size-15);
  color: var(--text-secondary);
  margin-bottom: var(--space-20);
}

.eyebrow {
  font-family: var(--font-label);
  font-size: var(--size-11);
  font-weight: 500;
  letter-spacing: var(--tracking-14);
  text-transform: uppercase;
  color: var(--accent);
}

.eyebrow-soft {
  color: var(--text-secondary);
}

.muted {
  color: var(--text-secondary);
}

.center {
  text-align: center;
}

/* ============================================================================
 * Home page layout
 * ========================================================================== */
.home {
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
  /* Clear fixed elements at bottom: tab bar (~68px) + mic dock / input row (~60px) + breathing room */
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
}

.home-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-16) 0 var(--space-20);
}

.baby-pill {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  cursor: pointer;
  padding: var(--space-8) var(--space-12);
  border-radius: var(--radius-card);
  transition: background 0.15s ease;
}

.baby-pill:hover {
  background: var(--black-a02);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  background: var(--accent-soft);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: var(--size-18);
}

.avatar.lg {
  width: 60px;
  height: 60px;
  font-size: var(--size-28);
}

.avatar.blue {
  background: var(--sky-200);
  color: var(--text-primary);
}

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

.baby-info .n {
  font-family: var(--font-display);
  font-size: var(--size-16);
  font-weight: 500;
  color: var(--text-primary);
}

.baby-info .s {
  font-size: var(--size-12);
  color: var(--text-secondary);
}

/* Composed Home (nh-*) was designed on the workbench with its own 16px gutter and
   no outer frame. Ported into #app — which has a 22px page gutter — the two stack,
   pinching cards to a 38px inset while the fixed tabbar stays full-bleed. Instead of
   negative-margining the wrapper past #app's padding box (fragile on-device: pushes
   content to the very edge and rendered asymmetric under viewport-fit=cover), zero
   #app's HORIZONTAL padding only while it hosts the composed Home. The wrapper then
   fits #app exactly (no negative geometry) and Home renders at its own symmetric 16px
   gutter. :has scopes this to Home; other views keep the 22px page gutter. */
#app:has(> .nh-pvdev) {
  padding-left: 0;
  padding-right: 0;
}

/* ============================================================================
 * Section titles & cards
 * ========================================================================== */
.section-title {
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-14);
  text-transform: uppercase;
  color: var(--accent);
  margin: var(--space-24) 0 var(--space-16);
  font-weight: 500;
}

/* Softer, body-font heading used for profile group labels (Your account /
 * Caregivers / AI assistant / Privacy). The caps-mono .section-title works
 * for short verb-eyebrows ('Try asking', 'Today', 'Quick log') but reads
 * as admin-panel chrome on profile where each label gates a real section
 * of the account. (V2 D-PROFILE-SECTION-LABELS-ENGINEER-VOICE) */
.profile-section {
  font-family: var(--font-body);
  font-size: var(--size-14);
  font-weight: 600;
  color: var(--text-secondary);
  margin: var(--space-28) 0 var(--space-12);
}

/* Inline source pill following a clinical claim. Rendered inline in
 * the bullet, e.g. 'Mood that stays low for 2+ weeks [NHS]'. Quieter than
 * a global anchor — typography carries the meaning of a citation, not
 * the colour. (V2 D-PARENTS-CLINICAL-CLAIMS-NO-CITATIONS) */
.inline-source {
  display: inline;
  font-family: var(--font-mono);
  font-size: var(--size-11);
  color: var(--text-secondary);
  text-decoration: none;
  white-space: nowrap;
}
.inline-source:hover { color: var(--text-primary); text-decoration: underline; }

.caia-strip {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  padding: var(--space-16) var(--space-20);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.caia-strip:hover {
  background: var(--surface-card-hover);
  transform: translateY(-1px);
}

.caia-strip.rt-pulse {
  animation: pulse 0.6s ease;
}

@keyframes pulse {
  0%, 100% { background: var(--surface-card); }
  50% { background: var(--surface-notice); }
}

.caia-strip .tag {
  font-family: var(--font-label);
  font-size: var(--size-10);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-8);
  font-weight: 500;
}

.caia-strip .head {
  font-family: var(--font-display);
  font-size: var(--size-18);
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.caia-strip .sub {
  font-size: var(--size-14);
  color: var(--text-secondary);
}

.tag {
  font-family: var(--font-label);
  font-size: var(--size-10);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--space-8);
  font-weight: 500;
}

.head {
  font-size: var(--size-18);
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.sub {
  font-size: var(--size-14);
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* ============================================================================
 * Parents card
 * ========================================================================== */
.parents-card {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  padding: var(--space-16) var(--space-20);
  cursor: pointer;
  transition: background 0.15s ease;
}

.parents-card:hover {
  background: var(--surface-card-hover);
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-12);
  font-size: var(--size-14);
}

.label-row .l {
  font-weight: 500;
}

.arrow {
  color: var(--text-tertiary);
  font-size: var(--size-18);
}

.parents-tabs {
  display: flex;
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.parents-tab {
  flex: 1;
  padding: var(--space-8) var(--space-12);
  background: var(--surface-ground);
  border-radius: var(--radius-control);
  text-align: center;
  font-size: var(--size-12);
  font-weight: 500;
  color: var(--text-secondary);
  transition: background 0.15s ease, color 0.15s ease;
}

.parents-tab.viewer {
  background: var(--accent);
  color: var(--text-on-accent);
}

/* ============================================================================
 * Proof tiles (data indicators)
 * ========================================================================== */
.proof-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-12);
  margin: var(--space-16) 0;
}

.proof-tile {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  padding: var(--space-16);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.proof-tile:hover {
  background: var(--surface-card-hover);
  transform: translateY(-1px);
}

.proof-tile .ic {
  font-size: var(--size-28);
  margin-bottom: var(--space-8);
  display: block;
}

.proof-tile .v {
  font-family: var(--font-display);
  font-size: var(--size-18);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

.proof-tile .l {
  font-size: var(--size-12);
  color: var(--text-secondary);
}

/* ============================================================================
 * Up next
 * ========================================================================== */
.up-next {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  padding: var(--space-16) var(--space-16);
  font-size: var(--size-14);
  margin-top: var(--space-12);
}

.up-next .tag {
  margin-bottom: var(--space-8);
}

.up-next .ms {
  color: var(--text-primary);
  line-height: var(--leading-150);
}

/* O-040 part 3 — feeding-mode mismatch nudge banner on Home. */
.feed-nudge {
  background: var(--surface-card);
  border-radius: var(--radius-card);
  padding: var(--space-16) var(--space-16);
  margin-top: var(--space-12);
  border: 1px solid var(--ink-line, var(--black-a08));
}
.feed-nudge .fn-head {
  font-weight: 600;
  font-size: var(--size-15);
  margin-bottom: var(--space-4);
  color: var(--text-primary);
}
.feed-nudge .fn-sub {
  color: var(--text-tertiary);
  font-size: var(--size-13);
  line-height: var(--leading-145);
  margin-bottom: var(--space-12);
}
.feed-nudge .fn-actions {
  display: flex;
  gap: var(--space-8);
  justify-content: flex-end;
}

/* ============================================================================
 * Weekly page
 * ========================================================================== */
.weekly-page {
  display: flex;
  flex-direction: column;
}

.weekly-back {
  align-self: flex-start;
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: var(--size-14);
  color: var(--ink-soft);
  transition: color 0.15s ease;
}

.weekly-back:hover {
  color: var(--ink);
}

/* D-496 — the fake percentile masthead and its .pm-* styles were DELETED.
   A decorative element that borrows clinical authority is not decoration; it is a
   claim. Do not reinstate. See web/js/views/weekly.js. */

/* Week navigation */
.week-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0 20px;
  padding: 12px 14px;
  background: var(--paper-card);
  border-radius: var(--r-md);
}

.week-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-16);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.week-nav-btn:hover:not(.disabled) {
  background: var(--paper-2);
  border-color: var(--warm);
}

.week-nav-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.week-nav-label {
  flex: 1;
  text-align: center;
}

.week-nav-eyebrow {
  font-family: var(--font-label);
  font-size: var(--size-9);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 2px;
}

.week-nav-num {
  font-family: var(--font-display);
  font-size: var(--size-20);
  font-weight: 600;
  color: var(--ink);
}

/* Weekly headings */
.weekly-h1 {
  font-size: var(--size-32);
  font-family: var(--font-display);
  font-weight: 500;
  margin-bottom: 8px;
  line-height: var(--leading-110);
}

.weekly-theme {
  font-size: var(--size-14);
  color: var(--ink-soft);
  margin-bottom: 18px;
  font-style: italic;
}

/* Weekly hero — flows on cream paper (no green box). Continues the home aesthetic
 * via shared eyebrow / serif Week N / warm accent, but reads like a magazine article
 * opening, not a card. */
.weekly-hero {
  margin: 14px 0 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--rule);
}

.weekly-hero-eyebrow {
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-14);
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: 14px;
}

.weekly-hero-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.weekly-hero-chev {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--ink);
  font-size: var(--size-20);
  line-height: var(--leading-100);
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.weekly-hero-chev:hover {
  background: var(--paper-card);
  border-color: var(--ink-soft);
}

.weekly-hero-chev.disabled {
  opacity: 0.3;
  pointer-events: none;
}

.weekly-hero-week {
  flex: 1;
  font-family: var(--font-display);
  font-size: var(--size-22);
  font-weight: 500;
  letter-spacing: var(--tracking-neg-01);
  color: var(--ink);
  text-align: center;
}

.weekly-hero-h1 {
  font-family: var(--font-display);
  font-size: var(--size-36);
  font-weight: 500;
  line-height: var(--leading-110);
  letter-spacing: var(--tracking-neg-015);
  margin: 0 0 12px;
  color: var(--ink);
}

.weekly-hero-summary {
  font-size: var(--size-16);
  line-height: var(--leading-155);
  color: var(--ink-soft);
  font-style: italic;
  margin: 0;
}

/* Parents page */
.parents-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

.parents-intro {
  margin-top: 4px;
}

.parents-intro h3 {
  font-family: var(--font-label);
  font-size: var(--size-11);
  font-weight: 500;
  letter-spacing: var(--tracking-14);
  text-transform: uppercase;
  color: var(--warm);
  margin: 0 0 8px;
}

.parents-intro h2 {
  font-size: var(--size-28);
  line-height: var(--leading-115);
  margin: 0 0 10px;
}

.parents-intro p {
  color: var(--ink-soft);
  font-size: var(--size-15);
  line-height: var(--leading-155);
  margin: 0;
}

.audience-content {
  padding-top: 6px;
}

.audience-content h4 {
  font-size: var(--size-14);
  font-family: var(--font-body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--tracking-05);
  color: var(--ink-soft);
  margin: 18px 0 8px;
}

.audience-content p {
  font-size: var(--size-15);
  line-height: var(--leading-160);
  margin: 0 0 10px;
}

.audience-content ul {
  padding-left: 20px;
  margin: 0 0 10px;
}

.audience-content li {
  font-size: var(--size-15);
  line-height: var(--leading-155);
  margin-bottom: 6px;
}

/* Audience tabs */
.audience-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--rule);
  margin: 16px 0 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.audience-tabs::-webkit-scrollbar {
  display: none;
}

.audience-tab {
  padding: 10px 12px;
  font-size: var(--size-13);
  font-weight: 500;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.audience-tab.on {
  color: var(--ink);
  border-bottom-color: var(--warm);
}

/* Depth pills */
.depth-pills {
  display: flex;
  gap: 8px;
  margin: 12px 0 16px;
}

.depth-pill {
  padding: 6px 14px;
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-10);
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--rule);
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  font-weight: 500;
}

.depth-pill.on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Weekly sections & content */
.weekly-section {
  margin: 18px 0;
}

.weekly-section h4 {
  font-size: var(--size-16);
  margin-bottom: 12px;
  color: var(--ink);
}

.weekly-section ul, .weekly-section ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.weekly-section li {
  margin-bottom: 6px;
  line-height: var(--leading-150);
}

.weekly-lede {
  font-size: var(--size-16);
  line-height: var(--leading-160);
  color: var(--ink);
  margin-bottom: 14px;
  font-weight: 500;
}

.weekly-notice {
  background: var(--surface-notice);
  border-left: 3px solid var(--warm);
  padding: 12px 14px;
  border-radius: var(--r-sm);
}

.weekly-personalised {
  background: var(--paper-card);
  border-radius: var(--r-md);
  padding: 14px 16px;
}

.weekly-closer {
  font-size: var(--size-14);
  color: var(--ink-soft);
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--rule);
  font-style: italic;
}

.weekly-article {
  margin: 20px 0;
}

.weekly-article-kicker {
  font-family: var(--font-label);
  font-size: var(--size-10);
  letter-spacing: var(--tracking-14);
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: 6px;
  font-weight: 500;
}

.weekly-article-title {
  font-size: var(--size-24);
  font-family: var(--font-display);
  font-weight: 500;
  margin-bottom: 8px;
}

.weekly-article-dek {
  font-size: var(--size-14);
  color: var(--ink-soft);
  font-style: italic;
}

.weekly-article-body {
  margin-top: 16px;
  font-size: var(--size-15);
  line-height: var(--leading-160);
}

.weekly-sources {
  margin-top: 20px;
}

.weekly-sources h4 {
  margin-bottom: 12px;
}

.weekly-sources ul {
  list-style: decimal;
}

.weekly-sources a {
  color: var(--warm);
}

.weekly-source {
  font-family: var(--font-mono);
  font-size: var(--size-10);
  letter-spacing: var(--tracking-10);
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 10px;
}

.weekly-empty {
  text-align: center;
  padding: 24px 16px;
}

.weekly-empty h4 {
  margin-bottom: 8px;
}

.weekly-empty p {
  color: var(--ink-soft);
  margin-bottom: 12px;
}

/* ============================================================================
 * Caïa tab (data-driven weekly view)
 * ========================================================================== */
.caia-eyebrow {
  font-family: var(--font-label);
  font-size: var(--size-10);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--warm);
  margin: 16px 0 12px;
  font-weight: 500;
}

.caia-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.caia-stat {
  background: var(--paper-card);
  border-radius: var(--r-md);
  padding: 14px 12px;
  text-align: center;
}

.caia-stat-num {
  font-family: var(--font-display);
  font-size: var(--size-20);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.caia-stat-label {
  font-size: var(--size-11);
  color: var(--ink-soft);
  font-weight: 500;
}

.caia-pending-note {
  font-size: var(--size-13);
  color: var(--ink-soft);
  text-align: center;
  padding: 12px 16px 4px;
  font-style: italic;
}

/* ============================================================================
 * Markdown content
 * ========================================================================== */
.md {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.md p {
  margin: 0;
  line-height: var(--leading-160);
}

.md strong {
  font-weight: 600;
}

.md ul, .md ol {
  margin: 0;
  padding-left: 20px;
}

.md li {
  margin-bottom: 6px;
}

/* ============================================================================
 * Chat view
 * ========================================================================== */
.chat-disclaimer {
  background: var(--surface-notice);
  border-left: 3px solid var(--warm);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  font-size: var(--size-13);
  line-height: var(--leading-150);
  margin-bottom: 12px;
}

.chat-disclaimer b {
  font-weight: 600;
}

.chat-sources-line {
  font-size: var(--size-12);
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.suggested-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 10px;
  margin: 16px 0 20px;
}

.suggestion {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: var(--size-12);
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.suggestion:hover {
  background: var(--surface-card-hover);
  border-color: var(--warm);
}

/* Reserve space at the bottom so the last message isn't hidden behind the fixed input row + tab bar. */
.chat-msg-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 16px 0;
  min-height: 200px;
  padding-bottom: 140px; /* clear the fixed input row + tab bar */
}

.msg {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--size-14);
  line-height: var(--leading-160);
}

.msg.user {
  align-items: flex-end;
  margin-bottom: 12px;
}

.msg.user > div:first-child {
  background: var(--warm);
  color: var(--paper);
  padding: 10px 14px;
  border-radius: 18px 18px 4px 18px;
  max-width: 85%;
  word-wrap: break-word;
}

.msg.bot > div:first-child {
  padding: 0;
}

.msg-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Safety card (D-349 pre-model gate, types 1–3) — full-width, calm
 * publication register: no flashing, no all-caps, numbers tappable. */
.safety-card {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-safety);
  border: 1px solid var(--warm-soft);
  border-left: 3px solid var(--warm);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: var(--size-14);
  line-height: var(--leading-165);
  margin-bottom: 8px;
}

.safety-card .safety-text {
  margin: 0;
}

.safety-tel {
  color: var(--warm);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

/* Quiet HCP chip under a type-4 soft redirect bubble */
.safety-chip {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-size: var(--size-12);
  color: var(--ink-soft);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 4px 12px;
  margin-top: 4px;
}

.chat-h {
  font-family: var(--font-display);
  font-size: var(--size-16);
  font-weight: 500;
  margin-top: 8px;
  margin-bottom: 4px;
}

.chat-list {
  padding-left: 20px;
  margin: 0;
}

.chat-list li {
  margin-bottom: 6px;
}

.chat-link {
  color: var(--warm);
  text-decoration: underline;
}

/* Citation chip — superscript pill that reads as a typographic system,
 * not as inline body text (V2 D-CHAT-CITATION-CHIP-INLINE-RENDER). */
.chat-cite {
  display: inline-block;
  padding: 0 4px;
  margin: 0 2px;
  font-size: var(--size-11);
  font-family: var(--font-mono);
  background: var(--paper-2);
  border-radius: 3px;
  vertical-align: super;
  line-height: var(--leading-100);
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
}
.chat-cite:hover { color: var(--ink); }

.msg-sources {
  margin-top: 8px;
}

.chat-sources-label {
  font-family: var(--font-label);
  font-size: var(--size-10);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 6px;
  font-weight: 500;
}

.chat-sources-list {
  list-style: decimal;
  padding-left: 20px;
  margin: 0;
}

.chat-source-item {
  font-size: var(--size-12);
  line-height: var(--leading-150);
  color: var(--warm);
}

.chat-source-item:hover {
  text-decoration: underline;
}

.chat-source-publication {
  font-weight: 600;
  color: var(--warm);
}

.chat-source-title {
  color: var(--ink-soft);
  font-style: italic;
}

.msg-actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.chat-action-btn {
  padding: 6px 12px;
  font-size: var(--size-12);
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chat-action-btn:hover {
  background: var(--surface-card-hover);
  border-color: var(--warm);
}

/* Log-suggest card — appears below sources when a loggable message is detected */
.msg-log-suggest {
  margin-top: 8px;
}
.msg-log-suggest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--cream-150);
  border: 1px solid var(--cream-500);
  border-radius: var(--r-sm);
  padding: 8px 12px;
}
.msg-log-suggest-label {
  font-size: var(--size-13);
  color: var(--ink-mute);
}

/* Log suggest action rows inside the modal */
.log-suggest-action {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}
.log-suggest-action:last-child { border-bottom: none; }
.log-suggest-action.saved { opacity: 0.55; }
.log-suggest-icon { font-size: var(--size-20); flex-shrink: 0; }
.log-suggest-summary { flex: 1; font-size: var(--size-14); line-height: var(--leading-140); }
.log-suggest-check { color: var(--success); font-size: var(--size-18); }

/* ============================================================================
 * Chat input row
 * ========================================================================== */
.chat-input-row {
  position: fixed;
  bottom: calc(68px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  padding: 0 22px 12px;
  display: flex;
  gap: 8px;
  max-width: var(--col-max);
  margin: 0 auto;
  z-index: 95;
}

.chat-input-row input {
  flex: 1;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: var(--size-14);
  outline: none;
}

.chat-input-row input::placeholder {
  color: var(--cream-300-a50);
}

.chat-send {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--warm);
  color: var(--paper);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-18);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.chat-send:hover {
  background: var(--accent-hover);
}

.chat-send:active {
  transform: scale(0.96);
}

/* ============================================================================
 * Capture view
 * ========================================================================== */
.capture-intro {
  background: var(--paper-card);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 20px;
}

.capture-intro h3 {
  font-size: var(--size-16);
  margin-bottom: 8px;
}

.capture-intro p {
  font-size: var(--size-13);
  line-height: var(--leading-150);
  margin-bottom: 8px;
}

.examples {
  font-size: var(--size-12);
  color: var(--ink-soft);
  font-style: italic;
}

.log-input-card {
  background: var(--paper-card);
  border-radius: var(--r-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.log-mode-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.mode-btn {
  flex: 1;
  padding: 8px 12px;
  font-size: var(--size-13);
  font-weight: 500;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.mode-btn.on {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.upload-box {
  background: var(--paper);
  border: 2px dashed var(--rule);
  border-radius: var(--r-md);
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.upload-box:hover {
  background: var(--surface-hover-wash);
  border-color: var(--warm);
}

.upload-box .ic {
  font-size: var(--size-40);
  margin-bottom: 10px;
  display: block;
}

.upload-box p {
  margin: 0 0 4px;
  font-size: var(--size-14);
}

.upload-box strong {
  font-weight: 600;
}

.upload-box .small {
  font-size: var(--size-12);
  color: var(--ink-soft);
}

.log-textarea {
  width: 100%;
  min-height: 100px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 12px;
  font-size: var(--size-14);
  font-family: var(--font-body);
  resize: vertical;
  line-height: var(--leading-150);
  outline: none;
  transition: border-color 0.15s ease;
}

.log-textarea:focus {
  border-color: var(--warm);
}

.review-card {
  background: var(--paper-card);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  border-left: 3px solid var(--warm);
}

.review-card .tag {
  margin-bottom: 6px;
}

.review-card .summary {
  font-size: var(--size-14);
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--ink);
}

.review-card .data {
  font-family: var(--font-mono);
  font-size: var(--size-10);
  background: var(--paper);
  padding: 6px 8px;
  border-radius: 3px;
  color: var(--ink-mute);
  margin-bottom: 10px;
  overflow-x: auto;
}

.review-actions {
  display: flex;
  gap: 8px;
}

.review-actions button {
  padding: 6px 12px;
  font-size: var(--size-12);
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.15s ease;
}

.review-actions .save {
  background: var(--warm);
  color: var(--paper);
  border: 0;
}

.review-actions .save:hover {
  background: var(--accent-hover);
}

.review-actions .skip {
  background: transparent;
  color: var(--ink-soft);
}

.review-actions .skip:hover {
  background: var(--paper);
  color: var(--ink);
}

/* Quick log tiles */
.quick-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin: 16px 0;
}

.qt {
  background: var(--paper-card);
  border-radius: var(--r-md);
  padding: 12px;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}

.qt:hover {
  background: var(--surface-card-hover);
  transform: translateY(-1px);
}

.qt .ic {
  font-size: var(--size-24);
  margin-bottom: 6px;
  display: block;
}

.qt .l {
  font-size: var(--size-11);
  font-weight: 500;
  color: var(--ink);
}

/* Timeline */
.timeline-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.timeline-item:last-child {
  border-bottom: 0;
}

.timeline-time {
  font-family: var(--font-mono);
  font-size: var(--size-12);
  font-weight: 600;
  color: var(--ink-mute);
  min-width: 45px;
}

.timeline-text {
  flex: 1;
  font-size: var(--size-14);
  color: var(--ink);
}

.timeline-text .meta {
  font-size: var(--size-12);
  color: var(--ink-soft);
  margin-top: 4px;
}

/* ============================================================================
 * Auth & onboarding
 * ========================================================================== */
.welcome {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  padding: 32px 0;
}

.w-hero {
  text-align: center;
  margin-bottom: 32px;
}

.w-hero h2 {
  margin-bottom: 8px;
  font-size: var(--size-32);
}

.w-hero p {
  color: var(--ink-soft);
  margin-bottom: 24px;
  font-size: var(--size-16);
}

.w-illustration {
  font-size: var(--size-60);
  margin: 20px 0;
}

/* Welcome CTA block — anchors the primary button + sign-in helper at the bottom of the hero. */
.w-cta {
  margin-top: 32px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
}

.w-cta .btn.full {
  width: 100%;
  padding: 16px 22px;
  font-size: var(--size-16);
}

.w-cta .footer-note {
  margin-top: 0;
}

/* Generic empty state — used in Progress > Growth/Milestones, etc. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  padding: 28px 0 20px;
  text-align: center;
}

.empty-state .muted {
  font-size: var(--size-15);
  margin: 0;
}

.footer-note {
  text-align: center;
  font-size: var(--size-13);
  color: var(--ink-soft);
  margin-top: 14px;
  cursor: pointer;
  /* Reset button defaults so .footer-note works on a real <button> too. */
  background: transparent;
  border: 0;
  padding: 0;
  font-family: var(--font-body);
}

.footer-note:hover {
  text-decoration: underline;
}

.auth-screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  padding: 20px 0;
}

.top-bar-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.back-link {
  padding: 8px;
  font-size: var(--size-14);
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.15s ease;
}

.back-link:hover {
  color: var(--ink);
}

.step-progress {
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--ink-mute);
  font-weight: 500;
}

.step-heading {
  font-size: var(--size-24);
  margin-bottom: 8px;
}

.step-sub {
  font-size: var(--size-14);
  color: var(--ink-soft);
  margin-bottom: 16px;
}

.error {
  background: var(--surface-danger);
  border-left: 3px solid var(--danger);
  padding: 10px 12px;
  border-radius: 4px;
  font-size: var(--size-13);
  color: var(--danger);
  margin-bottom: 14px;
}

.label {
  display: block;
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 6px;
  font-weight: 500;
}

.input {
  display: block;
  width: 100%;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: var(--size-16);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s ease;
  margin-bottom: 14px;
}

.input:focus {
  border-color: var(--warm);
}

.input[type="date"] {
  font-family: var(--font-body);
}

/* Auth Pattern A — typographic horizon above the input cluster.
 * Inspired by Stripe Checkout's hairline-anchored block. */
.auth-form {
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--rule);
}

/* Auth footer line — smaller, mute, left-aligned. Replaces the old
 * generic "By continuing you agree…" line which has moved to /access-gate. */
.auth-foot {
  margin-top: 24px;
  font-size: var(--size-13);
  color: var(--ink-mute);
  text-align: left;
}

/* Quiet text-link button — used for "Wrong email? Try again." reset.
 * Reads as text, not as a button. Inherits warm-orange focus ring from
 * the global :focus-visible rule. */
.auth-text-link {
  margin-top: 16px;
  background: transparent;
  border: 0;
  padding: 4px 0;
  font-size: var(--size-14);
  font-family: var(--font-body);
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.auth-text-link:hover { color: var(--ink); }

/* Radio grid / tile selection */
.radio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.radio-grid.radio-grid[style*="1fr"] {
  grid-template-columns: 1fr;
}

.radio-tile {
  background: var(--paper-card);
  border: 2px solid var(--rule);
  border-radius: var(--r-md);
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.radio-tile:hover {
  border-color: var(--warm);
  background: var(--surface-hover-wash);
}

.radio-tile.on {
  border-color: var(--warm);
  background: var(--surface-notice);
}

.radio-tile .ic {
  font-size: var(--size-32);
  margin-bottom: 8px;
  display: block;
}

.radio-tile .body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  text-align: left;
}

.radio-tile.row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  text-align: left;
  grid-column: 1 / -1;
  padding: 12px 14px;
}

.radio-tile.row .ic {
  font-size: var(--size-28);
  margin-bottom: 0;
  flex-shrink: 0;
}

.radio-tile.row .body {
  flex: 1;
}

.radio-tile.row .body > div:first-child {
  font-weight: 500;
  color: var(--ink);
}

.radio-tile.row small {
  font-size: var(--size-12);
  color: var(--ink-soft);
}

/* Step screen */
.step-screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px);
  min-height: calc(100dvh - 80px);
  padding: 20px 0;
}

.progress-bar {
  display: flex;
  gap: 4px;
  margin: 12px 0 20px;
}

.progress-bar .seg {
  flex: 1;
  height: 4px;
  background: var(--rule);
  border-radius: 2px;
  transition: background 0.2s ease;
}

.progress-bar .seg.on {
  background: var(--warm);
}

/* Chip grid */
.chip-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 14px;
}

.chip {
  padding: 6px 14px;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 999px;
  font-size: var(--size-12);
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.chip:hover {
  border-color: var(--warm);
  background: var(--surface-hover-wash);
}

.chip.on {
  background: var(--warm);
  color: var(--paper);
  border-color: var(--warm);
}

/* Consent list */
.consent-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 14px 0;
}

/* ============================================================================
 * Profile / progress
 * ========================================================================== */
.me-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 18px;
}

.me-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.me-info .n {
  font-weight: 600;
  color: var(--ink);
}

.me-info .s {
  font-size: var(--size-13);
  color: var(--ink-soft);
}

.settings-group, .setting-group {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 18px;
  background: var(--paper-card);
  border-radius: var(--r-md);
  overflow: hidden;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  cursor: pointer;
  transition: background 0.15s ease;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-row:hover {
  background: var(--black-a02);
}

.s-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.s-ic {
  font-size: var(--size-22);
  flex-shrink: 0;
}

.s-label {
  font-weight: 500;
  color: var(--ink);
  font-size: var(--size-14);
}

.s-sub {
  font-size: var(--size-12);
  color: var(--ink-soft);
}

.s-right {
  color: var(--ink-mute);
  font-size: var(--size-18);
}

.progress-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--rule);
  margin: 14px 0 18px;
  overflow-x: auto;
  scrollbar-width: none;
}

.progress-tabs::-webkit-scrollbar {
  display: none;
}

.ptab {
  padding: 10px 12px;
  font-size: var(--size-13);
  font-weight: 500;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.ptab.on {
  color: var(--ink);
  border-bottom-color: var(--warm);
}

/* Arc */
.arc-now {
  background: var(--paper-card);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 14px;
  border-left: 3px solid var(--warm);
}

.arc-now-lab {
  font-family: var(--font-label);
  font-size: var(--size-10);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--warm);
  margin-bottom: 4px;
  font-weight: 500;
}

.arc-now-name {
  font-size: var(--size-18);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.arc-now-desc {
  font-size: var(--size-13);
  color: var(--ink-soft);
}

/* ============================================================================
 * Button styles
 * ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  font-family: var(--font-body);
  font-size: var(--size-15);
  font-weight: 500;
  padding: var(--space-12) var(--space-20);
  border-radius: var(--radius-pill);
  background: var(--surface-inverse);
  color: var(--text-on-dark);
  border: 0;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
}

.btn:hover {
  opacity: 0.92;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn.warm {
  background: var(--accent);
}

.btn.secondary {
  background: var(--surface-card);
  color: var(--text-primary);
  border: 1px solid var(--border-hairline);
}

.btn.full {
  width: 100%;
}

.btn.sm {
  font-size: var(--size-13);
  padding: var(--space-8) var(--space-16);
}

/* ============================================================================
 * Bottom tab bar (D-354 v10 / D-404 / D-427 / D-403)
 * Home / Weeks / Progress / Toolkit / Chat — one solid cream band, five
 * uniform tabs. Each tab carries a fixed 40px icon circle so the active cue
 * never shifts the baseline. Active = a soft round chip behind the icon + a
 * teal icon glyph (D-404: only the active tab's icon is coloured) + a teal
 * label. Inactive = neutral grey, recognisable by shape alone. Icons are
 * Phosphor Bold (D-427), recoloured via currentColor. Labels are Schibsted
 * (D-429). aria-current="page" drives the active state.
 * ========================================================================== */
.tabbar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--layout-bar-max);
  background: var(--surface-bar);
  border-top: 1px solid var(--border-hairline);
  display: flex;
  justify-content: space-around;
  padding: var(--space-8) var(--space-4);
  padding-bottom: max(var(--space-20), env(safe-area-inset-bottom));
  z-index: var(--z-nav);
  transition: transform var(--duration-200) var(--ease-in-out);
}

/* D-522(D) — AUTO-HIDE. 85px while you navigate; ZERO while you read.
 *
 * ⚠️ THE TRANSFORM MUST KEEP THE translateX(-50%). The bar is horizontally centred with
 * `left:50%; transform: translateX(-50%)`. Writing `transform: translateY(100%)` here would
 * REPLACE that — the bar would slide down AND jump half its own width to the right on the way.
 * A transform is one property, not a list you can add to. This is the single easiest way to
 * break this rule, and it looks like a rendering glitch rather than a CSS mistake. */
.tabbar.nav-away { transform: translateX(-50%) translateY(100%); }

.tab-item {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  color: var(--nav-inactive);
  font-family: var(--font-label);
  /* D-522(C) — 10px → 12px, weight UNCHANGED at 500 (active 600).
   *
   * ⚠️ THE SIZE WAS THE FIX. THE WEIGHT WAS ME PILING ON.
   * I first shipped 12px/600 with the active at 700, and Andrew's read was immediate: "text is a
   * bit heavy now." He is right, and the reason is worth writing down — the problem was never
   * that the labels were too LIGHT, it was that they were too SMALL. Ten pixels is legible in a
   * design review and not at arm's length in a dark room. Twelve fixes that.
   * Adding weight on top did not make them more legible; it made them SHOUT. Five words of
   * permanent chrome, bolded, at the bottom of every screen, competing with the content they
   * exist to help you leave. Two changes were made where one was needed, and the second undid
   * some of the good the first did. */
  font-size: var(--size-12);
  font-weight: var(--weight-500);
  line-height: var(--leading-120);
  transition: color var(--duration-150) var(--ease-standard);
}

/* Fixed 40px icon circle — identical for active and inactive so the active
   chip fills it without moving the baseline (D-354 v10). */
.tab-item .ic {
  width: var(--dim-40);
  height: var(--dim-40);
  display: grid;
  place-items: center;
  border-radius: var(--radius-round);
  transition: background var(--duration-150) var(--ease-standard);
}

.tab-item .ic-svg {
  width: var(--dim-24);
  height: var(--dim-24);
  display: block;
  fill: currentColor;
}

/* ── the Tools slot ────────────────────────────────────────────────────────
 * 🔴 THERE IS DELIBERATELY ALMOST NOTHING HERE, AND THAT IS THE DESIGN.
 * The slot inherits `.tab-item` wholesale — same chip, same 24px glyph, same
 * 12px/500 Schibsted label, same inactive ink. Every rule that used to give it
 * a teal or ink FILLED DISC has been deleted, not overridden. A raised circle
 * in the centre of a tab bar announces "the app's primary action"; in a product
 * whose primary action is reading, that is a claim made in geometry (D-671).
 *
 * ⚠️ AND IT IS NEVER `.active`. Tools is not a place, so it can never be the
 * place you are — `renderTabs` refuses to give an action slot the active class.
 * The OPEN state below is a different thing wearing similar clothes: it says
 * "this panel is showing", not "you are here". */
.tab-item.tab-tools .ic-svg {
  transition: transform var(--duration-200) var(--ease-in-out);
}

/* OPEN — the + becomes an ×. One transform on the same element, so the target
 * that opened it is the target that closes it, in the same place. 45° is exact:
 * the glyph is a symmetric cross, so a quarter-turn halved lands on a true ×
 * rather than something that approximates one. */
.tab-item.tab-tools.open { color: var(--nav-active); font-weight: var(--weight-600); }
.tab-item.tab-tools.open .ic { background: var(--nav-active-chip); color: var(--nav-active-icon); }
.tab-item.tab-tools.open .ic-svg { transform: rotate(45deg); }

/* D-450 — reduce-motion drops the ROTATION, never the STATE CHANGE. The glyph
 * still becomes an ×; it just stops spinning to get there. */
@media (prefers-reduced-motion: reduce) {
  .tab-item.tab-tools .ic-svg { transition: none; }
}

/* ⚠️ A STROKED GLYPH IN A BAR OF FILLED ONES. (D-676 · D-549)
 * `portrait` (user-circle-bold) is three stroked elements, carried as real asset markup because
 * redrawing it as a fill is the forgery D-549 forbids. Its children declare fill="none" and
 * stroke="currentColor" as presentation attributes, which beat the inherited `fill: currentColor`
 * above — so this rule is belt-and-braces, not the mechanism. It exists because the failure mode
 * is silent and total: if the fill ever DID win, the circle floods solid and the tab becomes a
 * black disc, which reads as a design choice rather than a bug. */
.tab-item .ic-svg [fill="none"] { fill: none; }

/* Active (D-404): teal label + teal icon glyph inside a soft warm-ink chip. */
.tab-item.active {
  color: var(--nav-active);
  /* D-522(C) — 600. Enough to say "you are here" against the 500 of its neighbours, and no more.
   * (700 was tried and read as heavy — see the size note above. And note this rule is the ONLY
   * place the active weight may be set: a duplicate EARLIER in this file never fired, because a
   * later rule of equal specificity wins. A CSS rule that never fires is worse than no rule.) */
  font-weight: var(--weight-600);
}

.tab-item.active .ic {
  background: var(--nav-active-chip);
  color: var(--nav-active-icon);
}

/* Micro-states (D-422): focus ring on the icon circle, press tone on tap. */
.tab-item:focus-visible { outline: none; }
.tab-item:focus-visible .ic { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.tab-item:active .ic { background: var(--nav-active-chip); }

/* ============================================================================
 * App shell — topbar (D-403 / D-229 / D-429)
 * Baby chip (avatar + name + weeks·days) on the left; profile avatar button on
 * the right → Profile. No profile TAB — profile lives here (D-403). Persistent
 * shell chrome rendered by renderTopbar(), above each surface's own hero zone.
 * Horizontal gutter comes from #app padding, so the bar itself is flush (0).
 * ========================================================================== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-8);
  padding: var(--space-8) 0 var(--space-4);
}

.topbar .babychip {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  background: var(--surface-card);
  border: 0;
  border-radius: var(--radius-pill);
  padding: var(--space-4) var(--space-12) var(--space-4) var(--space-4);
  cursor: pointer;
  transition: background var(--duration-150) var(--ease-standard);
}
.topbar .babychip:active { background: var(--surface-card-hover); }
.topbar .babychip:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }

.topbar .babychip .a {
  width: var(--dim-24);
  height: var(--dim-24);
  border-radius: var(--radius-round);
  background: var(--brand);
  color: var(--text-on-accent);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: var(--text-meta);
  font-weight: var(--weight-500);
}
.topbar .babychip .n {
  font-size: var(--text-caption);
  font-weight: var(--weight-600);
  color: var(--text-primary);
}
.topbar .babychip .w {
  font-family: var(--font-label);
  font-size: var(--text-label);
  font-weight: var(--weight-600);
  color: var(--text-secondary);
}

.topbar .av {
  width: var(--dim-32);
  height: var(--dim-32);
  border: 0;
  border-radius: var(--radius-round);
  background: var(--surface-sunken);
  color: var(--text-secondary);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background var(--duration-150) var(--ease-standard);
}
.topbar .av:active { background: var(--surface-card-hover); }
.topbar .av:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.topbar .av svg {
  width: var(--dim-16);
  height: var(--dim-16);
  fill: currentColor;
}

/* ============================================================================
 * Mic dock (fixed, above tab bar)
 * ========================================================================== */
.mic-dock {
  position: fixed;
  left: 22px;
  right: 22px;
  /* Sit above the tab bar (~56px + safe area) AND lift over the keyboard via --kb-h. */
  bottom: calc(68px + env(safe-area-inset-bottom) + var(--kb-h, 0px));
  background: var(--surface-inverse);
  border-radius: var(--radius-card);
  padding: var(--space-8) var(--space-8) var(--space-8) var(--space-12);
  display: flex;
  align-items: center;
  gap: var(--space-8);
  z-index: 95;
  box-shadow: var(--shadow-card);
  max-width: calc(var(--layout-col-max) - 44px);
  margin: 0 auto;
  animation: slideUp 0.3s ease;
  transition: bottom 0.18s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(120px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Inline text input inside the dock — typing replaces tap-through-to-capture */
.mic-input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text-on-dark);
  font-family: var(--font-body);
  font-size: var(--size-16);       /* 16px+ stops iOS auto-zooming on focus */
  padding: var(--space-8) var(--space-4);
}

.mic-input::placeholder {
  color: var(--cream-300-a55);
}

.mic-input:disabled {
  opacity: 0.6;
}

/* Legacy: the old <span> placeholder styling — keep it gracefully if old code lingers */
.mic-dock span:first-child {
  flex: 1;
  font-size: var(--size-13);
  color: var(--cream-300-a90);
  cursor: pointer;
}

.mic-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-round);
  background: var(--accent);
  color: var(--text-on-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-18);
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.mic-btn:hover {
  background: var(--accent-hover);
}

.mic-btn:active {
  transform: scale(0.96);
}

.mic-btn.on {
  background: var(--accent-hover);
  animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--orange-600-a55); }
  50%      { box-shadow: 0 0 0 10px var(--orange-600-a00); }
}

.x-close {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-round);
  background: var(--cream-300-a10);
  color: var(--cream-300-a70);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-20);
  cursor: pointer;
  transition: background 0.15s ease;
}

.x-close:hover {
  background: var(--cream-300-a20);
}

.mic-fab {
  position: fixed;
  bottom: calc(78px + env(safe-area-inset-bottom));
  right: 22px;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-round);
  background: var(--accent);
  color: var(--text-on-dark);
  display: none;
  align-items: center;
  justify-content: center;
  font-size: var(--size-20);
  z-index: 95;
  box-shadow: var(--shadow-card);
  cursor: pointer;
}

.mic-fab.visible {
  display: flex;
  animation: slideUp 0.3s ease;
}

/* ============================================================================
 * Utilities & misc
 * ========================================================================== */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--danger);
  color: var(--white);
  padding: 8px 16px;
  text-align: center;
  font-size: var(--size-12);
  font-weight: 500;
  z-index: 200;
}

.divider {
  height: 1px;
  background: var(--rule);
  margin: 18px 0;
}

.spacer {
  flex: 1;
}

.n, .s {
  display: block;
}

/* For tables, mono content */
.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' on;
}

/* Responsive: stack on mobile */
@media (max-width: 480px) {
  #app {
    padding: 0 16px 120px;
  }

  .proof-row {
    grid-template-columns: 1fr;
  }

  .radio-grid {
    grid-template-columns: 1fr;
  }

  .caia-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .quick-tiles {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================================
 * Modal — used for "Edit baby" and similar full-sheet forms.
 * Slides up from the bottom on mobile, centred on desktop. Cream paper inside,
 * dimmed ink overlay outside. Shares input/label/btn styles with the rest.
 * ========================================================================== */
/* The overlay uses a CSS variable --kb-h that the modal JS keeps in sync with the
 * iOS keyboard height (Capacitor Keyboard willShow / willHide). When the keyboard
 * is up, we lift the bottom of the overlay so the modal sheet sits above it.
 * Default is 0 so the overlay reaches the screen edge when no keyboard is shown. */
.modal-overlay {
  position: fixed;
  inset: 0;
  bottom: var(--kb-h, 0px);
  z-index: 1000;
  background: var(--overlay-scrim);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  transition: bottom 0.18s ease;
}

@media (min-width: 600px) {
  .modal-overlay {
    align-items: center;
    padding: 24px;
  }
}

/* Sheet uses dvh so keyboard correctly shrinks viewport on platforms that report it.
 * On iOS Capacitor the dvh trick doesn't always fire — that's why we also use --kb-h
 * on the overlay above as a belt-and-braces. */
.modal-sheet {
  background: var(--paper);
  width: 100%;
  max-width: var(--col-max);
  height: auto;
  max-height: calc(100dvh - var(--kb-h, 0px) - 24px);
  display: flex;
  flex-direction: column;
  border-top-left-radius: var(--r-lg);
  border-top-right-radius: var(--r-lg);
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
}

@media (min-width: 600px) {
  .modal-sheet {
    border-radius: var(--r-lg);
    max-height: 88dvh;
  }
}

.modal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
}

.modal-title {
  font-family: var(--font-display);
  font-size: var(--size-17);
  font-weight: 500;
  color: var(--ink);
}

.modal-close {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--size-22);
  line-height: var(--leading-100);
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-close:hover {
  background: var(--paper-card);
  color: var(--ink);
}

.modal-body {
  padding: 14px 20px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

/* Tighter spacing inside modals than full-page forms */
.modal-body .label {
  margin-top: 14px;
  margin-bottom: 6px;
  display: block;
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--ink-soft);
}

.modal-body .label:first-child {
  margin-top: 0;
}

.modal-body .input {
  width: 100%;
  padding: 12px 14px;
  font-size: var(--size-16);            /* 16px+ stops iOS auto-zooming on focus */
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  color: var(--ink);
  outline: none;
}

.modal-body .input:focus {
  border-color: var(--warm);
}

.modal-body .radio-grid {
  margin-bottom: 4px;
}

.modal-foot {
  display: flex;
  flex-direction: row-reverse;
  gap: 10px;
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--rule);
  background: var(--paper);
  flex-shrink: 0;
}

.modal-foot .btn {
  flex: 1;
  padding: 14px 20px;
}

@media (min-width: 600px) {
  .modal-foot .btn {
    flex: 0 0 auto;
    min-width: 120px;
  }
}

/* ============================================================================
 * Invite modal — role tiles, access list, share link box.
 * ========================================================================== */
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 4px;
}

.role-tile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-card);
  cursor: pointer;
  font-size: var(--size-14);
  font-weight: 500;
  color: var(--ink);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.role-tile:hover { border-color: var(--ink-soft); }

.role-tile.on {
  border-color: var(--warm);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--warm);
}

.role-tile .ic { font-size: var(--size-18); line-height: var(--leading-100); }

.access-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.access-row {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--paper-card);
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.access-row:hover { border-color: var(--ink-soft); }
.access-row.on    { border-color: var(--warm); box-shadow: inset 0 0 0 1px var(--warm); background: var(--paper); }

.access-check {
  flex-shrink: 0;
  font-size: var(--size-14);
  color: var(--warm);
  line-height: var(--leading-140);
  width: 16px;
  text-align: center;
}

.access-label {
  font-size: var(--size-14);
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.access-blurb {
  font-size: var(--size-12);
  line-height: var(--leading-145);
  color: var(--ink-soft);
}

.invite-link-box {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: var(--size-12);
  color: var(--ink);
  word-break: break-all;
  user-select: all;
}

/* Accept screen — quick callout under the headline */
.invite-blurb {
  background: var(--paper-card);
  border-left: 3px solid var(--warm);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  margin-top: 12px;
  font-size: var(--size-14);
  line-height: var(--leading-150);
  color: var(--ink-soft);
}

/* ============================================================================
 * Activity log — reads like a quiet ledger. Hairlines, mono timestamps.
 * ========================================================================== */
.activity-list {
  display: flex;
  flex-direction: column;
}

.activity-row {
  display: flex;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  align-items: flex-start;
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-when {
  flex-shrink: 0;
  width: 70px;
  font-family: var(--font-mono);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-04);
  color: var(--ink-mute);
  padding-top: 1px;
}

.activity-body {
  flex: 1;
  min-width: 0;
}

.activity-actor {
  font-size: var(--size-14);
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 1px;
}

.activity-action {
  font-size: var(--size-13);
  color: var(--ink-soft);
  line-height: var(--leading-140);
}

/* ============================================================================
 * MFA enrolment — QR, secret, factor list rows.
 * ========================================================================== */
.mfa-qr {
  display: block;
  width: 200px;
  height: 200px;
  margin: 12px auto;
  background: var(--white);
  border-radius: var(--r-md);
  padding: 8px;
  box-shadow: var(--shadow-soft);
}

.mfa-secret {
  font-family: var(--font-mono);
  font-size: var(--size-13);
  letter-spacing: var(--tracking-05);
  text-align: center;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  user-select: all;
  word-break: break-all;
}

.mfa-factor {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--rule);
}

.mfa-factor:last-child {
  border-bottom: 0;
}

.mfa-factor-info {
  flex: 1;
}

.mfa-factor-name {
  font-size: var(--size-14);
  font-weight: 500;
  color: var(--ink);
}

.mfa-factor-meta {
  font-size: var(--size-12);
  color: var(--ink-soft);
  margin-top: 2px;
}

/* ============================================================================
 * Phase 0/1 disclaimer — modal long-form text + bulleted list
 * Copy and structure per content/STYLE.md §"Phase 0/1 disclaimer".
 * ========================================================================== */
.disclaimer-body p {
  font-size: var(--size-15);
  line-height: var(--leading-155);
  color: var(--ink);
  margin: 0 0 12px;
}

.disclaimer-body .disclaimer-list {
  list-style: disc;
  padding-left: 20px;
  margin: 0 0 12px;
}

.disclaimer-body .disclaimer-list li {
  font-size: var(--size-15);
  line-height: var(--leading-155);
  color: var(--ink);
  margin-bottom: 8px;
}

/* Phase 0/1 'Pre-release version' footer tag — small subtle button fixed
 * above the tab bar on every authenticated screen. Taps open the full
 * disclaimer modal. Sits inside a 44px touch target via vertical padding
 * even though the visible text is much smaller.
 *
 * Position: tab bar visual height is 18+11+16 = 45px content + 1px top
 * border = 46px, before the safe-area-inset-bottom padding kicks in. Place
 * this tag immediately above. */
.footer-tag {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 99;
  max-width: var(--col-max);
  margin: 0 auto;
  display: block;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: var(--size-12);
  letter-spacing: var(--tracking-02);
  color: var(--ink-mute);
  background: transparent;
  border: 0;
  text-align: center;
  cursor: pointer;
  transition: color 0.15s ease;
}

.footer-tag:hover { color: var(--ink-soft); }
.footer-tag:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; border-radius: 2px; }

/* Phase 0/1 disclaimer banner on weekly articles — small muted strip below
 * the back button, above the hero. Renders verbatim CONDENSED VERSION
 * per content/STYLE.md §"Phase 0/1 disclaimer". Taps to open the full
 * modal. Reads as a banner, not as a button — typography carries the
 * affordance via the trailing 'About this version' link text. */
.weekly-disclaimer-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  margin: 12px 0 18px;
  padding: 12px 14px;
  background: var(--paper-2);
  border-radius: var(--r-sm);
  border: 0;
  font-family: var(--font-body);
  font-size: var(--size-13);
  line-height: var(--leading-140);
  color: var(--ink-soft);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease;
}

.weekly-disclaimer-banner:hover { background: var(--paper-card); }

.weekly-disclaimer-banner .weekly-disclaimer-text { flex: 1 1 auto; }
.weekly-disclaimer-banner .weekly-disclaimer-text strong { color: var(--ink); font-weight: 600; }

.weekly-disclaimer-banner .weekly-disclaimer-link {
  flex: 0 0 auto;
  font-size: var(--size-12);
  color: var(--warm);
  white-space: nowrap;
}

/* ── Page label (family pilot feedback helper) ──────────────────────────────
 * Small monospace label, bottom-right, above the tab bar.
 * Kill it: change --page-label to 'none' in the :root rule below.
 *
 * IT IS PINNED TO THE VIEWPORT, and must stay that way (checked at desktop width,
 * Gate 2 item 4, 2026-07-30): it names the SCREEN, so it belongs in the window's
 * corner on a 420px column surface and on a full-bleed read alike, never tucked
 * inside whichever card happens to be widest. What made it look like it was sitting
 * inside a card was 603 running the full width of the window — that was item 1, and
 * it is fixed in timeline.css, not here.
 *
 * THE 76px WAS TAB-BAR CLEARANCE ASSUMED UNCONDITIONALLY. Half the surfaces that set
 * a label have no tab bar — the phase read, the area read, the milestone year are all
 * full-screen drill-ins — and there the label floated 76px up from the corner with
 * nothing beneath it, which is what reads as misplaced on a tall desktop window. The
 * clearance is now asked for rather than assumed: `:has(.tabbar)` pays it where the
 * bar exists, and the corner is the corner everywhere else.                */
:root { --page-label: block; }

#page-label {
  display: var(--page-label, block);
  position: fixed;
  bottom: calc(12px + env(safe-area-inset-bottom));
  right: calc(12px + env(safe-area-inset-right));
  font-size: var(--size-11);
  font-family: ui-monospace, 'SF Mono', 'Menlo', monospace;
  font-variant-numeric: tabular-nums;
  color: var(--ink-cool-a38);
  pointer-events: none;
  z-index: 200;
  white-space: nowrap;
  letter-spacing: var(--tracking-01);
  user-select: none;
}

/* the tab bar is ~46px + safe area; 76 is the clearance the label has always used, kept
   verbatim so every tab surface's label sits exactly where it did. */
body:has(.tabbar) #page-label { bottom: calc(76px + env(safe-area-inset-bottom)); }

@media print { #page-label { display: none !important; } }

/* ============================================================================
 * Toolkit — tab 4 shell (D-240–D-255)
 * ============================================================================ */

/* Outer wrapper — uses #app padding except where the hero needs full bleed */
.tk-wrap { }

/* Inner padding wrapper (below hero) */
.tk-inner {
  padding: 0 22px;
}

/* ---- Hero ----------------------------------------------------------------- */
.tk-hero {
  padding: 40px 22px 32px;
  background: var(--hero);
  color: var(--white);
}

.tk-eyebrow {
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-12);
  color: var(--hero-soft);
  text-transform: uppercase;
  margin-bottom: 12px;
}

.tk-display {
  font-family: var(--font-display);
  font-size: clamp(var(--size-26), 7vw, var(--size-34));
  font-weight: 300;
  line-height: var(--leading-115);
  color: var(--white);
  margin-bottom: 12px;
}

.tk-standfirst {
  font-size: var(--size-14);
  color: var(--white-a72);
  line-height: var(--leading-150);
}

/* ---- Quick note section --------------------------------------------------- */
.tk-note-section {
  margin: 28px 0;
  padding: 20px;
  background: var(--paper-card);
  border-radius: var(--r-lg);
  border: 1px solid var(--rule);
}

.tk-note-heading {
  font-family: var(--font-display);
  font-size: var(--size-20);
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 8px;
}

.tk-note-sub {
  font-size: var(--size-13);
  color: var(--ink-soft);
  line-height: var(--leading-150);
  margin-bottom: 14px;
}

.tk-note-input {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: var(--size-15);
  color: var(--ink);
  background: var(--paper);
  resize: none;
  display: block;
  line-height: var(--leading-150);
  transition: border-color 0.15s ease;
  box-sizing: border-box;
}

.tk-note-input:focus {
  border-color: var(--warm);
  outline: none;
}

.tk-note-save {
  margin-top: 10px;
  width: 100%;
}

/* ---- Areas grid ----------------------------------------------------------- */
.tk-areas-section {
  margin: 28px 0;
}

.tk-areas-heading {
  font-family: var(--font-display);
  font-size: var(--size-22);
  font-weight: 300;
  color: var(--ink);
  margin-bottom: 6px;
}

.tk-areas-sub {
  font-size: var(--size-13);
  color: var(--ink-soft);
  line-height: var(--leading-150);
  margin-bottom: 16px;
}

.tk-areas-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tk-area-card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 14px 12px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  transition: background 0.12s ease;
}

.tk-area-card:active {
  background: var(--paper-2);
}

.tk-area-eyebrow {
  font-family: var(--font-label);
  font-size: var(--size-9);
  letter-spacing: var(--tracking-10);
  color: var(--ink-mute);
  text-transform: uppercase;
  margin-bottom: 6px;
}

.tk-area-name {
  font-family: var(--font-display);
  font-size: var(--size-16);
  font-weight: 400;
  color: var(--ink);
  line-height: var(--leading-120);
}

/* ---- Per-area landing ----------------------------------------------------- */
.tk-area-topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.tk-back {
  font-size: var(--size-14);
  color: var(--warm);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0;
}

.tk-area-title {
  font-family: var(--font-display);
  font-size: var(--size-22);
  font-weight: 300;
  color: var(--ink);
  line-height: var(--leading-115);
}

.tk-section {
  margin-bottom: 28px;
}

.tk-section-label {
  font-family: var(--font-label);
  font-size: var(--size-11);
  letter-spacing: var(--tracking-12);
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-bottom: 10px;
}

.tk-placeholder-card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 16px;
}

.tk-placeholder-text {
  font-size: var(--size-14);
  color: var(--ink-soft);
  font-style: italic;
}

/* Tool cards */
.tk-tool-card {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  padding: 16px;
  margin-bottom: 8px;
  text-align: left;
  width: 100%;
}

.tk-tool-card.tk-tool-live {
  cursor: pointer;
  transition: background 0.12s ease;
}

.tk-tool-card.tk-tool-live:active {
  background: var(--paper-2);
}

.tk-tool-card.tk-tool-coming-soon {
  opacity: 0.75;
}

.tk-tool-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tk-tool-name {
  font-size: var(--size-16);
  font-weight: 500;
  color: var(--ink);
}

.tk-tool-badge {
  font-family: var(--font-label);
  font-size: var(--size-9);
  letter-spacing: var(--tracking-08);
  text-transform: uppercase;
  color: var(--ink-mute);
  flex-shrink: 0;
}

.tk-tool-chev {
  color: var(--ink-soft);
  font-size: var(--size-18);
  flex-shrink: 0;
}

.tk-tool-benefit {
  font-size: var(--size-13);
  color: var(--ink-soft);
  line-height: var(--leading-145);
  margin-top: 6px;
}

/* Progress link bridge (D-252) */
.tk-progress-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 0;
  font-size: var(--size-15);
  color: var(--warm);
  border-top: 1px solid var(--rule);
  cursor: pointer;
  margin-bottom: 16px;
}

/* Not-found / coming-soon fallback */
.tk-not-found {
  color: var(--ink-soft);
  margin-top: 32px;
  font-style: italic;
  font-size: var(--size-15);
}

/* ---------------------------------------------------------------------------
 * Your tools — conditional quick-log panel (home-tools locked, ported D-464).
 * Token-native port of workbench/surfaces/home-tools.html "Your tools" piece;
 * slate kind-family chips (D-454), teal interactive (D-440). ytools-* namespace.
 * ------------------------------------------------------------------------- */
.ytools-slot:empty { display: none; }
.ytools-head { display: flex; align-items: baseline; justify-content: space-between; padding: var(--space-12) var(--space-16) var(--space-4); }
.ytools-head h2 { font-family: var(--font-display); font-weight: var(--weight-500); font-size: var(--size-20); letter-spacing: var(--tracking-neg-01); color: var(--text-primary); }
.ytools-seeall { display: inline-flex; align-items: center; gap: var(--space-4); font-family: var(--font-label); font-size: var(--size-12); font-weight: var(--weight-600); color: var(--accent); background: 0; border: 0; cursor: pointer; }
.ytools-seeall svg { width: var(--size-13); height: var(--size-13); display: block; }
.ytools-panel { margin: var(--space-4) var(--space-16) var(--space-8); background: var(--surface-card); border-radius: var(--radius-card-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.ytools-row { display: flex; align-items: center; gap: var(--space-12); padding: var(--space-12) var(--space-16); border-top: 1px solid var(--border-hairline); /* token-exception */ cursor: pointer; }
.ytools-row:first-child { border-top: 0; }
.ytools-chip { width: var(--dim-40); height: var(--dim-40); border-radius: var(--radius-round); background: var(--kind-track-fill); color: var(--kind-track-icon); display: flex; align-items: center; justify-content: center; flex: none; }
.ytools-chip svg { width: var(--size-18); height: var(--size-18); display: block; }
.ytools-mid { flex: 1; min-width: 0; }
.ytools-name { display: block; font-family: var(--font-display); font-weight: var(--weight-500); font-size: var(--size-16); color: var(--text-primary); line-height: var(--leading-120); }
.ytools-val { display: block; font-family: var(--font-label); font-size: var(--size-12); font-weight: var(--weight-600); color: var(--text-tertiary); margin-top: var(--space-4); }
.ytools-log { flex: none; display: inline-flex; align-items: center; gap: var(--space-4); font-family: var(--font-label); font-size: var(--size-13); font-weight: var(--weight-700); color: var(--accent); background: var(--teal-100); border: 0; border-radius: var(--radius-pill); padding: var(--space-8) var(--space-16); cursor: pointer; }
.ytools-log svg { width: var(--size-14); height: var(--size-14); display: block; }
.ytools-row:active { background: var(--surface-card-hover); }
.ytools-log:active, .ytools-seeall:active { opacity: 0.72; }
.ytools-row:focus-visible, .ytools-log:focus-visible, .ytools-seeall:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }




/* ============================================================================
 * /weekly — the week read host (views/week-read.js · 502 port)
 * ========================================================================== */
/* the read's column owns its own gutters (.wkr pads itself, exactly as it renders in the
 * WB frame) — #app's shell padding would double them, so the host escapes it the same way
 * the preview host does (see #app:has(> .nh-pvdev) above). Bottom clearance stays: the
 * auto-hiding tab bar still needs its landing strip. */
#app:has(> .wkv-host) {
  padding-left: 0;
  padding-right: 0;
}
/* the whole screen reads on the light card while she reads — the app-side twin of
 * read.css's WB-scoped `.afscreen { background: var(--surface-card) }` rule */
.wkv-host { background: var(--surface-card); min-height: 100dvh; }

/* the honest empty (D-541) — an unwritten week says so. The header echoes the card's own
 * scale (read.css .wkr-num/.wkr-weeks) so stepping between a written and an unwritten week
 * doesn't jump the chrome, but the classes are the view's: card CSS is self-contained and
 * this state is not the card's. */
.wkv-empty { text-align: center; padding: var(--space-40) var(--space-16) var(--space-40); }
.wkv-navrow { display: flex; align-items: center; justify-content: center; gap: var(--space-16); }
.wkv-step { width: var(--dim-44); height: var(--dim-44); flex: none; display: grid; place-items: center; background: var(--surface-ground); color: var(--nav-active); border: 1px solid var(--border-hairline); border-radius: var(--radius-round); cursor: pointer; font-size: var(--size-18); }
.wkv-step:active { background: var(--surface-card-hover); }
.wkv-step:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
.wkv-step[disabled] { opacity: 0.35; cursor: default; }
.wkv-num { font-family: var(--font-display); font-weight: var(--weight-600); font-size: var(--size-60); line-height: var(--leading-100); color: var(--nav-active); letter-spacing: var(--tracking-neg-015); }
.wkv-weeks { font-family: var(--font-label); font-size: var(--size-12); font-weight: var(--weight-600); letter-spacing: var(--tracking-14); text-transform: uppercase; color: var(--accent); margin-top: var(--space-4); }
.wkv-none { font-family: var(--font-display); font-size: var(--size-16); color: var(--text-secondary); margin-top: var(--space-24); }
.wkv-return { font-family: var(--font-label); font-size: var(--size-13); font-weight: var(--weight-600); color: var(--accent); background: var(--teal-100); border: 0; border-radius: var(--radius-pill); padding: var(--space-8) var(--space-16); margin-top: var(--space-16); cursor: pointer; }
.wkv-return:active { opacity: 0.72; }
.wkv-return:focus-visible { outline: var(--focus-ring); outline-offset: var(--focus-offset); }
