/* ── Meal Selector v7 — Unified selector layout ── */
/* Inherits v6 tokens: --orange, --cyan, --bg, --dark, --gray, etc. */

/* ── Design system tokens (extends v6 :root) ── */
:root {
  --canvas: #eeecea;
  --canvas-deep: #e5e3e0;
  --charcoal: #1e1e1e;
  --charcoal-elevated: #282828;
  --charcoal-border: rgba(255,255,255,0.08);
  --card-surface: #f8f7f5;
  --card-border: rgba(0,0,0,0.05);
  --orange-muted: rgba(239,76,0,0.08);
  --radius-md: 12px;
  --radius-sm: 8px;
  --text-dark: #2d2d2d;
  --text-gray: #777;
  --text-faint: #aaa;
  --transition: 0.2s ease;
}

/* ── A. Page shell — cream bg, dark text ── */
.meal-selector-v7-page {
  margin: 0; padding: 0;
  font-family: 'DM Sans', sans-serif;
  background: var(--canvas);
  color: var(--text-dark);
  min-height: 100vh;
  overflow-x: hidden;
}
/* Box-sizing reset + WordPress override for v7-owned elements only */
.meal-selector-v7-page *,
.meal-selector-v7-page *::before,
.meal-selector-v7-page *::after {
  box-sizing: border-box;
}
/* Tame WordPress theme inflation — set clean baseline */
.v7-app { font-size: 14px; line-height: 1.4; }
.v7-app button, .v7-app a { font-family: inherit; font-size: inherit; }
.v7-cat-prompt button { line-height: 1; }

/* ── Loading state ── */
.v7-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; font-size: 18px; color: var(--text-gray);
}
.v7-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(0,0,0,0.08);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: v7-spin 0.8s linear infinite;
  margin-bottom: 12px;
}
@keyframes v7-spin {
  to { transform: rotate(360deg); }
}
.v7-loading-bar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
  animation: v7-loading-slide 1.5s ease-in-out infinite;
  z-index: 10;
}
@keyframes v7-loading-slide {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── Error state ── */
.v7-error {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100vh; gap: 12px; color: var(--text-gray);
}
.v7-error-icon {
  font-size: 36px; color: var(--orange);
}
.v7-error-text {
  font-size: 16px; text-align: center;
}
.v7-error-retry {
  margin-top: 8px; padding: 10px 24px;
  border: 1px solid var(--orange); border-radius: var(--radius-sm);
  background: transparent; color: var(--orange);
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.2s;
}
.v7-error-retry:hover {
  background: var(--orange); color: #fff;
}

/* ── B. App layout — 100vh flex column ── */
.v7-app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  padding-top: 64px;
  isolation: isolate;
}
.v7-app.prompt-hidden {
  padding-top: 0;
  transition: padding-top 0.4s;
}

/* ── C. Logo (fixed top-left) + Cart icon (fixed top-right) ── */
.v7-logo {
  position: fixed; top: 0; left: 0; z-index: 300;
  display: flex; align-items: center;
  height: 64px; padding-left: 40px;
  pointer-events: auto;
  color: var(--cyan);
}
.v7-logo svg { height: 44px; width: auto; }

.v7-cart-icon {
  position: fixed; top: 0; right: 0; z-index: 300;
  display: flex; align-items: center;
  height: 64px; padding-right: 40px;
  color: var(--text-dark); text-decoration: none;
  pointer-events: auto;
}
.v7-cart-icon:hover { color: var(--orange); }

