/* ===========================
   CSS VARIABLES & RESET
   =========================== */
:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface2: #252525;
  --surface3: #303030;
  --border: #2a2a2a;
  --text: #ffffff;
  --text-muted: #888888;
  --text-dim: #555555;
  --accent: #4ade80;
  --accent-dim: #14532d;
  --accent-text: #0f0f0f;
  --blue: #60a5fa;
  --orange: #fb923c;
  --purple: #c084fc;
  --cyan: #38bdf8;
  --red: #f87171;
  --yellow: #facc15;
  --nav-height: 64px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-height: 56px;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
}

html {
  height: 100%;
  height: -webkit-fill-available;
}

body {
  min-height: 100%;
  min-height: -webkit-fill-available;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

input, button, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

/* ===========================
   LAYOUT
   =========================== */
#app {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: calc(var(--nav-height) + var(--safe-bottom));
  overflow: hidden;
}

.view {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.view.active {
  display: flex;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: calc(12px + var(--safe-top));
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: calc(var(--header-height) + var(--safe-top));
  gap: 12px;
}

.view-header h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  flex: 1;
}

.view-header h1.brand-logo {
  color: #f97316;
  font-size: 24px;
}

.view-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  padding-bottom: 32px;
}

/* ===========================
   CARDS
   =========================== */
.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.card-title {
  font-weight: 600;
  font-size: 15px;
}

.card-subtitle {
  font-size: 12px;
  color: var(--text-muted);
}

/* ===========================
   BRAND LOGO
   =========================== */
.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 0;
  font-weight: 800;
  color: #f97316;
  letter-spacing: -0.5px;
  line-height: 1;
}

.brand-runner {
  display: inline-block;
  height: 1.05em;
  width: auto;
  vertical-align: middle;
  margin: 0 1px;
  flex-shrink: 0;
}

/* ===========================
   BOTTOM NAVIGATION
   =========================== */
#bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(var(--nav-height) + var(--safe-bottom));
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  min-height: 48px;
  padding: 6px 2px;
  transition: color 0.15s;
  letter-spacing: 0.02em;
}

/* Colored icon badge */
.nav-icon-wrap {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
}

.nav-icon-wrap svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

