/* =========================================================
   MacroTune — Premium Dark Design System
   Spec: docs/superpowers/specs/2026-04-02-ui-redesign-design.md
   ========================================================= */

/* ── 1. Custom properties ── */
:root {
  --bg-base:        #010409;
  --bg-surface:     #0d1117;
  --bg-card:        #161b22;
  --bg-subtle:      #21262d;
  --text-primary:   #e6edf3;
  --text-secondary: #8b949e;
  --text-muted:     #7d8590;
  --accent:         #58a6ff;
  --accent-dark:    #1f6feb;
  --accent-bg:      rgba(88,166,255,.1);
  --success:        #22c55e;
  --success-bg:     rgba(34,197,94,.1);
  --danger:         #f85149;
  --warning:        #d29922;
  --border:         #21262d;
  --border-muted:   #30363d;
  --radius-card:    8px;
  --radius-btn:     6px;
  --radius-sm:      4px;
  --radius-input:   6px;
}

/* ── 2. Reset ── */
html { font-size: 16px; }

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

/* ── 3. Base ── */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-base);
  min-height: 100vh;
  color: var(--text-primary);
  font-size: 0.875rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── 4. App shell ── */
.container {
  max-width: 100%;
  min-height: 100vh;
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
}

/* ── 5. Header ── */
.header {
  padding: 8px 16px 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-title-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 2px 0;
}

.header-sub-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
}

.header h1 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -.3px;
  white-space: nowrap;
}

/* Hide old subtitle */
.header > p { display: none; }

/* User status badge */
.user-status {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--success-bg);
  border: 1px solid rgba(34,197,94,.25);
  padding: 4px 12px;
  border-radius: 20px;
  color: var(--success);
  font-size: 0.75rem;
  font-weight: 600;
  flex-shrink: 0;
}

/* ── 6. Hamburger / dropdown ── */
.data-menu { position: relative; margin-left: auto; }

/* ── Day-of-week pill selector ── */
.day-pills {
  display: flex;
  flex-wrap: nowrap;
  gap: 5px;
}

.day-pill {
  flex: 1;
  text-align: center;
  padding: 7px 4px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.2);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}

.day-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.menu-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  transition: border-color .15s, color .15s;
}

.menu-btn:hover {
  border-color: var(--accent);
  color: var(--text-primary);
  transform: none;
  box-shadow: none;
}

.hamburger { display: flex; flex-direction: column; gap: 3px; }
.hamburger span { width: 16px; height: 2px; background: currentColor; border-radius: 1px; }

.dropdown-content {
  display: none;
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--bg-card);
  min-width: 200px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  z-index: 1000;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.dropdown-content.show { display: block; }

.dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  transition: background .15s, color .15s;
}

.dropdown-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.dropdown-item:last-child { border-bottom: none; }

.file-input { display: none; }

/* ── 7. Main tab bar (mobile) — scoped to direct .container child ── */
.container > .tabs {
  display: flex;
  background: var(--bg-base);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}
.container > .tabs::-webkit-scrollbar { display: none; }

/* Auth modal tab bar keeps a minimal style */
#authTabs {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 0;
}

/* ── 8. Tab buttons (main nav) ── */
.container > .tabs > .tab {
  flex: 1;
  min-width: 52px;
  padding: 10px 4px 8px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.5625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

/* Icon via data-icon attribute */
.container > .tabs > .tab::before {
  content: attr(data-icon);
  font-size: 0.875rem;
  text-transform: none;
  letter-spacing: 0;
}

.container > .tabs > .tab:hover { color: var(--text-secondary); }

.container > .tabs > .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  transform: none;
  box-shadow: none;
  background: transparent;
}

/* Auth modal tabs */
#authTabs .tab {
  flex: 1;
  padding: 10px 16px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color .15s, border-color .15s;
  transform: none;
  box-shadow: none;
}

#authTabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  background: transparent;
}

/* ── 9. Tab content ── */
.tab-content { display: none; padding: 16px; }
.tab-content.active { display: block; }

/* ── 10. Cards ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: none;
  transition: border-color .15s;
}

.card:hover { transform: none; box-shadow: none; border-color: var(--border-muted); }

.card h3 {
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 14px;
}

/* ── 11. Buttons ── */
.btn {
  background: var(--accent);
  color: var(--bg-surface);
  border: none;
  padding: 9px 18px;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
  display: inline-block;
}

.btn:hover { background: var(--accent-dark); transform: none; box-shadow: none; }

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

.btn-secondary:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--accent);
}

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #c93c37; }

