/* ========================================
   Ernährungstracker – Design System
   ======================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ── CSS Variablen (Light Mode) ──────────── */
:root {
  --font: 'Inter', system-ui, sans-serif;

  /* Brand Colors */
  --blue-50:  #eff6ff;
  --blue-100: #dbeafe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;

  --green-50:  #f0fdf4;
  --green-100: #dcfce7;
  --green-400: #4ade80;
  --green-500: #22c55e;
  --green-600: #16a34a;

  --purple-50:  #faf5ff;
  --purple-100: #f3e8ff;
  --purple-400: #c084fc;
  --purple-500: #a855f7;
  --purple-600: #9333ea;

  --orange-50:  #fff7ed;
  --orange-400: #fb923c;
  --orange-500: #f97316;
  --orange-600: #ea580c;

  --cyan-50:  #ecfeff;
  --cyan-400: #22d3ee;
  --cyan-500: #06b6d4;

  --pink-50:  #fdf2f8;
  --pink-500: #ec4899;

  --red-400: #f87171;
  --red-500: #ef4444;
  --red-600: #dc2626;

  --yellow-50:  #fefce8;
  --yellow-500: #eab308;

  /* Background & Surface */
  --bg:        #f0f4f8;
  --surface:   #ffffff;
  --surface-2: #f8fafc;
  --border:    #e2e8f0;

  /* Text */
  --text-primary:   #0f172a;
  --text-secondary: #475569;
  --text-muted:     #94a3b8;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
  --shadow:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.05);
  --shadow-md: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 20px 25px rgba(0,0,0,.1), 0 8px 10px rgba(0,0,0,.04);

  /* Nav */
  --nav-bg:     rgba(255,255,255,.92);
  --nav-border: #e2e8f0;

  /* Radii */
  --r-sm: .75rem;
  --r-md: 1rem;
  --r-lg: 1.25rem;
  --r-xl: 1.5rem;
  --r-2xl: 2rem;

  /* Transitions */
  --ease: cubic-bezier(.4,0,.2,1);
}

/* ── Dark Mode via Klasse ──────────────── */
.dark {
  --bg:        #0f172a;
  --surface:   #1e293b;
  --surface-2: #273548;
  --border:    #334155;

  --text-primary:   #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted:     #64748b;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
  --shadow:    0 4px 6px rgba(0,0,0,.35);
  --shadow-md: 0 10px 15px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 25px rgba(0,0,0,.45);

  --nav-bg:     rgba(30,41,59,.95);
  --nav-border: #334155;
}

/* ── Systemweiter Dark Mode Fallback ─── */
@media (prefers-color-scheme: dark) {
  :root:not(.light) {
    --bg:        #0f172a;
    --surface:   #1e293b;
    --surface-2: #273548;
    --border:    #334155;
    --text-primary:   #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted:     #64748b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.4);
    --shadow:    0 4px 6px rgba(0,0,0,.35);
    --shadow-md: 0 10px 15px rgba(0,0,0,.4);
    --shadow-lg: 0 20px 25px rgba(0,0,0,.45);
    --nav-bg:     rgba(30,41,59,.95);
    --nav-border: #334155;
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text-primary);
  min-height: 100svh;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}

[v-cloak] { display: none; }

/* ── Loading Screen ────────────────────── */
.loading-screen {
  position: fixed;
  inset: 0;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.loading-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  animation: fadeIn .4s var(--ease);
}
.loading-logo .icon-wrap {
  width: 88px; height: 88px;
  background: var(--surface);
  border-radius: var(--r-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid var(--border);
}
.loading-icon-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.loading-logo p {
  font-size: .875rem;
  color: var(--text-muted);
  font-weight: 500;
}
.loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--blue-500);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

/* ── Page Wrapper ──────────────────────── */
.page-wrapper { padding-bottom: 5.5rem; }

