:root {
  --accent: #1E5EFF;
  --accent-dark: #1449D4;
  --accent-light: #EBF2FF;
  --accent-mid: #BFCFFF;
  --bg: #F4F7FF;
  --surface: #FFFFFF;
  --surface-2: #F0F4FF;
  --border: #DDE4F0;
  --border-dark: #C4CFEA;
  --text: #0D1829;
  --text-2: #4A5878;
  --text-3: #8A97B8;
  --green: #0F9F6E;
  --green-light: #E8F8F3;
  --purple: #6B4ECC;
  --purple-light: #F0ECFF;
  --yellow: #D97706;
  --yellow-light: #FFF8EB;
  --red: #DC2626;
  --red-light: #FEF2F2;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 4px rgba(30,60,120,0.08);
  --shadow-md: 0 4px 16px rgba(30,60,120,0.12);
}

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

html, body {
  overflow-x: hidden;
  max-width: 100vw;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* ── HEADER ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  gap: 12px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.logo-svg { width: 34px; height: 34px; flex-shrink: 0; }
.logo-text { font-size: 15px; font-weight: 800; letter-spacing: -0.4px; white-space: nowrap; }
.logo-text span { color: var(--accent); }
.week-badge {
  font-size: 12px;
  color: var(--text-2);
  background: var(--surface-2);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── NAV ── */
.nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 54px;
  z-index: 99;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
}
.nav::-webkit-scrollbar { display: none; }
.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  padding: 0 20px;
  min-width: max-content;
}
.nav-tab {
  padding: 13px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  user-select: none;
}
.nav-tab:hover { color: var(--text); }
/* Inactive tabs stay neutral; only the active tab gets the blue accent treatment */
.nav-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.nav-tab-primary { color: var(--text-1); font-weight: 700; }
.nav-tab-primary:hover { color: var(--accent); }
.step-num {
  width: 20px; height: 20px;
  background: var(--surface-2);
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  flex-shrink: 0;
}
.nav-tab.active .step-num { background: var(--accent); color: white; }
.nav-tab-secondary { color: var(--text-3); font-weight: 500; }
.nav-tab-secondary:hover { color: var(--text-2); }
.nav-tab-secondary.active { color: var(--accent); font-weight: 600; }
.nav-divider { width: 1px; background: var(--border); margin: 8px 6px; flex-shrink: 0; }

/* ── MAIN ── */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  width: 100%;
}
.section { display: none; }
.section.active { display: block; }

