/*
 * A New Chapter Tracker
 * Copyright (c) 2026 Jessica A. Miller. All rights reserved.
 * https://millrjess.github.io/tracker/
 */

:root {
  --gold: #E8B54A;
  --gold-dark: #A78235;
  --gold-light: #F5DEAE;
  --gold-soft: #FDF8ED;
  --sage: #5A6B52;
  --sage-dark: #44503E;
  --sage-deep: #364031;
  --sage-light: #7A8B6F;
  --sage-soft: #DEE1DC;
  /* Very light sage tint: 12% exact sage #5A6B52 mixed with white, so the
     white cards stand out against the page (v164 beauty redesign). */
  --sage-tint: #EBEDEA;
  --cream: #FDFBF7;
  --card-bg: #FFFFFF;
  --ink: #2B2B28;
  --ink-soft: #4A4840;
  --muted: #6E6A5E;
  --border: #E8E2D4;
  --sage-border: #DEE1DC;
  --danger: #87692B;
  --focus: #5A6B52;
  --radius: 20px;
  --radius-sm: 14px;
  --shadow: 0 2px 16px rgba(78, 92, 70, 0.08);
  --shadow-lift: 0 8px 28px rgba(78, 92, 70, 0.12);
}

* {
  box-sizing: border-box;
}

/* Plain links use the brand sage dark, never the browser default blue. */
a, a:visited {
  color: var(--sage-dark);
}
/* Dark theme plain links (v049, R-08): sage dark is too dark on dark
   cards, so links use the light sage from the dark-theme palette. */
html[data-theme="dark"] a, html[data-theme="dark"] a:visited {
  color: #9DB894;
}

:focus-visible {
  outline: 3px solid var(--focus);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  background: #5A6B52;
  color: #FDFBF7;
  padding: 12px 16px;
  border-radius: 8px;
  z-index: 100;
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus {
  top: 12px;
  outline-offset: 2px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

h1, h2, h3, .card {
  overflow-wrap: break-word;
}

html {
  -webkit-text-size-adjust: 100%;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  margin-top: 0;
}

.app-header {
  background: var(--sage-deep);
  color: #fff;
  padding: 24px 20px 24px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(78, 92, 70, 0.18);
  position: relative;
  overflow: hidden;
  border-bottom: 3px solid var(--gold);
}

/* Flat sage header: no gradients, per the Brand Identity guide. */

.app-header h1 {
  color: #fff;
  font-size: clamp(1.5rem, 5vw, 1.75rem);
  margin: 0 0 8px;
  letter-spacing: 0.01em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.12);
  font-weight: 700;
  position: relative;
  overflow-wrap: break-word;
  max-width: 100%;
}

/* v063: the header lotus is out (her call: it competed with the bloom).
   The title and tagline carry the brand now. */

.app-header .tagline {
  margin: 0;
  font-size: 1.02rem;
  opacity: 0.92;
  font-style: italic;
  position: relative;
  letter-spacing: 0.02em;
  color: #E8B54A;
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 16px 28px;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* v052: cards fade in gently when a tab opens. Opacity only, 0.25s
   ease, no keyframes. The .tab-fading class holds them at opacity 0
   for one frame; showTab removes it and they ease in. Reduced motion
   makes the transition instant. */
.tab-panel .card { transition: opacity 0.25s ease; }
.tab-panel.tab-fading .card { opacity: 0; transition: none; }

.tab-panel h2 {
  font-size: 1.375rem;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

.date-line {
  color: var(--muted);
  margin-top: 0;
  font-size: 0.9rem;
}

.card h3, .card h2.card-title {
  font-size: 1.125rem;
  margin-bottom: 10px;
  letter-spacing: 0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card p {
  margin: 8px 0;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
}

/* Status and error messages: never muted grey, so they meet contrast and are not missed */
.code-msg {
  color: var(--danger);
  font-weight: 600;
  font-size: 0.9rem;
}
.code-msg.success {
  color: var(--sage-dark);
}
/* Inline text link: a button styled as a link inside a muted line. */
button.linklike {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-decoration: underline;
  cursor: pointer;
}
button.linklike:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}
input[aria-invalid="true"] {
  border: 2px solid var(--danger);
  outline: 2px solid var(--danger);
  outline-offset: 1px;
}
input[aria-invalid="true"]:focus-visible {
  outline: 3px solid var(--danger);
}
::placeholder {
  color: var(--muted);
  opacity: 1;
}

.big-number {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.progress-bar {
  background: #F0EBDD;
  border-radius: 12px;
  height: 12px;
  overflow: hidden;
  margin: 12px 0;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.06);
}





/* Personal greeting (v165): serif, sage-deep, under the date nav. */
.greeting-line {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.2rem;
  color: var(--sage-deep);
  margin: 14px 0 0;
  text-align: center;
}
.greeting-line:empty { display: none; }

/* Streak count (v166): small and calm, under the greeting. */
.streak-line {
  text-align: center;
  color: var(--sage);
  font-size: 0.9rem;
  margin: 6px 0 0;
}
.streak-line:empty { display: none; }

/* v052: the morning greeting, streak, today's focus, and the daily
   encouragement live in one warm card at the top of Today. */
.welcome-card { text-align: center; border-top: 3px solid var(--gold); }
.welcome-card .greeting-line { margin: 0; }
.welcome-card .streak-line { margin: 6px 0 0; }
.focus-line { text-align: center; color: var(--sage-dark); font-size: 0.9rem; font-weight: 600; margin: 6px 0 0; }
.focus-line:empty { display: none; }
.welcome-card .encouragement { background: transparent; border: none; border-radius: 0; padding: 0; margin: 10px 0 0; }


/* Journal monthly chapters (v166): serif month headings. */
.journal-chapter {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--sage-deep);
  font-size: 1.15rem;
  margin: 18px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid #EDE9DF;
}
.journal-chapter:first-child { margin-top: 4px; }

/* Side-effects timeline (v166): a quiet vertical line with a
   severity-colored dot per entry, newest first. */
.se-timeline {
  border-left: 2px solid #EDE9DF;
  margin: 4px 0 0 8px;
  padding-left: 20px;
}
.se-timeline-item { position: relative; }
.se-timeline-item::before {
  content: "";
  position: absolute;
  left: -26px;
  top: 22px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--sage);
  border: 2px solid #fff;
  box-shadow: 0 0 0 2px #EDE9DF;
}
.se-timeline-item.se-sev-moderate::before { background: var(--gold); }
.se-timeline-item.se-sev-severe::before { background: #87692B; box-shadow: 0 0 0 2px #87692B; }

.btn {
  font: inherit;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(78, 92, 70, 0.06);
}

.btn:hover {
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(78, 92, 70, 0.10);
}

.btn:active {
  transform: scale(0.97);
}

.btn-small {
  padding: 10px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 44px;
}

/* Secondary button: same white/border look as .btn, named explicitly. */
.btn-secondary {
  background: #fff;
  border-color: var(--border);
  color: var(--ink);
}

/* Flat gold button, dark text, AA contrast. No gradients, per the Brand Identity guide. */
.btn-primary {
  background: var(--gold);
  border-color: var(--gold-dark);
  color: #2D2D2D;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(232, 181, 74, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 4px 14px rgba(232, 181, 74, 0.45);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-link {
  border: none;
  background: none;
  color: var(--sage-dark);
  font-weight: 600;
  padding: 6px 0;
  text-decoration: underline;
}

.btn-block {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 14px;
  font-size: 1.05rem;
}

.btn-danger {
  background: #fff;
  border-color: var(--danger);
  color: var(--danger);
  font-size: 0.85rem;
  padding: 10px 16px;
  min-height: 44px;
}


label {
  display: block;
  margin: 12px 0;
  font-weight: 600;
  font-size: 0.9rem;
}

label input,
label select,
label textarea {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

/* The hidden attribute must always hide, even inside a label: the
   `label input` rule above otherwise forces hidden file inputs
   (Restore backup, Add photo) to render as visible "Choose File" fields
   instead of their label buttons. */
[hidden] {
  display: none !important;
}

/* Same label styling for the injection-site block, which uses a div
   wrapper (a label cannot contain the site-map div). */
.field-group {
  display: block;
  margin: 12px 0;
  font-weight: 600;
  font-size: 0.9rem;
}

.field-group select {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.hidden {
  display: none;
}

/* Daily mood is a dropdown, like the Journal mood. Dark sage text, never
   the browser default blue. */
#mood-select {
  display: block;
  width: 100%;
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--sage-dark);
}

.entry-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}




.app-footer {
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 14px calc(96px + env(safe-area-inset-bottom));
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
}

.app-footer a {
  color: var(--sage-dark);
  font-weight: 600;
}

.app-footer .footer-copy {
  margin-top: 4px;
  font-size: 0.85rem;
}

.measure-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.measure-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
  font-weight: 600;
}

