/* =====================================================
   Syntro Health — Mobile-First Responsive Upgrade Pack
   Standards: WCAG 2.1 AA/AAA Touch Targets (>= 48x48px)
   Safe-Area Insets & Thumb-Zone Ergonomics
   ===================================================== */

/* ── 1. Root & Safe-Area Variables ── */
:root {
  --mobile-bottom-nav-height: 64px;
  --mobile-header-height: 56px;
  --touch-target-min: 48px;
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
}

/* ── 2. Viewport & Body Adjustments (< 992px) ── */
@media (max-width: 991.98px) {
  body {
    padding-bottom: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom) + var(--space-md)) !important;
    overflow-x: clip;
    -webkit-tap-highlight-color: transparent;
  }

  /* Prevent iOS Auto-Zoom on form inputs (minimum 16px) */
  input, select, textarea, .form-control, .form-select, .q-input {
    font-size: 16px !important;
  }
}

/* ── Desktop Hide Enforcement (>= 992px) ── */
@media (min-width: 992px) {
  .mobile-top-header,
  .mobile-bottom-bar,
  .mobile-bottom-nav,
  .sticky-action-tray {
    display: none !important;
  }
}

/* ── 3. Mobile Top Header ── */
@media (max-width: 991.98px) {
  .mobile-top-header {
    left: 0;
    right: 0;
    height: var(--mobile-header-height);
    background: var(--bg-glass, color-mix(in srgb, var(--color-obsidian) 92%, transparent));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-subtle, color-mix(in srgb, var(--color-slate-50) 8%, transparent));
    z-index: 1020;
    padding: 0 var(--space-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
}

.mobile-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--text-primary, var(--color-slate-50));
}

.mobile-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  margin-right: var(--space-xs);
}

.mobile-brand-title {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text-primary, var(--color-slate-50));
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-2xs);
}

.mobile-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.mobile-icon-btn {
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border-subtle, color-mix(in srgb, var(--color-slate-50) 10%, transparent));
  background: var(--bg-surface, var(--color-slate-900));
  color: var(--text-secondary, var(--color-slate-400));
  font-size: 1.25rem;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  padding: 0;
}

.mobile-icon-btn:hover, .mobile-icon-btn:active {
  background: var(--accent-tint, color-mix(in srgb, var(--color-emerald-500) 15%, transparent));
  color: var(--accent-solid, var(--color-emerald-500));
  border-color: var(--border-accent, color-mix(in srgb, var(--color-emerald-500) 30%, transparent));
}

/* ── 4. Fixed Bottom Navigation Bar ── */
@media (max-width: 991.98px) {
  .mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--mobile-bottom-nav-height) + var(--safe-area-bottom));
    padding-bottom: var(--safe-area-bottom);
    background: var(--bg-glass, color-mix(in srgb, var(--color-obsidian) 95%, transparent));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-subtle, color-mix(in srgb, var(--color-slate-50) 8%, transparent));
    box-shadow: 0 -4px 20px color-mix(in srgb, var(--color-shadow-ink) 30%, transparent);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1030;
  }
}

.mobile-nav-link {
  flex: 1;
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--text-secondary, var(--color-slate-400));
  font-size: 0.72rem;
  font-weight: 500;
  padding: var(--space-2xs) 0;
  position: relative;
  transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, opacity 0.15s ease-in-out, transform 0.15s ease-in-out;
  border: none;
  background: transparent;
}

.mobile-nav-link i {
  font-size: 1.28rem;
  margin-bottom: var(--space-3xs);
  transition: transform 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link:active,
.mobile-nav-link.active {
  color: var(--accent-solid, var(--color-emerald-500));
}

.mobile-nav-link.active i {
  transform: scale(1.15);
  color: var(--accent-solid, var(--color-emerald-500));
}

.mobile-nav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 16px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber-500);
  border: 2px solid var(--white);
}

.mobile-nav-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--green-600);
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-3xs);
}

/* ── 5. Offcanvas Mobile Drawer ── */
.mobile-drawer {
  max-width: 320px;
  border-right: 1px solid var(--slate-200);
  box-shadow: 4px 0 24px color-mix(in srgb, var(--color-shadow-ink) 10%, transparent);
}

