/* styles.css — charte « cuisine chaleureuse » : crème + terracotta + safran, Fraunces + Inter */
:root[data-theme="light"] {
  --bg: #f6ede1;
  --bg-2: #fffaf3;
  --surface: #fffaf3;
  --surface-2: #f1e4d2;
  --surface-3: #e9d9c2;
  --border: #e2d2bd;
  --border-2: #d4bfa3;
  --text: #2e211a;
  --text-2: #7a6555;
  --text-3: #a48d79;
  --accent: #c75b3e;        /* terracotta */
  --accent-2: #b14730;
  --accent-soft: rgba(199, 91, 62, 0.1);
  --accent-glow: rgba(199, 91, 62, 0.22);
  --warm: #d8973a;          /* safran (accent secondaire) */
  --warm-soft: rgba(216, 151, 58, 0.14);
  --danger: #a23a4a;        /* aubergine-brique */
  --danger-soft: rgba(162, 58, 74, 0.1);
  --shadow: 0 10px 34px rgba(74, 47, 28, 0.12);
  --on-accent: #fff6ee;
}
:root[data-theme="dark"] {
  --bg: #211712;
  --bg-2: #2a1d16;
  --surface: #2a1d16;
  --surface-2: #34251c;
  --surface-3: #402d21;
  --border: #3e2d20;
  --border-2: #4d3826;
  --text: #f3e6d8;
  --text-2: #c2a890;
  --text-3: #8f7660;
  --accent: #e58a63;        /* terracotta éclairci */
  --accent-2: #d4734a;
  --accent-soft: rgba(229, 138, 99, 0.13);
  --accent-glow: rgba(229, 138, 99, 0.26);
  --warm: #e3ab53;          /* safran */
  --warm-soft: rgba(227, 171, 83, 0.16);
  --danger: #e0788a;
  --danger-soft: rgba(224, 120, 138, 0.13);
  --shadow: 0 10px 34px rgba(0, 0, 0, 0.45);
  --on-accent: #2a160e;
}

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

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding-bottom: 88px;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

h1, h2, h3 {
  font-family: "Fraunces", Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  letter-spacing: -0.01em;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select { font-family: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Splash ---------- */
#splash {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--bg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; transition: opacity 0.5s, visibility 0.5s;
}
#splash.hide { opacity: 0; visibility: hidden; }
.splash-mark { animation: splashPop 0.7s cubic-bezier(0.22, 1, 0.36, 1); }
.splash-leaf { transform-origin: 42px 30px; animation: leafSway 2s ease-in-out infinite; }
.splash-name {
  font-family: "Fraunces", Georgia, serif; font-weight: 600; font-size: 1.15rem;
  color: var(--text-2); letter-spacing: 0.005em; font-style: italic;
  animation: fadeUp 0.6s 0.2s both;
}
.splash-loading { display: flex; gap: 5px; animation: fadeUp 0.6s 0.3s both; }
.splash-loading span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--accent);
  animation: dotPulse 1.2s ease-in-out infinite;
}
.splash-loading span:nth-child(2) { animation-delay: 0.15s; }
.splash-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes splashPop { from { transform: scale(0.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes leafSway { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(6deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dotPulse { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* ---------- Offline banner ---------- */
#offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: var(--danger); color: #fff; text-align: center;
  font-size: 0.8rem; font-weight: 600; padding: 0; max-height: 0; overflow: hidden;
  transition: max-height 0.3s, padding 0.3s;
}
#offline-banner.show { max-height: 40px; padding: 8px; }

/* ---------- Header ---------- */
#header {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; gap: 12px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 44px; height: 44px; flex-shrink: 0;
  display: grid; place-items: center; font-size: 1.45rem;
  background: var(--accent-soft); border-radius: 14px;
  border: 1px solid var(--border);
}
.brand-text { min-width: 0; }
.brand-text h1 { font-size: 1.3rem; line-height: 1.05; font-weight: 600; }
.brand-text p { font-size: 0.74rem; color: var(--text-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.header-actions { display: flex; gap: 8px; flex-shrink: 0; }

.icon-btn {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; font-size: 1rem;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); transition: all 0.15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-2); }
.icon-btn:active { transform: scale(0.94); }
.lang-btn { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.04em; }

/* ---------- Main ---------- */
#view { max-width: 1320px; margin: 0 auto; padding: 18px; animation: viewIn 0.3s ease; }
@media (min-width: 1600px) {
  #view { max-width: 1480px; }
}
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Navigation ---------- */
#nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: center; gap: 6px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
}
.nav-btn {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 22px; border-radius: 14px;
  color: var(--text-3); font-size: 0.7rem; font-weight: 600;
  transition: all 0.15s;
}
.nav-btn .nav-icon { font-size: 1.2rem; filter: grayscale(0.35); transition: filter 0.15s; }
.nav-btn.active { color: var(--accent); background: var(--accent-soft); }
.nav-btn.active .nav-icon { filter: grayscale(0); }
.nav-btn .badge {
  position: absolute; top: 2px; right: 12px;
  background: var(--accent); color: var(--on-accent);
  font-size: 0.62rem; font-weight: 800; min-width: 16px; height: 16px;
  border-radius: 8px; display: grid; place-items: center; padding: 0 4px;
}

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 0.88rem;
  transition: all 0.15s; border: 1px solid transparent; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 16px var(--accent-glow); }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-2); }
