/* ── 67 FUEL — Block Brutalist Dark Theme ─────────────────────── */
html { background: #131313; } /* prevent flash of white on page load */

:root {
  --bg:              #131313;
  --surface:         #1f1f1f;
  --surface-low:     #1b1b1b;
  --surface-high:    #2a2a2a;
  --surface-bright:  #393939;
  --text:            #e2e2e2;
  --text-muted:      #ebbbb4;
  --text-main:       #e2e2e2;        /* backward compat */
  --surface-border:  #e2e2e2;        /* backward compat */
  --bg-gradient:     #131313;        /* backward compat */
  --primary:         #ff5540;
  --primary-hover:   #c00100;
  --secondary:       #080cff;
  --tertiary:        #eaea00;
  --accent:          #eaea00;        /* backward compat */
  --danger:          #ff5540;
  --warning:         #eaea00;        /* backward compat */
  --font-family:     'Space Mono', monospace;
  --font-headline:   'Sora', sans-serif;
}

/* Log page gets light background */
body.page-log {
  background: #e2e2e2;
  color: #131313;
  --bg: #e2e2e2;
  --surface: #e2e2e2;
  --surface-low: #f0f0f0;
  --surface-high: #f0f0f0;
  --surface-bright: #ffffff;
  --text: #131313;
  --text-main: #131313;
  --text-muted: #353535;
  --surface-border: #131313;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-family);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 72px;
}

/* ── Containers ─────────────────────────────────────────────── */
.glass-panel {
  background: var(--surface);
  border: 3px solid var(--surface-border);
  border-radius: 0;
  box-shadow: 4px 4px 0 0 rgba(0,0,0,1);
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3 {
  font-family: var(--font-headline);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: var(--text);
}

p { color: var(--text-muted); line-height: 1.5; margin-bottom: 1rem; }

/* ── Forms ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }

label {
  display: block;
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
  color: var(--text-muted);
}

input, select, textarea {
  width: 100%;
  background: var(--surface-bright);
  border: 3px solid var(--surface-border);
  border-radius: 0;
  padding: 0.875rem 1rem;
  color: var(--text);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: border-color 0.1s, border-width 0.1s, padding 0.1s;
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #080cff;
  border-width: 5px;
  padding: calc(0.875rem - 2px) calc(1rem - 2px);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.5rem;
  border-radius: 0;
  font-family: var(--font-family);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 3px solid var(--surface-border);
  cursor: pointer;
  box-shadow: 4px 4px 0 0 rgba(0,0,0,1);
  transition: transform 0.1s, box-shadow 0.1s, background 0.1s;
  width: 100%;
  background: var(--surface-high);
  color: var(--text);
  text-decoration: none;
}

.btn:hover  { box-shadow: 2px 2px 0 0 rgba(0,0,0,1); transform: translate(2px,2px); }
.btn:active { box-shadow: 0 0 0 0 rgba(0,0,0,1);     transform: translate(4px,4px); }

.btn-primary { background: var(--primary); color: #131313; }
.btn-primary:hover { background: var(--primary-hover); color: #e2e2e2; }

.btn-accent { background: var(--tertiary); color: #131313; }
.btn-accent:hover { background: #cdcd00; }

/* ── Utilities ──────────────────────────────────────────────── */
.text-center { text-align: center; }
.mt-4 { margin-top: 1rem; }
.mt-8 { margin-top: 2rem; }
.mb-4 { margin-bottom: 1rem; }
.d-none { display: none !important; }
.error-text { color: var(--danger); font-size: 0.875rem; margin-top: 0.5rem; }

/* ── Macro Tanks ────────────────────────────────────────────── */
.macro-tanks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  height: 200px;
}

.macro-tank {
  position: relative;
  border: 3px solid var(--surface-border);
  box-shadow: 4px 4px 0 0 rgba(0,0,0,1);
  background: var(--surface-low);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.macro-tank::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(226,226,226,0.06) 1px, transparent 1px);
  background-size: 100% 20px;
  pointer-events: none;
  z-index: 1;
}