.mobile-drawer-header {
  padding: 20px var(--space-md);
  border-bottom: 1px solid var(--slate-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-drawer-close {
  min-width: var(--touch-target-min);
  min-height: var(--touch-target-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--slate-100);
  color: var(--slate-700);
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}

.mobile-drawer-profile {
  padding: var(--space-md);
  background: var(--green-50);
  border-radius: 12px;
  margin: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.mobile-drawer-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--green-600);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.mobile-drawer-nav {
  padding: var(--space-xs) var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-2xs);
}

.mobile-drawer-item {
  min-height: var(--touch-target-min);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: 10px;
  color: var(--slate-700);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.mobile-drawer-item i {
  font-size: 1.25rem;
  color: var(--slate-600);
  width: 24px;
  text-align: center;
}

.mobile-drawer-item:hover, .mobile-drawer-item:active {
  background: var(--green-50);
  color: var(--green-600);
}

.mobile-drawer-item:hover i, .mobile-drawer-item:active i {
  color: var(--green-600);
}

.mobile-drawer-divider {
  height: 1px;
  background: var(--slate-200);
  margin: var(--space-sm) var(--space-md);
}

/* ── 6. Mobile 7-Day Meal Plan Stack & Carousel ── */
@media (max-width: 767.98px) {
  .meal-day-tabs {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-xs);
    margin-bottom: var(--space-md);
    gap: var(--space-xs);
  }

  .meal-day-tabs::-webkit-scrollbar {
    display: none;
  }

  .meal-day-tabs .nav-item {
    scroll-snap-align: start;
    flex-shrink: 0;
  }

  .meal-day-tabs .nav-link {
    min-height: var(--touch-target-min);
    min-width: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs) var(--space-md);
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 600;
  }

  .meal-card {
    margin-bottom: var(--space-md);
    border-radius: 16px;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-shadow-ink) 4%, transparent);
  }

  .meal-card-header {
    padding: var(--space-md) var(--space-md);
  }

  .meal-card-body {
    padding: var(--space-md);
  }

  .btn-swap-meal {
    width: 100%;
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: var(--space-sm);
  }

  .meal-macros {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-xs);
    margin: var(--space-sm) 0;
  }

  .macro-tag {
    padding: var(--space-2xs) var(--space-sm);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 600;
  }
}

/* ── 7. Mobile Questionnaire Wizard (Sticky Step Bar & Touch Grids) ── */
.mobile-wizard-header {
  position: sticky;
  top: var(--mobile-header-height);
  background: color-mix(in srgb, var(--color-slate-50) 96%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1010;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--slate-200);
  box-shadow: 0 2px 10px color-mix(in srgb, var(--color-shadow-ink) 3%, transparent);
}

.mobile-wizard-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-xs);
}

.mobile-wizard-badge {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--green-700);
  background: var(--green-100);
  padding: var(--space-2xs) var(--space-sm);
  border-radius: 100px;
}

.mobile-wizard-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--slate-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60%;
}

.mobile-wizard-bar {
  height: 6px;
  background: var(--slate-100);
  border-radius: 100px;
  overflow: hidden;
}

.mobile-wizard-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green-500), var(--green-600));
  border-radius: 100px;
  transition: none;
}

