/* ============================================================
   FUEL — Design system
   ============================================================ */
:root {
  --bg: #0a0a0a;
  --surface: #141414;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --border: #2a2a2a;
  --border-strong: #3a3a3a;
  --text: #f5f5f0;
  --text-dim: #a0a098;
  --text-mute: #6e6e68;
  --accent: #c5f82a;
  --accent-dim: #8aaa1f;
  --accent-2: #ff6b35;
  --success: #4ade80;
  --warning: #fbbf24;
  --danger: #ef4444;
  --info: #60a5fa;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-lg: 22px;
  --safe-top: env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);
  --focus-ring: 0 0 0 3px rgba(197,248,42,0.45);
}

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

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: "Geist", -apple-system, system-ui, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background-image:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(197,248,42,0.06), transparent),
    radial-gradient(ellipse 60% 40% at 90% 100%, rgba(255,107,53,0.04), transparent);
  background-attachment: fixed;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}
button { cursor: pointer; }
input, textarea, select { -webkit-appearance: none; appearance: none; }

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.option:focus-visible,
.pill:focus-visible,
.tab-btn:focus-visible,
.day-chip:focus-visible {
  box-shadow: var(--focus-ring);
  border-radius: 8px;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

/* ============================================================
   Typography utilities
   ============================================================ */
.serif { font-family: "Fraunces", Georgia, serif; font-variation-settings: "opsz" 144, "SOFT" 50, "WONK" 0; letter-spacing: -0.02em; }
.mono { font-family: "Geist Mono", ui-monospace, monospace; }
.uppercase { text-transform: uppercase; letter-spacing: 0.12em; }
.tabular { font-variant-numeric: tabular-nums; }

/* ============================================================
   App shell
   ============================================================ */
#app {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
  padding-bottom: calc(80px + var(--safe-bottom));
}

.screen { display: none; animation: fadeIn .4s ease both; }
.screen.active { display: block; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

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

/* ============================================================
   Top header
   ============================================================ */
.top-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: calc(var(--safe-top) + 16px) 20px 14px;
  background: linear-gradient(to bottom, var(--bg) 60%, rgba(10,10,10,0));
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 700, "SOFT" 0, "WONK" 1;
  font-size: 28px;
  letter-spacing: -0.04em;
  line-height: 1;
}
.brand em {
  color: var(--accent);
  font-style: italic;
  font-variation-settings: "opsz" 144, "wght" 600, "SOFT" 100, "WONK" 1;
}
.eyebrow {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-mute);
}
.top-actions { display: flex; gap: 6px; }
.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn:active { transform: scale(0.95); }

/* ============================================================
   Onboarding wizard
   ============================================================ */
.wizard {
  padding: 0 20px;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.wizard-progress {
  display: flex;
  gap: 4px;
  padding: calc(var(--safe-top) + 20px) 0 12px;
}
.wizard-progress .seg {
  flex: 1;
  height: 3px;
  background: var(--surface-2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}
.wizard-progress .seg.done { background: var(--accent); }
.wizard-progress .seg.current::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent);
  width: 50%;
  animation: pulseBar 1.8s ease-in-out infinite;
}
@keyframes pulseBar {
  0%, 100% { transform: translateX(-100%); }
  50% { transform: translateX(100%); }
}

.wizard-step {
  flex: 1;
  display: none;
  flex-direction: column;
  padding: 24px 0 40px;
  animation: slideUp .35s cubic-bezier(.2,.7,.2,1) both;
}
.wizard-step.active { display: flex; }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: none; }
}

.welcome-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 0;
}
.welcome-title {
  font-size: clamp(48px, 12vw, 72px);
  line-height: 0.92;
  letter-spacing: -0.04em;
  margin-bottom: 20px;
}
.welcome-title em {
  color: var(--accent);
  font-style: italic;
}
.welcome-sub {
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1.55;
  max-width: 34ch;
}