/* ── Page Animations ───────────────────── */
.page-enter { animation: pageIn .25s var(--ease); }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
@keyframes pulse-ring {
  0%   { transform: scale(.9); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Header ────────────────────────────── */
.app-header {
  padding: 1rem 1rem .5rem;
  position: relative;
  z-index: 10;
}
.header-gradient {
  background: linear-gradient(135deg, var(--blue-500) 0%, var(--purple-500) 100%);
  color: #fff;
  padding: 1.25rem 1rem 2.5rem;
  border-radius: 0 0 var(--r-2xl) var(--r-2xl);
  margin-bottom: -.5rem;
  box-shadow: var(--shadow-md);
}
.header-gradient.green {
  background: linear-gradient(135deg, var(--green-500), var(--green-600));
}
.header-gradient.purple {
  background: linear-gradient(135deg, var(--purple-500), var(--purple-600));
}
.header-gradient.dark-gray {
  background: linear-gradient(135deg, #334155, #1e293b);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-title { font-size: 1.125rem; font-weight: 700; }
.header-sub   { font-size: .8rem; opacity: .85; margin-top: .125rem; }

/* ── Icon Button ───────────────────────── */
.icon-btn {
  width: 40px; height: 40px;
  border-radius: var(--r-md);
  border: none;
  background: rgba(255,255,255,.18);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .2s var(--ease), transform .15s var(--ease);
  font-size: 1rem;
  backdrop-filter: blur(4px);
}
.icon-btn:active { transform: scale(.92); }
.icon-btn:hover  { background: rgba(255,255,255,.28); }
.icon-btn.dark   { background: var(--surface-2); color: var(--text-secondary); }
.icon-btn.dark:hover { background: var(--border); }

/* ── Cards ─────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow);
  transition: box-shadow .2s var(--ease), transform .2s var(--ease);
}
.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card-p { padding: 1rem; }
.card-p-lg { padding: 1.25rem; }

/* ── Progress Ring ─────────────────────── */
.progress-ring-svg { transform: rotate(-90deg); }
.progress-ring-track { transition: stroke-dashoffset .8s var(--ease); }

/* ── Progress Bar ──────────────────────── */
.progress-bar-wrap {
  background: var(--border);
  border-radius: 9999px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  transition: width .8s var(--ease);
}
.progress-bar-fill.blue   { background: linear-gradient(90deg, var(--blue-400), var(--blue-500)); }
.progress-bar-fill.green  { background: linear-gradient(90deg, var(--green-400), var(--green-500)); }
.progress-bar-fill.orange { background: linear-gradient(90deg, var(--orange-400), var(--orange-500)); }
.progress-bar-fill.purple { background: linear-gradient(90deg, var(--purple-400), var(--purple-500)); }
.progress-bar-fill.danger { background: linear-gradient(90deg, var(--red-400), var(--red-500)); }
.progress-bar-fill.cyan   { background: linear-gradient(90deg, var(--cyan-400), var(--cyan-500)); }

/* ── Stat Badges ───────────────────────── */
.stat-badge {
  padding: .625rem;
  border-radius: var(--r-lg);
  text-align: center;
}
.stat-badge.orange  { background: var(--orange-50); }
.stat-badge.blue    { background: var(--blue-50); }
.stat-badge.green   { background: var(--green-50); }
.stat-badge.purple  { background: var(--purple-50); }
.stat-badge.pink    { background: var(--pink-50); }
.stat-badge.yellow  { background: var(--yellow-50); }
.stat-badge.cyan    { background: var(--cyan-50); }
.stat-value { font-weight: 700; font-size: 1.125rem; line-height: 1.2; }
.stat-label { font-size: .7rem; color: var(--text-muted); margin-top: .125rem; }

.dark .stat-badge.orange  { background: rgba(249,115,22,.15); }
.dark .stat-badge.blue    { background: rgba(59,130,246,.15); }
.dark .stat-badge.green   { background: rgba(34,197,94,.15); }
.dark .stat-badge.purple  { background: rgba(168,85,247,.15); }
.dark .stat-badge.pink    { background: rgba(236,72,153,.15); }
.dark .stat-badge.yellow  { background: rgba(234,179,8,.15); }
.dark .stat-badge.cyan    { background: rgba(6,182,212,.15); }

/* ── Meal List Item ────────────────────── */
.meal-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  margin-bottom: .5rem;
  transition: background .15s;
}
.meal-item:hover { background: var(--border); }
.meal-icon {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: .875rem;
}
.meal-icon.blue   { background: var(--blue-100);   color: var(--blue-500); }
.meal-icon.green  { background: var(--green-100);  color: var(--green-600); }
.meal-icon.purple { background: var(--purple-100); color: var(--purple-500); }
.meal-icon.gray   { background: var(--surface-2);  color: var(--text-muted); }

.dark .meal-icon.blue   { background: rgba(59,130,246,.2); }
.dark .meal-icon.green  { background: rgba(34,197,94,.2); }
.dark .meal-icon.purple { background: rgba(168,85,247,.2); }
.dark .meal-icon.gray   { background: rgba(100,116,139,.2); }

/* ── Quick Action Buttons ──────────────── */
.quick-btn {
  border: none;
  cursor: pointer;
  border-radius: var(--r-xl);
  padding: 1.25rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
  font-family: var(--font);
  font-weight: 600;
  font-size: .875rem;
  color: #fff;
  box-shadow: var(--shadow);
  transition: box-shadow .2s var(--ease), transform .15s var(--ease);
}
.quick-btn:hover  { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quick-btn:active { transform: translateY(0); }
.quick-btn .icon  { font-size: 1.5rem; }
.quick-btn.blue   { background: linear-gradient(135deg, var(--blue-500), var(--blue-600)); }
.quick-btn.green  { background: linear-gradient(135deg, var(--green-500), var(--green-600)); }
.quick-btn.purple { background: linear-gradient(135deg, var(--purple-500), var(--purple-600)); }
.quick-btn.orange { background: linear-gradient(135deg, var(--orange-500), var(--orange-600)); }
.quick-btn.cyan   { background: linear-gradient(135deg, var(--cyan-400), var(--cyan-500)); }

/* ── Water Widget ──────────────────────── */
.water-btn {
  width: 44px; height: 44px;
  border-radius: var(--r-lg);
  border: 2px solid var(--cyan-400);
  background: var(--cyan-50);
  color: var(--cyan-500);
  font-weight: 700;
  font-size: .75rem;
  font-family: var(--font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s var(--ease);
  flex-shrink: 0;
}
.water-btn:hover  { background: var(--cyan-400); color: #fff; transform: scale(1.05); }
.water-btn:active { transform: scale(.95); }
.dark .water-btn  { background: rgba(6,182,212,.15); border-color: var(--cyan-500); }
.dark .water-btn:hover { background: var(--cyan-500); }

/* ── Bottom Navigation ─────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--nav-bg);
  border-top: 1px solid var(--nav-border);
  display: flex;
  justify-content: space-around;
  padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 50;
  transition: background .3s var(--ease);
}
.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .25rem;
  padding: .375rem .75rem;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: var(--r-md);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: .65rem;
  font-weight: 500;
  transition: color .2s var(--ease), background .2s var(--ease);
  min-width: 52px;
}
.nav-btn i { font-size: 1.125rem; transition: transform .2s var(--ease); }
.nav-btn.active { color: var(--blue-500); }
.nav-btn.active i { transform: scale(1.15); }
.nav-btn:hover { background: var(--surface-2); color: var(--blue-500); }
.nav-center-btn {
  width: 52px; height: 52px;
  background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(59,130,246,.4);
  transform: translateY(-8px);
  font-size: 1.25rem;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.nav-center-btn:hover  { transform: translateY(-10px); box-shadow: 0 6px 16px rgba(59,130,246,.5); }
.nav-center-btn:active { transform: translateY(-6px); }

/* ── Forms & Inputs ────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .375rem;
  letter-spacing: .01em;
}
.form-input {
  width: 100%;
  padding: .75rem 1rem;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  font-family: var(--font);
  font-size: .9rem;
  background: var(--surface-2);
  color: var(--text-primary);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--blue-500);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.form-input::placeholder { color: var(--text-muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }

/* ── Buttons ───────────────────────────── */
.btn {
  width: 100%;
  padding: .875rem;
  border: none;
  border-radius: var(--r-lg);
  font-family: var(--font);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  transition: all .2s var(--ease);
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: linear-gradient(135deg, var(--blue-500), var(--blue-600)); color: #fff; box-shadow: 0 4px 12px rgba(59,130,246,.3); }
.btn-primary:hover:not(:disabled)  { box-shadow: 0 6px 16px rgba(59,130,246,.4); transform: translateY(-1px); }
.btn-green  { background: linear-gradient(135deg, var(--green-500), var(--green-600)); color: #fff; box-shadow: 0 4px 12px rgba(34,197,94,.3); }
.btn-green:hover:not(:disabled)    { box-shadow: 0 6px 16px rgba(34,197,94,.4); transform: translateY(-1px); }
.btn-purple { background: linear-gradient(135deg, var(--purple-500), var(--purple-600)); color: #fff; box-shadow: 0 4px 12px rgba(168,85,247,.3); }
.btn-purple:hover:not(:disabled)   { box-shadow: 0 6px 16px rgba(168,85,247,.4); transform: translateY(-1px); }
.btn-danger { background: linear-gradient(135deg, var(--red-400), var(--red-500)); color: #fff; }
.btn-ghost  { background: var(--surface-2); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--border); }
.btn-sm { padding: .5rem .875rem; font-size: .8rem; width: auto; border-radius: var(--r-md); }
.btn-icon { width: 40px; height: 40px; padding: 0; flex-shrink: 0; border-radius: var(--r-md); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: .875rem; transition: all .15s var(--ease); background: var(--surface-2); color: var(--text-muted); }
.btn-icon:hover { background: var(--red-400); color: #fff; }
.btn-row { display: flex; gap: .75rem; }

/* ── Toggle Switch ─────────────────────── */
.toggle-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .875rem 0;
  border-bottom: 1px solid var(--border);
}
.toggle-wrap:last-child { border-bottom: none; }
.toggle-label { font-size: .9rem; font-weight: 500; color: var(--text-primary); }
.toggle-sub   { font-size: .78rem; color: var(--text-muted); margin-top: .15rem; }
.toggle {
  position: relative;
  width: 48px; height: 26px;
  flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border);
  border-radius: 9999px;
  transition: background .2s var(--ease);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s var(--ease);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle input:checked + .toggle-slider { background: var(--blue-500); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

/* ── Section Title ─────────────────────── */
.section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: .75rem;
}

/* ── Favorites Chip ────────────────────── */
.fav-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: .75rem .5rem;
  border-radius: var(--r-lg);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: all .2s var(--ease);
  min-width: 80px;
  text-align: center;
}
.fav-chip:hover { border-color: var(--blue-500); background: var(--blue-50); transform: translateY(-2px); }
.dark .fav-chip:hover { background: rgba(59,130,246,.12); }
.fav-chip-name { font-size: .72rem; font-weight: 600; color: var(--text-primary); margin-top: .25rem; line-height: 1.2; }
.fav-chip-kcal { font-size: .65rem; color: var(--text-muted); }

/* ── Toast ─────────────────────────────── */
.toast {
  position: fixed;
  bottom: 5.5rem; left: 1rem; right: 1rem;
  padding: 1rem 1.25rem;
  border-radius: var(--r-xl);
  color: #fff;
  font-weight: 600;
  text-align: center;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  animation: slideUp .3s var(--ease);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
}
.toast.success { background: linear-gradient(135deg, var(--green-500), var(--green-600)); }
.toast.error   { background: linear-gradient(135deg, var(--red-400), var(--red-500)); }
.toast.info    { background: linear-gradient(135deg, var(--blue-500), var(--purple-500)); }

/* ── Badge / Chip ──────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .25rem .625rem;
  border-radius: 9999px;
  font-size: .7rem;
  font-weight: 600;
}
.badge.blue   { background: var(--blue-100); color: var(--blue-600); }
.badge.green  { background: var(--green-50); color: var(--green-600); }
.badge.orange { background: var(--orange-50); color: var(--orange-600); }
.badge.purple { background: var(--purple-50); color: var(--purple-500); }
.dark .badge.blue   { background: rgba(59,130,246,.2); }
.dark .badge.green  { background: rgba(34,197,94,.2); }
.dark .badge.orange { background: rgba(249,115,22,.2); }
.dark .badge.purple { background: rgba(168,85,247,.2); }

/* ── Filter Chips ──────────────────────── */
.filter-chip {
  padding: .4rem 1rem;
  border-radius: 9999px;
  border: none;
  font-family: var(--font);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s var(--ease);
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--text-secondary);
}
.filter-chip.active { background: var(--blue-500); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,.35); }
.filter-chip:hover:not(.active) { background: var(--border); }

/* ── Empty State ───────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
}
.empty-state i { font-size: 2.5rem; margin-bottom: .75rem; opacity: .5; }
.empty-state p { font-size: .875rem; }

/* ── Divider ───────────────────────────── */
.divider { height: 1px; background: var(--border); margin: .75rem 0; }

/* ── Floating Label Input (API Key) ────── */
.input-password-wrap { position: relative; }
.input-password-wrap .form-input { padding-right: 3rem; }
.input-reveal {
  position: absolute;
  right: .75rem; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: .875rem;
  transition: color .15s;
}
.input-reveal:hover { color: var(--text-primary); }

/* ── Custom Scrollbar ──────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 9999px; }

/* ── Utility ───────────────────────────── */
.flex  { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .25rem; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: .25rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mb-2 { margin-bottom: .5rem; }
.mb-3 { margin-bottom: .75rem; }
.mb-4 { margin-bottom: 1rem; }
.mx-4 { margin-left: 1rem; margin-right: 1rem; }
.p-4  { padding: 1rem; }
.px-4 { padding-left: 1rem; padding-right: 1rem; }
.py-2 { padding-top: .5rem; padding-bottom: .5rem; }
.text-sm { font-size: .875rem; }
.text-xs { font-size: .75rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-primary  { color: var(--text-primary); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .75rem; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: .5rem; }
.w-full { width: 100%; }
.overflow-x-auto { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.space-y > * + * { margin-top: .5rem; }
.rounded-full { border-radius: 9999px; }
.text-center { text-align: center; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.relative { position: relative; }
.absolute { position: absolute; }
.inset-0 { inset: 0; }

/* ── Camera / Scanner ──────────────────── */
.scanner-viewfinder {
  position: relative;
  background: #000;
  border-radius: var(--r-xl);
  overflow: hidden;
  aspect-ratio: 4/3;
}
.scanner-viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-box {
  width: 200px; height: 120px;
  border: 2px solid rgba(255,255,255,.85);
  border-radius: var(--r-md);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.4);
  position: relative;
}
.scanner-box::before, .scanner-box::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
  border-color: var(--blue-400);
  border-style: solid;
}
.scanner-box::before { top: -2px; left: -2px; border-width: 3px 0 0 3px; border-radius: var(--r-sm) 0 0 0; }
.scanner-box::after  { bottom: -2px; right: -2px; border-width: 0 3px 3px 0; border-radius: 0 0 var(--r-sm) 0; }
.scanner-hint {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: .625rem;
  text-align: center;
  font-size: .78rem;
  color: rgba(255,255,255,.9);
  background: linear-gradient(transparent, rgba(0,0,0,.6));
}

/* ── Photo Upload Zone ─────────────────── */
.photo-upload {
  aspect-ratio: 4/3;
  background: var(--surface-2);
  border-radius: var(--r-xl);
  border: 2px dashed var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .2s var(--ease);
  color: var(--text-muted);
  gap: .5rem;
}
.photo-upload:hover { border-color: var(--purple-400); background: var(--purple-50); color: var(--purple-400); }
.dark .photo-upload:hover { background: rgba(168,85,247,.1); }
.photo-upload i { font-size: 2rem; }
.photo-upload span { font-size: .875rem; font-weight: 500; }

/* ── History Group ─────────────────────── */
.history-group { background: var(--surface); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow); }
.history-group-header {
  background: var(--surface-2);
  padding: .625rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.history-group-header .day-total { color: var(--orange-500); font-weight: 700; }
.history-meal-row {
  padding: .875rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--border);
}

/* ── Settings Profile Card ─────────────── */
.profile-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--blue-500), var(--purple-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.75rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  flex-shrink: 0;
}

/* ── Swipe Support ─────────────────────── */
.swipe-container { touch-action: pan-y; }
