/* ══════════════════════════════════════════════════════════════════ */
/*  PRECISION_FUEL  —  Design System                                 */
/*  Dark futuristic theme · Neon lime accents · Glassmorphism        */
/* ══════════════════════════════════════════════════════════════════ */

/* ── ROOT VARIABLES ───────────────────────────────────────────────── */
:root {
  --bg-primary:   #060606;
  --bg-secondary: #0e0e0e;
  --bg-card:      #141414;
  --bg-elevated:  #1a1a1a;
  --bg-input:     #111111;
  --bg-glass:     rgba(20, 20, 20, 0.75);

  --accent:       #CCFF00;
  --accent-dim:   #a3cc00;
  --accent-muted: rgba(204,255,0,0.12);
  --accent-glow:  rgba(204,255,0,0.25);

  --text-primary:   #f0f0f0;
  --text-secondary: #999999;
  --text-muted:     #555555;
  --text-dim:       #333333;

  --clr-protein: #CCFF00;
  --clr-carbs:   #00E5FF;
  --clr-fat:     #FF3D71;

  --clr-breakfast: #CCFF00;
  --clr-lunch:     #00E5FF;
  --clr-dinner:    #FF6B35;
  --clr-snack:     #B388FF;

  --border:       #1a1a1a;
  --border-light: #2a2a2a;

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --shadow-card: 0 4px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 24px rgba(204,255,0,0.18);

  --font-ui:   'Space Grotesk', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  --ease: cubic-bezier(.4,0,.2,1);
  --header-h: 60px;
  --nav-h: 72px;
}

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

html {
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* ── SCROLLBAR ────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 4px; }

/* ── UTILITIES ────────────────────────────────────────────────────── */
.hidden { display: none !important; }
.accent { color: var(--accent); }

/* ── VIEWS ────────────────────────────────────────────────────────── */
.view {
  display: none;
  min-height: 100dvh;
}
.view.active { display: flex; flex-direction: column; }

/* Sections within app */
.section {
  display: none;
  padding: 20px 20px 24px;
  animation: fadeSlideUp .4s var(--ease) both;
}
.section.active { display: block; }

@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ══════════════════════════════════════════════════════════════════ */
/*  AUTH VIEW                                                        */
/* ══════════════════════════════════════════════════════════════════ */
#auth-view {
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  position: relative;
  overflow: hidden;
}

.auth-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(204,255,0,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(204,255,0,0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.auth-wrapper {
  width: 100%;
  max-width: 400px;
  padding: 40px 28px;
  position: relative;
  z-index: 1;
}

.auth-header {
  text-align: center;
  margin-bottom: 40px;
}

.auth-logo-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  background: var(--accent);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: var(--bg-primary);
  box-shadow: var(--shadow-glow);
  animation: logoGlow 3s ease-in-out infinite alternate;
}

@keyframes logoGlow {
  from { box-shadow: 0 0 20px rgba(204,255,0,0.2); }
  to   { box-shadow: 0 0 40px rgba(204,255,0,0.45), 0 0 80px rgba(204,255,0,0.1); }
}

.auth-logo-text {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--text-primary);
}

.auth-tagline {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 3px;
  margin-top: 8px;
}

/* Auth Toggle */
.auth-toggle {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 4px;
  margin-bottom: 32px;
  position: relative;
}

.auth-toggle-btn {
  flex: 1;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  border-radius: var(--radius-xs);
  transition: color .3s var(--ease);
  z-index: 1;
  position: relative;
}

.auth-toggle-btn.active { color: var(--bg-primary); }

.auth-toggle-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 4px);
  height: calc(100% - 8px);
  background: var(--accent);
  border-radius: var(--radius-xs);
  transition: transform .3s var(--ease);
}

.auth-toggle-indicator.right {
  transform: translateX(100%);
}

/* Auth Form */
.auth-form { display: flex; flex-direction: column; gap: 20px; }

.signup-fields {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height .4s var(--ease), opacity .3s var(--ease);
}

.signup-fields.show {
  max-height: 2200px;
  opacity: 1;
}