.step-num {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--text-mute);
  text-transform: uppercase;
  margin-bottom: 16px;
}
.step-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500, "SOFT" 30;
  font-size: clamp(34px, 8vw, 48px);
  line-height: 0.95;
  letter-spacing: -0.035em;
  margin-bottom: 12px;
}
.step-title em {
  color: var(--accent);
  font-style: italic;
  font-variation-settings: "opsz" 144, "wght" 400, "SOFT" 100, "WONK" 1;
}
.step-hint {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.5;
  margin-bottom: 28px;
  max-width: 36ch;
}

.wizard-cta {
  position: sticky;
  bottom: 0;
  padding: 16px 0 calc(20px + var(--safe-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  display: flex;
  gap: 10px;
  margin-top: auto;
}

.info-note {
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.5;
}

/* ============================================================
   Form controls
   ============================================================ */
.field { margin-bottom: 18px; }
.field-label {
  display: block;
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 8px;
}

.input,
.textarea,
.select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 16px;
  color: var(--text);
  transition: border-color .2s, background .2s;
}
.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--accent);
  background: var(--surface-2);
}
.textarea {
  min-height: 100px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}
.select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'><path fill='%23a0a098' d='M1 1l5 5 5-5'/></svg>");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 44px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field-inline {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.field-inline .input { flex: 1; }
.input-suffix { position: relative; }
.input-suffix .suffix {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-mute);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
  pointer-events: none;
}

/* Option cards */
.option-list { display: flex; flex-direction: column; gap: 10px; }
.option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .18s;
  text-align: left;
  width: 100%;
}
.option:hover { border-color: var(--border-strong); }
.option.selected,
.option[aria-checked="true"] {
  background: linear-gradient(135deg, rgba(197,248,42,0.08), rgba(197,248,42,0.02));
  border-color: var(--accent);
}
.option-emoji { font-size: 26px; line-height: 1; }
.option-body { flex: 1; display: flex; flex-direction: column; }
.option-title { font-weight: 600; font-size: 16px; margin-bottom: 2px; display: block; }
.option-desc { font-size: 13px; color: var(--text-dim); line-height: 1.4; display: block; }
.option-check {
  width: 20px; height: 20px; border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: all .18s;
}
.option.selected .option-check,
.option[aria-checked="true"] .option-check {
  background: var(--accent);
  border-color: var(--accent);
}
.option.selected .option-check::after,
.option[aria-checked="true"] .option-check::after {
  content: '';
  width: 6px; height: 10px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}

/* Pills */
.pill-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 10px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-dim);
  transition: all .15s;
}
.pill.selected,
.pill[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 22px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all .15s;
  border: 1px solid transparent;
  position: relative;
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--bg); flex: 1; }
.btn-primary:hover { background: #d4ff3d; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: rgba(239,68,68,0.1); }
.btn-sm { padding: 10px 14px; font-size: 13px; }
.btn-arrow::after {
  content: '→';
  font-family: "Geist", sans-serif;
  font-weight: 400;
}
.btn.full { width: 100%; }
.mt-10 { margin-top: 10px !important; }
.mt-14 { margin-top: 14px !important; }
.mt-24 { margin-top: 24px !important; }

/* ============================================================
   Bottom nav
   ============================================================ */
.tab-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 100;
  padding: 6px 8px calc(6px + var(--safe-bottom));
  background: rgba(10,10,10,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  display: none;
}
.tab-bar.active { display: flex; }
.tab-bar-inner {
  display: flex;
  justify-content: space-around;
  max-width: 520px;
  margin: 0 auto;
  width: 100%;
}
.tab-btn {
  flex: 1;
  padding: 10px 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-mute);
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: "Geist Mono", monospace;
  transition: color .15s;
  background: none;
  border: none;
}
.tab-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.tab-btn.active,
.tab-btn[aria-selected="true"] { color: var(--accent); }
.tab-btn.active svg { stroke-width: 1.8; }

/* ============================================================
   Sections & cards
   ============================================================ */
