/* =====================================================================
   components.css: every reusable component. Colors only from tokens.
   Recipes follow the planner-theme-palettes skill.
   ===================================================================== */

/* ================= SHELL: SIDEBAR / ICON RAIL ================= */
.sidebar {
  display: none;
  position: fixed; inset: 0 auto 0 0; z-index: 40;
  width: var(--rail-w);
  background: var(--nav-bg); color: var(--nav-text);
  flex-direction: column;
  padding-top: var(--safe-top);
  overflow: hidden;
  transition: width 200ms var(--ease-out-soft);
}
.sidebar::before { content: ""; display: block; height: 6px; background: var(--brand-stripe); flex: none; }
[data-theme="blush-sage"] .sidebar::before, [data-theme="neutral"] .sidebar::before, [data-theme="dark"] .sidebar::before, :root:not([data-theme]) .sidebar::before { display: none; }
@media (min-width: 768px) { .sidebar { display: flex; } }
@media (min-width: 1024px) { .sidebar { width: var(--sidebar-w); } }
.app.rail-expanded .sidebar { width: var(--sidebar-w); box-shadow: var(--shadow-lg); }
@media (min-width: 1024px) { .app.rail-expanded .sidebar { box-shadow: none; } }

.sidebar-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; min-height: 64px; }
.sidebar-mark { width: 28px; height: 28px; border-radius: 8px; flex: none; }
.sidebar-word { font-family: var(--font-heading); font-weight: 500; font-variation-settings: "SOFT" 50, "WONK" 0; font-size: 1.125rem; color: var(--nav-text); line-height: 1.2; }
.sidebar-hi { font-size: 0.875rem; color: var(--nav-text); opacity: 0.85; }
.sidebar-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 10px 12px; scrollbar-width: thin; }
.nav-group-label { font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.04em; color: var(--nav-text); opacity: 0.8; padding: 14px 12px 4px; white-space: nowrap; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 44px; padding: 8px 12px; margin: 1px 0;
  border-radius: var(--radius-btn); color: var(--nav-text); text-decoration: none;
  font-weight: 600; font-size: 0.9375rem; white-space: nowrap;
  transition: background-color 120ms ease-out;
}
.nav-item .icon { color: var(--nav-icon); }
.nav-item:hover { background: var(--nav-hover-bg); }
.nav-item[aria-current="page"] {
  background: var(--nav-active-bg); color: var(--nav-active-text);
  box-shadow: inset 3px 0 0 var(--accent-1-deep);
}
.nav-item .nav-label { overflow: hidden; text-overflow: ellipsis; }
/* Rainbow Pastel: icons cycle through the six chip text colors */
[data-theme="rainbow-pastel"] .nav-item[data-cycle="1"] .icon { color: var(--chip-1-text); }
[data-theme="rainbow-pastel"] .nav-item[data-cycle="2"] .icon { color: var(--chip-2-text); }
[data-theme="rainbow-pastel"] .nav-item[data-cycle="3"] .icon { color: var(--chip-3-text); }
[data-theme="rainbow-pastel"] .nav-item[data-cycle="4"] .icon { color: var(--chip-4-text); }
[data-theme="rainbow-pastel"] .nav-item[data-cycle="5"] .icon { color: var(--chip-5-text); }
[data-theme="rainbow-pastel"] .nav-item[data-cycle="6"] .icon { color: var(--chip-6-text); }
.sidebar-foot { padding: 8px 10px calc(12px + var(--safe-bottom)); border-top: 1px solid var(--nav-hover-bg); }
.nav-item.small { min-height: 40px; font-size: 0.875rem; }
.sidebar-copy { font-size: 0.8125rem; color: var(--nav-text); opacity: 0.85; padding: 8px 12px 0; white-space: nowrap; }
.rail-toggle { display: none; }

/* Tablet portrait: collapsed 72px icon rail, labels on hover/focus, toggle to expand */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .rail-toggle { display: flex; }
  .app:not(.rail-expanded) .sidebar .nav-label,
  .app:not(.rail-expanded) .sidebar .nav-group-label,
  .app:not(.rail-expanded) .sidebar .sidebar-word,
  .app:not(.rail-expanded) .sidebar .sidebar-hi,
  .app:not(.rail-expanded) .sidebar .sidebar-copy { display: none; }
  .app:not(.rail-expanded) .sidebar { overflow: visible; }
  .app:not(.rail-expanded) .sidebar-scroll { overflow: visible; }
  .app:not(.rail-expanded) .nav-item { justify-content: center; padding: 8px; }
  .app:not(.rail-expanded) .sidebar-head { justify-content: center; padding: 18px 8px 12px; }
  .app:not(.rail-expanded) .nav-group-sep { display: block; height: 1px; background: var(--nav-hover-bg); margin: 8px 10px; }
  .app:not(.rail-expanded) .nav-item:hover .nav-tip,
  .app:not(.rail-expanded) .nav-item:focus-visible .nav-tip { display: block; }
}
.nav-group-sep { display: none; }
.nav-tip {
  display: none; position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--surface); color: var(--text); border: 1px solid var(--border);
  box-shadow: var(--shadow-md); border-radius: 8px; padding: 6px 10px; font-size: 0.875rem; white-space: nowrap; z-index: 60;
  pointer-events: none;
}

/* ================= SHELL: HEADER ================= */
.header-bar {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: calc(16px + var(--safe-top)) 0 16px;
}
@media (min-width: 768px) { .header-bar { padding-top: 28px; padding-bottom: 20px; } }
.header-title-wrap { min-width: 0; }
.header-date { font-size: 0.875rem; color: var(--text-muted); margin-top: 2px; }
.header-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid transparent;
  background: transparent; color: var(--btn-ghost-text); cursor: pointer;
  transition: background-color 120ms ease-out, transform 120ms ease-out;
}
.icon-btn:hover { background: var(--surface-alt); border-color: var(--border); }
.icon-btn:active { transform: scale(0.97); }
.icon-btn.sm { width: 36px; height: 36px; }
.offline-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  background: var(--info-bg); color: var(--info-text); font-size: 0.8125rem; font-weight: 600; white-space: nowrap;
}
@media (max-width: 420px) { .offline-chip .offline-long { display: none; } }

/* ================= SHELL: BOTTOM NAV ================= */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: var(--nav-bg); border-top: 1px solid var(--nav-hover-bg);
}
.bottom-nav::before { content: ""; position: absolute; left: 0; right: 0; top: -1px; height: 4px; background: var(--brand-stripe); }
@media (min-width: 768px) { .bottom-nav { display: none; } }
.bn-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 44px; color: var(--nav-text); text-decoration: none; font-size: 0.8125rem; font-weight: 600;
  background: none; border: 0; cursor: pointer; font-family: inherit; position: relative;
}
.bn-item .icon { color: var(--nav-icon); width: 22px; height: 22px; }
.bn-item[aria-current="page"] { color: var(--nav-active-text); }
.bn-item[aria-current="page"]::after {
  content: ""; position: absolute; top: 6px; left: 50%; transform: translateX(-50%);
  width: 52px; height: 30px; border-radius: 999px; background: var(--nav-active-bg); z-index: -1;
}
.bn-item[aria-current="page"] .icon { color: var(--accent-1-deep); }
.bn-item { z-index: 0; }

/* ================= SHELL: FLOATING QUICK LOG BUTTON ================= */
.fab {
  position: fixed; z-index: 45; right: 16px;
  bottom: calc(var(--bottom-nav-h) + 16px + var(--safe-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: var(--btn-primary-bg); color: var(--btn-primary-text);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: var(--shadow-lg); transition: transform 120ms ease-out, background-color 120ms ease-out;
}
[data-theme="dark"] .fab { border: 1px solid var(--border-accent); }
.fab:hover { background: var(--btn-primary-hover); }
.fab:active { transform: scale(0.95); }
.fab .icon { width: 26px; height: 26px; stroke-width: 2; }
@media (min-width: 768px) { .fab { right: 24px; bottom: 24px; } }
.fab[hidden] { display: none; }

/* ================= CARDS ================= */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm); padding: 16px; min-width: 0;
}
@media (min-width: 768px) { .card { padding: 20px; } }
.card.accent { border-color: var(--border-accent); border-width: 1.5px; }
.card.tinted { background: var(--surface-alt); }
.card.callout { background: var(--callout-bg); border: 1.5px solid var(--callout-border); box-shadow: none; }
.card.danger-zone { background: var(--danger-bg); border-color: var(--danger-bg); color: var(--danger-text); box-shadow: none; }
.card.danger-zone h2 { color: var(--danger-text); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { display: flex; align-items: center; gap: 8px; }
.card-head h2 .icon { color: var(--accent-2-deep); }
.card-sub { color: var(--text-muted); font-size: 0.875rem; margin-top: 2px; }
@media (hover: hover) and (min-width: 1024px) {
  .card { transition: transform 150ms ease-out, box-shadow 150ms ease-out; }
  .card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 18px; border-radius: var(--radius-btn);
  font-family: var(--font-body); font-size: 0.9375rem; font-weight: 600; line-height: 1.2;
  border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background-color 120ms ease-out, transform 120ms ease-out, border-color 120ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn .icon { width: 18px; height: 18px; }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); }