/* ── D. Sidebar toggle — single hat button, right edge ── */
.v7-sidebar-toggle {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 260;
  width: 54px;
  border: none;
  border-radius: 12px 0 0 12px;
  background: rgba(255,255,255,0.95);
  box-shadow: -2px 0 8px rgba(0,0,0,0.08);
  cursor: pointer;
  transition: right 0.25s cubic-bezier(0.4,0,0.2,1), top 0.25s, transform 0.25s, background 0.2s, box-shadow 0.2s;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--cyan);
  padding: 8px 4px;
  gap: 2px;
}
.v7-sidebar-toggle.migrated {
  right: 320px;
  background: var(--card-surface);
  box-shadow: -4px 0 12px rgba(0,0,0,0.1);
}
.v7-sidebar-toggle.migrated .v7-sidebar-toggle-label { display: none; }
.v7-sidebar-toggle svg { width: 24px; height: 22px; flex-shrink: 0; }
.v7-sidebar-toggle-label {
  font-size: 9px; font-weight: 600; color: var(--text-gray);
  line-height: 1.3; text-transform: uppercase;
  letter-spacing: 0.3px; text-align: center;
  margin-top: 2px;
}
.v7-toggle-dates {
  font-weight: 500; color: var(--text-faint); font-size: 9px;
}
.v7-sidebar-toggle:hover {
  background: var(--card-surface);
  box-shadow: -2px 0 12px rgba(0,0,0,0.12);
}

/* ── E. Sidebar — fixed right panel ── */
.v7-sidebar-overlay {
  position: fixed; inset: 0; z-index: 250;
  background: rgba(0,0,0,0.15);
}
.sidebar-open .v7-workspace {
  filter: blur(3px); pointer-events: none;
  transition: filter 0.25s ease;
}
.v7-sidebar {
  position: fixed;
  right: 0; top: 0; bottom: 0;
  z-index: 260;
  width: 320px; max-width: calc(100vw - 60px);
  background: var(--card-surface);
  border-left: 1px solid var(--card-border);
  padding: 24px 20px;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: v7-slide-in 0.25s ease-out;
}
@keyframes v7-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
/* ── Sidebar header row ── */
.v7-sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.v7-sidebar-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-dark);
}
.v7-sidebar-hat {
  width: 22px; height: 20px; color: var(--cyan); flex-shrink: 0;
}
.v7-sidebar-close {
  background: none; border: none; color: var(--text-faint); font-size: 20px;
  cursor: pointer; width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%; flex-shrink: 0;
}
.v7-sidebar-close:hover { color: var(--text-dark); background: rgba(0,0,0,0.05); }

/* ── Sidebar section labels ── */
.v7-sidebar-label {
  display: block;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-gray);
  margin: 20px 0 8px;
}
.v7-sidebar-label:first-child { margin-top: 0; }

/* ── Pill toggles ── */
.v7-pills {
  display: flex; gap: 6px;
}
.v7-pill {
  flex: 1; padding: 10px 0;
  border: 1px solid rgba(0,0,0,0.08); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-gray);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  text-align: center;
}
.v7-pill:hover { border-color: rgba(0,0,0,0.25); color: var(--text-dark); }
.v7-pill.active {
  background: var(--orange); border-color: var(--orange); color: #fff;
  font-weight: 600;
}
.v7-pill.disabled, .v7-pill:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Kids toggle — styled card with switch ── */
.v7-kids-toggle {
  display: flex; align-items: center; gap: 10px;
  margin-top: 10px; padding: 10px 12px;
  border: 1px solid rgba(0,0,0,0.08); border-radius: var(--radius-sm);
  background: transparent; cursor: pointer;
  transition: all var(--transition);
  text-align: left; width: 100%;
}
.v7-kids-toggle:hover { border-color: rgba(0,0,0,0.2); }
.v7-kids-toggle.active {
  border-color: var(--orange); background: rgba(239,76,0,0.04);
}
.v7-kids-toggle.disabled {
  opacity: 0.3; cursor: not-allowed; pointer-events: none;
}
.v7-kids-icon { font-size: 18px; flex-shrink: 0; }
.v7-kids-text { flex: 1; min-width: 0; }
.v7-kids-label {
  display: block; font-size: 12px; font-weight: 600; color: var(--text-dark);
}
.v7-kids-desc {
  display: block; font-size: 10px; color: var(--text-faint); margin-top: 1px;
}
/* Toggle track + thumb */
.v7-toggle-track {
  width: 36px; height: 20px; flex-shrink: 0;
  border-radius: 10px; background: rgba(0,0,0,0.1);
  position: relative; transition: background 0.2s;
}
.v7-toggle-track.on { background: var(--orange); }
.v7-toggle-thumb {
  position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}