/* Sign-up card wizard */
.auth-form--signup-cards .auth-submit {
  display: none !important;
}

.signup-wizard-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.signup-wizard-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent);
}

.signup-card-dots {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.signup-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border-light);
  transition: background .25s, transform .25s;
}

.signup-dot.is-active {
  background: var(--accent);
  transform: scale(1.25);
  box-shadow: 0 0 10px rgba(204, 255, 0, 0.35);
}

.signup-dot.is-done {
  background: var(--text-muted);
}

.signup-card-viewport {
  position: relative;
  min-height: 280px;
}

.auth-card {
  display: none;
  padding: 20px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
}

.auth-card.is-active {
  display: block;
  animation: authCardIn 0.35s var(--ease) both;
}

@keyframes authCardIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.auth-card-title {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  margin: 0 0 8px;
  line-height: 1.3;
}

.auth-card-lead {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  /* Must stay readable on --bg-card (#141414); avoid --text-dim (#333) here */
  color: #b0b0b0;
  margin: 0 0 18px;
}

.signup-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
}

.signup-actions[hidden] {
  display: none !important;
}

.signup-actions-back,
.signup-actions-next {
  flex: 1;
  min-width: 0;
}

.signup-actions-next i {
  font-size: 13px;
}

.auth-activity-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-activity-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
  transition: border-color .2s, background .2s, color .2s;
}

.auth-activity-card > i {
  font-size: 20px;
  width: 28px;
  text-align: center;
  color: #8a8a8a;
  flex-shrink: 0;
}

.auth-activity-card-title {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--text-primary);
}

.auth-activity-card-desc {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: #9a9a9a;
  margin-top: 2px;
  letter-spacing: 0.3px;
  line-height: 1.35;
}

.auth-activity-card:hover {
  border-color: var(--accent-muted);
}

.auth-activity-card.active {
  border-color: var(--accent);
  background: var(--accent-muted);
  color: var(--text-primary);
}

.auth-activity-card.active > i {
  color: var(--accent);
}

.auth-activity-card.active .auth-activity-card-desc {
  color: #d4d4c8;
}

.auth-activity-card.active .auth-activity-card-title {
  color: var(--text-primary);
}

.auth-goal-row--cards {
  flex-direction: column;
}

.auth-goal-row--cards .auth-goal-chip {
  width: 100%;
  padding: 16px 14px;
  font-size: 12px;
}

.signup-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--accent);
  margin: 4px 0 0;
}

.form-row-auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 420px) {
  .form-row-auth {
    grid-template-columns: 1fr;
  }
}

.auth-goal-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.auth-goal-chip {
  flex: 1;
  min-width: 0;
  padding: 12px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-align: center;
  color: var(--text-secondary);
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}

.auth-goal-chip:hover {
  border-color: var(--accent-muted);
  color: var(--text-primary);
}

.auth-goal-chip.active {
  border-color: var(--accent);
  color: var(--bg-primary);
  background: var(--accent);
  box-shadow: var(--shadow-glow);
}

.label-hint {
  font-weight: 400;
  letter-spacing: 0.5px;
  color: #9a9a9a;
  text-transform: none;
}

.signup-cal-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #a8a8a8;
  line-height: 1.45;
  margin: 0;
}

/* Wizard-only: form labels on dark card */
#signup-fields .form-group label {
  color: #c4c4c4;
}

.form-group { display: flex; flex-direction: column; gap: 8px; }

.form-group label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 16px;
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease);
}

.input-wrapper i {
  color: var(--text-dim);
  font-size: 14px;
  flex-shrink: 0;
  transition: color .3s var(--ease);
}

.input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.input-wrapper:focus-within i { color: var(--accent); }

.input-wrapper input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 0.5px;
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
  font-style: italic;
}

.input-wrapper select {
  flex: 1;
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  padding: 14px 0;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.3px;
  cursor: pointer;
}

.input-wrapper select option {
  background: var(--bg-primary);
  color: var(--text-primary);
}