.section { padding: 0 20px 24px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}
.section-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.section-action {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(197,248,42,0.08);
  border: 1px solid rgba(197,248,42,0.2);
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.section-action:hover { background: rgba(197,248,42,0.16); }
.section-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.day-summary {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.card-soft {
  background: linear-gradient(135deg, rgba(197,248,42,0.04), transparent);
  border-color: rgba(197,248,42,0.2);
}

/* ============================================================
   Progress ring & calorie tracking
   ============================================================ */
.progress-card {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 12px;
}
.progress-ring {
  width: 130px; height: 130px;
  position: relative;
}
.progress-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.progress-ring .ring-bg {
  fill: none; stroke: var(--surface-3);
  stroke-width: 10;
}
.progress-ring .ring-fg {
  fill: none; stroke: var(--accent);
  stroke-width: 10;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  stroke-linecap: round;
  transition: stroke-dashoffset .6s ease;
}
.progress-ring.over .ring-fg { stroke: var(--warning); }
.progress-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.progress-current {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.progress-target {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-top: 4px;
}
.progress-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.progress-bar-row {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 8px;
  align-items: center;
}
.pb-label {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  font-weight: 700;
}
.pb-track {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}
.pb-fill {
  height: 100%;
  background: linear-gradient(to right, var(--accent-dim), var(--accent));
  border-radius: 3px;
  transition: width .5s ease;
}
.pb-fill.over { background: var(--warning); }
.pb-val {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
}

/* ============================================================
   Macros (small tiles)
   ============================================================ */
.macro-hero {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.macro-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.macro-tile.main { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.macro-tile.main .macro-label { color: rgba(10,10,10,0.7); }
.macro-tile .macro-label {
  font-family: "Geist Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 6px;
}
.macro-tile .macro-value {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 26px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.macro-tile .macro-unit {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--text-dim);
  margin-left: 2px;
}
.macro-tile.main .macro-unit { color: rgba(10,10,10,0.6); }

/* ============================================================
   Plan view — day strip
   ============================================================ */
.day-strip {
  display: flex;
  gap: 8px;
  padding: 0 20px 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.day-strip::-webkit-scrollbar { display: none; }
.day-chip {
  flex-shrink: 0;
  scroll-snap-align: start;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-align: center;
  min-width: 56px;
  transition: all .15s;
}
.day-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
}
.day-chip.today { border-color: var(--accent); }
.day-chip .day-dow {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-mute);
  margin-bottom: 4px;
}
.day-chip.active .day-dow { color: rgba(10,10,10,0.7); }
.day-chip .day-num {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 600;
  font-size: 18px;
  line-height: 1;
}

/* Meal cards */
.meal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  transition: border-color .15s;
}
.meal-card.done {
  border-color: rgba(74,222,128,0.4);
  background: linear-gradient(135deg, rgba(74,222,128,0.04), transparent);
}
.meal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  cursor: pointer;
  gap: 12px;
}
.meal-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.meal-time-tag {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 5px 9px;
  background: rgba(197,248,42,0.1);
  border-radius: 6px;
  flex-shrink: 0;
}
.meal-card.done .meal-time-tag {
  color: var(--success);
  background: rgba(74,222,128,0.1);
}
.meal-title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meal-kcal {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--text);
  flex-shrink: 0;
}
.meal-kcal-unit {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.1em;
  margin-left: 3px;
  text-transform: uppercase;
}
.meal-body {
  display: none;
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
  margin-top: 4px;
  animation: fadeIn .25s ease;
}
.meal-card.open .meal-body { display: block; }
.meal-card.open .chevron { transform: rotate(90deg); }
.chevron {
  width: 16px; height: 16px;
  color: var(--text-mute);
  transition: transform .2s;
  flex-shrink: 0;
}

.meal-macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.meal-macro {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}
.meal-macro-val {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 18px;
  line-height: 1;
}
.meal-macro-lbl {
  font-family: "Geist Mono", monospace;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 4px;
}

.meal-section-head {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 14px 0 8px;
}
.meal-section-head:first-child { margin-top: 0; }
.meal-meta-row {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 14px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.meal-meta-row span { display: inline-flex; align-items: center; gap: 4px; }

.ingredient-list, .step-list { list-style: none; padding: 0; }
.ingredient-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 14px;
  gap: 12px;
}
.ingredient-list li:last-child { border-bottom: none; }
.ingredient-name { flex: 1; }
.ingredient-qty {
  font-family: "Geist Mono", monospace;
  color: var(--text-dim);
  font-size: 12px;
  text-align: right;
  flex-shrink: 0;
}
.step-list li {
  display: flex;
  gap: 12px;
  padding: 8px 0;
  font-size: 14px;
  line-height: 1.5;
}
.step-list li::before {
  content: counter(step);
  counter-increment: step;
  flex-shrink: 0;
  width: 22px; height: 22px;
  background: var(--surface-3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}
.step-list { counter-reset: step; }

.meal-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.meal-actions .btn {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 12px;
  letter-spacing: 0.02em;
}
.meal-actions .btn.done-active {
  background: var(--success);
  border-color: var(--success);
  color: var(--bg);
}

/* ============================================================
   Shopping list (editable)
   ============================================================ */
.shopping-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.shopping-actions .btn { flex: 1; min-width: 100px; }

.cat-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 10px;
}
.cat-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.cat-name {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.cat-count {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.sh-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.sh-item:last-child { border-bottom: none; }
.sh-check {
  width: 22px; height: 22px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  flex-shrink: 0;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  cursor: pointer;
}
.sh-item.checked .sh-check {
  background: var(--accent);
  border-color: var(--accent);
}
.sh-item.checked .sh-check::after {
  content: '';
  width: 5px; height: 9px;
  border: solid var(--bg);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translateY(-1px);
}
.sh-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}
.sh-name {
  font-size: 14px;
  line-height: 1.3;
}
.sh-item.checked .sh-name {
  text-decoration: line-through;
  color: var(--text-mute);
}
.sh-qty {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
}
.sh-edit {
  flex-shrink: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-mute);
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.sh-edit:hover { background: var(--surface-2); color: var(--text); }

.budget-hero {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.budget-hero .budget-label {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.budget-hero .budget-val {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 32px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.budget-hero .budget-val small {
  font-size: 14px;
  color: var(--text-dim);
}

/* ============================================================
   Chat
   ============================================================ */
.chat-container {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 200px);
  padding: 0 20px;
}
.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 120px;
}
.msg {
  max-width: 88%;
  padding: 12px 16px;
  border-radius: 18px;
  line-height: 1.5;
  font-size: 14.5px;
  animation: msgIn .3s cubic-bezier(.2,.7,.2,1) both;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--bg);
  border-bottom-right-radius: 4px;
}
.msg.assistant {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center;
  background: transparent;
  color: var(--text-mute);
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.msg p { margin-bottom: 8px; }
.msg p:last-child { margin-bottom: 0; }
.msg ul, .msg ol { margin: 8px 0 8px 22px; }
.msg li { margin-bottom: 4px; }
.msg code {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}
.msg pre {
  background: rgba(0,0,0,0.4);
  padding: 10px;
  border-radius: 8px;
  overflow-x: auto;
  font-size: 12px;
  margin: 8px 0;
}
.msg.assistant strong { color: var(--accent); }
.msg-action-summary {
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(197,248,42,0.08);
  border: 1px dashed rgba(197,248,42,0.3);
  border-radius: 8px;
  font-size: 12px;
  font-family: "Geist Mono", monospace;
  color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.msg-action-summary::before { content: "⚡"; font-family: initial; }

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.typing span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-mute);
  animation: bounce 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-input-bar {
  position: fixed;
  bottom: calc(76px + var(--safe-bottom));
  left: 0; right: 0;
  padding: 10px 20px;
  background: linear-gradient(to top, var(--bg) 70%, transparent);
  z-index: 90;
}
.chat-input-bar-inner {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  gap: 8px;
  align-items: flex-end;
}
.chat-input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 12px 18px;
  font-size: 15px;
  resize: none;
  max-height: 140px;
  line-height: 1.4;
  min-height: 44px;
  overflow-y: auto;
}
.chat-input:focus { border-color: var(--accent); }
.chat-send,
.chat-attach {
  width: 44px; height: 44px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
}
.chat-attach {
  background: var(--danger);
  color: white;
  font-size: 16px;
}
.chat-send:disabled { opacity: 0.3; }
.chat-send svg { width: 18px; height: 18px; stroke: var(--bg); fill: none; stroke-width: 2.2; }

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 20px 14px;
  scrollbar-width: none;
}
.chip-row::-webkit-scrollbar { display: none; }
.suggest-chip {
  flex-shrink: 0;
  padding: 9px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-dim);
  white-space: nowrap;
}
.suggest-chip:hover { color: var(--text); border-color: var(--border-strong); }

