/* ==========================================================================
   Sloth Grove — Design tokens, reset, shell layout, responsive nav
   ========================================================================== */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Design tokens --- */
:root {
  /* Ported unchanged from the original single-file app */
  --bg: #f5f7f2;
  --surface: #ffffff;
  --border: #d8e4d0;
  --text: #2c3a26;
  --muted: #6a7f62;
  --accent: #4a7c4e;
  --accent-light: #e8f2e8;
  --danger: #c0392b;
  --danger-light: #fdecea;
  --tag-open: #4a7c4e;
  --tag-done: #95a58a;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0, 0, 0, 0.07);

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  /* Touch targets */
  --tap-min: 44px;

  /* Display font falls back to the system stack everywhere until kid mode is active */
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Nav sizing (used by the three nav presentations below) */
  --nav-sidebar-width: 220px;
  --nav-topbar-height: 56px;
  --nav-bottombar-height: 64px;
}

/* Kid mode: larger radius, playful display face, bigger tap targets.
   Styling is fleshed out in a later task — this reserves the tokens now. */
[data-mode="kid"] {
  --radius: 18px;
  --font-display: 'Baloo 2', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tap-min-kid: 60px;
}

/* --- Base elements --- */
html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
}

button {
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

input, select, textarea {
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: var(--space-2) var(--space-3);
}

a { color: var(--accent); }

/* ==========================================================================
   App shell
   ========================================================================== */

.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  background: var(--accent);
  color: #fff;
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
}

header .logo {
  font-size: 1.6rem;
  line-height: 1;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

#current-user-name {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-left: auto;
}

#switch-person-btn,
#family-settings-btn,
#issues-btn,
#logout-btn {
  display: none;
}

#switch-person-btn.active,
#family-settings-btn.active,
#issues-btn.active,
#logout-btn.active {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: #fff;
  font-size: 0.85rem;
  font-family: inherit;
  border-radius: 5px;
  padding: var(--space-1) var(--space-3);
  min-height: var(--tap-min);
}

/* Kid mode still shows the header (it's the only way back to the profile
   picker from inside a kid session — see initProfilePicker()'s comment in
   profile.js), so "Switch person" needs the 60px kid tap-target minimum
   too, not just #main-nav's tab buttons. #family-settings-btn never gets
   .active in kid mode (see renderNav()'s toggle in app.js) so it doesn't
   need this rule. */
[data-mode="kid"] #switch-person-btn.active {
  min-height: var(--tap-min-kid, 60px);
}

#switch-person-btn:hover,
#family-settings-btn:hover,
#issues-btn:hover,
#logout-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

main {
  flex: 1;
  padding: var(--space-5);
  width: 100%;
}

.tab { display: none; }
.tab.active { display: block; }

/* Kid mode gives a tab panel a dedicated .kid-root child (see app.js's
   switchTab) instead of handing renderKid() the whole panel, so the
   panel's static standard-mode markup (section header, add buttons,
   list/content containers) survives underneath rather than being wiped by
   renderKid()'s container.innerHTML = ''. .kid-root stays hidden by
   default (it's dead leftover markup outside of kid mode — created once
   and never removed, so it must not render when switching back to
   standard mode); .kid-rendered on the panel flips the visibility of both
   sides at once: .kid-root shows, every other direct child hides. */
.tab > .kid-root { display: none; }
.tab.kid-rendered > .kid-root { display: block; }
.tab.kid-rendered > :not(.kid-root) { display: none; }

.error-banner {
  background: var(--danger-light);
  color: var(--danger);
  padding: var(--space-3) var(--space-4);
  border-radius: 6px;
  margin-bottom: var(--space-3);
  font-size: 0.85rem;
  display: none;
}

.error-banner.active { display: block; }

/* ==========================================================================
   Nav — one #main-nav, three presentations switched by breakpoint.
   `.nav-topbar` (tablet), `.nav-sidebar` (desktop) and `.nav-bottombar`
   (mobile) each name one presentation; all three are applied to the same
   #main-nav element and activated purely by the media queries below —
   there are no separate DOM trees.
   ========================================================================== */

#main-nav {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

/* An author-origin `display` declaration always beats the User-Agent-origin
   `[hidden] { display: none }` rule regardless of specificity, so #main-nav's
   own `display: flex` above would otherwise keep it visible even with the
   `hidden` attribute set (as app.js's showLoginGate()/showApp() do). This
   override restores the native hidden-attribute behavior for this element. */
#main-nav[hidden] {
  display: none;
}

#main-nav button {
  flex: 1;
  background: none;
  border: none;
  padding: var(--space-3) var(--space-4);
  font-size: 0.9rem;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  font-weight: 500;
  min-height: var(--tap-min);
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

#main-nav button.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