.btn-primary:hover:not(:disabled) { background: var(--btn-primary-hover); }
.btn-secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); }
.btn-secondary:hover:not(:disabled) { background: var(--btn-secondary-hover); }
.btn-ghost { background: transparent; color: var(--btn-ghost-text); border-color: var(--btn-ghost-border); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); }
.btn-text { background: transparent; color: var(--link); padding-left: 8px; padding-right: 8px; }
.btn-text:hover:not(:disabled) { background: var(--surface-alt); }
.btn-danger { background: var(--danger-text); color: var(--danger-bg); }
.btn-danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn-danger-soft { background: var(--surface); color: var(--danger-text); border-color: var(--danger-text); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: transparent; color: var(--text-muted); border-color: var(--btn-ghost-border); cursor: not-allowed;
}
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 0.875rem; }
.btn-lg { min-height: 56px; padding: 14px 22px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-btn { background: none; border: 0; padding: 4px 2px; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }

/* ================= CHIPS ================= */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.4; white-space: nowrap;
  background: var(--chip-1-bg); color: var(--chip-1-text);
}
.chip-1 { background: var(--chip-1-bg); color: var(--chip-1-text); }
.chip-2 { background: var(--chip-2-bg); color: var(--chip-2-text); }
.chip-3 { background: var(--chip-3-bg); color: var(--chip-3-text); }
.chip-4 { background: var(--chip-4-bg); color: var(--chip-4-text); }
.chip-5 { background: var(--chip-5-bg, var(--chip-1-bg)); color: var(--chip-5-text, var(--chip-1-text)); }
.chip-6 { background: var(--chip-6-bg, var(--chip-2-bg)); color: var(--chip-6-text, var(--chip-2-text)); }
.chip-muted { background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.chip .icon { width: 14px; height: 14px; }

/* Selectable chips (single or multi select) */
.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-opt {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px;
  border-radius: 999px; border: 1px solid var(--btn-ghost-border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
  transition: background-color 120ms ease-out, border-color 120ms ease-out, transform 120ms ease-out;
}
.chip-opt:hover { background: var(--surface-alt); }
.chip-opt:active { transform: scale(0.97); }
.chip-opt[aria-pressed="true"], .chip-opt[aria-checked="true"] {
  background: var(--chip-2-bg); color: var(--chip-2-text); border-color: var(--chip-2-bg);
}
.chip-opt[aria-pressed="true"]::before, .chip-opt[aria-checked="true"]::before {
  content: ""; width: 14px; height: 14px; flex: none; background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* Segmented control */
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 12px; background: var(--surface-alt); border: 1px solid var(--border); }
.seg-opt {
  min-height: 40px; padding: 8px 14px; border-radius: 9px; border: 0; background: transparent;
  color: var(--text); font: inherit; font-size: 0.9375rem; font-weight: 600; cursor: pointer;
}
.seg-opt:hover { background: var(--surface); }
.seg-opt[aria-checked="true"] { background: var(--btn-primary-bg); color: var(--btn-primary-text); }

/* ================= SWITCH ================= */
.switch-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 12px 0; }
.switch-row + .switch-row { border-top: 1px solid var(--divider); }
.switch-text { min-width: 0; }
.switch-label { font-weight: 600; }
.switch-help { font-size: 0.875rem; color: var(--text-muted); margin-top: 2px; }
.switch {
  position: relative; flex: none; width: 52px; height: 32px; border-radius: 999px; cursor: pointer;
  border: 1.5px solid var(--btn-ghost-border); background: var(--surface-alt); padding: 0;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 23px; height: 23px; border-radius: 50%;
  background: var(--text-muted); transition: transform 180ms var(--ease-out-soft), background-color 150ms;
}
.switch[aria-checked="true"] { background: var(--btn-primary-bg); border-color: var(--btn-primary-bg); }
.switch[aria-checked="true"]::after { transform: translateX(20px); background: var(--btn-primary-text); }
/* 44px touch target around the 32px switch */
.switch::before { content: ""; position: absolute; inset: -6px -4px; }

/* ================= CHECKBOX ================= */
.check {
  appearance: none; -webkit-appearance: none; flex: none; cursor: pointer;
  width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--btn-ghost-border); background: var(--surface);
  display: inline-grid; place-content: center; margin: 0;
  transition: background-color 150ms ease-out, border-color 150ms ease-out;
}
.check::after {
  content: ""; width: 14px; height: 14px; background: var(--check-tick);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
  clip-path: inset(0 100% 0 0); transition: clip-path 200ms ease-out;
}
.check:checked { background: var(--accent-2); border-color: var(--accent-2); }
.check:checked::after { clip-path: inset(0); }
.check.lg { width: 28px; height: 28px; }
.check-row { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.check-row.done .check-text { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-accent); }

/* ================= FORM FIELDS ================= */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-weight: 600; font-size: 0.9375rem; color: var(--text); }
.field-help { font-size: 0.875rem; color: var(--text-muted); }
.field-error { font-size: 0.875rem; color: var(--danger-text); font-weight: 600; }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: var(--radius-input);
  border: 1px solid var(--border-accent); background: var(--surface); color: var(--text);
  font: inherit; font-size: 1rem; line-height: 1.4;
  transition: border-color 120ms ease-out, box-shadow 120ms ease-out;
}
.input::placeholder, .textarea::placeholder { color: var(--text-muted); opacity: 1; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--focus-ring); }
.textarea { min-height: 96px; resize: vertical; }
.select { appearance: none; -webkit-appearance: none; padding-right: 40px; background-image: none; }
.select-wrap { position: relative; }
.select-wrap .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--text-muted); }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 52px; }
.input-suffix .suffix { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-weight: 600; pointer-events: none; }
input[type="date"].input, input[type="time"].input { min-height: 48px; }
input[type="date"], input[type="time"] { color-scheme: inherit; }
.input[aria-invalid="true"] { border-color: var(--danger-text); }

/* ================= ALERTS & CALLOUTS ================= */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 0.9375rem; }
.alert .icon { margin-top: 2px; }
.alert-success { background: var(--success-bg); color: var(--success-text); }
.alert-warning { background: var(--warning-bg); color: var(--warning-text); }
.alert-danger { background: var(--danger-bg); color: var(--danger-text); }
.alert-info { background: var(--info-bg); color: var(--info-text); }

/* ================= PROGRESS ================= */
.progress { height: 10px; border-radius: 999px; background: var(--progress-track); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: 999px; background: var(--progress-fill); transition: width 400ms var(--ease-out-soft); }

/* ================= MODALS & SHEETS ================= */
.backdrop {
  position: fixed; inset: 0; z-index: 90; background: rgba(20, 16, 18, 0.4);
  animation: fade-in 200ms ease-out both;
}
.dialog-wrap { position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; pointer-events: none; }
.dialog {
  pointer-events: auto; position: relative; width: 100%; max-width: 560px; max-height: calc(100dvh - 32px);
  display: flex; flex-direction: column;
  background: var(--surface); color: var(--text); border-radius: var(--radius-modal);
  border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  animation: dialog-in 220ms var(--ease-out-soft) both;
}
.dialog.sm { max-width: 440px; }
.dialog.lg { max-width: 760px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 20px 8px; }
.dialog-title { font-size: 1.25rem; }
.dialog-sub { color: var(--text-muted); font-size: 0.9375rem; margin-top: 4px; }
.dialog-body { padding: 8px 20px 20px; overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
.dialog-foot { padding: 12px 20px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--divider); display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; background: var(--surface); border-radius: 0 0 var(--radius-modal) var(--radius-modal); }
.dialog-foot .btn { flex: 0 1 auto; }
.sheet-handle { display: none; }

