/*
 * Copyright (c) 2026 diet-dost and/or its contributors.
 * Licensed under the "GNU Affero General Public License v3.0 only" and
 * the "Server Side Public License, v 1"; you may not use this file except
 * in compliance with, at your election, the "GNU Affero General Public
 * License v3.0 only" or the "Server Side Public License, v 1".
 */
:root {
  --canvas-bg: #08090a;
  --surface-card: #0f1012;
  --surface-modal: #141518;
  --surface-subtle: #18191d;
  --surface-hover: #1e2025;
  --border-subtle: #222326;
  --border-hover: #2e3035;
  --accent-brand: #5e6ad2;
  --accent-brand-hover: #707ce6;
  --accent-brand-glow: rgba(94, 106, 210, 0.25);
  --accent: var(--accent-brand);
  --accent-hover: var(--accent-brand-hover);
  --status-emerald: #27c380;
  --status-emerald-bg: rgba(39, 195, 128, 0.12);
  --status-amber: #f5a623;
  --status-amber-bg: rgba(245, 166, 35, 0.12);
  --status-rose: #eb5757;
  --status-rose-bg: rgba(235, 87, 87, 0.12);
  --text-primary: #f7f8f8;
  --text-secondary: #8a8f98;
  --text-muted: #62666d;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 9999px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Geist", "Inter", sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  /* Phase 1 Layer 6 Responsive Breakpoint Tokens */
  --breakpoint-mobile-max: 639px;
  --breakpoint-tablet-min: 640px;
  --breakpoint-tablet-max: 1023px;
  --breakpoint-desktop-min: 1024px;
  --breakpoint-wide-min: 1440px;
}

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

html, body {
  background-color: var(--canvas-bg);
  color: var(--text-primary);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
  padding-top: env(safe-area-inset-top, 0px);
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

@media (max-width: 639px) {
  body {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
}

.tabular {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* App Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background-color: rgba(8, 9, 10, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-badge {
  background: linear-gradient(135deg, var(--accent-brand), #8f98ff);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px var(--accent-brand-glow);
}

.brand-name {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.brand-tag {
  font-size: 0.7rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--accent-brand-hover);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
}

.btn-primary {
  background: var(--accent-brand);
  border-color: var(--accent-brand);
  color: #fff;
  box-shadow: 0 0 12px var(--accent-brand-glow);
}

.btn-primary:hover {
  background: var(--accent-brand-hover);
  border-color: var(--accent-brand-hover);
}

.btn-sm {
  padding: 0.25rem 0.6rem;
  font-size: 0.75rem;
}

.btn-xs {
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

/* Badges & Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
}

.badge-success {
  background: var(--status-emerald-bg);
  color: var(--status-emerald);
  border-color: rgba(39, 195, 128, 0.3);
}

.badge-warning {
  background: var(--status-amber-bg);
  color: var(--status-amber);
  border-color: rgba(245, 166, 35, 0.3);
}

.badge-danger {
  background: var(--status-rose-bg);
  color: var(--status-rose);
  border-color: rgba(235, 87, 87, 0.3);
}

.badge-primary {
  background: rgba(94, 106, 210, 0.15);
  color: var(--accent-brand-hover);
  border-color: rgba(94, 106, 210, 0.35);
}

.progress-delta-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: rgba(94, 106, 210, 0.15);
  color: var(--accent-brand-hover);
  border: 1px solid rgba(94, 106, 210, 0.3);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Container */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Diet Dost Companion Banner */
.companion-card {
  background: linear-gradient(135deg, rgba(94, 106, 210, 0.08) 0%, rgba(15, 16, 18, 0.95) 100%);
  border: 1px solid rgba(94, 106, 210, 0.25);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
}

.companion-avatar {
  font-size: 2.2rem;
  background: var(--surface-modal);
  border: 1px solid rgba(94, 106, 210, 0.3);
  width: 54px;
  height: 54px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(94, 106, 210, 0.2);
}

.companion-content {
  flex: 1;
}

.companion-name {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-brand-hover);
  font-weight: 600;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.companion-speech {
  font-size: 0.98rem;
  color: var(--text-primary);
  line-height: 1.4;
}

.streak-pill {
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.3);
  color: #ffb84d;
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  white-space: nowrap;
}

/* Hero HUD Grid */
.hero-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
}

@media (max-width: 800px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background-color: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color 0.2s ease;
}

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

/* Calorie Big Numbers */
.calorie-hud-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.hud-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  font-weight: 600;
}

.calorie-numbers-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.stat-box-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
}

.stat-box-val {
  font-size: 1.8rem;
  font-weight: 700;
  font-family: var(--font-mono);
  line-height: 1.1;
}

.val-consumed { color: #f7f8f8; }
.val-budget { color: var(--text-secondary); }
.val-remaining { color: var(--status-emerald); }
.val-remaining.over { color: var(--status-rose); }

/* Glowing Progress Bar */
.progress-container {
  margin-bottom: 1.5rem;
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--surface-subtle);
  border-radius: var(--radius-pill);
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-brand), var(--status-emerald));
  border-radius: var(--radius-pill);
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 12px var(--accent-brand-glow);
}

.progress-bar-fill.warning {
  background: linear-gradient(90deg, var(--accent-brand), var(--status-amber));
}

.progress-bar-fill.over {
  background: linear-gradient(90deg, var(--status-amber), var(--status-rose));
}

/* Macro Pill Gauges */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}

@media (max-width: 600px) {
  .macro-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.macro-pill {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
}

.macro-pill-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.macro-pill-val {
  font-family: var(--font-mono);
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.macro-meter {
  width: 100%;
  height: 5px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.macro-meter-fill {
  height: 100%;
  background: var(--accent-brand);
  border-radius: var(--radius-pill);
  transition: width 0.5s ease;
}

.macro-meter-fill.protein { background: #38bdf8; }
.macro-meter-fill.carbs { background: #fbbf24; }
.macro-meter-fill.fat { background: #f87171; }
.macro-meter-fill.fiber { background: #4ade80; }

/* Clinical Side Card */
.clinical-hud-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.health-score-container {
  text-align: center;
  padding: 1rem 0;
}

.score-circle {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  margin: 0 auto 0.75rem auto;
  border: 6px solid var(--border-subtle);
  border-top-color: var(--status-emerald);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px rgba(39, 195, 128, 0.15);
}

.score-val {
  font-size: 1.8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--status-emerald);
  line-height: 1;
}

.score-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted);
}

.badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 1rem;
}

.badge-chip {
  font-size: 0.75rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  color: var(--text-primary);
}

/* Logging Area */
.logging-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.logging-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mode-switcher {
  display: flex;
  background: var(--surface-subtle);
  padding: 3px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
}

.mode-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.mode-btn.active {
  background: var(--surface-modal);
  color: var(--text-primary);
  font-weight: 600;
}

/* Photo Dropzone */
.dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.01);
  transition: all 0.2s ease;
  position: relative;
}

.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent-brand);
  background: rgba(94, 106, 210, 0.04);
}

.dropzone-icon {
  font-size: 2.8rem;
  margin-bottom: 0.75rem;
  display: block;
}

.dropzone-text {
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.dropzone-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Scanning Shimmer */
.scanning-state {
  padding: 2.5rem 1.5rem;
  text-align: center;
  display: none;
}

.shimmer-bar {
  width: 60%;
  height: 6px;
  margin: 1.5rem auto;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--surface-subtle) 0%, var(--accent-brand) 50%, var(--surface-subtle) 100%);
  background-size: 200% 100%;
  animation: shimmerAnim 1.5s infinite linear;
}