#main-nav button:hover {
  color: var(--accent);
}

/* Kid mode (Task 9): app.js's renderNav() adds .kid-nav to #main-nav and
   .kid-tap-target to each button when the active profile is in kid mode.
   This needs #main-nav.kid-nav specificity (not just .kid-tap-target alone)
   to win over the plain #main-nav button rule above, which is an ID
   selector and would otherwise keep buttons at the 44px adult minimum. */
#main-nav.kid-nav button {
  min-height: var(--tap-min-kid, 60px);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
}

/* Desktop (>1024px): .nav-sidebar presentation.
   Grid, not flex-wrap: header is a fixed-content-height row; nav-sidebar
   and the content row below it must independently fill the *remaining*
   viewport height regardless of how tall main's content is on a given
   tab. flex-wrap can't express that ("row 2" sizes to its own content,
   not the viewport) — grid's row-track sizing can. */
@media (min-width: 1025px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--nav-sidebar-width) 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header header"
      "nav    main";
    min-height: 100vh;
  }

  header {
    grid-area: header;
  }

  #main-nav.nav-sidebar {
    grid-area: nav;
    flex-direction: column;
    border-bottom: none;
    border-right: 1px solid var(--border);
    align-items: stretch;
  }

  #main-nav.nav-sidebar button {
    flex: none;
    text-align: left;
    border-bottom: none;
    border-left: 3px solid transparent;
  }

  #main-nav.nav-sidebar button.active {
    border-bottom-color: transparent;
    border-left-color: var(--accent);
    background: var(--accent-light);
  }

  main,
  #login-gate,
  #profile-gate {
    grid-area: main;
    min-width: 0;
  }
}

/* Tablet (640–1024px): .nav-topbar presentation */
@media (min-width: 640px) and (max-width: 1024px) {
  #main-nav.nav-topbar {
    flex-direction: row;
    order: 0;
    overflow-x: auto;
  }

  #main-nav.nav-topbar button {
    white-space: nowrap;
  }
}

/* Mobile (<640px): .nav-bottombar presentation */
@media (max-width: 639px) {
  .app-shell {
    padding-bottom: var(--nav-bottombar-height);
  }

  #main-nav.nav-bottombar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    order: 2;
    flex-direction: row;
    border-bottom: none;
    border-top: 1px solid var(--border);
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.07);
    z-index: 50;
    overflow-x: auto;
  }

  #main-nav.nav-bottombar button {
    padding: var(--space-2) var(--space-2);
    font-size: 0.85rem;
    flex-shrink: 0;
    white-space: nowrap;
  }

  main {
    padding: var(--space-4);
  }
}

/* ==========================================================================
   Login gate
   ========================================================================== */

#login-gate {
  display: none;
  padding: 60px var(--space-4);
  text-align: center;
}

#login-gate.active { display: block; }

#login-gate .login-logo {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

#login-gate p {
  color: var(--muted);
  margin-bottom: var(--space-5);
}

#google-login-link {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  padding: var(--space-3) var(--space-5);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  min-height: var(--tap-min);
}

/* ==========================================================================
   Profile gate — full-screen family-member picker (Task 9)
   ========================================================================== */

#profile-gate {
  display: none;
  padding: 60px var(--space-4);
  text-align: center;
  /* Defense-in-depth (not a substitute for initProfilePicker() actively
     closing every open modal, see app.js's closeAllModals()): genuine
     overlay positioning + a z-index above .modal-backdrop's 100, so even a
     modal some future code path forgets to close still renders underneath
     the picker rather than on top of it. */
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow-y: auto;
  background: var(--surface);
}

#profile-gate.active { display: block; }

.profile-gate-heading {
  margin-bottom: var(--space-5);
}

/* ==========================================================================
   Family settings gate — standalone mode-setting screen for production,
   where SHOW_PROFILE_PICKER is false and #profile-gate is never shown.
   Same overlay treatment as #profile-gate (see the comment there).
   ========================================================================== */

#family-settings-gate {
  display: none;
  padding: 60px var(--space-4);
  text-align: center;
  position: fixed;
  inset: 0;
  z-index: 200;
  overflow-y: auto;
  background: var(--surface);
}

#family-settings-gate.active { display: block; }

.family-settings-heading {
  margin-bottom: var(--space-5);
}

.profile-grid {
  max-width: 720px;
  margin: 0 auto;
}

.profile-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-3);
  cursor: pointer;
  text-align: center;
  min-height: max(var(--tap-min), 120px);
}

.profile-card-icon {
  font-size: 2.4rem;
}

.profile-card-name {
  margin-bottom: 0;
}

