/* ============================================================
   INDIAN MEAL PLANNER — Editorial cookbook redesign
   Type:    Instrument Serif (display) + IBM Plex Sans (body)
   Palette: warm cream + terracotta + curry-leaf green + turmeric
   ============================================================ */

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

:root {
  /* Brand */
  --terra:        #b85a2c;
  --terra-deep:   #8e3f1d;
  --terra-tint:   #fdeee4;
  --leaf:         #4a6d3a;
  --leaf-deep:    #2f4924;
  --leaf-tint:    #ecf1e5;
  --turmeric:     #c98a14;
  --turmeric-tint:#fbf0d4;
  --rose:         #b14a4a;
  --rose-tint:    #f8e3e0;

  /* Surfaces */
  --bg-page:      #f7f1e6;
  --bg-card:      #fffaf2;
  --bg-subtle:    #f0e8d8;
  --bg-deep:      #ebe1cc;
  --border:       #e3d9c4;
  --border-mid:   #c9bda2;
  --rule:         #d8cdb4;

  /* Ink */
  --ink:          #1f1813;
  --ink-mid:      #564a3e;
  --ink-muted:    #8b7e6d;
  --ink-faint:    #c2b69c;

  /* Compat (alias to old vars so app.js classes still resolve) */
  --green:        var(--leaf);
  --green-light:  var(--leaf-tint);
  --green-mid:    #7a9268;
  --green-dark:   var(--leaf-deep);
  --green-subtle: var(--leaf-tint);
  --blue:         #466a8a;
  --blue-light:   #e1ebf2;
  --amber:        var(--turmeric);
  --amber-light:  var(--turmeric-tint);
  --red:          var(--rose);
  --red-light:    var(--rose-tint);
  --veg-color:    var(--leaf);
  --nv-color:     var(--rose);
  --text:         var(--ink);
  --text-mid:     var(--ink-mid);
  --text-muted:   var(--ink-muted);
  --text-faint:   var(--ink-faint);

  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    14px;
  --radius-xl:    20px;
  --shadow-sm:    0 1px 0 rgba(50,30,10,.04), 0 1px 2px rgba(50,30,10,.04);
  --shadow-card:  0 1px 0 rgba(50,30,10,.04), 0 8px 24px -12px rgba(50,30,10,.18);
  --shadow-modal: 0 24px 70px rgba(20,10,0,.22), 0 6px 18px rgba(20,10,0,.12);

  --font-serif:   'Instrument Serif', 'Cormorant Garamond', Georgia, serif;
  --font-sans:    'IBM Plex Sans', system-ui, sans-serif;
  --font-mono:    'IBM Plex Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
  --terra:        #e08550;
  --terra-deep:   #f0a87a;
  --terra-tint:   #3a1f12;
  --leaf:         #8aab74;
  --leaf-deep:    #b0cf99;
  --leaf-tint:    #1f2b18;
  --turmeric:     #e3b143;
  --turmeric-tint:#382a0f;
  --rose:         #d97373;
  --rose-tint:    #38191a;

  --bg-page:      #14110d;
  --bg-card:      #1d1a14;
  --bg-subtle:    #25211a;
  --bg-deep:      #2e2920;
  --border:       #312c23;
  --border-mid:   #4a4234;
  --rule:         #2a261e;

  --ink:          #f4ecdc;
  --ink-mid:      #c8bba3;
  --ink-muted:    #8b7e6a;
  --ink-faint:    #5a5142;

  --green-dark:   var(--leaf-deep);
  --green-mid:    #6a8455;
  --shadow-sm:    0 1px 0 rgba(0,0,0,.5);
  --shadow-card:  0 1px 0 rgba(0,0,0,.4), 0 12px 36px -16px rgba(0,0,0,.6);
  --shadow-modal: 0 24px 70px rgba(0,0,0,.7), 0 6px 18px rgba(0,0,0,.5);
}

html, body { background: var(--bg-page); }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg-page);
  min-height: 100vh;
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Subtle paper texture via radial noise on light mode */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(184,90,44,.06), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(74,109,58,.05), transparent 60%);
}
[data-theme="dark"] body::before {
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(224,133,80,.07), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(138,171,116,.05), transparent 60%);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.5rem 5rem;
}