@keyframes shimmerAnim {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Text / Voice Logger */
.text-logger-box {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.search-input-wrapper {
  position: relative;
  display: flex;
  gap: 0.5rem;
}

.text-input {
  flex: 1;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  border-color: var(--accent-brand);
}

/* Quick Suggestion Pills */
.suggestion-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.suggest-chip {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
}

.suggest-chip:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* Review & Progress Modals */
.modal-overlay,
.review-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  z-index: 100010;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  overflow: hidden;
}

body.modal-open .mobile-bottom-nav {
  display: none !important;
}

.review-card {
  background: var(--surface-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 920px;
  width: 100%;
  max-height: min(90vh, 780px);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.7);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  overflow: hidden;
  min-width: 0;
}

.review-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--surface-modal);
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  z-index: 15;
}

.review-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
  gap: 1rem;
}

.confidence-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-weight: 600;
}

.confidence-pass {
  background: var(--status-emerald-bg);
  border: 1px solid rgba(39, 195, 128, 0.3);
  color: var(--status-emerald);
}

.confidence-fail {
  background: var(--status-rose-bg);
  border: 1px solid rgba(235, 87, 87, 0.3);
  color: var(--status-rose);
}

/* Two-column layout on desktop, single column on mobile */
.review-body-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1.25rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.review-body-layout.no-photo {
  grid-template-columns: 240px 1fr;
}

.review-media-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
  overflow-y: auto;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

.review-details-column {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
}

/* AI Detection Feedback & Model Retraining Bar */
.ai-feedback-bar {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.65rem 0.85rem;
  background: rgba(99, 102, 241, 0.05);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.ai-feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ai-feedback-label {
  font-size: 0.76rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.ai-feedback-buttons {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.btn-feedback-thumb {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-feedback-thumb:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-feedback-thumb.active-up {
  background: rgba(39, 195, 128, 0.15);
  border-color: rgba(39, 195, 128, 0.5);
  color: var(--status-emerald);
  box-shadow: 0 0 10px rgba(39, 195, 128, 0.25);
}

.btn-feedback-thumb.active-down {
  background: rgba(235, 87, 87, 0.15);
  border-color: rgba(235, 87, 87, 0.5);
  color: var(--status-rose);
  box-shadow: 0 0 10px rgba(235, 87, 87, 0.25);
}

.ai-feedback-remarks-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
}

.feedback-remarks-field {
  flex: 1;
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-base);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.feedback-remarks-field:focus {
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.feedback-remarks-field::placeholder {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.btn-feedback-submit {
  font-size: 0.72rem;
  padding: 5px 10px;
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  border-radius: var(--radius-sm);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-feedback-submit:hover {
  background: rgba(99, 102, 241, 0.35);
  color: #e0e7ff;
}

.feedback-retrain-status {
  font-size: 0.72rem;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: rgba(39, 195, 128, 0.1);
  border: 1px solid rgba(39, 195, 128, 0.3);
  color: var(--status-emerald);
  animation: fadeIn 0.3s ease;
}

/* Sleek Dark Scrollbars across app & modals */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
}

*::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.35);
}

*::-webkit-scrollbar-button {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
}

/* Uploaded Meal Photo Evidence in Review Modal */
.review-photo-container {
  width: 100%;
  flex-shrink: 0;
  min-width: 0;
}

.review-photo-wrapper {
  position: relative;
  width: 100%;
  height: clamp(140px, 26vh, 210px);
  max-height: 210px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: radial-gradient(circle at center, #15171d 0%, #08090a 100%);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.review-photo-wrapper:hover {
  border-color: var(--accent-brand);
}

.review-meal-img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto;
  user-select: none;
  transition: transform 0.2s ease;
}

.review-photo-wrapper:hover .review-meal-img {
  transform: scale(1.02);
}

.review-photo-overlay-top {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 2;
  pointer-events: none;
}

.review-photo-badge {
  background: rgba(8, 9, 10, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.review-photo-zoom-btn {
  pointer-events: auto;
  background: rgba(8, 9, 10, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.review-photo-zoom-btn:hover {
  background: var(--accent-brand);
  border-color: var(--accent-brand-hover);
  color: #fff;
  transform: translateY(-1px);
}

.review-photo-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 6px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(8, 9, 10, 0.88) 100%);
  font-size: 0.68rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
  pointer-events: none;
}

.review-dietitian-box {
  background: var(--surface-subtle);
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--text-secondary);
  transition: all 0.3s ease;
}

.review-dietitian-box.advice-updated {
  border-color: rgba(39, 195, 128, 0.6);
  background: rgba(39, 195, 128, 0.08);
  box-shadow: 0 0 12px rgba(39, 195, 128, 0.15);
}

/* Pinned Modal Footer */
.review-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
  background: var(--surface-modal);
}

/* Lightbox Fullscreen Modal */
.review-lightbox-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(4, 5, 7, 0.92);
  backdrop-filter: blur(12px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.review-lightbox-frame {
  max-width: min(94vw, 1000px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
}

.review-lightbox-topbar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.review-lightbox-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary);
}

.review-lightbox-close {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.review-lightbox-close:hover {
  background: var(--status-rose);
  border-color: var(--status-rose);
  color: #fff;
}

.review-lightbox-image-container {
  max-width: 100%;
  max-height: 78vh;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #08090a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85);
}

.review-lightbox-image-container img {
  max-width: 90vw;
  max-height: 76vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.review-lightbox-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (max-width: 819px) {
  .review-card {
    max-width: 95vw;
    max-height: 94vh;
    padding: 1rem;
    gap: 0.75rem;
  }

  .review-body-layout,
  .review-body-layout.no-photo {
    grid-template-columns: 1fr;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .review-photo-wrapper {
    height: clamp(120px, 20vh, 160px);
    max-height: 160px;
  }

  .review-media-column {
    overflow-y: visible;
    padding-right: 0;
  }

  .review-details-column {
    overflow-y: visible;
    padding-right: 0;
  }
}

.dish-items-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item-row {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-info-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.15rem;
}

.item-info-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.review-macro-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: rgba(18, 19, 24, 0.85);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.55rem 0.85rem;
  backdrop-filter: blur(12px);
  margin-bottom: 0.25rem;
  flex-wrap: wrap;
}

.macro-stat-chip {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-sm);
  flex: 1;
  min-width: 80px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.macro-stat-chip:hover {
  background: rgba(255, 255, 255, 0.06);
}

.macro-stat-chip .macro-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.macro-stat-chip .macro-val {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
  transition: transform 0.2s ease, color 0.2s ease;
}

.macro-stat-chip.macro-stat-kcal {
  border-color: rgba(251, 146, 60, 0.3);
  background: rgba(251, 146, 60, 0.06);
}
.macro-stat-chip.macro-stat-kcal .macro-val {
  color: #fb923c;
}

.macro-stat-chip.macro-stat-protein {
  border-color: rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.06);
}
.macro-stat-chip.macro-stat-protein .macro-val {
  color: #38bdf8;
}

.macro-stat-chip.macro-stat-carbs {
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.06);
}
.macro-stat-chip.macro-stat-carbs .macro-val {
  color: #fbbf24;
}

.macro-stat-chip.macro-stat-fat {
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.06);
}
.macro-stat-chip.macro-stat-fat .macro-val {
  color: #f87171;
}

.macro-stat-chip.macro-stat-fiber {
  border-color: rgba(52, 211, 153, 0.3);
  background: rgba(52, 211, 153, 0.06);
}
.macro-stat-chip.macro-stat-fiber .macro-val {
  color: #34d399;
}

.macro-stat-chip.macro-stat-sugar {
  border-color: rgba(244, 114, 182, 0.3);
  background: rgba(244, 114, 182, 0.06);
}
.macro-stat-chip.macro-stat-sugar .macro-val {
  color: #f472b6;
}

@keyframes macroPulse {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.05); filter: brightness(1.3); }
  100% { transform: scale(1); filter: brightness(1); }
}