.profile-card-settings {
  /* Visually compact, but — same convention as .btn-sm above — the base
     .btn rule's min-height (loaded later in this file, so it wins the
     cascade at equal specificity) keeps this at >= --tap-min regardless. */
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  padding: var(--space-1) var(--space-2);
}

.profile-card-toggle {
  display: flex;
  gap: var(--space-3);
  margin-top: var(--space-2);
  font-size: 0.8rem;
  color: var(--muted);
}

.profile-toggle-label {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  cursor: pointer;
  min-height: var(--tap-min);
}

/* ==========================================================================
   Color themes — ported verbatim from the original app
   ========================================================================== */

.theme-blue   { --theme-bg: #e8f0fe; --theme-border: #3367d6; --theme-text: #1a56cc; }
.theme-amber  { --theme-bg: #fef9e8; --theme-border: #b8860b; --theme-text: #9a6e08; }
.theme-green  { --theme-bg: var(--accent-light); --theme-border: var(--accent); --theme-text: var(--accent); }
.theme-pink   { --theme-bg: #fce8f3; --theme-border: #c2185b; --theme-text: #ad1457; }
.theme-purple { --theme-bg: #f3e8fd; --theme-border: #7b1fa2; --theme-text: #6a1b9a; }
.theme-red    { --theme-bg: var(--danger-light); --theme-border: var(--danger); --theme-text: var(--danger); }
.theme-slate  { --theme-bg: #f1f5f9; --theme-border: #64748b; --theme-text: #475569; }
.theme-teal   { --theme-bg: #e0f2f1; --theme-border: #00897b; --theme-text: #00796b; }

/* ==========================================================================
   Section headers, cards, badges, buttons — shared across all tabs
   ========================================================================== */

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
  gap: var(--space-3);
}

.section-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.section-header-controls {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  flex-wrap: wrap;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  margin-bottom: var(--space-3);
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}

.card:hover { box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); border-color: var(--accent); }

.card.themed { background: var(--theme-bg, var(--surface)); border-left: 6px solid var(--theme-border, var(--border)); }
.card.themed:hover { border-color: var(--theme-border, var(--accent)); }

/* A routine/chain card where the viewing column's step isn't currently
   actionable - blocked on a dependency, or already done for that column
   while the card stays visible for other steps/columns. */
.card.themed.card-step-blocked { background: repeating-linear-gradient(135deg, var(--theme-bg, var(--surface)), var(--theme-bg, var(--surface)) 10px, var(--surface) 10px, var(--surface) 20px); border-left-style: dashed; }
.card.themed.card-step-not-open { opacity: 0.6; }
.card.themed.card-step-not-open:hover { opacity: 0.85; }

.card-title { font-weight: 600; font-size: 1rem; margin-bottom: var(--space-1); overflow-wrap: break-word; }
.card-meta { font-size: 0.8rem; color: var(--muted); }
.card-row { display: flex; align-items: flex-start; gap: var(--space-3); justify-content: space-between; }
.card-row-main { display: flex; align-items: flex-start; gap: var(--space-2); min-width: 0; flex: 1; }
.card-row-main > div { min-width: 0; }
.card-routine-badge-row { margin-bottom: var(--space-1); }

.icon-chip { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }
.recur-icon { opacity: 0.65; margin-left: 3px; font-style: normal; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.badge-open { background: var(--accent-light); color: var(--accent); }
.badge-completed { background: #eee; color: var(--tag-done); }
.badge-overdue { background: var(--danger-light); color: var(--danger); }
.badge-blocked { background: #f1f5f9; color: #64748b; }
.badge-calendar { background: #e8f0fe; color: #3367d6; }
.badge-task { background: #fef9e8; color: #b8860b; }
.badge-routine { background: var(--theme-bg, #f1f5f9); color: var(--theme-text, #64748b); border: 1px solid var(--theme-border, #64748b); }

/* Compact variant used inline within card-meta text (e.g. quest chain
   "up next" / "blocked" indicators ahead of a run of plain text). */
.badge-inline { font-size: 0.7rem; margin-right: 4px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: var(--space-2) var(--space-4);
  border-radius: 6px;
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.15s;
  min-height: var(--tap-min);
}

.btn:hover { opacity: 0.85; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--accent-light); color: var(--accent); }
.btn-danger { background: var(--danger-light); color: var(--danger); }
/* Visually compact, but the tap target itself stays >= --tap-min: this
   only trims horizontal padding/font-size, deliberately not overriding
   the base .btn's min-height, so Delete/Edit/+Add stay >= 44px tall. */
.btn-sm { padding: 5px 11px; font-size: 0.78rem; }

.empty-state {
  text-align: center;
  padding: 40px var(--space-4);
  color: var(--muted);
  font-size: 0.9rem;
}

/* Compact variant used inside a kanban column when that person has no
   quests — the full-size empty-state padding is too tall for a column. */
.empty-state-sm {
  font-size: 0.85rem;
  padding: var(--space-2) 0;
  text-align: left;
}

/* ==========================================================================
   Forms
   ========================================================================== */

.form-group { margin-bottom: 13px; }

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--muted);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg);
}

.form-group textarea { resize: vertical; min-height: 60px; }

.form-group-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-input {
  width: 18px;
  max-width: 18px;
  height: 18px;
  flex: none;
}

.checkbox-label {
  margin: 0;
  color: var(--text);
  font-size: 0.9rem;
}

.field-row { display: flex; gap: 6px; }
.field-grow { flex: 1; }
.field-time { flex: 0 0 90px; }
.field-narrow { width: 80px; }
.field-narrow-md { max-width: 160px; }
.field-hint { font-size: 0.85rem; color: var(--muted); margin-left: 6px; }

.icon-color-fields { display: flex; gap: 10px; }
.icon-color-fields .form-group { flex: 1; }

/* ==========================================================================
   Link builder
   ========================================================================== */

.link-list { list-style: none; margin: 4px 0 8px; }
.link-list li { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; padding: 3px 0; }
.link-list .link-rel { opacity: 0.6; font-size: 0.72rem; margin-left: 4px; }
.link-list .link-remove {
  background: none;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 2px;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.link-row { display: flex; gap: 6px; align-items: center; }
.link-row select { flex: 1; }
.link-row .btn { flex-shrink: 0; }

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: var(--space-5);
  width: 420px;
  max-width: 95vw;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
  max-height: 90vh;
  overflow-y: auto;
}

.modal-wide { width: 520px; }
.modal h3 { font-size: 1.1rem; margin-bottom: var(--space-4); }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
  flex-wrap: wrap;
}

.modal-actions-left { margin-right: auto; }

.confirm-banner {
  background: var(--danger-light);
  border: 1px solid #f5c6c2;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: var(--space-3);
  font-size: 0.88rem;
}

.confirm-banner strong { color: var(--danger); }

/* ==========================================================================
   Detail panes (shared by detail-modal.js's renderView output)
   ========================================================================== */

.detail-field { margin-bottom: var(--space-3); }

.detail-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 3px;
}

.detail-value { font-size: 0.95rem; }

/* Link-builder chips shown in a linked entity's detail view (see
   linksHtml() in app.js) — one chip per link, with the relationship
   label shown in a muted, smaller sub-span. */
.link-chip {
  background: var(--accent-light);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 0.8rem;
  margin-right: 4px;
  display: inline-block;
}

.link-chip-relationship {
  opacity: 0.6;
  font-size: 0.72rem;
}

.detail-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.detail-title.themed {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--theme-border);
}

.detail-icon { font-size: 1.4rem; vertical-align: middle; }

/* ==========================================================================
   Calendar — view switcher, list/week/month views
   ========================================================================== */

.view-switcher {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-btn {
  background: none;
  border: none;
  padding: 6px 14px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  min-height: var(--tap-min);
}

.view-btn.active { background: var(--accent); color: #fff; }

.cal-label {
  font-size: 0.85rem;
  font-weight: 500;
  min-width: 130px;
  text-align: center;
}

/* --- Week view --- */

.week-wrapper { overflow-x: auto; }

.week-grid {
  display: grid;
  grid-template-columns: 48px repeat(7, 1fr);
  font-size: 0.78rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 560px;
}

.week-corner { background: var(--accent); border-right: 1px solid rgba(255, 255, 255, 0.2); }

.week-allday-label {
  background: var(--bg);
  border-right: 1px solid var(--border);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.68rem;
  text-align: right;
  padding: 3px 5px;
}

.week-allday-cell {
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  background: var(--bg);
  min-height: 24px;
  padding: 2px;
}

.week-day-header {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 6px 2px;
  font-weight: 600;
}

.week-day-header .day-num { font-size: 0.85em; opacity: 0.85; }
.week-day-header.today-col { background: #2d5e31; }

.week-time-col {
  color: var(--muted);
  text-align: right;
  padding: 0 6px;
  border-right: 1px solid var(--border);
  border-top: 1px solid var(--border);
  font-size: 0.68rem;
  line-height: 32px;
  height: 32px;
}

.week-cell {
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  height: 32px;
  position: relative;
}

.week-cell.today-col { background: #f0faf0; }

.week-event {
  position: absolute;
  left: 1px;
  right: 1px;
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 0.7rem;
  font-weight: 500;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--text);
  z-index: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.week-event:hover { opacity: 0.85; }
.week-event .event-time { opacity: 0.6; }

.week-allday-event {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding: 1px 4px;
  font-size: 0.7rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 1px;
  cursor: pointer;
}

.week-allday-event:hover { opacity: 0.85; }

/* --- Month view --- */

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}

.month-day-header {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 5px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 4px;
}

.month-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px;
  min-height: 80px;
}

.month-cell.other-month { background: var(--bg); opacity: 0.55; }
.month-cell.today { border-color: var(--accent); border-width: 2px; }

.month-date { font-size: 0.72rem; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
.month-date.today-num { color: var(--accent); }

.month-event {
  background: var(--accent-light);
  border-radius: 3px;
  padding: 1px 4px;
  margin-bottom: 2px;
  font-size: 0.68rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
  cursor: pointer;
}

.month-event:hover { opacity: 0.8; }
.month-more { font-size: 0.65rem; color: var(--muted); padding-left: 2px; }

/* --- Mobile (<640px): week/month collapse to agenda-style stacked day
   cards rather than shrinking the grid, per the Global Constraints. Each
   day becomes a card-like block; the underlying grid markup is unchanged,
   so this is a pure CSS re-layout keyed off the same .week-grid/.month-grid
   structure emitted by tabs/calendar.js. --- */

@media (max-width: 639px) {
  .week-wrapper { overflow-x: visible; }

  .week-grid {
    display: block;
    min-width: 0;
    border: none;
    border-radius: 0;
  }

  .week-corner,
  .week-allday-label,
  .week-time-col { display: none; }

  .week-day-header {
    display: block;
    text-align: left;
    border-radius: var(--radius) var(--radius) 0 0;
    padding: var(--space-2) var(--space-3);
    margin-top: var(--space-3);
  }

  .week-day-header:first-of-type { margin-top: 0; }

  .week-allday-cell,
  .week-cell {
    display: block;
    height: auto;
    min-height: 0;
    border: 1px solid var(--border);
    border-top: none;
    background: var(--surface);
    padding: 0;
  }

  .week-allday-cell:empty,
  .week-cell:empty { display: none; }

  .week-cell:last-of-type,
  .week-allday-cell:last-of-type { border-radius: 0 0 var(--radius) var(--radius); }

  .week-event,
  .week-allday-event {
    position: static;
    display: flex;
    align-items: center;
    width: auto;
    height: auto !important;
    top: auto !important;
    white-space: normal;
    margin: var(--space-1) var(--space-2);
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
    min-height: var(--tap-min);
  }

  .month-grid {
    display: block;
  }

  .month-day-header { display: none; }

  .month-cell {
    display: block;
    min-height: 0;
    margin-bottom: var(--space-2);
  }

  .month-cell.other-month { display: none; }

  .month-date {
    font-size: 0.85rem;
    padding-bottom: var(--space-1);
    border-bottom: 1px solid var(--border);
    margin-bottom: var(--space-2);
  }

  .month-event {
    white-space: normal;
    padding: var(--space-2) var(--space-3);
    font-size: 0.85rem;
    min-height: var(--tap-min);
    display: flex;
    align-items: center;
    margin-bottom: var(--space-1);
  }

  .month-more { padding: var(--space-1) var(--space-3); }
}

/* ==========================================================================
   Quests — kanban board (standard mode)
   ========================================================================== */

#quests-list {
  display: flex;
  gap: var(--space-4);
  align-items: flex-start;
  padding-bottom: var(--space-2);
  overflow-x: auto;
}

.kanban-col {
  flex: 1 1 0;
  min-width: 220px;
  background: var(--bg);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.group-header {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0 0 var(--space-3);
}

/* Mobile (<640px): stacked per-person sections instead of side-scrolling
   kanban columns — a full re-layout, not a shrunk kanban. */
@media (max-width: 639px) {
  #quests-list {
    flex-direction: column;
    overflow-x: visible;
  }

  .kanban-col {
    width: 100%;
    min-width: 0;
  }
}

/* ==========================================================================
   Quest chains — step builder (create/edit forms)
   ========================================================================== */

.step-builder { margin-top: var(--space-2); border-top: 1px solid var(--border); padding-top: var(--space-3); }

.step-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: var(--space-2) 0;
  border-bottom: 1px dashed var(--border);
  position: relative;
}

.step-row:last-of-type { border-bottom: none; }

.step-drag-handle {
  cursor: grab;
  color: var(--muted);
  font-size: 1rem;
  padding: 4px 2px;
  user-select: none;
  flex-shrink: 0;
  align-self: center;
}

.step-drag-handle:active { cursor: grabbing; }

.step-fields {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.step-fields-wide { grid-column: 1 / -1; }

.step-fields label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  display: block;
  margin-bottom: 2px;
}

.step-fields input,
.step-fields select {
  padding: 6px 8px;
  font-size: 0.85rem;
  width: 100%;
}

.step-fields select[multiple] { height: auto; }

.step-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  align-self: flex-start;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.step-row.dragging { opacity: 0.4; }
.step-row.drag-over { border-top: 2px solid var(--accent); }
.step-add-btn { margin-top: var(--space-2); }

.step-builder-empty {
  font-size: 0.83rem;
  color: var(--muted);
  padding: 4px 0;
}

/* ==========================================================================
   Quest chains — card progress + inline step list
   ========================================================================== */

.quest-steps-summary {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: var(--space-1);
}

.quest-steps-bar {
  flex: 0 0 60px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.quest-steps-bar-fill { height: 100%; background: var(--accent); border-radius: 2px; }

/* Progress row (routine detail view): "N/M steps" label with the same
   progress bar shown inline, vertically centered, rather than stacked. */
.detail-progress-row { display: flex; align-items: center; gap: 6px; }
.detail-progress-row .quest-steps-bar { margin: 0; }

.quest-step-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 0.85rem;
  padding: 2px 4px;
  flex-shrink: 0;
  line-height: 1;
  min-height: var(--tap-min);
  min-width: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.quest-step-toggle:hover { color: var(--accent); }

.quest-steps-list {
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  display: none;
}

.quest-steps-list.expanded { display: block; }

.quest-step-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px 0;
  font-size: 0.82rem;
  border-bottom: 1px dashed var(--border);
}

.quest-step-item:last-child { border-bottom: none; }
.quest-step-item.step-blocked { opacity: 0.5; }

.quest-step-item .badge { flex-shrink: 0; }
.quest-step-item-title { flex: 1; }
.quest-step-item-assignee { font-size: 0.75rem; color: var(--muted); }

/* ==========================================================================
   Quest chains — detail view steps
   ========================================================================== */

.detail-steps-section { margin-top: var(--space-4); }

.detail-steps-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: var(--space-2);
}

.detail-step-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}

.detail-step-row:last-child { border-bottom: none; }
.detail-step-row.step-blocked { opacity: 0.5; }
.detail-step-info { flex: 1; }
.detail-step-title { font-weight: 500; font-size: 0.9rem; }
.detail-step-meta { font-size: 0.75rem; color: var(--muted); margin-top: 2px; }
.detail-step-waiting { font-size: 0.78rem; color: var(--muted); }
.detail-step-done { color: var(--muted); font-size: 0.9rem; }

/* ==========================================================================
   Kid mode — large tap-target cards, checklist, confetti burst
   ========================================================================== */

.kid-nav {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.kid-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-4);
}

.kid-tap-target {
  min-height: var(--tap-min-kid, 60px);
}

.kid-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  background: var(--theme-bg, var(--surface));
  border: 2px solid var(--theme-border, var(--border));
  border-radius: var(--radius);
  padding: var(--space-5) var(--space-3);
  cursor: pointer;
  text-align: center;
  font-family: var(--font-display);
  transition: transform 0.12s, box-shadow 0.12s;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kid-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.kid-card:active { transform: translateY(0); }

.kid-card-icon { font-size: 2.4rem; line-height: 1; }

.kid-card-label {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--theme-text, var(--text));
}

.kid-card-check {
  position: absolute;
  top: var(--space-2);
  right: var(--space-2);
  font-size: 1.2rem;
  color: var(--accent);
}

.kid-card-subtitle {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* Meal Plan's kid-mode cards expand in place on tap (Quests/Routines don't
   need this — their subtitle already fits everything relevant). Spans the
   full grid row when open so the full ingredient list/instructions has
   room, rather than being squeezed into one narrow grid cell next to
   shorter unexpanded cards. */
.kid-meal-card { text-align: left; align-items: stretch; }
.kid-meal-card .kid-card-icon,
.kid-meal-card .kid-card-photo,
.kid-meal-card .kid-card-label,
.kid-meal-card .kid-card-subtitle { text-align: center; align-self: center; }

.kid-meal-card-open {
  grid-column: 1 / -1;
  cursor: default;
}

.kid-meal-expanded {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--theme-border, var(--border));
  text-align: left;
  cursor: default;
}