.btn-ghost.danger, .btn-ghost .danger { color: var(--danger); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); }
.btn-sm { padding: 8px 13px; font-size: 0.8rem; }
.btn-xs { padding: 6px 10px; font-size: 0.74rem; border-radius: 10px; }

/* ---------- Planning ---------- */
.week-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 8px 10px;
}
.week-center { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.week-range { font-family: "Fraunces", serif; font-weight: 600; font-size: 1.08rem; }
.week-today {
  font-size: 0.7rem; color: var(--accent); font-weight: 600;
  padding: 2px 10px; border-radius: 20px; background: var(--accent-soft);
}
.week-bar .icon-btn { font-size: 1.5rem; line-height: 1; }

.planner-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; align-items: start;
}
.day-col {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 8px;
}
.day-col.is-today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-glow); }
.day-head { text-align: center; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.day-name { display: block; font-weight: 600; font-size: 0.86rem; font-family: "Fraunces", serif; }
.day-date { display: block; font-size: 0.68rem; color: var(--text-3); margin-top: 1px; }
.day-chevron { display: none; }

.slot { position: relative; }
.slot.drag-over { outline: 2px dashed var(--accent); outline-offset: 2px; border-radius: 11px; }
.slot.dragging-source { opacity: 0.4; }
.drag-ghost {
  position: fixed; z-index: 500; pointer-events: none;
  background: var(--surface-2); border: 1px solid var(--accent);
  border-radius: 11px; padding: 8px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; opacity: 0.95;
}
.slot-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-3); font-weight: 600; margin-bottom: 4px; }
.slot-add {
  width: 100%; padding: 10px; border-radius: 11px;
  border: 1px dashed var(--border-2); color: var(--text-3);
  font-size: 1.1rem; transition: all 0.15s;
}
.slot-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.slot-meal {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 11px; padding: 8px; cursor: pointer; cursor: grab;
  display: flex; flex-direction: column; gap: 4px; transition: all 0.15s;
  user-select: none; -webkit-user-select: none; touch-action: pan-y;
}
.slot-meal:hover { border-color: var(--accent); }
.slot-meal.dragging { opacity: 0.4; }
.slot-emoji { font-size: 1.1rem; }
.slot-meal-name { font-size: 0.76rem; font-weight: 600; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.slot-serv-row { display: flex; align-items: center; gap: 6px; }
.slot-serv { font-size: 0.64rem; color: var(--warm); font-weight: 700; flex: 1; }
.serv-btn {
  width: 18px; height: 18px; flex-shrink: 0; border-radius: 6px; font-size: 0.72rem;
  font-weight: 800; background: var(--surface-3); color: var(--text-2);
  display: grid; place-items: center; transition: all 0.15s;
}
.serv-btn:hover { background: var(--accent-soft); color: var(--accent); }
.slot-remove {
  position: absolute; top: 16px; right: 4px;
  width: 18px; height: 18px; border-radius: 6px; font-size: 0.66rem;
  background: var(--surface-3); color: var(--text-3); display: grid; place-items: center;
  opacity: 0; transition: opacity 0.15s;
}
.slot:hover .slot-remove { opacity: 1; }
.slot-remove:hover { color: var(--danger); background: var(--danger-soft); }

.planner-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.planner-actions .btn { flex: 1; min-width: 160px; white-space: normal; }
@media (max-width: 600px) {
  .planner-actions { flex-direction: column; }
  .planner-actions .btn { width: 100%; min-width: 0; }
}

/* ---------- Liste de courses ---------- */
.list-head, .meals-head { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 16px; }
.list-head h2, .meals-head h2 { font-size: 1.5rem; }
.list-count { font-size: 0.8rem; color: var(--text-2); font-weight: 600;
  background: var(--surface); padding: 5px 12px; border-radius: 20px; border: 1px solid var(--border); }

.progress-bar { height: 6px; border-radius: 4px; background: var(--surface-2);
  overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 4px; transition: width 0.3s ease; }

.add-row { display: flex; gap: 8px; margin-bottom: 18px; }
.add-input, .search-input, .form-input {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  font-size: 0.9rem; transition: border-color 0.15s;
}
.add-input:focus, .search-input:focus, .form-input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.add-row .btn { flex-shrink: 0; min-width: 46px; font-size: 1.1rem; }

.aisles { display: flex; flex-direction: column; gap: 18px; }
.aisle {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
}
.aisle-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; font-weight: 600; font-size: 0.95rem;
  font-family: "Fraunces", serif; border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.aisle-icon { font-size: 1.1rem; }
.aisle-count { margin-left: auto; font-size: 0.72rem; color: var(--text-3);
  font-family: "Inter"; font-weight: 600; background: var(--surface-3);
  padding: 2px 8px; border-radius: 10px; }

.list-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-bottom: 1px solid var(--border); transition: opacity 0.2s; cursor: pointer;
}
.list-item:last-child { border-bottom: none; }
.list-item.checked { opacity: 0.5; }
.list-item.checked .item-name { text-decoration: line-through; }
.checkbox {
  width: 24px; height: 24px; flex-shrink: 0; border-radius: 8px;
  border: 2px solid var(--border-2); display: grid; place-items: center;
  font-size: 0.8rem; color: var(--on-accent); transition: all 0.15s; font-weight: 800;
}
.checkbox.on { background: var(--accent); border-color: var(--accent); }
.item-info { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.item-name { font-weight: 600; font-size: 0.9rem; }
.item-qty { font-size: 0.8rem; color: var(--accent); font-weight: 700; }
.item-src { font-size: 0.68rem; color: var(--text-3); width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-src.manual { color: var(--text-3); font-style: italic; }
.item-del {
  width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; font-size: 0.72rem;
  color: var(--text-3); transition: all 0.15s;
}
.item-del:hover { color: var(--danger); background: var(--danger-soft); }

.list-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.list-actions .btn { flex: 1; min-width: 120px; }

/* ---------- Recettes ---------- */
.meals-head .btn { flex-shrink: 0; }
.search-input { margin-bottom: 16px; }

.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  padding: 6px 13px; border-radius: 20px; font-size: 0.76rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: all 0.15s; white-space: nowrap;
}
.chip:hover { border-color: var(--border-2); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.meals-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.meal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  transition: all 0.15s;
}
.meal-card:hover { border-color: var(--border-2); transform: translateY(-2px); box-shadow: var(--shadow); }
.meal-card-top { display: flex; gap: 12px; align-items: center; }
.meal-emoji { font-size: 1.8rem; width: 50px; height: 50px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--warm-soft); border-radius: 14px; }
.meal-meta { min-width: 0; flex: 1; }
.meal-name { display: block; font-weight: 600; font-size: 1.05rem; font-family: "Fraunces", serif; }
.meal-sub { display: block; font-size: 0.72rem; color: var(--text-3); margin-top: 2px; }
.meal-fav {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 10px; font-size: 1.05rem;
  color: var(--text-3); display: grid; place-items: center; transition: all 0.15s;
}
.meal-fav:hover { background: var(--warm-soft); color: var(--warm); }
.meal-fav.on { color: var(--warm); }
.meal-ings { display: flex; flex-wrap: wrap; gap: 5px; }
.ing-chip { font-size: 0.7rem; color: var(--text-2); background: var(--surface-2);
  padding: 3px 8px; border-radius: 8px; border: 1px solid var(--border); }