.macro-val-pulse {
  animation: macroPulse 0.35s ease-out;
}

/* Item row & portion input styles */
.item-row-editable {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 0.5rem;
  gap: 0.75rem;
  transition: border-color 0.2s ease;
}

.item-row-editable:hover {
  border-color: var(--border-hover);
}

.item-edit-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.item-inputs-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.item-name-input {
  flex: 1.5;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-weight: 600;
  padding: 5px 8px;
  outline: none;
  transition: all 0.2s ease;
}

.item-name-input:focus {
  border-color: var(--accent-brand);
  background: rgba(255, 255, 255, 0.07);
}

.portion-input-wrap {
  flex: 1.1;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0 8px;
  transition: all 0.2s ease;
}

.portion-input-wrap:focus-within {
  border-color: #38bdf8;
  background: rgba(56, 189, 248, 0.06);
}

.portion-input-wrap .portion-icon {
  font-size: 0.72rem;
  margin-right: 5px;
  color: var(--text-muted);
}

.item-portion-input {
  width: 100%;
  background: transparent;
  border: none;
  color: #38bdf8;
  font-size: 0.78rem;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 5px 0;
  outline: none;
}

.item-portion-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  font-weight: 400;
}

.item-edit-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-delete-item {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  opacity: 0.65;
  transition: opacity 0.2s ease, transform 0.15s ease;
}

.btn-delete-item:hover {
  opacity: 1;
  transform: scale(1.1);
}

/* Review Modal Dedicated Food Search by Text Box */
.review-search-bar {
  margin-bottom: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.review-search-bar:focus-within {
  border-color: rgba(94, 106, 210, 0.5);
  box-shadow: 0 0 12px rgba(94, 106, 210, 0.15);
  background: rgba(94, 106, 210, 0.03);
}

.review-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.review-search-icon {
  font-size: 0.95rem;
  opacity: 0.7;
}

.review-search-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.84rem;
  padding: 6px 10px;
  outline: none;
  transition: all 0.18s ease;
}

.review-search-input:focus {
  border-color: var(--accent-brand);
  background: rgba(255, 255, 255, 0.07);
}

.btn-review-search-submit {
  white-space: nowrap;
  font-size: 0.76rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.review-search-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}

.review-search-chip {
  cursor: pointer;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  transition: all 0.15s ease;
}

.review-search-chip:hover {
  border-color: var(--accent-brand);
  color: #818cf8;
  background: rgba(94, 106, 210, 0.12);
  transform: translateY(-1px);
}

.btn-item-ai-search {
  background: rgba(94, 106, 210, 0.12);
  border: 1px solid rgba(94, 106, 210, 0.35);
  color: #a5b4fc;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-item-ai-search:hover {
  background: rgba(94, 106, 210, 0.25);
  border-color: #818cf8;
  color: #fff;
  transform: translateY(-1px);
}

.item-ai-searching-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #fbbf24;
  font-size: 0.7rem;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.3);
  padding: 1px 6px;
  border-radius: 4px;
  animation: pulse-glow 1.2s infinite;
}

.item-ai-verified-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #38bdf8;
  font-size: 0.7rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 500;
}

@keyframes pulse-glow {
  0%, 100% { opacity: 0.65; transform: scale(0.99); }
  50% { opacity: 1; transform: scale(1.01); }
}

.portion-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
}

.step-btn {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 4px;
}

.step-val {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.85rem;
  min-width: 24px;
  text-align: center;
}

/* Cooking Fat Toggles */
.cooking-fat-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.fat-chip {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
}

.fat-chip.active {
  background: rgba(245, 166, 35, 0.15);
  border-color: var(--status-amber);
  color: #ffb84d;
  font-weight: 600;
}

/* Warnings / Flags container */
.flags-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.flag-alert {
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.flag-warning {
  background: var(--status-amber-bg);
  border: 1px solid rgba(245, 166, 35, 0.3);
  color: #ffb84d;
}

.flag-medication {
  background: var(--status-rose-bg);
  border: 1px solid rgba(235, 87, 87, 0.3);
  color: #ff9999;
}

/* Analytics Tabs Section */
.analytics-card {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.05);
}

.chart-wrapper {
  min-height: 220px;
  background: var(--surface-subtle);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.bar-chart-container {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  height: 180px;
  padding-top: 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--border-subtle) transparent;
}

.chart-bar-group {
  flex: 1;
  min-width: 38px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar {
  width: 100%;
  max-width: 38px;
  background: var(--accent-brand);
  border-radius: 4px 4px 0 0;
  transition: height 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
}

.chart-bar:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 105%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-modal);
  border: 1px solid var(--border-subtle);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  font-family: var(--font-mono);
}

.chart-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  white-space: nowrap;
  text-align: center;
}

/* Confetti Canvas */
#confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
}

/* Toast Notification System */
.toast-container {
  position: fixed;
  top: 1.25rem;
  right: 1.25rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 440px;
  pointer-events: none;
}

.toast-item {
  pointer-events: auto;
  background: rgba(15, 16, 18, 0.96);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(39, 195, 128, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(39, 195, 128, 0.2);
  border-radius: var(--radius-md);
  padding: 0.85rem 1.1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: toastSlideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: all 0.25s ease;
}

.toast-item.toast-leave {
  opacity: 0;
  transform: translateX(100%);
}

.toast-item.toast-success {
  border-color: rgba(39, 195, 128, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(39, 195, 128, 0.2);
}
.toast-item.toast-success .toast-icon {
  color: var(--status-emerald, #27c380);
}

.toast-item.toast-error {
  border-color: rgba(244, 63, 94, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(244, 63, 94, 0.2);
}
.toast-item.toast-error .toast-icon {
  color: #f43f5e;
}

.toast-item.toast-warning {
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(245, 158, 11, 0.2);
}
.toast-item.toast-warning .toast-icon {
  color: #f59e0b;
}

.toast-item.toast-info {
  border-color: rgba(56, 189, 248, 0.45);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.7), 0 0 25px rgba(56, 189, 248, 0.2);
}
.toast-item.toast-info .toast-icon {
  color: #38bdf8;
}

.toast-icon {
  font-size: 1.2rem;
  line-height: 1;
  color: var(--status-emerald);
  margin-top: 2px;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.toast-body {
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.toast-action-btn {
  margin-top: 0.5rem;
  background: rgba(94, 106, 210, 0.2);
  border: 1px solid rgba(94, 106, 210, 0.45);
  color: #a5b4fc;
  padding: 3px 10px;
  font-size: 0.72rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
  font-weight: 600;
}

.toast-action-btn:hover {
  background: var(--accent-brand);
  color: #fff;
  border-color: var(--accent-brand);
}

.toast-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 0;
  line-height: 1;
}

.toast-close:hover {
  color: #fff;
}

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

.audit-card-updated {
  border-color: var(--status-emerald) !important;
  box-shadow: 0 0 25px rgba(39, 195, 128, 0.25) !important;
}

/* Meal Timing Bar & Pills */
.meal-timing-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  flex-wrap: wrap;
}

.meal-type-pills {
  display: flex;
  gap: 0.35rem;
}

.meal-pill {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}

.meal-pill:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.meal-pill.active {
  background: var(--accent-brand);
  border-color: var(--accent-brand);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 10px rgba(94, 106, 210, 0.4);
}

/* Model Training & Memory Notice */
.training-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  background: rgba(94, 106, 210, 0.08);
  border: 1px solid rgba(94, 106, 210, 0.25);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.8rem;
  font-size: 0.75rem;
  color: #c7d2fe;
  line-height: 1.4;
}

.training-banner strong {
  color: #e0e7ff;
}

/* Subzi Quick Add Chips */
.subzi-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.7rem;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.subzi-chip:hover {
  background: rgba(94, 106, 210, 0.18);
  border-color: var(--accent-brand);
  color: #fff;
}

/* Editable Item Rows */
.item-row-editable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0.75rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  gap: 0.75rem;
  transition: border-color 0.15s ease;
}

.item-row-editable:hover {
  border-color: var(--border-hover);
}

.item-edit-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.item-name-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: var(--radius-sm);
  width: 100%;
  font-family: var(--font-sans);
}