/* ============================================================
   Profile / Stats
   ============================================================ */
.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.stat-row .lbl { color: var(--text-dim); font-size: 14px; }
.stat-row .val { font-family: "Geist Mono", monospace; font-size: 14px; }

.weight-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  margin-bottom: 16px;
}
.weight-input-row .input { flex: 1; }
.weight-unit {
  color: var(--text-dim);
  font-family: "Geist Mono", monospace;
  font-size: 13px;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 120px;
  padding: 16px 0 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.bar {
  flex: 1;
  background: linear-gradient(to top, var(--accent), var(--accent-dim));
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  position: relative;
  transition: height .3s;
}
.bar:hover { opacity: 0.8; }
.chart-caption {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
  text-align: center;
}
.weekday-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-mute);
}

.inventory-actions { margin-bottom: 10px; display: flex; gap: 8px; }
.data-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.data-actions .btn { flex: 1; min-width: 130px; }

.learned-prefs {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}
.pref-item {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}
.pref-item:last-child { border-bottom: none; }
.pref-remove {
  color: var(--text-mute);
  font-size: 16px;
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
}
.pref-remove:hover { background: var(--surface-2); color: var(--danger); }

.scanned-prod {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.scanned-prod:last-child { border-bottom: none; }
.scanned-prod-img {
  width: 44px; height: 44px;
  border-radius: 8px;
  background: var(--surface-3);
  object-fit: cover;
}
.scanned-prod-body { flex: 1; min-width: 0; }
.scanned-prod-name { font-size: 13px; font-weight: 500; }
.scanned-prod-macros {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ============================================================
   Empty / Loading / Skeleton
   ============================================================ */
.empty { padding: 60px 30px; text-align: center; }
.empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 24px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.empty-text {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.5;
}

.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
.skeleton-meal {
  height: 86px;
  margin-bottom: 12px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   Sheets
   ============================================================ */
.sheet-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: none;
  animation: fadeIn .2s;
}
.sheet-backdrop.active { display: block; }
.sheet {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 201;
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  max-height: 88vh;
  overflow-y: auto;
  display: none;
  max-width: 520px;
  margin: 0 auto;
  animation: sheetUp .3s cubic-bezier(.2,.7,.2,1);
  border: 1px solid var(--border);
  border-bottom: none;
}
.sheet.active { display: block; }
.sheet.sheet-full { max-height: 96vh; }
@keyframes sheetUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--border-strong);
  border-radius: 2px;
  margin: 0 auto 18px;
}
.sheet-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  margin-bottom: 16px;
}
.sheet-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}
.sheet-actions .btn { flex: 1; }