/* Phones: sheets slide up from the bottom */
@media (max-width: 767.98px) {
  .dialog-wrap.is-sheet { align-items: flex-end; padding: 0; }
  .dialog-wrap.is-sheet .dialog {
    max-width: none; max-height: calc(100dvh - 24px - var(--safe-top));
    border-radius: var(--radius-modal) var(--radius-modal) 0 0; border-bottom: 0;
    animation: sheet-in 280ms var(--ease-out-soft) both;
  }
  .dialog-wrap.is-sheet.full .dialog { height: calc(100dvh - 24px - var(--safe-top)); }
  .dialog-wrap.is-sheet .dialog-foot { border-radius: 0; }
  .dialog-wrap.is-sheet .dialog-body:last-child { padding-bottom: calc(20px + var(--safe-bottom)); }
  .dialog-wrap.is-sheet .dialog-foot .btn { flex: 1 1 auto; }
  .sheet-handle { display: block; width: 100%; height: 22px; border: 0; background: transparent; cursor: grab; flex: none; position: relative; touch-action: none; }
  .sheet-handle::after { content: ""; position: absolute; left: 50%; top: 9px; width: 40px; height: 5px; border-radius: 999px; transform: translateX(-50%); background: var(--border-accent); }
  .dialog-wrap.is-sheet .dialog-head { padding-top: 4px; }
}
.dialog.closing { animation: dialog-out 160ms ease-out both; }
@media (max-width: 767.98px) { .dialog-wrap.is-sheet .dialog.closing { animation: sheet-out 200ms ease-out both; } }
.backdrop.closing { animation: fade-out 180ms ease-out both; pointer-events: none; }
.dialog.closing { pointer-events: none !important; }

/* ================= TOASTS ================= */
.toast-region {
  position: fixed; z-index: 150; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bottom-nav-h) + 88px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(92vw, 440px); pointer-events: none;
}
@media (min-width: 768px) { .toast-region { bottom: 96px; } }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 14px 12px 16px; border-radius: 14px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-accent); box-shadow: var(--shadow-lg);
  font-weight: 600; font-size: 0.9375rem;
  animation: toast-in 200ms var(--ease-out-soft) both;
}
.toast .icon { color: var(--accent-2-deep); }
.toast-msg { flex: 1; }
.toast.leaving { animation: toast-out 180ms ease-out both; }
.toast .btn { min-height: 36px; }

/* ================= TABS ================= */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; min-height: 44px; padding: 10px 16px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 0.9375rem; cursor: pointer; white-space: nowrap;
}
.tab:hover { background: var(--surface-alt); }
.tab[aria-selected="true"] { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); border-color: var(--btn-secondary-bg); }
@media (min-width: 768px) {
  .tabs { border-bottom: 1px solid var(--divider); gap: 4px; border-radius: 0; padding-bottom: 0; }
  .tab { border-radius: 10px 10px 0 0; border: 0; background: transparent; padding: 10px 16px; position: relative; color: var(--text-muted); }
  .tab:hover { background: var(--surface-alt); color: var(--text); }
  .tab[aria-selected="true"] { background: transparent; color: var(--heading); }
  .tab[aria-selected="true"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--accent-1-deep); }
}
.tab-panel:focus-visible { outline-offset: 4px; }

/* ================= ACCORDION ================= */
.acc-head {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: none; border: 0; padding: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; min-height: 44px;
}
.acc-head .chev { transition: transform 200ms var(--ease-out-soft); color: var(--text-muted); }
.acc-head[aria-expanded="true"] .chev { transform: rotate(180deg); }
.acc-panel[hidden] { display: none; }

/* ================= HUB PAGES ================= */
.hub-list { display: grid; gap: 12px; }
@media (min-width: 640px) { .hub-list { grid-template-columns: repeat(2, minmax(0,1fr)); } }
.hub-card {
  display: flex; align-items: center; gap: 16px; padding: 18px; text-decoration: none; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
  min-height: 84px; transition: transform 120ms ease-out;
}
.hub-card:active { transform: scale(0.98); }
.hub-icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none; }
.hub-icon .icon { width: 24px; height: 24px; }
.hub-title { font-family: var(--font-heading); font-weight: 500; font-variation-settings: "SOFT" 50, "WONK" 0; font-size: 1.125rem; color: var(--heading); }
.hub-desc { color: var(--text-muted); font-size: 0.9375rem; }
.hub-card .chev { margin-left: auto; color: var(--text-muted); }

/* ================= MORE SHEET LIST ================= */
.menu-list { display: flex; flex-direction: column; }
.menu-item {
  display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 10px 6px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 600; background: none; border: 0; font: inherit; font-weight: 600; text-align: left; cursor: pointer; width: 100%;
}
.menu-item .icon { color: var(--accent-2-deep); }
.menu-item:hover { background: var(--surface-alt); }
.menu-item + .menu-item { border-top: 1px solid var(--divider); }

/* ================= EMPTY STATE ================= */
.empty {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 24px 12px;
}
.empty-art { width: 140px; height: 110px; color: var(--accent-2-deep); }
.empty-art svg { width: 100%; height: 100%; }
.empty-title { font-family: var(--font-heading); font-weight: 500; font-variation-settings: "SOFT" 50, "WONK" 0; font-size: 1.125rem; color: var(--heading); }
.empty-body { color: var(--text-muted); max-width: 42ch; }

/* ================= SKELETON ================= */
.skeleton { border-radius: 10px; background: linear-gradient(90deg, var(--surface-alt) 0%, var(--divider) 50%, var(--surface-alt) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* ================= SETTINGS ================= */
.settings-layout { display: grid; gap: 16px; }
@media (min-width: 1024px) { .settings-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 32px; align-items: start; } }
.settings-nav { display: none; }
@media (min-width: 1024px) {
  .settings-nav { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 24px; }
  .settings-nav a { padding: 8px 12px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9375rem; }
  .settings-nav a:hover { background: var(--surface-alt); }
  .settings-nav a.active { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent-1-deep); border: 1px solid var(--border); }
}
.settings-sections { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (min-width: 768px) { .settings-sections { gap: 20px; } }
.set-section { scroll-margin-top: 16px; }
.set-section .acc-head h2 { display: flex; align-items: center; gap: 10px; }
.set-section .acc-head h2 .icon { color: var(--accent-2-deep); }
.set-body { margin-top: 12px; }
@media (min-width: 768px) {
  .set-section .acc-head { cursor: default; pointer-events: none; }
  .set-section .acc-head .chev { display: none; }
}
.set-group { display: flex; flex-direction: column; gap: 8px; padding: 12px 0; }
.set-group + .set-group { border-top: 1px solid var(--divider); }
.style-cards { display: grid; gap: 10px; }
@media (min-width: 640px) { .style-cards { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.pick-card {
  text-align: left; display: flex; flex-direction: column; gap: 6px; padding: 14px; cursor: pointer;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-card); color: var(--text); font: inherit;
  transition: border-color 120ms ease-out, background-color 120ms ease-out;
}
.pick-card:hover { background: var(--surface-alt); }
.pick-card[aria-checked="true"] { border-color: var(--accent-1-deep); background: var(--surface-alt); box-shadow: inset 0 0 0 1px var(--accent-1-deep); }
.pick-card .pick-title { font-weight: 700; line-height: 1.3; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pick-card .pick-desc { font-size: 0.875rem; color: var(--text-muted); }
.pick-card .pick-tick { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-2); color: var(--check-tick); visibility: hidden; }
.pick-card[aria-checked="true"] .pick-tick { visibility: visible; }
.pick-card .pick-tick .icon { width: 14px; height: 14px; stroke-width: 3; }

/* Theme picker swatches: nav-bg, btn-primary-bg, btn-secondary-bg, chart-3 of each theme */
.theme-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.theme-swatches { display: grid; grid-template-columns: repeat(4, 1fr); height: 40px; border-radius: 10px; overflow: hidden; border: 1px solid var(--border); }
.theme-swatches span { display: block; }
.theme-swatches .sw-nav { background: var(--nav-bg); }
.theme-swatches .sw-pri { background: var(--btn-primary-bg); }
.theme-swatches .sw-sec { background: var(--btn-secondary-bg); }
.theme-swatches .sw-ch3 { background: var(--chart-3); }
.card.danger-zone .acc-head h2 .icon, .card.danger-zone .chev { color: var(--danger-text); }

/* Data & backup important box */
.important-box { background: var(--warning-bg); color: var(--warning-text); border-radius: 12px; padding: 14px 16px; font-size: 0.9375rem; }
.steps-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }

/* ================= HELP ================= */
.help-acc + .help-acc { border-top: 1px solid var(--divider); }
.help-acc .acc-head { padding: 10px 0; font-weight: 600; font-size: 1rem; }
.help-acc .acc-panel { padding: 0 0 14px; color: var(--text); }
.help-acc ol, .help-acc ul { margin: 0; padding-left: 1.4em; display: flex; flex-direction: column; gap: 4px; }
.help-acc ol { list-style: decimal; }
.help-acc ul { list-style: disc; }
.faq-q { font-weight: 600; margin-top: 10px; }

/* ================= BANNERS (update, errors, private mode) ================= */
#update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 300;
  padding: calc(14px + var(--safe-top)) 14px 14px; text-align: center;
  background: var(--btn-primary-bg); color: var(--btn-primary-text); font-weight: 600;
}
#update-banner button {
  margin-left: 10px; padding: 8px 14px; min-height: 40px; border-radius: var(--radius-btn); cursor: pointer;
  background: transparent; color: var(--btn-primary-text); border: 1.5px solid var(--btn-primary-text); font: inherit; font-weight: 600;
}
.app-banner { padding: 12px 16px; text-align: center; font-weight: 600; font-size: 0.9375rem; }
.app-banner.danger { background: var(--danger-bg); color: var(--danger-text); cursor: pointer; }
.app-banner.info { background: var(--info-bg); color: var(--info-text); }