.tank-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 0%;
  transition: height 0.9s ease-out;
  z-index: 0;
}

.tank-fill.protein { background-color: #93000a; }
.tank-fill.carbs   { background-color: #080cff; }
.tank-fill.fat     { background-color: #b1b100; }

.tank-label {
  position: relative;
  z-index: 2;
  text-align: center;
  pointer-events: none;
}

.tank-val {
  font-family: var(--font-headline);
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  display: block;
  mix-blend-mode: difference;
}

.tank-name {
  font-family: var(--font-family);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text);
  display: block;
  mix-blend-mode: difference;
}

/* ── Dashboard Rings (hidden, kept for JS) ───────────────────── */
.ring-container { display: flex; justify-content: space-around; margin: 1.5rem 0; }
.ring { position: relative; width: 90px; height: 90px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.ring .bg { stroke: var(--surface-high); }
.ring .progress { stroke: var(--text); stroke-dasharray: 251; stroke-dashoffset: 251; transition: stroke-dashoffset 1s ease-out; }
.ring .progress.protein { stroke: var(--primary); }
.ring .progress.carbs   { stroke: var(--secondary); }
.ring .progress.fat     { stroke: var(--tertiary); }
.ring-label { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); text-align: center; }
.ring-label .value { font-family: var(--font-headline); font-weight: 800; font-size: 1.1rem; color: var(--text); }
.ring-label .name  { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; }

/* ── Camera overlay ─────────────────────────────────────────── */
#camera-modal {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: #000; z-index: 100; display: flex; flex-direction: column;
}
#video-stream { flex: 1; object-fit: cover; width: 100%; }
.camera-controls {
  padding: 20px; display: flex; justify-content: center;
  background: #131313; border-top: 3px solid var(--surface-border);
}

/* ── Modals ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 200; display: flex; align-items: flex-end; justify-content: center;
}

.modal-sheet {
  background: var(--surface-low);
  border-radius: 0;
  border: 3px solid var(--surface-border);
  border-bottom: none;
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  padding-bottom: max(env(safe-area-inset-bottom), 20px);
}

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 1.5rem 1rem;
  position: sticky; top: 0;
  background: var(--surface-low);
  z-index: 1;
  border-bottom: 3px solid var(--surface-border);
}

.modal-header h3 {
  margin: 0;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text);
}

.modal-close {
  background: var(--surface-high); border: 2px solid var(--surface-border);
  width: 32px; height: 32px; border-radius: 0; cursor: pointer;
  font-size: 0.85rem; color: var(--text);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.modal-body { padding: 1.25rem 1.5rem 0.5rem; }

/* Unit guide */
.unit-guide {
  background: var(--surface-high); border: 2px solid var(--surface-border);
  padding: 0.75rem 1rem; margin-bottom: 1rem; display: grid; gap: 0.25rem;
  font-size: 0.78rem; color: var(--text-muted); line-height: 1.4; font-family: var(--font-family);
}

/* Input mode toggle */
.input-mode-toggle {
  display: flex; background: var(--surface-high); border: 2px solid var(--surface-border);
  padding: 3px; margin-bottom: 1rem; gap: 3px;
}
.input-mode-toggle button {
  flex: 1; padding: 0.4rem 0.5rem; border: none; background: transparent;
  font-family: var(--font-family); font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; transition: all 0.1s;
}
.input-mode-toggle button.active { background: var(--tertiary); color: #131313; border: 2px solid #131313; }

/* Macro input rows */
.macro-input-row   { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.875rem; }
.macro-label-col   { width: 72px; flex-shrink: 0; }
.macro-label-col .macro-name { font-family: var(--font-family); font-size: 0.875rem; font-weight: 700; color: var(--text); }
.macro-label-col .macro-hint { font-size: 0.68rem; color: var(--text-muted); margin-top: 1px; }
.macro-converted   { font-size: 0.72rem; color: var(--text-muted); width: 68px; text-align: right; flex-shrink: 0; font-family: var(--font-family); }

/* Slot Picker */
.slot-picker-wrapper {
  position: relative; height: 150px; overflow: hidden;
  border: 3px solid var(--surface-border); margin-bottom: 1.25rem; background: var(--surface-high);
}
.slot-picker-wrapper::before, .slot-picker-wrapper::after {
  content: ''; position: absolute; left: 0; right: 0; height: 52px; z-index: 2; pointer-events: none;
}
.slot-picker-wrapper::before { top: 0; background: linear-gradient(to bottom, var(--surface-high) 0%, transparent 100%); }
.slot-picker-wrapper::after  { bottom: 0; background: linear-gradient(to top, var(--surface-high) 0%, transparent 100%); }
.slot-selection-line {
  position: absolute; top: 50%; left: 0; right: 0; height: 50px; margin-top: -25px;
  border-top: 3px solid var(--surface-border); border-bottom: 3px solid var(--surface-border);
  pointer-events: none; z-index: 1;
}
.slot-list { height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.slot-list::-webkit-scrollbar { display: none; }
.slot-spacer { height: 50px; flex-shrink: 0; }
.slot-item {
  height: 50px; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-family); font-size: 1rem; font-weight: 400;
  color: var(--text-muted); scroll-snap-align: center; user-select: none; transition: color 0.15s;
}

/* Scan choice */
.scan-choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.875rem; margin-top: 0.25rem; }
.scan-choice-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 1.25rem 0.75rem; border: 3px solid var(--surface-border);
  background: var(--surface-high); cursor: pointer; box-shadow: 4px 4px 0 0 rgba(0,0,0,1); transition: all 0.1s;
}
.scan-choice-btn:hover  { background: var(--surface-bright); box-shadow: 2px 2px 0 0 rgba(0,0,0,1); transform: translate(2px,2px); }
.scan-choice-btn:active { box-shadow: none; transform: translate(4px,4px); }
.scan-choice-icon  { font-size: 1.75rem; line-height: 1; }
.scan-choice-title { font-family: var(--font-family); font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; }
.scan-choice-desc  { font-size: 0.7rem; color: var(--text-muted); text-align: center; line-height: 1.3; font-family: var(--font-family); }