.confirm-msg {
  color: var(--text-dim);
  font-size: 14.5px;
  line-height: 1.5;
  margin-bottom: 6px;
}

/* ============================================================
   Scanner
   ============================================================ */
.scanner-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 14px;
}
.scanner-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.scanner-frame {
  width: 78%;
  aspect-ratio: 2.6 / 1;
  border: 2px solid var(--accent);
  border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
  position: relative;
  overflow: hidden;
}
.scanner-frame::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  animation: scanLine 2s linear infinite;
}
@keyframes scanLine {
  0% { transform: translateY(0); }
  50% { transform: translateY(calc(100% - 2px)); }
  100% { transform: translateY(0); }
}
.scanner-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.8);
}
.scanner-result-card {
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  gap: 12px;
}
.scanner-result-img {
  width: 60px; height: 60px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--surface-3);
}
.scanner-result-body { flex: 1; }
.scanner-result-name {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 2px;
}
.scanner-result-meta {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
}
.scanner-result-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.scanner-result-actions .btn {
  font-size: 11px;
  padding: 6px 10px;
}

/* ============================================================
   Toast
   ============================================================ */
#toast-region {
  position: fixed;
  bottom: calc(100px + var(--safe-bottom));
  left: 20px; right: 20px;
  max-width: 480px;
  margin: 0 auto;
  z-index: 300;
  pointer-events: none;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
  margin-bottom: 8px;
  animation: toastIn .3s, toastOut .3s 2.7s forwards;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.info { border-color: var(--info); }