.v7-toggle-track.on .v7-toggle-thumb { transform: translateX(16px); }

/* ── Date picker ── */
.v7-date-picker { margin-top: 4px; flex: 1 1 0; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.v7-date-count {
  color: var(--orange); font-weight: 600;
  margin-left: 4px;
}
.v7-cal-month { margin-bottom: 16px; }
.v7-cal-title {
  font-size: 13px; font-weight: 600; color: var(--text-dark);
  margin-bottom: 8px; text-align: center;
}
.v7-cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.v7-cal-header {
  font-size: 10px; color: var(--text-faint); text-align: center;
  padding: 4px 0; font-weight: 600;
}
.v7-cal-empty { padding: 8px; }
.v7-cal-day {
  padding: 8px 0; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-dark);
  font-size: 12px; text-align: center;
  cursor: pointer; transition: all 0.15s;
}
.v7-cal-day:hover:not(:disabled):not(.selected) { background: rgba(0,0,0,0.05); }
.v7-cal-day.selected {
  background: var(--orange); color: #fff; font-weight: 600;
}
.v7-cal-day.unavailable {
  color: var(--text-faint); opacity: 0.6; cursor: default;
}

/* ── Date presets (replaces full calendar by default) ── */
.v7-date-presets {
  display: flex; flex-direction: column; gap: 4px;
  flex: 1 1 0; min-height: 0;
  max-height: clamp(160px, 35vh, 400px);
  overflow-y: auto;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent 100%);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 32px), transparent 100%);
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.15) transparent;
}
.v7-date-presets::-webkit-scrollbar { width: 4px; }
.v7-date-presets::-webkit-scrollbar-track { background: transparent; }
.v7-date-presets::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 2px; }
.v7-date-presets::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.25); }
/* Remove fade when scrolled to bottom */
.v7-date-presets.scrolled-end {
  -webkit-mask-image: none;
  mask-image: none;
}
.v7-date-preset {
  width: 100%; padding: 10px 14px;
  border: 1px solid rgba(0,0,0,0.08); border-radius: var(--radius-sm);
  background: transparent; color: var(--text-gray);
  font-size: 12px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
  text-align: left;
}
.v7-date-preset:hover { border-color: rgba(0,0,0,0.25); color: var(--text-dark); }
.v7-date-preset.active {
  background: var(--orange); border-color: var(--orange); color: #fff;
  font-weight: 600;
}
.v7-date-custom-btn {
  display: block; margin: 8px auto 0;
  background: none; border: none;
  font-size: 12px; color: var(--text-faint);
  text-decoration: underline; cursor: pointer;
  text-align: center;
}
.v7-date-custom-btn:hover { color: var(--text-gray); }
.v7-date-cal-scroll {
  flex: 1 1 0; min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,.15) transparent;
}
.v7-date-cal-scroll::-webkit-scrollbar { width: 4px; }
.v7-date-cal-scroll::-webkit-scrollbar-track { background: transparent; }
.v7-date-cal-scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.15); border-radius: 2px; }
.v7-date-back-btn {
  display: block; margin: 8px auto 0;
  padding: 6px 14px;
  background: transparent;
  border: 1px solid rgba(0,0,0,0.12); border-radius: var(--radius-sm);
  font-size: 12px; color: var(--text-gray);
  cursor: pointer; transition: all 0.2s;
}
.v7-date-back-btn:hover { border-color: rgba(0,0,0,0.3); color: var(--text-dark); }

