/* ─── Badge progress rings (SVG arc) ─────────────────────────────────────────
   Horseshoe-style arc ring: 270° span, 90° gap at bottom (6 o'clock).
   Arc runs from 7:30 to 4:30. Implemented as inline SVG in badge-ring.js.
   The fill circle uses stroke-dashoffset for smooth CSS-transition animation.

   .ring-wrap: relative container so the text label can be absolutely centered.
   .ring-label: overlays tier initial + level number on top of the SVG.
   .ring-pct: smaller % display inside the label. */

.ring-wrap {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
}

.ring-wrap.sm { width: 48px; height: 48px; }
.ring-wrap.md { width: 72px; height: 72px; }
.ring-wrap.lg { width: 90px; height: 90px; }

.ring-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
  color: var(--text);
  pointer-events: none; /* label should never intercept clicks on parent */
}
.ring-wrap.sm .ring-label { font-size: 9px;  }
.ring-wrap.md .ring-label { font-size: 11px; }
.ring-wrap.lg .ring-label { font-size: 13px; }

.ring-pct { font-size: 8px; color: var(--muted); font-weight: 600; }

/* Arrow navigation button — compact replacement for text "Continue" in list rows.
   The › character signals forward navigation without consuming horizontal space. */
.icon-btn { padding: 8px 14px; font-size: 18px; min-width: unset; line-height: 1; }

/* Lesson type icon — shown inline before lesson title on topic page */
.lesson-icon { font-size: 11px; color: var(--muted); margin-right: 6px; flex-shrink: 0; }

/* ─── Bonus indicator ────────────────────────────────────────────────────────
   Shown on badges and lessons tied to the daily task bonus path.
   Uses warn color to visually signal "this is the high-value action today". */
.bonus-label {
  font-size: 10px;
  font-weight: 850;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  padding: 2px 7px;
  white-space: nowrap;
}

/* ─── Content state badges ───────────────────────────────────────────────────
   Applied to lesson items on the topic page. The state tells users where they
   are in each piece of content without requiring them to tap in to find out. */
.state-badge {
  font-size: 10px;
  font-weight: 850;
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}
.state-badge.not-started { background: var(--soft);         color: var(--muted);  }
.state-badge.in-progress  { background: var(--accent-soft); color: var(--accent); }
.state-badge.completed    { background: var(--good-bg); color: var(--good); border: 1px solid var(--good-border); }

/* ─── Content type tags ──────────────────────────────────────────────────────
   Lesson vs refresher must feel visually distinct — PRD requires they are
   understood as different content types before the user taps in. */
.content-type-tag {
  font-size: 9px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .05em;
  border-radius: 6px;
  padding: 2px 6px;
  display: inline-block;
  margin-bottom: 4px;
}
.content-type-tag.lesson    { background: var(--accent-soft); color: var(--accent); }
.content-type-tag.refresher { background: var(--warn-bg);     color: var(--warn);   }

/* ─── Quiz answer states ─────────────────────────────────────────────────────
   Correct/incorrect feedback on quiz choices. Wrong answers show red background
   and are visually disabled — user must keep trying until correct. This is intentional
   UX per spec: quiz is a learning tool, not a pass/fail gate. */
.choice.correct  { border-color: var(--good); background: var(--good-bg); color: var(--good); }
.choice.wrong    { border-color: var(--danger); background: var(--danger-bg);
                   color: var(--danger); opacity: 0.55;
                   text-decoration: line-through; }

/* ─── Ring label level-up pulse ──────────────────────────────────────────────
   Applied momentarily via JS when the level number increments during the reward
   animation. Class is added by setTimeout, removed after 0.4s so it can retrigger
   for a second level-up on the same ring. Translate keeps it centered during scale. */
@keyframes ring-label-pulse {
  0%   { transform: translate(-50%,-50%) scale(1);   opacity: 1;   }
  40%  { transform: translate(-50%,-50%) scale(1.5); opacity: 0.8; }
  100% { transform: translate(-50%,-50%) scale(1);   opacity: 1;   }
}
.ring-label.pulse { animation: ring-label-pulse 0.4s ease; }