/* Per-item overlay colors — Dashboard: green */
.nav-item:nth-child(2) .nav-icon-wrap { background: rgba(74,222,128,0.12); color: #4ade80; }
.nav-item:nth-child(2).active .nav-icon-wrap { background: rgba(74,222,128,0.22); }
.nav-item:nth-child(2).active { color: #4ade80; }

/* Log Food: orange */
.nav-item:nth-child(3) .nav-icon-wrap { background: rgba(249,115,22,0.12); color: #f97316; }
.nav-item:nth-child(3).active .nav-icon-wrap { background: rgba(249,115,22,0.22); }
.nav-item:nth-child(3).active { color: #f97316; }

/* Recipes: yellow */
.nav-item:nth-child(4) .nav-icon-wrap { background: rgba(250,204,21,0.12); color: #facc15; }
.nav-item:nth-child(4).active .nav-icon-wrap { background: rgba(250,204,21,0.22); }
.nav-item:nth-child(4).active { color: #facc15; }

/* Products: light blue */
.nav-item:nth-child(5) .nav-icon-wrap { background: rgba(56,189,248,0.12); color: #38bdf8; }
.nav-item:nth-child(5).active .nav-icon-wrap { background: rgba(56,189,248,0.22); }
.nav-item:nth-child(5).active { color: #38bdf8; }

/* More: purple */
.nav-item:nth-child(6) .nav-icon-wrap { background: rgba(192,132,252,0.12); color: #c084fc; }
.nav-item:nth-child(6).active .nav-icon-wrap { background: rgba(192,132,252,0.22); }
.nav-item:nth-child(6).active { color: #c084fc; }

.nav-item:active .nav-icon-wrap { transform: scale(0.92); }

/* ===========================
   BUTTONS
   =========================== */
.btn-primary {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  padding: 14px 20px;
  cursor: pointer;
  min-height: 50px;
  transition: opacity 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:active { opacity: 0.8; }

.btn-primary.danger {
  background: var(--red);
}

.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  cursor: pointer;
  min-height: 48px;
  transition: background 0.15s;
}

.btn-secondary:active { background: var(--surface3); }

.full-width { width: 100%; }

.header-btn {
  background: var(--accent);
  color: var(--accent-text);
  border: none;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  min-height: 38px;
  white-space: nowrap;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  min-width: 40px;
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  margin-left: -8px;
  flex-shrink: 0;
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: 8px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.btn-icon.danger { color: var(--red); background: rgba(248, 113, 113, 0.1); }
.btn-icon:active { opacity: 0.7; }

/* ===========================
   FORMS
   =========================== */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

.form-input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 14px;
  min-height: 50px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.15s;
}

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

.form-row {
  display: flex;
  gap: 12px;
}

.form-group.half { flex: 1; }

.radio-group {
  display: flex;
  gap: 16px;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  cursor: pointer;
  padding: 10px 0;
}

.radio-label input[type="radio"] {
  width: 18px;
  height: 18px;
  min-height: unset;
  accent-color: var(--accent);
  flex-shrink: 0;
}

/* ===========================
   PROGRESS BARS
   =========================== */
.macro-row {
  margin-bottom: 14px;
}

.macro-row:last-child { margin-bottom: 0; }

.macro-info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}

.macro-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.macro-values {
  font-size: 13px;
  font-weight: 600;
}

.macro-remaining {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 6px;
}

.progress-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--surface3);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar.lg { height: 12px; }

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
  min-width: 0;
}

.progress-fill.over { opacity: 0.7; }

.fill-cal   { background: var(--accent); }
.fill-pro   { background: var(--blue); }
.fill-carb  { background: var(--orange); }
.fill-fat   { background: var(--purple); }
.fill-water { background: var(--cyan); }

.progress-pct {
  font-size: 12px;
  color: var(--text-muted);
  width: 36px;
  text-align: right;
  flex-shrink: 0;
}

/* ===========================
   STREAK
   =========================== */
.streak-badge {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--surface2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  flex-shrink: 0;
}

.streak-icon {
  font-size: 18px;
  line-height: 1;
}

.streak-count {
  font-size: 18px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.streak-label {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===========================
   DATE NAVIGATION
   =========================== */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 4px 0;
}

.date-nav-btn {
  width: 44px;
  height: 44px;
  border: none;
  background: var(--surface2);
  color: var(--text);
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.date-nav-btn:active { opacity: 0.7; }
.date-nav-btn:disabled { opacity: 0.3; }

.date-nav-label {
  font-size: 15px;
  font-weight: 600;
  min-width: 130px;
  text-align: center;
}

/* ===========================
   SEARCH
   =========================== */
.search-bar {
  margin-bottom: 12px;
}

.search-bar input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 16px;
  padding: 12px 16px;
  min-height: 50px;
  outline: none;
  -webkit-appearance: none;
}

.search-bar input:focus { border-color: var(--accent); }

.search-results {
  background: var(--surface);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.search-results.compact {
  max-height: 180px;
  overflow-y: auto;
}

.search-result-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  gap: 8px;
}

.search-result-item:last-child { border-bottom: none; }
.search-result-item:active { background: var(--surface2); }

.search-result-info { flex: 1; min-width: 0; }
.search-result-name { font-weight: 500; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.search-result-cal { font-size: 14px; font-weight: 700; color: var(--accent); white-space: nowrap; }

.search-empty {
  padding: 20px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===========================
   ITEMS LIST
   =========================== */
.items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.product-item, .recipe-item {
  background: var(--surface);
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--border);
  gap: 12px;
}

.item-info { flex: 1; min-width: 0; }
.item-name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.item-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ===========================
   LOG LIST
   =========================== */
.log-list {
  display: flex;
  flex-direction: column;
}

.log-item {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  gap: 8px;
}

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

.log-item-info { flex: 1; min-width: 0; }
.log-item-name { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-item-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.log-item-cal { font-size: 15px; font-weight: 700; color: var(--accent); white-space: nowrap; flex-shrink: 0; }

.log-item-delete {
  width: 32px;
  height: 32px;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 32px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.empty-state-icon { font-size: 36px; }

/* ===========================
   FILTER TABS
   =========================== */
.filter-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.filter-tab {
  flex: 1;
  padding: 9px 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  min-height: 38px;
  transition: all 0.15s;
}

.filter-tab.active {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* ===========================
   CATEGORY BADGE
   =========================== */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-known   { background: #1e3a5f; color: var(--blue); }
.badge-homemade { background: #2d1a0a; color: var(--orange); }
.badge-recipe  { background: var(--accent-dim); color: var(--accent); }

/* ===========================
   MODALS
   =========================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  z-index: 200;
  display: none;
  align-items: flex-end;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.modal.active {
  display: flex;
}

.modal-sheet {
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  padding-bottom: calc(16px + var(--safe-bottom));
}

.modal-sheet-tall { max-height: 96vh; }

@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 10px;
  flex-shrink: 0;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 700;
  flex: 1;
}

.modal-close {
  width: 30px;
  height: 30px;
  border: none;
  background: var(--surface2);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.modal-close:active { opacity: 0.7; }

.modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 20px 8px;
}

/* ===========================
   INPUT WITH SCAN BUTTON
   =========================== */
.input-with-btn {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.input-with-btn .form-input {
  flex: 1;
  min-width: 0;
}

.scan-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 12px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ===========================
   MACROS CALC PILLS
   =========================== */
.macros-calc {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 0;
}

.macro-pill {
  background: var(--surface2);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.macro-pill span {
  color: var(--text);
  font-weight: 700;
}

.log-macros-preview {
  background: var(--surface2);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 14px;
  color: var(--text-muted);
  line-height: 1.8;
}

/* ===========================
   WATER
   =========================== */
.water-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 16px;
}

.water-btn {
  width: 58px;
  height: 58px;
  border: none;
  background: var(--surface2);
  color: var(--text);
  border-radius: 50%;
  font-size: 30px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 300;
  line-height: 1;
}

.water-btn.plus {
  background: var(--cyan);
  color: #0f1a20;
  font-weight: 700;
}

.water-btn:active { opacity: 0.7; }

.water-display {
  font-size: 20px;
  font-weight: 700;
  min-width: 120px;
  text-align: center;
}

/* ===========================
   FASTING TIMER
   =========================== */
.fasting-timer {
  font-size: 52px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--accent);
  letter-spacing: 3px;
  margin: 8px 0 16px;
  line-height: 1;
}

.fasting-timer.active-fast { color: var(--yellow); }

.fasting-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.fasting-controls .btn-primary { min-width: 160px; }

.fasting-history { margin-top: 4px; }

.fasting-history-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.fasting-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.fasting-history-item:last-child { border-bottom: none; }

.fasting-history-dates { color: var(--text-muted); }
.fasting-duration { font-weight: 700; color: var(--accent); }

/* ===========================
   MENU ITEMS (More screen)
   =========================== */
.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 15px;
  font-weight: 500;
}

.menu-item:active { opacity: 0.7; }
.chevron { color: var(--text-muted); font-size: 22px; line-height: 1; }

/* ===========================
   WEEKLY CHART
   =========================== */
#weekly-chart {
  width: 100%;
  display: block;
}

.weekly-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-box {
  background: var(--surface2);
  border-radius: 12px;
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ===========================
   SETTINGS
   =========================== */
.settings-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}

.settings-row label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 500;
}

/* ===========================
   BARCODE SCANNER
   =========================== */
.scanner-viewport {
  position: relative;
  width: 100%;
  border-radius: 14px;
  overflow: hidden;
  background: #000;
  aspect-ratio: 1;
}

.scanner-viewport video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scanner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.scanner-frame {
  width: 65%;
  aspect-ratio: 2;
  border: 2px solid var(--accent);
  border-radius: 10px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.45);
}

.scanner-hint {
  color: #fff;
  font-size: 13px;
  background: rgba(0, 0, 0, 0.65);
  padding: 5px 14px;
  border-radius: 99px;
}

.scanner-status {
  margin-top: 14px;
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
  padding: 12px;
  background: var(--surface2);
  border-radius: 10px;
}

/* ===========================
   RECIPE BUILDER
   =========================== */
.recipe-ingredient-item {
  display: flex;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  gap: 10px;
}

.recipe-ingredient-item:last-child { border-bottom: none; }

.recipe-ingredient-name {
  flex: 1;
  font-size: 14px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recipe-ingredient-qty {
  width: 80px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 7px 8px;
  text-align: center;
  outline: none;
  flex-shrink: 0;
  min-height: 38px;
  -webkit-appearance: none;
}

.recipe-ingredient-qty:focus { border-color: var(--accent); }

.recipe-ingredient-remove {
  width: 30px;
  height: 30px;
  border: none;
  background: none;
  color: var(--red);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.recipe-totals-bar {
  background: var(--surface2);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0;
  line-height: 1.8;
}

.recipe-totals-bar b { color: var(--text); }

/* ===========================
   TOAST
   =========================== */
.toast {
  position: fixed;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: var(--surface3);
  color: var(--text);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  white-space: nowrap;
  border: 1px solid var(--border);
  pointer-events: none;
  max-width: calc(100vw - 48px);
  text-align: center;
  white-space: normal;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===========================
   STREAK BEST
   =========================== */
.streak-row {
  display: flex;
  gap: 10px;
}

.streak-box {
  flex: 1;
  background: var(--surface2);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}

.streak-box-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.streak-box-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ===========================
   MISC
   =========================== */
.divider {
  height: 1px;
  background: var(--border);
  margin: 12px 0;
}

.section-title {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 10px;
}

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

/* ===========================
   LOGIN SCREEN
   =========================== */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px 20px;
  padding-top: calc(24px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

#login-screen.hidden { display: none; }

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 40px 32px 36px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  font-size: 36px;
  font-weight: 800;
  color: #f97316;
  letter-spacing: -1px;
  line-height: 1;
  margin-bottom: 10px;
}

.login-logo .brand-runner {
  height: 1em;
  width: auto;
  margin: 0 2px;
}

.login-tagline {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 32px;
  line-height: 1.4;
}

.login-error {
  font-size: 13px;
  color: var(--red);
  min-height: 20px;
  margin-bottom: 12px;
  font-weight: 500;
}

.pw-toggle {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 12px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  min-height: 50px;
  min-width: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}

.pw-toggle:hover { color: var(--text); }

.settings-username {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 14px;
  padding: 2px 0;
}

/* ===========================
   ONBOARDING SCREEN
   =========================== */
#onboarding-screen {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  z-index: 900;
}

#onboarding-screen.hidden { display: none; }

.ob-header {
  flex-shrink: 0;
  padding: 16px 24px 12px;
  padding-top: calc(16px + env(safe-area-inset-top, 0px));
}

.ob-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

#ob-step-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.ob-progress {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}

.ob-progress-fill {
  height: 100%;
  background: #f97316;
  border-radius: 2px;
  width: 0%;
  transition: width 0.35s ease;
}

.ob-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 24px 16px;
}

.ob-footer {
  flex-shrink: 0;
  display: flex;
  gap: 12px;
  padding: 12px 24px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.ob-footer .ob-back  { min-width: 100px; }
.ob-footer .ob-next  { flex: 1; }

/* ── Typography ── */
.ob-title {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.4px;
  margin-bottom: 6px;
  line-height: 1.2;
}

.ob-sub {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 28px;
  line-height: 1.4;
}

.ob-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.ob-field { margin-bottom: 20px; }

.ob-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 4px;
}

/* ── Scroll Picker ── */
.scroll-picker {
  position: relative;
  height: 220px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
}

.sp-track {
  height: 100%;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 88px 0;
}

.sp-track::-webkit-scrollbar { display: none; }

.sp-item {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  font-size: 17px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
}

.sp-highlight {
  position: absolute;
  top: 50%;
  left: 12px;
  right: 12px;
  height: 44px;
  transform: translateY(-50%);
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.4);
  border-radius: 10px;
  pointer-events: none;
  z-index: 2;
}

.sp-fade {
  position: absolute;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 1;
}

.sp-fade-top {
  top: 0;
  background: linear-gradient(to bottom, var(--surface2) 0%, transparent 100%);
}

.sp-fade-bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--surface2) 0%, transparent 100%);
}

/* ── Sex / Binary selector cards ── */
.ob-btn-row {
  display: flex;
  gap: 12px;
}

.ob-sel-card {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 18px 12px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
  user-select: none;
}

.ob-sel-card input { display: none; }

.ob-sel-card:has(input:checked) {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.1);
  color: #f97316;
}

/* ── Weight diff pill ── */
.ob-diff {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  padding: 14px;
  background: var(--surface2);
  border-radius: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.diff-lose { color: #4ade80; }
.diff-gain { color: #f97316; }

/* ── Timeline breakdown ── */
.ob-timeline {
  background: var(--surface2);
  border-radius: 14px;
  padding: 16px;
  margin-top: 14px;
  border: 1px solid var(--border);
  min-height: 60px;
}

.ob-breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.ob-breakdown-item { text-align: center; }

.ob-breakdown-val {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.3px;
}

.ob-breakdown-lbl {
  font-size: 10px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

.ob-achieve {
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  border-radius: 10px;
  line-height: 1.4;
}

.achieve-green  { background: rgba(74,222,128,0.12);  color: #4ade80; }
.achieve-yellow { background: rgba(250,204,21,0.12);  color: #facc15; }
.achieve-orange { background: rgba(249,115,22,0.12);  color: #fb923c; }
.achieve-red    { background: rgba(248,113,113,0.12); color: #f87171; }

/* ── Activity / compact option rows ── */
.ob-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ob-row-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  user-select: none;
}

.ob-row-card input { display: none; }

.ob-row-card:has(input:checked) {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.08);
}

.ob-row-card.compact { padding: 11px 14px; }

.ob-row-body { flex: 1; }

.ob-row-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.ob-row-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.ob-row-check {
  color: #f97316;
  font-weight: 800;
  font-size: 15px;
  opacity: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.ob-row-card:has(input:checked) .ob-row-check { opacity: 1; }

/* ── Chips (dietary + goal) ── */
.ob-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ob-chip {
  display: inline-flex;
  cursor: pointer;
  user-select: none;
}

.ob-chip input { display: none; }

.ob-chip span {
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface2);
  border: 2px solid var(--border);
  color: var(--text-muted);
  transition: all 0.15s;
}

.ob-chip:has(input:checked) span {
  background: rgba(249, 115, 22, 0.1);
  border-color: #f97316;
  color: #f97316;
  font-weight: 600;
}

/* ── Seed meals ── */
.ob-seed-list { margin-top: 12px; }

.ob-seed-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}

.ob-seed-item:last-child { border-bottom: none; }

.ob-seed-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

/* ── Skip link ── */
.ob-skip-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
  padding: 8px 16px;
  text-decoration: underline;
  font-family: inherit;
}

.ob-skip-btn:hover { color: var(--text-muted); }

/* ── Step error ── */
.ob-step-error {
  font-size: 13px;
  color: var(--red);
  padding: 10px 14px;
  background: rgba(248,113,113,0.08);
  border-radius: 10px;
  margin-top: 12px;
  font-weight: 500;
}

/* ===========================
   DESKTOP RESPONSIVE LAYOUT
   =========================== */

/* Nav logo — hidden on mobile, shown on desktop sidebar */
.nav-logo {
  display: none;
  font-size: 22px;
  font-weight: 800;
  color: #f97316;
  letter-spacing: -0.4px;
  padding: 4px 14px 24px;
  line-height: 1;
}

@media (min-width: 768px) {
  /* Darker page background visible outside the app frame */
  body {
    display: flex;
    justify-content: center;
    background: #060606;
  }

  /* Onboarding centered card on desktop */
  #onboarding-screen {
    align-items: center;
    justify-content: center;
    background: #060606;
  }

  #onboarding-screen > * {
    width: 100%;
    max-width: 560px;
  }

  .ob-header { border-radius: 20px 20px 0 0; background: var(--surface); border: 1px solid var(--border); border-bottom: none; padding-top: 28px; }
  .ob-body   { background: var(--surface); border-left: 1px solid var(--border); border-right: 1px solid var(--border); }
  .ob-footer { border-radius: 0 0 20px 20px; background: var(--surface); border: 1px solid var(--border); border-top: 1px solid var(--border); }

  /* Centered app container */
  #shell {
    position: relative;
    display: flex;
    width: 100%;
    max-width: 1100px;
    height: 100vh;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--border), 0 24px 80px rgba(0, 0, 0, 0.6);
  }

  /* Sidebar nav — override fixed mobile styles */
  #bottom-nav {
    position: relative;
    top: auto; left: auto; right: auto; bottom: auto;
    width: 220px;
    height: 100vh;
    flex-shrink: 0;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    border-top: none;
    border-right: 1px solid var(--border);
    padding: 28px 12px 24px;
    gap: 2px;
  }

  .nav-logo {
    display: flex;
    align-items: center;
  }

  .nav-item {
    flex-direction: row;
    justify-content: flex-start;
    font-size: 14px;
    font-weight: 500;
    padding: 6px 8px;
    border-radius: 12px;
    min-height: 52px;
    gap: 12px;
    letter-spacing: 0;
  }

  .nav-icon-wrap {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    flex-shrink: 0;
  }

  .nav-icon-wrap svg { width: 22px; height: 22px; }

  /* Remove old generic active highlight — per-item colors handle it */
  .nav-item.active { background: none; }

  /* App content area — override fixed mobile styles */
  #app {
    position: relative;
    top: auto; left: auto; right: auto; bottom: auto;
    flex: 1;
    min-width: 0;
    height: 100vh;
    overflow: hidden;
  }

  /* More breathing room on desktop */
  .view-content {
    padding: 28px 32px 48px;
  }

  /* Modals become centered dialogs instead of bottom sheets */
  .modal {
    align-items: center;
    justify-content: center;
  }

  .modal-sheet {
    width: 480px;
    max-width: 90%;
    border-radius: 20px;
    animation: fadeScale 0.22s cubic-bezier(0.32, 0.72, 0, 1);
  }

  @keyframes fadeScale {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
  }

  /* Hide the drag handle — not needed for dialog */
  .modal-handle { display: none; }

  /* Toast sits above the bottom edge */
  .toast { bottom: 24px; }
}

@media (min-width: 1100px) {
  #shell { max-width: 1200px; }
  #bottom-nav { width: 248px; }
  .nav-logo { font-size: 24px; }
  .view-content { padding: 32px 40px 56px; }
  .nav-icon-wrap { width: 46px; height: 46px; border-radius: 14px; }
  .nav-icon-wrap svg { width: 24px; height: 24px; }
}

/* ===========================
   ONBOARDING STEP 7 — PLAN
   =========================== */
.ob-plan-section {
  margin-bottom: 24px;
}

.ob-plan-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* BMI gradient bar */
.ob-bmi-bar-wrap {
  margin-bottom: 8px;
}

.ob-bmi-bar {
  position: relative;
  height: 14px;
  border-radius: 99px;
  background: linear-gradient(
    to right,
    #38bdf8 0% 14%,
    #4ade80 14% 40%,
    #facc15 40% 60%,
    #f87171 60% 100%
  );
  margin-bottom: 4px;
}

.ob-bmi-marker {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--bg);
  box-shadow: 0 0 0 2px rgba(255,255,255,.5);
}

.ob-bmi-zones {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-muted);
  padding: 0 2px;
}

.ob-bmi-val {
  font-size: 16px;
  font-weight: 700;
  margin-top: 8px;
}

.ob-bmi-val.bmi-under  { color: #38bdf8; }
.ob-bmi-val.bmi-normal { color: #4ade80; }
.ob-bmi-val.bmi-over   { color: #facc15; }
.ob-bmi-val.bmi-obese  { color: #f87171; }

/* Calorie/protein cards */
.ob-plan-cards {
  display: flex;
  gap: 10px;
}

.ob-plan-card {
  flex: 1;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
}

.ob-plan-card.highlight {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.ob-plan-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.ob-plan-card.highlight .ob-plan-num {
  color: var(--accent);
}

.ob-plan-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.ob-plan-note {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
  padding: 12px 0 4px;
}

/* ===========================
   DASHBOARD — GREETING
   =========================== */
.dash-header {
  align-items: flex-start;
}

.dash-greeting-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dash-greeting {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.dash-date-full {
  font-size: 13px;
  color: var(--text-muted);
}

/* Streak badge (compact in header) */
.streak-count {
  font-size: 18px;
  font-weight: 800;
  color: var(--orange);
}

/* ===========================
   DASHBOARD — CALORIE RING
   =========================== */
.cal-card {
  padding: 20px;
}

.cal-ring-row {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 20px;
}

.cal-ring-wrap {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.cal-ring-svg {
  width: 120px;
  height: 120px;
}

.cal-ring-bg {
  stroke: var(--surface3);
  stroke-width: 10;
  fill: none;
}

.cal-ring-arc {
  stroke: var(--accent);
  stroke-width: 10;
  fill: none;
  stroke-linecap: round;
  stroke-dasharray: 0 326.73;
  transform: rotate(-90deg);
  transform-origin: 60px 60px;
  transition: stroke-dasharray 0.5s ease, stroke 0.3s ease;
}

.cal-ring-arc.over-budget {
  stroke: var(--red);
}

.cal-ring-center {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
}

.cal-ring-num {
  display: block;
  font-size: 26px;
  font-weight: 800;
  line-height: 1;
}

.cal-ring-lbl {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.cal-ring-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.cal-info-item {
  text-align: center;
  width: 100%;
}

.cal-info-val {
  font-size: 24px;
  font-weight: 800;
  line-height: 1;
  color: var(--text);
}

.cal-info-item:last-child .cal-info-val {
  color: var(--accent);
}

.cal-info-item.over-budget:last-child .cal-info-val {
  color: var(--red);
}

.cal-info-lbl {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.cal-info-divider {
  height: 1px;
  background: var(--border);
  width: 70%;
}

/* ===========================
   DASHBOARD — SECONDARY MACROS
   =========================== */
.macro-secondary-row {
  display: flex;
  gap: 16px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.macro-mini {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.macro-mini-lbl {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===========================
   DASHBOARD — WATER BOTTLES
   =========================== */
.water-bottles {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0 4px;
  align-items: flex-end;
}

.water-bottle {
  width: 22px;
  height: 38px;
  border-radius: 4px 4px 7px 7px;
  border: 2px solid var(--surface3);
  position: relative;
  overflow: hidden;
  background: var(--surface2);
}

.water-bottle-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--cyan);
  opacity: 0.85;
  transition: height 0.4s ease;
}

/* ===========================
   DASHBOARD — LOG LIST
   =========================== */
.log-total-badge {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}

.log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

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

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

.log-item-name {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.log-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.log-item-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.log-item-cal {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.log-kcal-unit {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-muted);
}

.log-item-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.log-item-delete:hover {
  color: var(--red);
  background: rgba(248, 113, 113, 0.12);
}

/* ===========================
   FAB — FLOATING ACTION BUTTON
   =========================== */
.fab-btn {
  position: fixed;
  bottom: calc(var(--nav-height) + 12px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--orange);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
  box-shadow: 0 4px 20px rgba(251, 146, 60, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.fab-btn:hover {
  box-shadow: 0 6px 24px rgba(251, 146, 60, 0.65);
}

.fab-btn:active {
  transform: translateX(-50%) scale(0.92);
}

.fab-btn svg {
  width: 28px;
  height: 28px;
  stroke: #fff;
}

/* ===========================
   QUICK LOG MODAL
   =========================== */
.ql-actions {
  display: flex;
  gap: 12px;
  margin: 16px 0 8px;
}

.ql-action-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.ql-action-btn:hover {
  background: var(--surface3);
}

.ql-action-icon {
  font-size: 20px;
}

.ql-hint {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

/* Desktop FAB adjustments */
@media (min-width: 768px) {
  .fab-btn {
    bottom: 32px;
    right: 32px;
    left: auto;
    transform: none;
  }

  .fab-btn:active {
    transform: scale(0.92);
  }
}

/* ===========================
   MEALS VIEW — TABS
   =========================== */
.meals-tabs-bar {
  display: flex;
  gap: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none;
}

.meals-tabs-bar::-webkit-scrollbar { display: none; }

.meals-tab {
  flex-shrink: 0;
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.meals-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 700;
}

.meals-panel {
  display: none;
}

.meals-panel.active {
  display: block;
}

/* ===========================
   MEALS VIEW — MEAL CARDS
   =========================== */
.meal-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

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

.meal-main {
  flex: 1;
  min-width: 0;
}

.meal-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.meal-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.meal-servings {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

.meal-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}

.btn-log-now {
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-log-now:hover {
  background: rgba(74, 222, 128, 0.25);
}

.btn-log-now:active {
  transform: scale(0.96);
}

.meal-icon-btns {
  display: flex;
  gap: 4px;
}

/* ===========================
   MEALS VIEW — PRODUCT ITEMS
   =========================== */
.product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

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

.item-info {
  flex: 1;
  min-width: 0;
}

.item-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.item-per {
  color: var(--text-dim);
  font-size: 11px;
}

/* ===========================
   THREE-STREAK ROW
   =========================== */
.three-streaks {
  display: flex;
  align-items: center;
  justify-content: space-around;
}

.streak3-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.streak3-div {
  width: 1px;
  height: 32px;
  background: var(--border);
}

.streak3-icon {
  font-size: 18px;
  line-height: 1;
}

.streak3-val {
  font-size: 22px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.streak3-lbl {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ===========================
   CHALLENGES
   =========================== */
.challenges-card {
  padding: 12px 16px;
}

.challenges-count {
  font-size: 12px;
  color: var(--text-muted);
}

.challenge-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.challenge-icon {
  font-size: 20px;
  flex-shrink: 0;
  line-height: 1.3;
}

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

.challenge-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

.challenge-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.challenge-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.challenge-bar {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 3px;
  overflow: hidden;
}

.challenge-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.challenge-progress {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===========================
   CELEBRATION OVERLAY
   =========================== */
.celebration-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
}

.celebration-overlay.active {
  display: flex;
}

.confetti-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall linear forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  80%  { opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

.celebration-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 24px;
  text-align: center;
  max-width: 300px;
  width: 90%;
  position: relative;
  z-index: 1;
}

.cel-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 8px;
}

.cel-badge-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.cel-title {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 6px;
}

.cel-desc {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.cel-btn {
  width: 100%;
}

/* ===========================
   PROGRESS VIEW
   =========================== */
.weight-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.weight-input-row .form-input {
  flex: 1;
}

.btn-save-weight {
  flex-shrink: 0;
  padding: 10px 20px;
}

.progress-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

.progress-streaks-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.prog-streak-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.prog-streak-icon {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.prog-streak-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.prog-streak-unit {
  font-size: 12px;
  font-weight: 400;
  color: var(--text-muted);
}

.prog-streak-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
}

.prog-streak-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.badge-item {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 8px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border-top: 3px solid var(--badge-color, var(--accent));
}

.badge-item-icon {
  font-size: 28px;
  line-height: 1;
}

.badge-item-name {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.2;
  text-align: center;
}

/* ===========================
   PROFILE VIEW
   =========================== */
.profile-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.profile-stat {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.profile-stat-lbl {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.profile-stat-val {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.profile-goal-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.profile-goal-chip {
  background: rgba(249,115,22,0.12);
  color: var(--accent);
  border: 1px solid rgba(249,115,22,0.25);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
}

.profile-bmi-section {
  margin-top: 4px;
}

/* Nav Log action button — never shows active state */
.nav-log-action.active {
  background: none;
  color: var(--text-muted);
}
.nav-log-action.active .nav-icon-wrap {
  background: rgba(249,115,22,0.12);
}

/* ── Auth panel switch row ── */
.auth-switch-row {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 0;
}
.auth-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ── Online food search results ── */
.search-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 14px 6px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.search-result-online {
  opacity: 0.9;
}
.search-result-online .search-result-meta {
  color: #60a5fa;
}