.meal-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag-chip { font-size: 0.68rem; color: var(--accent); background: var(--accent-soft);
  padding: 3px 8px; border-radius: 8px; font-weight: 600; }
.meal-card-actions { display: flex; gap: 6px; margin-top: auto; }
.meal-card-actions .btn { flex: 1; }

/* ---------- Statistiques ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat-tile {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 16px; text-align: center;
}
.stat-value { font-family: "Fraunces", serif; font-size: 2rem; font-weight: 600; color: var(--accent); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-3); margin-top: 6px; }
.stats-section h3 { font-size: 1.05rem; margin-bottom: 14px; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 200px) 1fr 28px; align-items: center; gap: 12px; }
.bar-label { font-size: 0.85rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; min-width: 6px; border-radius: 4px; background: var(--accent); transition: width 0.3s ease; }
.bar-value { font-size: 0.8rem; font-weight: 700; color: var(--text-2); text-align: right; }
@media (max-width: 480px) {
  .bar-row { grid-template-columns: 90px 1fr 24px; }
}

/* ---------- États vides ---------- */
.empty-state { text-align: center; padding: 50px 20px; display: flex;
  flex-direction: column; align-items: center; gap: 8px; grid-column: 1 / -1; }
.empty-emoji { font-size: 3rem; opacity: 0.75; margin-bottom: 6px; }
.empty-title { font-weight: 600; font-size: 1.15rem; font-family: "Fraunces", serif; }
.empty-hint { color: var(--text-3); font-size: 0.85rem; max-width: 280px; }
.empty-state .btn { margin-top: 12px; }
.muted { color: var(--text-3); }
.center { text-align: center; padding: 30px; }

