

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  background: #f6f7f8;
  color: #1f2937;
  font-size: 14px;
}
a { color: inherit; text-decoration: none; }

/* ============ HEADER ============ */
.head {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 12px 24px;
  display: grid;
  grid-template-columns: 220px 1fr auto;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-mark { color: #2563eb; font-size: 12px; }
.searchbox { position: relative; max-width: 460px; width: 100%; margin: 0 auto; }
.search-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: #94a3b8; font-size: 16px;
}
.searchbox input {
  width: 100%; border: 1px solid #e5e7eb; background: #f9fafb;
  border-radius: 8px; padding: 9px 14px 9px 36px;
  font: inherit; font-size: 13px; color: #1f2937;
}
.head-right { display: flex; align-items: center; gap: 8px; }
.head-tab {
  font-size: 13px; padding: 6px 14px; border-radius: 6px;
  color: #4b5563; cursor: pointer; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  transition: background 120ms;
}
.head-tab:hover { background: #f3f4f6; }
.head-tab-active { background: #1f2937; color: #fff; }
.head-tab-active:hover { background: #1f2937; }
.head-tab .badge {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  background: #fff;
  color: #1f2937;
  padding: 1px 6px;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}
.head-tab:not(.head-tab-active) .badge {
  background: #e5e7eb;
  color: #4b5563;
}

/* ============ VIEW: RECIPES (Direction B) ============ */
.view-recipes { display: grid; grid-template-columns: 240px 1fr; min-height: calc(100vh - 60px); }

.sidebar {
  background: #fff;
  border-right: 1px solid #e5e7eb;
  padding: 24px 16px;
}
.sidebar-section { margin-bottom: 28px; }
.sidebar-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #64748b; font-weight: 600; padding: 0 8px; margin-bottom: 8px;
}
.filter-list { list-style: none; padding: 0; margin: 0; }
.filter {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 8px; border-radius: 6px; font-size: 13px; color: #374151;
  cursor: pointer; transition: background 120ms;
}
.filter:hover { background: #f3f4f6; }
.filter span {
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: #94a3b8;
}
.filter-active { background: #eef2ff; color: #1e40af; font-weight: 500; }
.filter-active span { color: #1e40af; }

.main { padding: 20px 24px 40px; }
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 20px;
}
.toolbar-sort { font-size: 13px; display: flex; gap: 8px; align-items: center; }
.toolbar-sort-label { color: #64748b; }
.toolbar-sort-button {
  background: #fff; border: 1px solid #e5e7eb; padding: 5px 12px;
  border-radius: 6px; color: #1f2937; font-weight: 500;
}
.toolbar-active-filters {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
}
.toolbar-active-filters:empty { display: none; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #eef2ff; color: #1e40af;
  font-size: 12px; font-weight: 500;
  padding: 4px 6px 4px 10px; border-radius: 100px;
  cursor: pointer; user-select: none;
}
.filter-chip:hover { background: #e0e7ff; }
.filter-chip-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 100px;
  font-size: 13px; line-height: 1;
  background: rgba(30,64,175,0.15);
}
.filter-chip-clear {
  font-size: 11px; color: #64748b; cursor: pointer;
  padding: 4px 8px; border-radius: 4px;
  text-decoration: underline;
  text-decoration-color: #cbd5e1;
}
.filter-chip-clear:hover { color: #ef4444; text-decoration-color: #ef4444; }

.grid-empty {
  text-align: center;
  padding: 80px 24px;
  color: #64748b;
}
.grid-empty h2 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 20px; margin: 0 0 8px;
  font-weight: 500; color: #0f172a;
}
.grid-empty a { color: #2563eb; text-decoration: underline; }
.filter-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 150ms, transform 150ms, box-shadow 150ms;
  display: flex; flex-direction: column;
  position: relative;
}
.card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15,23,42,0.06);
  transform: translateY(-1px);
}
.card-img-wrap {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
}
.card-img { width: 100%; height: 100%; }
.card-time {
  position: absolute; bottom: 8px; left: 8px;
  background: rgba(0,0,0,0.65); color: #fff;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px;
  padding: 3px 8px; border-radius: 4px; letter-spacing: 0.02em;
}
.card-add {
  position: absolute; top: 8px; right: 8px;
  width: 32px; height: 32px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(15,23,42,0.08);
  border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 120ms, transform 120ms;
  font-size: 18px; font-weight: 500;
  color: #1f2937;
}
.card-add:hover {
  background: #2563eb; color: #fff; transform: scale(1.05);
}
.card-add.in-plan {
  background: #16a34a; color: #fff;
}
.card-body {
  padding: 12px 14px 14px; flex: 1;
  display: flex; flex-direction: column; gap: 10px;
}
.card-title {
  font-size: 14px; font-weight: 500; line-height: 1.25;
  margin: 0; color: #0f172a;
}
.card-meta {
  display: flex; gap: 12px; margin-top: auto; padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}
.card-stat {
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; font-weight: 500;
  color: #1f2937; line-height: 1;
  display: flex; align-items: baseline; gap: 2px;
}
.card-stat small {
  font-size: 10px; font-weight: 400; color: #94a3b8; letter-spacing: 0.02em;
}
.card-prep-indicator {
  position: absolute; top: 8px; left: 8px;
  background: rgba(255,255,255,0.95);
  font-size: 10px; font-family: 'IBM Plex Mono', monospace;
  padding: 3px 8px; border-radius: 4px;
  color: #b85428; letter-spacing: 0.02em;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}
.modal-overlay.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 12px;
  max-width: 560px; width: 100%;
  margin: 0 16px;
  box-shadow: 0 20px 60px rgba(15,23,42,0.18);
  overflow: hidden;
  animation: modalRise 200ms ease-out;
}
@keyframes modalRise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal-head {
  padding: 18px 24px 14px;
  border-bottom: 1px solid #f1f5f9;
}
.modal-kicker {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #64748b; margin-bottom: 4px; font-weight: 600;
}
.modal-title {
  font-size: 18px; font-weight: 600; margin: 0;
  color: #0f172a; line-height: 1.2;
}
.modal-body { padding: 18px 24px; }
.modal-section-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #64748b; font-weight: 600; margin-bottom: 10px;
}
.day-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}
.day-btn {
  background: #fff;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px 4px;
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms, background 120ms;
  display: flex; flex-direction: column; gap: 2px; align-items: center;
}
.day-btn:hover {
  border-color: #2563eb;
  background: #eff6ff;
}
.day-btn-name {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: #64748b; font-weight: 600;
}
.day-btn-date {
  font-size: 16px; font-weight: 600; color: #0f172a;
  font-family: 'IBM Plex Sans', sans-serif;
}
.day-btn-occupied {
  background: #fef3c7; border-color: #fbbf24;
}
.day-btn-occupied .day-btn-date { color: #92400e; }
.day-btn-current {
  background: #16a34a; border-color: #16a34a;
}
.day-btn-current .day-btn-name,
.day-btn-current .day-btn-date { color: #fff; }
.day-btn-existing {
  font-size: 9px; color: #92400e; margin-top: 2px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.prep-preview {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 12px;
}
.prep-preview-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #92400e; margin-bottom: 6px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
}
.prep-task {
  display: flex; align-items: start; gap: 8px;
  padding: 4px 0;
  color: #78350f;
}
.prep-task-when {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  background: rgba(146,64,14,0.1); padding: 2px 6px; border-radius: 4px;
  white-space: nowrap; flex-shrink: 0;
}

.modal-foot {
  padding: 14px 24px;
  background: #f9fafb;
  border-top: 1px solid #f1f5f9;
  display: flex; justify-content: flex-end; gap: 8px;
}
.btn {
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 7px 14px; border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer; transition: background 120ms;
}
.btn-ghost {
  background: transparent; color: #4b5563; border-color: #e5e7eb;
}
.btn-ghost:hover { background: #f3f4f6; }

/* ============ VIEW: MEAL PLAN ============ */
.view-mealplan { padding: 24px 24px 40px; max-width: 1400px; margin: 0 auto; }
.mealplan-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}
.mealplan-head h1 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 26px; font-weight: 500; margin: 0;
  letter-spacing: -0.015em;
}
.mealplan-head .range {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; color: #64748b;
}
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}
.week-day {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 14px;
  min-height: 320px;
  display: flex; flex-direction: column;
}
.week-day-today {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.08);
}
.week-day-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-bottom: 10px; margin-bottom: 10px;
  border-bottom: 1px solid #f1f5f9;
}
.week-day-name {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; color: #64748b;
}
.week-day-today .week-day-name { color: #2563eb; }
.week-day-num {
  font-family: 'IBM Plex Serif', serif;
  font-size: 22px; font-weight: 500; color: #0f172a;
  line-height: 1;
}
.week-day-today .week-day-num { color: #2563eb; }

.dinner-card {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 12px;
}
.dinner-card-img {
  width: 100%; height: 90px;
}
.dinner-card-body {
  padding: 10px 0 0;
}
.dinner-card-title {
  font-size: 13px; font-weight: 500; line-height: 1.25;
  margin: 0 0 4px; color: #0f172a;
}
.dinner-card-meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px; color: #64748b; letter-spacing: 0.02em;
}
.dinner-card-remove {
  position: absolute; top: 6px; right: 6px;
  width: 24px; height: 24px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; color: #ef4444;
  line-height: 1; font-weight: 400;
  border: 1px solid rgba(15,23,42,0.08);
  transition: background 120ms;
}
.dinner-card-remove:hover { background: #fef2f2; }

.empty-day {
  flex: 1;
  display: flex; align-items: center; justify-content: center;
  border: 2px dashed #e5e7eb;
  border-radius: 8px;
  color: #94a3b8;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 120ms, color 120ms;
  min-height: 90px;
}
.empty-day:hover {
  border-color: #2563eb; color: #2563eb;
}

.prep-section {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
}
.prep-section-label {
  font-size: 9px; text-transform: uppercase; letter-spacing: 0.08em;
  color: #b85428; font-weight: 600; margin-bottom: 6px;
}
.prep-item {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 6px;
  font-size: 11px;
  color: #78350f;
  line-height: 1.4;
}
.prep-item-for {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: #92400e;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}

.mealplan-empty {
  text-align: center;
  padding: 80px 24px;
  color: #64748b;
}
.mealplan-empty h2 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 22px; margin: 0 0 8px;
  font-weight: 500; color: #0f172a;
}

/* ============ VIEW: GROCERY LIST ============ */
.view-grocery { padding: 24px 24px 40px; max-width: 880px; margin: 0 auto; }
.grocery-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e7eb;
}
.grocery-head h1 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 26px; font-weight: 500; margin: 0;
  letter-spacing: -0.015em;
}
.grocery-head .meta {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px; color: #64748b;
}
.grocery-category {
  margin-bottom: 32px;
}
.grocery-category-head {
  display: flex; align-items: baseline; gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #18181b;
}
.grocery-category-name {
  font-family: 'IBM Plex Serif', serif;
  font-size: 18px; font-weight: 500;
  letter-spacing: -0.005em;
  color: #0f172a;
}
.grocery-category-count {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; color: #94a3b8;
}
.grocery-items {
  list-style: none; padding: 0; margin: 0;
}
.grocery-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  align-items: start;
  cursor: pointer;
}
.grocery-item:last-child { border-bottom: none; }
.grocery-item-check {
  width: 18px; height: 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  margin-top: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: background 120ms, border-color 120ms;
  flex-shrink: 0;
}
.grocery-item-checked .grocery-item-check {
  background: #16a34a;
  border-color: #16a34a;
}
.grocery-item-checked .grocery-item-check::after {
  content: '✓'; color: #fff; font-size: 11px; line-height: 1;
}
.grocery-item-checked .grocery-item-text { text-decoration: line-through; color: #94a3b8; }
.grocery-item-checked .grocery-item-sources { color: #cbd5e1; }
.grocery-item-text {
  font-size: 14px; color: #1f2937; line-height: 1.35;
}
.grocery-item-qty {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  color: #0f172a;
  margin-right: 6px;
}
.grocery-item-sources {
  font-size: 11px; color: #94a3b8;
  margin-top: 2px;
  font-style: italic;
}

.grocery-empty {
  text-align: center;
  padding: 80px 24px;
  color: #64748b;
}
.grocery-empty h2 {
  font-family: 'IBM Plex Serif', serif;
  font-size: 22px; margin: 0 0 8px;
  font-weight: 500; color: #0f172a;
}

/* Mise en Place — sits above the ingredients/instructions split */
.recipe-mise {
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  border-radius: 10px;
  padding: 18px 20px;
  margin: 24px 0 0;
}
.recipe-mise-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.recipe-mise-title {
  font-family: 'IBM Plex Serif', serif;
  font-size: 17px;
  font-weight: 500;
  color: #0f172a;
  margin: 0;
  font-style: italic;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.recipe-mise-title-helper {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  font-weight: 400;
  font-style: normal;
  color: #94a3b8;
}
.recipe-mise-totals {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #64748b;
  display: flex;
  gap: 12px;
}
.recipe-mise-totals strong {
  color: #b85428;
  font-weight: 500;
}
.recipe-mise-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 4px 16px;
}
.recipe-mise-item {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 7px 0;
  border-bottom: 1px dotted #e7e5e4;
  cursor: pointer;
  font-size: 13.5px;
  line-height: 1.4;
  color: #1f2937;
}
.recipe-mise-check {
  width: 16px; height: 16px;
  border: 1.5px solid #cbd5e1;
  border-radius: 3px;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 120ms, border-color 120ms;
}
.recipe-mise-checked .recipe-mise-check {
  background: #16a34a;
  border-color: #16a34a;
}
.recipe-mise-checked .recipe-mise-check::after {
  content: '✓'; color: #fff; font-size: 10px; line-height: 1;
}
.recipe-mise-checked .recipe-mise-task {
  text-decoration: line-through;
  color: #94a3b8;
}
.recipe-mise-time {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #94a3b8;
  white-space: nowrap;
  margin-top: 2px;
}
.recipe-mise-item.is-passive .recipe-mise-time {
  color: #b85428;
}
.recipe-mise-item.is-passive .recipe-mise-time::after {
  content: ' · passive';
  color: #b85428;
  opacity: 0.7;
}

/* ============ VIEW: RECIPE DETAIL (cooking page) ============ */
.view-recipe {
  background: #fff;
  min-height: calc(100vh - 60px);
  padding-bottom: 80px;
}
.recipe-topbar {
  position: sticky;
  top: 60px;
  z-index: 50;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.recipe-topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recipe-double-btn {
  background: #fff;
  color: #1f2937;
  border: 1px solid #e5e7eb;
  padding: 7px 13px;
  border-radius: 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
}
.recipe-double-btn:hover {
  border-color: #b85428;
  color: #b85428;
}
.recipe-double-btn.active {
  background: #b85428;
  color: #fff;
  border-color: #b85428;
}
.recipe-title-badge {
  display: inline-block;
  vertical-align: middle;
  margin-left: 14px;
  background: #b85428;
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 100px;
  letter-spacing: 0.02em;
  font-style: normal;
  line-height: 1.5;
}
.dinner-card-doubled {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #b85428;
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  letter-spacing: 0.04em;
  z-index: 2;
  pointer-events: none;
}
.modal-double-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 14px 14px;
  margin: 14px 0 6px;
  background: #fafaf9;
  border: 1px solid #e7e5e4;
  border-radius: 8px;
  cursor: pointer;
}
.modal-double-row input[type="checkbox"] {
  grid-row: 1 / 3;
  width: 18px;
  height: 18px;
  accent-color: #b85428;
  cursor: pointer;
  margin: 0;
}
.modal-double-label {
  font-size: 14px;
  font-weight: 500;
  color: #1f2937;
}
.modal-double-helper {
  font-size: 12px;
  color: #71717a;
  font-style: italic;
}

/* ============ VIEW: RECIPE DETAIL (cooking page) ============ */
.recipe-back {
  background: transparent;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: #4b5563;
  cursor: pointer;
  padding: 6px 10px 6px 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: background 120ms, color 120ms;
}
.recipe-back:hover { background: #f3f4f6; color: #18181b; }
.recipe-back-arrow { font-size: 16px; }
.recipe-topbar-status {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #16a34a;
  display: flex;
  align-items: center;
  gap: 6px;
}
.recipe-topbar-status:empty { display: none; }
.recipe-topbar-status::before {
  content: '●';
  font-size: 10px;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.recipe-add-btn {
  background: #1f2937;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 120ms;
}
.recipe-add-btn:hover { background: #111827; }
.recipe-add-btn.in-plan { background: #16a34a; }

.recipe-body { max-width: 1100px; margin: 0 auto; padding: 0 24px; }

.recipe-hero {
  padding: 32px 0 24px;
  border-bottom: 1px solid #e5e7eb;
}
.recipe-kicker {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #b85428;
  margin-bottom: 8px;
  font-weight: 500;
}
.recipe-title {
  font-family: 'IBM Plex Serif', serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 500;
  line-height: 1.1;
  margin: 0 0 12px;
  letter-spacing: -0.015em;
  color: #0f172a;
}
.recipe-source {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  color: #71717a;
  letter-spacing: 0.02em;
}
.recipe-source a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: #d4d4d8;
  text-underline-offset: 3px;
}
.recipe-source a:hover {
  color: #b85428;
  text-decoration-color: #b85428;
}

.recipe-quickfacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0;
  padding: 16px 0;
  border-bottom: 1px solid #e5e7eb;
}
.recipe-fact {
  padding: 4px 16px 4px 0;
  border-right: 1px solid #f1f5f9;
}
.recipe-fact:last-child { border-right: none; }
.recipe-fact-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #71717a;
  margin-bottom: 4px;
}
.recipe-fact-value {
  font-family: 'IBM Plex Serif', serif;
  font-size: 17px;
  font-weight: 500;
  color: #0f172a;
}

.recipe-note {
  background: #fef3c7;
  border-left: 3px solid #f59e0b;
  padding: 12px 16px;
  margin: 20px 0;
  font-size: 14px;
  color: #78350f;
  font-style: italic;
  border-radius: 0 4px 4px 0;
}

.recipe-columns {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 48px;
  padding: 24px 0;
}

.recipe-col-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 600;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.recipe-col-helper {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 11px;
  color: #94a3b8;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  font-style: italic;
}

/* Ingredient list — left column on wide screens, sticky-ish */
.recipe-ingredients-col {
  position: sticky;
  top: 130px;
  align-self: start;
  max-height: calc(100vh - 150px);
  overflow-y: auto;
  padding-right: 12px;
}
.recipe-ingredient-list {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
}
.recipe-ingredient {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: start;
  padding: 8px 0;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-size: 15px;
  line-height: 1.4;
  color: #1f2937;
}
.recipe-ingredient:last-child { border-bottom: none; }
.recipe-ingredient-check {
  width: 18px; height: 18px;
  border: 1.5px solid #cbd5e1;
  border-radius: 4px;
  margin-top: 2px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 120ms, border-color 120ms;
}
.recipe-ingredient-checked .recipe-ingredient-check {
  background: #16a34a;
  border-color: #16a34a;
}
.recipe-ingredient-checked .recipe-ingredient-check::after {
  content: '✓'; color: #fff; font-size: 11px; line-height: 1;
}
.recipe-ingredient-checked .recipe-ingredient-text {
  text-decoration: line-through;
  color: #94a3b8;
}
.recipe-ingredient-qty {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 500;
  color: #0f172a;
}
.recipe-ingredient-checked .recipe-ingredient-qty {
  color: #94a3b8;
}
.recipe-ingredient-note {
  display: block;
  font-size: 12px;
  color: #71717a;
  font-style: italic;
  margin-top: 2px;
}

.recipe-tools {
  background: #f8fafc;
  border-radius: 8px;
  padding: 14px 16px;
}
.recipe-tools-label {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  font-weight: 600;
  margin-bottom: 8px;
}
.recipe-tools-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 13px;
  color: #374151;
}
.recipe-tools-list li {
  padding: 3px 0;
  display: flex;
  align-items: start;
  gap: 8px;
}
.recipe-tools-list li::before {
  content: '·';
  color: #94a3b8;
}

/* Instructions — right column */
.recipe-instructions-col { min-width: 0; }
.recipe-stage {
  margin-bottom: 32px;
}
.recipe-stage:last-child { margin-bottom: 0; }
.recipe-stage-title {
  font-family: 'IBM Plex Serif', serif;
  font-size: 19px;
  font-weight: 500;
  margin: 0 0 14px;
  letter-spacing: -0.005em;
  color: #b85428;
  font-style: italic;
}
.recipe-step-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: step;
}
.recipe-step {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 16px;
  align-items: start;
  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.55;
  color: #1f2937;
}
.recipe-step:last-child { border-bottom: none; }
.recipe-step-num {
  width: 30px;
  height: 30px;
  border-radius: 100px;
  background: #1f2937;
  color: #fff;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 120ms;
}
.recipe-step:hover .recipe-step-num { background: #b85428; }
.recipe-step-checked .recipe-step-num {
  background: #16a34a;
}
.recipe-step-checked .recipe-step-text {
  color: #94a3b8;
}

/* Mobile stack */
@media (max-width: 820px) {
  .recipe-columns {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .recipe-ingredients-col {
    position: static;
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }
  .recipe-topbar { padding: 10px 16px; }
  .recipe-body { padding: 0 16px; }
  .recipe-step { font-size: 15px; }
  .recipe-ingredient { font-size: 14px; }
}

/* ============ TOAST ============ */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #0f172a; color: #fff;
  padding: 12px 20px; border-radius: 8px;
  font-size: 13px;
  z-index: 2000;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms, transform 200ms;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}
.toast-icon {
  width: 18px; height: 18px;
  background: #16a34a; color: #fff;
  border-radius: 100px;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 600;
}

/* ============ UTILITY ============ */
.hidden { display: none !important; }

.img-bas-best-bolognese{background-image:url("./images/recipes/bas-best-bolognese.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-beef-and-bacon-stew{background-image:url("./images/recipes/beef-and-bacon-stew.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-beef-bourguignon{background-image:url("./images/recipes/beef-bourguignon.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-butter-roasted-halibut-with-asparagus{background-image:url("./images/recipes/butter-roasted-halibut-with-asparagus.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-cheesy-chicken-enchilada-skillet{background-image:url("./images/recipes/cheesy-chicken-enchilada-skillet.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-cod-poached-in-tomato-curry{background-image:url("./images/recipes/cod-poached-in-tomato-curry.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-coq-au-vin{background-image:url("./images/recipes/coq-au-vin.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-creamy-pasta-with-crispy-mushrooms{background-image:url("./images/recipes/creamy-pasta-with-crispy-mushrooms.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-foolproof-pan-pizza{background-image:url("./images/recipes/foolproof-pan-pizza.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-french-onion-beef-noodle-soup{background-image:url("./images/recipes/french-onion-beef-noodle-soup.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-garlic-herb-roast-chicken-with-potatoes{background-image:url("./images/recipes/garlic-herb-roast-chicken-with-potatoes.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-linguine-with-crab-lemon-and-mint{background-image:url("./images/recipes/linguine-with-crab-lemon-and-mint.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-matty-mathesons-ultimate-burger{background-image:url("./images/recipes/matty-mathesons-ultimate-burger.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-mongolian-beef-ramen{background-image:url("./images/recipes/mongolian-beef-ramen.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-one-skillet-chicken-with-buttery-orzo{background-image:url("./images/recipes/one-skillet-chicken-with-buttery-orzo.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-one-skillet-rotisserie-chicken-pot-pie{background-image:url("./images/recipes/one-skillet-rotisserie-chicken-pot-pie.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-pasta-bravo{background-image:url("./images/recipes/pasta-bravo.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-perfect-french-fries{background-image:url("./images/recipes/perfect-french-fries.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-porcini-rubbed-rib-roast{background-image:url("./images/recipes/porcini-rubbed-rib-roast.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-red-wine-braised-short-ribs{background-image:url("./images/recipes/red-wine-braised-short-ribs.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-salmon-cakes-with-sauteed-aromatics{background-image:url("./images/recipes/salmon-cakes-with-sauteed-aromatics.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-sheet-pan-fish-with-sweet-peppers-and-olives{background-image:url("./images/recipes/sheet-pan-fish-with-sweet-peppers-and-olives.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-sheet-pan-trout-with-garlicky-broccolini{background-image:url("./images/recipes/sheet-pan-trout-with-garlicky-broccolini.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-shepherds-pie{background-image:url("./images/recipes/shepherds-pie.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-slow-cooker-beef-pot-roast{background-image:url("./images/recipes/slow-cooker-beef-pot-roast.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-slow-cooker-chipotle-honey-chicken-tacos{background-image:url("./images/recipes/slow-cooker-chipotle-honey-chicken-tacos.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-slow-cooker-pork-shoulder-with-zesty-basil-sauce{background-image:url("./images/recipes/slow-cooker-pork-shoulder-with-zesty-basil-sauce.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}
.img-spicy-chicken-lettuce-wraps{background-image:url("./images/recipes/spicy-chicken-lettuce-wraps.jpg");background-position:center;background-size:cover;background-repeat:no-repeat;background-color:#ececec}

/* ============================================================
   Mobile responsive layout — added 2026-05-25
   Breakpoint: 640px (phone portrait)
   ============================================================ */
@media (max-width: 640px) {
  /* HEADER: collapse the 3-col grid to a single column with brand + tabs stacked */
  .head {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    padding: 10px 12px;
    gap: 8px;
  }
  .searchbox { display: none; }
  .head-right {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
  }
  .head-tab {
    font-size: 12px;
    padding: 5px 10px;
    flex: 1;
    justify-content: center;
    min-width: 0;
  }
  .head-tab .badge {
    font-size: 10px;
    padding: 1px 6px;
  }
  .brand {
    font-size: 14px;
  }

  /* RECIPES VIEW: stack sidebar above main */
  .view-recipes {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 0;
  }
  .sidebar {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    padding: 12px;
    max-height: 50vh;
    overflow-y: auto;
  }
  .sidebar-section { margin-bottom: 16px; }
  .main { padding: 14px 12px 32px; }

  /* TOOLBAR: stack pieces */
  .toolbar {
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 14px;
  }

  /* RECIPE GRID: 2 cards per row on phones */
  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .card-title { font-size: 13px; }
  .card-body { padding: 10px 12px 12px; gap: 8px; }

  /* MEAL PLAN WEEK GRID: 2 cols x 4 rows is friendlier than 7 tiny columns */
  .week-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .mealplan-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }
  .grocery-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* RECIPE DETAIL PAGE topbar */
  .recipe-topbar {
    top: 0;
    flex-wrap: wrap;
    padding: 10px 12px;
    gap: 8px;
  }
  .recipe-topbar-right {
    flex-wrap: wrap;
    gap: 6px;
  }
  .recipe-double-btn,
  .recipe-add-btn {
    font-size: 12px;
    padding: 6px 10px;
  }
  .recipe-body { padding: 0 12px; }

  /* MODAL: full-width-ish with tight margins */
  .modal {
    margin: 8px;
    max-height: calc(100vh - 16px);
    overflow-y: auto;
  }
  /* Day picker grid in the add-to-plan modal — 7 days won't fit, use 2 cols */
  .day-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
  }
}

/* ============================================================
   Mobile filter drawer — replaces sticky sidebar pattern
   ============================================================ */
/* Hide the buttons on desktop */
.mobile-filter-toggle,
.mobile-filter-close {
  display: none;
}

@media (max-width: 640px) {
  /* Show the toggle pill in the toolbar */
  .mobile-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    padding: 6px 14px;
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
  }
  .mobile-filter-icon {
    display: inline-block;
    transform: translateY(-1px);
  }
  body.mobile-filters-open .mobile-filter-toggle {
    background: #1f2937;
    color: #fff;
    border-color: #1f2937;
  }

  /* Sidebar becomes a hidden drawer; opens on body.mobile-filters-open */
  .view-recipes {
    /* Drop the previous grid-rows stacking; now main is full width on mobile */
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }
  .sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: #fff;
    border-right: none;
    border-bottom: none;
    padding: 56px 16px 16px;
    overflow-y: auto;
    max-height: none;
    transform: translateY(-100%);
    transition: transform 220ms ease;
    box-shadow: 0 8px 24px rgba(15,23,42,0.12);
  }
  body.mobile-filters-open .sidebar {
    transform: translateY(0);
  }

  /* Close button (the × in the top-right of the open drawer) */
  body.mobile-filters-open .mobile-filter-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 101;
    background: #fff;
    border: 1px solid #e5e7eb;
    color: #1f2937;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(15,23,42,0.1);
  }

  /* Lock background scroll while drawer is open */
  body.mobile-filters-open {
    overflow: hidden;
  }
}

@media (min-width: 641px) {
  .sidebar { transform: none !important; }
  body.mobile-filters-open { overflow: auto; }
}

/* Mobile header search bar — show it on its own row */
@media (max-width: 640px) {
  .head {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 8px;
    padding: 10px 12px;
  }
  .searchbox {
    display: block;
    width: 100%;
    max-width: none;
    margin: 0;
  }
  .searchbox input {
    width: 100%;
    box-sizing: border-box;
    font-size: 14px;
    padding: 8px 10px 8px 30px;
  }
}

/* ============================================================
   Meal plan: per-day time picker + export button
   ============================================================ */
.mealplan-head {
  align-items: center;
}
.mealplan-head-left { flex: 1; }
.mealplan-export-btn {
  background: #1f2937;
  color: #fff;
  border: none;
  padding: 8px 14px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.mealplan-export-btn:hover { background: #111827; }

.meal-time-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  margin-top: 6px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  color: #4b5563;
}
.meal-time-label {
  font-weight: 500;
  flex-shrink: 0;
}
.meal-time-input {
  border: 1px solid #d1d5db;
  border-radius: 4px;
  padding: 3px 6px;
  font: inherit;
  font-size: 12px;
  background: #fff;
  color: #1f2937;
  font-variant-numeric: tabular-nums;
}
.meal-time-input:focus {
  outline: 2px solid #2563eb;
  outline-offset: -1px;
  border-color: transparent;
}

/* ============================================================
   Google Calendar quick-add buttons (per-event)
   ============================================================ */
.meal-cal-btn {
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 4px 9px;
  border-radius: 4px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  margin-left: auto;
  flex-shrink: 0;
}
.meal-cal-btn:hover { background: #1d4ed8; }

.prep-item {
  position: relative;
}
.prep-item-task {
  /* Avoid the button overlapping the text */
  padding-right: 60px;
}
.prep-cal-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: #2563eb;
  color: #fff;
  border: none;
  padding: 3px 8px;
  border-radius: 4px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
}
.prep-cal-btn:hover { background: #1d4ed8; }

@media (max-width: 768px) {
  .meal-cal-btn, .prep-cal-btn {
    font-size: 10px;
    padding: 3px 7px;
  }
}