.item-name-input:focus {
  outline: none;
  border-color: var(--accent-brand);
  background: rgba(94, 106, 210, 0.1);
}

.item-correction-indicator {
  font-size: 0.65rem;
  color: #fbbf24;
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 1px;
}

.item-edit-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-delete-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.btn-delete-item:hover {
  color: var(--status-rose);
  background: rgba(235, 87, 87, 0.1);
}

/* ==========================================================================
   Visual Progress Photo & Transformation Styles
   ========================================================================== */

.progress-card {
  padding: 1.25rem 1.5rem;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  transition: all 0.2s ease;
}

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

.progress-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}

.progress-delta-pill {
  background: rgba(39, 195, 128, 0.15);
  border: 1px solid rgba(39, 195, 128, 0.35);
  color: var(--status-emerald);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.progress-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.face-comparison-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.25rem;
}

.photo-compare-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
}

.compare-badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  display: inline-block;
  width: fit-content;
  align-self: center;
}

.baseline-badge {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.current-badge {
  background: rgba(39, 195, 128, 0.15);
  color: var(--status-emerald);
  border: 1px solid rgba(39, 195, 128, 0.35);
}

.photo-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  aspect-ratio: 4/5;
  width: 100%;
  max-width: 250px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.photo-frame.current-glow {
  border-color: rgba(39, 195, 128, 0.4);
  box-shadow: 0 4px 20px rgba(39, 195, 128, 0.15);
}

.progress-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
}

.photo-meta-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.4) 60%, transparent 100%);
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-primary);
}

.weight-tag {
  background: rgba(255, 255, 255, 0.15);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-mono);
}

.emerald-tag {
  background: rgba(39, 195, 128, 0.25);
  color: var(--status-emerald);
}

.compare-divider {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.vs-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--surface-card);
  border: 2px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent-brand-hover);
  letter-spacing: 0.5px;
}

.days-pill {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 500;
}

.delta-sub {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--status-emerald);
}

/* Detail & Full Body Modal */
.modal-card {
  background: var(--surface-modal);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  max-width: 820px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  padding: 1.75rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-close {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.15s ease;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

.progress-detail-modal {
  max-width: 820px;
  width: 95%;
  max-height: 90vh;
  overflow-y: auto;
}

.progress-tabs-nav {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.progress-tab-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  font-weight: 500;
}

.progress-tab-btn:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.progress-tab-btn.active {
  background: rgba(94, 106, 210, 0.15);
  border-color: var(--accent-brand);
  color: #fff;
  font-weight: 600;
}

.progress-tab-btn.primary-tab {
  border-color: rgba(39, 195, 128, 0.4);
  color: var(--status-emerald);
}

.progress-tab-btn.primary-tab.active {
  background: rgba(39, 195, 128, 0.18);
  border-color: var(--status-emerald);
  color: #fff;
}

.detail-comparison-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.detail-photo-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-photo-frame {
  position: relative;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-subtle);
  background: var(--surface-subtle);
  aspect-ratio: 4/5;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.detail-photo-frame.body-frame {
  aspect-ratio: 3/4;
}

.detail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.detail-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
  padding: 10px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: #fff;
}

.photo-caption {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding: 0 2px;
}

/* Upload Form & Category Selector */
.photo-type-selector {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.type-pill {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 0.8rem;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}

.type-pill.active {
  background: rgba(94, 106, 210, 0.2);
  border-color: var(--accent-brand);
  color: #fff;
  font-weight: 600;
}

.progress-dropzone {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1.75rem 1rem;
  text-align: center;
  cursor: pointer;
  background: var(--surface-subtle);
  transition: all 0.2s ease;
}

.progress-dropzone:hover {
  border-color: var(--accent-brand);
  background: rgba(94, 106, 210, 0.05);
}

/* Timeline Gallery Grid */
.timeline-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.timeline-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all 0.15s ease;
}

.timeline-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.timeline-thumb-frame {
  position: relative;
  aspect-ratio: 4/5;
  background: #000;
}

.timeline-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.timeline-info {
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.timeline-date {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-weight {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
}

.timeline-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  width: fit-content;
}

@media (max-width: 640px) {
  .face-comparison-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .compare-divider {
    flex-direction: row;
    justify-content: center;
  }
  .detail-comparison-grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Logged Meal Diary & History Section (Analytics Integration)
   ========================================================================== */

.meal-log-section {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.meal-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.meal-log-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.meal-log-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.meal-log-heading {
  color: var(--text-primary);
}

.meal-log-icon {
  font-size: 1.1rem;
}

.meal-log-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.55rem;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
  color: #38bdf8;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
}

.meal-log-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.meal-log-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.btn-clear-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-clear-filter:hover {
  background: rgba(245, 158, 11, 0.22);
  transform: translateY(-1px);
}

.btn-clear-filter.hidden {
  display: none !important;
}

.view-toggle-group {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
}

.btn-toggle-view {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.32rem 0.65rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-toggle-view:hover {
  color: var(--text-primary);
}

.btn-toggle-view.active {
  background: var(--surface-subtle);
  color: var(--text-primary);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.btn-export-excel {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.38rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(39, 195, 128, 0.12);
  border: 1px solid rgba(39, 195, 128, 0.3);
  color: var(--status-emerald);
  cursor: pointer;
  transition: all 0.18s ease;
}

.btn-export-excel:hover {
  background: rgba(39, 195, 128, 0.22);
  border-color: rgba(39, 195, 128, 0.5);
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(39, 195, 128, 0.2);
}

/* Interactive Chart Bar Highlights */
.chart-bar {
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease;
}

.chart-bar:hover {
  filter: brightness(1.25);
  transform: scaleY(1.04);
}

.chart-bar.selected {
  outline: 2px solid var(--status-emerald);
  outline-offset: 1px;
  box-shadow: 0 0 10px rgba(39, 195, 128, 0.5);
  filter: brightness(1.3);
}

/* Meal Cards Layout */
.meal-log-cards-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.85rem;
}

.meal-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.meal-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transform: translateY(-2px);
}

.meal-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
}

.meal-card-type-badge {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.18rem 0.5rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.meal-card-type-badge.breakfast {
  background: rgba(245, 158, 11, 0.14);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.meal-card-type-badge.lunch {
  background: rgba(56, 189, 248, 0.14);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.meal-card-type-badge.snack {
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.3);
  color: #c084fc;
}

.meal-card-type-badge.dinner {
  background: rgba(99, 102, 241, 0.14);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #818cf8;
}

.meal-card-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.meal-card-dish {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.25;
}

.meal-card-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.meal-card-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.meal-macro-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-family: var(--font-mono);
}

.meal-macro-pill.cals {
  background: rgba(251, 146, 60, 0.12);
  color: #fb923c;
}
.meal-macro-pill.protein {
  background: rgba(56, 189, 248, 0.12);
  color: #38bdf8;
}
.meal-macro-pill.carbs {
  background: rgba(250, 204, 21, 0.12);
  color: #facc15;
}
.meal-macro-pill.fat {
  background: rgba(248, 113, 113, 0.12);
  color: #f87171;
}
.meal-macro-pill.fiber {
  background: rgba(52, 211, 153, 0.12);
  color: #34d399;
}
.meal-macro-pill.sugar {
  background: rgba(244, 114, 182, 0.12);
  color: #f472b6;
}
.meal-macro-pill.sodium {
  background: rgba(148, 163, 184, 0.12);
  color: #94a3b8;
}

.meal-card-items-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.meal-item-tag {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  color: var(--text-secondary);
}

.meal-item-tag strong {
  color: var(--text-primary);
}

.meal-card-advice {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
  border-left: 2px solid rgba(56, 189, 248, 0.3);
  padding-left: 0.5rem;
  margin-top: 0.2rem;
}

/* Meal Grid / Table Layout */
.meal-log-grid-container {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.meal-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  text-align: left;
}

.meal-grid-table thead tr {
  background: rgba(0, 0, 0, 0.35);
  border-bottom: 1px solid var(--border-subtle);
}

.meal-grid-table th {
  padding: 0.65rem 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.meal-grid-table th.num-col,
.meal-grid-table td.num-col {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.meal-grid-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
  transition: background 0.12s ease;
}

.meal-grid-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.meal-grid-table td {
  padding: 0.6rem 0.8rem;
  color: var(--text-primary);
  vertical-align: middle;
}

.meal-grid-table tfoot tr {
  background: rgba(0, 0, 0, 0.4);
  border-top: 2px solid var(--border-subtle);
  font-weight: 700;
}

.meal-grid-table tfoot td {
  padding: 0.65rem 0.8rem;
  color: var(--text-primary);
}

.table-meal-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
  display: inline-block;
}

.table-meal-badge.breakfast { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.table-meal-badge.lunch { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.table-meal-badge.snack { background: rgba(168, 85, 247, 0.15); color: #c084fc; }
.table-meal-badge.dinner { background: rgba(99, 102, 241, 0.15); color: #818cf8; }

.table-dish-name {
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.table-dish-items {
  font-size: 0.7rem;
  color: var(--text-muted);
}

/* Empty State */
.meal-log-empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--surface-subtle);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
}

.meal-log-empty-state .empty-icon {
  font-size: 2rem;
  opacity: 0.6;
}

.meal-log-empty-state .empty-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
}

.meal-log-empty-state .empty-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  max-width: 360px;
}

.hidden {
  display: none !important;
}

/* Meal Actions (Edit & Delete) Styling */
.meal-card-top-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.meal-card-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.btn-card-action {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.btn-card-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}

.btn-card-action.btn-edit-meal:hover {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.4);
  color: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.2);
}

.btn-card-action.btn-delete-meal:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: rgba(248, 113, 113, 0.4);
  color: #f87171;
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.2);
}