/* ─── Bonus corner indicators ────────────────────────────────────────────────
   .bonus-corner: large indicator with "⚡ Bonus" text — badge board cards and
   topic page header. Positioned absolute top-right; parent needs position:relative.
   .bonus-corner-sm: icon-only — lesson items in topic page. Smaller, no text. */
.bonus-corner {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 9px;
  font-weight: 850;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  padding: 2px 6px;
  white-space: nowrap;
}
.bonus-corner-sm {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 11px;
  color: var(--warn);
}

/* ─── Reward screen — event badges (level up / tier up) ──────────────────────
   Shown ABOVE the ring for any badge that leveled up or tiered up.
   A fixed-height slot reserves space in every cell so all rings are vertically
   aligned regardless of which badges had events. Default color = green (level up);
   tier-up variant overrides to gold inline. */
.reward-event-badge {
  font-size: 10px;
  font-weight: 850;
  color: var(--good);
  background: var(--good-bg);
  border: 1px solid var(--good-border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.reward-event-badge--warn {
  font-size: 10px;
  font-weight: 850;
  color: var(--warn);
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ─── Lesson Player ──────────────────────────────────────────────────────────
   Full-height, non-scrolling three-section layout:
     .lp-stage    — top visual area (accent bg, waveform, title)
     .lp-subtitle — middle subtitle strip (prev / current / next sentence)
     .lp-controls — bottom audio controls bar
   screenRoot gets .lesson-mode in render.js, which removes padding + overflow. */

.lp-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ── Stage ── */
.lp-stage {
  flex: 0 0 42%;
  background: var(--accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 20px;
  position: relative;
}

.lp-stage-title {
  font-size: 22px;
  font-weight: 850;
  color: #fff;
  text-align: center;
  letter-spacing: -.03em;
  margin: 0;
  line-height: 1.25;
}

/* Back button — top-left of staging area */
.lp-back-btn {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  font-size: 24px;
  font-weight: 850;
  border-radius: 10px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Waveform bars — 7 bars, each with a unique keyframe for organic feel */
.lp-wave {
  display: flex;
  align-items: flex-end;
  gap: 5px;
  height: 56px;
}

.lp-wave-hidden { display: none; }

.lp-bar {
  width: 5px;
  height: 10px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 3px;
}

@keyframes lp-b1 { 0%,100% { height: 10px; } 50% { height: 50px; } }
@keyframes lp-b2 { 0%,100% { height: 22px; } 50% { height: 46px; } }
@keyframes lp-b3 { 0%,100% { height: 8px;  } 50% { height: 54px; } }
@keyframes lp-b4 { 0%,100% { height: 18px; } 50% { height: 48px; } }
@keyframes lp-b5 { 0%,100% { height: 12px; } 50% { height: 42px; } }
@keyframes lp-b6 { 0%,100% { height: 26px; } 50% { height: 52px; } }
@keyframes lp-b7 { 0%,100% { height: 6px;  } 50% { height: 46px; } }

.lp-wave.playing .lp-bar:nth-child(1) { animation: lp-b1 0.70s ease-in-out infinite; }
.lp-wave.playing .lp-bar:nth-child(2) { animation: lp-b2 0.90s ease-in-out infinite 0.12s; }
.lp-wave.playing .lp-bar:nth-child(3) { animation: lp-b3 0.65s ease-in-out infinite 0.28s; }
.lp-wave.playing .lp-bar:nth-child(4) { animation: lp-b4 0.85s ease-in-out infinite 0.05s; }
.lp-wave.playing .lp-bar:nth-child(5) { animation: lp-b5 0.75s ease-in-out infinite 0.40s; }
.lp-wave.playing .lp-bar:nth-child(6) { animation: lp-b6 0.80s ease-in-out infinite 0.20s; }
.lp-wave.playing .lp-bar:nth-child(7) { animation: lp-b7 0.70s ease-in-out infinite 0.35s; }

/* ── Subtitle strip ── */
.lp-subtitle {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  background: var(--screen);
}

.lp-sub-prev,
.lp-sub-next {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 1.5;
  margin: 0;
  min-height: 1.5em;
  opacity: 0.6;
}

.lp-sub-curr {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
  line-height: 1.55;
  margin: 0;
  min-height: 2em;
}

/* ── Controls bar ── */
.lp-controls {
  flex: 0 0 auto;
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--screen);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lp-ctrl-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lp-ctrl-btn { flex: 1; font-size: 13px; }
.lp-speed-btn { min-width: 46px; }

.lp-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lp-time-label {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  min-width: 30px;
}

/* Progress track */
.lp-progress {
  flex: 1;
  height: 6px;
  background: var(--progress-bg);
  border-radius: 999px;
  overflow: hidden;
}

.lp-progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  /* Short linear transition interpolates between the ~100ms clock ticks so the
     bar reads as continuous motion rather than 10 discrete steps per second. */
  transition: width 0.12s linear;
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .04);
}

.admin-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 14px;
  color: var(--text);
}

.admin-card-title {
  font-size: 13px;
  font-weight: 850;
  margin: 0 0 10px;
}

.item-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  margin-bottom: 10px;
}

.item-card:hover,
.task-card:hover {
  background: var(--soft);
  cursor: pointer;
}

.stage-card {
  height: 245px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 34px;
  font-weight: 850;
  letter-spacing: -.04em;
  /* Anchors .chat-buddy-btn, which deliberately overhangs the bottom edge.
     The extra bottom margin is the room that overhang needs. */
  position: relative;
  margin-bottom: 34px;
}

/* Chat pill — straddles the stage's bottom edge, half on/half off, so it reads
   as attached to the scene rather than to the task list below it. */
.chat-buddy-btn {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 12px 26px;
  font-size: 15px;
  font-weight: 850;
  letter-spacing: 0;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(16, 24, 40, .16);
  z-index: 2;
}

.chat-buddy-btn:hover  { background: var(--soft); }
.chat-buddy-btn:active { opacity: .86; }

/* Typography */
.title {
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -.03em;
  margin: 0;
}

.subtitle {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.35;
  margin: 6px 0 0;
}

.section-title {
  font-size: 16px;
  font-weight: 850;
  margin: 0 0 10px;
}

/* Semantic typography helpers — use instead of inline font-size/weight styles */
.label    { font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.stat-val { font-size: 13px; font-weight: 700; }
.caption  { font-size: 11px; color: var(--muted); }

.helper {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

/* Spacing utility overrides */
.mb-sm  { margin-bottom: 8px;  }
.mb-md  { margin-bottom: 12px; }
.mb-0   { margin-bottom: 0;    }

/* Layout helpers */
.row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

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

/* Buttons */
.button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  padding: 10px 13px;
  border-radius: 13px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

/* .primary is an alias for the default button style — explicit intent marker */
.button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.button.secondary {
  border-color: var(--line);
  background: var(--card);
  color: var(--text);
}

/* Compact button variant for inline actions inside cards */
.button.small {
  font-size: 11px;
  padding: 5px 10px;
}

.button.full {
  width: 100%;
}

.button:not(:disabled):hover        { filter: brightness(1.06); }
.button.secondary:not(:disabled):hover { filter: none; background: var(--soft); }
.button:not(:disabled):active       { opacity: .86; }

.button:disabled {
  opacity: .55;
  cursor: default;
}

/* Forms */
.input-group {
  margin-bottom: 12px;
}

.input-group label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  font-weight: 850;
  margin-bottom: 5px;
}

.input-group input,
.input-group textarea,
.input-group select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  padding: 9px;
  font-family: Arial, Helvetica, sans-serif;
  outline: none;
}

.input-group textarea {
  min-height: 58px;
  resize: vertical;
}

/* Progress */
.progress {
  height: 10px;
  background: var(--progress-bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

/* Pills */
.pill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  border: 1px solid var(--accent-border);
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 850;
}

/* Badges */
.badge-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.badge-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 13px;
}

.badge-patch {
  width: 52px;
  height: 52px;
  border: 1px solid var(--line);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 850;
  color: var(--muted);
  margin-bottom: 10px;
  background: var(--soft);
}

.badge-name {
  font-size: 13px;
  font-weight: 850;
  margin-bottom: 4px;
}

/* Task cards */
.home-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.settings-btn {
  min-width: 74px;
  height: 38px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-bottom: 8px;
}

.task-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .04);
}