/* Primary Button */
.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 24px;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: var(--radius-sm);
  transition: all .3s var(--ease);
  box-shadow: var(--shadow-glow);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255,255,255,0.15) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform .6s var(--ease);
}

.btn-primary:hover::after { transform: translateX(100%); }
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 32px rgba(204,255,0,0.35);
}
.btn-primary:active { transform: scale(.97); }

.btn-primary:disabled {
  opacity: 0.5;
  pointer-events: none;
}

/* Outline Button */
.btn-outline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 24px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 1.5px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  transition: all .3s var(--ease);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-muted);
}

/* Auth Error */
.auth-error {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--clr-fat);
  text-align: center;
  min-height: 18px;
  letter-spacing: 0.5px;
}

/* Save-meal gate (sign-in overlay while scan results stay open underneath) */
.auth-gate-notice {
  width: 100%;
  max-width: 400px;
  margin: 0 auto 20px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(204, 255, 0, 0.25);
  background: rgba(204, 255, 0, 0.06);
  text-align: center;
}
.auth-gate-notice.hidden {
  display: none !important;
}
.auth-gate-notice-title {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--accent);
  margin: 0 0 8px;
}
.auth-gate-notice-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 12px;
}
.auth-gate-cancel {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.auth-gate-cancel:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
}

#auth-view.auth-view--overlay {
  position: fixed;
  inset: 0;
  z-index: 3000;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

body.auth-gate-open #app-view {
  pointer-events: none;
  user-select: none;
}

/* ══════════════════════════════════════════════════════════════════ */
/*  APP LAYOUT                                                       */
/* ══════════════════════════════════════════════════════════════════ */
#app-view {
  background: var(--bg-primary);
  position: relative;
}

.app-content {
  flex: 1;
  padding-top: var(--header-h);
  padding-bottom: var(--nav-h);
  overflow-y: auto;
  min-height: calc(100dvh - var(--header-h) - var(--nav-h));
}

/* ── HEADER ───────────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 0 20px;
  background: rgba(6,6,6,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 200;
}

.header-side {
  width: 40px;
  height: 40px;
}

.header-side--end {
  justify-self: end;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.header-install-btn.hidden {
  display: none !important;
}

.header-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 18px;
  border-radius: var(--radius-sm);
  transition: color .2s;
}
.header-btn:hover { color: var(--accent); }

/* Ask AI modal */
.ai-chat-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 9999;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.ai-chat-modal {
  width: min(820px, 100%);
  max-height: min(86dvh, 720px);
  display: flex;
  flex-direction: column;
  background: rgba(14,14,14,0.92);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  box-shadow: 0 18px 80px rgba(0,0,0,0.65);
  overflow: hidden;
}
.ai-chat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 14px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.ai-chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--accent);
}
.ai-chat-chip {
  margin-left: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(204,255,0,0.12);
  border: 1px solid rgba(204,255,0,0.22);
  color: var(--text-primary);
  letter-spacing: 2px;
  font-size: 10px;
}
.ai-chat-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  color: var(--text-primary);
}
.ai-chat-cards {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  overflow-x: auto;
}
.ai-range-card {
  flex: 0 0 auto;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.09);
  background: rgba(255,255,255,0.03);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 1.5px;
}
.ai-range-card.active {
  background: rgba(204,255,0,0.10);
  border-color: rgba(204,255,0,0.26);
  color: var(--text-primary);
}
.ai-chat-messages {
  padding: 14px;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.ai-msg {
  max-width: 92%;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
}
.ai-msg--user {
  align-self: flex-end;
  background: rgba(0,229,255,0.06);
  border-color: rgba(0,229,255,0.16);
}
.ai-msg--ai {
  align-self: flex-start;
  background: rgba(204,255,0,0.06);
  border-color: rgba(204,255,0,0.16);
}
.ai-msg-text {
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.35;
}
.ai-chat-form {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(6,6,6,0.35);
}
.ai-chat-input {
  flex: 1;
  height: 44px;
  border-radius: 12px;
  padding: 0 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.10);
  color: var(--text-primary);
  outline: none;
}
.ai-chat-input:focus {
  border-color: rgba(204,255,0,0.35);
  box-shadow: 0 0 0 3px rgba(204,255,0,0.08);
}
.ai-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(204,255,0,0.12);
  border: 1px solid rgba(204,255,0,0.25);
  color: var(--text-primary);
}