/* ── HEADER ──────────────────────────────────────────────── */
.hdr {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 2.25rem 0 1.5rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}
.hdr-brand { display: flex; align-items: center; gap: 16px; }
.hdr-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  font-size: 30px;
  line-height: 1;
  background: var(--bg-card);
  border: 1px solid var(--terra);
  border-radius: 50%;
  box-shadow: inset 0 0 0 3px var(--bg-card), inset 0 0 0 3.5px rgba(184,90,44,.15);
  /* tiny tilt makes the plate look intentional, not centered-emoji-in-a-circle */
  position: relative;
}
.hdr-mark::before {
  /* a thin dashed inner ring like a plate well */
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  border: .5px dashed var(--terra);
  opacity: .35;
  pointer-events: none;
}

/* Keep old class as alias if html still uses it */
.hdr-logo { display: none; }
.hdr h1 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 38px;
  line-height: 1;
  letter-spacing: -.015em;
  color: var(--ink);
  margin: 0 0 4px;
  font-style: italic;
}
.hdr h1 em {
  font-style: normal;
}
.hdr p {
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 400;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.hdr p .dot {
  display: inline-block;
  width: 3px; height: 3px;
  background: var(--terra);
  border-radius: 50%;
  margin: 0 8px 2px;
  vertical-align: middle;
}

.hdr-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.diet-select {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 32px 8px 14px;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--ink-mid);
  cursor: pointer;
  flex-shrink: 0;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238b7e6d' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
[data-theme="dark"] .diet-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23c8bba3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.theme-toggle, .help-btn {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  background: var(--bg-card);
  cursor: pointer;
  color: var(--ink-mid);
  font-size: 14px;
  transition: all .15s;
  flex-shrink: 0;
}
.help-btn { font-family: var(--font-serif); font-style: italic; font-size: 17px; }
.theme-toggle:hover, .help-btn:hover {
  background: var(--terra-tint);
  color: var(--terra-deep);
  border-color: var(--terra);
}
[data-theme="dark"] .theme-toggle:hover,
[data-theme="dark"] .help-btn:hover {
  background: var(--terra-tint);
  color: var(--terra-deep);
}

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--rule);
}
.tab {
  font-family: var(--font-sans);
  padding: 12px 0;
  margin-right: 28px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: .02em;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ink-muted);
  position: relative;
  white-space: nowrap;
}
.tab::after {
  content: '';
  position: absolute;
  bottom: -1px; left: 0; right: 0;
  height: 2px;
  background: var(--terra);
  border-radius: 2px 2px 0 0;
  opacity: 0;
  transition: opacity .15s;
}
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { opacity: 1; }
.tab:hover:not(.active) { color: var(--ink-mid); }

.section { display: none; }
.section.active { display: block; }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
  font-family: var(--font-sans);
  padding: 9px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink-mid);
  transition: all .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  white-space: nowrap;
  letter-spacing: .005em;
}
.btn:hover { background: var(--bg-subtle); color: var(--ink); border-color: var(--ink-faint); }
.btn:active { transform: translateY(1px); }