/* BYOK */
.step-label { font-family: var(--font-family); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.5rem; }
.byok-step  { margin-bottom: 1.25rem; }
.byok-prompt-box {
  background: var(--surface-high); border: 2px solid var(--surface-border); padding: 0.75rem;
  font-size: 0.75rem; color: var(--text-muted); font-family: monospace;
  white-space: pre-wrap; max-height: 100px; overflow-y: auto; margin-bottom: 0.625rem; line-height: 1.5;
}
.byok-info     { font-size: 0.78rem; color: var(--text-muted); line-height: 1.5; margin: 0; font-family: var(--font-family); }
.byok-textarea {
  width: 100%; border: 3px solid var(--surface-border); border-radius: 0; padding: 0.75rem;
  font-size: 0.875rem; resize: none; font-family: var(--font-family);
  color: var(--text); background: var(--surface-bright);
}
.byok-textarea:focus { outline: none; border-color: var(--secondary); border-width: 5px; }

/* Scan result */
.macro-result-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.75rem; margin: 1rem 0 1.25rem; }
.macro-result-item { text-align: center; background: var(--surface-high); border: 2px solid var(--surface-border); padding: 0.875rem 0.5rem; }
.macro-result-value { font-family: var(--font-headline); font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1; }
.macro-result-label { font-family: var(--font-family); font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; margin-top: 0.35rem; }
.macro-result-unit  { font-family: var(--font-family); font-size: 0.65rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ── Bottom navigation ───────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface-low);
  border-top: 3px solid var(--surface-border);
  display: flex; justify-content: space-around; align-items: stretch;
  z-index: 150; height: 68px;
}