/* ── 12. Forms ── */
.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-input);
  font-family: inherit;
  font-size: 0.8125rem;
  color: var(--text-primary);
  transition: border-color .15s, box-shadow .15s;
}

.form-group input::placeholder,
.form-group textarea::placeholder { color: var(--text-muted); }

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.12);
}

.macro-inputs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.macro-range-group {
  padding: 12px;
  background: var(--bg-surface);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
}

.serving-info {
  font-size: 0.6875rem;
  color: var(--accent);
  margin-top: 4px;
}

/* ── 13. Macro display (ingredients & meals cards) ── */
.macro-display {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.macro-item {
  text-align: center;
  padding: 8px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.macro-item .label {
  font-size: 0.625rem;
  color: var(--text-muted);
  margin-bottom: 3px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.macro-item .value {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--text-primary);
}

/* ── 14. Planner ── */
.target-macros {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 12px;
}

.target-macros h3 {
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.generated-plan {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 16px;
  margin-top: 12px;
}

/* Override the hardcoded inline color on "Generated Meal Plan" h3 */
.generated-plan h3 { color: var(--text-primary) !important; }

.day-plan {
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-left-color: var(--accent);
}

.meal-list { display: grid; gap: 8px; margin-top: 10px; }

.meal-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.meal-item .name { font-weight: 600; font-size: 0.8125rem; color: var(--text-primary); }
.meal-item .macros { font-size: 0.6875rem; color: var(--text-muted); }

/* ── 15. Progress bars ── */
.progress-bar {
  width: 100%;
  height: 5px;
  background: var(--bg-subtle);
  border-radius: 3px;
  margin-top: 6px;
  overflow: hidden;
}

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

/* ── 16. Misc content components ── */
.optimization-results {
  margin-top: 14px;
  padding: 12px;
  background: var(--success-bg);
  border-radius: var(--radius-card);
  border-left: 3px solid var(--success);
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.export-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--border-muted);
  padding: 7px 14px;
  border-radius: var(--radius-btn);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.export-btn:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  transform: none;
  box-shadow: none;
}

.meal-ingredient-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.meal-ingredient-row select { min-width: 180px; flex: 2; }
.meal-ingredient-row input { flex: 1; min-width: 80px; }
.meal-ingredient-row button { flex: 0 0 auto; white-space: nowrap; }

.ingredient-preview {
  font-size: 0.6875rem;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ── 17. Modal ── */
.modal {
  display: none;
  position: fixed;
  z-index: 3000;
  left: 0; top: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
}

.modal.show {
  display: flex;
  align-items: center;
  justify-content: center;
  animation: modalFadeIn .2s ease;
}

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

.modal-content {
  background: var(--bg-card);
  margin: 16px;
  padding: 24px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
  border-radius: var(--radius-card);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  max-height: 85dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  box-shadow: 0 20px 48px rgba(0,0,0,.55);
  animation: modalSlideIn .2s ease;
}

@keyframes modalSlideIn {
  from { transform: translateY(-20px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 { font-size: 0.9375rem; font-weight: 700; color: var(--text-primary); margin: 0; }

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color .15s, background .15s;
}

.close-btn:hover { color: var(--text-primary); background: var(--bg-subtle); }

.modal-body h3 {
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 600;
  margin-top: 18px;
  margin-bottom: 10px;
}

.modal-body p {
  line-height: 1.6;
  margin-bottom: 10px;
  color: var(--text-secondary);
  font-size: 0.8125rem;
}

.modal-body ul { margin-left: 18px; margin-bottom: 10px; }
.modal-body li { margin-bottom: 6px; color: var(--text-secondary); font-size: 0.8125rem; }

/* ── 18. Auth form ── */
.auth-form { color: var(--text-primary); }
.auth-form .form-group label { color: var(--text-secondary); }
.auth-form .form-group input {
  background: var(--bg-surface);
  border: 1px solid var(--border-muted);
  color: var(--text-primary);
}
.auth-form .form-group input:focus { border-color: var(--accent); }

/* ── 19. Notification toast ── */
.notification {
  position: fixed;
  top: 16px;
  right: 16px;
  padding: 12px 16px;
  border-radius: var(--radius-card);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 600;
  z-index: 4000;
  transform: translateX(calc(100% + 20px));
  transition: transform .3s ease;
  max-width: 320px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}

.notification.show  { transform: translateX(0); }
.notification.success { border-left-color: var(--success); }
.notification.error   { border-left-color: var(--danger); }

/* ── 20. Footer ── */
.footer {
  text-align: center;
  margin-top: 32px;
  padding: 16px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.75rem;
}

.footer a { color: var(--accent); text-decoration: none; }
.footer a:hover { color: var(--text-primary); }
.version-info { margin-top: 6px; font-size: 0.6875rem; color: var(--text-muted); font-style: italic; }
.version-number { color: var(--accent); font-weight: 600; }

/* Hide marketing footer on mobile — it overlaps the bottom tab bar and
   gets cut off. Privacy Policy is reachable from the hamburger / About
   modal anyway. */
@media (max-width: 899px) {
  .footer { display: none; }
}

/* ── 21. Desktop: sidebar layout (≥900px) ── */
@media (min-width: 900px) {
  html { font-size: 18px; }

  .container {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  /* Header spans full width */
  .header {
    flex: 0 0 100%;
    order: 0;
  }

  /* Tab bar becomes left sidebar */
  .container > .tabs {
    flex: 0 0 200px;
    flex-direction: column;
    border-bottom: none;
    border-right: 1px solid var(--border);
    overflow-x: visible;
    overflow-y: auto;
    order: 1;
    position: sticky;
    top: 49px;
    height: calc(100vh - 49px);
    padding: 8px 0;
  }

  .container > .tabs > .tab {
    min-width: unset;
    width: 100%;
    flex-direction: row;
    justify-content: flex-start;
    padding: 10px 16px;
    gap: 10px;
    font-size: 0.75rem;
    text-transform: none;
    letter-spacing: 0;
    border-bottom: none;
    border-left: 3px solid transparent;
    border-radius: 0;
  }

  .container > .tabs > .tab::before { font-size: 1rem; }

  .container > .tabs > .tab.active {
    border-bottom-color: transparent;
    border-left-color: var(--accent);
    background: var(--bg-card);
    color: var(--text-primary);
  }

  /* Main content area */
  .tab-content {
    flex: 1;
    order: 2;
    padding: 24px;
    min-width: 0;
  }
}

/* ── 22. Mobile adjustments ── */
@media (max-width: 640px) {
  .meal-ingredient-row {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .meal-ingredient-row select,
  .meal-ingredient-row input,
  .meal-ingredient-row button {
    width: 100%;
    flex: none;
  }

  .macro-inputs { grid-template-columns: 1fr; }

  .user-status {
    font-size: 0.7rem;
  }
}

/* ── Today tab: date navigation ─────────────────────────────────────── */
.today-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 12px 0 8px;
}

.date-nav-arrow {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

.date-nav-arrow:hover:not(:disabled) {
  background: var(--bg-card);
  color: var(--text-primary);
}

.date-nav-arrow:disabled {
  opacity: 0.3;
  cursor: default;
}

.date-nav-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 200px;
  text-align: center;
}

.date-today-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

#verify-wall {
  position: fixed;
  inset: 0;
  background: var(--bg-surface);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.verify-wall-content {
  text-align: center;
  max-width: 420px;
  width: 100%;
}

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

.btn-link:hover { opacity: 0.8; }

.past-day-notice {
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  padding: 8px 0 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.streak-badge {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: rgba(255, 107, 107, 0.15);
  border: 1px solid rgba(255, 107, 107, 0.4);
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ff6b6b;
  vertical-align: middle;
}

/* ── Quick log & Today view enhancements ── */

.btn-eaten-full {
  display: block;
  width: calc(100% - 32px);
  margin: 8px 16px 4px;
  padding: 13px;
  background: linear-gradient(135deg, #1a7a3a, #22c55e);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.2px;
}

.btn-eaten-full:active {
  opacity: 0.85;
}

.slot-secondary-actions {
  display: flex;
  gap: 20px;
  padding: 0 16px 12px;
}

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

.btn-link:hover {
  color: var(--text-secondary);
}

/* FAB */
.fab-btn {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.6rem;
  font-weight: 300;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(88, 166, 255, 0.4);
  z-index: 200;
  line-height: 1;
}

.fab-btn.visible {
  display: flex;
}

/* Bottom sheet */
.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 300;
  display: flex;
  align-items: flex-end;
}

.bottom-sheet {
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bottom-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.bottom-sheet-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.bottom-sheet-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 4px 8px;
}

.quick-add-input {
  margin: 12px 16px;
  padding: 10px 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-muted);
  border-radius: var(--radius-input);
  color: var(--text-primary);
  font-size: 0.9rem;
  width: calc(100% - 32px);
}

.quick-add-input:focus {
  outline: none;
  border-color: var(--accent);
}

.quick-add-results {
  overflow-y: auto;
  flex: 1;
  padding: 0 16px 16px;
}

.quick-add-group-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin: 12px 0 6px;
}

.quick-add-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 10px;
  border-radius: 8px;
  margin-bottom: 4px;
  background: var(--bg-subtle);
}

.quick-add-row-info { flex: 1; }
.quick-add-row-name { color: var(--text-primary); font-size: 0.88rem; font-weight: 500; }
.quick-add-row-meta { color: var(--text-muted); font-size: 0.75rem; margin-top: 1px; }

.quick-add-servings {
  width: 52px;
  padding: 5px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-muted);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 0.85rem;
  text-align: center;
  margin: 0 8px;
}

.quick-add-log-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

/* Extras section */
.extras-section-label {
  padding: 12px 16px 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  border-top: 1px solid var(--border);
}

.extra-entry-row {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.extra-entry-info { flex: 1; }
.extra-entry-name { color: var(--text-primary); font-size: 0.85rem; font-weight: 500; }
.extra-entry-macros { color: var(--text-muted); font-size: 0.75rem; margin-top: 2px; }

.extra-entry-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
}

.extra-entry-remove:hover { color: var(--danger); }

/* ── 23. Foods tab sub-toggle ────────────────────────────────────────── */
.foods-subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.foods-subtab {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 9px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.foods-subtab.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.foods-subtab-content { display: none; }
.foods-subtab-content.active { display: block; }

/* ── 24. Mobile UX foundation ───────────────────────────────────────── */

/* Prevent 300ms click delay and accidental double-tap zoom */
button, a, .tab, .dropdown-item {
  touch-action: manipulation;
}

/* Hover styles only on devices that actually have a hover pointer */
@media (hover: none) {
  .menu-btn:hover,
  .dropdown-item:hover,
  .card:hover,
  .btn-link:hover,
  .date-nav-arrow:hover:not(:disabled),
  .extra-entry-remove:hover {
    background: inherit;
    color: inherit;
    border-color: inherit;
    opacity: 1;
  }
}

/* Bottom sheet respects iOS home-indicator safe area */
.bottom-sheet { padding-bottom: env(safe-area-inset-bottom); }

@media (max-width: 899px) {
  /* Header respects notch / status bar */
  .header { padding-top: calc(10px + env(safe-area-inset-top)); }

  /* Move tab bar to bottom for one-handed reach */
  .container > .tabs {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    border-bottom: none;
    border-top: 1px solid var(--border);
    background: var(--bg-base);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 90;
    overflow-x: visible;
  }

  /* Bigger, legible tab labels; active indicator above instead of below */
  .container > .tabs > .tab {
    font-size: 0.75rem;
    padding: 10px 4px 8px;
    border-bottom: none;
    border-top: 2px solid transparent;
    min-height: 56px;
  }
  .container > .tabs > .tab.active {
    border-bottom-color: transparent;
    border-top-color: var(--accent);
  }
  .container > .tabs > .tab::before { font-size: 1.2rem; }

  /* Keep main content above the bottom tab bar */
  .tab-content.active {
    padding-bottom: calc(72px + env(safe-area-inset-bottom));
  }

  /* iOS Safari zooms when input font-size < 16px on focus — prevent it */
  input, select, textarea { font-size: 16px; }

  /* FAB clears the bottom bar */
  .fab-btn { bottom: calc(76px + env(safe-area-inset-bottom)); }

  /* Bigger tap targets on small touch elements */
  .date-nav-arrow { width: 44px; height: 44px; }
  .menu-btn { width: 44px; height: 44px; }
  .extra-entry-remove,
  .bottom-sheet-close { padding: 10px 14px; min-width: 44px; min-height: 44px; }

  /* Wrap Swap/Skip text links in adequate hit area */
  .slot-secondary-actions .btn-link {
    padding: 10px 4px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
}

/* Planner day tabs */
.planner-day-tab {
  border-radius: var(--radius-btn);
  padding: 5px 10px;
  font-size: 0.78rem;
  border: 1px solid var(--border-muted);
  cursor: pointer;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.planner-day-tab.active {
  background: var(--accent);
  color: var(--bg-surface);
  font-weight: 600;
  border-color: var(--accent);
}

/* Planner slot pick button (dashed empty-slot prompt) */
.planner-pick-btn {
  background: rgba(88, 166, 255, 0.12);
  border: 1px dashed var(--accent);
  color: var(--accent);
  border-radius: var(--radius-btn);
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}
