:root {
  --bg: #f5f3ee;
  --paper: #fdfcf8;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-mute: #9a9690;
  --line: #e3e0d8;
  --line-strong: #2a2a2a;
  --accent: #c2410c;
  --accent-soft: #fef3ec;
  --green: #166534;
  --green-soft: #dcfce7;
  --red: #991b1b;
  --red-soft: #fee2e2;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-weight: 400;
  line-height: 1.55;
  min-height: 100vh;
  padding: 3rem 1.5rem 5rem;
  background-image:
    radial-gradient(circle at 15% 5%, rgba(194, 65, 12, 0.035), transparent 35%),
    radial-gradient(circle at 85% 90%, rgba(22, 101, 52, 0.03), transparent 40%);
}

.container { max-width: 1200px; margin: 0 auto; }

/* ---------- Header ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-bottom: 2rem;
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 1.5rem;
}
.brand { display: flex; align-items: baseline; gap: 0.75rem; }
.brand-mark {
  font-family: 'Fraunces', serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.brand-mark::before { content: "※ "; font-style: normal; }

h1 {
  font-family: 'Fraunces', serif;
  font-weight: 400;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
h1 em { font-style: italic; font-weight: 300; color: var(--ink-soft); }

.subtitle {
  font-size: 0.8rem;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-top: 0.5rem;
}

.date-tag {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  color: var(--ink-soft);
  font-style: italic;
}
.date-tag strong {
  font-weight: 600;
  font-style: normal;
  color: var(--ink);
  display: block;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

/* ---------- Controls ---------- */
.controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
  align-items: center;
}

button {
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--line-strong);
  background: var(--ink);
  color: var(--paper);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}
button:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.12); }
button.secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
button.secondary:hover { border-color: var(--ink); background: var(--paper); }
button.ghost {
  background: transparent;
  color: var(--ink-mute);
  border: none;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
}
button.ghost:hover { color: var(--ink); background: transparent; box-shadow: none; }

/* ---------- Equilibre ---------- */
.equilibre-banner {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.equilibre-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-mute);
}
.equilibre-score {
  font-family: 'Fraunces', serif;
  font-size: 2rem;
  line-height: 1;
  font-weight: 500;
}
.equilibre-score em { font-size: 1rem; color: var(--ink-mute); font-style: italic; font-weight: 300; }
.equilibre-bars {
  flex: 1;
  min-width: 260px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 0.75rem;
}
.eq-bar { font-size: 0.7rem; }
.eq-bar-label {
  display: flex;
  justify-content: space-between;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-mute);
  margin-bottom: 0.3rem;
}
.eq-bar-track {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.eq-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.eq-bar-fill.good { background: var(--green); }

/* ---------- Week / Days ---------- */
.week {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.25rem;
}

.day-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.25s ease;
}
.day-card:hover { border-color: var(--ink-mute); }

.day-header {
  padding: 1.1rem 1.25rem 0.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px dashed var(--line);
}
.day-name {
  font-family: 'Fraunces', serif;
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.day-num {
  font-size: 0.7rem;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.15em;
}

/* Lock day button */
.lock-day-btn {
  font-size: 0.65rem;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-mute);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}
.lock-day-btn:hover { border-color: var(--accent); color: var(--accent); transform: none; box-shadow: none; }
.lock-day-btn.is-locked { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.day-card.day-locked { border-color: var(--accent); border-style: solid; }

.meal {
  padding: 1rem 1.25rem;
  border-bottom: 1px dashed var(--line);
  transition: background 0.2s;
}
.meal:last-child { border-bottom: none; }
.meal.is-locked { background: var(--accent-soft); }

/* Lock meal button — inline with meal label */
.lock-meal-btn {
  font-size: 0.55rem;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--line-strong);
  cursor: pointer;
  opacity: 0.3;
  transition: opacity 0.15s, color 0.15s;
  line-height: 1;
}
.lock-meal-btn:hover { opacity: 1; color: var(--accent); transform: none; box-shadow: none; }
.lock-meal-btn.is-locked { opacity: 1; color: var(--accent); }