.table-actions-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: center;
}

.btn-table-action {
  font-size: 0.78rem;
  padding: 0.22rem 0.42rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-table-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: scale(1.15);
}

.btn-table-action.btn-edit-meal:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.25);
}

.btn-table-action.btn-delete-meal:hover {
  background: rgba(248, 113, 113, 0.2);
  border-color: rgba(248, 113, 113, 0.5);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.25);
}

.meal-grid-table th.action-col,
.meal-grid-table td.action-col {
  text-align: center;
  width: 75px;
}

/* ============================================================================
   Custom Delete Confirmation Dialog (Obsidian Dark & Linear.app Aesthetic)
   ============================================================================ */
.delete-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 5, 7, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: deleteModalFadeIn 0.2s ease-out;
}

.delete-modal-card {
  background: #0e0f12;
  border: 1px solid rgba(235, 87, 87, 0.32);
  border-radius: var(--radius-lg);
  max-width: 440px;
  width: 100%;
  padding: 1.6rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.9), 0 0 35px rgba(235, 87, 87, 0.14);
  position: relative;
  animation: deleteModalScaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes deleteModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes deleteModalScaleUp {
  from { opacity: 0; transform: scale(0.93) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.delete-modal-close-btn {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.delete-modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.delete-modal-icon-wrap {
  display: flex;
  justify-content: center;
  margin-top: 0.2rem;
}

.delete-modal-icon {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(235, 87, 87, 0.12);
  border: 1px solid rgba(235, 87, 87, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.45rem;
  box-shadow: 0 0 20px rgba(235, 87, 87, 0.25);
  animation: dangerPulse 2s infinite ease-in-out;
}

@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(235, 87, 87, 0.2); transform: scale(1); }
  50% { box-shadow: 0 0 26px rgba(235, 87, 87, 0.4); transform: scale(1.04); }
}

.delete-modal-header {
  text-align: center;
}

.delete-modal-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
  letter-spacing: -0.01em;
}

.delete-modal-desc {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Meal Preview Card */
.delete-meal-preview {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.delete-preview-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.72rem;
}

.delete-preview-type-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
}

.delete-preview-type-badge.breakfast { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.delete-preview-type-badge.lunch { background: rgba(56, 189, 248, 0.15); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.delete-preview-type-badge.snack { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.3); }
.delete-preview-type-badge.dinner { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }

.delete-preview-time {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}

.delete-preview-dish {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-primary);
  line-height: 1.35;
}

.delete-preview-macros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.macro-mini-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.45rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
}