/* ── Price summary ── */
.v7-price-summary {
  margin-top: 20px; padding: 16px;
  background: var(--card-surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md); text-align: center;
}
.v7-price-total {
  font-size: 28px; font-weight: 800; color: var(--text-dark); letter-spacing: -0.5px;
}
.v7-price-per-day {
  font-size: 12px; color: var(--text-gray); margin-top: 2px;
}

/* ── Cart button ── */
.v7-cart-btn {
  display: block; width: 100%;
  margin-top: 16px; padding: 14px;
  border: none; border-radius: var(--radius-md);
  background: var(--canvas-deep); color: var(--text-faint);
  font-size: 14px; font-weight: 600;
  cursor: not-allowed; transition: all var(--transition);
}
.v7-cart-btn.go {
  background: var(--orange); color: #fff; cursor: pointer;
}
.v7-cart-btn.go:hover { background: var(--orange-hover); }
.v7-cart-btn.ready {
  background: var(--orange); color: #fff; cursor: pointer;
}
.v7-cart-btn.ready:hover { background: var(--orange-hover); }

/* ── F. Workspace — flex-centered, bottom-pinned strip ── */
.v7-workspace {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  align-items: stretch;
  position: relative;
  overflow: visible;
}
.v7-main-content {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  align-items: stretch;
  justify-content: center;
  width: 100%;
  overflow: visible;
}
/* J. Hat/cube containment — match v6 max-widths, margin auto for centering */
.v7-workspace .hat-row { max-width: 552px; margin-left: auto; margin-right: auto; }
.v7-workspace .cube-viewport { max-width: 600px; margin-left: auto; margin-right: auto; }
/* Override cube-scene height: v7 has more chrome (prompt 64 + hat ~90 + strip 50 + CTA 56 + gaps ~40) */
.v7-workspace .cube-scene { height: min(440px, calc(100vh - 340px)); }
.v7-workspace .meal-strip { width: 100%; margin-top: auto; }

.v7-debug {
  padding: 12px; background: rgba(0,0,0,0.03);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-gray);
  margin-bottom: 12px;
}
.v7-cards-debug {
  display: flex; flex-direction: column; gap: 6px;
}
.v7-cards-debug > div {
  padding: 10px; background: rgba(0,0,0,0.03);
  border-radius: 6px; font-size: 13px;
}