.task-card.completed {
  opacity: .72;
  background: var(--soft);
}

.task-title {
  font-size: 14px;
  font-weight: 850;
  margin: 0 0 4px;
}

.task-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  margin: 0;
}

.done-state {
  border: 1px solid var(--good-border);
  background: var(--good-bg);
  color: var(--good);
  border-radius: 13px;
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

/* Flow */
.flow-footer {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

/* Lesson */
.audio-box {
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--soft);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

/* Quiz */
.choice {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 15px;
  padding: 13px;
  text-align: left;
  cursor: pointer;
  font-weight: 800;
}

.choice.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* Marketplace */
.market-category {
  font-size: 12px;
  font-weight: 850;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 8px;
}

/* Notes */
.note {
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: 16px;
  padding: 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

/* Baby Budget iframe */
.bb-iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: var(--screen);
}

/* ─── Budget Dashboard ────────────────────────────────────────────────────── */

/* Ghost overlay — empty-state promise view */
.budget-ghost-wrap { position: relative; margin-bottom: 14px; }
.budget-ghost-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 2;
}
.budget-ghost-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 20px;
  width: 100%;
  max-width: 280px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10);
}

/* Category tile grid — 2 columns; savings spans full width */
.budget-tile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.budget-tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: box-shadow .15s;
}
.budget-tile:active { box-shadow: 0 2px 10px rgba(49,94,251,.18); }
.budget-tile-full { grid-column: 1 / -1; }