/* ── SECTION HEADER ── */
.section-header { margin-bottom: 22px; padding-left: 14px; border-left: 3px solid var(--accent); }
.section-title { font-size: 21px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.section-subtitle { color: var(--text-2); font-size: 13px; max-width: 560px; line-height: 1.55; }

/* ── CARDS ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600;
  cursor: pointer; border: none;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: transparent; color: var(--text-2); padding: 5px 8px; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red-light); color: var(--red); border: 1px solid #FCA5A5; }
.btn-danger:hover { background: #FCA5A5; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-xs { padding: 3px 8px; font-size: 11px; }

/* ── INPUTS ── */
input, textarea, select {
  font-family: inherit; font-size: 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
textarea { resize: vertical; }
label { font-size: 11px; font-weight: 700; color: var(--text-2); display: block; margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-group { margin-bottom: 14px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ═══════════════════════════════════════
   STEP 1 – PLAN YOUR WEEK
═══════════════════════════════════════ */
.week-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.day-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}
.day-card.has-note { border-color: var(--accent-mid); }
.day-header {
  background: var(--surface-2);
  padding: 10px 13px 8px;
  border-bottom: 1px solid var(--border);
}
.day-name { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; color: var(--text-3); }
.day-card.has-note .day-name { color: var(--accent); }
.day-slots { padding: 10px 13px 12px; display: flex; flex-direction: column; gap: 8px; }
.day-slot {}
.slot-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-3);
  margin-bottom: 3px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.day-slot textarea {
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 6px 8px;
  background: var(--bg);
  font-size: 12px;
  min-height: 44px;
  resize: none;
  line-height: 1.4;
  color: var(--text);
}
.day-slot textarea:focus { border-color: var(--accent); background: white; box-shadow: none; }
.day-slot textarea::placeholder { color: var(--text-3); font-size: 11px; }
.week-tip {
  margin-top: 18px;
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 13px 16px;
  font-size: 13px;
  color: var(--accent-dark);
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.55;
}

/* ═══════════════════════════════════════
   STEP 2 – RECIPES
═══════════════════════════════════════ */
.meal-sections { display: flex; flex-direction: column; gap: 30px; }
.meal-section-header {
  display: flex; flex-direction: column; align-items: flex-start;
  margin-bottom: 12px; gap: 8px;
}
.meal-type-label { display: flex; align-items: center; gap: 10px; }
.meal-type-icon {
  width: 36px; height: 36px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.meal-type-icon.breakfast { background: var(--yellow-light); }
.meal-type-icon.lunch { background: var(--green-light); }
.meal-type-icon.dinner { background: var(--accent-light); }
.meal-type-title { font-size: 16px; font-weight: 800; }
.meal-type-desc { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.meal-slots-count { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.recipes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.recipe-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 15px;
  box-shadow: var(--shadow);
  transition: all 0.15s;
}
.recipe-card:hover { border-color: var(--accent-mid); box-shadow: var(--shadow-md); }
.recipe-card-name { font-size: 13px; font-weight: 700; margin-bottom: 2px; }
.recipe-card-servings { font-size: 11px; color: var(--text-2); margin-bottom: 6px; }
.recipe-card-note { font-size: 11px; color: var(--text-2); margin-bottom: 6px; line-height: 1.4; }
.recipe-steps { margin: 0; padding-left: 16px; }
.recipe-card-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.recipe-tag { font-size: 10px; font-weight: 600; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; white-space: nowrap; }
.recipe-card-ings { font-size: 11px; color: var(--text-3); margin-bottom: 10px; }
.recipe-card-actions { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border); }

/* ── Info Tooltips ── */
.info-tip-wrap { position: relative; display: inline-flex; align-items: center; }
.info-tip-btn {
  background: none; border: none; cursor: pointer; padding: 0; margin-left: 6px;
  font-size: 15px; line-height: 1; color: var(--text-3); opacity: 0.5;
  transition: opacity 0.15s;
}
.info-tip-btn:hover { opacity: 0.85; }
.info-tip-bubble {
  display: none; position: absolute; left: 50%; top: calc(100% + 8px);
  transform: translateX(-50%); z-index: 200;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; box-shadow: 0 6px 20px rgba(0,0,0,0.12);
  font-size: 12px; font-weight: 400; color: var(--text-2); line-height: 1.5;
  width: max-content; max-width: 340px; text-align: left; text-transform: none; letter-spacing: normal;
  pointer-events: auto;
}
.info-tip-bubble::before {
  content: ''; position: absolute; top: -6px; left: 50%; transform: translateX(-50%);
  width: 10px; height: 10px; background: var(--surface); border-left: 1px solid var(--border);
  border-top: 1px solid var(--border); transform: translateX(-50%) rotate(45deg);
}
.info-tip-bubble.open { display: block; }
.modal .info-tip-bubble { left: 0; transform: none; max-width: min(340px, calc(100vw - 100px)); }
.modal .info-tip-bubble::before { left: 12px; }

/* Mobile: pin tooltip to viewport edges so it never clips off-screen */
@media (max-width: 600px) {
  .info-tip-bubble {
    position: fixed;
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 80px;
    transform: none;
    width: auto;
    max-width: none;
    font-size: 13px;
    padding: 12px 16px;
    box-shadow: 0 8px 28px rgba(0,0,0,0.22);
    z-index: 300;
  }
  .info-tip-bubble::before { display: none; }
  .modal .info-tip-bubble {
    position: fixed;
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 80px;
    max-width: none;
  }
}

.add-recipe-slot {
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; cursor: pointer; min-height: 110px;
  color: var(--text-3); transition: all 0.15s;
}
.add-recipe-slot:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.add-recipe-slot .plus { font-size: 22px; font-weight: 300; line-height: 1; }
.add-recipe-slot .slot-text { font-size: 12px; font-weight: 600; }
.max-reached {
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 16px; text-align: center; min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.max-reached strong { color: var(--accent); font-size: 13px; display: block; margin-bottom: 3px; }
.max-reached span { font-size: 11px; color: var(--accent-dark); opacity: 0.75; }
.starter-note {
  margin-top: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 12px;
  color: var(--text-2);
  display: flex;
  gap: 8px;
}

/* ═══════════════════════════════════════
   RECIPE LIBRARY
═══════════════════════════════════════ */
.lib-intro {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}
.lib-intro-icon { font-size: 26px; flex-shrink: 0; }
.lib-intro-text { font-size: 13px; color: var(--text-2); line-height: 1.55; }
.lib-intro-text strong { color: var(--text); }
.lib-filters {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.lib-filter-btn {
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-family: inherit;
  transition: all 0.15s;
}
.lib-filter-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.lib-filter-btn:hover:not(.active) { border-color: var(--accent-mid); color: var(--text); }
.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.lib-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 0;
  transition: all 0.15s;
}
.lib-card:hover { border-color: var(--accent-mid); box-shadow: var(--shadow-md); }
.lib-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.lib-card-name { font-size: 14px; font-weight: 700; line-height: 1.3; }
.lib-type-tag {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  letter-spacing: 0.2px;
  text-transform: uppercase;
}
.lib-type-breakfast { background: var(--yellow-light); color: var(--yellow); }
.lib-type-lunch { background: var(--green-light); color: var(--green); }
.lib-type-dinner { background: var(--accent-light); color: var(--accent-dark); }
.lib-card-srv { font-size: 11px; color: var(--text-3); margin-bottom: 8px; }
.lib-card-note {
  font-size: 12px;
  color: var(--text-2);
  font-style: italic;
  line-height: 1.5;
  margin-bottom: 8px;
}
.lib-card-ings { font-size: 11px; color: var(--text-3); line-height: 1.5; margin-bottom: 12px; }
.lib-card-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.lib-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.lib-tag {
  font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 10px;
  letter-spacing: 0.2px; white-space: nowrap;
}
/* Tag colour map */
.lib-tag-mealtime { background: #E8F5E9; color: #2E7D32; }
.lib-tag-freezer  { background: #EBF2FF; color: #1449D4; }
.lib-tag-batch    { background: #F0ECFF; color: #6B4ECC; }
.lib-tag-mealprep { background: #F0ECFF; color: #6B4ECC; }
.lib-tag-quick    { background: #FFF8EB; color: #D97706; }
.lib-tag-protein  { background: #E8F8F3; color: #0F9F6E; }
.lib-tag-nocook   { background: #E8F8F3; color: #0F9F6E; }
.lib-tag-easy     { background: #F0F4FF; color: #4A5878; }
.lib-tag-budget   { background: #F4F7FF; color: #4A5878; }
.lib-tag-onepan   { background: #FFF3E0; color: #E65100; }
.lib-filter-tag { font-size: 11px; padding: 5px 12px; opacity: 0.85; }
.lib-filter-tag.active { opacity: 1; }
.lib-filter-mealtime { background: #E8F5E9; color: #2E7D32; border-color: #C8E6C9; }
.lib-filter-mealtime.active { background: #2E7D32; color: #fff; border-color: #2E7D32; }
.lib-badge-added { font-size: 12px; color: var(--green); font-weight: 700; }
.lib-badge-full { font-size: 11px; color: var(--text-3); font-style: italic; }
.lib-add-btn { font-size: 12px; padding: 6px 14px; }
@media (max-width: 480px) {
  .lib-grid { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════
   STEP 3 – MEAL PLAN
═══════════════════════════════════════ */
.meal-plan-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.meal-plan-table { width: 100%; border-collapse: collapse; min-width: 640px; }
.meal-plan-table th {
  background: var(--surface-2);
  padding: 0;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  vertical-align: top;
  min-width: 160px;
}
.meal-plan-table th:first-child { min-width: 80px; }
.meal-plan-table th:last-child { border-right: none; }
.th-inner { padding: 10px 12px; }
.th-day { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-2); margin-bottom: 6px; }
.th-commitment {
  display: flex; align-items: flex-start; gap: 4px;
  font-size: 10px; color: var(--text-2); margin-bottom: 3px;
  line-height: 1.3;
}
.th-commitment-icon { font-size: 10px; flex-shrink: 0; margin-top: 1px; }
.th-commitment-text { color: var(--text-2); }
.meal-plan-table td {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 6px;
  vertical-align: top;
}
.meal-plan-table td:first-child { background: var(--surface-2); border-right: 1px solid var(--border-dark); }
.meal-plan-table td:last-child { border-right: none; }
.meal-plan-table tr:last-child td { border-bottom: none; }
.row-label {
  padding: 10px 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 5px; text-align: center; min-height: 88px; height: 100%;
}
.row-label-name { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px; }
.row-label-icon { font-size: 22px; }
.plan-cell {
  min-height: 80px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  border: 2px dashed transparent;
  transition: all 0.15s;
  position: relative;
}
.plan-cell.empty {
  border-color: var(--border);
  display: flex; align-items: center; justify-content: center;
}
.plan-cell.empty:hover { border-color: var(--accent-mid); background: var(--accent-light); }
.cell-empty-label { font-size: 11px; color: var(--text-3); font-weight: 500; }
.plan-cell.empty:hover .cell-empty-label { color: var(--accent); }
.cell-filled {
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  min-height: 80px;
  position: relative;
  transition: all 0.15s;
  background: var(--surface);
}
.cell-filled:hover { border-color: var(--accent-mid); box-shadow: var(--shadow); }
.cell-filled.type-breakfast { border-left: 3px solid var(--yellow); }
.cell-filled.type-lunch { border-left: 3px solid var(--green); }
.cell-filled.type-dinner-goto { border-left: 3px solid var(--accent); }
.cell-filled.type-dinner-freezer { border-left: 3px solid var(--purple); }
.cell-filled.type-dinner-takeout { border-left: 3px solid var(--text-3); }
.cell-filled.type-dinner-fun { border-left: 3px solid var(--green); }
.cell-meal-name { font-size: 12px; font-weight: 700; margin-bottom: 2px; line-height: 1.3; padding-right: 18px; }
.cell-servings { font-size: 10px; color: var(--text-3); margin-bottom: 5px; }
.cell-tag {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 700;
  padding: 2px 7px; border-radius: 10px;
}
.tag-goto { background: var(--accent-light); color: var(--accent); }
.tag-freezer { background: var(--purple-light); color: var(--purple); }
.tag-takeout { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tag-fun { background: var(--green-light); color: var(--green); }
.tag-lunchout { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.tag-leftovers { background: var(--yellow-light); color: var(--yellow); }
.cell-remove {
  position: absolute; top: 5px; right: 5px;
  width: 18px; height: 18px;
  background: var(--border); border: none; border-radius: 50%;
  font-size: 11px; cursor: pointer;
  display: none; align-items: center; justify-content: center;
  color: var(--text-2); line-height: 1; font-weight: 700;
}
.cell-filled:hover .cell-remove { display: flex; }

/* Edit button — subtle blue circle, far right of cell */
.cell-edit-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 18px;
  height: 18px;
  background: rgba(30, 94, 255, 0.12);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  padding: 0;
  flex-shrink: 0;
}
.cell-edit-btn:hover {
  background: rgba(30, 94, 255, 0.3);
}
@media (max-width: 600px) {
  .cell-edit-btn { width: 22px; height: 22px; }
}

/* Clickable recipe name — shows cooking instructions on tap */
.cell-has-notes { cursor: pointer; text-decoration: underline dotted var(--text-3); text-underline-offset: 2px; }
.cell-has-notes:hover { color: var(--accent); text-decoration-color: var(--accent); }

/* Cooking instructions popover */
.cell-notes-popover {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cell-notes-card {
  background: var(--surface);
  border-radius: 12px;
  max-width: 420px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.cell-notes-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.cell-notes-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--text-1);
}
.cell-notes-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-3);
  padding: 0;
  line-height: 1;
}
.cell-notes-steps {
  padding-left: 20px;
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-2);
}
.cell-notes-steps li { margin-bottom: 6px; }

/* ═══════════════════════════════════════
   STEP 4 – GROCERY LIST
═══════════════════════════════════════ */
.grocery-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 18px; flex-wrap: wrap; gap: 10px;
}
.grocery-main { max-width: 680px; }
.grocery-category { margin-bottom: 22px; }
.category-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
}
.category-icon { font-size: 15px; }
.category-name { font-size: 13px; font-weight: 800; letter-spacing: -0.2px; }
.category-count { font-size: 11px; color: var(--text-3); margin-left: auto; }
.grocery-add-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 18px; padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.grocery-add-bar input[type="text"] {
  flex: 1 1 auto; min-width: 0;
  padding: 9px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; font-family: inherit;
}
.grocery-add-bar select {
  font-size: 13px; padding: 9px 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: #fff; font-family: inherit;
  max-width: 170px; cursor: pointer;
}
.grocery-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.12s;
}
.grocery-item:hover { border-color: var(--accent); background: var(--surface); }
.grocery-item input[type="checkbox"] {
  width: 18px; height: 18px; flex-shrink: 0;
  cursor: pointer; accent-color: var(--accent);
  border-radius: 4px;
}
.grocery-item-name { font-size: 13px; flex: 1 1 auto; }
.grocery-item.done { background: var(--surface-2); opacity: 0.7; }
.grocery-item.done .grocery-item-name,
.grocery-item.done .grocery-item-qty { text-decoration: line-through; color: var(--text-3); }
.grocery-item-qty { font-size: 12px; color: var(--text-2); font-weight: 500; }
.grocery-item-qty .hint { color: var(--text-3); font-weight: 400; font-size: 11px; }
.grocery-item .item-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 14px; padding: 2px 6px;
  flex-shrink: 0;
}
.grocery-item .item-remove:hover { color: var(--red); }
.list-only-section { margin-bottom: 22px; }
.list-only-items { display: flex; flex-direction: column; gap: 0; }
.list-item-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 7px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-2);
}
.list-item-row:hover { background: var(--surface-2); }
.list-item-row .item-name { flex: 1; }
.list-item-row .item-remove { background: none; border: none; cursor: pointer; color: var(--text-3); font-size: 13px; padding: 2px 4px; }
.list-item-row .item-remove:hover { color: var(--red); }
.list-item-row input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; accent-color: var(--accent); }
.list-item-row .item-name.done { text-decoration: line-through; color: var(--text-3); }
.add-list-item { display: flex; gap: 8px; margin-top: 8px; }
.add-list-item input { flex: 1; }
.grocery-empty-hint {
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  line-height: 1.5;
}
.grocery-empty {
  text-align: center; padding: 50px 20px;
  color: var(--text-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.grocery-empty .empty-icon { font-size: 40px; margin-bottom: 12px; }
.grocery-empty p { font-size: 13px; max-width: 280px; margin: 0 auto; line-height: 1.55; }

/* ═══════════════════════════════════════
   FREEZER
═══════════════════════════════════════ */
.freezer-layout { display: grid; grid-template-columns: 1fr 300px; gap: 20px; }
.freezer-list { display: flex; flex-direction: column; gap: 10px; }
.freezer-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.freezer-card.use-first { border-color: var(--accent); border-left: 4px solid var(--accent); }
.freezer-icon { font-size: 24px; flex-shrink: 0; }
.freezer-body { flex: 1; min-width: 0; }
.freezer-name { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fifo-badge {
  font-size: 10px; font-weight: 700;
  background: var(--accent); color: white;
  padding: 2px 7px; border-radius: 10px;
}
.freezer-meta { font-size: 11px; color: var(--text-2); margin-top: 2px; }
.freezer-note { font-size: 11px; color: var(--text-3); margin-top: 2px; }
.freezer-exp { font-size: 11px; margin-top: 4px; font-weight: 600; }
.exp-ok { color: var(--green); }
.exp-warn { color: var(--yellow); }
.exp-danger { color: var(--red); }
.freezer-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.freezer-empty {
  text-align: center; padding: 50px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-3);
}

/* ═══════════════════════════════════════
   MODAL
═══════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10,20,50,0.45);
  z-index: 200;
  display: none; align-items: center; justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%; max-width: 500px;
  max-height: 92vh; overflow-y: auto;
  box-shadow: 0 24px 64px rgba(10,20,80,0.2);
}
.modal-header {
  padding: 20px 22px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 800; }
.modal-close {
  width: 28px; height: 28px;
  background: var(--surface-2); border: none; border-radius: 50%;
  cursor: pointer; font-size: 14px; color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 18px 22px; overflow: visible; }
.modal-footer {
  padding: 12px 22px 20px;
  display: flex; gap: 10px; justify-content: flex-end;
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0;
  background: var(--surface);
}

/* ingredient cards */
.ing-row {
  position: relative;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 40px 10px 12px; margin-bottom: 8px;
}
.ing-name { width: 100%; margin-bottom: 6px; }
.ing-row-bottom {
  display: flex; gap: 8px;
}
.ing-row-bottom input { flex: 0 0 90px; }
.ing-row-bottom select { flex: 1; padding: 8px 7px; }
.ing-remove {
  position: absolute; top: 8px; right: 8px;
  width: 24px; height: 24px; padding: 0;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  color: var(--text-3); font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.ing-remove:hover { background: var(--red-light); color: var(--red); border-color: #FCA5A5; }

/* Step rows (instructions builder) */
.step-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.step-num {
  font-size: 11px; font-weight: 800; color: var(--accent);
  background: var(--accent-light); border-radius: 50%;
  width: 20px; height: 20px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.step-row input {
  flex: 1; font-size: 13px;
}
.step-row button {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); font-size: 13px; padding: 2px 4px; flex-shrink: 0;
}
.step-row button:hover { color: var(--red); }

/* assign modal */
.assign-type-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.assign-type-btn {
  padding: 10px 12px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  transition: all 0.15s; text-align: center; background: var(--surface);
}
.assign-type-btn:hover { border-color: var(--accent-mid); background: var(--accent-light); }
.assign-type-btn.sel { border-color: var(--accent); background: var(--accent-light); }
.assign-type-btn .atype-icon { font-size: 18px; margin-bottom: 3px; }
.assign-type-btn .atype-name { font-size: 12px; font-weight: 700; color: var(--text); }
.assign-type-btn .atype-sub { font-size: 10px; color: var(--text-3); margin-top: 1px; }
.assign-type-btn.sel .atype-name { color: var(--accent); }
.meal-name-row { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.meal-name-row > div:first-child { flex: 1; }
.recipe-picker { margin-bottom: 12px; }
.recipe-pick-opt {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer;
  margin-bottom: 6px; transition: all 0.15s; background: var(--surface);
}
.recipe-pick-opt:hover { border-color: var(--accent-mid); background: var(--accent-light); }
.recipe-pick-opt.sel { border-color: var(--accent); background: var(--accent-light); }
.rpo-name { font-size: 13px; font-weight: 600; flex: 1; }
.rpo-sub { font-size: 11px; color: var(--text-3); }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 900px) {
  .freezer-layout { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .week-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .assign-type-grid { grid-template-columns: 1fr 1fr; }
  /* Recipe cards stack to single column below 700px */
  .recipes-grid { grid-template-columns: 1fr; }
  /* Header: hide week badge, tighten spacing */
  .week-badge { display: none; }
  .user-menu { gap: 6px; }
  .user-email { max-width: 120px; font-size: 10px; }
  .logo-text { font-size: 13px; }
  .header-inner { height: 48px; }
  .header { padding: 0 14px; }
  /* Nav tabs: tighter on mobile — readable font size */
  .nav-tab { padding: 11px 14px; font-size: 14px; gap: 6px; }
  .nav-divider { margin: 6px 4px; }
  .step-num { width: 20px; height: 20px; font-size: 11px; }
  .nav-inner { padding: 0 10px; }
  /* Sticky top adjusts for shorter header */
  .nav { top: 48px; }
  /* Footer: hide descriptions on mobile */
  .footer-action-desc { display: none; }
}
@media (max-width: 480px) {
  .week-grid { grid-template-columns: 1fr; }
  .recipes-grid { grid-template-columns: 1fr; }
  .main { padding: 16px 14px 60px; }
  .section-title { font-size: 18px; }
  .section-subtitle { font-size: 12px; }
  /* Nav: compact for small phones but still readable */
  .nav-tab { padding: 9px 11px; font-size: 13px; gap: 5px; }
  .step-num { width: 18px; height: 18px; font-size: 10px; }
  /* Header: minimal */
  .user-email { display: none; }
  .header-inner { height: 44px; }
  .nav { top: 44px; }
  /* Grocery toolbar stacks */
  .grocery-toolbar { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* Modal full-width on small phones */
  .modal { width: 95vw; max-width: 95vw; margin: 10px; }
}

/* ── AUTH SCREEN ── */
#authScreen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 24px;
  overflow-y: auto;
}
/* Prevent flex from squishing auth box when mobile keyboard is open */
.auth-box { flex-shrink: 0; }
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 40px 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
}
.auth-logo { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.auth-logo span { color: var(--accent); }
.auth-subtitle { font-size: 13px; color: var(--text-2); margin-bottom: 28px; line-height: 1.5; }
.auth-label { text-align: left; font-size: 11px; font-weight: 700; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 5px; }
.auth-input { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 14px; font-family: inherit; margin-bottom: 14px; outline: none; transition: border-color 0.15s; }
.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.auth-btn { width: 100%; padding: 11px; background: var(--accent); color: white; border: none; border-radius: var(--radius-sm); font-size: 14px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background 0.15s; }
.auth-btn:hover { background: var(--accent-dark); }
.auth-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.auth-msg { margin-top: 16px; font-size: 13px; color: var(--text-2); line-height: 1.55; }
.auth-msg.success { color: var(--green); font-weight: 600; }
.auth-msg.error { color: var(--red); }

/* ── USER BADGE in header ── */
.user-menu { display: flex; align-items: center; gap: 10px; }
.user-email { font-size: 11px; color: var(--text-3); font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.logout-btn { font-size: 11px; color: var(--text-3); background: none; border: 1px solid var(--border); border-radius: 20px; padding: 4px 10px; cursor: pointer; font-family: inherit; font-weight: 600; transition: all 0.15s; }
.logout-btn:hover { color: var(--red); border-color: var(--red); }

/* ── ACCESS GATE ── */
#accessGate {
  display: none;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}
.access-gate-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.access-gate-icon { font-size: 48px; margin-bottom: 16px; }
.access-gate-title { font-size: 22px; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.4px; }
.access-gate-sub { font-size: 14px; color: var(--text-2); margin-bottom: 28px; line-height: 1.6; }
.access-gate-price { font-size: 32px; font-weight: 800; color: var(--accent); margin-bottom: 6px; }
.access-gate-price-sub { font-size: 13px; color: var(--text-3); margin-bottom: 28px; }
.btn-get-access {
  display: inline-block; width: 100%; padding: 14px 24px;
  background: var(--accent); color: #fff; font-size: 15px;
  font-weight: 700; border: none; border-radius: var(--radius);
  cursor: pointer; letter-spacing: -0.2px; transition: background .15s;
}
.btn-get-access:hover { background: var(--accent-dark); }
.btn-get-access:disabled { opacity: .6; cursor: not-allowed; }
.access-gate-signout { margin-top: 18px; font-size: 13px; color: var(--text-3); }
.access-gate-signout a { color: var(--text-3); text-decoration: underline; cursor: pointer; }
.payment-success-banner {
  background: #ecfdf5; border: 1px solid #6ee7b7;
  color: #065f46; padding: 12px 18px; border-radius: var(--radius);
  font-size: 13px; font-weight: 600; text-align: center; margin-bottom: 16px;
}

/* ── Auth tab styles ── */
.auth-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
}
.auth-tab {
  flex: 1;
  background: none;
  border: none;
  padding: 10px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.auth-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Save toast ───────────────────────────────────────────────────────── */
#_saveToast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 9999;
}
#_saveToast._toast-visible {
  opacity: 1;
  transform: translateY(0);
}
#_saveToast._toast-ok  { background: #1a9e5c; color: #fff; }
#_saveToast._toast-err { background: #c0392b; color: #fff; }

/* ════════════════════════════════════════
   MOBILE RESPONSIVE  (max-width: 768px)
════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Sidebar becomes a horizontal scrollable strip */
  #appRoot { flex-direction: column !important; height: auto !important; overflow: visible !important; }
  #sidebar {
    width: 100% !important; height: auto !important;
    flex-direction: row !important; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-right: none !important; border-bottom: 1px solid var(--border);
    padding: 6px 10px; gap: 4px; min-height: 0; flex-shrink: 0;
  }
  .logo-area, .sidebar-logo, .app-logo-wrap { display: none !important; }
  .nav-btn, .nav-item {
    flex-direction: column !important; min-width: 58px;
    padding: 5px 6px !important; font-size: 10px !important; gap: 2px; border-radius: 8px;
  }
  .signout-btn { margin-top: 0 !important; margin-left: auto !important; }

  #mainContent { padding: 12px !important; overflow-y: auto; height: auto !important; }

  .week-grid { grid-template-columns: 1fr !important; gap: 10px !important; }

  .meal-table-wrap, .plan-table-wrap, .week-table-wrap, .table-scroll-wrap {
    overflow-x: auto !important; -webkit-overflow-scrolling: touch;
  }
  table.meal-table, table.plan-table, .meal-plan-table { min-width: 520px; }

  .grocery-grid, .recipe-grid, .lib-grid, .cards-grid { grid-template-columns: 1fr !important; }

  .modal-content { width: 95vw !important; max-width: 95vw !important; margin: 16px auto !important; padding: 20px 16px !important; }

  #authScreen { padding: 20px 12px !important; }
  .auth-card, .auth-box { width: 100% !important; max-width: 100% !important; padding: 24px 16px !important; }

  .app-header { padding: 10px 14px !important; }
  .app-header h1, .header-title { font-size: 15px !important; }

  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
  .btn-row, .action-row { flex-wrap: wrap; gap: 8px; }
}

/* ── ONBOARDING / LOADING ─────────────────────────────────────────────── */
.auth-notice {
  background: #fff8e1; border: 1px solid #f9c74f; border-radius: 8px;
  padding: 10px 14px; font-size: 13px; color: #6d4c00;
  margin-bottom: 16px; display: flex; align-items: flex-start;
  gap: 8px; line-height: 1.4;
}
.auth-notice span { font-size: 16px; flex-shrink: 0; }
.access-gate-support { font-size: 12px; color: #888; margin-top: 6px; }
.access-gate-support a { color: var(--accent, #4f8ef7); text-decoration: none; }
.access-gate-support a:hover { text-decoration: underline; }
#loadingScreen {
  position: fixed; inset: 0; background: var(--bg, #fff);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; transition: opacity 0.3s ease;
}
.loading-spinner {
  width: 40px; height: 40px;
  border: 3px solid #e0e0e0; border-top-color: var(--accent, #4f8ef7);
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#onboardingOverlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9998; padding: 20px; transition: opacity 0.3s ease;
}
.onboarding-card {
  background: var(--card-bg, #fff); border-radius: 16px;
  padding: 36px 32px; max-width: 420px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.onboarding-icon { font-size: 48px; margin-bottom: 12px; }
.onboarding-card h2 { font-size: 22px; font-weight: 700; margin-bottom: 10px; }
.onboarding-card > p { font-size: 15px; color: #666; margin-bottom: 20px; }
.onboarding-tips { list-style: none; padding: 0; margin: 0 0 24px; text-align: left; display: flex; flex-direction: column; gap: 10px; }
.onboarding-tips li { font-size: 14px; line-height: 1.4; }
.onboarding-dismiss { width: 100%; padding: 12px; font-size: 15px; font-weight: 600; }

/* ═══════════════════════════════════════
   COOKING VIEW MODAL
═══════════════════════════════════════ */
.cooking-modal { max-width: 560px; }
.cook-meta {
  font-size: 13px; color: var(--text-2); font-weight: 600;
  margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.cook-section-title {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-3); margin-bottom: 10px;
  margin-top: 18px;
}
.cook-section-title:first-of-type { margin-top: 0; }
.cook-ing-group {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px; margin-bottom: 10px;
}
.cook-ing-cat {
  font-size: 11px; font-weight: 800; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 8px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.cook-ing-row {
  display: flex; align-items: baseline; gap: 8px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
  font-size: 14px; line-height: 1.4;
}
.cook-ing-row:last-child { border-bottom: none; padding-bottom: 0; }
.cook-ing-qty {
  font-weight: 700; color: var(--accent); min-width: 56px;
  flex-shrink: 0; font-size: 13px;
}
.cook-ing-name { color: var(--text-1); }
.cook-steps {
  padding-left: 20px; margin: 0;
}
.cook-steps li {
  font-size: 14px; line-height: 1.65; color: var(--text-1);
  margin-bottom: 10px; padding-left: 4px;
}
.cook-steps li:last-child { margin-bottom: 0; }
/* Tappable recipe name in meal plan */
.cell-meal-link {
  cursor: pointer; text-decoration: underline;
  text-decoration-color: rgba(30,94,255,0.35);
  text-underline-offset: 2px;
}
.cell-meal-link:hover { color: var(--accent); }

/* ═══════════════════════════════════════
   ONBOARDING BANNERS & CTAs
═══════════════════════════════════════ */
.onboarding-banner {
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.ob-banner-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.ob-banner-left { flex: 1; min-width: 0; }
.ob-banner-right { flex-shrink: 0; }
.ob-step {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--accent); margin-bottom: 4px;
}
.ob-title { font-size: 16px; font-weight: 800; margin-bottom: 3px; }
.ob-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.btn-next {
  padding: 8px 18px; font-size: 13px; font-weight: 700;
  white-space: nowrap; border-radius: 8px;
}
.ob-complete-msg {
  font-size: 14px; font-weight: 700; color: var(--green);
  margin-bottom: 10px; text-align: center;
}
.btn-cta {
  display: block; width: 100%; max-width: 320px;
  margin: 0 auto; padding: 12px 24px;
  font-size: 14px; font-weight: 700;
  text-align: center;
}
.onboarding-progress {
  font-size: 13px; color: var(--text-2); font-weight: 600;
}

/* ═══════════════════════════════════════
   SOFT GATING
═══════════════════════════════════════ */
.soft-gate {
  background: var(--yellow-light);
  border: 1px solid #F9C74F;
  border-radius: var(--radius);
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 20px;
}
.soft-gate-msg {
  font-size: 14px; font-weight: 600;
  color: #6D4C00; margin-bottom: 14px;
  line-height: 1.5;
}

/* ═══════════════════════════════════════
   V4 QUICK-START WELCOME MODAL
═══════════════════════════════════════ */
.qs-welcome-modal {
  max-width: 380px;
  width: 90%;
  text-align: center;
  padding: 48px 32px 40px;
  border-radius: 16px;
  position: relative;
}
.qs-welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
}
.qs-welcome-title {
  font-size: 24px;
  font-weight: 800;
  color: var(--text-1);
  margin: 0 0 8px;
  letter-spacing: -0.3px;
}
.qs-welcome-sub {
  font-size: 15px;
  color: var(--text-2);
  margin: 0 0 28px;
  line-height: 1.5;
}
.qs-welcome-btn {
  width: 100%;
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 700;
  border-radius: 10px;
}

/* Quick-start example highlight on pre-filled obligation inputs */
.plan-note-input.qs-example {
  border: 2px solid var(--accent, #1E5EFF);
  background: rgba(30, 94, 255, 0.04);
}

/* ═══════════════════════════════════════
   V4 LEARN MORE BUTTON (dash header)
═══════════════════════════════════════ */
.learn-more-btn {
  background: none;
  color: var(--accent);
  border: none;
  border-radius: 0;
  padding: 2px 0;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  animation: lmPulse 2s ease-in-out 3;
}
.learn-more-btn:hover {
  text-decoration: underline;
  background: none;
}
@keyframes lmPulse {
  0%, 100% { text-shadow: 0 0 0 rgba(66,133,244,0.4); }
  50% { text-shadow: 0 0 8px rgba(66,133,244,0.3); }
}

/* V4 Learn More Banner (sequential walkthrough) */
.lm-banner {
  background: var(--accent-light);
  border: 1px solid var(--accent-mid);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.lm-banner-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.lm-banner-left { flex: 1; min-width: 0; }
.lm-banner-right { flex-shrink: 0; }
.lm-banner-step {
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--accent); margin-bottom: 4px;
}
.lm-banner-title { font-size: 16px; font-weight: 800; margin-bottom: 3px; }
.lm-banner-desc { font-size: 13px; color: var(--text-2); line-height: 1.5; }
.lm-banner .btn-next {
  padding: 8px 18px; font-size: 13px; font-weight: 700;
  white-space: nowrap; border-radius: 8px;
}

/* ═══════════════════════════════════════
   V4 QUICK-START ONBOARDING TOOLTIPS
═══════════════════════════════════════ */
.qs-tooltip-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: qsFadeIn 0.25s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
@keyframes qsFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.qs-tooltip-card {
  background: var(--surface);
  border-radius: 16px;
  padding: 28px 24px;
  max-width: 380px;
  width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
  text-align: center;
}
.qs-tooltip-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 8px;
  color: var(--text-1);
}
.qs-tooltip-body {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.55;
  margin-bottom: 16px;
}
.qs-tooltip-btn {
  padding: 14px 32px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  min-width: 200px;
  min-height: 48px;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(0,0,0,0.1);
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.qs-reset-arrow {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  margin: 12px 0 16px;
  animation: qsBounce 1.2s ease infinite;
}
@keyframes qsBounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(5px); }
}
.qs-final-card {
  max-width: 420px;
}

/* ═══════════════════════════════════════
   SAVED RECIPES (Step 2 — Not on menu)
═══════════════════════════════════════ */
.saved-recipes-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 24px;
  box-shadow: var(--shadow);
}
.saved-recipes-section.saved-recipes-empty {
  background: var(--surface-2);
  box-shadow: none;
}
.saved-recipes-header {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.saved-recipes-grid {
  display: flex; flex-direction: column; gap: 8px;
}
.saved-recipe-card {
  display: flex; align-items: center;
  justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}
.saved-recipe-card:hover {
  border-color: var(--accent-mid);
  box-shadow: var(--shadow);
}
.saved-recipe-info { flex: 1; min-width: 0; }
.saved-recipe-actions {
  display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap;
}
.btn-inline-goto {
  background: var(--accent-light); color: var(--accent);
  border: 1px solid var(--accent-mid);
  font-weight: 700; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.btn-inline-goto:hover { background: var(--accent); color: white; }
.btn-inline-goto:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-inline-goto:disabled:hover { background: var(--accent-light); color: var(--accent); }
.btn-inline-exp {
  background: var(--green-light); color: var(--green);
  border: 1px solid #A5D6A7;
  font-weight: 700; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.btn-inline-exp:hover { background: var(--green); color: white; }
.btn-inline-exp:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-inline-exp:disabled:hover { background: var(--green-light); color: var(--green); }

/* ═══════════════════════════════════════
   APP FOOTER
═══════════════════════════════════════ */
.app-footer {
  max-width: 480px; margin: 48px auto 0; padding: 24px 20px 32px;
  border-top: 1px solid var(--border); text-align: center;
}
.footer-primary-row {
  display: flex; gap: 10px; align-items: stretch;
  max-width: 360px; margin: 0 auto 8px;
}
.btn-reset-week {
  flex: 2 1 0;
  font-size: 14px; font-weight: 700;
  padding: 12px 16px;
}
.btn-settings {
  flex: 1 1 0;
  font-size: 13px; font-weight: 600;
  padding: 12px 14px;
}
/* Settings modal rows */
.settings-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: #F9FAFB;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 10px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  font-family: inherit;
  color: inherit;
  transition: background 0.1s, border-color 0.1s;
}
.settings-row:hover { background: #EEF3FA; border-color: var(--accent); }
.settings-row-main { flex: 1 1 auto; min-width: 0; }
.settings-row-title { font-size: 14px; font-weight: 600; color: var(--text-1); }
.settings-row-sub   { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.settings-row-arrow { font-size: 22px; color: var(--text-3); flex: 0 0 auto; }

/* ═══════════════════════════════════════
   TYPE TAG STYLES (Step 1 library)
═══════════════════════════════════════ */
.lib-type-goto { background: var(--accent-light); color: var(--accent-dark); }
.lib-type-experimental { background: var(--green-light); color: var(--green); }
.lib-type-custom { background: #F0ECFF; color: #6B4ECC; }
.lib-tag-custom { background: #F0ECFF; color: #6B4ECC; }
.lib-badge-full { font-size: 11px; color: var(--text-3); line-height: 1.4; }
.lib-badge-full a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* URL import in recipe modal */
.url-input-row { display: flex; gap: 8px; }
.url-input-row input { flex: 1; }
.url-input-row .btn { flex-shrink: 0; }
.url-status { font-size: 12px; margin-top: 6px; min-height: 16px; }
.url-status.url-error { color: var(--red); }
.url-status.url-success { color: #2e7d32; }
.url-disclaimer { font-size: 11px; color: var(--text-3); margin-top: 4px; }
.lib-source-link {
  display: block; font-size: 12px; color: var(--accent); text-decoration: none;
  margin-top: 6px; font-weight: 600;
}
.lib-source-link:hover { text-decoration: underline; }

/* What's New modal */
.whats-new-modal { max-width: 420px; }
.whats-new-date { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.whats-new-list { padding-left: 18px; margin: 0; }
.whats-new-list li { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 10px; }
.whats-new-list li:last-child { margin-bottom: 0; }
.whats-new-list strong { color: var(--text); }

/* Tag picker in recipe modal */
.tag-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
  font-size: 12px; font-family: inherit; font-weight: 600;
  padding: 5px 12px; border-radius: 20px; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); transition: all 0.15s;
}
.tag-pill:hover { border-color: var(--accent); color: var(--accent); }
.tag-pill.active { background: var(--accent-light); border-color: var(--accent-mid); color: var(--accent); }

/* Cooking modal stepper */
.cook-stepper { text-align: center; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.cook-stepper-row { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 4px; }
.cook-stepper-label { font-size: 14px; font-weight: 600; color: var(--text-1); }
.cook-stepper-btn { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-1); font-size: 18px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: all 0.15s; }
.cook-stepper-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.cook-stepper-btn:disabled { opacity: 0.3; cursor: default; }
.cook-stepper-val { font-size: 22px; font-weight: 700; color: var(--accent); min-width: 28px; text-align: center; }
.cook-stepper-hint { font-size: 11px; color: var(--text-3); font-style: italic; }

/* Account settings modal */
.acct-section { margin-bottom: 4px; }
.acct-section-title { font-weight: 700; font-size: 14px; color: var(--text-1); margin-bottom: 8px; }
.acct-field { margin-bottom: 10px; }
.acct-field label { display: block; font-size: 12px; color: var(--text-2); margin-bottom: 3px; font-weight: 600; }
.acct-field input { width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; background: var(--bg); color: var(--text-1); box-sizing: border-box; }
.acct-hint { font-size: 11px; color: var(--text-3); margin-top: 6px; }
.acct-msg { font-size: 13px; margin-bottom: 12px; min-height: 18px; }
.acct-msg.acct-error { color: #c0392b; }
.acct-msg.acct-success { color: #27ae60; }
.btn-sm { font-size: 13px; padding: 6px 16px; }

/* Mobile adjustments for saved recipes */
@media (max-width: 600px) {
  .saved-recipe-card { flex-direction: column; align-items: stretch; }
  .saved-recipe-actions { justify-content: flex-start; }
  .url-input-row { flex-direction: column; }
  .url-input-row .btn { width: 100%; }
}


/* ══════════════════════════════════════════════
   DASHBOARD — the "final result" of Steps 1-3
   ══════════════════════════════════════════════ */
/* .nav-tab-dashboard retired — replaced by .nav-tab-primary / .nav-tab-secondary pair */

.dash-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 24px;
  padding-left: 14px;
  border-left: 3px solid var(--accent);
}
.dash-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-1);
  letter-spacing: -0.3px;
}
.dash-daterange {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 4px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.week-ctx-range { white-space: nowrap; }
.week-ctx-toggle {
  display: inline-flex;
  background: var(--bg-2, #f1f3f8);
  border: 1px solid var(--border, #e4e8ef);
  border-radius: 999px;
  padding: 2px;
}
.week-ctx-btn {
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  background: transparent;
  border: 0;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s;
}
.week-ctx-btn.active {
  background: var(--accent, #1E5EFF);
  color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.week-ctx-btn:not(.active):hover { color: var(--text-1); }
.dash-grocery-btn {
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 700;
  padding: 12px 20px;
  font-size: 14px;
}

.dash-body { margin-bottom: 16px; }

.dash-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.dash-day-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  min-height: 200px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-day-card.today {
  border: 2px solid var(--accent);
  box-shadow: 0 4px 14px rgba(30, 94, 255, 0.12);
  padding: 13px 11px;
}
.dash-day-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.dash-day-name {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-1);
}
.dash-day-card.today .dash-day-name { color: var(--accent); }
.dash-today-badge {
  font-size: 9px;
  font-weight: 800;
  background: var(--accent);
  color: white;
  padding: 2px 6px;
  border-radius: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
/* "Today" pinned to the bottom of the day card — subtle, doesn't shift layout */
.dash-today-footer {
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
}
.dash-obligation {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 500;
  color: #C0392B;
  text-align: center;
  line-height: 1.3;
  opacity: 0.85;
}
.dash-day-date {
  font-size: 11px;
  color: var(--text-3);
  font-weight: 600;
}

.dash-meal-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.dash-meal-row:last-child { border-bottom: none; }
.dash-meal-label {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
/* Cook slots get a darker meal label to differentiate from skipped */
.dash-meal-label.is-cook { color: var(--text-1); font-weight: 800; }
.dash-meal-label.is-skip { color: var(--text-3); font-weight: 600; opacity: 0.7; }
.dash-meal-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  word-break: break-word;
}
.dash-meal-name.cookable {
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
.dash-meal-name.cookable:hover { text-decoration: underline; }
.dash-meal-name.cookable[title] { cursor: help; }
.dash-meal-name.freezer {
  color: #3b82f6;
  font-weight: 600;
}
/* Intentional "not cooking" plans (Leftovers / Eating out / custom) — dark text like cook assignments */
.dash-meal-name.planned-alt {
  color: var(--text-1);
  font-weight: 600;
  font-style: normal;
}
.dash-meal-name.empty-cook {
  color: var(--text-3);
  font-style: italic;
  font-weight: 500;
}
.dash-meal-name.empty-cook .dash-slot-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  background: #E53935;
  border-radius: 50%;
  margin-left: 4px;
  vertical-align: middle;
  box-shadow: 0 0 4px rgba(229,57,53,0.6);
}
.dash-meal-empty {
  font-size: 12px;
  color: var(--text-3);
  font-style: italic;
}
.dash-meal-sub {
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
  margin-top: 2px;
  line-height: 1.3;
}
.dash-meal-row {
  cursor: pointer;
  padding: 4px 0;
  margin: 0;
  position: relative;
}
/* Hover highlight is tight around the meal name/label, not the full row */
.dash-meal-row .dash-meal-name,
.dash-meal-row .dash-meal-empty,
.dash-meal-row .dash-meal-label {
  transition: background 0.1s, color 0.1s;
  border-radius: 5px;
  display: inline-block;
  padding: 1px 4px;
  margin-left: -4px;
}
.dash-meal-row:hover .dash-meal-name,
.dash-meal-row:hover .dash-meal-empty { background: rgba(30,94,255,0.08); }
.dash-meal-name, .dash-meal-empty { cursor: pointer; }

/* Blue edit dot on dashboard meal rows */
.dash-edit-dot {
  position: absolute;
  top: 4px;
  right: 2px;
  bottom: auto;
  width: 6px;
  height: 6px;
  background: rgba(30, 94, 255, 0.22);
}

/* Weekend days — subtle de-emphasis */
.dash-day-card.weekend {
  background: #FAFBFC;
  border-style: dashed;
  opacity: 0.92;
}
.dash-day-card.weekend .dash-day-name { color: var(--text-2); }

.dash-footer {
  text-align: center;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.dash-edit-link {
  font-size: 13px;
  color: var(--text-3);
  text-decoration: none;
  font-weight: 600;
}
.dash-edit-link:hover { color: var(--accent); }

/* Empty state */
.dash-empty {
  text-align: center;
  padding: 60px 20px;
  background: var(--surface, #fff);
  border: 2px dashed var(--border);
  border-radius: 14px;
}
.dash-empty-icon { font-size: 42px; margin-bottom: 12px; }
.dash-empty-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 6px;
}
.dash-empty-sub {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 22px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.5;
}

/* Responsive — step down column count as the viewport narrows */
@media (max-width: 1180px) {
  .dash-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 820px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .dash-header { flex-direction: column; }
  .dash-grocery-btn { width: 100%; }
  .dash-grid { grid-template-columns: 1fr; gap: 10px; }
  .dash-day-card { min-height: auto; }
  .dash-day-card.today { order: -1; }
}

/* ══════════════════════════════════════════════
   MEAL PLAN — Mobile day-stack layout
   (mirrors Dashboard's phone layout)
   ══════════════════════════════════════════════ */
.meal-plan-mobile { display: none; }

@media (max-width: 600px) {
  .meal-plan-wrap { display: none; }
  .meal-plan-mobile { display: block; }
}

.mpm-day-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  margin-bottom: 14px;
}
.mpm-day-header {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.mpm-day-name {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-1);
}
.mpm-commitments {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}
.mpm-commitment {
  display: flex;
  gap: 6px;
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.35;
}
.mpm-com-icon { flex-shrink: 0; }
.mpm-com-text { flex: 1; }

.mpm-meals {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mpm-meal-row {
  padding: 10px 12px;
  border-radius: 8px;
}
.mpm-meal-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.mpm-meal-cell {
  position: relative;
  background: var(--surface, #fff);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 34px 10px 12px;
  cursor: pointer;
  min-height: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.mpm-meal-cell.empty {
  background: transparent;
  border: 1px dashed var(--border-dark);
  padding: 12px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  font-weight: 600;
  min-height: auto;
}
.mpm-meal-cell .cell-remove {
  position: absolute;
  top: 6px;
  right: 6px;
}
.mpm-meal-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-1);
  line-height: 1.25;
}
.mpm-meal-servings {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 600;
}
.mpm-meal-empty-label { pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   PLAN-THIS-WEEK FLOW  (Modals, Dashboard slots, FAB, Slot Editor)
   ═══════════════════════════════════════════════════════════════ */

/* ── Dashboard editable slot grid ─────────────────────────────── */
.dash-slotgrid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.dash-day-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  align-items: center;
}
.dash-day-row.weekend {
  background: #FAFBFC;
  border-top: 1px dashed var(--border);
}
.dash-day-row.today {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(13,24,41,0.06);
}
.dash-day-col .dash-day-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-1);
}
.dash-day-col .dash-day-date {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  font-weight: 600;
}
.dash-day-row.weekend .dash-day-name { color: var(--text-2); }
.dash-meals-col {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.dash-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #F8F9FC;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  min-height: 52px;
  position: relative;
}
.dash-slot:hover {
  border-color: var(--accent);
  background: #FFFFFF;
  transform: translateY(-1px);
}
.dash-slot-meal {
  font-size: 16px;
  flex-shrink: 0;
}
.dash-slot-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.dash-slot-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-slot.cook.filled .dash-slot-name { color: var(--text-1); }
.dash-slot.cook.empty .dash-slot-name { color: var(--text-2); font-weight: 600; }
.dash-slot.skipped .dash-slot-name {
  color: var(--text-3);
  font-weight: 500;
  font-style: italic;
}
.dash-slot-note {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-slot-caret {
  font-size: 11px;
  color: var(--text-3);
  flex-shrink: 0;
  opacity: 0.6;
}
.dash-slot.cook.filled {
  background: #F0F7F1;
  border-color: #CDE3D1;
}
.dash-slot-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #E53935;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
  box-shadow: 0 0 0 2px rgba(229,57,53,0.12);
}
.dash-summary {
  margin-top: 14px;
  padding: 10px 14px;
  text-align: center;
  font-size: 13px;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

@media (max-width: 700px) {
  .dash-day-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
  }
  .dash-day-col {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    padding-bottom: 6px;
  }
  .dash-meals-col { grid-template-columns: 1fr; gap: 6px; }
  .dash-slot { min-height: 48px; padding: 9px 11px; }
}

/* ── Plan Modal (shared styles for Modal 1 + Modal 2) ────────── */
.plan-modal-overlay { z-index: 250; }
.plan-modal { max-width: 520px; width: 100%; }
.plan-modal-step {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  background: #F0F2F6;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 8px;
  vertical-align: middle;
}
.plan-modal-step-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}
.plan-modal-intro {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.45;
  margin-bottom: 14px;
}

/* Modal 1 grid */
.plan-grid-wrap { overflow-x: auto; }
.plan-grid {
  display: grid;
  grid-template-columns: 52px repeat(3, 1fr);
  gap: 6px;
  min-width: 280px;
}
.plan-grid-corner {}
.plan-col-head {
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  padding: 6px 4px;
  border-radius: 6px;
  background: #F0F2F6;
  color: var(--text-2);
  transition: all 0.15s;
}
.plan-col-head.active {
  background: #DFF0E2;
  color: #2E6B36;
}
.plan-row-head {
  font-size: 12px;
  font-weight: 800;
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0 4px;
}
.plan-row-head.weekend { color: var(--text-3); font-weight: 600; }
.plan-row-obligation {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70px;
  line-height: 1.2;
  margin-top: 1px;
}
.plan-cell {
  background: #F4F5F8;
  border: 1.5px solid #E2E5EC;
  border-radius: 8px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s, border-color 0.12s;
  font-family: inherit;
  padding: 0;
}
.plan-cell:active { transform: scale(0.95); }
.plan-cell.weekend { background: #FAFBFC; border-style: dashed; }
.plan-cell.on {
  background: #3FA84F;
  border-color: #2E6B36;
  transform: scale(1.02);
}
.plan-cell-check {
  color: #FFF;
  font-size: 16px;
  font-weight: 900;
}
.plan-counter {
  margin-top: 14px;
  padding: 10px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-2);
  background: #F8F9FC;
  border-radius: 8px;
}
.plan-quick-row {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

/* Modal 2 notes list */
.plan-notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.plan-note-row {
  padding: 10px 12px;
  background: #F8F9FC;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.plan-note-row.skipped { background: #FCFCFD; }
.plan-note-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}
.plan-note-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  background: #3FA84F;
  color: #FFF;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 900;
  margin-right: 4px;
}
.plan-note-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  background: #FFF;
}
/* Servings block inside Assign Meal modal — prominent */
.a-servings-block {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.a-servings-label {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 8px;
}
.a-servings-block input[type="number"]#a_servings {
  width: 90px;
  font-size: 16px;
  font-weight: 700;
  padding: 8px 10px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: #FFF;
}
.a-servings-hint {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-2);
}

/* Inline dash for skipped slots in Plan Modal 2 */
.plan-note-dash {
  flex: 1;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.6;
}
.plan-note-row.skipped .plan-note-label { opacity: 0.55; }

/* ── FAB ─────────────────────────────────────────────────────── */
.plan-fab {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  z-index: 100;
  background: var(--accent, #0D1829);
  color: #FFF;
  border: none;
  border-radius: 14px;
  padding: 12px 20px;
  box-shadow: 0 8px 24px rgba(13,24,41,0.25);
  cursor: pointer;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.plan-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(13,24,41,0.3);
}
.plan-fab .fab-label {
  font-size: 14px;
  font-weight: 800;
}
.plan-fab .fab-sub {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.8;
}
@media (max-width: 600px) {
  .plan-fab {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    padding: 10px 16px;
  }
  .plan-fab .fab-label { font-size: 13px; }
}

/* ── Slot Editor popover ─────────────────────────────────────── */
.slot-editor-overlay { z-index: 220; }
.slot-editor-modal { max-width: 420px; width: 100%; }
.slot-editor-title {
  font-size: 15px;
  font-weight: 800;
  color: var(--text-1);
  margin-bottom: 14px;
}
.slot-editor-section {
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.slot-editor-section:last-child { border-bottom: none; padding-bottom: 0; }
.slot-editor-section-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.slot-editor-recipes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.slot-editor-recipe {
  background: #F4F5F8;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-1);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s;
}
.slot-editor-recipe:hover { border-color: var(--accent); background: #FFF; }
.slot-editor-recipe.selected {
  background: #3FA84F;
  border-color: #2E6B36;
  color: #FFF;
}
.slot-editor-recipe.staged,
.slot-editor-recipes.experimental .slot-editor-recipe.staged {
  background: #E8F0FF;
  border-color: var(--accent);
  color: #1a1a1a;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(30,94,255,0.18);
}

/* Servings panel — appears inside slot editor after picking */
.slot-servings-panel {
  margin-top: 14px;
  padding: 14px;
  background: var(--surface-2);
  border: 2px solid var(--accent);
  border-radius: 12px;
  animation: slotServingsIn 0.18s ease-out;
}
@keyframes slotServingsIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.slot-servings-title {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.slot-servings-title strong { color: var(--text-1); font-weight: 800; }
.slot-servings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.slot-servings-row label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-1);
  margin-right: 4px;
}
.slot-servings-step {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #FFF;
  font-size: 18px;
  font-weight: 800;
  color: var(--text-1);
  cursor: pointer;
  line-height: 1;
}
.slot-servings-step:hover { border-color: var(--accent); color: var(--accent); }
#slotEditServings {
  width: 64px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  padding: 6px 8px;
  border: 2px solid var(--accent);
  border-radius: 8px;
  background: #FFF;
}
.slot-servings-hint {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.slot-servings-save {
  width: 100%;
}
/* Footer row: Mark as skipped + Clear this slot side by side */
.slot-editor-footer {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
}
.slot-editor-footer .btn { flex: 1 1 0; }
.slot-editor-empty {
  font-size: 12px;
  color: var(--text-3);
  padding: 8px 0;
}
.slot-editor-empty a { color: var(--accent); text-decoration: none; font-weight: 700; }

/* Subtle subheader inside slot editor (e.g. "or try an experimental meal") */
.slot-editor-sub-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: lowercase;
  letter-spacing: 0.3px;
  margin: 12px 0 6px 0;
  padding-top: 8px;
  border-top: 1px dashed var(--border-2, #E5E7EB);
}
.slot-editor-sub-label.slot-editor-sub-label-first {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}
.slot-editor-recipes.experimental .slot-editor-recipe {
  background: #FFFBEB;
  border-color: #F3D88B;
}
/* Quick free-text entry inside slot editor (e.g. "PB&J sandwich") */
.slot-editor-custom {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  margin-bottom: 4px;
}
.slot-editor-custom input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.slot-editor-custom input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,94,255,0.12);
}
.slot-editor-custom .btn {
  flex-shrink: 0;
}

/* Custom-text meal on the dashboard (no recipe card backing it) */
.dash-meal-name.custom {
  color: var(--text);
  font-weight: 600;
}

/* Escape hatch link inside slot editor */
.slot-editor-escape {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.slot-editor-escape a {
  font-size: 12px;
  color: var(--text-3);
  text-decoration: none;
}
.slot-editor-escape a:hover { color: var(--accent); }

/* Quick-pick buttons for leftovers / eating out */
.slot-editor-quick {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.slot-editor-quick-btn {
  flex: 1 1 140px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #F7F9FC;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
}
.slot-editor-quick-btn:hover {
  background: #EEF3FA;
  border-color: var(--accent);
}
.slot-editor-quick-btn.active {
  background: #E8F0FF;
  border-color: var(--accent);
  color: #1a1a1a;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(30,94,255,0.18);
}

/* Skip detail panel — reveals after tapping Leftovers / Eating out */
.slot-skip-panel {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.slot-skip-panel input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.slot-skip-panel input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(30,94,255,0.12);
}
.slot-skip-panel .btn {
  flex-shrink: 0;
}

/* Plan Modal 2: day-grouped note rows */
.plan-days-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}
.plan-day-group {
  border: 1px solid var(--border-2, #E5E7EB);
  border-radius: 10px;
  padding: 10px 12px;
  background: #FDFDFD;
}
.plan-day-group.weekend {
  background: #FAFBFC;
  border-style: dashed;
}
.plan-day-group.skipped {
  background: #F8F8F8;
  opacity: 0.9;
}
.plan-day-head {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.plan-day-meals {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-day-group .plan-note-row {
  background: transparent;
  border: 0;
  padding: 4px 0;
}

/* Dashboard slot hover hint */
.dash-slot.cook.filled[title] { cursor: help; }
.dash-slot.cook.filled[title]:hover { background: #EEF7EF; }