/* ---------- Modales ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(46, 33, 26, 0.45); backdrop-filter: blur(3px);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; transition: opacity 0.2s;
}
.modal-overlay.show { opacity: 1; }
.modal {
  background: var(--bg-2); width: 100%; max-width: 560px;
  border-radius: 22px 22px 0 0; max-height: 88vh; overflow-y: auto;
  border: 1px solid var(--border); border-bottom: none;
  transform: translateY(30px); transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.modal-overlay.show .modal { transform: translateY(0); }
.modal-header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px; border-bottom: 1px solid var(--border);
  background: var(--bg-2);
}
.modal-header h3 { font-size: 1.2rem; }
.modal-close { width: 32px; height: 32px; border-radius: 10px; font-size: 0.85rem;
  background: var(--surface); color: var(--text-2); display: grid; place-items: center; }
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-footer { display: flex; gap: 10px; padding: 16px 20px;
  border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--bg-2); }
.flex1 { flex: 1; }

@media (min-width: 560px) {
  .modal-overlay { align-items: center; }
  .modal { border-radius: 22px; border-bottom: 1px solid var(--border); }
}
/* La modale Réglages s'étale davantage en largeur pour limiter le scroll interne */
.modal:has(.settings) { max-width: 780px; }

/* Picker */
.picker { padding: 16px 20px 20px; }
.picker .search-input { margin-bottom: 14px; }
.picker .filter-chips { margin-bottom: 14px; }
.picker-recent:empty { display: none; }
.picker-recent-label { font-size: 0.74rem; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 8px; }
.picker-grid-recent { margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px; max-height: 50vh; overflow-y: auto; }
.picker-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  padding: 14px 10px; border-radius: 14px; background: var(--surface);
  border: 1px solid var(--border); transition: all 0.15s;
}
.picker-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.picker-item.selected { border-color: var(--accent); background: var(--accent-soft); }
.picker-emoji { font-size: 1.6rem; }
.picker-name { font-size: 0.8rem; font-weight: 600; line-height: 1.2; }
.picker-serv { font-size: 0.66rem; color: var(--warm); font-weight: 700; }

/* Éditeur recette */
.meal-form { padding: 16px 20px 0; display: flex; flex-direction: column; gap: 8px; }
.form-label { font-size: 0.74rem; font-weight: 600; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.04em; margin-top: 8px; }
.form-row { display: flex; gap: 8px; }
.emoji-input { width: 52px; text-align: center; font-size: 1.3rem; padding: 10px 0;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.meal-fav-toggle {
  flex-shrink: 0; width: 44px; border-radius: 12px; font-size: 1.2rem;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-3);
  transition: all 0.15s;
}
.meal-fav-toggle:hover { border-color: var(--border-2); }
.meal-fav-toggle.on { color: var(--warm); border-color: var(--warm-soft); background: var(--warm-soft); }
.form-input.err { border-color: var(--danger); }
.serv-input { width: 90px; }
.ings-wrap { display: flex; flex-direction: column; gap: 8px; }
.ing-row { display: grid; grid-template-columns: 1fr 60px 84px 1fr 28px; gap: 6px; align-items: center; }
.ing-row .form-input { padding: 9px 10px; font-size: 0.82rem; }
.ing-rm { width: 28px; height: 28px; border-radius: 8px; color: var(--text-3); font-size: 0.72rem; }
.ing-rm:hover { color: var(--danger); background: var(--danger-soft); }
.meal-form > .btn-ghost { align-self: flex-start; margin-top: 4px; }