.toast-icon {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.toast.success .toast-icon { background: var(--success); }
.toast.error .toast-icon { background: var(--danger); }
.toast.info .toast-icon { background: var(--info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(10px); }
}

/* ============================================================
   API banner
   ============================================================ */
.api-banner {
  margin: 0 20px 16px;
  padding: 14px 16px;
  background: rgba(255,107,53,0.08);
  border: 1px solid rgba(255,107,53,0.3);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--accent-2);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.api-banner button {
  background: rgba(255,107,53,0.18);
  color: var(--accent-2);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================================
   Quick actions (J'ai mangé + Photo)
   ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.qa-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
}
.qa-btn:hover { background: var(--surface-2); border-color: var(--accent); }
.qa-btn:active { transform: scale(0.97); }
.qa-btn span:first-child { font-size: 20px; }

/* ============================================================
   Extras row (water + workouts) on plan
   ============================================================ */
.extras-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}
.extra-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.extra-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.extra-label {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.extra-val {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 20px;
  letter-spacing: -0.02em;
  color: var(--text);
}
.extra-val .extra-unit {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  color: var(--text-dim);
}

.water-glasses {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}
.glass {
  width: 18px; height: 24px;
  border: 1.5px solid var(--border-strong);
  border-radius: 2px 2px 6px 6px;
  background: transparent;
  transition: background .15s, border-color .15s;
}
.glass.filled {
  background: linear-gradient(to top, var(--info), rgba(96,165,250,0.5));
  border-color: var(--info);
}
.water-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.water-actions .btn { flex: 1; }
.water-input-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.water-input-row .input {
  flex: 1;
  padding: 8px 10px;
  font-size: 13px;
}

.workout-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
  min-height: 24px;
}
.workout-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--border);
}
.workout-item:last-child { border-bottom: none; }
.workout-item span:first-child { flex: 1; }
.workout-rm {
  background: none;
  color: var(--text-mute);
  font-size: 14px;
  padding: 0 4px;
}
.workout-rm:hover { color: var(--danger); }

/* ============================================================
   Portion slider on meal cards
   ============================================================ */
.portion-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}
.portion-label {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.portion-buttons {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: flex-end;
}
.portion-btn {
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--text-dim);
  transition: all .15s;
}
.portion-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}

/* ============================================================
   Off-plan meal card
   ============================================================ */
.meal-card.off-plan {
  border-color: rgba(255,107,53,0.3);
  background: linear-gradient(135deg, rgba(255,107,53,0.04), transparent);
}

/* ============================================================
   Toast undo
   ============================================================ */
.toast.undo {
  border-color: var(--info);
  display: flex;
  align-items: center;
  gap: 12px;
}
.toast .toast-msg { flex: 1; }
.toast-undo {
  background: rgba(96,165,250,0.15);
  color: var(--info);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  padding: 6px 12px;
  border-radius: 999px;
  flex-shrink: 0;
}
.toast-undo:hover { background: rgba(96,165,250,0.25); }

/* ============================================================
   Chat photo button
   ============================================================ */
.chat-photo {
  width: 44px; height: 44px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text);
  font-size: 18px;
  transition: all .15s;
}
.chat-photo:hover { background: var(--surface-2); border-color: var(--accent); }

/* ============================================================
   Photo upload (analysis sheet)
   ============================================================ */