.budget-tile-top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.budget-tile-icon { font-size: 16px; flex-shrink: 0; }
.budget-tile-name { font-size: 12px; font-weight: 850; flex: 1; }
.budget-tile-amount { font-size: 20px; font-weight: 850; line-height: 1.1; }
.budget-tile-delta  { font-size: 10px; color: var(--muted); line-height: 1.3; }
.budget-tile-target { font-size: 10px; font-weight: 850; color: var(--accent); }

/* Signal pills */
.budget-signal-pill {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 850;
  padding: 3px 8px;
  border-radius: 99px;
  width: fit-content;
  white-space: nowrap;
}
.budget-signal-pill.on-track      { background: var(--good-pill-bg);        color: var(--good-pill-text); }
.budget-signal-pill.intentional   { background: var(--accent-soft);         color: var(--accent); }
.budget-signal-pill.worth-a-look  { background: var(--warn-pill-bg);        color: var(--warn-pill-text); }
.budget-signal-pill.worth-a-look.strong { background: var(--warn-pill-strong-bg); color: var(--warn-pill-strong-text); }
.budget-signal-pill.context-only  { background: var(--soft);                color: var(--muted); }

/* Goals mini — inside Savings tile */
.budget-goals-mini {
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.budget-goals-row {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  padding: 2px 0;
  cursor: pointer;
}

/* Header metrics — Income / Plan / Remaining */
.budget-header-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}
.budget-header-metric { text-align: center; }
.budget-header-label {
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  margin-bottom: 2px;
}
.budget-header-value { font-size: 18px; font-weight: 850; line-height: 1.1; }
.budget-header-sub   { font-size: 9px; color: var(--muted); }

/* Expandable overhead detail */
.budget-overhead-detail.hidden { display: none; }

/* ─── Budget Category Detail ─────────────────────────────────────────────── */

/* Intentional toggle pill */
.budget-intentional-toggle {
  flex-shrink: 0;
  padding: 8px 18px;
  border-radius: 99px;
  border: 2px solid var(--line);
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.budget-intentional-toggle.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

/* ±$25 stepper */
.budget-stepper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.budget-stepper-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--soft);
  font-size: 20px;
  font-weight: 850;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: background .1s;
}
.budget-stepper-btn:active { background: var(--accent-soft); }
.budget-stepper-input {
  flex: 1;
  text-align: center;
  font-size: 22px;
  font-weight: 850;
  border: 2px solid var(--line);
  border-radius: 12px;
  padding: 8px 12px;
  background: var(--card);
  color: var(--text);
  -moz-appearance: textfield;
}
.budget-stepper-input::-webkit-outer-spin-button,
.budget-stepper-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.budget-stepper-input:focus { outline: none; border-color: var(--accent); }

/* Goals V2 form fields — theme-aware (light + dark), no number spinners.
   Mirrors .input-group input; spinner removal scoped to number inputs so
   <select> keeps its native caret. */