/* Touch Selection Card Grids */
@media (max-width: 767.98px) {
  .goal-card, .work-card, .stress-card, .diet-card, .nfpe-card {
    min-height: 52px;
    padding: var(--space-md) var(--space-md) !important;
    display: flex;
    align-items: center;
    border-radius: 12px;
    cursor: pointer;
    touch-action: manipulation;
  }

  .q-btn-prev, .q-btn-next, .q-btn-submit {
    min-height: var(--touch-target-min);
    font-size: 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .q-nav-buttons {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
  }

  .q-nav-buttons .btn {
    flex: 1;
  }
}

/* ── 8. Draggable Mobile Bottom Sheet Modal ── */
@media (max-width: 767.98px) {
  .modal.fade .modal-dialog.modal-bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    max-width: 100%;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
  }

  .modal.show .modal-dialog.modal-bottom-sheet {
    transform: translateY(0);
  }

  .modal-dialog.modal-bottom-sheet.is-dragging {
    transition: none !important;
    will-change: transform;
  }

  .modal-dialog.modal-bottom-sheet.is-dragging * {
    user-select: none !important;
    -webkit-user-select: none !important;
  }

  .modal-dialog.modal-bottom-sheet .modal-content {
    border-radius: 28px 28px 0 0;
    border: none;
    max-height: calc(100dvh - 2rem);
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--space-md) + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 30px color-mix(in srgb, var(--color-shadow-ink) 22%, transparent);
    background-clip: padding-box;
  }

  .bottom-sheet-drag-handle {
    width: 38px;
    height: 5px;
    background: var(--slate-300, var(--color-slate-300));
    border-radius: 9999px;
    margin: var(--space-sm) auto var(--space-xs) auto;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    cursor: grab;
    flex-shrink: 0;
    transition: background 0.15s ease, transform 0.15s ease;
  }

  [data-theme="dark"] .bottom-sheet-drag-handle,
  .dark-theme .bottom-sheet-drag-handle {
    background: color-mix(in srgb, var(--color-slate-50) 28%, transparent);
  }

  .bottom-sheet-drag-handle:active {
    cursor: grabbing;
    background: var(--slate-400, var(--color-slate-400));
    transform: scaleX(1.08);
  }

  [data-theme="dark"] .bottom-sheet-drag-handle:active,
  .dark-theme .bottom-sheet-drag-handle:active {
    background: color-mix(in srgb, var(--color-slate-50) 45%, transparent);
  }

  .modal-dialog.modal-bottom-sheet .modal-header {
    border-bottom: 1px solid var(--slate-100, var(--color-slate-100));
    padding: var(--space-sm) 20px;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    flex-shrink: 0;
  }

  [data-theme="dark"] .modal-dialog.modal-bottom-sheet .modal-header,
  .dark-theme .modal-dialog.modal-bottom-sheet .modal-header {
    border-bottom-color: color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  }

  .modal-dialog.modal-bottom-sheet .modal-body {
    padding: 20px;
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .modal-dialog.modal-bottom-sheet .modal-footer {
    border-top: 1px solid var(--slate-100, var(--color-slate-100));
    padding: var(--space-md) 20px;
    display: flex;
    gap: var(--space-sm);
    flex-shrink: 0;
  }

  [data-theme="dark"] .modal-dialog.modal-bottom-sheet .modal-footer,
  .dark-theme .modal-dialog.modal-bottom-sheet .modal-footer {
    border-top-color: color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  }

  .modal-dialog.modal-bottom-sheet .modal-footer .btn {
    flex: 1;
    min-height: var(--touch-target-min);
    font-size: 1rem;
    font-weight: 600;
  }
}

/* ── 9. General Accessibility & Tap Polish ── */
button, input[type="button"], input[type="submit"], a.btn {
  touch-action: manipulation;
}

.touch-target-48 {
  min-width: 48px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-close.touch-target-48 {
  width: 48px;
  height: 48px;
  padding: var(--space-md);
  background-size: 16px;
}

/* ── 10. Mobile CTA & Action Stacking ── */
@media (max-width: 767.98px) {
  .results-cta-row {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
  }

  .results-cta-row .btn {
    width: 100%;
    margin-left: 0 !important;
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 600;
  }

  /* Table overflow protection */
  .table-responsive {
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
  }
}

/* ==========================================================================
   NutriAI / Syntro Health High-Efficiency Mobile Design System
   WCAG 2.1 AA/AAA Compliant • Thumb-Zone Ergonomics • Fluid Snap Navigation
   ========================================================================== */

/* ── Fixed Bottom Navigation Bar & Floating Thumb Zone ── */
@media (max-width: 991.98px) {
  .mobile-bottom-bar,
  .mobile-bottom-nav {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    background: color-mix(in srgb, var(--color-slate-900) 96%, transparent) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid color-mix(in srgb, var(--color-slate-50) 8%, transparent) !important;
    z-index: 1050 !important;
    display: block !important;
  }
}

.bottom-bar-inner {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: 100%;
  align-items: center;
  max-width: 600px;
  margin: 0 auto;
}

.bar-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-target-min, 48px);
  min-width: var(--touch-target-min, 48px);
  color: var(--color-slate-400);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 500;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  border: none;
  background: transparent;
  padding: var(--space-2xs) 0;
}