.btn-green {
  background: var(--terra);
  color: #fffaf2;
  border-color: var(--terra-deep);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(0,0,0,.06), 0 2px 8px -2px rgba(184,90,44,.4);
}
.btn-green:hover { background: var(--terra-deep); color: #fffaf2; border-color: var(--terra-deep); }
[data-theme="dark"] .btn-green { color: #1c1108; }
[data-theme="dark"] .btn-green:hover { background: var(--terra-deep); color: #1c1108; }

.btn-export, .btn-shop {
  background: transparent;
  border-color: var(--border-mid);
  color: var(--ink-mid);
}
.btn-export:hover, .btn-shop:hover { background: var(--bg-subtle); }

.btn-share {
  background: var(--leaf);
  color: #fbfaf6;
  border-color: var(--leaf-deep);
  font-weight: 600;
}
.btn-share:hover { background: var(--leaf-deep); color: #fbfaf6; border-color: var(--leaf-deep); }
[data-theme="dark"] .btn-share { color: #0d150a; }

/* ── PLANNER ACTIONS ─────────────────────────────────────── */
.planner-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.spacer { flex: 1; }

/* ── DAY TABS (mobile) ───────────────────────────────────── */
.day-tabs {
  display: none;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex-shrink: 0;
  padding: 8px 18px;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--ink-mid);
  transition: all .15s;
}
.day-tab.active {
  background: var(--ink);
  color: var(--bg-card);
  border-color: var(--ink);
}
[data-theme="dark"] .day-tab.active { background: var(--ink); color: var(--bg-page); }

/* ── WEEK GRID ────────────────────────────────────────────── */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  margin-bottom: 2rem;
}
.day-col {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 12px 10px 10px;
  border: 1px solid var(--border);
  position: relative;
}
.day-col.hidden-mobile { display: block; }

.day-label {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
  text-align: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  letter-spacing: 0;
  text-transform: none;
}

/* ── SLOT ─────────────────────────────────────────────────── */
.slot {
  border-radius: var(--radius-md);
  padding: 8px 9px;
  margin-bottom: 6px;
  min-height: 64px;
  cursor: pointer;
  transition: all .15s;
  position: relative;
  background: transparent;
  border: 1px dashed var(--border-mid);
}
.slot:hover {
  border-color: var(--terra);
  background: var(--terra-tint);
  border-style: dashed;
}
.slot:last-child { margin-bottom: 0; }
.slot.filled {
  border-style: solid;
  border-color: var(--border);
  background: var(--bg-subtle);
}
.slot.filled:hover { border-color: var(--terra); background: var(--terra-tint); }

.slot-label {
  font-family: var(--font-sans);
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.slot.filled .slot-label { color: var(--ink-muted); }
.slot:not(.filled) .slot-label { color: var(--ink-faint); }

.slot-meal  {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.32;
  letter-spacing: -.005em;
}
.slot-kcal  {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.slot-empty { font-size: 10px; color: var(--ink-faint); padding-top: 3px; }

.rmv-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-faint);
  font-size: 11px;
  padding: 1px 4px;
  line-height: 1;
  border-radius: 4px;
}
.rmv-btn:hover { color: var(--rose); background: var(--rose-tint); }

/* ── STAT GRID ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 2rem;
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 16px 16px;
  text-align: left;
  position: relative;
  overflow: hidden;
}
.stat::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 28px; height: 2px;
  background: var(--terra);
}
.stat-n {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 36px;
  font-weight: 400;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1;
}
.stat-n--green, .stat-n--blue, .stat-n--amber, .stat-n--text { color: var(--ink); }
.stat-l {
  font-size: 10px;
  color: var(--ink-muted);
  margin-top: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
}

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20,15,8,.45);
  z-index: 100;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--bg-card);
  width: 100%;
  max-width: 540px;
  max-height: 86vh;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-modal);
  border: 1px solid var(--border);
  animation: slideUp .25s cubic-bezier(.25,.8,.25,1);
}
.modal::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  background: var(--border-mid);
  border-radius: 2px;
  margin: 10px auto 0;
  flex-shrink: 0;
}
@keyframes slideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
@media (min-width: 560px) {
  .modal-overlay { align-items: center; padding: 1.5rem; }
  .modal {
    border-radius: var(--radius-xl);
    max-height: 78vh;
    animation: fadeScale .2s cubic-bezier(.25,.8,.25,1);
  }
  .modal::before { display: none; }
  @keyframes fadeScale {
    from { transform: scale(.96); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 1rem 1.5rem .875rem;
  border-bottom: 1px solid var(--rule);
  flex-shrink: 0;
}
.modal-title {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 2px;
  color: var(--ink);
  letter-spacing: -.01em;
}
.modal-sub   {
  font-size: 12px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.modal-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border-mid);
  border-radius: 50%;
  font-size: 13px;
  color: var(--ink-mid);
  cursor: pointer;
  transition: all .15s;
  flex-shrink: 0;
  margin-top: 2px;
}
.modal-close:hover { background: var(--rose-tint); color: var(--rose); border-color: var(--rose); }

.modal-body {
  overflow-y: auto;
  padding: .75rem 1rem 1.5rem;
  -webkit-overflow-scrolling: touch;
}

.modal-meal-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 10px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background .12s;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--rule);
}
.modal-meal-row:last-child { border-bottom: none; }
.modal-meal-row:hover { background: var(--terra-tint); }

.modal-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-veg { background: var(--leaf); box-shadow: 0 0 0 2px var(--leaf-tint); }
.dot-nv  { background: var(--rose); box-shadow: 0 0 0 2px var(--rose-tint); }

/* Veg / non-veg dot in slot kcal row — FSSAI-style square mark for
   consistency with browse tiles. */
.type-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 11px; height: 11px;
  border: 1.4px solid;
  border-radius: 2px;
  padding: 0;
  flex-shrink: 0;
  vertical-align: middle;
  margin-right: 3px;
  background: var(--bg-card);
}
.type-dot::before {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}
.type-dot--veg { border-color: #2f7a2f; }
.type-dot--veg::before { background: #2f7a2f; }
.type-dot--nv  { border-color: #b21f1f; }
.type-dot--nv::before  { background: #b21f1f; }

[data-theme="dark"] .type-dot { background: var(--bg-card); }

.modal-meal-info { flex: 1; min-width: 0; }
.modal-meal-name {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.35;
  color: var(--ink);
}
.modal-meal-meta {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.modal-kcal {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--terra-deep);
  background: var(--terra-tint);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
[data-theme="dark"] .modal-kcal { color: var(--terra-deep); background: var(--terra-tint); }

.modal-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 16px;
}

/* ── BROWSE ───────────────────────────────────────────────── */
.mode-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.mode-row select {
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 30px 8px 14px;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--ink-mid);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238b7e6d' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}
[data-theme="dark"] .mode-row select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23c8bba3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.browse-search {
  flex: 1;
  min-width: 200px;
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border-mid);
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--ink);
  outline: none;
  transition: border-color .15s, background .15s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b7e6d' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 13px center;
}
[data-theme="dark"] .browse-search {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23c8bba3' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
}
.browse-search:focus {
  border-color: var(--terra);
  box-shadow: 0 0 0 3px var(--terra-tint);
}
.browse-search::placeholder { color: var(--ink-faint); }

.count-label {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  padding: 4px 10px;
  font-weight: 500;
  white-space: nowrap;
}

/* Filters — collapsible scrollable row */
.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  max-height: 80px;
  overflow: hidden;
  transition: max-height .25s ease;
  position: relative;
  padding-bottom: 2px;
}
.filters.expanded { max-height: 400px; }
.filters::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 28px;
  background: linear-gradient(to bottom, transparent, var(--bg-page));
  pointer-events: none;
  opacity: 1;
  transition: opacity .2s;
}
.filters.expanded::after { opacity: 0; }

.chip {
  font-family: var(--font-sans);
  padding: 5px 12px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--ink-mid);
  transition: all .15s;
  user-select: none;
  white-space: nowrap;
  letter-spacing: 0;
  text-transform: capitalize;
}
.chip:hover { border-color: var(--terra); color: var(--terra-deep); background: var(--terra-tint); }
.chip.on {
  background: var(--ink);
  color: var(--bg-card);
  border-color: var(--ink);
}
[data-theme="dark"] .chip.on { background: var(--ink); color: var(--bg-page); }

.chip--custom { border-color: var(--turmeric); color: var(--turmeric); }
.chip--custom.on { background: var(--turmeric); color: var(--bg-page); border-color: var(--turmeric); }

.filters-toggle {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 500;
  background: transparent;
  border: 1px dashed var(--border-mid);
  color: var(--ink-mid);
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: .03em;
  white-space: nowrap;
}
.filters-toggle:hover { color: var(--terra-deep); border-color: var(--terra); background: var(--terra-tint); }

/* ── MEAL CARDS ──────────────────────────────────────────── */
.meal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 2rem;
}
.meal-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all .2s;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.meal-card:hover {
  border-color: var(--terra);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
/* Editorial header tile — the meal name + meta lives here, not a photo placeholder */
.meal-thumb {
  min-height: 200px;
  position: relative;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  color: rgba(255,250,242,.96);
  overflow: hidden;
  flex-shrink: 0;
  isolation: isolate;
}
.meal-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 15% 20%, rgba(255,255,255,.14), transparent 45%),
    radial-gradient(circle at 90% 95%, rgba(0,0,0,.18), transparent 55%);
  pointer-events: none;
  z-index: 0;
}
.meal-thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.06) 1px, transparent 1.2px);
  background-size: 14px 14px;
  pointer-events: none;
  z-index: 0;
}
.meal-thumb > * { position: relative; z-index: 1; }