.kid-meal-expanded-heading {
  font-weight: 700;
  font-size: 0.95rem;
  margin: var(--space-3) 0 var(--space-2);
}

.kid-meal-expanded-heading:first-child { margin-top: 0; }

.kid-meal-instructions {
  white-space: pre-wrap;
  font-size: 0.9rem;
  color: var(--text);
}

/* Kid mode reuses .group-header (a small uppercase muted label elsewhere
   in the app) for routine names above each step checklist — too quiet for
   a kid-facing headline, so bump it to match the card labels' weight/size
   inside [data-mode="kid"] specifically. */
[data-mode="kid"] .group-header {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  text-transform: none;
  letter-spacing: normal;
  font-family: var(--font-display);
}

.kid-progress-hint {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
}

.kid-card-done {
  cursor: default;
}

.kid-card-done .kid-card-label,
.kid-card-done .kid-card-subtitle {
  opacity: 0.75;
}

.kid-checklist {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.kid-checklist-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  transition: transform 0.12s, box-shadow 0.12s;
}

.kid-checklist-row:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1); }

.kid-checklist-icon { font-size: 1.3rem; flex-shrink: 0; }
.kid-checklist-label { flex: 1; }

.kid-checklist-row-blocked {
  opacity: 0.5;
  cursor: default;
}