.header-logo {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-align: center;
  justify-self: center;
}

/* ── DATE NAV ─────────────────────────────────────────────────────── */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 0 20px;
  position: relative;
}

.date-arrow {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all .2s var(--ease);
}
.date-arrow:hover { border-color: var(--accent); color: var(--accent); }

.date-display {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.date-pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px 8px 16px;
  min-height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  transition: border-color .25s var(--ease), box-shadow .25s var(--ease), background .25s var(--ease);
}

.date-pill:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
  background: var(--bg-elevated);
}

.date-pill:active {
  transform: scale(0.98);
}

.date-cal-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 14px;
  opacity: 0.9;
}

.date-picker-input-hidden {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 48px;
  height: 48px;
  opacity: 0.02;
  margin: 0;
  padding: 0;
  border: 0;
}

/* ── CALORIE RING ─────────────────────────────────────────────────── */
.calorie-ring-container {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 8px auto 32px;
}

.calorie-ring {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.ring-progress {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 565.48;   /* 2π × 90 */
  stroke-dashoffset: 565.48;
  transition: stroke-dashoffset 1.2s var(--ease);
}

.calorie-ring-info {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ring-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ring-value {
  font-family: var(--font-ui);
  font-size: 52px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1px;
}

.ring-target {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
  letter-spacing: 1px;
}

/* ── MACRO CARDS ──────────────────────────────────────────────────── */
.macro-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 36px;
}

.macro-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 14px 14px;
  text-align: center;
  transition: border-color .3s var(--ease);
}

.macro-card:hover { border-color: var(--border-light); }

.macro-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 8px;
}

.macro-value-row {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  margin-bottom: 12px;
}

.macro-value {
  font-family: var(--font-ui);
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.macro-value-row sub {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.macro-bar {
  height: 4px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.macro-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 1s var(--ease);
  width: 0%;
}

.protein-fill { background: var(--clr-protein); }
.carbs-fill   { background: var(--clr-carbs); }
.fat-fill     { background: var(--clr-fat); }

/* ── TIMELINE ─────────────────────────────────────────────────────── */
.timeline-section { margin-top: 4px; }

.timeline-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
}

.timeline-title {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 1px;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 1px;
  font-weight: 600;
}

.timeline { display: flex; flex-direction: column; gap: 12px; }

.timeline-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.timeline-empty i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.2;
}

.timeline-empty p {
  font-size: 16px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.timeline-empty span {
  font-size: 13px;
  opacity: 0.5;
}

/* Timeline Entry */
.timeline-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all .3s var(--ease);
  position: relative;
  overflow: hidden;
  animation: fadeSlideUp .4s var(--ease) both;
}

.timeline-entry:hover {
  border-color: var(--border-light);
  transform: translateX(4px);
}

.timeline-entry-thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.timeline-entry-thumb-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 22px;
  color: var(--text-dim);
}

.timeline-entry-body { flex: 1; min-width: 0; }

.timeline-entry-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  margin-bottom: 4px;
  display: inline-block;
}

.timeline-entry-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.timeline-entry-insight {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-entry-right {
  text-align: right;
  flex-shrink: 0;
  padding-left: 8px;
}

.timeline-entry-cal {
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  display: block;
}

.timeline-entry-unit {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 2px;
  font-weight: 600;
}

.timeline-entry-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--text-dim);
  border-radius: var(--radius-xs);
  opacity: 0;
  transition: all .2s;
}
.timeline-entry:hover .timeline-entry-delete { opacity: 1; }
.timeline-entry-delete:hover { color: var(--clr-fat); background: rgba(255,61,113,0.1); }