/* ── G. Summary Overlay — white card ── */
.v7-summary-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.v7-summary-card {
  background: var(--card-surface);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.v7-summary-header-row {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 12px;
}
.v7-summary-title {
  font-size: 20px; font-weight: 800; color: var(--text-dark); letter-spacing: -0.3px;
}
.v7-summary-sub {
  font-size: 13px; color: var(--text-gray);
}
.v7-summary-week-title {
  font-size: 12px; font-weight: 600; color: #777;
  text-transform: uppercase; letter-spacing: 1px;
  margin: 12px 0 8px;
}
.v7-summary-grid {
  display: grid;
  gap: 2px;
  margin-bottom: 12px;
}
.v7-sg-header {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  text-align: center; padding: 6px 2px;
}
.v7-sg-row-label {
  font-size: 11px; font-weight: 600; color: var(--text-gray);
  padding: 6px 4px;
  display: flex; align-items: center;
}
.v7-sg-cell {
  font-size: 10px; color: #fff;
  padding: 6px 4px;
  border-radius: 4px;
  text-align: center;
  line-height: 1.3;
  min-height: 32px;
  display: flex; align-items: center; justify-content: center;
}
.v7-sg-cell.empty {
  background: var(--canvas-deep); color: var(--text-faint);
}
/* Solid v6 diet colors with white text */
.v7-sg-cell.diet-traditional  { background: var(--diet-traditional,  #EF4C00); }
.v7-sg-cell.diet-fitness-f    { background: var(--diet-fitness-f,    #e91e63); }
.v7-sg-cell.diet-fitness-m    { background: var(--diet-fitness-m,    #009688); }
.v7-sg-cell.diet-fitness-f-loss { background: #F48FB1; }
.v7-sg-cell.diet-fitness-f-gain { background: #e91e63; }
.v7-sg-cell.diet-fitness-m-loss { background: #009688; }
.v7-sg-cell.diet-fitness-m-gain { background: #1565C0; }
.v7-sg-cell.diet-vegetarian   { background: var(--diet-vegetarian,   #4caf50); }
.v7-sg-cell.diet-none { background: #8d6e63; }
.v7-summary-stats-row {
  display: flex; align-items: center; justify-content: center;
  gap: 20px; margin-top: 10px; padding: 8px 0;
  border-top: 1px solid rgba(0,0,0,0.06);
}
.v7-summary-stat {
  font-size: 18px; font-weight: 800; color: var(--text-dark);
  letter-spacing: -0.3px;
}
.v7-summary-stat span {
  font-size: 12px; font-weight: 500; color: var(--text-gray);
}
.v7-summary-actions {
  display: flex; gap: 8px; margin-top: 12px;
}
.v7-summary-actions .v7-summary-edit-btn {
  flex: 1; margin-top: 0;
}
.v7-summary-actions .v7-summary-btn {
  flex: 2; margin-top: 0;
}
.v7-summary-btn {
  display: block; width: 100%;
  margin-top: 12px; padding: 14px;
  border: none; border-radius: var(--radius-md);
  background: var(--canvas-deep); color: var(--text-faint);
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all var(--transition);
}
.v7-summary-btn.ready {
  background: var(--orange); color: #fff;
}
.v7-summary-btn.ready:hover { background: var(--orange-hover); }
.v7-summary-btn.loading {
  opacity: 0.7; pointer-events: none; cursor: wait;
}

/* ── Summary close button ── */
.v7-summary-card { position: relative; }
.v7-summary-close {
  position: absolute; top: 16px; right: 16px;
  background: none; border: none; font-size: 22px;
  color: var(--text-faint); cursor: pointer;
  width: 32px; height: 32px; display: flex;
  align-items: center; justify-content: center;
  border-radius: 50%; z-index: 1;
}
.v7-summary-close:hover { color: var(--text-dark); background: rgba(0,0,0,0.05); }

/* ── "Mai editează" secondary button ── */
.v7-summary-edit-btn {
  display: block; padding: 14px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: var(--radius-md);
  background: transparent; color: var(--text-gray);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all 0.2s;
}
.v7-summary-edit-btn:hover { border-color: var(--orange); color: var(--orange); }

/* ── Quantity stepper ── */
.v7-summary-qty {
  display: flex; align-items: center;
}
.v7-qty-stepper {
  display: flex; align-items: center; gap: 0;
  border: 1px solid rgba(0,0,0,0.12); border-radius: var(--radius-sm);
  overflow: hidden;
}
.v7-qty-stepper button {
  width: 32px; height: 32px; border: none;
  background: transparent; font-size: 16px;
  cursor: pointer; color: var(--text-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.v7-qty-stepper button:hover { background: rgba(0,0,0,0.04); }
.v7-qty-stepper button:disabled { opacity: 0.3; cursor: not-allowed; }
.v7-qty-value {
  width: 32px; text-align: center;
  font-weight: 600; font-size: 14px;
}

/* ── Day-edit hover in summary grid ── */
.v7-sg-day-edit { cursor: pointer; position: relative; }
.v7-sg-edit-icon { opacity: 0; margin-left: 2px; transition: opacity 0.15s; vertical-align: middle; }
.v7-sg-day-edit:hover .v7-sg-edit-icon { opacity: 0.6; }
.v7-sg-day-edit:hover { color: var(--orange); }

/* ── Auto-fill overlay — full-page centered progress ── */
.v7-autofill-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(238,236,234,0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: v7-af-fadein 0.2s ease;
}
@keyframes v7-af-fadein {
  from { opacity: 0; }
  to { opacity: 1; }
}
.v7-autofill-card {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.v7-autofill-label {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-gray);
}
.v7-autofill-bars {
  display: flex; gap: 3px; align-items: flex-end;
  height: 48px;
  justify-content: center;
}
.v7-af-bar {
  width: 6px; height: 100%;
  background: rgba(0,0,0,0.06);
  border-radius: 3px;
  transition: background 0.2s ease;
}
.v7-af-bar.filled {
  background: var(--bar-color, var(--orange));
}
.v7-autofill-pct {
  font-size: 28px; font-weight: 800; letter-spacing: -0.5px;
}

/* ── Config loading overlay — full-page centered message ── */
.v7-config-loading-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(238,236,234,0.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  animation: v7-af-fadein 0.2s ease;
}
.v7-config-loading-card {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.v7-config-loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(0,0,0,0.08);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: v7-spin 0.8s linear infinite;
}
.v7-config-loading-title {
  font-size: 14px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: var(--text-gray);
}
.v7-config-loading-desc {
  font-size: 13px; color: var(--text-faint);
  text-align: center; line-height: 1.5;
}

/* ── H. Category Prompt — fixed top bar ── */
.v7-cat-prompt {
  position: fixed; top: 0; left: 0; right: 0;
  height: 64px; box-sizing: border-box;
  background: rgba(238,236,234,0.95);
  backdrop-filter: blur(8px);
  padding: 0 60px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  flex-wrap: nowrap;
  z-index: 200;
  transform: translateY(0);
  will-change: transform;
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1), opacity 0.4s;
  border-bottom: 1px solid var(--card-border);
}
.v7-cat-prompt.hidden {
  transform: translateY(-100%);
  opacity: 0;
  pointer-events: none;
}
.v7-cat-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-gray);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  margin-right: 4px;
}
.v7-cat-pills {
  display: flex;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  align-items: center;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  /* fade out at the edges to hint scrollability */
  mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
  -webkit-mask-image: linear-gradient(to right, transparent 0, black 16px, black calc(100% - 16px), transparent 100%);
  padding: 0 16px;
}
.v7-cat-pills::-webkit-scrollbar { display: none; }
/* ── Prompt bar inner layout ── */
.v7-cat-bar {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; width: 100%; height: 100%;
}
/* Mobile toggle — hidden on desktop, shown on mobile */
.v7-cat-mobile-toggle { display: none; }
.v7-cat-arrow { font-size: 9px; opacity: 0.6; margin-left: 2px; }

/* Top sheet — hidden on desktop */
.v7-cat-top-sheet { display: none; }

/* v6-style colored pill backgrounds */
.v7-cat-pill {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 14px;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.v7-cat-pill:hover { filter: brightness(0.88); }
.v7-pill-mod {
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  vertical-align: super;
  margin-left: 1px;
}
.v7-cat-pill.diet-traditional  { background: #EF4C00; color: #fff3e6; }
.v7-cat-pill.diet-fitness-f    { background: #e91e63; color: #fce4ec; }
.v7-cat-pill.diet-fitness-m    { background: #009688; color: #e0f2f1; }
.v7-cat-pill.diet-fitness-f-loss { background: #F48FB1; color: #6d1535; }
.v7-cat-pill.diet-fitness-f-gain { background: #e91e63; color: #fce4ec; }
.v7-cat-pill.diet-fitness-m-loss { background: #009688; color: #e0f2f1; }
.v7-cat-pill.diet-fitness-m-gain { background: #1565C0; color: #e3f2fd; }
.v7-cat-pill.diet-vegetarian   { background: #4caf50; color: #e8f5e9; }
.v7-cat-dismiss {
  display: none; /* shown on mobile via media query */
}
@media (max-width: 599px) {
  .v7-cat-dismiss {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; padding: 6px;
    font-size: 14px; color: var(--text-faint); cursor: pointer;
    touch-action: manipulation; flex-shrink: 0;
  }
}

/* Category trigger — floating button after dismiss */
.v7-cat-trigger {
  position: fixed; top: 64px; left: 50%; transform: translateX(-50%);
  z-index: 150;
  padding: 7px 18px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.95);
  font-size: 11px; font-weight: 600; color: var(--text-gray);
  text-transform: uppercase; letter-spacing: 0.4px;
  cursor: pointer; transition: all 0.3s;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
  opacity: 0; pointer-events: none;
  white-space: nowrap;
  border: none;
}
.v7-cat-trigger.visible { opacity: 1; pointer-events: auto; }
.v7-cat-trigger.hidden { opacity: 0; pointer-events: none; }
.v7-cat-trigger:hover { background: var(--card-surface); color: var(--orange); }

/* ── Spacing: hat → cube gap (shrinkable) ── */
.v7-workspace .hat-row { margin-bottom: clamp(4px, 2vh, 20px); }

/* ── Bottom CTA bar ── */
.v7-bottom-bar {
  position: sticky; bottom: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 6px 20px; flex-shrink: 0;
  background: var(--canvas);
}
.v7-bottom-cta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; max-width: 520px;
  padding: 10px 32px; background: var(--orange); color: #fff;
  border: none; border-radius: var(--radius-md); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: all var(--transition);
  letter-spacing: 0.5px; text-transform: uppercase;
  font-family: 'DM Sans', sans-serif;
}
.v7-bottom-cta:hover { background: var(--orange-hover); transform: translateY(-1px); }
.v7-bottom-cta:active { transform: translateY(0); }
.v7-bottom-cta:disabled {
  background: var(--canvas-deep); color: var(--text-faint);
  cursor: not-allowed; transform: none;
}
.v7-bottom-cta svg { width: 16px; height: 16px; fill: #fff; }

/* ── Tablet/small desktop (600-899px) — tighten layout ── */
@media (min-width: 600px) and (max-width: 899px) {
  .v7-workspace .cube-scene { height: min(400px, calc(100vh - 300px)); }
  .v7-cat-pill { padding: 5px 10px; }
}

/* ── Narrow screens (≤420px) ── */
@media (max-width: 420px) {
  .v7-cat-prompt { padding: 0 4px; }
  .v7-cat-pill { padding: 4px 10px; font-size: 9px; flex-shrink: 0; }
}

/* ── Tiny screens (iPhone SE etc.) ── */
@media (max-width: 375px) {
  .v7-workspace .cube-scene { height: min(360px, calc(100dvh - 240px)); }
}

/* ── I. Mobile overrides (matches v6 breakpoint at 599px) ── */
@media (max-width: 599px) {
  .v7-logo {
    left: 50%; transform: translateX(-50%);
    padding-left: 0; height: 56px;
  }
  .v7-logo svg { height: 36px; }
  .v7-cart-icon { height: 56px; }

  .v7-app { padding-top: 92px; }
  .v7-app.prompt-hidden { padding-top: 56px; }

  .v7-sidebar-toggle {
    position: fixed;
    right: 0; left: auto;
    top: 25% !important;
    transform: none !important;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    width: 44px; min-width: 44px;
    flex-direction: column; gap: 2px;
    padding: 8px 0;
    box-shadow: -2px 0 8px rgba(0,0,0,0.08);
    z-index: 200;
  }
  .v7-sidebar-toggle svg { width: 20px; height: 18px; }
  .v7-sidebar-toggle-label {
    display: block; margin-top: 2px;
    font-size: 8px; line-height: 1.2;
    text-align: center;
  }
  .v7-toggle-dates { display: none; }

  .meal-selector-v7-page.sidebar-open .v7-logo,
  .meal-selector-v7-page.sidebar-open .v7-cart-icon,
  .meal-selector-v7-page.sidebar-open .v7-cat-prompt,
  .meal-selector-v7-page.sidebar-open .v7-cat-trigger { display: none; }
  .v7-sidebar-overlay { z-index: 400; }
  .v7-sidebar {
    right: 0; width: 100%;
    max-width: 100vw;
    border-radius: 0;
    top: 0; bottom: 0;
    padding: 12px 16px 16px;
    z-index: 401;
  }
  .v7-sidebar-header { margin-bottom: 10px; }
  .v7-sidebar-label { margin: 10px 0 4px; }
  .v7-price-summary { margin-top: 12px; padding: 10px 12px; }
  .v7-price-total { font-size: 22px; }
  .v7-price-per-day { font-size: 11px; }
  .v7-cart-btn { margin-top: 10px; padding: 12px; }
  .v7-date-preset { padding: 10px 14px; }
  .v7-sidebar-toggle.migrated { display: none; }

  .v7-cat-prompt {
    top: 56px; height: 44px;
    padding: 0 12px;
    background: rgba(238,236,234,0.97);
    border-bottom: 1px solid var(--card-border);
    box-shadow: none;
    overflow: visible; /* allow sheet to overflow below */
  }
  /* Hide inline pills on mobile — replaced by top sheet */
  .v7-cat-pills { display: none; }
  .v7-cat-label { display: none; }

  /* Mobile toggle button */
  .v7-cat-mobile-toggle {
    display: flex; align-items: center;
    flex: 1;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: var(--text-gray);
    background: none; border: none; padding: 0;
    cursor: pointer; touch-action: manipulation;
  }

  /* Top sheet: drops down from the bar */
  .v7-cat-top-sheet {
    display: block;
    position: absolute; top: 100%; left: 0; right: 0;
    background: rgba(238,236,234,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--card-border);
    box-shadow: 0 6px 20px rgba(0,0,0,0.10);
    max-height: 0; overflow: hidden;
    transition: max-height 0.28s cubic-bezier(0.4,0,0.2,1);
  }
  .v7-cat-prompt.sheet-open .v7-cat-top-sheet {
    max-height: 300px;
  }
  .v7-sheet-grid {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 10px; padding: 14px 16px 16px;
  }
  .v7-sheet-pill {
    padding: 15px 8px;
    font-size: 12px; font-weight: 700;
    text-align: center;
    border-radius: var(--radius-sm);
    border: 1.5px solid transparent;
    touch-action: manipulation; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    transition: opacity 0.15s, transform 0.15s;
  }
  .v7-sheet-pill:active { opacity: 0.7; transform: scale(0.97); }

  .v7-cat-pill { padding: 4px 10px; font-size: 10px; }
  .v7-cat-trigger:not(.in-header) { top: 12px; left: 12px; transform: none; font-size: 9px; padding: 5px 10px; }

  /* Tighter hat-row gap on mobile */
  .v7-workspace .hat-row { margin-bottom: clamp(2px, 1vh, 10px); }
  .v7-workspace .cube-scene { height: min(380px, calc(100vh - 320px)); height: min(380px, calc(100dvh - 320px)); }

  .v7-summary-card {
    max-height: 90vh;
    border-radius: var(--radius-md);
    padding: 16px;
  }
  .v7-sg-cell { font-size: 9px; padding: 4px 2px; }
}

@media (min-width: 600px) {
  .v7-cat-trigger { font-size: 12px; padding: 9px 22px; }
}

/* ── Focus states ── */
.v7-pill:focus-visible,
.v7-cat-pill:focus-visible,
.v7-cal-day:focus-visible,
.v7-date-preset:focus-visible,
.v7-sidebar-toggle:focus-visible,
.v7-sidebar-close:focus-visible,
.v7-cat-trigger:focus-visible,
.v7-error-retry:focus-visible,
.v7-date-back-btn:focus-visible,
.v7-date-custom-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--orange-muted);
}
.v7-bottom-cta:focus-visible,
.v7-cart-btn:focus-visible,
.v7-summary-btn:focus-visible,
.v7-summary-close:focus-visible,
.v7-summary-edit-btn:focus-visible,
.v7-qty-stepper button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--orange-muted);
}