.macro-mini-pill.cals { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.macro-mini-pill.protein { background: rgba(56, 189, 248, 0.12); color: #38bdf8; }
.macro-mini-pill.carbs { background: rgba(250, 204, 21, 0.12); color: #facc15; }
.macro-mini-pill.fat { background: rgba(248, 113, 113, 0.12); color: #f87171; }
.macro-mini-pill.fiber { background: rgba(52, 211, 153, 0.12); color: #34d399; }
.macro-mini-pill.sugar { background: rgba(244, 114, 182, 0.12); color: #f472b6; }

/* Advisory Box */
.delete-advisory-box {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  background: rgba(94, 106, 210, 0.08);
  border: 1px solid rgba(94, 106, 210, 0.22);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  font-size: 0.76rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.delete-advisory-box .advisory-icon {
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.delete-advisory-box strong {
  color: var(--accent-brand-hover);
}

/* Modal Actions */
.delete-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.btn-delete-cancel {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-secondary);
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.btn-delete-cancel:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-delete-confirm {
  flex: 1.3;
  background: linear-gradient(135deg, #e11d48, #be123c);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #ffffff;
  padding: 0.65rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  box-shadow: 0 0 16px rgba(225, 29, 72, 0.35);
  transition: all 0.18s ease;
}

.btn-delete-confirm:hover {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 0 24px rgba(225, 29, 72, 0.55);
  transform: translateY(-1px);
}

.btn-delete-confirm:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   Review Modal Header & Meal Timing Enhancements (Linear.app Aesthetic)
   ========================================================================== */
.review-header-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--accent-brand-hover);
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: all 0.15s ease;
}

.review-header-select:hover,
.review-header-select:focus {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-brand);
  box-shadow: 0 0 0 2px var(--accent-brand-glow);
}

.review-header-select option {
  background: var(--surface-modal);
  color: var(--text-primary);
}

.review-dish-title-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.35rem;
  flex-wrap: wrap;
}

.review-dish-heading-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
}

.review-dish-heading-input {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-bottom: 1.5px dashed rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 4px 28px 4px 10px;
  font-family: inherit;
  min-width: 240px;
  max-width: 560px;
  outline: none;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.review-dish-heading-input:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.26);
  border-bottom-color: rgba(99, 102, 241, 0.6);
}

.review-dish-heading-input:focus {
  background: #0f172a;
  border-color: #6366f1;
  border-bottom-style: solid;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
  color: #ffffff;
}

.review-dish-heading-pencil {
  position: absolute;
  right: 8px;
  font-size: 0.85rem;
  opacity: 0.5;
  pointer-events: none;
  transition: opacity 0.15s ease;
}

.review-dish-heading-wrap:hover .review-dish-heading-pencil {
  opacity: 0.9;
}

.review-dish-kcal-badge {
  font-size: 0.85rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(245, 166, 35, 0.12);
  border: 1px solid rgba(245, 166, 35, 0.32);
  color: var(--status-amber);
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.review-log-time-row {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.review-log-time-input {
  width: 100%;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-family: inherit;
  color-scheme: dark;
  outline: none;
  box-sizing: border-box;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.review-log-time-input:hover {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.28);
}

.review-log-time-input:focus {
  background: #0f172a;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

/* ============================================================
   Profile Modal – Sticky Save/Cancel Footer
   ============================================================ */

/* Card uses flex-column so footer can stick to bottom */
.profile-modal-card {
  display: flex !important;
  flex-direction: column !important;
  max-height: min(94vh, 900px) !important;
}

/* The form area scrolls; footer does not */
.profile-form-scrollable {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(99, 102, 241, 0.3) transparent;
}

.profile-form-scrollable::-webkit-scrollbar { width: 5px; }
.profile-form-scrollable::-webkit-scrollbar-track { background: transparent; }
.profile-form-scrollable::-webkit-scrollbar-thumb {
  background: rgba(99, 102, 241, 0.35);
  border-radius: 4px;
}

/* Sticky footer – always visible below the scrollable form */
.profile-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  padding-top: 0.85rem;
  margin-top: 0.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  flex-shrink: 0;
}

.profile-modal-footer .btn-outline {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--text-secondary);
  padding: 0.55rem 1.25rem;
  font-size: 0.875rem;
  transition: all 0.18s ease;
}

.profile-modal-footer .btn-outline:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.3);
  color: var(--text-primary);
}

.profile-modal-footer .btn-primary {
  min-width: 190px;
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.profile-modal-footer .btn-primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

/* ==========================================================================
   Obsidian Authentication & Verification Gate Styles (OWASP A01 & A04)
   ========================================================================== */

.auth-gate-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(8, 9, 12, 0.94);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}

.auth-gate-card {
  background: #121316;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.85);
  border-radius: 14px;
  width: 100%;
  max-width: 460px;
  padding: 2rem 1.75rem;
  display: flex;
  flex-direction: column;
}

.auth-brand-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 1.25rem;
}

.brand-badge-large {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #5e6ad2 0%, #8b5cf6 100%);
  font-weight: 800;
  font-size: 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 16px rgba(94, 106, 210, 0.4);
}

.auth-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  letter-spacing: -0.5px;
}

.auth-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.4;
}