.measure-grid input {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.photo-upload-label {
  display: inline-block;
  cursor: pointer;
}

.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.photo-grid:empty {
  display: none;
}

.photo-item {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 3/4;
  background: var(--accent-soft, #f7f5ef);
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-date {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 0.85rem;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.photo-date button {
  background: #2B2B28;
  border: none;
  color: #fff;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.entry {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}

/* v106: clear space between stacked entry cards. */
.entry + .entry {
  margin-top: 14px;
}

.entry-title {
  font-weight: 700;
  margin: 0 0 2px;
}

.entry-sub {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 4px;
}

.entry-notes {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 4px 0;
}

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

/* v106: routine buttons share one line, equal widths. */
/* v108: center the row's items instead of stretching them, so the
   buttons sit at their own height instead of the row's height. */
.routine-actions {
  gap: 4px;
  align-items: center;
}

.routine-actions .btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 10px 4px;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* v108: the generic label rule gives the Weight label 12px margins top
   and bottom, which stretched the routine row to 78px tall and the
   buttons stretched with it. Zero them so the row is the input's
   height. Narrow the weight input's side padding so three digits fit
   in its 44px width. */
.routine-actions label {
  margin: 0;
}

.routine-actions .routine-weight-input {
  margin: 0;
  padding-left: 4px;
  padding-right: 4px;
}

/* v108: tighten the Weight tab so more fits on one screen. Cards keep
   clear separation; nothing touches. */
#tab-weight .card {
  margin: 8px 0;
  padding: 16px;
}

#tab-weight .stats-row {
  gap: 8px;
}

.badge {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 20px;
  margin-left: 8px;
  vertical-align: middle;
}

.badge-mild {
  background: var(--sage-soft);
  color: var(--sage-dark);
}

.badge-moderate {
  background: #FBEFD2;
  color: #87692B;
}

.badge-severe {
  background: #87692B;
  color: #FDFBF7;
}

/* v170: the daily side-effect check-in on Today. One tap per symptom
   cycles None, Mild, Moderate, Severe. The level pill reuses the
   side-effect badge colors, so the check-in and the Effects tab read
   the same. */
.feel-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.feel-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card-bg);
  color: inherit;
  font: inherit;
  font-size: .95rem;
  text-align: left;
  cursor: pointer;
}

.feel-level {
  font-size: .78rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}

.feel-level-0 { background: var(--sage-soft); color: var(--muted); }
.feel-level-1 { background: var(--sage-soft); color: var(--sage-dark); }
.feel-level-2 { background: #FBEFD2; color: #87692B; }
.feel-level-3 { background: #87692B; color: #FDFBF7; }

html[data-theme="dark"] .feel-level-1 { color: #9DB894; }

.feel-flag {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 4px solid #87692B;
  background: var(--gold-soft);
  font-size: .9rem;
}

.stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.stat-card {
  flex: 1 1 140px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.85rem;
  margin: 0 0 2px;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.stat-value.loss {
  color: var(--sage);
}

.stat-unit {
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}

#weight-chart {
  width: 100%;
  height: auto;
  max-height: 280px;
}

.legal-card h3 {
  margin-top: 16px;
}

.legal-card h3:first-child {
  margin-top: 0;
}


.tab-bar {
  position: fixed;
  bottom: 0;
  transform: translateZ(0);
  -webkit-transform: translateZ(0);
  left: 0;
  right: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 8px 2px calc(8px + env(safe-area-inset-bottom));
  z-index: 100;
  box-shadow: 0 -2px 16px rgba(78, 92, 70, 0.06);
}

.tab-list {
  display: flex;
  flex: 5 1 0;
  gap: 4px;
  min-width: 0;
}

/* v168: gold active state is the gold icon and label plus a small gold
   dot under the active tab (no gold circle behind the icon). */
.tab-btn.active .tab-icon {
  color: #87692B;
}

.tab-btn.active .tab-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #87692B;
  margin-top: 2px;
}

.tab-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: transparent;
  margin-top: 2px;
}

.tab-icon {
  font-size: 1.35rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-icon svg {
  width: 24px;
  height: 24px;
}

.tab-btn.active {
  color: #87692B;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 24px 12px;
}

/* v063: the small lotus is out of the empty states (her call: it was
   taking up space). The text stays; the icon is gone. */

@media (min-width: 480px) {
  .tab-label {
    font-size: 0.7rem;
  }
}

.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(43, 43, 40, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
}
.modal-overlay.hidden { display: none; }
.modal-card {
  background: var(--card, #fff); border-radius: 20px;
  max-width: 440px; width: 100%; padding: 28px 24px;
  box-shadow: 0 24px 60px -12px rgba(0,0,0,.3);
  margin-top: 4vh; position: relative;
}
/* Close X in the upper right of a modal (v169, movement plan editor).
   It closes the same way Cancel, Escape and backdrop tap do. */
.modal-x {
  position: absolute; top: 10px; right: 10px;
  width: 44px; height: 44px; border-radius: 50%; border: none;
  background: transparent; color: var(--muted); font-size: 1.5rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.modal-x:hover { background: var(--sage-soft); }
.modal-x:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Recipe modal (v048): the card is a flex column with a scrolling body
   and a fixed footer, so the Close button stays visible at the bottom
   without scrolling the recipe. The X is already 44x44; the sage-soft
   disc makes it read as a button against the card. */
.recipe-modal-card { display: flex; flex-direction: column; max-height: calc(100vh - 4vh - 48px); max-height: calc(100dvh - 4vh - 48px); }
.recipe-modal-card #recipe-modal-body { overflow-y: auto; min-height: 0; }
#recipe-modal .modal-x { background: var(--sage-soft); color: var(--ink); }
/* v066: the X is 44px tall at top:10px, so content scrolled to the top
   of the body used to slide under it (the Calories number was cut off).
   A 60px top padding puts the body scroll area below the X. */
#recipe-modal .modal-card { padding-top: 60px; }
.recipe-modal-footer { flex: none; margin: 16px -24px -28px; padding: 14px 24px 20px; border-top: 1px solid var(--border, #ddd); background: var(--card, #fff); border-radius: 0 0 20px 20px; }
.recipe-modal-footer .btn { margin: 0; }
.modal-card h2 { margin-top: 0; }
.modal-card label { display: block; margin: 12px 0; font-weight: 600; font-size: .9rem; }
/* v080: a checkbox inside a modal label keeps its own size; the
   full-width input rule below would otherwise stretch it and push
   its label text far away (setup Terms checkbox). */
.modal-card label input[type="checkbox"] { width: 24px; height: 24px; flex: none; }
.modal-card label select, .modal-card label input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--border, #ddd); border-radius: 10px; font-size: 1rem;
}

/* Today dashboard: encouragement banner and summary grid */
.encouragement {
  background: var(--sage-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  text-align: center;
  margin: 16px 0 4px;
}

.encouragement p {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  color: var(--sage-deep);
  font-size: 1rem;
}






/* Recent foods quick-pick */





/* AI Companion chat (v168: sage user bubbles, cream Companion bubbles,
   small lotus beside the Companion's messages). */
.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px 2px 12px;
  margin-bottom: 12px;
}
.chat-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--sage);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start;
  background: var(--cream);
  border: 1px solid var(--border, #e8e0d4);
  border-bottom-left-radius: 4px;
}
.chat-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.chat-row .chat-lotus {
  width: 26px;
  height: 20px;
  flex: none;
  margin-top: 10px;
}
.chat-row.assistant .chat-msg {
  flex: 1;
  max-width: none;
}
.chat-msg.typing {
  color: var(--muted, #6E6A5E);
  font-style: italic;
}
.chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-form textarea {
  flex: 1;
  min-height: 48px;
  padding: 12px;
  border: 1px solid var(--border, #ddd);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  max-height: 204px;
  overflow-y: auto;
}

/* v077: mic and Send match the single-line input height, so the row
   reads as one clean baseline. The container's align-items: flex-end
   keeps them pinned to the bottom as the input grows. */
.chat-form .btn {
  height: 48px;
  flex: none;
}


/* Companion chat markdown lists */
.chat-msg ul {
  margin: 8px 0 4px;
  padding-left: 20px;
}
.chat-msg li {
  margin-bottom: 6px;
}
.chat-msg li:last-child {
  margin-bottom: 0;
}

/* Injection calendar */
.mini-calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-top: 12px;
}
/* Injection calendar rows (a11y): the grid is built from week rows,
   so the container stacks rows and each row is its own 7-column grid.
   The date picker (#day-cal-grid) keeps the flat 7-column grid above. */
#inj-calendar { display: flex; flex-direction: column; gap: 4px; }
#inj-calendar .cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
/* Injection calendar rows (a11y): the grid is built from week rows,
   so the container stacks rows and each row is its own 7-column grid.
   The date picker (#day-cal-grid) keeps the flat 7-column grid above. */
#inj-calendar { display: flex; flex-direction: column; gap: 4px; }
#inj-calendar .cal-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.mini-calendar .dow {
  text-align: center;
  font-size: .72em;
  color: var(--muted);
  font-weight: 700;
  padding: 4px 0;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.mini-calendar .day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: .92em;
  min-height: 40px;
  min-width: 0;
}
.mini-calendar .day.other-month {
  visibility: hidden;
}
.mini-calendar .day.today {
  box-shadow: inset 0 0 0 2px #E8B54A;
  font-weight: 700;
}
.mini-calendar .day.logged {
  position: relative;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}
.mini-calendar .day.logged::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
}
.mini-calendar .day.logged.today {
  box-shadow: inset 0 0 0 2px #E8B54A;
}
.mini-calendar .day.scheduled {
  box-shadow: inset 0 0 0 2px #5A6B52;
}
.mini-calendar .day.selected {
  background: #5A6B52;
  color: #fff;
  font-weight: 700;
}
.mini-calendar .day.disabled {
  opacity: .3;
}
.mini-calendar .day[data-pick-date] {
  cursor: pointer;
  min-height: 44px;
  max-width: 100%;
  overflow: hidden;
}

/* v054: base type 16px, MyFitnessPal-like scale; tap targets stay 44px */
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--sage-tint);
  color: var(--ink);
  padding-bottom: 144px;
  scroll-padding-bottom: 156px;
  font-size: 16px;
  line-height: 1.55;
}

/* Bigger progress numbers for at-a-glance reading */

/* Roomier cards (v164: rounder, softer shadow, more space between sections) */
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 4px 24px rgba(78, 92, 70, 0.10);
  padding: 20px 18px;
  margin: 16px 0;
  transition: box-shadow 0.2s ease;
  margin-bottom: 16px;
}

/* Tab bar labels, sized so the longest labels clear their neighbors */
.tab-label {
  font-weight: 600;
  white-space: nowrap;
  font-size: 0.68rem;
}
.tab-btn {
  flex: 1 0 auto;
  border: none;
  background: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 0;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  min-width: 44px;
  justify-content: center;
  border-radius: var(--radius-sm);
  transition: color 0.2s ease, background 0.2s ease;
  min-height: 60px;
}

/* Collapsible sections: clean disclosure triangles, generous tap targets */
details.card summary {
  list-style: none;
  padding: 4px 0;
  font-size: 1.05rem;
}

/* Companion memory (v077): a quiet one-line row, not a big card. The
   section stays fully functional; only its closed size shrinks. */
details.card.memory-compact {
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 14px;
}
details.card.memory-compact summary {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted, #6E6A5E);
  padding: 2px 0;
}
details.card.memory-compact summary::before {
  margin-right: 8px;
}

/* Hidden recipes (v078): a quiet one-line row under the Kitchen
   search and filters, only when a recipe is hidden. Closed by
   default; inside, one row per hidden recipe with a Show button. */
details.card.kitchen-hidden-compact {
  padding: 8px 14px;
  margin: 0 0 12px;
  border-radius: 14px;
}
details.card.kitchen-hidden-compact summary {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--muted, #6E6A5E);
  padding: 2px 0;
}
details.card.kitchen-hidden-compact summary::before {
  margin-right: 8px;
}
.kitchen-hidden-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--sage-border, #DEE1DC);
}