.confirm { padding: 24px 20px 0; }
.confirm p { font-size: 0.95rem; line-height: 1.5; }

/* Réglages */
.settings {
  padding: 20px; display: grid; grid-template-columns: 1fr; gap: 14px;
  background: var(--bg); border-radius: 0 0 4px 4px;
}
@media (min-width: 560px) {
  .settings { grid-template-columns: 1fr 1fr; padding: 24px; gap: 16px; }
  .settings-block.wide { grid-column: 1 / -1; }
}
.settings-block {
  display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 16px;
}
.settings-block-head { display: flex; align-items: center; gap: 10px; }
.settings-icon {
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center; font-size: 1.05rem;
  background: var(--accent-soft);
}
.settings-block h4 { font-family: "Fraunces", serif; font-size: 1rem; font-weight: 600; }
.settings-hint { font-size: 0.8rem; color: var(--text-3); line-height: 1.4; }
.hidden-file-input { display: none; }
.settings-block .add-row { width: 100%; margin-bottom: 0; }
.settings-block .filter-chips { width: 100%; }
.backup-row { display: flex; gap: 16px; width: 100%; flex-wrap: wrap; }
.backup-col { flex: 1; min-width: 200px; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.templates-list { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.templates-list .muted { font-size: 0.85rem; }
.template-row {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px;
}
.template-name { flex: 1; font-weight: 600; font-size: 0.88rem; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--surface-3); color: var(--text); border: 1px solid var(--border-2);
  padding: 12px 14px 12px 22px; border-radius: 12px; font-weight: 600; font-size: 0.9rem;
  box-shadow: var(--shadow); z-index: 400; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  display: flex; align-items: center; gap: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.toast-undo { color: var(--accent); font-weight: 800; font-size: 0.86rem;
  padding: 4px 10px; border-radius: 8px; }
.toast-undo:hover { background: var(--accent-soft); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .planner-grid { grid-template-columns: 1fr; }
  .day-col { display: grid; grid-template-columns: 90px 1fr 1fr 1fr; gap: 8px; align-items: stretch; }
  .day-head { border-bottom: none; border-right: 1px solid var(--border);
    display: flex; flex-direction: column; justify-content: center; text-align: left;
    padding: 0 8px 0 0; cursor: pointer; position: relative; }
  .day-chevron { display: block; position: absolute; top: 2px; right: -2px;
    font-size: 0.7rem; color: var(--text-3); transition: transform 0.2s; }
  .day-col.expanded .day-chevron { transform: rotate(180deg); color: var(--accent); }
  .day-col .slot { display: none; }
  .day-col.expanded .slot { display: flex; flex-direction: column; }
  .day-col.is-today .day-head { color: var(--accent); }
  .ing-row { grid-template-columns: 1fr 50px 70px 28px; }
  .ing-row .ing-aisle { grid-column: 1 / 4; }
}
@media (max-width: 420px) {
  .brand-text p { display: none; }
  .meals-list { grid-template-columns: 1fr; }
}

/* ---------- Impression (liste de courses) ---------- */
@media print {
  #header, #nav, #offline-banner, .toast, .modal-overlay,
  .planner-actions, .add-row, .list-actions, .search-input, .filter-chips,
  .item-del, .slot-remove, .progress-bar, .install-btn { display: none !important; }
  body { padding-bottom: 0; background: #fff; color: #000; }
  #view { max-width: none; padding: 0; }
  .aisle { border: none; break-inside: avoid; }
  .aisle-head { background: none; border-bottom: 2px solid #000; }
  .list-item { border-bottom: 1px solid #ccc; }
  .checkbox { border-color: #000; }
}