/* ================= MISC ================= */
.list-row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 0; }
.list-row + .list-row { border-top: 1px solid var(--divider); }
.badge-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.save-indicator { display: inline-flex; align-items: center; gap: 4px; font-size: 0.8125rem; color: var(--success-text); font-weight: 600; opacity: 0; transition: opacity 200ms; }
.save-indicator.show { opacity: 1; }
.tooltip-btn { position: relative; flex: none; display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 50%; border: 0; background: transparent; color: var(--text-muted); cursor: pointer; vertical-align: middle; }
.tooltip-btn:hover { background: var(--surface-alt); color: var(--text); }
.popover {
  position: fixed; z-index: 160; max-width: 300px; padding: 12px 14px; border-radius: 12px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-accent); box-shadow: var(--shadow-lg);
  font-size: 0.9375rem; animation: fade-in 150ms ease-out both;
}
.specimen-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: baseline; }

/* =====================================================================
   SESSION 2 COMPONENTS
   ===================================================================== */

/* ---------- Mood picker ---------- */
.mood-picker { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.mood-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; min-height: 76px;
  border-radius: 14px; border: 1px solid transparent; background: transparent; color: var(--text-muted);
  font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer;
  transition: background-color 150ms ease-out, color 150ms ease-out;
}
.mood-btn:hover { background: var(--surface-alt); }
.mood-face { width: 40px; height: 40px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; transition: transform 200ms var(--ease-out-soft); }
.mood-face .eye { fill: currentColor; stroke: none; }
.mood-label { color: var(--text); }
.mood-btn[aria-pressed="true"] { border-color: var(--border-accent); }
.mood-btn[aria-pressed="true"] .mood-face { transform: scale(1.12); }
.mood-btn.mood-1[aria-pressed="true"] { background: var(--chip-3-bg); color: var(--chip-3-text); }
.mood-btn.mood-2[aria-pressed="true"] { background: var(--chip-4-bg); color: var(--chip-4-text); }
.mood-btn.mood-3[aria-pressed="true"] { background: var(--chip-1-bg); color: var(--chip-1-text); }
.mood-btn.mood-4[aria-pressed="true"], .mood-btn.mood-5[aria-pressed="true"] { background: var(--chip-2-bg); color: var(--chip-2-text); }
.mood-btn[aria-pressed="true"] .mood-face circle:first-child { fill: var(--surface); }
.mood-picker.compact .mood-btn { min-height: 64px; }
.mood-picker.compact .mood-face { width: 34px; height: 34px; }

/* ---------- Range slider ---------- */
.range-field { display: flex; flex-direction: column; gap: 8px; }
.range-value { font-weight: 600; color: var(--accent-2-deep); font-size: 0.9375rem; }
.range { -webkit-appearance: none; appearance: none; width: 100%; height: 44px; background: transparent; cursor: pointer; margin: 0; }
.range::-webkit-slider-runnable-track { height: 8px; border-radius: 999px; background: linear-gradient(90deg, var(--accent-2) var(--pct, 50%), var(--progress-track) var(--pct, 50%)); }
.range::-moz-range-track { height: 8px; border-radius: 999px; background: var(--progress-track); }
.range::-moz-range-progress { height: 8px; border-radius: 999px; background: var(--accent-2); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent-2-deep); box-shadow: var(--shadow-sm); }
.range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 3px solid var(--accent-2-deep); }
.range.unset::-webkit-slider-runnable-track { background: var(--progress-track); }
.range.unset::-moz-range-progress { background: transparent; }
.range.unset::-webkit-slider-thumb { border-color: var(--btn-ghost-border); }
.range.unset::-moz-range-thumb { border-color: var(--btn-ghost-border); }
.range:focus-visible { outline: none; }
.range:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.range:focus-visible::-moz-range-thumb { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.range-ends { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--text-muted); margin-top: -6px; }

/* ---------- Stepper ---------- */
.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border-accent); border-radius: 12px; padding: 2px; background: var(--surface); }
.stepper-btn { width: 44px; height: 44px; }
.stepper-btn:disabled { color: var(--text-muted); opacity: 0.6; cursor: not-allowed; }
.stepper-value { min-width: 64px; text-align: center; font-weight: 600; font-size: 1.0625rem; }

/* ---------- Date nav ---------- */
.date-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.date-nav-label { font-weight: 600; min-width: 150px; text-align: center; }
.icon-btn:disabled { color: var(--text-muted); opacity: 0.45; cursor: not-allowed; background: transparent; border-color: transparent; }

/* ---------- Progress ring ---------- */
.pring { position: relative; flex: none; }
.pring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.pring-track { fill: none; stroke: var(--progress-track); stroke-width: 11; }
.pring-fill { fill: none; stroke: var(--progress-fill); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 400ms var(--ease-out-soft); }
[data-theme="rainbow-pastel"] .pring-fill { stroke: var(--chart-5); }
.pring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 18px; }
.pring-main { font-weight: 600; font-size: 1.125rem; line-height: 1.2; color: var(--heading); }
.pring-sub { font-size: 0.8125rem; color: var(--text-muted); line-height: 1.25; }
.pring-tick { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-2); color: var(--check-tick); margin-bottom: 2px; }
.pring-tick .icon { stroke-width: 3; }

/* ---------- Progress bar row ---------- */
.pbar + .pbar { margin-top: 12px; }
.pbar-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 0.9375rem; }
.pbar-label { font-weight: 600; }
.pbar-value { color: var(--text-muted); }

/* ---------- Stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 12px; }
@media (min-width: 640px) and (max-width: 1279.98px) { .stat-grid.six { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 640px) and (max-width: 1023.98px) { .stat-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); } .stat-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (min-width: 1280px) { .stat-grid.six { grid-template-columns: repeat(6, minmax(0,1fr)); } }
@media (min-width: 1024px) { .stat-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); } .stat-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px; box-shadow: var(--shadow-sm); min-width: 0; }
.stat-card .stat-number { font-size: 1.5rem; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
@media (min-width: 1024px) { .stat-card .stat-number { font-size: 1.625rem; } }
.stat-arrow { color: var(--accent-1-deep); display: inline-flex; }

/* ---------- Sparkline ---------- */
.sparkline { color: var(--accent-2-deep); display: inline-flex; }