.goal-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 13px;
  padding: 9px;
  font-family: inherit;
  outline: none;
}
.goal-field:focus { border-color: var(--accent); }
.goal-field option { background: var(--card); color: var(--text); }
input.goal-field[type="number"] { -moz-appearance: textfield; }
input.goal-field[type="number"]::-webkit-outer-spin-button,
input.goal-field[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Income-relative progress bar with peer marker */
.budget-sub-bar {
  position: relative;
  height: 8px;
  border-radius: 99px;
  background: var(--bar);
  overflow: visible;
}
.budget-sub-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  max-width: 100%;
  transition: width .2s ease;
}
.budget-sub-bar-peer {
  position: absolute;
  top: -3px;
  width: 2px;
  height: 14px;
  background: var(--warn);
  border-radius: 2px;
  transform: translateX(-50%);
  opacity: 0.8;
}

/* Card color variants — accent-soft or warn backgrounds */
.card.card--accent { background: var(--accent-soft); border-color: var(--accent-border); }
.card.card--warn   { background: var(--warn-bg);     border-color: var(--warn-border);   }

/* Inline alert strip — warn variant (reconciliation signal, budget alerts) */
.budget-alert--warn {
  padding: 10px 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: 12px;
  font-size: 12px;
}

/* Debt strategy pills — semantic colors for each payoff strategy */
.strategy-pill--snowball  { color: var(--accent); }
.strategy-pill--avalanche { color: var(--good);   }
.strategy-pill--equal     { color: var(--warn);   }
.strategy-pill--minimum   { color: var(--muted);  }

/* ─── Debt screens ─────────────────────────────────────────────────────────── */
.debt-card-chevron {
  font-size: 12px;
  color: var(--muted);
  transition: transform .15s;
  display: inline-block;
}
.debt-card-chevron.open {
  transform: rotate(180deg);
}
.debt-best-badge {
  font-size: 10px;
  font-weight: 850;
  background: var(--good-bg);
  color: var(--good);
  border: 1px solid var(--good-border);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}
.debt-graph-wrap {
  width: 100%;
  overflow-x: auto;
}
.debt-strategy-best {
  border-color: var(--good) !important;
}

.payoff-behavior-btn {
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--line);
}
.payoff-behavior-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Lifestyle question chain ────────────────────────────────────────────────
   Ported from bb_template.html. Used by lifestyle-chain.js.
*/
.lifestyle-img-box {
  width: 100%;
  height: 120px;
  background: var(--progress-bg, var(--soft));
  border-radius: 16px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lifestyle-img-section {
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 11px;
  font-weight: 850;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lifestyle-img-coords {
  font-size: 22px;
  font-weight: 850;
  color: var(--accent);
  letter-spacing: .2em;
}
.lifestyle-img-subprog {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 11px;
  color: var(--muted);
}
.tier-pill-row {
  display: flex;
  gap: 8px;
  margin: 12px 0 10px;
  flex-wrap: wrap;
}
.tier-pill {
  flex: 1;
  min-width: 60px;
  text-align: center;
  padding: 9px 6px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  background: var(--card);
  -webkit-user-select: none;
  user-select: none;
  transition: background .12s, border-color .12s, color .12s;
}
.tier-pill.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}
.tier-selected-desc {
  font-size: 12px;
  color: var(--text);
  line-height: 1.45;
  padding: 9px 11px;
  background: var(--soft);
  border-radius: 10px;
}

/* ─── Chat with Buddy ────────────────────────────────────────────────────────
   Screen: screens/chat.js. The shell is a full-height flex column so the thread
   scrolls on its own while the chips + input bar stay pinned to the bottom —
   this requires .screen-scroll.chat-mode (layout.css) to drop its own padding
   and scrolling, the same arrangement lesson-mode uses. */
.chat-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
}

.chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.chat-thread {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-row { display: flex; }
.chat-row-user { justify-content: flex-end; }

.chat-bubble {
  max-width: 82%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.45;
}

.chat-bubble-buddy {
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}

.chat-bubble-user {
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft);
  color: var(--text);
  border-bottom-right-radius: 5px;
}

/* Link out of a reply — the user always taps it; chat never auto-navigates. */
.chat-link {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 9px 11px;
  border: 1px solid var(--accent);
  border-radius: 11px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}

.chat-link:hover { filter: brightness(1.06); }