/* Tag colors */
.tag-breakfast { color: var(--clr-breakfast); }
.tag-lunch     { color: var(--clr-lunch); }
.tag-dinner    { color: var(--clr-dinner); }
.tag-snack     { color: var(--clr-snack); }

/* ── LOG DETAIL / NUTRITION FACTS ─────────────────────────────────── */
.log-detail-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}
.log-detail-hero img {
  width: 100%;
  max-height: 38vh;
  object-fit: cover;
  display: block;
}
.log-detail-hero .log-detail-meta {
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-end;
}
.log-detail-chip {
  background: rgba(0,0,0,0.6);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 1px;
  color: var(--text-secondary);
}
.nf-card {
  background: #0b0b0b;
  border: 2px solid #eaeaea;
  border-radius: 10px;
  padding: 14px;
  color: #eaeaea;
  margin: 16px 0 20px;
}
.nf-title {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: .5px;
  margin-bottom: 6px;
}
.nf-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.85;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.nf-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(234,234,234,0.2);
  padding: 8px 0;
  font-family: var(--font-mono);
  font-size: 12px;
}
.nf-row strong { color: #fff; }
.nf-cal {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 3px solid #eaeaea;
  border-bottom: 6px solid #eaeaea;
  padding: 10px 0;
  margin: 10px 0;
}
.nf-cal .kcal {
  font-family: var(--font-ui);
  font-size: 34px;
  font-weight: 900;
  color: #fff;
}
.nf-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}
.qty-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 12px;
  margin: 14px 0;
}
.qty-stepper .label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--text-muted);
}
.qty-stepper .controls {
  display: flex;
  align-items: center;
  gap: 10px;
}
.qty-stepper button {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 14px;
}
.qty-stepper .val {
  min-width: 34px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 800;
  color: var(--accent);
}

/* ══════════════════════════════════════════════════════════════════ */
/*  SCANNER                                                          */
/* ══════════════════════════════════════════════════════════════════ */

/* Camera View */
.camera-view {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.scan-library-hint {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 1px;
  padding: 4px 8px 0;
  line-height: 1.5;
}

.camera-view.preview-active .camera-feed-wrapper,
.camera-view.preview-active .camera-status,
.camera-view.preview-active .camera-controls,
.camera-view.preview-active .scan-library-hint {
  display: none;
}

.camera-feed-wrapper.drag-over {
  box-shadow: inset 0 0 0 2px var(--accent);
  border-radius: var(--radius-lg);
}

.camera-feed-wrapper {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  max-height: 60vh;
  min-height: 220px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.camera-feed-wrapper video {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 100%;
  min-height: 100%;
  object-fit: cover;
  background: #000;
}

/* Scan Overlay (brackets + crosshair) */
.scan-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scan-bracket {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--accent);
  border-style: solid;
}

.scan-bracket.tl { top: 16px; left: 16px;   border-width: 2px 0 0 2px; }
.scan-bracket.tr { top: 16px; right: 16px;  border-width: 2px 2px 0 0; }
.scan-bracket.bl { bottom: 16px; left: 16px;  border-width: 0 0 2px 2px; }
.scan-bracket.br { bottom: 16px; right: 16px; border-width: 0 2px 2px 0; }

.scan-crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  transform: translate(-50%, -50%);
}

.scan-crosshair::before, .scan-crosshair::after {
  content: '';
  position: absolute;
  background: var(--accent);
  opacity: 0.5;
}

.scan-crosshair::before { width: 1px; height: 100%; left: 50%; top: 0; }
.scan-crosshair::after  { height: 1px; width: 100%; top: 50%; left: 0; }

/* Camera Status */
.camera-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  padding: 0 4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-dim);
}

.status-dot.live {
  background: var(--accent);
  animation: statusPulse 1.5s ease infinite;
}

@keyframes statusPulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 var(--accent-glow); }
  50%      { opacity: 0.6; box-shadow: 0 0 0 6px transparent; }
}

/* Camera Controls */
.camera-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  padding: 8px 0;
}

.camera-controls--dual {
  justify-content: center;
  gap: 56px;
}