/* WCAG 1.4.10: at 320px the 6 bottom tabs must fit without horizontal scrolling.
   Allow tabs to shrink below 44px and use smaller labels at narrow widths, so all 6 fit in 320px. */
@media (max-width: 400px) {
  .tab-btn {
    min-width: 0;
    flex: 1 1 0;
    padding: 6px 1px;
  }
  .tab-label {
    font-size: 0.6rem;
    letter-spacing: 0;
  }
  .tab-bar {
    gap: 0;
  }
  .tab-list {
    gap: 0;
  }
}
details.card summary::-webkit-details-marker {
  display: none;
}
details.card summary::before {
  content: "\25B6";
  display: inline-block;
  margin-right: 10px;
  font-size: 0.75em;
  color: var(--sage-dark, #5A6B52);
  transition: transform 0.15s ease;
}
details.card[open] summary::before {
  transform: rotate(90deg);
}
details.card summary h3 {
  font-size: 1.125rem;
}

/* Injection site map */
.site-map-wrap {
  display: block;
  margin: 10px 0 6px;
}
#site-map {
  display: block;
  width: 172px;
  height: auto;
  max-height: 480px;
  margin: 0 auto;
}
#site-map #map-front[hidden],
#site-map #map-back[hidden] {
  display: none;
}
#site-map .body-outline {
  fill: none;
  stroke: #8A8A8A;
  stroke-width: 2;
  stroke-linecap: round;
}
#site-map .site-zone {
  fill: var(--sage-soft);
  stroke: var(--sage);
  stroke-width: 2;
  cursor: pointer;
  transition: fill 0.15s ease;
}
#site-map .site-zone:hover,
#site-map .site-zone:focus-visible {
  fill: var(--gold-light);
}
#site-map .site-zone.selected {
  fill: var(--gold);
  stroke: var(--gold-dark);
  stroke-width: 3;
}
#site-map .site-zone.last-used {
  stroke: var(--gold-dark);
  stroke-width: 3;
  stroke-dasharray: 6 3;
}
.site-map-caption {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 8px 0 4px;
}
.site-map-caption .rotation-nudge {
  display: block;
  margin-top: 4px;
  color: #87692B;
  font-weight: 600;
}

/* ---------- Steppers ---------- */


/* ---------- Overflow fix ---------- */
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}


/* ---------- Readable inputs ---------- */
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  font-size: 1rem; /* prevents iOS zoom on focus */
  min-height: 48px; /* comfortable tap target */
}

/* ---------- v168 ---------- */

/* Your Macros donut card: protein gold, carbs sage, fat soft cream tan.
   Same donut geometry as the approved preview (r=84, circumference
   527.79). Tap a row or a segment to show that macro in the center. */
.donut-wrap { position: relative; width: 300px; height: 300px; margin: 1rem auto 0.25rem; }
.donut-wrap svg { display: block; }
.donut-seg { transition: opacity 0.25s ease, stroke-dasharray 0.35s ease, stroke-dashoffset 0.35s ease; cursor: pointer; }
.donut-label { font-size: 0.85rem; font-weight: 700; fill: #333; pointer-events: none; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center; pointer-events: none;
}
.donut-center .big {
  font-family: Georgia, "Times New Roman", serif; font-size: 2.25rem; font-weight: 600; line-height: 1; color: var(--ink);
}
.donut-center .big small { font-size: 1.1rem; font-weight: 500; color: var(--muted); }
.donut-center .cap { font-size: 0.85rem; color: var(--muted); margin-top: 0.3rem; max-width: 110px; line-height: 1.3; }
.donut-note { text-align: center; font-size: 0.85rem; color: var(--muted); margin: 0.35rem 0 0; }
/* Type an amount to add, inline (v049): the big number on water,
   movement, and each macro row is a button. Tapping it shows a small
   row in the same card, so the three work the same way. The row is a
   plain wrapper (hidden with .hidden) with the flex layout on an inner
   row, so toggling .hidden always wins. */