.chat-foot {
  flex-shrink: 0;
  border-top: 1px solid var(--line);
  background: var(--card);
  padding: 10px 18px 14px;
}

.chat-chips {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-end;
  gap: 8px;
  padding-bottom: 12px;
}

.chat-chip {
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap; /* a chip never wraps its text — it moves to the next row whole */
  cursor: pointer;
}

.chat-chip:hover { background: var(--accent-soft); border-color: var(--accent); }

.chat-inputbar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chat-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--screen);
  color: var(--text);
  font-size: 13px;
  padding: 11px 14px;
  font-family: Arial, Helvetica, sans-serif;
  outline: none;
}

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

/* ─── Lifestyle Survey (builder flow) ────────────────────────────────────────
   Screens: screens/lifestyle-survey.js. Full-screen flow (nav hidden). The
   4-notch slider is a native range input with decorative dots under the track;
   commit on release (onchange) — never oninput, a mid-drag re-render would
   destroy the thumb. Theme tokens only. */
.ls-wrap { padding-top: 6px; }

.ls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.ls-header .button { font-size: 12px; padding: 8px 14px; }

/* Question phase: full-height column so the stage grows and the selector pins
   to the bottom. (Basics/Review still use .ls-wrap normal flow.) */
.ls-q-layout {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  padding-top: 6px;
}

/* Large stage — the star of the screen; describes the current selection (or the
   typical reference before a pick) in real-world terms. Grows to fill space. */
.ls-q-stage {
  flex: 1 1 auto;
  overflow-y: auto;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 20px;
  padding: 22px 20px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.ls-stage-eyebrow {
  font-size: 21px;
  font-weight: 850;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}
.ls-stage-ref,
.ls-stage-figure { font-size: 15px; line-height: 1.5; margin: 0 0 12px; }
.ls-stage-ref strong,
.ls-stage-figure strong { font-weight: 850; }
.ls-stage-lead {
  font-size: 24px;
  font-weight: 850;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ls-stage-pct { font-size: 12px; font-weight: 850; }
.ls-stage-desc { font-size: 14px; line-height: 1.6; color: var(--text); margin: 0 0 12px; }
.ls-stage-desc:last-child { margin-bottom: 0; }
.ls-stage-prompt { font-size: 15px; font-weight: 800; color: var(--muted); margin: 0; }

/* Bottom selector: tappable 4-notch scale (all labels shown, hollow until
   tapped — no misleading fill) + Next. */
.ls-q-selector { flex: 0 0 auto; padding-bottom: 4px; }
.ls-notches {
  position: relative;
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.ls-notches::before {
  content: "";
  position: absolute;
  top: 9px;
  left: 12.5%;
  right: 12.5%;
  height: 2px;
  background: var(--line);
}
.ls-notch {
  flex: 1;
  background: transparent;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ls-notch-dot {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--line);
  transition: background .12s, border-color .12s, transform .12s;
}
.ls-notch.active .ls-notch-dot { background: var(--accent); border-color: var(--accent); transform: scale(1.12); }
.ls-notch-label { font-size: 10px; font-weight: 700; color: var(--muted); text-align: center; line-height: 1.2; }
.ls-notch.active .ls-notch-label { color: var(--accent); }

/* Slider used by the Review step (kept from the original ls- section). */
.ls-slider {
  width: 100%;
  position: relative;
  z-index: 1;
  padding: 0;
  accent-color: var(--accent);
  background: transparent;
}

/* Income mode toggle (twin of the wizard's seg-toggle) */
.ls-seg {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--line);
  border-radius: 13px;
  overflow: hidden;
  margin-bottom: 10px;
}
.ls-seg-btn {
  padding: 9px;
  font-size: 13px;
  font-weight: 850;
  background: var(--card);
  color: var(--muted);
  border: none;
  border-radius: 0;
  cursor: pointer;
}
.ls-seg-btn.active { background: var(--accent); color: #fff; }

/* Review step: compact slider rows + pinned-feel totals */
.ls-review-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--screen);
  padding: 4px 0 8px;
}
.ls-total-box {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
}
.ls-review-row { padding: 10px 12px; margin-bottom: 8px; }

/* Modal overlay (skip confirm / save prompt) */
.ls-modal-bg {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
}