.kid-checklist-row-done {
  cursor: default;
  background: var(--accent-light);
  border-color: var(--accent);
}

.kid-checklist-row-overdue {
  background: var(--danger-light);
  border-color: var(--danger);
}

.kid-checklist-row-done .kid-checklist-label {
  opacity: 0.75;
  text-decoration: line-through;
}

/* Confetti / star-burst — CSS-only, no animation library. A ring of emoji
   "particles" pop out from the center and fade; kid-mode.js toggles this
   class on the target card element and removes it once the animation
   completes (see CONFETTI_DURATION_MS in kid-mode.js). */

.kid-confetti-burst { position: relative; }

.kid-confetti-burst::before,
.kid-confetti-burst::after {
  content: '✨ 🎉 ⭐ 🎊';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  font-size: 1.4rem;
  white-space: nowrap;
  pointer-events: none;
  z-index: 5;
  animation: kid-confetti-pop 0.9s ease-out forwards;
}

.kid-confetti-burst::after {
  content: '🎊 ⭐ 🎉 ✨';
  animation-delay: 0.08s;
}

@keyframes kid-confetti-pop {
  0% { transform: translate(-50%, -50%) scale(0) rotate(0deg); opacity: 1; }
  60% { transform: translate(-50%, -120%) scale(1.3) rotate(12deg); opacity: 1; }
  100% { transform: translate(-50%, -160%) scale(1) rotate(-8deg); opacity: 0; }
}

