:root {
  /* Accent comes from the chosen palette / wallpaper (set by js/theme.js). */
  --brand-light: #16a34a;
  --brand-dark: #22c55e;
  --on-brand-light: #ffffff;
  --on-brand-dark: #0b1210;

  --bg-base: #f4f6f3;
  --card: #ffffff;
  --text: #17211b;
  --muted: #637068;
  --line: #e2e7e2;
  --brand: var(--brand-light);
  --on-brand: var(--on-brand-light);
  --burn: #ea580c;
  --burn-soft: #ffedd5;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --danger: #dc2626;
  --protein: #2563eb;
  --carbs: #d97706;
  --fat: #9333ea;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.04);
  --radius: 16px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-base: #0e1411;
    --card: #18201b;
    --text: #e8efe9;
    --muted: #93a198;
    --line: #2a352e;
    --brand: var(--brand-dark);
    --on-brand: var(--on-brand-dark);
    --burn: #fb923c;
    --burn-soft: #3b2415;
    --warn: #fbbf24;
    --warn-soft: #3a2f12;
    --danger: #f87171;
    --protein: #60a5fa;
    --carbs: #fbbf24;
    --fat: #c084fc;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg-base: #0e1411;
  --card: #18201b;
  --text: #e8efe9;
  --muted: #93a198;
  --line: #2a352e;
  --brand: var(--brand-dark);
  --on-brand: var(--on-brand-dark);
  --burn: #fb923c;
  --burn-soft: #3b2415;
  --warn: #fbbf24;
  --warn-soft: #3a2f12;
  --danger: #f87171;
  --protein: #60a5fa;
  --carbs: #fbbf24;
  --fat: #c084fc;
  --shadow: none;
  color-scheme: dark;
}

/* Derived colors: everything is tinted by the accent so the whole app feels like one theme. */
:root, :root[data-theme] {
  --bg: color-mix(in srgb, var(--brand) 6%, var(--bg-base));
  --card-tint: color-mix(in srgb, var(--brand) 2%, var(--card));
  --brand-soft: color-mix(in srgb, var(--brand) 16%, var(--card));
  --brand-text: color-mix(in srgb, var(--brand) 65%, var(--text));
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}

button, input, select, textarea { font: inherit; color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.topbar h1 { font-size: 1.5rem; margin: 0; letter-spacing: -0.02em; }

main { max-width: 680px; margin: 0 auto; padding: 4px 16px 24px; }

.view { display: flex; flex-direction: column; gap: 14px; }
.view[hidden] { display: none; }

.card {
  background: var(--card-tint);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
}
.card h2 { font-size: 1.05rem; margin: 0 0 10px; }
.card h3 { font-size: 0.95rem; margin: 14px 0 6px; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 8px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  padding: 10px 14px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--brand-soft); color: var(--brand-text); }
.btn.ghost { background: transparent; color: var(--brand); padding: 6px 8px; }
.btn.burn { background: var(--burn); color: #fff; }
.btn.danger { background: transparent; color: var(--danger); border: 1px solid var(--line); }
.btn.small { padding: 6px 10px; font-size: 0.85rem; border-radius: 10px; }
.btn.block { width: 100%; }

.icon-btn {
  border: 0;
  background: transparent;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 1rem;
  color: var(--muted);
}
.icon-btn:hover { background: var(--line); }

input[type="text"], input[type="number"], input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 16px; /* prevents iOS zoom */
}
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
label.field > span { font-weight: 600; color: var(--text); }

/* Date nav */
.datenav { display: flex; align-items: center; gap: 2px; }
.datenav .label { font-weight: 600; font-size: 0.95rem; min-width: 92px; text-align: center; }