.meal-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.meal-label::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.meal-label.dinner::before { background: var(--ink-soft); }

.meal-name {
  font-family: 'Fraunces', serif;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
  margin-bottom: 0.5rem;
  color: var(--ink);
}
.recipe-link-icon {
  display: inline-block;
  margin-left: 0.35rem;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  vertical-align: middle;
  opacity: 0.75;
  transition: opacity 0.15s;
}
.recipe-link-icon:hover { opacity: 1; }

/* Cliquable ingredient token */
.ing-token {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.08em 0.4em;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  border-bottom: 1px dashed var(--accent);
  font-style: italic;
}
.ing-token:hover {
  background: var(--accent);
  color: var(--paper);
  border-bottom-color: transparent;
}

.meal-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.tag {
  font-size: 0.65rem;
  color: var(--ink-mute);
  background: var(--bg);
  padding: 0.15rem 0.55rem;
  border-radius: 100px;
  letter-spacing: 0.03em;
}
.tag.modified {
  background: var(--accent-soft);
  color: var(--accent);
}

.meal-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.5rem;
}
.vote-group { display: flex; gap: 0.3rem; }
.vote-btn {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  padding: 0.3rem 0.55rem;
  border-radius: 100px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}
.vote-btn:hover { transform: none; box-shadow: none; border-color: var(--ink); }
.vote-btn.up.active { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.vote-btn.down.active { background: var(--red-soft); border-color: var(--red); color: var(--red); }

.reset-recipe-btn {
  background: transparent;
  border: none;
  color: var(--ink-mute);
  font-size: 0.75rem;
  padding: 0.3rem 0.4rem;
  cursor: pointer;
  transition: color 0.15s ease;
  letter-spacing: 0.05em;
}
.reset-recipe-btn:hover {
  color: var(--accent);
  background: transparent;
  box-shadow: none;
}

/* Menu déroulant pour le swap de recette */
.shuffle-menu {
  position: relative;
  display: inline-block;
}
.shuffle-trigger {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.75rem;
  padding: 0.3rem 0.7rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s ease;
  letter-spacing: 0.02em;
  line-height: 1;
  font-family: inherit;
}
.shuffle-trigger:hover {
  border-color: var(--ink);
  color: var(--ink);
  transform: none;
  box-shadow: none;
}
.shuffle-menu.open .shuffle-trigger {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.shuffle-options {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.3rem;
  min-width: 140px;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.15);
  opacity: 0;
  pointer-events: none;
  transform: translateY(4px);
  transition: all 0.18s ease;
  z-index: 20;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.shuffle-menu.open .shuffle-options {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.shuffle-option {
  background: transparent;
  border: none;
  color: var(--ink);
  font-family: 'Fraunces', serif;
  font-size: 0.85rem;
  padding: 0.45rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
  letter-spacing: 0;
  line-height: 1.2;
}
.shuffle-option:hover {
  background: var(--accent-soft);
  color: var(--accent);
  transform: none;
  box-shadow: none;
}

.score-badge {
  font-size: 0.65rem;
  color: var(--ink-mute);
  font-family: 'Fraunces', serif;
  font-style: italic;
}
.score-badge.positive { color: var(--green); }
.score-badge.negative { color: var(--red); }

/* ---------- Ingredient swap modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 26, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  padding: 1rem;
}
.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.modal {
  background: var(--paper);
  border-radius: 16px;
  padding: 2rem;
  max-width: 480px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(10px);
  transition: transform 0.25s ease;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.25);
}
.modal-overlay.open .modal { transform: translateY(0); }

.modal-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-mute);
  margin-bottom: 0.35rem;
}
.modal h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}
.modal-sub {
  font-size: 0.85rem;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}
.modal-sub em { color: var(--accent); font-style: italic; }

.ing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.ing-option {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-family: 'Fraunces', serif;
  font-size: 0.9rem;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
  color: var(--ink);
}
.ing-option:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: none;
  box-shadow: none;
}
.ing-option.current {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.modal-close {
  background: transparent;
  color: var(--ink-mute);
  border: 1px solid var(--line);
  margin-top: 0.5rem;
}
.modal-close:hover { color: var(--ink); background: transparent; }

/* ---------- Stats ---------- */
.stats {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 3rem;
  flex-wrap: wrap;
  align-items: baseline;
}
.stat-item { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-val {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.01em;
}
.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-mute);
}

/* ---------- Loading / Error states ---------- */
.loading {
  text-align: center;
  padding: 4rem 1rem;
  color: var(--ink-mute);
  font-style: italic;
  font-family: 'Fraunces', serif;
}
.error {
  background: var(--red-soft);
  color: var(--red);
  padding: 1rem 1.25rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ---------- Animations ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.day-card { animation: fadeUp 0.5s ease backwards; }
.day-card:nth-child(1) { animation-delay: 0.05s; }
.day-card:nth-child(2) { animation-delay: 0.1s; }
.day-card:nth-child(3) { animation-delay: 0.15s; }
.day-card:nth-child(4) { animation-delay: 0.2s; }
.day-card:nth-child(5) { animation-delay: 0.25s; }
.day-card:nth-child(6) { animation-delay: 0.3s; }
.day-card:nth-child(7) { animation-delay: 0.35s; }

@media (max-width: 600px) {
  body { padding: 1.5rem 1rem 3rem; }
  header { align-items: flex-start; flex-direction: column; }
  .equilibre-banner { flex-direction: column; align-items: flex-start; gap: 1rem; }
  .equilibre-bars { width: 100%; }
  .modal { padding: 1.5rem; }
}

/* ========== Éditeur de recettes ========== */
.editor-overlay {
  align-items: flex-start;
  padding: 2rem 1rem;
}
.editor-panel-wrap {
  background: var(--paper);
  border-radius: 16px;
  width: 100%;
  max-width: 780px;
  max-height: calc(100vh - 4rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.25);
  transform: translateY(10px);
  transition: transform 0.25s ease;
}
.editor-overlay.open .editor-panel-wrap { transform: translateY(0); }

.editor-header {
  padding: 1.5rem 1.75rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
}
.editor-header h2 {
  font-family: 'Fraunces', serif;
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  margin-top: 0.25rem;
}

.editor-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 1.75rem;
  gap: 0.25rem;
  flex-shrink: 0;
}
.editor-tab {
  background: transparent;
  border: none;
  color: var(--ink-mute);
  padding: 0.9rem 1.1rem;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  transition: all 0.15s ease;
  margin-bottom: -1px;
}
.editor-tab:hover {
  color: var(--ink);
  transform: none;
  box-shadow: none;
  background: transparent;
}
.editor-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

.editor-panel {
  display: none;
  padding: 1.5rem 1.75rem 2rem;
  overflow-y: auto;
  flex: 1;
}
.editor-panel.active { display: block; }

.editor-actions {
  margin-bottom: 1.25rem;
}

.editor-section {
  margin-bottom: 1.75rem;
}
.editor-section h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.15rem;
  font-weight: 500;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.editor-section .count {
  font-size: 0.75rem;
  color: var(--ink-mute);
  font-style: italic;
  font-weight: 400;
}

.items-grid {
  display: grid;
  gap: 0.4rem;
}
.item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  gap: 0.75rem;
}
.item-row.custom {
  border-left: 3px solid var(--accent);
}
.item-info {
  flex: 1;
  min-width: 0;
}
.item-name {
  font-family: 'Fraunces', serif;
  font-size: 0.95rem;
  line-height: 1.2;
}
.item-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.25rem;
  align-items: center;
}
.item-meta code {
  font-family: 'Inter', monospace;
  font-size: 0.68rem;
  color: var(--ink-mute);
  background: transparent;
}
.flag-badge, .badge-custom {
  font-size: 0.6rem;
  padding: 0.1rem 0.4rem;
  border-radius: 100px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.flag-badge {
  background: var(--line);
  color: var(--ink-soft);
}
.badge-custom {
  background: var(--accent-soft);
  color: var(--accent);
}
.delete-btn {
  background: transparent;
  color: var(--ink-mute);
  border: 1px solid var(--line);
  border-radius: 100px;
  width: 26px;
  height: 26px;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1;
  flex-shrink: 0;
}
.delete-btn:hover {
  color: var(--red);
  border-color: var(--red);
  transform: none;
  box-shadow: none;
  background: transparent;
}

/* Formulaires */
.editor-form {
  display: none;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin-top: 1.5rem;
}
.editor-form.open { display: block; }
.editor-form h3 {
  font-family: 'Fraunces', serif;
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 0.6rem;
}
.form-hint {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-bottom: 1rem;
  line-height: 1.5;
}
.form-hint code {
  background: var(--paper);
  padding: 0.1em 0.35em;
  border-radius: 4px;
  font-size: 0.85em;
  border: 1px solid var(--line);
}
.form-row {
  margin-bottom: 0.9rem;
}
.form-row label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-mute);
  margin-bottom: 0.3rem;
}
.form-row input[type="text"],
.form-row select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--paper);
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  color: var(--ink);
}
.form-row input:focus,
.form-row select:focus {
  outline: none;
  border-color: var(--accent);
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 0.75rem;
}
.flag-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.8rem;
  padding-top: 0.3rem;
}
.flag-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--ink);
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  margin-bottom: 0;
  font-family: 'Fraunces', serif;
}
.flag-checkboxes input[type="checkbox"] {
  accent-color: var(--accent);
}
.form-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1rem;
}