@media (max-width: 639px) {
  .kid-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ==========================================================================
   Meal Plan — sub-nav, week grid, recipe cards, AI/modal helpers
   ========================================================================== */

.meal-subnav {
  display: flex;
  gap: 6px;
  margin-bottom: var(--space-4);
}

.meal-subnav-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
  font-weight: 500;
  min-height: var(--tap-min);
}

.meal-subnav-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.meal-subview { display: none; }
.meal-subview.active { display: block; }

.meal-week-heading {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 18px 0 8px;
}

.meal-week-heading:first-child { margin-top: 0; }

/* --- Week grid (tablet/desktop): 7-day grid with a slot-label column --- */

.meal-grid {
  display: grid;
  grid-template-columns: 80px repeat(7, 1fr);
  gap: 4px;
  font-size: 0.8rem;
  margin-bottom: var(--space-3);
}

.meal-grid .day-header {
  background: var(--accent);
  color: #fff;
  text-align: center;
  padding: 6px 2px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.75rem;
}

.meal-grid .day-header .day-header-date { font-weight: 400; font-size: 0.68rem; opacity: 0.85; }

.meal-grid .slot-label {
  display: flex;
  align-items: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meal-cell {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  min-height: 52px;
  overflow: hidden;
}

.meal-cell.clickable {
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
  min-height: var(--tap-min);
}

.meal-cell.clickable:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); border-color: var(--accent); }