.inline-add-row { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
.inline-add-row input { flex: 1; min-width: 90px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: var(--card-bg); color: var(--ink); }
.inline-add-row input:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.inline-add-preview { margin: 6px 0 0; font-size: .9rem; color: var(--muted); }
/* The donut center number is a button (v049): the center keeps pointer
   events while the wrapper stays none, so a real tap reaches it. */
.donut-center button { pointer-events: auto; background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-radius: 12px; }
.donut-center button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* The logged number on each macro row is a button (v049): tapping it
   opens the same type-in row water and movement use. */
button.macro-vals { background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; }
button.macro-vals:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.macro-inline-add { grid-column: 1 / -1; }
.macro-inline-add input { user-select: text; -webkit-user-select: text; cursor: text; }
/* Shots tab actions (v049): the two buttons sit side by side, equal
   width and height, with a clean gap, so the row never staggers. The
   labels are short and never wrap, so both fit on one line at phone
   width. */
.shots-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.shots-actions .btn { flex: 1 1 150px; min-height: 44px; padding: 10px 12px; font-size: 0.9rem; text-align: center; }
/* Progress photo comparison (v049, R-17): two picked photos sit side
   by side with their dates. */
.photo-item.selected { outline: 3px solid #E8B54A; outline-offset: 2px; }
.photo-compare-row { display: flex; gap: 10px; }
.photo-compare-row figure { flex: 1 1 0; min-width: 0; margin: 0; }
.photo-compare-row img { width: 100%; border-radius: 12px; display: block; }
.photo-compare-row figcaption { font-size: .9rem; color: var(--muted); margin-top: 4px; text-align: center; }
/* Settings groups (v049, R-13): three plain headings that group the
   cards, so the long page reads as plan, companion, data. */
.settings-group { font-size: 1.125rem; margin: 20px 0 8px; }



.macro-rows { margin-top: 0.9rem; border-top: 1px solid #EFE9D6; }
.macro-row {
  display: grid; grid-template-columns: 1fr auto; gap: 0.15rem 0.75rem;
  padding: 0.7rem 0.35rem; border-bottom: 1px solid #EFE9D6; border-radius: 8px;
  cursor: pointer; align-items: center;
}
.macro-row:last-child { border-bottom: none; }
.macro-row.selected { background: #FBF6E6; }
.macro-name { display: flex; align-items: center; gap: 0.55rem; font-weight: 700; font-size: 1rem; color: var(--ink); }
button.macro-name { background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
button.macro-name:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.macro-vals { font-size: 0.9rem; color: var(--ink); white-space: nowrap; }
.macro-vals .of { color: var(--muted); }
.macro-why { grid-column: 1 / -1; font-size: .9rem; }
.macro-bar { grid-column: 1 / -1; height: 24px; border-radius: 3px; background: #F0EAD6; overflow: visible; margin-top: 0.3rem; }
/* Slide a macro row (v169): the bar is the slide target, like the rings.
   touch-action none so the page does not scroll while sliding. The
   padding widens the grab area to about 20px tall while the visible
   track stays 6px. No negative top margin: the 18px thumb sits inside
   the grab area, and a negative margin pulled it up over the
   description line above. The 11px side padding keeps the thumb
   inside the row at 0 percent, where it otherwise poked past the
   left edge. */
.macro-bar { touch-action: none; cursor: ew-resize; padding: 9px 11px; margin: 0 0 0.3rem; background-clip: content-box; }
.macro-bar:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.macro-bar i { position: relative; display: block; height: 100%; border-radius: 3px; transition: width 0.3s ease; box-sizing: border-box; border: 1px solid #87692B; }
/* L7: the calories fill gets the same darker outline as the macro fills,
   so the filled portion reads against the track without relying on gold alone. */
#calories-fill { box-sizing: border-box; border: 1px solid #87692B; }

/* v052: one short note under a food's macros, when something about
   it is worth a line. */
.food-note { font-size: 0.85em; color: var(--sage); margin-top: 2px; }
.macro-bar i::after { content: ""; position: absolute; right: -7px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid #E8B54A; box-shadow: 0 1px 3px rgba(0,0,0,0.25); }

/* v057: the thumb carries the macro color, so each row reads as one
   color from the name to the thumb. The base rule above is gold,
   which is the protein color. */
.macro-row[data-macro="carbs"] .macro-bar i::after { border-color: var(--sage); }
.macro-row[data-macro="fat"] .macro-bar i::after { border-color: #C9B586; }
.macro-row, .macro-bar { user-select: none; -webkit-user-select: none; }
.macro-pct { font-size: 0.85rem; color: var(--muted); }
/* Log steppers on each macro row: change the day's logged grams by
   exactly 1, like the ring nudge buttons. */
.macro-stepper { display: inline-flex; align-items: center; gap: 8px; }

/* Today's Movement card */
.movement-sub { margin: 0.25rem 0 0; font-size: 1rem; font-weight: 700; color: #87692B; }
.movement-desc { margin: 0.3rem 0 0; font-size: 0.85rem; line-height: 1.45; color: var(--muted); }
.moves { list-style: none; margin: 0.75rem 0 0; padding: 0; }
.moves li { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0; border-top: 1px solid #EFE9D6; }
.moves li:first-child { border-top: none; }
.move-check {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  border: 2.5px solid var(--gold); background: #FFF9EA; color: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; touch-action: manipulation; padding: 0;
}
.move-check svg { opacity: 0; display: block; }
.move-check.done { background: var(--gold); }
.move-check.done svg { opacity: 1; }
.move-check:focus-visible { outline: 3px solid var(--sage); outline-offset: 2px; }
.move-name { flex: 1; font-weight: 600; font-size: 0.9rem; line-height: 1.3; color: var(--ink); }
li.done-move .move-name { color: #5C6656; }
.move-reps { font-size: 0.85rem; color: var(--muted); white-space: nowrap; text-align: right; }
.move-progress { margin-top: 0.9rem; padding-top: 0.85rem; border-top: 1px solid #EFE9D6; }
.move-track { height: 8px; border-radius: 4px; background: #F0EAD6; overflow: hidden; }
.move-track i { display: block; height: 100%; width: 0%; background: var(--gold); border-radius: 4px; transition: width 0.3s ease; }
.move-count { margin: 0.5rem 0 0; font-size: 0.9rem; color: var(--muted); }
.move-logged { margin: 0.25rem 0 0; font-size: 0.85rem; font-weight: 700; color: var(--sage-dark); display: none; }
.move-logged.show { display: block; }

/* Movement plan editor: one row per exercise, checkbox plus reps. */
.plan-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-top: 1px solid #EFE9D6;
}
/* Compact picker (v169): the exercise list scrolls inside a fixed box
   showing about four rows, so the editor stays short. The add-your-own
   section and the Save/Cancel buttons sit below it, always visible. */
#movement-plan-list {
  max-height: 264px; overflow-y: auto;
  border: 1px solid #EFE9D6; border-radius: 12px; padding: 2px 12px;
  margin: 12px 0;
}
#movement-plan-editor { margin-top: 12px; border-top: 1px solid #EFE9D6; padding-top: 4px; }
#movement-plan-add { border-top: 1px solid #EFE9D6; margin-top: 12px; padding-top: 12px; }
#movement-plan-add h3 { margin: 0 0 4px; font-size: 1.125rem; }
#movement-plan-add .form-actions { margin-top: 10px; }
/* Remove button on a custom exercise row (v169). */
.plan-remove {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: none;
  background: transparent; color: var(--muted); font-size: 1.3rem; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0;
}
.plan-remove:hover { background: var(--sage-soft); }
.plan-remove:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.plan-row:first-child { border-top: none; }
.plan-row input[type="checkbox"] { width: 24px; height: 24px; flex: none; accent-color: var(--sage); }
.plan-row .plan-name { flex: 1; font-weight: 600; font-size: 0.9rem; }
.plan-row .plan-pattern { font-size: 0.85rem; color: var(--muted); font-weight: 400; display: block; }
.plan-row .plan-detail { width: 110px; flex: none; margin: 0; }

/* More sheet: slides up from above the tab bar. Effects, Companion,
   Settings live here now that the bar has five tabs. */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 150;
  background: rgba(43, 43, 40, 0.45);
}
.more-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 151;
  background: #fff;
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 28px rgba(78, 92, 70, 0.18);
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  max-width: 640px;
  margin: 0 auto;
}
.more-sheet-handle {
  width: 40px; height: 5px; border-radius: 3px;
  background: #E5E0D5; margin: 4px auto 12px;
}
.more-item {
  display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 56px;
  font: inherit; font-weight: 600; font-size: 1.05rem; color: var(--ink);
  background: none; border: none; border-bottom: 1px solid #EFE9D6;
  padding: 12px 4px; cursor: pointer; text-align: left;
}
.more-item:last-of-type { border-bottom: none; }
.more-item-icon {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--sage-soft); color: var(--sage-deep);
  display: flex; align-items: center; justify-content: center; flex: none;
}
.more-item-icon svg { width: 22px; height: 22px; }
.more-item-label { flex: 1; }
.more-sheet-title { margin: 0 4px 4px; font-weight: 700; font-size: 1.1rem; }
.more-item-chevron { color: var(--muted); font-size: 1.3rem; line-height: 1; }
.more-close { justify-content: center; color: var(--muted); }

/* Weight tab (v168): big calm current number, BMI under it. */
.weight-hero { text-align: center; padding: 16px 0 4px; }
/* Weight tab actions (v169): the two buttons sit side by side in one
   row. Compact, but never below 44px tall; they wrap to two rows only
   on very narrow screens. */
.weight-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 2px 0 6px; }
.weight-actions .btn { flex: 1 1 150px; min-height: 44px; padding: 10px 12px; font-size: 0.9rem; }
.weight-hero-label { color: var(--muted); margin: 0; font-size: 0.9rem; }
.weight-hero-num {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 2.25rem; font-weight: 600; margin: 0; line-height: 1.1; color: var(--ink);
}
.weight-hero-num .unit { font-size: 1.2rem; color: var(--muted); font-weight: 400; }
.weight-hero-date { text-align: center; color: var(--muted); margin: 2px 0 0; font-size: 0.9rem; }
.weight-hero-date:empty { display: none; }
.bmi-line { text-align: center; color: var(--sage-deep); font-weight: 600; margin: 4px 0 0; font-size: 0.9rem; }
.bmi-line:empty { display: none; }
/* BMI extras (v169): how far the current weight sits from the healthy
   range, and the healthy range for this height. Calm and compact. */
.bmi-over { text-align: center; color: var(--muted); margin: 2px 0 0; font-size: 0.9rem; }
.bmi-over:empty { display: none; }
.bmi-healthy { text-align: center; margin: 10px auto 0; padding: 10px 14px; max-width: 340px; background: var(--sage-tint); border-radius: 12px; }
.bmi-healthy p { margin: 0; font-size: 0.85rem; color: var(--sage-deep); line-height: 1.5; }
.bmi-healthy .bmi-cutoffs { margin-top: 4px; font-size: 0.85rem; color: var(--muted); }

/* Journal (v168): entries as elegant cards with the date in serif. */
#tab-journal .entry-sub {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.9rem;
}

/* Settings (v168): grouped sections with clear headings. */
#tab-settings .card h3 {
  border-bottom: 2px solid var(--gold-light);
  padding-bottom: 8px;
}

/* ---------- v000: Companion name and avatar, Appearance, voice ---------- */

/* Appearance themes. The theme switches CSS variables through a data
   attribute on the root element. The default stays the sage, gold,
   and cream brand look; gold accents stay gold and the lotus stays
   gold in every theme. */
html[data-theme="dark"] {
  --cream: #2B332A;
  --card-bg: #2B332A;
  --ink: #F5F1E6;
  --ink-soft: #E6E0CE;
  --muted: #B9B4A4;
  --border: #41503F;
  --sage-light: #5C6B58;
  --sage-soft: #37402F;
  --sage-tint: #20261F;
  --gold-soft: #3A3220;
  --gold-dark: #E8B54A;
  --danger: #E8B54A;
  --focus: #9DB894;
  /* --sage stays #5A6B52: white text on it is 5.9:1, so the user
     bubbles and buttons keep their contrast on dark backgrounds. */
}
html[data-theme="dark"] body { background: var(--sage-tint); }
/* :not(.btn-primary): the gold primary buttons keep their flat gold
   in dark mode; every other button goes dark. */
html[data-theme="dark"] .btn:not(.btn-primary) { background: #2B332A; }
html[data-theme="dark"] label input,
html[data-theme="dark"] label select,
html[data-theme="dark"] label textarea,
html[data-theme="dark"] .modal-card label input,
html[data-theme="dark"] .modal-card label select,
html[data-theme="dark"] .chat-form textarea { background: #2B332A; }
html[data-theme="dark"] .btn-link { color: #9DB894; }
html[data-theme="dark"] .streak-line { color: #9DB894; }
html[data-theme="dark"] .se-timeline-item::before { border-color: #2B332A; }
/* v055 WCAG 2.2 AA: dark-theme contrast fixes (SC 1.4.3). The tab bar,
   More sheet, modals, and the selected macro row keep a light
   background in dark mode while their text goes light; give them a
   dark background. Sage text that fails on dark card/page backgrounds
   goes to the established dark light-sage #9DB894. */
html[data-theme="dark"] .tab-bar { background: rgba(43, 51, 42, 0.96); }
html[data-theme="dark"] .tab-btn.active,
html[data-theme="dark"] .tab-btn.active .tab-icon { color: var(--gold); }
html[data-theme="dark"] .more-sheet { background: var(--card-bg); }
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .recipe-modal-footer { background: var(--card-bg); }
html[data-theme="dark"] .macro-row.selected { background: var(--gold-soft); }
html[data-theme="dark"] .code-msg.success,
html[data-theme="dark"] .greeting-line,
html[data-theme="dark"] .focus-line,
html[data-theme="dark"] .encouragement p,
html[data-theme="dark"] .move-logged,
html[data-theme="dark"] .journal-chapter,
html[data-theme="dark"] .bmi-line,
html[data-theme="dark"] .bmi-healthy p,
html[data-theme="dark"] .badge-mild,
html[data-theme="dark"] .more-item-icon,
html[data-theme="dark"] .progress-big,
html[data-theme="dark"] .progress-small,
html[data-theme="dark"] .week-bar-val,
html[data-theme="dark"] .stack-legend,
html[data-theme="dark"] .food-note,
html[data-theme="dark"] .stat-value.loss,
html[data-theme="dark"] li.done-move .move-name { color: #9DB894; }
html[data-theme="dark"] .movement-sub { color: var(--gold); }

html[data-theme="cream"] {
  --cream: #FFFDF8;
  --sage-soft: #EDEFEA;
  --sage-tint: #F1EDE3;
  --border: #EDE6D6;
}

/* Text size. The root font size scales every rem value; the body
   size is set in px, so it is scaled here too. */
html[data-text-size="large"] { font-size: 112.5%; }
html[data-text-size="large"] body { font-size: 20.25px; }

/* Chat header: the Companion's chosen avatar beside its name. */
.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.chat-header h2 { margin: 0; }
.chat-header-avatar {
  width: 34px;
  height: 26px;
  flex: none;
}

/* Companion avatar variants: CSS tints of the existing gold lotus
   asset. The default (no class) is the gold lotus, unchanged. */
.avatar-sage { filter: hue-rotate(62deg) saturate(0.45) brightness(0.85); }
.avatar-deep-gold { filter: brightness(0.62) saturate(0.7); }
.avatar-tile {
  background: var(--sage);
  border-radius: 50%;
  padding: 3px;
}

/* Assistant rows wrap the bubble and its Listen button together, so
   the bubble keeps its full width and the button sits under it. */
.chat-row.assistant .chat-msg-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.chat-row.assistant .chat-msg-wrap .chat-msg { max-width: none; }
.chat-listen {
  align-self: flex-start;
  font-size: 0.85rem;
  padding: 6px 12px;
}
.chat-listen svg { vertical-align: -2px; margin-right: 2px; }
.chat-mic svg { display: block; }
/* v080: tappable prompts under the greeting in an empty chat. */
.chat-prompts { display: flex; flex-direction: column; gap: 8px; margin: 4px 0 12px; }
.chat-prompt { align-self: flex-start; text-align: left; white-space: normal; }
.chat-listen.playing { background: #E8B54A; border-color: #87692B; color: #2B2B28; font-weight: 700; }

/* Mic button: visible Listening state while recording. */
.chat-mic.listening {
  background: var(--gold);
  border-color: var(--gold-dark);
}

/* Settings pickers: Companion avatar, theme, text size. */
.picker-fieldset {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 12px 0;
}
.picker-fieldset legend {
  font-weight: 700;
  padding: 0 6px;
}
.picker-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 400;
  margin: 4px 0;
  cursor: pointer;
}
.picker-option input {
  display: inline-block;
  width: auto;
  margin: 0;
  flex: none;
}
.avatar-thumb {
  flex: none;
  width: 40px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar-thumb img {
  width: 40px;
  height: 30px;
  object-fit: contain;
}
.theme-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  border: 1px solid var(--border);
}
.theme-swatch-sage { background: #5A6B52; }
.theme-swatch-dark { background: #20261F; }
.theme-swatch-cream { background: #FFFDF8; }

/* New Chapter Kitchen: filter chips and recipe cards. */
.kitchen-filters { display: flex; flex-direction: column; gap: 10px; margin: 10px 0; }
.kitchen-filter-group { display: flex; flex-direction: column; gap: 4px; }
.kitchen-filter-label { margin: 0; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kitchen-filter-row { display: flex; flex-wrap: wrap; gap: 6px; }
/* v080: the Dietary chips sit behind a "More filters" disclosure, so
   Meal and search fit in the first viewport. */
.kitchen-more-filters { margin-top: 2px; }
.kitchen-more-filters summary { cursor: pointer; font-weight: 700; font-size: .9rem; color: var(--sage-dark); padding: 6px 0; }
.kitchen-more-filters summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.kitchen-more-filters .kitchen-filter-group { margin-top: 6px; }
.kitchen-chip {
  font: inherit;
  font-size: .9rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card-bg);
  color: var(--ink);
  cursor: pointer;
}
.kitchen-chip.active { background: var(--sage); border-color: var(--sage); color: #fff; }
.kitchen-list { display: grid; gap: 12px; margin: 4px 0 12px; }
.kitchen-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  padding: 12px;
  box-shadow: var(--shadow);
}
.kitchen-photo { width: 100%; height: 200px; object-fit: cover; border-radius: var(--radius-sm); display: block; }
.kitchen-credit { font-size: .75rem; color: var(--muted); margin: 2px 0 8px; }
/* Recipe source line (v048): a compact muted line under the name and
   calories on Kitchen cards, and at the end of the recipe modal. */
.kitchen-photo-open .kitchen-source { display: block; text-align: left; font-size: .72rem; color: var(--muted); padding: 0 12px 10px; }
.kitchen-source { font-size: .8rem; color: var(--muted); margin: 10px 0 0; }
.kitchen-macros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; margin-top: 8px; }
.kitchen-macro b { display: block; font-size: 1.05em; }
.kitchen-macro span { font-size: .85rem; color: var(--muted); }
.kitchen-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.kitchen-stepper { display: inline-flex; align-items: center; gap: 8px; }

/* Recipe detail tag chips (v076): rounded pills under the title. */
.recipe-tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 10px; }
.recipe-tag-chip { font-size: .85rem; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--sage-border); background: var(--card-bg); color: var(--ink); }
/* Recipe calorie ring (v076): SVG ring with calories in the center and
   the macro split below. Brand colors only: sage, bright gold, sage-light. */
.recipe-ring-wrap { display: flex; align-items: center; gap: 16px; margin: 4px 0 8px; }
.recipe-ring { position: relative; width: 120px; height: 120px; flex: none; }
.recipe-ring svg { display: block; }
.recipe-ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.recipe-ring-center b { font-size: 1.5rem; line-height: 1; color: var(--ink); }
.recipe-ring-center span { font-size: .85rem; color: var(--muted); }
.recipe-ring-macros { display: flex; flex-direction: column; gap: 8px; }
.recipe-ring-macro { display: flex; align-items: baseline; gap: 6px; }
.recipe-ring-macro b { font-size: 1.05em; }
.recipe-ring-macro span { font-size: .9rem; color: var(--muted); }
.recipe-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; align-self: center; }
/* Recipe nutrition details (v076): expandable saturated fat and
   per-serving note. The ring and macro summary stay visible. */
.kitchen-nutrition { margin: 4px 0 0; font-size: .9rem; }
.kitchen-nutrition summary { cursor: pointer; font-weight: 600; color: var(--ink); }
/* Sticky Add to Today (v076): the primary action pins to the bottom of
   the scrolling recipe modal, above the fixed Close footer. */
.kitchen-sticky-add { position: sticky; bottom: 0; margin: 16px 0 0; padding: 12px 0 4px; background: var(--card-bg); border-top: 1px solid var(--border); }
.kitchen-sticky-add .btn { margin: 0; }

/* Charts: the 600px canvas must shrink to fit a phone screen, or the
   right side of the chart (and the latest point) is cut off. */
canvas { max-width: 100%; height: auto; display: block; }

/* Compact Today cards (v034): 7-day strip, meal rows, weight card. */
.week-strip { display:flex; gap:4px; margin:8px 0 4px; }
.week-day { flex:1; border:1px solid var(--border); background:#fff; border-radius:8px; padding:4px 0 3px; cursor:pointer; display:flex; flex-direction:column; align-items:center; gap:0; font:inherit; }

/* v052: the week strip fills day by day. A logged day grows a short
   gold bar at its base, 0.35s ease, when the strip renders. */
.week-day { position: relative; }
.week-fill { position: absolute; left: 50%; bottom: 2px; transform: translateX(-50%); display: block; height: 3px; width: 0; background: var(--gold); border-radius: 2px; transition: width 0.35s ease; }
.week-strip.filled .week-fill { width: 24px; }
.week-day .week-letter { font-size:.7rem; color:var(--muted); }
.week-day .week-num { font-size:.85rem; font-weight:700; color:var(--sage-dark); }
.week-day.today .week-num { color:#5A6B52; }
.week-day.viewed { background:#5A6B52; border-color:#5A6B52; }
.week-day.viewed .week-letter, .week-day.viewed .week-num { color:#FDFBF7; }
.week-day:disabled { opacity:.4; cursor:default; }
.week-day .week-plan-label { font-size:.65rem; color:var(--muted); line-height:1.25; text-align:center; }
.week-day.viewed .week-plan-label { color:#FDFBF7; }

.meal-row { border-top:1px solid var(--border); padding:10px 0 2px; }
.meal-row:first-child { border-top:0; padding-top:2px; }
.meal-head { display:flex; align-items:center; gap:8px; }
.meal-name { font-weight:700; }
.meal-total { font-size:.85em; flex:1; }

/* GLP-1 quick actions (v035): three links in one row on Today. */

/* Compact slider rows (v036): water and movement as one row with the
   big amount and the goal, a horizontal slider, and a slim progress
   bar. Sage slider, gold progress fill, sage when the goal is met. */
.slider-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.slider-amount { background: none; border: none; padding: 0; margin: 0; cursor: pointer; font: inherit; color: inherit; text-align: left; display: flex; align-items: baseline; gap: 6px; min-height: 44px; }
.slider-amount:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.slider-goal { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.goal-slider { width: 100%; margin: 10px 0 8px; accent-color: var(--sage); height: 28px; display: block; }

/* v057: the Settings macro percentage sliders fill with the macro
   color up to the thumb, like the Today bars. The fill percentage
   is set by syncMacroPctSliders in app.js. */
#set-protein-pct-slider { --fill: #E8B54A; }
#set-carbs-pct-slider { --fill: #5A6B52; }
#set-fat-pct-slider { --fill: #DCC9A3; }
.goal-slider.pct-fill { -webkit-appearance: none; appearance: none; background: transparent; }
.goal-slider.pct-fill::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--fill) var(--fill-pct, 0%), #EDEBE3 var(--fill-pct, 0%)); }
.goal-slider.pct-fill::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--fill); box-shadow: 0 1px 3px rgba(0,0,0,0.25); margin-top: -6px; cursor: ew-resize; }
.goal-slider.pct-fill::-moz-range-track { height: 6px; border-radius: 3px; background: #EDEBE3; }
.goal-slider.pct-fill::-moz-range-progress { height: 6px; border-radius: 3px; background: var(--fill); }
.goal-slider.pct-fill::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 2px solid var(--fill); box-shadow: 0 1px 3px rgba(0,0,0,0.25); cursor: ew-resize; }
.slider-amount .big-number { text-decoration: underline; text-decoration-style: dotted; text-underline-offset: 4px; }

/* Compact Today (v036): tighter cards on Today only, so the tab reads
   shorter without losing breathing room. Other tabs keep their spacing. */
#tab-today .card { padding: 18px; margin: 14px 0; }

/* ---------- Progress view (v038) ---------- */
.progress-big { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; color: var(--sage-deep); }
.progress-small { color: var(--sage-dark); }
.week-bars { display: flex; gap: 6px; margin-top: 12px; }
.week-bar-col { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; }
.week-bar-val { font-size: .75rem; line-height: 1.2; min-height: 1.2em; color: var(--sage-deep); }
.week-bar-track { width: 100%; height: 110px; display: flex; align-items: flex-end; justify-content: center; }
/* v080: per-macro charts are shorter; the stacked chart stays full height. */
#progress-protein-card .week-bar-track,
#progress-carbs-card .week-bar-track,
#progress-fat-card .week-bar-track,
#progress-weight-card .week-bar-track { height: 64px; }
.week-bar { width: 100%; max-width: 30px; border-radius: 6px 6px 0 0; }
.week-bar-empty { background: #EDEBE3; }
.week-bar-day { font-size: .85rem; color: var(--sage); margin-top: 6px; }

/* v052: weekly stacked macro bars (Progress). Protein first, then
   carbs, then fat, in brand colors only. The column rounds at the
   top; the fill grows gently when the view renders. */
.stack-bar { display: flex; flex-direction: column; width: 100%; max-width: 30px; height: 0; border-radius: 6px 6px 0 0; overflow: hidden; transition: height 0.35s ease; }
#progress-bars-stack.filled .stack-bar { height: var(--h); }
.stack-bar i { display: block; width: 100%; flex: none; }
.stack-legend { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin: 10px 0 0; font-size: 0.85rem; color: var(--sage-dark); }
.stack-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.avg-table { width: 100%; border-collapse: collapse; margin: 12px 0 0; font-size: 0.9rem; }
.avg-table th, .avg-table td { padding: 6px 4px; text-align: right; border-top: 1px solid var(--border); }
.avg-table th:first-child, .avg-table td:first-child { text-align: left; }
.avg-table th { color: var(--muted); font-weight: 600; }

/* v039: compact pass. Even text, collapsible Movement section, compact
   macro rows, Kitchen photo cards, compact Companion header. */
#tab-today, #tab-recipes { line-height: 1.5; }
#tab-today .muted, #tab-recipes .muted, #tab-today .move-reps, #tab-recipes .kitchen-credit { line-height: 1.4; }
#tab-today h2, #tab-today h3, #tab-recipes h2, #tab-recipes h3 { line-height: 1.3; }

/* Collapsible section header: one button, title left, summary and
   chevron right. No circle icon, so the title stays on one line. */
.section-toggle {
  display: flex; align-items: baseline; gap: 10px; width: 100%;
  background: none; border: none; padding: 10px 0; margin: 0 0 4px;
  font: inherit; color: inherit; cursor: pointer; text-align: left;
}
.section-toggle-title { font-size: 1.2rem; font-weight: 700; line-height: 1.3; }
.section-toggle-summary { flex: 1; font-size: .95rem; color: var(--muted); text-align: right; line-height: 1.4; }
.section-toggle-chevron { color: #87692B; font-size: 1.25rem; line-height: 1; flex: none; }
.section-toggle:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.movement-subhead { font-size: 1.2rem; font-weight: 700; margin: 14px 0 8px; line-height: 1.3; }

/* Compact macro rows: name and numbers on one line, a thin bar below,
   and the detail (why line and percent) only on the selected row. */
.macro-detail { grid-column: 1 / -1; display: none; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: 0.2rem; }
.macro-row.selected .macro-detail { display: flex; }
.macro-detail .macro-why { font-size: .9rem; }
.macro-detail .macro-pct { font-size: .85rem; color: var(--muted); }

/* Kitchen photo cards: horizontal featured row, two-column full list. */
#kitchen-list.kitchen-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kitchen-photo-card { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); box-shadow: var(--shadow); overflow: hidden; }
.kitchen-photo-open { display: block; width: 100%; background: none; border: none; padding: 0; margin: 0; font: inherit; color: inherit; cursor: pointer; text-align: left; }
.kitchen-photo-open:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.kitchen-photo-wrap { display: block; position: relative; }
.kitchen-photo-wrap .kitchen-photo { border-radius: 0; }
.kitchen-chip-tag { position: absolute; left: 8px; bottom: 8px; background: rgba(43, 43, 40, 0.85); color: #FDFBF7; font-size: .75rem; font-weight: 700; padding: 3px 8px; border-radius: 99px; }
/* v120: recipe cards lead with the name in Georgia, then a nutrition
   strip (protein, saturated fat, sodium) and the time and calories. */
.kitchen-photo-body { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 12px 14px 14px; }
.kitchen-photo-body strong { font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; line-height: 1.3; color: var(--sage-dark); }
.kitchen-nutrition { font-size: .82rem; font-weight: 600; color: var(--sage-dark); line-height: 1.4; }
.kitchen-photo-meta { display: flex; gap: 12px; font-size: .85rem; color: var(--muted); }
.kitchen-photo-body .muted { font-size: .85rem; white-space: nowrap; }
.kitchen-bookmark { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(43, 43, 40, 0.55); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.kitchen-bookmark:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.kitchen-favorite { position: absolute; top: 8px; right: 52px; width: 36px; height: 36px; border-radius: 50%; border: none; background: rgba(43, 43, 40, 0.55); display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; }
.kitchen-favorite:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.kitchen-hide { display: block; width: 100%; padding: 6px 12px 10px; background: none; border: none; color: inherit; opacity: .7; font-size: .85rem; text-align: center; cursor: pointer; }
.kitchen-hide:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
.kitchen-card-del { position: absolute; top: 8px; right: 8px; }
.recipe-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 180px; background: var(--sage); border-radius: var(--radius-sm); }
.recipe-placeholder img { width: 72px; height: 55px; object-fit: contain; }

/* Simple meals row: horizontal cards with a macro highlight. */

/* Compact Companion header: smaller avatar and heading, and the
   privacy note as one line with the full text behind a tap. */
.chat-header-compact { gap: 8px; }
.chat-header-compact .chat-header-avatar { width: 26px; height: 20px; }
.chat-header-compact h2 { font-size: 1.2rem; line-height: 1.3; }
.chat-privacy { margin: 8px 0 12px; }
.chat-privacy summary { font-size: .85rem; color: var(--muted); cursor: pointer; line-height: 1.4; }
.chat-privacy summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Print fallback for the doctor summary (v046): when the PDF library
   is unavailable, the print dialog shows only the summary. */
@media print {
  body * { visibility: hidden; }
  #doctor-modal, #doctor-modal * { visibility: visible; }
  #doctor-modal {
    position: absolute;
    inset: 0;
    display: block !important;
    background: #fff;
  }
  #doctor-modal .modal-card {
    box-shadow: none;
    border: none;
    max-width: none;
  }
  #doctor-modal .form-actions, #doctor-modal #doctor-msg { display: none !important; }
  #doctor-modal textarea {
    border: none;
    background: #fff;
    height: auto;
  }
}

/* ---------- v058 ---------- */
/* Subtle plus/minus steppers beside the Today sliders (water,
   movement, each macro). Quiet on purpose: a hairline ring, a sage
   glyph, no fill. 32px hit area, above the 24px WCAG minimum. */
.slider-stepper-row { display: flex; align-items: center; gap: 8px; }
.slider-stepper-row .goal-slider { flex: 1; min-width: 0; }
.macro-stepper-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; }
.macro-stepper-row .macro-bar { flex: 1; min-width: 0; margin: 0; }
.stepper-btn {
  flex: none; width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: transparent; color: var(--sage);
  font-size: 1.15rem; font-weight: 400; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  touch-action: manipulation;
}
.stepper-btn:active { background: var(--sage-soft); border-color: var(--sage); }
/* v080: the Movement steppers are 44px, a comfortable tap target. */
#movement-card .stepper-btn { width: 44px; height: 44px; }
.stepper-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
/* The macro steppers carry their row's color, darker for contrast. */
.stepper-protein { color: #87692B; }
.stepper-carbs { color: var(--sage); }
.stepper-fat { color: #87692B; }
html[data-theme="dark"] .stepper-btn { color: #9DB894; }
html[data-theme="dark"] .stepper-protein { color: #E8B54A; }
html[data-theme="dark"] .stepper-fat { color: #DCC9A3; }

/* Tap-to-type rows stay rendered when closed (collapsed, not
   display:none), so the input is focusable at tap time and iOS
   summons the keyboard from the tap. .hidden still marks closed, so
   the open/closed state reads the same as before. */
.inline-add { overflow: hidden; max-height: 240px; opacity: 1; transition: max-height .25s ease, opacity .2s ease; }
.inline-add.hidden { display: block; max-height: 0; opacity: 0; pointer-events: none; }

/* The strength empty state sits close under Add exercise and ends
   shortly after "No strength yet." Scoped to the strength list;
   other empty states are unchanged. v060: the saved-message line
   takes no space when it is empty (it used to reserve a blank line),
   and the empty state's own margins are zeroed, so the card ends
   shortly after the text. */
#strength-saved-msg:empty { display: none; }
#strength-list .empty-state { margin: 0; padding: 4px 12px 6px; }
#strength-saved-msg { margin: 6px 0 0; }

/* The lotus bloom. The lotus opens a little more with each logged
   day and strength session, quiet and cumulative. Stage 0 is a small
   closed bud, the smallest and faintest state, and the flower opens
   from there as days are logged; it never closes again. v061: no mask
   and no clip, the lotus is whole and solid at every stage. The stage
   shows through scale and opacity only. */
.bloom-wrap { display: flex; justify-content: center; margin: 2px 0 0; }
.bloom-lotus { height: 60px; width: auto; display: block; opacity: 0.9; transform: scale(0.96); transform-origin: 50% 100%; transition: transform .6s ease, opacity .6s ease, filter .6s ease; }
.bloom-stage-1 .bloom-lotus { opacity: 0.92; transform: scale(0.97); }
.bloom-stage-2 .bloom-lotus { opacity: 0.94; transform: scale(0.98); }
.bloom-stage-3 .bloom-lotus { opacity: 0.96; transform: scale(0.99); }
.bloom-stage-4 .bloom-lotus { opacity: 0.98; transform: scale(1); }
.bloom-stage-5 .bloom-lotus { opacity: 1; transform: scale(1); }
/* v089: the full bloom reads as a destination, not just one more step.
   A soft gold halo behind the lotus, a glow on the flower itself,
   and a gold stage line, so stage 5 is unmistakable next to stage 4. */
.bloom-stage-5 .bloom-wrap { width: fit-content; margin-left: auto; margin-right: auto; padding: 10px 12px 4px; border-radius: 50%; background: radial-gradient(circle, rgba(232, 181, 74, 0.28) 0%, rgba(232, 181, 74, 0.10) 60%, rgba(232, 181, 74, 0) 78%); }
.bloom-stage-5 .bloom-lotus { filter: drop-shadow(0 0 10px rgba(232, 181, 74, 0.7)); }
.bloom-stage-5 .bloom-stage-line { color: var(--gold-dark); font-weight: 600; }
.welcome-card .bloom-caption { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.welcome-card .bloom-stage-line { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 2px 0 0; }

/* Shopping list, pantry staples, and copy recipe (v069) */
.shopping-list { display: grid; gap: 6px; }
.shopping-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); }
/* L1: every checkbox is 24px, the WCAG 2.2 AA minimum target size.
   The setup Terms checkbox has no scoped rule, so this generic rule
   covers it too. */
input[type="checkbox"] { width: 24px; height: 24px; }
.shopping-row input[type="checkbox"] { width: 24px; height: 24px; flex: none; accent-color: var(--sage); }
.shopping-text { flex: 1; }
.shopping-done { text-decoration: line-through; color: var(--muted); }
.shopping-remove, .pantry-remove { border: none; background: none; font-size: 1.1rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 6px; flex: none; }
.pantry-list { display: grid; gap: 6px; }
.pantry-row { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); }
.pantry-row input[type="checkbox"] { width: 24px; height: 24px; flex: none; accent-color: var(--sage); }
.pantry-row span { flex: 1; }

/* Fitness card rows (v094): short summary rows that open their detail
   one tap away. Brand colors only, no ads. */
.fitness-row { display:flex; align-items:baseline; gap:10px; width:100%; padding:10px 0; background:none; border:none; border-top:1px solid var(--border); font:inherit; text-align:left; cursor:pointer; }
.fitness-row-label { font-size:1rem; font-weight:700; color:var(--sage-dark); line-height:1.3; }
.fitness-row-status { flex:1; font-size:.9rem; color:var(--muted); text-align:right; line-height:1.4; }
.fitness-row .section-toggle-chevron { color:#87692B; font-size:1.1rem; line-height:1; flex:none; }
.fitness-row:focus-visible { outline:3px solid var(--focus); outline-offset:2px; border-radius:4px; }
/* Strength detail tabs (v094): My Exercises, History, All Exercises. */
.strength-tabs { display:flex; gap:4px; border-bottom:1px solid var(--border); margin:12px 0 0; }
.strength-tab { background:none; border:none; border-bottom:2px solid transparent; padding:8px 10px; font:inherit; font-size:.95rem; color:var(--muted); cursor:pointer; }
.strength-tab[aria-selected="true"] { color:var(--sage-dark); font-weight:700; border-bottom-color:var(--sage); }
.strength-tab:focus-visible { outline:3px solid var(--focus); outline-offset:2px; border-radius:4px; }

/* v109: compact strength rows, the routine picker, the swap picker,
   and the library search and chips. */
.routine-picker { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 12px; }
.routine-pick-active { background: var(--gold); border-color: var(--gold-dark); color: #2D2D2D; font-weight: 600; }
.routine-row-head { display: flex; align-items: center; gap: 8px; }
.routine-row-toggle { flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.routine-row-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.routine-row-head label { flex: 0 0 auto; margin: 0; }
.routine-row-head .btn { flex: 0 0 auto; }
.routine-row-detail { margin-top: 8px; }
.swap-picker { margin-top: 8px; }
.swap-picker .muted { margin: 8px 0 4px; }
.swap-options, .swap-library { display: flex; flex-wrap: wrap; gap: 8px; }
.swap-search-label { display: block; margin: 8px 0 4px; font-size: 0.9rem; }
.swap-search { display: block; width: 100%; margin-top: 4px; }
.swap-scope-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.lib-tools { margin-bottom: 12px; }
#strength-lib-search { display: block; width: 100%; margin-bottom: 8px; }
/* v120: the Strength search fields are bigger and easier to tap. */
#strength-lib-search, .swap-search { font-size: 1.05rem; padding: 12px 14px; min-height: 52px; border-radius: 12px; }
.lib-chips { display: flex; flex-wrap: wrap; gap: 8px; }
/* v120: All Exercises rows are polished cards with a muscle-group
   visual tile (sage with a gold line drawing) beside the name. */
.lib-exercise { display: flex; gap: 12px; align-items: flex-start; }
.lib-ex-thumb { flex: none; width: 56px; height: 56px; border-radius: 12px; background: var(--sage); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.lib-ex-thumb svg { width: 56px; height: 56px; display: block; }
.lib-ex-main { flex: 1; min-width: 0; }
.lib-ex-muscle { margin: 2px 0 0; font-size: .82rem; color: var(--muted); }
.ex-tag { display: inline-block; font-size: 0.75rem; line-height: 1.2; padding: 2px 6px; margin-left: 6px; border: 1px solid var(--sage); border-radius: 999px; color: var(--sage-dark); background: var(--sage-tint); white-space: nowrap; }
.lib-chip-active { background: var(--gold); border-color: var(--gold-dark); color: #2D2D2D; font-weight: 600; }