.photo-upload {
  margin-bottom: 14px;
}
.photo-upload-label {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--surface-2);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-dim);
  font-size: 14px;
  transition: all .15s;
}
.photo-upload-label:hover {
  border-color: var(--accent);
  background: rgba(197,248,42,0.04);
  color: var(--text);
}
.photo-upload-label input { display: none; }
.photo-preview {
  margin-top: 10px;
}
.photo-preview img {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: var(--radius);
}

/* ============================================================
   Quick eat / photo success card
   ============================================================ */
.qe-success {
  background: var(--surface-2);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 14px;
}
.qe-success-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 17px;
  margin-bottom: 4px;
}
.qe-success-macros {
  font-family: "Geist Mono", monospace;
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 6px;
}
.qe-success-notes {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ============================================================
   OFF name search results
   ============================================================ */
.search-results {
  margin-top: 8px;
  max-height: 320px;
  overflow-y: auto;
}
.search-result-row {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  width: 100%;
  text-align: left;
  align-items: center;
  transition: border-color .15s;
}
.search-result-row:hover { border-color: var(--accent); }
.search-result-row img,
.search-noimg {
  width: 44px; height: 44px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--surface-3);
  flex-shrink: 0;
}
.search-body { flex: 1; min-width: 0; }
.search-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.search-name small {
  color: var(--text-dim);
  font-weight: 400;
}
.search-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* ============================================================
   Weekly review
   ============================================================ */