.auth-tabs {
  display: flex;
  background: var(--surface-subtle);
  padding: 3px;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.auth-tab-btn {
  flex: 1;
  padding: 6px 12px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.auth-tab-btn.active {
  background: #22242a;
  color: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-error-alert {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #fca5a5;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.auth-success-alert {
  background: rgba(39, 195, 128, 0.12);
  border: 1px solid rgba(39, 195, 128, 0.35);
  color: #6ee7b7;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.4;
}

.auth-submit-btn {
  width: 100%;
  padding: 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.auth-footer-prompt {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.auth-footer-prompt a {
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ──────────────────────────────────────────────────────────────────────────
   DESIGN.md: Alpha Preview Notice & Demo Accounts Selector
   Adheres to Linear design system: surface-1 (#0f1011), hairline border (#23252a),
   ink-subtle (#8a8f98), status pill, and 44px touch targets on mobile.
   ────────────────────────────────────────────────────────────────────────── */
.auth-notice-card {
  margin-top: 1rem;
  padding: 12px 14px;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  text-align: left;
}

.auth-notice-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.auth-preview-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.4px;
}

.auth-preview-badge::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #7a7fad;
}

.auth-notice-text {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin: 0 0 10px 0;
}

.demo-account-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.demo-pill-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 10px;
  min-height: 44px;
  background: var(--surface-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  user-select: none;
}

.demo-pill-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.demo-pill-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(94, 106, 210, 0.4);
  border-color: var(--accent-brand);
}

.demo-pill-btn .demo-title {
  color: var(--text-primary);
  font-weight: 600;
  line-height: 1.2;
}

.demo-pill-btn .demo-role {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-top: 2px;
  letter-spacing: -0.2px;
}

.auth-disabled-banner {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 18px 14px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.auth-disabled-banner .disabled-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.auth-disabled-banner .disabled-heading {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}


.legal-consent-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.5rem 0;
  padding: 0.75rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.legal-checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.72rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.4;
}

.legal-checkbox-label a {
  color: var(--accent);
  text-decoration: underline;
}

.otp-instruction-box {
  text-align: center;
  padding: 0.5rem 0 1rem 0;
}

.otp-digits-input {
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 1.6rem;
  letter-spacing: 8px;
  padding: 0.6rem;
}

.dev-otp-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(94, 106, 210, 0.12);
  border: 1px solid rgba(94, 106, 210, 0.35);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.otp-resend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
  font-size: 0.78rem;
  padding: 0;
}

.btn-link:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
  text-decoration: none;
}

/* ==========================================================================
   User Navigation Dropdown & Tier Pills
   ========================================================================== */

.tier-badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(94, 106, 210, 0.2);
  color: #a5b4fc;
  border: 1px solid rgba(94, 106, 210, 0.4);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1000;
  min-width: 220px;
  background: #16171b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);
  padding: 6px 0;
}

.user-dropdown-header {
  padding: 8px 14px;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 4px 0;
}

.user-dropdown-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.15s ease;
  cursor: pointer;
}

.user-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

/* ==========================================================================
   Admin Console & Telemetry Styles
   ========================================================================== */

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.admin-table th {
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: var(--surface-card);
  position: sticky;
  top: 0;
  z-index: 2;
}

.admin-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 0.8rem;
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.admin-pane {
  animation: fadeIn 0.15s ease-in-out;
}

.tier-admin-card {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tier-admin-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ==========================================================================
   AI Quota & Telemetry Modal Styles
   ========================================================================== */

.quota-tier-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
}

.quota-gauge-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

.quota-progress-bar-bg {
  height: 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.quota-progress-bar-fill {
  height: 100%;
  border-radius: 9999px;
  background: var(--accent);
  transition: width 0.3s ease;
}

.quota-stat-tile {
  background: var(--surface-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  text-align: center;
}

.quota-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.quota-stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  margin: 4px 0;
}

.quota-stat-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Legal Detail Modals & Governance Overlays (DPDPA 2023 §6 & Terms)
   ========================================================================== */

#legal-terms-modal,
#legal-health-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 100005 !important;
  background: rgba(4, 5, 8, 0.88) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  display: none;
  align-items: center !important;
  justify-content: center !important;
  padding: 1.25rem !important;
  overflow-y: auto !important;
}

.legal-modal-card {
  background: #121316 !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.95) !important;
  border-radius: 16px !important;
  max-width: 680px !important;
  width: 100% !important;
  max-height: 85vh !important;
  display: flex !important;
  flex-direction: column !important;
  padding: 1.75rem !important;
  gap: 1rem !important;
  animation: legalModalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes legalModalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(8px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.legal-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-modal-body {
  overflow-y: auto;
  flex: 1;
  padding-right: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.legal-modal-body::-webkit-scrollbar {
  width: 6px;
}

.legal-modal-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.legal-modal-body h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  margin: 0.5rem 0 0.25rem 0;
}

.legal-modal-body p {
  font-size: 0.85rem;
  color: #9da1b4;
  line-height: 1.6;
  margin: 0;
}

.legal-modal-body ul {
  margin: 0.25rem 0 0.5rem 1.25rem;
  padding: 0;
  font-size: 0.84rem;
  color: #c2c6dc;
}

.legal-modal-body li {
  margin-bottom: 0.35rem;
}

.legal-modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.legal-full-link {
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.legal-full-link:hover {
  text-decoration: underline;
}

/* ==========================================================================
   Phase 1 Layer 6: Responsive Web UI, Touch Ergonomics & Mobile Navigation
   Codified per ADR-060, SDD 09 v2.4.0 & responsive-ui-playbook.md
   ========================================================================== */

/* Main Container Sizing & Margins */
.container {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  box-sizing: border-box;
}

/* Fluid Heading Typography */
h1 {
  font-size: clamp(1.4rem, 4vw + 0.2rem, 2.2rem);
}
h2 {
  font-size: clamp(1.2rem, 3vw + 0.1rem, 1.8rem);
}

/* Touch Target Standard Utility (WCAG 2.2 / Apple HIG >= 44x44px) */
.touch-target {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

/* ==========================================================================
   Fixed Thumb-Zone Bottom Navigation Bar (< 640px)
   ========================================================================== */
.mobile-bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: rgba(15, 16, 18, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--border-subtle);
  display: none; /* Hidden on desktop & tablet */
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  padding: 0 0.5rem;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.45);
}

.bottom-nav-item {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 56px;
  min-height: 48px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.15s ease;
  position: relative;
  text-decoration: none;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
  color: var(--text-primary);
}

.bottom-nav-item.active {
  color: var(--accent-brand-hover);
}

.bottom-nav-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  width: 16px;
  height: 3px;
  background: var(--accent-brand);
  border-radius: var(--radius-pill);
}

.bottom-nav-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav-label {
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}

/* Center Floating Action Button (FAB) */
.bottom-nav-item.bottom-nav-fab {
  transform: translateY(-8px);
}

.bottom-nav-item.bottom-nav-fab .fab-circle {
  width: 46px;
  height: 46px;
  background: linear-gradient(135deg, var(--accent-brand), #8f98ff);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--accent-brand-glow);
  color: #fff;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.bottom-nav-item.bottom-nav-fab:active .fab-circle {
  transform: scale(0.92);
}

.bottom-nav-item.bottom-nav-fab .fab-icon {
  font-size: 1.3rem;
  font-weight: 700;
  line-height: 1;
}

.bottom-nav-item.bottom-nav-fab .bottom-nav-label {
  margin-top: 3px;
  color: var(--accent-brand-hover);
  font-weight: 600;
}

/* ==========================================================================
   Mobile Viewports (< 640px)
   ========================================================================== */
@media (max-width: 639px) {
  /* Show fixed bottom navigation */
  .mobile-bottom-nav {
    display: flex;
  }

  /* Safe container padding */
  .container {
    padding: 0.75rem 0.85rem;
    gap: 1rem;
    max-width: 100vw;
  }

  /* Slim Mobile App Header */
  .app-header {
    padding: 0.5rem 0.85rem;
    max-width: 100vw;
    overflow: visible !important;
    z-index: 1005 !important;
  }
  .brand-name {
    font-size: 1.05rem;
  }
  .brand-tag {
    display: none !important; /* Hide lengthy scientific tag on small phone header */
  }
  .header-actions {
    gap: 0.4rem;
  }
  .header-btn-desktop {
    display: none !important; /* Secondary action buttons hidden on phone header */
  }
  #btn-open-transparency,
  #btn-open-profile,
  #btn-open-progress-header {
    display: none !important; /* Accessible in bottom nav & dropdown menu */
  }
  .user-menu-wrapper #btn-user-menu {
    padding: 4px 8px !important;
  }
  #header-user-name {
    display: none !important;
  }
  .user-dropdown {
    position: fixed !important;
    top: 52px !important;
    right: 8px !important;
    left: auto !important;
    min-width: 230px !important;
    max-width: calc(100vw - 16px) !important;
    z-index: 100005 !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.85) !important;
  }

  /* Companion Card Mobile Adaption */
  .companion-card {
    flex-direction: column !important;
    align-items: flex-start !important;
    padding: 1rem !important;
    gap: 0.75rem !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .companion-avatar {
    width: 44px;
    height: 44px;
    font-size: 1.6rem;
  }
  .companion-speech {
    font-size: 0.88rem;
  }
  .streak-pill {
    align-self: flex-start !important;
    font-size: 0.78rem !important;
    padding: 0.25rem 0.65rem !important;
    white-space: normal !important;
    max-width: 100% !important;
  }

  /* Hero Calorie HUD & Numbers */
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .card {
    padding: 1.1rem;
  }
  .calorie-hud-header {
    margin-bottom: 0.85rem;
  }
  .calorie-numbers-row {
    gap: 0.4rem;
    margin-bottom: 1rem;
  }
  .stat-box {
    padding: 0.65rem 0.4rem;
    text-align: center;
  }
  .stat-box-label {
    font-size: 0.68rem;
  }
  .stat-box-val {
    font-size: clamp(1.15rem, 5vw, 1.45rem);
  }

  /* Macro Grid: 2x2 Clean Stack */
  .macro-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
  }
  .macro-pill {
    padding: 0.6rem 0.5rem;
  }
  .macro-pill-header {
    font-size: 0.7rem;
    margin-bottom: 0.25rem;
  }
  .macro-pill-val {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
  }

  /* Face Progress Card */
  .progress-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .progress-header-actions {
    width: 100%;
    display: flex;
    gap: 0.5rem;
  }
  .progress-header-actions .btn {
    flex: 1;
    min-height: 44px;
    justify-content: center;
    font-size: 0.78rem;
    padding: 0.4rem 0.6rem;
  }
  .face-comparison-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
  .compare-divider {
    flex-direction: row;
    gap: 0.5rem;
    padding: 0.5rem 0;
  }

  /* Instant Meal Logger */
  .logging-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .mode-switcher {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .mode-btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    font-size: 0.8rem;
  }
  .dropzone {
    padding: 1.75rem 1rem;
  }
  .dropzone-icon {
    font-size: 2.2rem;
  }
  .dropzone-text {
    font-size: 0.92rem;
  }
  .dropzone-sub {
    font-size: 0.75rem;
  }
  .search-input-wrapper {
    flex-direction: column;
    gap: 0.5rem;
  }
  .search-input-wrapper .btn {
    min-height: 44px;
    justify-content: center;
    width: 100%;
  }
  .suggest-chip {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
  }

  /* Analytics Tabs: Swipeable Scroll */
  .tabs-nav {
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 0.5rem;
    gap: 0.35rem;
  }
  .tabs-nav::-webkit-scrollbar {
    display: none;
  }
  .tab-btn {
    flex-shrink: 0;
    min-height: 44px;
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
  }

  /* Meal Diary Toolbar */
  .meal-log-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }
  .meal-log-toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .btn-export-excel,
  .btn-toggle-view,
  .btn-clear-filter {
    min-height: 44px;
  }

  /* Bottom Sheet Modals for Mobile (<640px) */
  .modal-overlay,
  .review-modal-overlay,
  .delete-modal-overlay,
  .auth-gate-overlay {
    align-items: flex-end !important;
    justify-content: center !important;
    padding: 0 !important;
    z-index: 100010 !important;
  }

  /* Single-Card Compact Modals */
  .auth-gate-card {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 94vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    padding: 1.25rem 1rem max(1rem, env(safe-area-inset-bottom, 1rem)) 1rem !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.75) !important;
    animation: slideUpBottom 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    margin: 0 !important;
  }

  .delete-modal-card {
    width: 100% !important;
    max-width: 100% !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    padding: 1.25rem 1rem max(1rem, env(safe-area-inset-bottom, 1rem)) 1rem !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.75) !important;
    animation: slideUpBottom 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    margin: 0 !important;
  }

  .delete-modal-actions .btn-delete-cancel,
  .delete-modal-actions .btn-delete-confirm {
    min-height: 48px !important;
    flex: 1 !important;
    display: inline-flex !important;
    justify-content: center !important;
    align-items: center !important;
  }

  /* Full-Featured Structured Modals: Pinned Header + Scrollable Body + Pinned/Sticky Footer */
  .review-card,
  .profile-modal-card,
  .admin-modal-card,
  .transparency-modal-card,
  .quota-modal-card,
  .progress-detail-modal {
    width: 100% !important;
    max-width: 100% !important;
    height: 94vh !important;
    max-height: 94vh !important;
    border-radius: 20px 20px 0 0 !important;
    border-bottom: none !important;
    padding: 1rem 0.85rem 0 0.85rem !important;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.75) !important;
    animation: slideUpBottom 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  /* Pinned Headers */
  .review-header,
  .modal-header {
    flex-shrink: 0 !important;
    z-index: 10 !important;
    margin-bottom: 0.5rem !important;
  }

  .review-header .btn-sm,
  .modal-header .modal-close {
    min-height: 44px !important;
    min-width: 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.15rem !important;
    touch-action: manipulation !important;
  }

  /* Scrollable Content Panes */
  .profile-form-scrollable,
  .admin-pane,
  .transparency-modal-body,
  .progress-tab-pane {
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 1.25rem !important;
  }

  /* Pinned / Sticky Action Footers */
  .profile-modal-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.65rem !important;
    padding: 0.75rem 0.85rem max(0.75rem, env(safe-area-inset-bottom, 0.75rem)) 0.85rem !important;
    background: var(--surface-modal) !important;
    border-top: 1px solid var(--border-subtle) !important;
    margin: 0 -0.85rem !important;
    flex-shrink: 0 !important;
    z-index: 20 !important;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5) !important;
  }

  .profile-modal-footer .btn,
  .profile-modal-footer .btn-primary,
  .profile-modal-footer .btn-outline {
    flex: 1 !important;
    min-height: 48px !important;
    font-size: 0.875rem !important;
    justify-content: center !important;
    align-items: center !important;
    display: inline-flex !important;
    min-width: 0 !important;
  }

  .review-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    flex-shrink: 0 !important;
    width: 100% !important;
  }

  .review-header > div:last-child {
    display: flex !important;
    gap: 0.4rem !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
  }

  .review-dish-title-row {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 0.35rem !important;
    width: 100% !important;
  }

  .review-dish-heading-wrap {
    width: 100% !important;
    display: flex !important;
    position: relative !important;
  }

  .review-dish-heading-input {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    font-size: 1.15rem !important;
    padding: 6px 30px 6px 8px !important;
    box-sizing: border-box !important;
  }

  .review-macro-summary-bar {
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 0.35rem !important;
    padding: 0.5rem !important;
    flex-shrink: 0 !important;
    margin-bottom: 0.4rem !important;
  }

  .macro-stat-chip {
    padding: 0.35rem 0.45rem !important;
  }

  .macro-stat-chip .macro-label {
    font-size: 0.65rem !important;
  }

  .macro-stat-chip .macro-val {
    font-size: 0.82rem !important;
  }

  .review-body-layout {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
    flex: 1 !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .review-footer {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 0.65rem !important;
    padding: 0.75rem 0.85rem max(0.75rem, env(safe-area-inset-bottom, 0.75rem)) 0.85rem !important;
    background: var(--surface-modal) !important;
    border-top: 1px solid var(--border-subtle) !important;
    margin: 0 -0.85rem !important;
    flex-shrink: 0 !important;
    z-index: 20 !important;
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.5) !important;
  }

  .review-footer .btn {
    flex: 1 !important;
    min-height: 48px !important;
    font-size: 0.875rem !important;
    justify-content: center !important;
  }

  /* Food item rows mobile ergonomics */
  .item-row-editable {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.5rem !important;
    padding: 0.65rem 0.75rem !important;
  }

  .item-inputs-row {
    flex-wrap: wrap !important;
    gap: 0.4rem !important;
  }

  .item-name-input {
    flex: 1 1 100% !important;
    font-size: 0.92rem !important;
    min-height: 38px !important;
  }

  .portion-input-wrap {
    flex: 1 1 auto !important;
    min-width: 120px !important;
    min-height: 38px !important;
  }

  .btn-item-ai-search {
    min-height: 38px !important;
    padding: 0 10px !important;
  }

  .item-edit-right {
    display: flex !important;
    justify-content: space-between !important;
    border-top: 1px dashed rgba(255, 255, 255, 0.08) !important;
    padding-top: 0.4rem !important;
    margin-top: 0.2rem !important;
    width: 100% !important;
  }

  .portion-stepper {
    min-height: 36px !important;
  }

  .btn-delete-item {
    min-height: 36px !important;
    min-width: 36px !important;
  }

  /* Meal Logger Mobile Ergonomics */
  .logging-header {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .mode-switcher {
    width: 100% !important;
    display: flex !important;
  }

  .mode-btn {
    flex: 1 !important;
    text-align: center !important;
    padding: 0.55rem 0.5rem !important;
    font-size: 0.82rem !important;
    min-height: 44px !important;
  }

  .search-input-wrapper {
    flex-direction: column !important;
    gap: 0.5rem !important;
  }

  .search-input-wrapper .text-input {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 0.9rem !important;
    box-sizing: border-box !important;
  }

  .search-input-wrapper #btn-submit-text {
    width: 100% !important;
    min-height: 44px !important;
    font-size: 0.9rem !important;
    justify-content: center !important;
  }

  .dropzone {
    padding: 1.5rem 1rem !important;
  }

  .dropzone-icon {
    font-size: 2.2rem !important;
    margin-bottom: 0.4rem !important;
  }

  .dropzone-text {
    font-size: 0.95rem !important;
  }

  .dropzone-sub {
    font-size: 0.75rem !important;
  }

  /* Mobile Toast Positioning (Sits comfortably above mobile bottom nav) */
  .toast-container {
    top: auto !important;
    bottom: 74px !important;
    left: 0.85rem !important;
    right: 0.85rem !important;
    max-width: none !important;
    z-index: 9999 !important;
  }
}