/* ---------- Charts ---------- */
.chart-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -4px; padding: 0 4px; }
.chart-box { position: relative; width: 100%; aspect-ratio: 4 / 3; max-height: 360px; }
@media (min-width: 768px) { .chart-box { aspect-ratio: 16 / 9; max-height: 380px; } }
.chart-card.short .chart-box { aspect-ratio: 16 / 9; max-height: 240px; }
@media (min-width: 768px) { .chart-card.short .chart-box { aspect-ratio: 21 / 9; } }
.chart-skeleton { position: absolute; inset: 0; border-radius: 12px; }
.chart-summary { margin-top: 10px; font-size: 0.9375rem; color: var(--text); }
.chart-table { margin-top: 10px; }
.table-scroll { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.data-table th, .data-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.data-table thead th { font-size: 0.8125rem; color: var(--text-muted); font-weight: 600; }
.data-table tbody th { font-weight: 600; }
.range-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pill { min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; }
.pill:hover { background: var(--surface-alt); }
.pill[aria-checked="true"], .pill[aria-pressed="true"] { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); border-color: var(--btn-secondary-bg); }

/* ---------- Swipe rows and menus ---------- */
.swipe-row { position: relative; overflow: hidden; }
.swipe-row + .swipe-row { border-top: 1px solid var(--divider); }
.swipe-content { position: relative; z-index: 1; display: flex; align-items: center; gap: 8px; background: var(--surface); min-height: 56px; padding: 8px 0; transition: transform 200ms var(--ease-out-soft); }
.swipe-main { flex: 1; min-width: 0; }
.swipe-actions { position: absolute; inset: 0 0 0 auto; display: flex; }
.swipe-btn { width: 80px; border: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font: inherit; font-size: 0.8125rem; font-weight: 600; cursor: pointer; }
.swipe-btn.edit { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); }
.swipe-btn.delete { background: var(--danger-bg); color: var(--danger-text); }
.row-menu { position: fixed; z-index: 170; min-width: 180px; padding: 6px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-accent); box-shadow: var(--shadow-lg); animation: fade-in 120ms ease-out both; }
.row-menu-item { width: 100%; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: 8px; border: 0; background: transparent; color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.row-menu-item:hover, .row-menu-item:focus-visible { background: var(--surface-alt); }
.row-menu-item.danger { color: var(--danger-text); }
.row-title { font-weight: 600; }
.row-meta { font-size: 0.875rem; color: var(--text-muted); }
.chips-inline { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }

/* ---------- Body map ---------- */
.body-map { max-width: 340px; margin: 0 auto; color: var(--text-muted); }
.body-map svg { width: 100%; height: auto; display: block; }
.body-outline > * { fill: var(--surface-alt); stroke: var(--border-accent); stroke-width: 1.5; }
.zone rect { fill: var(--chip-1-bg); stroke: var(--chip-1-text); stroke-width: 1; stroke-dasharray: 3 2; cursor: pointer; transition: fill 150ms; }
.zone:hover rect { fill: var(--chip-2-bg); }
.zone.selected rect { fill: var(--accent-2); stroke: var(--accent-2-deep); stroke-width: 2; stroke-dasharray: none; }
.zone-dot { fill: var(--accent-1-deep); pointer-events: none; }
.map-caption { fill: var(--text-muted); font-size: 12px; font-weight: 600; font-family: var(--font-body); }
.map-side { fill: var(--text-muted); font-size: 11px; font-weight: 700; font-family: var(--font-body); }
.site-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.site-chip { flex-direction: column; align-items: flex-start; gap: 0; border-radius: 14px; }
.site-chip .site-sub { font-size: 0.8125rem; font-weight: 400; opacity: 0.85; }
.site-chip[aria-checked="true"]::before { display: none; }

/* ---------- Widgets (Today) ---------- */
.widget-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.focus-text { font-family: var(--font-accent); font-weight: 500; font-size: 1.375rem; line-height: 1.3; color: var(--heading); }
.focus-empty { color: var(--text-muted); }
.week-dots { display: flex; gap: 8px; }
.week-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--btn-ghost-border); }
.week-dot.on { background: var(--accent-2); border-color: var(--accent-2); }
.week-dot.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--border-accent); }
.dot-labels { display: flex; gap: 8px; }
.dot-labels span { width: 24px; text-align: center; font-size: 0.8125rem; color: var(--text-muted); }
.cup-row { display: flex; flex-wrap: wrap; gap: 8px; }
.cup-btn { flex: 1 1 auto; }
.meal-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.meal-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-size: 0.875rem; font-weight: 600; border: 1px solid var(--border); color: var(--text-muted); background: var(--surface); }
.meal-chip.done { background: var(--chip-2-bg); color: var(--chip-2-text); border-color: var(--chip-2-bg); }
.coming-row { display: flex; align-items: center; gap: 12px; min-height: 44px; }
.coming-row + .coming-row { border-top: 1px solid var(--divider); }
.coming-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.coming-when { margin-left: auto; font-size: 0.875rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.easy-actions { display: grid; gap: 12px; }
@media (min-width: 768px) { .easy-actions { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.easy-btn { min-height: 72px; font-size: 1.0625rem; white-space: normal; }
.widget.highlight { animation: soft-flash 600ms ease-out; }
.customize-row { display: flex; align-items: center; gap: 8px; min-height: 52px; }
.customize-row + .customize-row { border-top: 1px solid var(--divider); }
.customize-row .grow { flex: 1; font-weight: 600; }

/* ---------- Food ---------- */
.num-chip { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: 0.8125rem; font-weight: 600; background: var(--surface-alt); color: var(--text-muted); border: 1px solid var(--border); }
.planned-chip .chip { white-space: normal; }
.planned-chip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 12px; background: var(--callout-bg); border: 1px dashed var(--callout-border); margin-bottom: 8px; }
.fav-grid { display: grid; gap: 12px; }
@media (min-width: 768px) { .fav-grid { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (min-width: 1280px) { .fav-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.disclosure { background: none; border: 0; padding: 6px 0; color: var(--link); font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.disclosure .icon { transition: transform 200ms; }
.disclosure[aria-expanded="true"] .icon { transform: rotate(180deg); }
.form-grid { display: grid; gap: 12px; }
@media (min-width: 480px) { .form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); } .form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); } }
.inline-note { padding: 10px 12px; border-radius: 12px; background: var(--info-bg); color: var(--info-text); font-size: 0.9375rem; }
.info-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--info-bg); color: var(--info-text); font-size: 0.9375rem; }
.quick-section { border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px; background: var(--surface); }
.quick-section + .quick-section { margin-top: 12px; }
.quick-section h3 { font-family: var(--font-body); font-weight: 700; font-size: 1rem; margin-bottom: 10px; }
.timeline-notes { display: flex; flex-direction: column; gap: 10px; }
.timeline-note { padding-left: 14px; border-left: 3px solid var(--border-accent); }
.sticky-action { position: sticky; bottom: calc(var(--bottom-nav-h) + 12px + var(--safe-bottom)); z-index: 5; }
@media (min-width: 768px) { .sticky-action { position: static; } }

/* =====================================================================
   ILLUSTRATIONS (dashboard hero, empty states, fresh start, iOS steps)
   Built by _build/make-art.py. Every shape has a wa-* class mapped to an
   --art-* token per theme (pwa-dashboard-illustration skill), so pictures
   recolor with the theme. Tokens point at each theme's own tokens.
   ===================================================================== */