.meal-cell .meal-name { font-weight: 500; }
.meal-cell .meal-ing { color: var(--muted); font-size: 0.72rem; margin-top: 2px; }
.meal-cell.empty { background: var(--bg); border-style: dashed; }

.meal-cell-thumb {
  width: 100%;
  height: 44px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 4px;
  display: block;
}

/* --- Mobile (<640px): a genuinely separate day-major markup block (see
   mealGridHtml/mealCellHtml in tabs/meals.js) renders as a stack of day
   cards, one per day, each day's own header immediately followed by its
   own breakfast/lunch/dinner cells — a real re-layout, not a shrunk
   8-column grid, and not the tablet/desktop .meal-grid DOM reinterpreted
   (that DOM is slot-major, required by CSS Grid's row-by-row
   auto-placement, so it can't also serve as the mobile day groups). ---- */

.meal-day-cards { display: none; }

@media (max-width: 639px) {
  .meal-grid { display: none; }

  .meal-day-cards {
    display: block;
  }

  .meal-day-card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: var(--space-3);
    overflow: hidden;
  }

  .meal-day-card .day-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    text-align: left;
    padding: var(--space-2) var(--space-3);
    background: var(--accent);
    color: #fff;
    font-weight: 600;
    font-size: 0.75rem;
  }

  .meal-day-card .day-header .day-header-date { font-weight: 400; font-size: 0.68rem; opacity: 0.85; }

  .meal-day-card .slot-label {
    padding: var(--space-2) var(--space-3) 2px;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
  }

  .meal-day-card .meal-cell {
    border-radius: 0;
    border-left: none;
    border-right: none;
    border-top: none;
    min-height: var(--tap-min);
  }

  .meal-day-card .meal-cell:last-child { border-bottom: none; }
}