.bar-tab:active {
  transform: scale(0.92);
}

.bar-tab.active {
  color: var(--color-emerald-400) !important;
  font-weight: 700;
}

.tab-icon-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 24px;
}

.tab-icon-wrap i {
  font-size: 1.25rem;
  line-height: 1;
}

.tab-label {
  margin-top: var(--space-3xs);
  line-height: 1.2;
}

.tab-avatar-wrap {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--color-emerald-600);
  color: var(--color-accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Central Prominent CTA: Analyze */
.bar-tab.central-cta {
  position: relative;
  top: -12px;
}

.cta-bubble {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--color-emerald-500) 40%, transparent);
  font-size: 1.35rem;
  border: 3px solid var(--color-slate-900);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.bar-tab.central-cta:active .cta-bubble {
  transform: scale(0.92);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--color-emerald-500) 30%, transparent);
}

/* ── Offcanvas Bottom Sheet (Account Drawer) ── */
.mobile-sheet-drawer {
  border-top-left-radius: 24px !important;
  border-top-right-radius: 24px !important;
  background: var(--color-slate-900) !important;
  color: var(--color-slate-50) !important;
  border-top: 1px solid color-mix(in srgb, var(--color-slate-50) 10%, transparent) !important;
  max-height: 80vh !important;
  /* Size to the items, not Bootstrap's 30vh, and keep the last item (Log Out) clear of the fixed
     bottom bar, which sits above the sheet (z-index 1050 over 1045) and used to cover it. */
  height: auto !important;
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
}

.drag-handle-pill {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: color-mix(in srgb, var(--color-slate-50) 25%, transparent);
}

.drawer-user-badge {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.btn-drawer-item {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: var(--space-sm) var(--space-md);
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-slate-50) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  color: var(--color-slate-200);
  font-weight: 500;
  font-size: 0.95rem;
  text-decoration: none;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.btn-drawer-item:hover, .btn-drawer-item:active {
  background: color-mix(in srgb, var(--color-slate-50) 10%, transparent);
  color: var(--color-slate-50);
}

/* ── Swipeable Day Pill Carousel ── */
.mobile-day-strip {
  background: color-mix(in srgb, var(--color-slate-900) 95%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  z-index: 1020;
  margin: calc(-1 * var(--space-md)) calc(-1 * var(--space-md)) 20px calc(-1 * var(--space-md));
}

.day-pills-carousel {
  display: flex;
  gap: var(--space-xs);
  overflow-x: auto;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
  padding-bottom: var(--space-3xs);
}

.day-pills-carousel::-webkit-scrollbar {
  display: none;
}

.day-pill-btn {
  flex: 0 0 54px;
  height: 64px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--color-slate-50) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-slate-50) 10%, transparent);
  color: var(--color-slate-400);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  scroll-snap-align: center;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.day-pill-btn .day-initial {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: none;
}

.day-pill-btn .day-num {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-slate-50);
  line-height: 1.1;
  margin-top: var(--space-3xs);
}

.day-pill-btn .active-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: transparent;
  margin-top: var(--space-2xs);
}

.day-pill-btn.active {
  background: var(--color-accent);
  border-color: var(--color-emerald-400);
  color: var(--color-accent-ink);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--color-emerald-600) 35%, transparent);
}

.day-pill-btn.active .active-dot {
  background: var(--color-slate-50);
}

/* The date number kept its slate-50 colour on the emerald active pill (2.4:1). Use the accent ink. */
.day-pill-btn.active .day-num {
  color: var(--color-accent-ink);
}

/* ── Mobile Meal Tile & Macro Badges ── */
.mobile-meal-tile {
  background: var(--color-slate-50);
  border-radius: 20px;
  padding: var(--space-md);
  box-shadow: 0 4px 20px color-mix(in srgb, var(--color-shadow-ink) 6%, transparent);
  border: 1px solid var(--color-slate-100);
  margin-bottom: var(--space-md);
}

.tile-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xs);
}

.tile-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.tile-label {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--color-slate-900);
}

.tile-time {
  font-size: 0.78rem;
  color: var(--color-muted);
  margin-left: var(--space-2xs);
}

.dish-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-slate-900);
  margin-bottom: var(--space-2xs);
}