.cam-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  transition: all .2s var(--ease);
}

.cam-btn:hover { border-color: var(--accent); color: var(--accent); }

.cam-btn.capture {
  width: 64px;
  height: 64px;
  background: transparent;
  border: 3px solid var(--text-primary);
  position: relative;
}

.capture-ring {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--text-primary);
  transition: all .15s;
}

.cam-btn.capture:hover .capture-ring { background: var(--accent); }
.cam-btn.capture:active .capture-ring { transform: scale(.85); }

/* Upload View */
.upload-view { position: relative; }

.upload-area {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-xl);
  padding: 60px 24px;
  text-align: center;
  transition: all .3s var(--ease);
}

.upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.upload-icon-ring {
  width: 80px;
  height: 80px;
  margin: 0 auto 24px;
  border: 2px solid var(--border-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: var(--accent);
}

.upload-area h3 {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.upload-area p {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.5;
}

.upload-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim) !important;
  letter-spacing: 1px;
  margin-top: 16px !important;
  margin-bottom: 0 !important;
}

/* Upload Preview */
.upload-preview {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.preview-image-container {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg-card);
}

.preview-image-container img {
  width: 100%;
  max-height: 50vh;
  object-fit: contain;
  display: block;
}

.preview-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── ANALYZING OVERLAY ────────────────────────────────────────────── */
.analyzing-overlay {
  position: relative;
  animation: fadeSlideUp .4s var(--ease) both;
}

.analyzing-image-wrap {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 20px;
}

.analyzing-image-wrap img {
  width: 100%;
  max-height: 45vh;
  object-fit: contain;
  display: block;
}

/* Scan line animation */
.scan-line-anim {
  position: absolute;
  left: 16px;
  right: 16px;
  height: 2px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent), 0 0 36px var(--accent-glow);
  animation: scanLine 2.4s linear infinite;
}

@keyframes scanLine {
  0%   { top: 16px;  opacity: 1; }
  90%  { top: calc(100% - 16px); opacity: 1; }
  100% { top: calc(100% - 16px); opacity: 0; }
}

.analyzing-status-panel {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 16px;
}

.analyzing-icon-box {
  width: 44px;
  height: 44px;
  background: var(--accent-muted);
  border: 1px solid rgba(204,255,0,0.2);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 18px;
  flex-shrink: 0;
}

.analyzing-info h3 {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-bottom: 6px;
}

.analyzing-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  line-height: 1.5;
}

.analyzing-progress-track {
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 12px;
}

.analyzing-progress-bar {
  height: 100%;
  width: 30%;
  background: var(--accent);
  border-radius: 3px;
  animation: indeterminate 1.5s var(--ease) infinite;
}

@keyframes indeterminate {
  0%   { transform: translateX(-150%); width: 30%; }
  50%  { width: 50%; }
  100% { transform: translateX(450%); width: 30%; }
}

.analyzing-bio-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  letter-spacing: 2px;
}

.blink { animation: blink 1s step-end infinite; }
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

/* ══════════════════════════════════════════════════════════════════ */
/*  RESULTS                                                          */
/* ══════════════════════════════════════════════════════════════════ */
.results-container { animation: fadeSlideUp .5s var(--ease) both; }

.results-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}

.results-hero img {
  width: 100%;
  max-height: 40vh;
  object-fit: contain;
  display: block;
}

.results-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: var(--accent);
  color: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
}

.results-food-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.results-food-label {
  position: absolute;
  background: rgba(0,0,0,0.7);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1px;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  white-space: nowrap;
}

.results-food-label::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

/* Results Header */
.results-meal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 4px;
}

.results-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 1px;
  font-weight: 600;
  margin-bottom: 8px;
}

.results-status .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.results-meal-name {
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  display: inline;
}

.results-total-cal {
  font-family: var(--font-ui);
  font-size: 36px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  flex-shrink: 0;
}

.results-total-cal sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 2px;
  vertical-align: baseline;
  margin-left: 2px;
}