.meal-thumb-top {
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: rgba(255,250,242,.8);
  flex-shrink: 0;
}
.meal-thumb-top .tdot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,250,242,.95);
  display: inline-block;
  flex-shrink: 0;
}
.meal-thumb-top .tdot--nv { background: #f8c8c4; }

/* FSSAI-style veg / non-veg mark — outlined square with center dot.
   Outline & dot are PURE green / red so they read at a glance against
   any tile color. */
.vmark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px; height: 14px;
  border: 1.6px solid #fff;
  background: rgba(255,255,255,.92);
  border-radius: 2px;
  flex-shrink: 0;
  padding: 1.5px;
}
.vmark i {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}
.vmark--veg { border-color: #2f7a2f; }
.vmark--veg i { background: #2f7a2f; }
.vmark--nv  { border-color: #b21f1f; }
.vmark--nv i { background: #b21f1f; }

/* Stats row — protein + fibre — sits just under the title */
.meal-thumb-stats {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: .04em;
  color: rgba(255,250,242,.72);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  flex-wrap: wrap;
  line-height: 1.3;
}
.meal-thumb-stats > span {
  white-space: nowrap;
}
.meal-thumb-stats b {
  font-weight: 600;
  color: rgba(255,250,242,.95);
  font-variant-numeric: tabular-nums;
  margin-right: 3px;
}
.meal-thumb-stats em {
  font-style: normal;
  opacity: .35;
  font-size: 11px;
}

.meal-thumb-title {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -.012em;
  color: rgba(255,250,242,.98);
  margin: 12px 0 16px;
  flex: 1 1 auto;
  word-break: break-word;
  hyphens: auto;
}

.meal-thumb-bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.meal-thumb-kcal {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .04em;
  color: rgba(255,250,242,.95);
  background: rgba(0,0,0,.22);
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.meal-thumb-stamp {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 13px;
  color: rgba(255,250,242,.55);
  letter-spacing: .02em;
  line-height: 1.2;
  flex: 1;
}

/* Deterministic palette per card */
.meal-thumb--c0 { background: linear-gradient(140deg, #c25a2e 0%, #8e3f1d 100%); }
.meal-thumb--c1 { background: linear-gradient(140deg, #4a6d3a 0%, #2f4924 100%); }
.meal-thumb--c2 { background: linear-gradient(140deg, #c98a14 0%, #8e601a 100%); }
.meal-thumb--c3 { background: linear-gradient(140deg, #6b4a8e 0%, #3d2a59 100%); }
.meal-thumb--c4 { background: linear-gradient(140deg, #b14a4a 0%, #7a2e2e 100%); }
.meal-thumb--c5 { background: linear-gradient(140deg, #2a6b6b 0%, #154242 100%); }
.meal-thumb--c6 { background: linear-gradient(140deg, #a85e7a 0%, #6b3a4f 100%); }
.meal-thumb--c7 { background: linear-gradient(140deg, #5c7a3a 0%, #36481f 100%); }

.meal-card-body {
  /* All content lives on the tile. Hide the original body entirely;
     delete button (for custom meals) gets lifted onto the tile by enhance.js. */
  display: none;
}
.meal-delete-btn--on-tile {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  background: rgba(0,0,0,.28);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  width: 24px; height: 24px;
  padding: 0;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: rgba(255,250,242,.85);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, background .15s;
  line-height: 1;
}
.meal-card:hover .meal-delete-btn--on-tile { opacity: 1; }
.meal-delete-btn--on-tile:hover { background: var(--rose); color: #fffaf2; border-color: var(--rose); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.badge-veg { background: var(--leaf-tint); color: var(--leaf-deep); }
.badge-nv  { background: var(--rose-tint); color: var(--rose);     }
.badge-cal {
  background: transparent;
  color: var(--ink-mid);
  border: 1px solid var(--border-mid);
  font-family: var(--font-mono);
  text-transform: none;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  background: transparent;
  color: var(--ink-muted);
  margin: 4px 4px 0 0;
  font-weight: 500;
  border: 1px solid var(--rule);
  text-transform: capitalize;
}

.kcal-bar  { height: 2px; background: var(--rule); border-radius: 2px; margin-top: 12px; }
.kcal-fill { height: 2px; background: var(--terra); border-radius: 2px; }

.no-meals {
  text-align: center;
  padding: 4rem;
  color: var(--ink-muted);
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 18px;
}

/* Custom badge */
.custom-badge {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  background: var(--turmeric-tint);
  color: var(--turmeric);
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-left: 6px;
  vertical-align: middle;
}

/* ── SHOPPING ────────────────────────────────────────────── */
.shopping-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 2rem;
  scroll-margin-top: 1rem;
}
@keyframes panel-flash {
  0%   { box-shadow: 0 0 0 3px var(--terra); }
  100% { box-shadow: none; }
}
.panel-highlight { animation: panel-flash .8s ease-out forwards; }

.shop-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: .75rem;
}
.shop-title {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
}
.shop-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
}

.shop-search-input {
  display: block;
  width: 100%;
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  color: var(--ink);
  margin-bottom: 1.25rem;
  outline: none;
}
.shop-search-input:focus { border-color: var(--terra); background: var(--bg-card); }

.shop-note {
  font-size: 12px;
  color: var(--ink-mid);
  margin-bottom: 1.25rem;
  padding: 10px 14px;
  background: var(--turmeric-tint);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--turmeric);
  line-height: 1.55;
}

.shop-category {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-muted);
  margin: 1.5rem 0 .5rem;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}
.shop-category:first-of-type { margin-top: 0; }

.shop-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
}
.shop-item:last-child { border-bottom: none; }

.shop-ing {
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
  text-transform: capitalize;
}
.shop-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-muted);
  background: var(--bg-subtle);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.shop-btns { display: flex; gap: 6px; flex-shrink: 0; }
.shop-btn {
  display: inline-block;
  padding: 4px 11px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity .15s;
  white-space: nowrap;
  font-family: var(--font-sans);
}
.shop-btn:hover { opacity: .85; }
.shop-btn--amz { background: var(--turmeric); color: #1f1813; }
.shop-btn--bb  { background: var(--leaf-tint); color: var(--leaf-deep); border: 1px solid var(--leaf); }

@media (max-width: 640px) {
  .shop-item { flex-wrap: wrap; gap: 6px; }
}

/* ── TOAST ───────────────────────────────────────────────── */
#toast, .toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--bg-page);
  padding: 11px 22px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 200;
  white-space: nowrap;
  box-shadow: var(--shadow-modal);
}
#toast.show, .toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── NUTRITION ───────────────────────────────────────────── */
.section-title {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 22px;
  font-weight: 400;
  margin: 0 0 1rem;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -.01em;
}
.section-title + .stat-grid { margin-bottom: 2.5rem; }

.prog-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding: 6px 0;
}
.prog-label {
  width: 180px;
  font-size: 13px;
  color: var(--ink);
  flex-shrink: 0;
  font-weight: 500;
}
.prog-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-deep);
  border-radius: 4px;
  overflow: hidden;
}
.prog-fill { height: 6px; border-radius: 4px; transition: width .45s cubic-bezier(.4,0,.2,1); }
.prog-fill--blue  { background: var(--terra); }
.prog-fill--amber { background: var(--turmeric); }
.prog-fill--red   { background: var(--rose); }
.prog-fill--green { background: var(--leaf); }
.prog-val  {
  width: 90px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted);
  flex-shrink: 0;
}

.full-select {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  padding: 11px 36px 11px 16px;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  margin-bottom: 1rem;
  width: 100%;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b7e6d' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
[data-theme="dark"] .full-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23c8bba3' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.nut-detail {
  background: var(--bg-card);
  padding: 1.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.nut-name {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 24px;
  font-weight: 400;
  margin-bottom: 6px;
  color: var(--ink);
}
.nut-sub  {
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 1.25rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.notes-box {
  font-size: 13px;
  color: var(--ink-mid);
  background: var(--turmeric-tint);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  line-height: 1.65;
  border-left: 3px solid var(--turmeric);
  font-style: italic;
}
.dgi-note {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.75rem;
  font-size: 13px;
  color: var(--ink-mid);
  line-height: 1.95;
  border: 1px solid var(--border);
  margin-top: 2rem;
  position: relative;
}
.dgi-note::before {
  content: '✦';
  position: absolute;
  top: 12px; right: 18px;
  color: var(--terra);
  font-size: 14px;
}
.dgi-note strong {
  font-family: var(--font-serif);
  font-style: normal;
  font-weight: 400;
  color: var(--ink);
  font-size: 18px;
  display: block;
  margin-bottom: 8px;
  letter-spacing: -.01em;
}

/* Meal detail */
.detail-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 1.25rem;
  align-items: center;
}
.detail-section-title {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 1.25rem 0 .5rem;
}
.detail-nutrition {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(74px, 1fr));
  gap: 10px;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  padding: 14px;
}
.detail-nut { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.detail-nut-val {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 22px;
  font-weight: 400;
  color: var(--ink);
}
.detail-nut-lbl {
  font-size: 10px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.detail-text { font-size: 13.5px; color: var(--ink-mid); line-height: 1.65; }
.detail-notes {
  background: var(--turmeric-tint);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border-left: 3px solid var(--turmeric);
  font-style: italic;
  color: var(--ink-mid);
}
.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-actions {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.order-btns {
  display: flex;
  gap: 8px;
}
.btn-order {
  flex: 1;
  justify-content: center;
  font-weight: 600;
  text-decoration: none;
}
.btn-order--zomato {
  background: #e23744;
  color: #fff;
  border-color: #c22030;
}
.btn-order--zomato:hover { background: #c22030; color: #fff; border-color: #c22030; }
.btn-order--swiggy {
  background: #fc8019;
  color: #fff;
  border-color: #e06d0d;
}
.btn-order--swiggy:hover { background: #e06d0d; color: #fff; border-color: #e06d0d; }

/* ── WELCOME MODAL ────────────────────────────────────────── */
.welcome-modal { max-width: 500px; }
.welcome-body  { padding-bottom: 1.5rem; }
.welcome-hero {
  text-align: center;
  padding: 1.25rem 0 1.5rem;
}
.welcome-hero h2 {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 30px;
  font-weight: 400;
  color: var(--ink);
  letter-spacing: -.015em;
  margin-bottom: 8px;
  line-height: 1.1;
}
.welcome-hero h2 em {
  font-style: italic;
  font-weight: 400;
}
.welcome-hero p {
  font-size: 13px;
  color: var(--ink-mid);
  max-width: 360px;
  margin: 0 auto;
  line-height: 1.55;
}
.welcome-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.welcome-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-md);
}
.welcome-num {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 26px;
  font-weight: 400;
  color: var(--terra);
  line-height: 1;
  flex-shrink: 0;
  width: 30px;
  text-align: center;
}
.welcome-icon { font-size: 18px; line-height: 1; flex-shrink: 0; margin-top: 2px; display: none; }
.welcome-step-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 3px;
}
.welcome-step-desc {
  font-size: 12.5px;
  color: var(--ink-mid);
  line-height: 1.55;
}
.welcome-step--warn {
  background: var(--turmeric-tint);
  border-color: var(--turmeric);
}
.welcome-step--warn .welcome-num { color: var(--turmeric); }
.welcome-cta {
  width: 100%;
  padding: 13px;
  font-size: 14px;
  justify-content: center;
}

/* ── CUSTOM FORM ──────────────────────────────────────────── */
.custom-form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 1.5rem;
  scroll-margin-top: 1rem;
}
.custom-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}
.custom-form-header h3 {
  font-family: var(--font-serif);
  font-style: normal;
  font-size: 24px;
  font-weight: 400;
  margin: 0;
  color: var(--ink);
}
.form-section { margin-bottom: 1.5rem; }
.form-section-title {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--ink-muted);
  margin-bottom: 1rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--rule);
}
.form-section-title.collapsible {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.form-section-title.collapsible::after {
  content: '▾';
  font-size: 10px;
  color: var(--ink-muted);
  transition: transform .2s;
}
.form-section-title.open::after { transform: rotate(180deg); }
.form-section-content { display: none; }
.form-section-title.open + .form-section-content { display: block; }

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; }
.form-row .form-group { margin-bottom: 0; }
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}
.form-group input,
.form-group textarea,
.form-group select {
  font-family: var(--font-sans);
  font-size: 13.5px;
  padding: 9px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  color: var(--ink);
  transition: border-color .15s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--terra);
  box-shadow: 0 0 0 3px var(--terra-tint);
}
.form-group textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.form-checkboxes { display: grid; grid-template-columns: 1fr; gap: 8px; }
.form-checkboxes label {
  display: flex; align-items: center; gap: 10px;
  font-weight: 400; cursor: pointer; user-select: none;
  padding: 6px 8px; border-radius: var(--radius-sm);
}
.form-checkboxes label:hover { background: var(--bg-subtle); }
.form-checkboxes input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--terra);
}
.form-actions {
  display: flex; gap: 1rem; justify-content: flex-end;
  padding-top: 1.5rem; border-top: 1px solid var(--rule);
  margin-top: 1.5rem;
}
.form-actions button { min-width: 110px; }

/* ── PRINT ───────────────────────────────────────────────── */
#print-sheet { display: none; }
@media print {
  @page { margin: 14mm 12mm; size: A4; }
  html, body { background: #ffffff !important; }
  body > .container, .modal-overlay, #toast, .toast { display: none !important; }

  #print-sheet {
    display: block;
    font-family: 'IBM Plex Sans', system-ui, sans-serif;
    color: #1f1813;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .print-page { max-width: 100%; }

  /* Header */
  .print-header { margin-bottom: 18px; }
  .print-eyebrow {
    font-size: 9.5px;
    font-weight: 500;
    color: #8b7e6d;
    text-transform: uppercase;
    letter-spacing: .14em;
    margin-bottom: 6px;
  }
  .print-header h1 {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 38px;
    line-height: 1;
    letter-spacing: -.015em;
    color: #1f1813;
    margin: 0 0 12px;
  }
  .print-rule {
    height: 1px;
    background: #d8cdb4;
    margin: 0 0 12px;
    position: relative;
  }
  .print-rule::before {
    content: '';
    position: absolute;
    left: 0; top: -1px;
    width: 60px; height: 3px;
    background: #b85a2c;
  }
  .print-summary {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    margin-top: 8px;
  }
  .print-summary-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .psi-num {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 24px;
    color: #1f1813;
    line-height: 1;
  }
  .psi-lbl {
    font-size: 9px;
    color: #8b7e6d;
    text-transform: uppercase;
    letter-spacing: .1em;
    font-weight: 500;
  }

  /* Days */
  .print-day { margin-bottom: 14px; break-inside: avoid; }
  .print-day-label {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 400;
    font-size: 22px;
    color: #b85a2c;
    border-bottom: .5px solid #c9bda2;
    padding-bottom: 4px;
    margin: 0 0 6px;
    line-height: 1;
  }
  .print-day-meals { display: block; }

  /* Each meal row */
  .print-meal {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    gap: 4px 14px;
    align-items: baseline;
    padding: 7px 0;
    border-bottom: .5px solid #efe8d7;
    font-size: 11.5px;
  }
  .print-meal:last-child { border-bottom: none; }

  .print-slot {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    color: #8b7e6d;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: .12em;
    font-weight: 500;
  }
  .print-meal-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }
  .print-meal-name {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: normal;
    font-weight: 400;
    font-size: 15px;
    color: #1f1813;
    line-height: 1.2;
  }
  .print-meal-region {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-size: 11px;
    color: #8b7e6d;
    letter-spacing: .01em;
  }
  .print-meal-meta {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .pmm-kcal {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-weight: 500;
    font-size: 11px;
    color: #1f1813;
  }
  .pmm-macro {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: 9px;
    color: #8b7e6d;
    letter-spacing: .04em;
  }

  /* FSSAI veg / non-veg mark */
  .pmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 10px;
    height: 10px;
    border: 1.2px solid;
    border-radius: 1.5px;
    background: #fff;
    flex-shrink: 0;
  }
  .pmark i {
    display: block;
    width: 4px;
    height: 4px;
    border-radius: 50%;
  }
  .pmark--veg { border-color: #2f7a2f; }
  .pmark--veg i { background: #2f7a2f; }
  .pmark--nv  { border-color: #b21f1f; }
  .pmark--nv i  { background: #b21f1f; }

  /* Footer */
  .print-footer {
    margin-top: 22px;
    padding-top: 10px;
    border-top: .5px solid #d8cdb4;
    font-size: 9.5px;
    color: #8b7e6d;
    text-align: center;
    display: flex;
    justify-content: center;
    gap: 6px;
    align-items: baseline;
    letter-spacing: .02em;
  }
  .pf-mark {
    color: #b85a2c;
    font-size: 11px;
    margin-right: 2px;
  }
  .pf-spacer { color: #c2b69c; }
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 900px) and (min-width: 641px) {
  .week-grid { gap: 8px; }
  .day-col { padding: 10px 8px 8px; }
  .day-label { font-size: 19px; }
  .slot { padding: 7px 8px; min-height: 60px; }
  .slot-meal { font-size: 11.5px; }
}

@media (max-width: 760px) {
  .container { padding: 0 1rem 4rem; }
  .hdr { padding: 1.5rem 0 1.25rem; }
  .hdr h1 { font-size: 30px; }
  .hdr-right { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .day-tabs { display: flex; }
  .day-col.hidden-mobile { display: none; }
  .day-col.active-mobile { display: block; }
  .week-grid { grid-template-columns: 1fr; }

  .slot { min-height: 68px; padding: 10px 12px; }
  .slot-meal { font-size: 13px; }
  .slot-kcal { font-size: 11px; }
  .day-label { font-size: 20px; text-align: left; padding-left: 4px; }

  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-n { font-size: 30px; }
  .meal-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .meal-thumb { min-height: 170px; padding: 12px 14px; }
  .meal-thumb-title { font-size: 19px; margin: 10px 0 14px; }
  .meal-name { font-size: 16px; }
  .prog-label { width: 120px; font-size: 12px; }

  .planner-actions { gap: 6px; }
  .btn { padding: 8px 13px; font-size: 12.5px; }
  .btn-export { font-size: 12px; padding: 8px 11px; }

  .tab { font-size: 12.5px; margin-right: 20px; }

  .custom-form-panel { padding: 1.25rem; }
  .form-row { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; gap: .75rem; }
  .form-actions button { width: 100%; }
}

@media (max-width: 400px) {
  .meal-grid { grid-template-columns: 1fr; }
  .tab { font-size: 12px; margin-right: 14px; }
  .hdr h1 { font-size: 26px; }
}

/* ── Site footer (studio attribution) ───────────────────────── */
.site-footer {
  margin: 3rem 0 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.02em;
}
.site-footer a {
  color: var(--text-mid);
  text-decoration: none;
  border-bottom: 1px solid var(--border-mid);
  transition: color 0.15s, border-color 0.15s;
}
.site-footer a:hover { color: var(--terra); border-color: var(--terra); }
.site-footer .sf-dot { margin: 0 0.5rem; color: var(--text-faint); }
@media print { .site-footer { display: none; } }