.dish-desc {
  font-size: 0.82rem;
  color: var(--color-muted);
  margin-bottom: var(--space-sm);
  line-height: 1.45;
}

.btn-quick-swap {
  min-height: 40px;
  padding: var(--space-xs) var(--space-md);
  border-radius: 20px;
  background: var(--color-emerald-50);
  border: 1px solid var(--color-emerald-200);
  color: var(--color-emerald-600);
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  transition: color 0.15s ease, background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
}

.btn-quick-swap:active {
  background: var(--color-emerald-100);
  transform: scale(0.96);
}

.tile-macro-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-xs);
}

.macro-badge {
  font-size: 0.75rem;
  padding: var(--space-2xs) var(--space-sm);
  border-radius: 8px;
  font-weight: 500;
}

.macro-cal { background: var(--color-slate-50); color: var(--color-slate-700); font-weight: 700; border: 1px solid var(--color-slate-200); }
.macro-p   { background: var(--color-cyan-50); color: var(--color-cyan-700); border: 1px solid var(--color-cyan-100); }
.macro-c   { background: var(--color-gold-50); color: var(--color-gold-700); border: 1px solid var(--color-gold-100); }
.macro-f   { background: var(--color-data-fat-wash); color: var(--color-data-fat-ink); border: 1px solid var(--color-data-fat-wash); }

/* ── 1-Tap Touch Assessment Cards ── */
.goal-touch-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
}

@media (min-width: 576px) {
  .goal-touch-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.touch-card-option {
  cursor: pointer;
  display: block;
  margin: 0;
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.touch-card-content {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: color-mix(in srgb, var(--color-slate-50) 5%, transparent);
  border: 1.5px solid color-mix(in srgb, var(--color-slate-50) 10%, transparent);
  border-radius: 18px;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  min-height: 76px;
}

.touch-card-content:active {
  transform: scale(0.98);
}

.card-icon-bubble {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}

.card-text-group {
  flex: 1;
}

.card-heading {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--color-slate-50);
  display: block;
}

.card-caption {
  font-size: 0.78rem;
  color: var(--color-slate-400);
  display: block;
  margin-top: var(--space-2xs);
  line-height: 1.35;
}

.check-indicator {
  margin-left: auto;
  font-size: 1.35rem;
  color: transparent;
  transition: color 0.2s ease, transform 0.2s ease;
  flex-shrink: 0;
}

.touch-card-option input:checked + .touch-card-content,
.touch-card-option.selected .touch-card-content {
  background: color-mix(in srgb, var(--color-emerald-500) 14%, transparent) !important;
  border-color: var(--color-emerald-500) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-emerald-500) 25%, transparent) !important;
}

.touch-card-option input:checked + .touch-card-content .check-indicator,
.touch-card-option.selected .touch-card-content .check-indicator {
  color: var(--color-emerald-500) !important;
  transform: scale(1.1);
}

/* ── Sticky Bottom Action Tray ── */
.sticky-action-tray {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-sm) var(--space-md) calc(var(--space-sm) + env(safe-area-inset-bottom, var(--space-sm)));
  background: color-mix(in srgb, var(--color-slate-900) 95%, transparent);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid color-mix(in srgb, var(--color-slate-50) 8%, transparent);
  z-index: 1040;
}

.btn-continue-action {
  width: 100%;
  min-height: 52px;
  background: var(--color-accent);
  color: var(--color-accent-ink);
  border: none;
  border-radius: 100px;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--color-emerald-600) 40%, transparent);
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
}

.btn-continue-action:active {
  transform: scale(0.98);
}

.btn-continue-action:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── 15. Flash Messages & Notification Alignment ── */
@media (max-width: 576px) {
  .flash-global {
    top: calc(var(--mobile-header-height) + 12px) !important;
    left: 12px !important;
    right: 12px !important;
    max-width: calc(100vw - 24px) !important;
    width: auto !important;
    z-index: 1050 !important;
  }
  .flash-item {
    padding: var(--space-sm) var(--space-md) !important;
    font-size: 0.85rem !important;
    border-radius: 10px !important;
    gap: var(--space-xs) !important;
  }
  .flash-close {
    min-width: 32px !important;
    min-height: 32px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
  }
}