:root, [data-theme="blush-sage"] {
  --hero-bg: linear-gradient(118deg, var(--callout-bg) 0%, var(--surface) 55%, var(--chip-2-bg) 100%);
  --hero-border: var(--callout-border); --hero-eyebrow-bg: var(--chip-1-bg); --hero-eyebrow-text: var(--chip-1-text);
  --art-glow: var(--chip-1-bg); --art-page: var(--surface); --art-ink: var(--text); --art-shadow: var(--text);
  --art-cover: var(--chart-3); --art-trend: var(--accent-2-deep); --art-trend-soft: var(--chart-1); --art-done: var(--chart-2);
  --art-water: var(--chart-2); --art-glass: var(--surface-alt); --art-lemon: var(--chart-6); --art-leaf: var(--chart-4); --art-leaf2: var(--chart-2);
  --art-pot: var(--chart-5); --art-pot-rim: var(--chart-1); --art-bowl: var(--chart-1); --art-fruit1: var(--chart-3); --art-fruit2: var(--accent-1-deep);
  --art-spark: var(--accent-1-deep); --art-hl: var(--chip-2-bg);
}
[data-theme="rainbow-pastel"] {
  --hero-bg: linear-gradient(118deg, var(--callout-bg) 0%, var(--surface) 55%, var(--chip-5-bg) 100%);
  --hero-border: var(--callout-border); --hero-eyebrow-bg: var(--chip-6-bg); --hero-eyebrow-text: var(--chip-6-text);
  --art-glow: var(--chip-3-bg); --art-page: var(--surface); --art-ink: var(--text); --art-shadow: var(--text);
  --art-cover: var(--chart-6); --art-trend: var(--chip-4-text); --art-trend-soft: var(--chart-2); --art-done: var(--chart-4);
  --art-water: var(--chart-5); --art-glass: var(--surface-alt); --art-lemon: var(--chart-3); --art-leaf: var(--chart-4); --art-leaf2: var(--success-text);
  --art-pot: var(--chart-1); --art-pot-rim: var(--chart-2); --art-bowl: var(--chart-5); --art-fruit1: var(--chart-1); --art-fruit2: var(--chart-6);
  --art-spark: var(--accent-1-deep); --art-hl: var(--chip-5-bg);
}
[data-theme="neutral"] {
  --hero-bg: linear-gradient(118deg, var(--callout-bg) 0%, var(--surface) 55%, var(--chip-2-bg) 100%);
  --hero-border: var(--callout-border); --hero-eyebrow-bg: var(--chip-1-bg); --hero-eyebrow-text: var(--chip-1-text);
  --art-glow: var(--chip-3-bg); --art-page: var(--surface); --art-ink: var(--text); --art-shadow: var(--text);
  --art-cover: var(--chart-2); --art-trend: var(--chart-6); --art-trend-soft: var(--chart-4); --art-done: var(--chart-1);
  --art-water: var(--chart-4); --art-glass: var(--surface-alt); --art-lemon: var(--chart-5); --art-leaf: var(--chart-6); --art-leaf2: var(--chart-1);
  --art-pot: var(--chart-5); --art-pot-rim: var(--chart-3); --art-bowl: var(--chart-3); --art-fruit1: var(--chart-2); --art-fruit2: var(--accent-1-deep);
  --art-spark: var(--accent-1-deep); --art-hl: var(--chip-2-bg);
}
/* Dark: "paper" stays light, so ink drawn on it is dark (reuses existing tokens). */
[data-theme="dark"] {
  --hero-bg: linear-gradient(118deg, var(--callout-bg) 0%, var(--surface) 55%, var(--chip-4-bg) 100%);
  --hero-border: var(--callout-border); --hero-eyebrow-bg: var(--chip-1-bg); --hero-eyebrow-text: var(--chip-1-text);
  --art-glow: var(--chip-1-bg); --art-page: var(--nav-text); --art-ink: var(--surface); --art-shadow: var(--bg);
  --art-cover: var(--chart-1); --art-trend: var(--surface-alt); --art-trend-soft: var(--chart-6); --art-done: var(--chart-2);
  --art-water: var(--chart-4); --art-glass: var(--btn-secondary-bg); --art-lemon: var(--chart-5); --art-leaf: var(--chart-2); --art-leaf2: var(--accent-2-deep);
  --art-pot: var(--chart-3); --art-pot-rim: var(--chart-6); --art-bowl: var(--chart-6); --art-fruit1: var(--chart-3); --art-fruit2: var(--chart-1);
  --art-spark: var(--chart-5); --art-hl: var(--chip-4-bg);
}
.wa-glow { fill: var(--art-glow); }
.wa-shadow { fill: var(--art-shadow); opacity: 0.08; }
[data-theme="dark"] .wa-shadow { opacity: 0.45; }
.wa-spark { fill: var(--art-spark); } .wa-soft { opacity: 0.55; }
.wa-cover { fill: var(--art-cover); }
.wa-page { fill: var(--art-page); }
.wa-frame { stroke: var(--art-cover); stroke-width: 1.5; }
.wa-line { fill: var(--art-ink); opacity: 0.16; }
.wa-grid { fill: none; stroke: var(--art-ink); stroke-width: 1; opacity: 0.08; }
.wa-trend { fill: none; stroke: var(--art-trend); stroke-width: 3.2; stroke-linecap: round; }
.wa-trend-soft { fill: none; stroke: var(--art-trend-soft); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1 5; }
.wa-dot { fill: var(--art-trend-soft); }
.wa-done { fill: var(--art-done); }
.wa-todo { fill: none; stroke: var(--art-ink); stroke-width: 1.4; opacity: 0.3; }
.wa-tick { fill: none; stroke: var(--art-ink); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: 0.75; }
.wa-glass { fill: var(--art-glass); stroke: var(--art-ink); stroke-width: 1.2; stroke-opacity: 0.18; }
.wa-water { fill: var(--art-water); opacity: 0.75; }
.wa-lemon { fill: var(--art-lemon); }
.wa-lemon-in { fill: var(--art-page); opacity: 0.55; }
.wa-ink-line { fill: none; stroke: var(--art-ink); stroke-width: 1.6; stroke-linecap: round; opacity: 0.2; }
.wa-ink-s { fill: none; stroke: var(--art-ink); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: 0.7; }
.wa-bowl { fill: var(--art-bowl); }
.wa-fruit1 { fill: var(--art-fruit1); } .wa-fruit2 { fill: var(--art-fruit2); }
.wa-pot { fill: var(--art-pot); } .wa-pot-rim { fill: var(--art-pot-rim); }
.wa-stem { fill: none; stroke: var(--art-leaf); stroke-width: 2.6; stroke-linecap: round; }
.wa-leaf { fill: var(--art-leaf); } .wa-leaf2 { fill: var(--art-leaf2); }
.wa-moon { fill: var(--art-lemon); }
.wa-hill { fill: var(--art-leaf2); opacity: 0.45; }
.wa-heart { fill: var(--art-fruit1); }
.wa-tape { fill: var(--art-lemon); }
.wa-handle { fill: none; stroke: var(--art-cover); stroke-width: 3.5; stroke-linecap: round; }
.wa-hl { fill: var(--art-hl); stroke: var(--art-spark); stroke-width: 1.5; }
.wa-sway { transform-box: fill-box; transform-origin: 50% 100%; animation: waSway 7s ease-in-out infinite; }
@keyframes waSway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2.5deg); } }
@media (prefers-reduced-motion: reduce) { .wa-sway { animation: none; } }
html.calm .wa-sway { animation: none; }

/* ---------- Today welcome panel ----------
   Laid out by its own width (container query) so the picture never squeezes the
   text: phones keep it small beside the message (panel about 140px tall). */
.wl-hero {
  container-type: inline-size; position: relative; overflow: hidden;
  background: var(--hero-bg, var(--surface)); border: 1px solid var(--hero-border, var(--border));
  border-radius: var(--radius-card); box-shadow: var(--shadow-sm);
}
.wl-hero__grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 118px; grid-template-areas: "text art" "foot foot";
  gap: 10px 12px; align-items: center; padding: 14px 16px;
}
.wl-hero__text { grid-area: text; min-width: 0; }
.wl-hero__art { grid-area: art; line-height: 0; aspect-ratio: 320 / 200; }
.wl-hero__art svg { width: 100%; height: auto; display: block; }
.wl-hero__foot { grid-area: foot; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.wl-hero__eyebrow { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--hero-eyebrow-bg); color: var(--hero-eyebrow-text); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.02em; }
.wl-hero__title { margin-top: 6px; font-family: var(--font-heading); font-weight: 500; font-variation-settings: "SOFT" 50, "WONK" 0; font-size: 1.125rem; line-height: 1.25; color: var(--heading); }
.wl-hero__line { margin-top: 2px; font-size: 0.875rem; color: var(--text); line-height: 1.4; }
@container (min-width: 560px) {
  .wl-hero__grid { grid-template-columns: minmax(0, 1fr) minmax(220px, 260px); gap: 10px 24px; padding: 18px 24px; }
  .wl-hero__title { font-size: 1.375rem; }
  .wl-hero__line { font-size: 1rem; }
}
@container (min-width: 860px) {
  .wl-hero__grid { grid-template-columns: minmax(0, 1fr) 288px; grid-template-areas: "text art" "foot art"; }
  .wl-hero__art { align-self: end; margin-bottom: -6px; }
}
@media print { .wl-hero__art { display: none; } .wl-hero { background: none; } }