/* Results Macros Row */
.results-macros {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 24px 0;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.results-macro-item {
  text-align: center;
}

.results-macro-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
}

.results-macro-val {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.results-macro-val sub {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}

/* Micronutrients & lipid detail (scan results + log detail) */
.results-micro-wrap {
  margin: 0 0 20px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.results-micro-wrap.hidden {
  display: none;
}
.results-micro-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  color: var(--accent);
}
.results-micro-head span {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
}
.nf-micro-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.nf-micro-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}
.nf-micro-row:first-of-type {
  border-top: none;
  padding-top: 0;
}
.nf-micro-name {
  opacity: 0.92;
}
.nf-micro-val {
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
}
.nf-card .nf-micro-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(234, 234, 234, 0.15);
}
.nf-card .nf-micro-section .nf-micro-head {
  margin-bottom: 8px;
  color: #ccff00;
}
.nf-card .nf-micro-row {
  border-top-color: rgba(234, 234, 234, 0.12);
  color: #ccc;
}
.nf-card .nf-micro-val {
  color: #fff;
}

/* Results Insight Card */
.results-insight {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 24px;
}

.results-insight-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--accent);
}

.results-insight-header i {
  font-size: 16px;
}

.results-insight-header span {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
}

.results-insight p {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  letter-spacing: 0.3px;
}

/* Meal type selector */
.results-meal-type-selector {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.meal-type-btn {
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: all .2s var(--ease);
}

.meal-type-btn.active {
  border-color: var(--accent);
  color: var(--bg-primary);
  background: var(--accent);
}

.meal-type-btn:hover:not(.active) {
  border-color: var(--border-light);
  color: var(--text-secondary);
}

/* Results Food Items List */
.results-foods-list {
  margin-bottom: 24px;
}

.results-foods-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.results-food-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.results-food-item-main {
  flex: 1;
  min-width: 0;
}

.results-food-item-aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

.results-food-serving {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.results-food-serving-label {
  margin-right: 2px;
  text-transform: uppercase;
}

.results-food-serving button {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color .2s, color .2s;
}

.results-food-serving button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.results-food-serving .food-serv-val {
  min-width: 22px;
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  color: var(--accent);
}

.qty-stepper-hint {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.5px;
  margin-top: 4px;
  line-height: 1.4;
}

.results-food-item:last-child { border-bottom: none; }

.results-food-item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.results-food-item-portion {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.results-food-item-cal {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* Results Actions */
.results-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ══════════════════════════════════════════════════════════════════ */
/*  PROFILE                                                          */
/* ══════════════════════════════════════════════════════════════════ */
.profile-container {
  animation: fadeSlideUp .4s var(--ease) both;
}

.profile-guest-card {
  text-align: center;
  padding: 32px 20px 40px;
  max-width: 400px;
  margin: 0 auto;
}
.profile-guest-icon {
  font-size: 48px;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.profile-guest-title {
  font-family: var(--font-mono);
  font-size: 14px;
  letter-spacing: 3px;
  color: var(--accent);
  margin: 0 0 12px;
}
.profile-guest-lead {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.65;
  margin: 0 0 22px;
}

.profile-header {
  text-align: center;
  padding: 20px 0 32px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  margin: 0 auto 16px;
  background: var(--accent);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--bg-primary);
}

.profile-name {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.profile-username {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
  letter-spacing: 1px;
}

/* Profile Stats */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 32px;
}

.profile-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  text-align: center;
}

.profile-stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--accent);
  display: block;
  margin-bottom: 4px;
}

.profile-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  font-weight: 600;
}

/* Profile Settings */
.profile-section-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.profile-hint {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
  margin: -8px 0 16px;
}

.profile-form-row {
  margin-bottom: 0;
}

.profile-form-row .profile-setting {
  margin-bottom: 16px;
}

.profile-recalc-btn {
  width: 100%;
  margin-bottom: 24px;
}

.profile-setting {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.profile-setting label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text-secondary);
}

.profile-setting .input-wrapper {
  background: var(--bg-input);
}