.weekly-review-item {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.wr-head {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.wr-body {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.wr-body p { margin-bottom: 6px; }
.wr-body p:last-child { margin-bottom: 0; }
.wr-body ul, .wr-body ol { margin: 4px 0 4px 22px; font-size: 13px; }

/* Notification checkboxes */
#notifs-panel input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ============================================================
   API test result
   ============================================================ */
.api-test-result {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.api-test-result:empty { display: none; }
.api-test-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 12.5px;
  border-left: 3px solid var(--text-mute);
}
.api-test-row.ok { border-left-color: var(--success); color: var(--text); }
.api-test-row.ko { border-left-color: var(--danger); color: var(--text); }
.api-test-row .spinner {
  width: 14px; height: 14px;
  border-width: 2px;
}
.api-test-row code {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  background: rgba(255,255,255,0.08);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ============================================================
   Mon frigo
   ============================================================ */
.fridge-summary {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 12px;
}
.fridge-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.fridge-actions .btn { flex: 1; min-width: 110px; }
.fridge-filters {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 12px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.fridge-filters::-webkit-scrollbar { display: none; }
.fridge-filter {
  flex-shrink: 0;
  padding: 6px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  transition: all .15s;
}
.fridge-filter.active {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
  font-weight: 600;
}
.fridge-cat {
  margin-bottom: 16px;
}
.fridge-cat-head {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 16px;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.fridge-cat-head span {
  font-family: "Geist Mono", monospace;
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.15em;
}
.fridge-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  transition: background .15s, border-color .15s;
}
.fridge-item.soon {
  border-color: var(--warning);
  background: linear-gradient(135deg, rgba(251,191,36,0.06), transparent);
}
.fridge-item.expired {
  border-color: var(--danger);
  background: linear-gradient(135deg, rgba(239,68,68,0.06), transparent);
  opacity: 0.7;
}
.fi-body { flex: 1; min-width: 0; }
.fi-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.3;
}
.fi-meta {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}
.fridge-item.expired .fi-name { text-decoration: line-through; color: var(--text-mute); }
.advanced-details {
  margin-top: 14px;
  font-size: 13px;
}
.advanced-details summary {
  cursor: pointer;
  color: var(--text-dim);
  padding: 6px 0;
}
.advanced-details summary:hover { color: var(--text); }
.advanced-details[open] summary { color: var(--accent); margin-bottom: 8px; }
.advanced-details textarea { margin-top: 8px; }

/* ============================================================
   Steps tile + extras improvements
   ============================================================ */
.steps-tile { /* same as other extra-tile */ }
.steps-input-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}
.steps-input-row .input {
  flex: 1;
  padding: 10px 12px;
  font-size: 14px;
}
.steps-quick {
  display: flex;
  gap: 4px;
}
.steps-quick .pill { padding: 4px 10px; font-size: 11px; }
.extra-tile.full-span { grid-column: 1 / -1; }
.extras-row { grid-template-columns: 1fr 1fr; }

/* ============================================================
   Range slider (loss rate)
   ============================================================ */
.range-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  outline: none;
}
.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.range-slider::-moz-range-thumb {
  width: 22px; height: 22px;
  background: var(--accent);
  border-radius: 50%;
  cursor: pointer;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.range-hints {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-mute);
  margin-top: 6px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ============================================================
   Profession result
   ============================================================ */
.profession-result {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
}
.profession-result:empty { display: none; }

/* ============================================================
   Features sheet
   ============================================================ */
.features-content {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}
.features-group { margin-bottom: 18px; }
.features-group-head {
  font-family: "Geist Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.features-item {
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.features-item:last-child { border-bottom: none; }
.fi-title {
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
}
.fi-desc {
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ============================================================
   Tour (visite guidée)
   ============================================================ */
body.tour-active {
  overflow: hidden;
}
.tour-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 9000;
  animation: fadeIn .25s ease;
  pointer-events: auto;
}
.tour-ring {
  position: fixed;
  z-index: 9001;
  pointer-events: none;
  border: 2px solid var(--accent);
  border-radius: 14px;
  box-shadow:
    0 0 0 9999px rgba(10, 10, 10, 0.78),
    0 0 24px rgba(197, 248, 42, 0.55),
    inset 0 0 12px rgba(197, 248, 42, 0.25);
  transition: top .35s ease, left .35s ease, width .35s ease, height .35s ease;
  animation: ringPulse 2s ease-in-out infinite;
}
@keyframes ringPulse {
  0%, 100% { box-shadow: 0 0 0 9999px rgba(10,10,10,0.78), 0 0 22px rgba(197,248,42,0.5), inset 0 0 12px rgba(197,248,42,0.25); }
  50%      { box-shadow: 0 0 0 9999px rgba(10,10,10,0.78), 0 0 36px rgba(197,248,42,0.85), inset 0 0 18px rgba(197,248,42,0.4); }
}
.tour-tooltip {
  position: fixed;
  z-index: 9002;
  left: 50%;
  transform: translateX(-50%);
  max-width: 460px;
  width: calc(100% - 32px);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 18px 60px rgba(0,0,0,0.6);
  animation: fadeIn .3s ease;
}
.tour-step-num {
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.tour-title {
  font-family: "Fraunces", serif;
  font-variation-settings: "opsz" 144, "wght" 500;
  font-size: 22px;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 8px;
}
.tour-desc {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-dim);
  margin-bottom: 14px;
}
.tour-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.tour-actions .btn { padding: 9px 14px; }

/* ============================================================
   Responsive & Print
   ============================================================ */
@media (min-width: 600px) {
  .step-title { font-size: 56px; }
  .macro-hero { grid-template-columns: 1.4fr 1fr 1fr 1fr; }
}

@media print {
  body { background: white; color: black; }
  .tab-bar, .top-bar, .chat-input-bar, .api-banner,
  .shopping-actions, .icon-btn, .scanner-wrap, .sheet, .sheet-backdrop,
  #toast-region, .section-action, .day-strip, .progress-card,
  .meal-actions, .chip-row, .chat-input-bar {
    display: none !important;
  }
  .card, .meal-card, .cat-block {
    border: 1px solid #ccc;
    background: white;
    box-shadow: none;
  }
  .meal-body { display: block !important; padding-top: 16px; border-top: 1px solid #ddd; }
  .sh-item { border-color: #eee; }
  .sh-item.checked { opacity: 0.5; }
  .meal-title, .step-title, .section-title, .brand,
  .ingredient-name, .step-list li {
    color: black !important;
  }
  .meal-time-tag, .cat-name, .meal-kcal {
    color: #555 !important;
    background: #f5f5f5 !important;
  }
  #app { padding-bottom: 0; }
  .section { padding: 0 0 12px; }
}