/* =====================================================================
   SESSION 3 PAGES
   ===================================================================== */
/* ---------- Week navigation ---------- */
.week-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.week-label { font-weight: 600; min-width: 140px; text-align: center; }

/* ---------- Meal planner ---------- */
.plan-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
.plan-grid {
  display: grid; grid-template-columns: 96px repeat(7, minmax(118px, 1fr)); min-width: 920px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden;
}
@media (min-width: 1280px) { .plan-grid { min-width: 0; } }
.plan-grid > * { border-right: 1px solid var(--divider); border-bottom: 1px solid var(--divider); }
.plan-corner, .plan-slot { background: var(--surface-alt); }
.plan-slot { padding: 10px; font-weight: 600; font-size: 0.875rem; color: var(--text); display: flex; align-items: flex-start; }
.plan-dayhead { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 8px; background: var(--surface-alt); min-height: 52px; }
.plan-dayhead.today { background: var(--callout-bg); box-shadow: inset 0 -3px 0 var(--accent-1-deep); }
.plan-dayhead .icon-btn { margin-left: auto; }
.plan-cell { padding: 6px; display: flex; flex-direction: column; gap: 6px; min-height: 72px; transition: background-color 120ms; }
.plan-cell.drop { background: var(--chip-2-bg); }
.plan-meal {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px; width: 100%; text-align: left; cursor: pointer;
  padding: 6px 8px; border-radius: 10px; border: 1px solid var(--border-accent); background: var(--surface); color: var(--text); font: inherit; font-size: 0.875rem; font-weight: 600;
}
.plan-meal:hover { background: var(--surface-alt); }
.plan-meal.logged { opacity: 0.85; }
.plan-meal .chips-inline { margin-top: 0; }
.plan-meal .chip { font-size: 0.8125rem; padding: 1px 8px; }
.plan-title { line-height: 1.3; overflow-wrap: anywhere; }
.plan-thumb { width: 100%; height: 48px; object-fit: cover; border-radius: 6px; }
.plan-add {
  display: flex; align-items: center; justify-content: center; min-height: 44px; width: 100%; border-radius: 10px;
  border: 1.5px dashed var(--btn-ghost-border); background: transparent; color: var(--btn-ghost-text); cursor: pointer;
}
.plan-add:hover { background: var(--surface-alt); }
.plan-row + .plan-row { margin-top: 8px; }
.plan-row .plan-cell { padding: 4px 0 0; min-height: 0; }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; }
.pick-row { text-align: left; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.pick-row:hover { background: var(--surface-alt); }
.pick-row[aria-checked="true"] { border-color: var(--accent-2-deep); background: var(--chip-2-bg); color: var(--chip-2-text); }

/* ---------- Recipes ---------- */
.recipe-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.recipe-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; }
.recipe-open { position: absolute; inset: 0; z-index: 1; background: transparent; border: 0; cursor: pointer; border-radius: var(--radius-card); }
.recipe-photo { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; display: block; }
.recipe-photo.placeholder { display: grid; place-items: center; }
.recipe-heart { position: absolute; top: 8px; right: 8px; z-index: 2; background: var(--surface); border: 1px solid var(--border); }
.recipe-heart[aria-pressed="true"] { color: var(--accent-1-deep); }
.recipe-heart[aria-pressed="true"] .icon { fill: currentColor; }
.recipe-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.recipe-hero { width: 100%; max-height: 260px; object-fit: cover; border-radius: 12px; }
.recipe-steps { list-style: decimal; padding-left: 1.4em; display: flex; flex-direction: column; gap: 6px; }
.ing-row { display: grid; grid-template-columns: 76px 90px minmax(0, 1fr) 40px; gap: 8px; align-items: end; padding: 10px; border: 1px solid var(--border); border-radius: 12px; }
.ing-row > .field:nth-child(4) { grid-column: 1 / 4; }
.ing-row .ing-remove { grid-column: 4; grid-row: 1; }
@media (min-width: 640px) { .ing-row { grid-template-columns: 80px 100px minmax(0, 1fr) 160px 40px; } .ing-row > .field:nth-child(4) { grid-column: auto; } .ing-row .ing-remove { grid-column: auto; grid-row: auto; } }
.step-list { list-style: decimal; padding-left: 1.2em; }
.photo-preview { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.photo-thumb { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }
.img-placeholder { display: grid; place-items: center; padding: 8px; text-align: center; font-size: 0.8125rem; color: var(--text-muted); background: var(--surface-alt); }

/* ---------- Grocery ---------- */
.grocery-card { padding-top: 4px; }
.aisle-head {
  position: sticky; top: 0; z-index: 2; margin: 0 -16px; padding: 10px 16px 6px; background: var(--surface);
  font-family: var(--font-body); font-size: 0.8125rem; font-weight: 700; letter-spacing: 0.04em; color: var(--text-muted); border-bottom: 1px solid var(--divider);
}
@media (min-width: 768px) { .aisle-head { margin: 0 -20px; padding: 10px 20px 6px; } }
.grocery-row { padding: 6px 0; align-items: flex-start; }
.grocery-row + .grocery-row { border-top: 1px solid var(--divider); }
.grocery-row .check { margin-top: 2px; }
.grocery-row .chips-inline .chip { font-size: 0.8125rem; padding: 1px 8px; }

/* ---------- Weekly planner ---------- */
.wk-grid { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 8px; min-width: 1000px; }
@media (min-width: 1280px) { .wk-grid { min-width: 0; } }
.wk-agenda { display: flex; flex-direction: column; gap: 10px; }
.wk-day { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 140px; }
.wk-agenda .wk-day { min-height: 0; }
.wk-day.today { background: var(--surface-alt); border-color: var(--border-accent); }
.wk-dayhead { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.wk-agenda .wk-dayhead { position: sticky; top: 0; background: inherit; z-index: 1; padding-bottom: 4px; }
.wk-items { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.wk-item { display: flex; align-items: flex-start; gap: 6px; width: 100%; text-align: left; padding: 6px 8px; border-radius: 10px; border: 0; font: inherit; font-size: 0.875rem; font-weight: 600; cursor: pointer; line-height: 1.3; }
.wk-item .icon { margin-top: 1px; }
.wk-item-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wk-item.done { text-decoration: line-through; text-decoration-color: currentColor; opacity: 0.85; }
.wk-add { min-height: 32px; }

/* ---------- Habits ---------- */
.habit-row { display: flex; align-items: center; gap: 10px; min-height: 60px; padding: 6px 0; }
.habit-row + .habit-row { border-top: 1px solid var(--divider); }
.habit-row.done .row-title { color: var(--text-muted); text-decoration: line-through; text-decoration-color: var(--border-accent); }
.check-spacer { width: 28px; flex: none; }
.habit-name { flex: 1; min-width: 0; text-align: left; background: none; border: 0; padding: 4px 0; color: inherit; font: inherit; cursor: pointer; }
.color-dot { width: 36px; height: 36px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--chip-1-bg); }
.color-dot.chip-1 { background: var(--chip-1-text); } .color-dot.chip-2 { background: var(--chip-2-text); }
.color-dot.chip-3 { background: var(--chip-3-text); } .color-dot.chip-4 { background: var(--chip-4-text); }
.color-dot[aria-checked="true"] { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--focus-ring); }
.heatmap { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 360px; }
.hm-head { text-align: center; font-size: 0.8125rem; font-weight: 600; color: var(--text-muted); }
.hm-cell { aspect-ratio: 1; border-radius: 8px; display: grid; place-items: center; font-size: 0.8125rem; font-weight: 700; border: 1.5px solid var(--btn-ghost-border); color: var(--text-muted); }
.hm-cell.empty { border: 0; }
.hm-cell.done { background: var(--accent-2); border-color: var(--accent-2); color: var(--check-tick); }
.hm-cell.done .icon { stroke-width: 3; }
.hm-cell.pause { background: repeating-linear-gradient(45deg, var(--surface-alt), var(--surface-alt) 4px, var(--divider) 4px, var(--divider) 8px); color: var(--text); }
.hm-cell.future { opacity: 0.45; }
.hm-cell.today { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--border-accent); }
.hm-cell.legend { width: 22px; height: 22px; aspect-ratio: auto; }
.hm-num { font-weight: 600; }