@keyframes slideUpBottom {
  from {
    transform: translateY(100%);
    opacity: 0.5;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ==========================================================================
   Tablet Viewports (640px - 1023px)
   ========================================================================== */
@media (min-width: 640px) and (max-width: 1023px) {
  .mobile-bottom-nav {
    display: none;
  }

  .container {
    max-width: 960px;
    padding: 1.25rem;
    gap: 1.25rem;
  }

  .app-header {
    padding: 0.65rem 1.25rem;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .calorie-numbers-row {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
  }

  .macro-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
  }

  .face-comparison-grid {
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
  }
}

/* ==========================================================================
   Desktop Viewports (>= 1024px) & Ultra-Wide (>= 1440px)
   ========================================================================== */
@media (min-width: 1024px) {
  .mobile-bottom-nav {
    display: none;
  }

  .hero-grid {
    grid-template-columns: 2fr 1fr;
    gap: 1.25rem;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }
}

/* Universal Touch Target Guarantee across Touch Devices */
@media (pointer: coarse) {
  button,
  .btn,
  .mode-btn,
  .tab-btn,
  .suggest-chip,
  .bottom-nav-item,
  .btn-toggle-view,
  .btn-export-excel,
  .btn-clear-filter {
    min-height: 44px;
    touch-action: manipulation;
  }
}