/* Import / Export */
.io-buttons {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.file-input-label {
  display: inline-flex;
  align-items: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 0.75rem 1.5rem;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.2s ease;
  letter-spacing: 0.01em;
}
.file-input-label:hover {
  border-color: var(--ink);
  background: var(--paper);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* ---------- Historique ---------- */
.history-list {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
}
.history-empty {
  font-size: 0.9rem;
  color: var(--ink-mute);
  text-align: center;
  padding: 3rem 1rem;
  line-height: 1.8;
}
.history-entry {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
}
.history-entry-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  gap: 1rem;
  flex-wrap: wrap;
}
.history-entry-label {
  font-family: 'Fraunces', serif;
  font-size: 1rem;
  font-weight: 500;
}
.history-entry-date {
  font-size: 0.75rem;
  color: var(--ink-mute);
  margin-top: 0.1rem;
}
.history-entry-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}
.history-entry-actions .restore-btn,
.history-entry-actions .delete-btn {
  font-size: 0.78rem;
  padding: 0.4rem 0.9rem;
}
.history-week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-top: none;
}
.history-day {
  padding: 0.6rem 0.5rem;
  border-right: 1px solid var(--line);
  font-size: 0.7rem;
}
.history-day:last-child { border-right: none; }
.history-day-name {
  font-family: 'Fraunces', serif;
  font-weight: 500;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  color: var(--ink-soft);
}
.history-meal {
  line-height: 1.3;
  color: var(--ink);
  margin-bottom: 0.25rem;
}
.history-meal.dinner { color: var(--ink-soft); }
.deleted-recipe { color: var(--ink-mute); font-style: italic; }

@media (max-width: 600px) {
  .editor-overlay { padding: 0.5rem; }
  .editor-panel-wrap { max-height: calc(100vh - 1rem); border-radius: 12px; }
  .editor-header { padding: 1rem 1.25rem 0.75rem; }
  .editor-tabs { padding: 0 1rem; overflow-x: auto; }
  .editor-panel { padding: 1rem 1.25rem 1.5rem; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .history-week-grid { grid-template-columns: repeat(4, 1fr); }
}