/* =====================================================================
   SESSION 4 PAGES
   ===================================================================== */
/* ---------- Insights ---------- */
.period-bar { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: 8px 0 4px; margin-top: -8px; }
.period-bar .range-pills { margin-bottom: 4px; }
.insight-grid { display: grid; gap: 12px; }
@media (min-width: 768px) { .insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .insight-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.insight-card { display: flex; gap: 12px; align-items: flex-start; padding: 14px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--border-accent); box-shadow: var(--shadow-sm); }
.insight-card.waiting { background: var(--surface-alt); border-color: var(--border); box-shadow: none; }
.insight-card.waiting .insight-text { color: var(--text-muted); }
.insight-card.compact { padding: 0; border: 0; box-shadow: none; background: transparent; }
.insight-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.insight-text { font-weight: 600; line-height: 1.45; }
.insight-based { font-size: 0.8125rem; color: var(--text-muted); margin-top: 4px; }

/* ---------- Reviews ---------- */
.review-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .review-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .review-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- Milestones ---------- */
.milestone-row { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; }
.milestone-row + .milestone-row { border-top: 1px solid var(--divider); }
.milestone-row .pbar { margin-top: 8px; }
.celebrate-badge { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto; display: grid; place-items: center; background: var(--chip-2-bg); color: var(--chip-2-text); animation: fade-in 400ms ease-out both; }
.celebrate-badge .icon { width: 32px; height: 32px; }
.celebrate-title { font-family: var(--font-accent); font-weight: 500; font-size: 1.5rem; line-height: 1.3; color: var(--heading); }
.confetti { position: fixed; inset: 0; z-index: 140; pointer-events: none; width: 100vw; height: 100vh; }
.nsv-photo { width: 100%; max-height: 180px; object-fit: cover; border-radius: 10px; margin-top: 10px; }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 768px) { .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; } }
.photo-tile { position: relative; display: block; padding: 0; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-alt); cursor: pointer; aspect-ratio: 3 / 4; }
.photo-tile img, .photo-tile .blur-wrap { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-tag { position: absolute; left: 6px; bottom: 6px; right: 6px; padding: 3px 8px; border-radius: 999px; background: var(--surface); color: var(--text); font-size: 0.8125rem; font-weight: 600; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.blur-wrap { position: relative; display: block; overflow: hidden; border: 0; padding: 0; background: none; cursor: pointer; }
.blur-wrap img { filter: blur(18px); transform: scale(1.1); transition: filter 200ms ease-out; }
.blur-wrap.revealed img { filter: none; transform: none; }
.blur-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; color: var(--text); background: color-mix(in srgb, var(--surface) 35%, transparent); }
.blur-wrap.revealed .blur-label { display: none; }
.photo-full { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; background: var(--surface-alt); }
.cmp-side { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cmp-side .cmp-img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 12px; background: var(--surface-alt); }
.cmp-slider { position: relative; width: 100%; aspect-ratio: 3 / 4; border-radius: 12px; overflow: hidden; background: var(--surface-alt); }
.cmp-slider .cmp-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cmp-before { position: absolute; inset: 0; border-right: 2px solid var(--surface); }
.vision-img { width: 160px; height: 110px; object-fit: cover; border-radius: 12px; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 4px; bottom: 4px; width: 2px; background: var(--border-accent); }
.tl-item { position: relative; display: flex; gap: 14px; padding: 8px 0; }
.tl-dot { position: relative; z-index: 1; width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--chip-2-bg); color: var(--chip-2-text); }
.tl-photo { width: 96px; height: 120px; object-fit: cover; border-radius: 10px; margin-top: 6px; }

/* ---------- Journey ---------- */
.reason-input { font-family: var(--font-accent); font-size: 1.375rem; font-weight: 500; min-height: 64px; line-height: 1.3; }

/* ---------- Start fresh today ---------- */
.fresh-page { max-width: 720px; margin: 0 auto; }
.fresh-art { max-width: 300px; width: 70%; margin: 0 auto; aspect-ratio: 3 / 2; }
.fresh-art svg { width: 100%; height: auto; }
.fresh-actions { background: var(--bg); padding-top: 8px; }


/* ---------- Sync card (Use on more than one device) ---------- */
.sync-status { white-space: normal; line-height: 1.4; padding: 6px 12px; }
.sync-code { font-family: var(--font-body); font-weight: 700; font-size: 2.25rem; letter-spacing: 0.12em; text-align: center; color: var(--heading); margin: 8px 0; font-variant-numeric: tabular-nums; }
.sync-code-input { font-size: 1.5rem; letter-spacing: 0.15em; text-align: center; font-variant-numeric: tabular-nums; }
.sync-key { display: block; width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 0.9375rem; letter-spacing: 0.04em; padding: 12px; border-radius: var(--radius-input); border: 1px solid var(--border-accent); background: var(--surface-alt); color: var(--text); text-align: left; word-break: break-all; cursor: pointer; }
.sync-key-hidden { color: transparent; text-shadow: 0 0 10px var(--text-muted); user-select: none; }
.sync-pics { display: flex; justify-content: center; gap: 18px; margin: 12px 0; }
.sync-pic-wrap { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sync-pic { font-size: 2.5rem; line-height: 1; }

/* ---------- Touch targets (Section 9: at least 44 x 44px) ----------
   Small-looking controls keep their size but get an invisible tap area around them. */
.tooltip-btn::before { content: ""; position: absolute; inset: -8px; }
.icon-btn.sm, .btn-sm, .link-btn { position: relative; }
.icon-btn.sm::before { content: ""; position: absolute; inset: -4px; }
.btn-sm::before { content: ""; position: absolute; inset: -4px 0; }
.link-btn::before { content: ""; position: absolute; inset: -6px -4px; }

/* ---------- Update banner and registration error (Section 23.3 f, g) ---------- */
#update-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 2000; text-align: center;
  padding: calc(14px + var(--safe-top)) 14px 14px; background: var(--btn-primary-bg); color: var(--btn-primary-text); font-weight: 600;
}
#update-now-btn {
  margin-left: 10px; min-height: 44px; padding: 8px 16px; border-radius: var(--radius-btn); background: transparent;
  color: var(--btn-primary-text); border: 1.5px solid var(--btn-primary-text); font: inherit; font-weight: 600; cursor: pointer;
}
#sw-error-banner {
  display: block; width: 100%; padding: calc(12px + var(--safe-top)) 14px 12px; border: 0; text-align: center;
  background: var(--danger-bg); color: var(--danger-text); font: inherit; font-weight: 600; cursor: pointer;
}

/* ---------- Install: bottom card and iPhone steps (Section 30.22) ---------- */
.install-bottom {
  position: fixed; z-index: 45; left: 12px; right: 12px; bottom: calc(var(--bottom-nav-h) + 84px + var(--safe-bottom));
  max-width: 460px; margin: 0 auto; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14); animation: toast-in 200ms var(--ease-out-soft) both;
}
@media (min-width: 1024px) { .install-bottom { left: auto; right: 24px; bottom: 24px; margin: 0; } }
.ios-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; }
.ios-step { display: flex; align-items: center; gap: 16px; }
.ios-step-art { flex: none; width: 96px; }
.ios-step-art svg { display: block; width: 100%; height: auto; }

/* The real file input is visually hidden; its label shows the keyboard focus. */
input.sr-only:focus-visible + label { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* Long text in a stat tile wraps instead of running off the card. */
.stat-card .stat-number.long { white-space: normal; font-size: 1.0625rem; line-height: 1.35; }

/* ---------- Free demo only (these classes never appear in the paid app) ---------- */
html.is-demo .demo-hide { display: none !important; }
.demo-bar { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 8px 14px; margin: 12px 0 0; border-radius: 12px; background: var(--callout-bg); border: 1px solid var(--callout-border); color: var(--text); font-size: 0.9375rem; font-weight: 600; }
.demo-loading { text-align: center; padding: 48px 16px; color: var(--text-muted); }
@media print { .demo-bar { display: none; } }