/* Summary */
.summary { display: grid; grid-template-columns: 132px 1fr; gap: 16px; align-items: center; }
.ring { position: relative; width: 132px; height: 132px; }
.ring svg { transform: rotate(-90deg); }
.ring .center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.ring .big { font-size: 1.7rem; font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.ring .cap { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }
.ring.over .big { color: var(--danger); }

.equation { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; font-size: 0.92rem; }
.equation .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.equation .burnv { color: var(--burn); }
.equation .total { border-top: 1px solid var(--line); padding-top: 4px; font-weight: 700; }

.macros { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.macro .name { font-size: 0.78rem; color: var(--muted); display: flex; justify-content: space-between; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; border-radius: 99px; }

/* Burned */
.burn-card { border-color: color-mix(in srgb, var(--burn) 30%, var(--line)); }
.burn-card .flame { font-size: 1.6rem; }
.burn-card input { max-width: 130px; }
.chip-src { display: inline-block; font-size: 0.75rem; background: var(--burn-soft); color: var(--burn); padding: 2px 8px; border-radius: 99px; font-weight: 600; }

/* Meals */
.meal-head { display: flex; align-items: center; justify-content: space-between; }
.meal-head h2 { margin: 0; }
.meal-kcal { font-weight: 700; font-variant-numeric: tabular-nums; }
.entries { list-style: none; margin: 8px 0 0; padding: 0; }
.entry { border-top: 1px solid var(--line); padding: 8px 0; }
.entry:first-child { border-top: 0; }
.entry-main { display: flex; align-items: center; gap: 8px; }
.entry-text { flex: 1; min-width: 0; }
.entry-text .t { font-weight: 500; overflow-wrap: anywhere; }
.entry-kcal { font-variant-numeric: tabular-nums; font-weight: 600; }
.entry details summary { cursor: pointer; font-size: 0.8rem; color: var(--muted); list-style: none; }
.entry details summary::-webkit-details-marker { display: none; }

.breakdown { list-style: none; margin: 6px 0 0; padding: 0; font-size: 0.85rem; }
.breakdown li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.breakdown li.unknown { color: var(--warn); }
.breakdown .g { color: var(--muted); font-size: 0.78rem; }

.add-box { margin-top: 10px; }
.preview { margin-top: 8px; background: var(--bg); border-radius: 12px; padding: 8px 10px; }
.preview:empty { display: none; }
.preview .sum { display: flex; justify-content: space-between; font-weight: 700; border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.hint { font-size: 0.8rem; color: var(--warn); background: var(--warn-soft); padding: 6px 8px; border-radius: 8px; margin-top: 6px; }

.quick-ideas { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px; scrollbar-width: none; }
.quick-ideas::-webkit-scrollbar { display: none; }
.pill {
  flex: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 99px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}
.pill b { color: var(--brand); font-weight: 600; }
.pill.active { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.pill.active b { color: var(--on-brand); }
.pill:disabled { opacity: 0.5; }

.tips { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.tips li { background: var(--brand-soft); color: var(--brand-text); padding: 10px 12px; border-radius: 12px; font-size: 0.9rem; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--brand-soft); color: var(--brand-text);
  padding: 4px 6px 4px 10px; border-radius: 99px; font-size: 0.85rem;
}
.chip.bad { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.chip button { border: 0; background: transparent; color: inherit; cursor: pointer; padding: 0 4px; font-size: 0.9rem; }
.toggle-chip { border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 6px 12px; cursor: pointer; font-size: 0.85rem; }
.toggle-chip[aria-pressed="true"] { background: var(--danger); border-color: var(--danger); color: #fff; }

/* Recipe cards */
.recipe { display: flex; flex-direction: column; gap: 6px; }
.recipe-top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.recipe-name { font-weight: 700; }
.recipe-kcal { font-weight: 700; color: var(--brand); white-space: nowrap; }
.recipe .ingr { font-size: 0.85rem; color: var(--muted); }
.reasons { display: flex; flex-wrap: wrap; gap: 4px; }
.reason { font-size: 0.75rem; background: var(--brand-soft); color: var(--brand-text); padding: 2px 8px; border-radius: 99px; }
.macro-line { font-size: 0.78rem; color: var(--muted); display: flex; gap: 10px; }
.macro-line .p { color: var(--protein); }
.macro-line .c { color: var(--carbs); }
.macro-line .f { color: var(--fat); }
.recipe-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.recipe-actions .spacer { flex: 1; }

/* Plan */
.weeknav { display: flex; align-items: center; justify-content: space-between; }
.day-card .day-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.day-card .day-head h2 { margin: 0; }
.day-card.today { border-color: var(--brand); }
.slot { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); cursor: pointer; }
.slot:first-of-type { border-top: 0; }
.slot .slot-name { width: 76px; flex: none; font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.slot .slot-meal { flex: 1; min-width: 0; }
.slot .slot-meal.empty { color: var(--muted); }
.slot .slot-kcal { font-variant-numeric: tabular-nums; font-size: 0.9rem; color: var(--muted); }
.day-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.day-total.over { color: var(--danger); }
.day-actions { display: flex; gap: 6px; margin-top: 8px; }

.shopping { list-style: none; padding: 0; margin: 0; }
.shopping li { display: flex; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.shopping li:first-child { border-top: 0; }
.shopping input { width: 20px; height: 20px; accent-color: var(--brand); }
.shopping li.done span { text-decoration: line-through; color: var(--muted); }

/* Sheet */
.sheet {
  border: 0;
  padding: 0;
  width: min(640px, 100%);
  max-width: 100%;
  max-height: 88vh;
  margin: auto auto 0;
  border-radius: 20px 20px 0 0;
  background: var(--card);
  color: var(--text);
}
@media (min-width: 700px) { .sheet { margin: auto; border-radius: 20px; } }
.sheet::backdrop { background: rgba(0, 0, 0, 0.4); }
.sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 6px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.sheet-head h2 { margin: 0; font-size: 1.1rem; }
#sheet-body { padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.pick { text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 12px; cursor: pointer; width: 100%; }
.pick .row { justify-content: space-between; }

/* Tab bar */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 10px; font-size: 0.72rem; color: var(--muted); font-weight: 600;
}
.tab-icon { font-size: 1.3rem; filter: grayscale(1); opacity: 0.7; }
.tab.active { color: var(--brand); }
.tab.active .tab-icon { filter: none; opacity: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 12px; font-size: 0.9rem; font-weight: 500;
  opacity: 0; pointer-events: none; transition: all 0.2s ease; z-index: 50;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.steps { margin: 6px 0 0; padding-left: 20px; font-size: 0.9rem; }
.steps li { margin: 4px 0; }
code, .code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; background: var(--bg); padding: 2px 6px; border-radius: 6px; overflow-wrap: anywhere; }

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

@media (max-width: 380px) {
  .summary { grid-template-columns: 1fr; justify-items: center; }
  .equation { width: 100%; }
}

/* ---------- Shared additions ---------- */
.gear { font-size: 1.15rem; }
.gear.active { background: var(--brand-soft); }
.topbar > .row { gap: 2px; }

.segmented { display: flex; background: var(--card-tint); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 8px 6px; border-radius: 9px; cursor: pointer; font-weight: 600; font-size: 0.88rem; color: var(--muted); }
.segmented button[aria-selected="true"] { background: var(--brand); color: var(--on-brand); }
.segmented.small button { font-size: 0.8rem; padding: 6px; }

.toggle-chip.brand[aria-pressed="true"] { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.bar.big { height: 10px; margin-top: 8px; }

.switch-row { display: flex; gap: 10px; align-items: center; margin-top: 10px; font-size: 0.92rem; }
.switch-row input { width: 20px; height: 20px; accent-color: var(--brand); }

/* ---------- Food: deficit ---------- */
.verdict { margin-top: 8px; font-weight: 700; font-size: 1.05rem; }
.verdict.ok { color: var(--brand); }
.verdict.warn { color: var(--warn); }
.verdict.bad { color: var(--danger); }
.verdict.none { color: var(--muted); font-weight: 600; }
.week-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 14px 0 6px; }
.day-dot { border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; gap: 2px; cursor: pointer; color: var(--muted); }
.day-dot span { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--line); font-weight: 700; color: var(--muted); }
.day-dot.ok span { background: var(--brand); color: var(--on-brand); }
.day-dot.bad span { background: color-mix(in srgb, var(--danger) 18%, var(--card)); color: var(--danger); }
.day-dot.sel span { outline: 2px solid var(--text); outline-offset: 2px; }
.day-dot small { font-size: 0.7rem; }

.goal-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 8px; }
.goal-summary div, .stats div { background: var(--brand-soft); border-radius: 12px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; }
.goal-summary b, .stats b { font-size: 1.3rem; color: var(--brand-text); font-variant-numeric: tabular-nums; }
.goal-summary span, .stats span { font-size: 0.72rem; color: var(--muted); }

/* ---------- Timetable ---------- */
.day-chips { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.day-chips .pill { padding: 8px 0; text-align: center; }
.day-chips .pill.is-today:not(.active) { border-color: var(--brand); color: var(--brand-text); font-weight: 700; }
.tt-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.tt-event {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--ev) 10%, var(--card));
  border-left: 5px solid var(--ev); border-radius: 12px; padding: 10px 12px;
}
.tt-time { font-variant-numeric: tabular-nums; font-size: 0.85rem; font-weight: 600; min-width: 44px; line-height: 1.3; }
.tt-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.badge { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.04em; }
.badge.now { background: var(--brand); color: var(--on-brand); }
.badge.next { background: var(--brand-soft); color: var(--brand-text); }
.badge.done { color: var(--muted); }
.now-next { display: flex; flex-direction: column; gap: 6px; border-color: var(--brand); }
.today-card { border-color: var(--brand); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch[aria-pressed="true"] { border-color: var(--text); }
input[type="time"] { width: 100%; border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 10px 12px; font-size: 16px; }

/* ---------- Mandarin ---------- */
.streak { font-size: 1.3rem; font-weight: 800; }
.goal-dots { display: flex; gap: 6px; margin-top: 10px; }
.goal-dots i { flex: 1; height: 8px; border-radius: 99px; background: var(--line); }
.goal-dots i.on { background: var(--brand); }
.hanzi-input { font-size: 1.6rem !important; text-align: center; }
.fc-list { list-style: none; margin: 8px 0 0; padding: 0; }
.fc-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.fc-row:first-child { border-top: 0; }
.fc-hanzi { font-size: 1.6rem; min-width: 52px; text-align: center; }
.fc-pinyin { color: var(--brand-text); font-weight: 600; }
.fc-pinyin.big { font-size: 1.3rem; display: flex; align-items: center; justify-content: center; gap: 4px; }
.box-dots { display: flex; gap: 2px; }
.box-dots i { width: 5px; height: 12px; border-radius: 2px; background: var(--line); }
.box-dots i.on { background: var(--brand); }
.fc-card { background: var(--bg); border-radius: 16px; padding: 18px 12px; text-align: center; min-height: 120px; display: flex; flex-direction: column; justify-content: center; gap: 6px; }
.fc-big { font-size: 3.4rem; line-height: 1.1; }
.fc-meaning { font-size: 1.2rem; font-weight: 600; }
.fc-answer { border-top: 1px dashed var(--line); padding-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.pad-wrap { display: flex; flex-direction: column; gap: 4px; align-items: center; }
.pad {
  position: relative; width: min(240px, 70vw); aspect-ratio: 1; border-radius: 12px; border: 2px solid color-mix(in srgb, var(--danger) 55%, var(--line));
  background:
    linear-gradient(to right, transparent calc(50% - 0.5px), color-mix(in srgb, var(--danger) 30%, transparent) calc(50% - 0.5px), color-mix(in srgb, var(--danger) 30%, transparent) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    linear-gradient(to bottom, transparent calc(50% - 0.5px), color-mix(in srgb, var(--danger) 30%, transparent) calc(50% - 0.5px), color-mix(in srgb, var(--danger) 30%, transparent) calc(50% + 0.5px), transparent calc(50% + 0.5px)),
    var(--card);
  touch-action: none;
}
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.pad-ghost { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; white-space: nowrap; line-height: 1; color: var(--text); opacity: 0; pointer-events: none; transition: opacity 0.2s; }
.pad-ghost.show { opacity: 0.12; }
.pad-wrap .row { width: min(240px, 70vw); }
.pad-wrap .muted { white-space: nowrap; }

/* ---------- Focus ---------- */
.hero-title { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; margin-bottom: 8px; color: var(--brand-text); }
.timer-ring { position: relative; width: 210px; height: 210px; margin: 8px auto; }
.timer-ring svg { width: 100%; height: 100%; }
.timer-ring #timer-ring { transition: stroke-dashoffset 0.5s linear; }
.timer-display { position: absolute; inset: 0; display: grid; place-items: center; font-size: 3rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.03em; }
.checklist { list-style: none; margin: 8px 0; padding: 0; }
.checklist li { display: flex; align-items: center; gap: 6px; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist label { flex: 1; display: flex; gap: 10px; align-items: center; padding: 9px 0; cursor: pointer; }
.checklist input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.checklist li.done span { text-decoration: line-through; color: var(--muted); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

/* ---------- Settings: themes ---------- */
.palettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.palette { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font-size: 0.82rem; font-weight: 600; }
.palette .dot { width: 30px; height: 30px; border-radius: 50%; }
.palette[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); }

/* Wallpaper behind the app */
body.has-wallpaper::before { content: ""; position: fixed; inset: 0; z-index: -2; background: var(--wallpaper) center / cover no-repeat; }
body.has-wallpaper::after { content: ""; position: fixed; inset: 0; z-index: -1; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
body.has-wallpaper { background: transparent; }
body.has-wallpaper .topbar { background: color-mix(in srgb, var(--bg) 60%, transparent); }

/* Week A / Week B */
.ab-badge { background: var(--brand); color: var(--on-brand); font-weight: 700; font-size: 0.8rem; padding: 4px 10px; border-radius: 99px; cursor: pointer; }
.ab-tag { font-size: 0.7rem; font-weight: 700; background: var(--brand-soft); color: var(--brand-text); padding: 1px 6px; border-radius: 6px; vertical-align: middle; }

/* After-sports evening plan & snack attack */
.evening-card { border-color: color-mix(in srgb, var(--burn) 35%, var(--line)); }
.evening-card.live { border-width: 2px; background: color-mix(in srgb, var(--burn) 6%, var(--card)); }
.sa-step { background: var(--bg); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.sa-step.done { opacity: 0.7; }
.sa-step .stack { width: 100%; }

/* Planned meals & ideas on the Today overview */
.card.has-plan { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.planned-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 10px 12px; border-radius: 12px; border: 1.5px dashed color-mix(in srgb, var(--brand) 55%, var(--line)); background: var(--brand-soft); }
.planned-row .small { overflow-wrap: anywhere; }
.planned-tag { font-size: 0.72rem; font-weight: 700; color: var(--brand-text); text-transform: uppercase; letter-spacing: 0.04em; }
.idea-row { display: flex; align-items: center; gap: 4px; margin-top: 8px; padding: 6px 4px 0; border-top: 1px dashed var(--line); font-size: 0.92rem; }
.idea-row .btn.ghost { padding: 6px; }
.plan-forecast { margin-top: 12px; padding: 8px 10px; border-radius: 10px; background: var(--brand-soft); color: var(--brand-text); font-size: 0.88rem; }