.nav-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; text-decoration: none; color: var(--text-muted);
  font-family: var(--font-family); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  flex: 1; transition: all 0.1s; user-select: none; cursor: pointer;
  filter: grayscale(1); opacity: 0.65;
}

.nav-item:active { background: var(--surface-high); }

.nav-item.active {
  background: #b1b100;
  color: #1d1d00;
  border-left: 3px solid #131313;
  border-right: 3px solid #131313;
  box-shadow: 0 -4px 0 0 #131313;
  transform: translateY(-4px);
  filter: none;
  opacity: 1;
}

.nav-icon { font-size: 22px; line-height: 1; }

/* ── Dashboard slides (minimal, for JS compat) ───────────────── */
.dashboard-slides { display: flex; overflow-x: scroll; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.dashboard-slides::-webkit-scrollbar { display: none; }
.dashboard-slide { min-width: 100%; scroll-snap-align: start; padding: 1.25rem; }
.slide-dots { display: flex; justify-content: center; gap: 6px; padding: 0 0 1rem; }
.slide-dot { width: 6px; height: 6px; background: var(--surface-high); border: 2px solid var(--surface-border); transition: all 0.2s; cursor: pointer; }
.slide-dot.active { background: var(--tertiary); width: 18px; border-color: var(--tertiary); }

/* Detail stat rows */
.stat-row { display: flex; justify-content: space-between; align-items: baseline; padding: 0.5rem 0; border-bottom: 2px solid var(--surface-high); font-size: 0.875rem; }
.stat-row:last-child { border-bottom: none; }
.stat-row .stat-label { font-family: var(--font-family); color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.stat-row .stat-val   { font-family: var(--font-headline); font-weight: 700; color: var(--text); font-size: 1rem; }
.stat-row .stat-val.highlight { color: var(--tertiary); }
.stat-row .stat-val.burned    { color: var(--tertiary); }

.macro-bars { display: flex; flex-direction: column; gap: 0.875rem; margin-top: 1rem; }
.macro-bar-header { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.macro-bar-name { font-family: var(--font-family); font-size: 12px; font-weight: 700; color: var(--text); text-transform: uppercase; }
.macro-bar-nums { font-family: var(--font-family); font-size: 0.72rem; color: var(--text-muted); }
.macro-left-pill { display: inline-block; background: var(--surface-high); border: 2px solid var(--surface-border); padding: 1px 6px; color: var(--text); font-weight: 700; margin-left: 0.35rem; font-size: 0.7rem; }
.macro-bar-track { background: var(--surface-high); border: 2px solid var(--surface-border); height: 12px; overflow: hidden; }
.macro-bar-fill { height: 100%; width: 0%; transition: width 0.9s ease-out; }
.macro-bar-fill.carbs   { background: var(--secondary); }
.macro-bar-fill.protein { background: var(--primary); }
.macro-bar-fill.fat     { background: var(--tertiary); }

/* ── Log page ────────────────────────────────────────────────── */
.date-nav {
  display: flex; align-items: stretch; justify-content: space-between;
  margin-bottom: 12px; border: 3px solid var(--surface-border);
  box-shadow: 4px 4px 0 0 rgba(0,0,0,1); background: var(--surface);
}
.date-nav .date-label {
  font-family: var(--font-headline); font-weight: 800; font-size: 1rem;
  text-transform: uppercase; letter-spacing: 0.04em; color: var(--text);
  padding: 0.625rem 0; flex: 1; text-align: center;
}
.date-nav-btn {
  background: transparent; border: none; width: 48px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--text);
  border-right: 3px solid var(--surface-border); transition: background 0.1s;
}
.date-nav-btn:last-child { border-right: none; border-left: 3px solid var(--surface-border); }
.date-nav-btn:hover  { background: var(--surface-high); }
.date-nav-btn:active { background: var(--tertiary); color: #131313; }
.date-nav-btn:disabled { opacity: 0.35; cursor: default; }

.section-heading {
  font-family: var(--font-family); font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text);
  margin: 1.25rem 0 0.625rem; display: inline-block;
  background: var(--text); color: var(--bg); padding: 4px 10px;
}

.log-entry {
  display: flex; align-items: stretch;
  background: var(--surface); border: 3px solid var(--surface-border);
  box-shadow: 4px 4px 0 0 rgba(0,0,0,1); margin-bottom: 8px;
}
.log-entry-left-bar { width: 5px; flex-shrink: 0; }
.log-entry-left-bar.food-bar     { background: var(--secondary); }
.log-entry-left-bar.exercise-bar { background: var(--tertiary); }
.log-entry-inner { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 0.875rem; flex: 1; }
.log-entry-info  { flex: 1; min-width: 0; }
.log-entry-name  { font-family: var(--font-headline); font-size: 14px; font-weight: 700; color: var(--text); }
.log-entry-meta  { font-family: var(--font-family); font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.log-entry-kcal  { font-family: var(--font-headline); font-size: 1rem; font-weight: 700; color: var(--text); flex-shrink: 0; }
.log-delete-btn  { background: none; border: none; color: var(--surface-bright); cursor: pointer; padding: 0.25rem; transition: color 0.1s; flex-shrink: 0; }
.log-delete-btn:hover { color: var(--danger); }

.log-summary-panel {
  background: var(--surface-low); border: 3px solid var(--surface-border);
  box-shadow: 4px 4px 0 0 rgba(0,0,0,1); padding: 1rem 1.25rem; margin-top: 1.25rem;
}

.log-empty {
  text-align: center; padding: 1.5rem 1rem; color: var(--text-muted);
  font-family: var(--font-family); font-size: 0.85rem;
  border: 3px dashed var(--surface-border); margin-bottom: 0.5rem;
}

/* ── Progress / Calendar ─────────────────────────────────────── */
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.calendar-month  { font-family: var(--font-headline); font-size: 1.1rem; font-weight: 800; color: var(--text); text-transform: uppercase; }

.calendar-grid {
  display: grid; grid-template-columns: repeat(7,1fr);
  gap: 3px; background: var(--surface-border); border: 3px solid var(--surface-border);
}
.cal-day-name {
  text-align: center; font-family: var(--font-family); font-size: 11px; font-weight: 700;
  color: var(--text); padding: 0.4rem 0; background: var(--surface-high); text-transform: uppercase;
}
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-family); font-size: 0.75rem; font-weight: 700;
  cursor: pointer; background: var(--surface); color: var(--text); transition: all 0.1s;
}
.cal-day.empty       { cursor: default; background: var(--surface-low); }
.cal-day.today       { border: 3px solid var(--text); }
.cal-day.logged-ok   { background: #cdcd00; color: #131313; }
.cal-day.logged-warn { background: var(--primary); color: #131313; opacity: 0.65; }
.cal-day.logged-over { background: var(--primary); color: #131313; }
.cal-day.logged-ok:hover   { background: #eaea00; }
.cal-day.logged-warn:hover { background: #ff7060; }
.cal-day.logged-over:hover { background: #c00100; color: #e2e2e2; }

/* ── Profile page ────────────────────────────────────────────── */
.profile-section-title {
  font-family: var(--font-family); font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 0.875rem;
}

.goal-mode-toggle { display: flex; border: 3px solid var(--surface-border); margin-bottom: 1rem; }
.goal-mode-btn {
  flex: 1; padding: 0.75rem 0.5rem;
  border: none; border-right: 3px solid var(--surface-border);
  background: var(--surface-high); font-family: var(--font-family); font-size: 12px; font-weight: 700;
  cursor: pointer; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; transition: all 0.1s;
}
.goal-mode-btn:last-child { border-right: none; }
.goal-mode-btn.active { background: var(--secondary); color: #e2e2e2; }

.protocol-info {
  background: var(--surface-high); border: 2px solid var(--surface-border);
  padding: 0.875rem 1rem; margin-bottom: 1rem; font-family: var(--font-family); font-size: 0.83rem; color: var(--text-muted);
}
.protocol-info .tdee-big { font-family: var(--font-headline); font-size: 1.5rem; font-weight: 800; color: var(--tertiary); display: block; margin-bottom: 0.25rem; }

.ratio-row { display: flex; gap: 0.75rem; margin-bottom: 0.875rem; }
.ratio-row .form-group { flex: 1; margin-bottom: 0; }

.scan-quota-badge {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--tertiary); border: 3px solid var(--surface-border);
  box-shadow: 4px 4px 0 0 rgba(0,0,0,1);
  padding: 0.625rem 1rem; font-family: var(--font-family); font-size: 12px;
  color: #131313; font-weight: 700; text-transform: uppercase;
}

/* ── Loading States ──────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--surface-high) 25%, var(--surface-bright) 50%, var(--surface-high) 75%);
  background-size: 200% 100%; animation: skeleton-pulse 1.5s ease-in-out infinite;
}
@keyframes skeleton-pulse { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-circle { width: 100px; height: 100px; }
.skeleton-line   { height: 14px; margin-bottom: 8px; }
.skeleton-line--short  { width: 60%; }
.skeleton-line--medium { width: 80%; }
.skeleton-block  { height: 80px; margin-bottom: 12px; }
.spinner         { width: 24px; height: 24px; border: 3px solid var(--surface-high); border-top-color: var(--text); animation: spin 0.6s linear infinite; margin: 1rem auto; }
@keyframes spin  { to { transform: rotate(360deg); } }
.error-state .error-icon    { font-size: 2rem; margin-bottom: 0.5rem; }
.error-state .error-message { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1rem; font-family: var(--font-family); }
.empty-state  { text-align: center; padding: 2rem 1rem; color: var(--text-muted); font-family: var(--font-family); font-size: 0.875rem; }
.error-state  { text-align: center; padding: 2rem 1rem; color: var(--danger); }
.btn-loading  { pointer-events: none; opacity: 0.7; position: relative; }
.btn-loading::after {
  content: ''; position: absolute; width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
  animation: spin 0.6s linear infinite; right: 16px; top: 50%; transform: translateY(-50%);
}

/* ── Water Tracker ───────────────────────────────────────────── */
.water-tracker-card { padding: 1rem 1.25rem; margin-top: 1rem; }
.water-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.75rem; }
.water-icon  { font-size: 1.1rem; }
.water-title { font-family: var(--font-family); font-weight: 700; font-size: 12px; text-transform: uppercase; flex: 1; color: var(--text); }
.water-count { font-family: var(--font-family); font-size: 0.8rem; color: var(--text-muted); }
.water-dots  { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 0.75rem; }
.water-dot   { width: 22px; height: 22px; border: 3px solid var(--surface-border); transition: background-color 0.2s; }
.water-dot--filled { background: var(--secondary); border-color: var(--secondary); }
.water-actions { display: flex; gap: 0.75rem; }
.water-btn {
  width: 44px; height: 44px; border: 3px solid var(--surface-border);
  background: var(--surface-high); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--text);
  box-shadow: 3px 3px 0 0 rgba(0,0,0,1); transition: all 0.1s;
}
.water-btn:hover  { background: var(--surface-bright); }
.water-btn:active { box-shadow: none; transform: translate(3px,3px); }

/* ── Favorites & Recent ─────────────────────────────────────── */
.recent-chips-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 0.5rem; scrollbar-width: none; }
.recent-chips-row::-webkit-scrollbar { display: none; }
.recent-chip {
  display: inline-flex; align-items: center; padding: 6px 12px;
  border: 2px solid var(--surface-border); background: var(--surface-high);
  font-family: var(--font-family); font-size: 0.75rem; cursor: pointer; white-space: nowrap;
  color: var(--text); transition: all 0.1s;
}
.recent-chip:hover { background: var(--tertiary); color: #131313; }

.fav-item        { display: flex; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--surface-high); gap: 0.75rem; }
.fav-item:last-child { border-bottom: none; }
.fav-item__info  { flex: 1; min-width: 0; }
.fav-item__label { font-family: var(--font-family); font-size: 0.875rem; font-weight: 700; color: var(--text); }
.fav-item__meta  { font-family: var(--font-family); font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }

/* ── Today's Food List ───────────────────────────────────────── */
.today-food-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 2px solid var(--surface-high); }
.today-food-item:last-child { border-bottom: none; }
.food-label { font-family: var(--font-family); font-size: 0.875rem; color: var(--text); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 0.5rem; }
.food-kcal  { font-family: var(--font-family); font-size: 0.875rem; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }

/* ── Weight Tracker ─────────────────────────────────────────── */
.weight-card    { padding: 1.25rem; margin-bottom: 1rem; }
.weight-header  { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.weight-current { font-family: var(--font-headline); font-size: 2rem; font-weight: 800; color: var(--text); }
.weight-change-pos { color: var(--primary); font-family: var(--font-family); font-size: 0.875rem; font-weight: 700; }
.weight-change-neg { color: #4CAF50;       font-family: var(--font-family); font-size: 0.875rem; font-weight: 700; }
.weight-sparkline  { margin: 0.5rem 0; overflow: hidden; }

/* ── Goal Quick-Edit ─────────────────────────────────────────── */
.icon-btn-subtle {
  width: 24px; height: 24px; border: none; background: transparent;
  cursor: pointer; opacity: 0.5; font-size: 0.875rem; padding: 0;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text); transition: opacity 0.15s;
}
.icon-btn-subtle:hover { opacity: 1; }

.segment-toggle { display: flex; border: 3px solid var(--surface-border); margin-bottom: 1rem; }
.seg-btn {
  flex: 1; padding: 0.55rem 0.5rem; border-right: 2px solid var(--surface-border); background: var(--surface-high);
  font-family: var(--font-family); font-size: 12px; font-weight: 700; cursor: pointer;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; transition: all 0.1s;
}
.seg-btn:last-child { border-right: none; }
.seg-btn.active { background: var(--secondary); color: #e2e2e2; }

.tdee-display .tdee-value { font-family: var(--font-headline); font-size: 2.5rem; font-weight: 800; color: var(--tertiary); display: block; }
.tdee-display .tdee-label { font-family: var(--font-family); font-size: 0.8rem; color: var(--text-muted); }
.tdee-display { text-align: center; padding: 0.75rem 0; }

.macro-split-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; margin-bottom: 0.75rem; }
.macro-split-row .form-group { margin-bottom: 0; }
.macro-split-row label { font-size: 0.75rem; }
.macro-split-row input { padding: 0.5rem; text-align: center; }
.muted { font-family: var(--font-family); font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.75rem; }

/* ── Onboarding Overlay ─────────────────────────────────────── */
.onboarding-overlay {
  position: fixed; inset: 0; background: #131313; z-index: 300;
  display: flex; flex-direction: column; align-items: center; overflow: hidden;
}
.onboarding-slides {
  display: flex; overflow-x: scroll; scroll-snap-type: x mandatory;
  scrollbar-width: none; width: 100%; -webkit-overflow-scrolling: touch; flex: 1;
}
.onboarding-slides::-webkit-scrollbar { display: none; }
.onboarding-slide {
  min-width: 100%; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem; text-align: center;
}
.onboarding-emoji { font-size: 3rem; margin-bottom: 1rem; }
.onboarding-title { font-family: var(--font-headline); font-size: 1.75rem; font-weight: 800; color: var(--text); margin-bottom: 0.75rem; text-transform: uppercase; }
.onboarding-body  { font-family: var(--font-family); font-size: 1rem; color: var(--text-muted); line-height: 1.6; }
.onboarding-dots  { display: flex; justify-content: center; gap: 6px; padding: 1rem 0; }
.onboarding-btn   { width: calc(100% - 4rem); max-width: 360px; margin-bottom: 2rem; }

/* ── Quick-Add ───────────────────────────────────────────────── */
.quick-add-search { width: 100%; padding: 12px; border: 3px solid var(--surface-border); border-radius: 0; font-size: 0.875rem; margin-bottom: 0.75rem; background: var(--surface-bright); color: var(--text); font-family: var(--font-family); }
.quick-add-categories { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 0.5rem; margin-bottom: 0.75rem; scrollbar-width: none; }
.quick-add-categories::-webkit-scrollbar { display: none; }
.cat-pill { flex-shrink: 0; padding: 4px 12px; border: 2px solid var(--surface-border); background: var(--surface-high); font-family: var(--font-family); font-size: 12px; cursor: pointer; white-space: nowrap; color: var(--text); font-weight: 700; text-transform: uppercase; transition: all 0.1s; }
.cat-pill.active { background: var(--primary); color: #131313; border-color: #131313; }
.quick-add-item { display: flex; align-items: center; padding: 12px 0; border-bottom: 2px solid var(--surface-high); gap: 0.75rem; }
.quick-add-item:last-child { border-bottom: none; }
.quick-add-item__info  { flex: 1; min-width: 0; }
.quick-add-item__label { font-family: var(--font-family); font-size: 0.875rem; font-weight: 700; color: var(--text); }
.quick-add-item__meta  { font-family: var(--font-family); font-size: 0.75rem; color: var(--text-muted); margin-top: 2px; }
.quick-add-item__btn {
  width: 36px; height: 36px; border: 3px solid var(--surface-border); background: var(--surface-high);
  font-size: 1.1rem; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 3px 3px 0 0 rgba(0,0,0,1); transition: all 0.1s; color: var(--text);
}
.quick-add-item__btn:hover { background: var(--primary); color: #131313; box-shadow: 1px 1px 0 0 rgba(0,0,0,1); transform: translate(2px,2px); }

/* ── Scan Result Editing ─────────────────────────────────────── */
.scan-result-macro { margin-bottom: 1rem; }
.scan-result-macro label { font-family: var(--font-family); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-muted); margin-bottom: 0.4rem; display: block; }
.scan-result-adjuster { display: flex; align-items: center; gap: 8px; }
.adj-btn {
  width: 40px; height: 40px; border: 3px solid var(--surface-border); box-shadow: 3px 3px 0 0 rgba(0,0,0,1);
  background: var(--surface-high); font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--text); transition: all 0.1s;
}
.adj-btn:active { box-shadow: none; transform: translate(3px,3px); }
.adj-value { width: 64px; text-align: center; font-family: var(--font-headline); font-size: 1.1rem; font-weight: 700; border: 3px solid var(--surface-border); padding: 0.4rem; color: var(--text); background: var(--surface-bright); -moz-appearance: textfield; }
.adj-value::-webkit-outer-spin-button, .adj-value::-webkit-inner-spin-button { -webkit-appearance: none; }
.adj-unit { font-family: var(--font-family); font-size: 0.75rem; color: var(--text-muted); margin-left: 2px; }
.scan-result-kcal { text-align: center; font-family: var(--font-family); font-size: 0.875rem; color: var(--text-muted); margin: 0.75rem 0; }
.scan-result-kcal strong { font-family: var(--font-headline); color: var(--text); font-size: 1rem; }

/* ── Daily Streak ────────────────────────────────────────────── */
.streak-badge {
  display: none; align-items: center; gap: 4px;
  background: var(--tertiary); border: 3px solid #131313;
  box-shadow: 3px 3px 0 0 rgba(0,0,0,1);
  padding: 4px 12px; font-weight: 700;
}
.streak-badge--visible { display: inline-flex; }
.streak-fire  { font-size: 1rem; }
.streak-count { font-family: var(--font-headline); color: #131313; }
.streak-label { font-family: var(--font-family); color: #353535; font-size: 0.75rem; }
@keyframes streak-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }
.streak-badge--hot .streak-fire { animation: streak-pulse 1.5s ease-in-out infinite; }