.profile-setting .input-wrapper input,
.profile-setting .input-wrapper select {
  padding: 12px 0;
}

.profile-logout {
  margin-top: 32px;
  width: 100%;
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--clr-fat);
  border: 1px solid rgba(255,61,113,0.2);
  border-radius: var(--radius-sm);
  transition: all .3s var(--ease);
}

.profile-logout:hover {
  background: rgba(255,61,113,0.1);
  border-color: var(--clr-fat);
}

/* ══════════════════════════════════════════════════════════════════ */
/*  FAB                                                              */
/* ══════════════════════════════════════════════════════════════════ */
.fab {
  position: fixed;
  bottom: 92px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-primary);
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 150;
  box-shadow: var(--shadow-glow);
  transition: all .3s var(--ease);
  animation: fabPulse 3s ease-in-out infinite;
}

@keyframes fabPulse {
  0%, 100% { box-shadow: 0 0 20px rgba(204,255,0,0.2); }
  50%      { box-shadow: 0 0 36px rgba(204,255,0,0.45); }
}

.fab:hover { transform: scale(1.1) rotate(90deg); }
.fab:active { transform: scale(.95); }

.fab.fab-hidden { transform: scale(0); pointer-events: none; }

/* ══════════════════════════════════════════════════════════════════ */
/*  BOTTOM NAV                                                       */
/* ══════════════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--nav-h);
  background: rgba(6,6,6,0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: space-around;
  border-top: 1px solid var(--border);
  z-index: 200;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-dim);
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: 600;
  letter-spacing: 1px;
  position: relative;
  transition: color .25s var(--ease);
}

.nav-btn i { font-size: 20px; transition: color .25s var(--ease); }

/* Avatar-style initial in bottom nav */
#nav-profile-initial {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.nav-btn.active #nav-profile-initial {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

.nav-btn.active { color: var(--accent); }

.nav-btn.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Special scan button in nav */
.nav-scan-icon {
  width: 42px;
  height: 42px;
  background: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: -16px;
  margin-bottom: 0;
  box-shadow: 0 0 20px rgba(204,255,0,0.25);
  transition: all .25s var(--ease);
}

.nav-scan-icon i {
  color: var(--bg-primary) !important;
  font-size: 18px;
}

.nav-scan-btn:hover .nav-scan-icon {
  box-shadow: 0 0 32px rgba(204,255,0,0.4);
  transform: scale(1.08);
}

.nav-scan-btn.active::after { display: none; }

.nav-scan-icon--capture {
  border: 2px solid var(--text-primary);
  background: transparent;
}

.nav-scan-icon--capture i {
  font-size: 32px !important;
  color: var(--text-primary) !important;
}

.nav-scan-btn.nav-scan-disabled {
  opacity: 0.45;
  pointer-events: none;
}

/* ══════════════════════════════════════════════════════════════════ */
/*  TOAST                                                            */
/* ══════════════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 12px 20px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastIn .4s var(--ease) both;
  min-width: 240px;
  max-width: 90vw;
  box-shadow: var(--shadow-card);
}

.toast.success { border-color: rgba(204,255,0,0.3); }
.toast.success i { color: var(--accent); }

.toast.error { border-color: rgba(255,61,113,0.3); }
.toast.error i { color: var(--clr-fat); }

.toast.removing { animation: toastOut .3s var(--ease) both; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-16px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-16px) scale(0.95); }
}

/* ══════════════════════════════════════════════════════════════════ */
/*  RESPONSIVE                                                       */
/* ══════════════════════════════════════════════════════════════════ */
@media (min-width: 600px) {
  .auth-wrapper { padding: 60px 40px; }
  .app-content { max-width: 560px; margin: 0 auto; }
  .calorie-ring-container { width: 260px; height: 260px; }
}

@media (min-width: 768px) {
  .calorie-ring-container { width: 280px; height: 280px; }
  .macro-cards { gap: 16px; }
}

/* Ensure mobile viewport works */
@supports (height: 100dvh) {
  .view { min-height: 100dvh; }
}