/* --- Recipes — responsive card grid --- */

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 639px) {
  .recipe-grid { grid-template-columns: 1fr; }
}

.recipe-card .card-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
}

.recipe-source-tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  flex-shrink: 0;
}

/* --- Image / icon-fallback treatment, shared by meal + recipe cards and
   detail views. An <img> renders when image_url is present; otherwise the
   existing icon-chip glyph fallback is used — never a broken image. --- */

.entity-thumb {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  margin-bottom: var(--space-3);
  display: block;
  background: var(--bg);
}

.entity-thumb-icon-fallback {
  width: 100%;
  height: 140px;
  border-radius: calc(var(--radius) - 4px);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  background: var(--accent-light);
}

.detail-thumb {
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: var(--space-4);
  display: block;
}

/* --- Ingredient list with per-item image/emoji from ingredient-images.js --- */

.ingredient-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ingredient-list li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 0.9rem;
}

.ingredient-img-emoji { font-size: 1.1rem; line-height: 1; flex-shrink: 0; }

.ingredient-img-photo {
  width: 22px;
  height: 22px;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}

/* --- Ingredient row builder (recipe create/edit forms) --- */

.ingredient-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}

.ingredient-row .ing-name { flex: 2; }
.ingredient-row .ing-qty { flex: 1; }
.ingredient-row .ing-unit { flex: 1; }
.ingredient-row .btn { flex-shrink: 0; }

/* --- Meal-modal AI generate sub-form --- */

.meal-ai-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-3);
}

.meal-ai-form {
  margin-bottom: var(--space-4);
  padding: var(--space-3);
  border: 1px dashed var(--border);
  border-radius: 6px;
}

.btn-sm-top { margin-top: 6px; }
.modal-divider { border: none; border-top: 1px solid var(--border); margin: 14px 0; }

.ai-loading-inline { display: inline; color: var(--muted); font-size: 0.85rem; margin-left: var(--space-2); }
.ai-loading-block { color: var(--muted); }

.ai-result-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: var(--space-1); }
.ai-result-meta { margin-bottom: var(--space-3); }
.text-pre-wrap { white-space: pre-wrap; }

.weekly-plan-intro { color: var(--muted); font-size: 0.85rem; margin-bottom: var(--space-3); }

.weekly-plan-prefs-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.weekly-plan-prefs-form { margin-top: var(--space-3); }

.wpp-skip-days {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.wpp-skip-day-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 400;
  color: var(--text);
}

/* --- Kid mode: today's meals, photo-first cards --- */

.kid-card-photo {
  width: 100%;
  height: 90px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 4px);
  margin-bottom: 2px;
}

/* ==========================================================================
   Shopping — list view, sales/store-tabs view, AI recipe flows
   ========================================================================== */

.shopping-category { margin-bottom: 18px; }

.shopping-category h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 8px;
}

.shopping-item-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  min-height: var(--tap-min);
}

.shopping-item-row input[type="checkbox"] {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.shopping-item-name { flex: 1; }

.shopping-item-row.checked .shopping-item-name {
  text-decoration: line-through;
  color: var(--muted);
}

.shopping-item-store { color: var(--muted); font-size: 0.78rem; font-weight: 400; }

.sale-ai-actions-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.suggested-existing-recipes { margin-bottom: 18px; }

.sale-settings-form { margin-bottom: var(--space-4); }

.sale-store-checkboxes {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}

.sale-item-card { margin-bottom: var(--space-3); }
.sale-item-card:last-child { margin-bottom: 0; }

.ai-ingredient-list { padding-left: 1.1em; margin: 0; }

@media (max-width: 639px) {
  #sale-store-tabs.meal-subnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  #sale-store-tabs .meal-subnav-btn { flex-shrink: 0; }

  .shopping-item-row { flex-wrap: wrap; }
}

/* ==========================================================================
   Rainforest / Milestones — minimal stub tabs (Task 10)
   ========================================================================== */

/* Full-bleed hero image, same treatment as the original single-file app's
   inline style="width:100%;height:auto;display:block;border-radius:var(--radius)"
   but as a class per this rebuild's no-inline-style rule. Responsive at all
   3 breakpoints via max-width alone — no media queries needed since the
   image already scales to its container's width at every size. */
.rainforest-img {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}
