/* À table — styles de l'application (design system 1.0, direction B « Marché »).
   Toutes les valeurs viennent de tokens.css (variables --at-*) : aucune couleur en dur.
   Mobile d'abord ; ruptures : 600 px (rail 88), 1024 px (barre latérale 264). */

:root {
  --nav-h: 68px;            /* barre flottante : 52 + 2 × 8 */
  --nav-gap: 12px;          /* au-dessus de safe-area-inset-bottom */
  --topbar-h: 64px;
  --nav-offset: calc(var(--nav-h) + var(--nav-gap) + var(--at-safe-bottom) + 12px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-padding-top: calc(var(--topbar-h) + var(--at-safe-top) + 12px);
  /* Le focus clavier n'est jamais masqué par la barre de navigation (WCAG 2.4.11). */
  scroll-padding-bottom: calc(var(--nav-offset) + 56px);
  background: var(--at-bg-canvas);
}
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--at-bg-canvas);
  color: var(--at-text-primary);
  font: var(--at-type-body);
  font-size: 1rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  padding-bottom: var(--nav-offset);
}
img { max-width: 100%; display: block; }
a { color: var(--at-text-link); text-underline-offset: 2px; }
h1, h2, h3 { margin: 0 0 var(--at-space-2); color: var(--at-text-brand); font-family: var(--at-font-display); }
h1 { font: var(--at-type-display-l); letter-spacing: var(--at-tracking-tight); color: var(--at-text-brand); }
h2 { font: var(--at-type-title-2); letter-spacing: -0.01em; color: var(--at-text-brand); }
h3 { font: var(--at-type-title-3); color: var(--at-text-primary); }
p { margin: 0 0 var(--at-space-3); }
small { font-size: 0.875em; }
strong { font-weight: 700; }
code { font-size: 0.9em; background: var(--at-bg-subtle); padding: 0.05em 0.3em; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

/* Focus : anneau terracotta visible partout */
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--at-focus-ring); border-radius: var(--at-radius-xs); }
.btn:focus-visible, .chip:focus-visible, .nav-link:focus-visible, .icon-btn:focus-visible, .fav-btn:focus-visible { border-radius: var(--at-radius-pill); }
.main:focus-visible, h1:focus-visible { box-shadow: none; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -80px; z-index: var(--at-z-modal);
  background: var(--at-action-primary-bg); color: var(--at-action-primary-text);
  padding: 12px 18px; border-radius: var(--at-radius-pill); font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: calc(var(--at-safe-top) + 8px); }

.icon { width: var(--at-icon); height: var(--at-icon); flex: none; }
.logo-mark { width: 40px; height: 40px; flex: none; }

/* ---------- Barre supérieure (écrans secondaires) ---------- */
.topbar {
  position: sticky; top: 0; z-index: var(--at-z-nav);
  display: flex; align-items: center; gap: var(--at-space-3);
  min-height: calc(var(--topbar-h) + var(--at-safe-top));
  padding: var(--at-safe-top) calc(var(--at-page-margin) + var(--at-safe-right)) 0 calc(var(--at-page-margin) - 4px + var(--at-safe-left));
  background: var(--at-bg-canvas);
  transition: background var(--at-duration-base) var(--at-ease-standard), box-shadow var(--at-duration-base);
}
.topbar[data-empty] { display: none; }
.topbar.is-scrolled { box-shadow: 0 1px 0 var(--at-border-default); }
.topbar-title { flex: 1; min-width: 0; margin: 0; font: var(--at-type-title-3); color: var(--at-text-brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Fiche recette : transparente au-dessus de la photo, puis remplie au défilement */
body.has-hero .topbar { position: fixed; left: 0; right: 0; background: transparent; }
body.has-hero .topbar .topbar-title { opacity: 0; transition: opacity var(--at-duration-base); }
body.has-hero .topbar.is-scrolled { background: var(--at-bg-canvas); }
body.has-hero .topbar.is-scrolled .topbar-title { opacity: 1; }
body.has-hero .topbar .icon-btn { background: color-mix(in srgb, var(--at-bg-canvas) 92%, transparent); box-shadow: var(--at-shadow-md); }
body.has-hero .topbar.is-scrolled .icon-btn { box-shadow: none; }

/* ---------- Contenu ---------- */
.main {
  display: block; max-width: var(--at-content-max); margin: 0 auto;
  padding: var(--at-space-4) calc(var(--at-page-margin) + var(--at-safe-right)) var(--at-space-8) calc(var(--at-page-margin) + var(--at-safe-left));
}
body.no-topbar .main { padding-top: calc(var(--at-space-6) + var(--at-safe-top)); }
body.has-hero .main { padding-top: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--at-space-3); margin-bottom: var(--at-space-5); }
.page-head h1 { margin: 0; }
.page-head .over { display: block; font: var(--at-type-body); font-weight: 600; color: var(--at-text-muted); margin-bottom: 2px; }
.lead { font: var(--at-type-body-l); color: var(--at-text-secondary); }
.muted { color: var(--at-text-muted); }
.hint { font: var(--at-type-body-s); color: var(--at-text-muted); margin: var(--at-space-1) 0 var(--at-space-3); }
.hint .icon { width: 1em; height: 1em; vertical-align: -0.15em; }
.overline, .eyebrow { display: block; font: var(--at-type-overline); letter-spacing: var(--at-tracking-overline); text-transform: uppercase; color: var(--at-text-muted); }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: var(--at-space-3); margin: 0 0 var(--at-space-3); }
.section-title h2 { margin: 0; font-size: 1.25rem; }
.section-title a { font: var(--at-type-label); }
.loading { display: flex; gap: var(--at-space-3); align-items: center; justify-content: center; padding: var(--at-space-16) 0; color: var(--at-text-muted); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--at-sauge-100); border-top-color: var(--at-action-primary-bg); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Navigation principale ---------- */
.nav {
  position: fixed; z-index: var(--at-z-nav);
  left: calc(16px + var(--at-safe-left)); right: calc(16px + var(--at-safe-right));
  bottom: calc(var(--nav-gap) + var(--at-safe-bottom));
  padding: 8px; border-radius: var(--at-radius-pill);
  background: var(--at-bg-brand); box-shadow: var(--at-shadow-lg);
}
.nav-brand, .nav-extra { display: none; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav-list { display: flex; gap: 4px; }
.nav-list li { flex: 1 1 0; min-width: 0; display: flex; }
.nav-list li:has([aria-current="page"]) { flex: 2.2 1 0; }
.nav-link {
  position: relative; flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 52px; padding: 0 10px; border-radius: var(--at-radius-pill);
  color: var(--at-sauge-100); text-decoration: none; font: var(--at-type-label);
  transition: background var(--at-duration-base) var(--at-ease-standard);
}
.nav-link:active { transform: scale(0.98); }
.nav-link[aria-current="page"] { background: var(--at-surface-sauge); color: var(--at-text-primary); }
.nav-list .nav-link:not([aria-current="page"]) .nav-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--at-radius-pill);
  background: var(--at-action-accent-bg); color: var(--at-action-accent-text);
  font: var(--at-type-caption); font-weight: 700; line-height: 22px; text-align: center; font-variant-numeric: tabular-nums;
}
/* Téléphone : la pastille reste posée sur l'icône, même pour l'onglet actif (place limitée). */
.nav-list .nav-badge { position: absolute; top: -4px; right: 4px; min-width: 20px; height: 20px; line-height: 20px; padding: 0 5px; font-size: 11px; }
.nav-list .nav-link:not([aria-current="page"]) .nav-badge { top: 2px; right: auto; left: calc(50% + 2px); }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--at-space-2);
  min-height: 48px; padding: 0 22px; border: 0; border-radius: var(--at-radius-pill);
  background: var(--at-action-secondary-bg); color: var(--at-action-secondary-text);
  font: var(--at-type-label); font-size: 0.9375rem; text-decoration: none; cursor: pointer; text-align: center;
  transition: background var(--at-duration-fast), transform var(--at-duration-fast);
}
.btn:hover { background: var(--at-action-secondary-bg-hover); }
.btn:active { transform: scale(0.98); }
.btn:disabled, .btn[aria-disabled="true"] { background: var(--at-action-disabled-bg); color: var(--at-action-disabled-text); cursor: not-allowed; transform: none; }
.btn-primary { background: var(--at-action-primary-bg); color: var(--at-action-primary-text); }
.btn-primary:hover { background: var(--at-action-primary-bg-hover); }
.btn-primary:active { background: var(--at-action-primary-bg-pressed); }
.btn-accent { background: var(--at-action-accent-bg); color: var(--at-action-accent-text); }
.btn-accent:hover { background: var(--at-action-accent-bg-hover); }
.btn-outline { background: transparent; color: var(--at-text-brand); box-shadow: inset 0 0 0 1.5px var(--at-border-strong); }
.btn-outline:hover { background: var(--at-bg-subtle); }
.btn-quiet { background: var(--at-bg-subtle); color: var(--at-text-primary); }
.btn-quiet:hover { background: var(--at-border-default); }
.btn-danger { background: var(--at-error-text); color: var(--at-neutre-0); }
.btn-danger:hover { filter: brightness(0.92); background: var(--at-error-text); }
.btn-danger-soft { background: var(--at-error-bg); color: var(--at-error-text); }
.btn-lg { min-height: 56px; padding: 0 28px; font-size: 1rem; }
.btn-xl { min-height: var(--at-touch-cook); padding: 0 28px; font-size: 1.125rem; flex: 1; }
.btn-block { width: 100%; }
.btn.is-active { background: var(--at-action-primary-bg); color: var(--at-action-primary-text); }
.btn .pill { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: var(--at-radius-pill); background: var(--at-surface-raised); color: var(--at-text-brand); font-size: 0.8rem; line-height: 22px; }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--at-space-2); justify-content: flex-end; margin-top: var(--at-space-2); }
.btn-row-start { justify-content: flex-start; }
.btn-stack { display: flex; flex-direction: column; gap: var(--at-space-2); margin-top: var(--at-space-2); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: var(--at-touch); height: var(--at-touch); border-radius: var(--at-radius-pill); border: 0;
  background: var(--at-bg-subtle); color: var(--at-text-brand); cursor: pointer; text-decoration: none;
}
.icon-btn:hover { background: var(--at-border-default); }
.icon-btn-plain { background: transparent; }
.icon-btn-lg { width: 56px; height: 56px; }
.icon-danger { color: var(--at-error-text); }
.link-btn { border: 0; background: none; color: var(--at-text-link); font: var(--at-type-label); text-decoration: underline; cursor: pointer; min-height: 44px; padding: 0 4px; }
.rot-90 { transform: rotate(90deg); }
.file-btn { cursor: pointer; }
.file-btn:focus-within, .file-action:focus-within { box-shadow: var(--at-focus-ring); }
.fab {
  position: fixed; z-index: calc(var(--at-z-nav) - 1);
  right: calc(var(--at-page-margin) + var(--at-safe-right)); bottom: calc(var(--nav-offset) + 4px);
  display: inline-flex; align-items: center; gap: var(--at-space-2); min-height: 56px; padding: 0 22px 0 18px;
  border: 0; border-radius: var(--at-radius-pill); background: var(--at-action-accent-bg); color: var(--at-action-accent-text);
  font: var(--at-type-label); font-size: 1rem; box-shadow: var(--at-shadow-lg); cursor: pointer;
}
.fab:hover { background: var(--at-action-accent-bg-hover); }

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; font: var(--at-type-label); color: var(--at-text-primary); }
.field > span small { display: block; font: var(--at-type-body-s); color: var(--at-text-muted); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea {
  width: 100%; min-height: var(--at-touch); padding: 10px 14px; font: var(--at-type-body); font-size: 1rem;
  border: 1.5px solid var(--at-border-strong); border-radius: var(--at-radius-sm);
  background: var(--at-surface-raised); color: var(--at-text-primary);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--at-border-focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--at-border-focus) 35%, transparent); border-radius: var(--at-radius-sm); }
input:disabled, select:disabled { background: var(--at-action-disabled-bg); color: var(--at-action-disabled-text); }
textarea { resize: vertical; line-height: 1.5; }
::placeholder { color: var(--at-text-muted); opacity: 1; }
/* Cases à cocher : carré 28 px, rayon 8, coche blanc cassé sur vert */
input[type="checkbox"]:not([role="switch"]) {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: var(--at-radius-xs); border: 2px solid var(--at-text-secondary);
  background: var(--at-surface-raised) center / 18px no-repeat;
}
input[type="checkbox"]:not([role="switch"]):checked {
  border-color: var(--at-action-primary-bg); background-color: var(--at-action-primary-bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FBFAF5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
input[type="radio"] { width: 22px; height: 22px; accent-color: var(--at-action-primary-bg); flex: none; margin: 0; }
/* Interrupteur */
input[type="checkbox"][role="switch"] {
  appearance: none; -webkit-appearance: none; margin: 0; flex: none; cursor: pointer; position: relative;
  width: 52px; height: 32px; border-radius: var(--at-radius-pill); background: var(--at-border-strong); transition: background var(--at-duration-base);
}
input[type="checkbox"][role="switch"]::after {
  content: ""; position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--at-neutre-0); box-shadow: var(--at-shadow-sm); transition: transform var(--at-duration-base) var(--at-ease-standard);
}
input[type="checkbox"][role="switch"]:checked { background: var(--at-action-primary-bg); }
input[type="checkbox"][role="switch"]:checked::after { transform: translateX(20px); }
input[type="checkbox"][role="switch"]:focus-visible { border-radius: var(--at-radius-pill); }

.field-inline { flex-direction: row; align-items: center; justify-content: space-between; gap: var(--at-space-4); min-height: 64px; border-bottom: 1px solid var(--at-border-default); }
.field-inline:last-child { border-bottom: 0; }
.field-inline select { width: auto; min-width: 140px; }
.fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.fieldset.card { padding: var(--at-space-5); }
.fieldset legend { font: var(--at-type-title-3); color: var(--at-text-brand); padding: 0; margin-bottom: var(--at-space-3); }
.card > legend { float: left; width: 100%; }
.card > legend + * { clear: both; }
.stack { display: flex; flex-direction: column; gap: var(--at-space-4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--at-space-3); }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--at-space-2); }
.choice {
  display: flex; align-items: center; gap: var(--at-space-3); min-height: var(--at-touch); padding: 8px 14px;
  border-radius: var(--at-radius-pill); background: var(--at-action-secondary-bg); color: var(--at-action-secondary-text);
  cursor: pointer; font: var(--at-type-label);
}
.choice:has(input:checked) { background: var(--at-action-primary-bg); color: var(--at-action-primary-text); }
.choice:has(input:focus-visible) { box-shadow: var(--at-focus-ring); }
.choice input[type="checkbox"] { width: 22px; height: 22px; border-color: currentColor; }
.choice input[type="checkbox"]:checked { border-color: var(--at-surface-raised); }
/* Choix rapides en pastilles (feuille « Ajouter au menu ») */
.seg { display: grid; gap: 6px; }
.seg-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.seg-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg label { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; border-radius: var(--at-radius-md); background: var(--at-bg-subtle); font: var(--at-type-label); font-size: 0.8125rem; cursor: pointer; text-align: center; line-height: 1.2; }
.seg-slots label { min-height: var(--at-touch-min); border-radius: var(--at-radius-pill); background: var(--at-action-secondary-bg); color: var(--at-action-secondary-text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { background: var(--at-action-primary-bg); color: var(--at-action-primary-text); }
.seg label:has(input:focus-visible) { box-shadow: var(--at-focus-ring); }
.check-inline { display: inline-flex; align-items: center; gap: var(--at-space-3); min-height: var(--at-touch-min); cursor: pointer; font-weight: 600; }

/* Recherche */
.search-row { display: flex; gap: var(--at-space-2); align-items: center; margin-bottom: var(--at-space-3); }
.search-field { position: relative; flex: 1; display: block; }
.search-field .icon { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--at-text-muted); pointer-events: none; }
.search-field input { padding-left: 48px !important; border-radius: var(--at-radius-pill) !important; border-color: transparent !important; background: var(--at-bg-subtle) !important; }
.search-field input:focus-visible { border-color: var(--at-border-focus) !important; }

/* Puces de filtre */
.chips { display: flex; gap: var(--at-space-2); overflow-x: auto; padding: 4px var(--at-page-margin) 12px; margin: 0 calc(-1 * var(--at-page-margin)) var(--at-space-2); scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 18px; border-radius: var(--at-radius-pill);
  border: 0; background: var(--at-action-secondary-bg); color: var(--at-action-secondary-text);
  font: var(--at-type-label); cursor: pointer; scroll-snap-align: start; white-space: nowrap;
}
.chip:hover { background: var(--at-action-secondary-bg-hover); }
.chip[aria-pressed="true"] { background: var(--at-action-primary-bg); color: var(--at-action-primary-text); }
.chip-small { min-height: 40px; padding: 0 14px; font-size: 0.8125rem; }
.chips-static { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tag { display: inline-flex; align-items: center; padding: 5px 12px; border-radius: var(--at-radius-pill); background: var(--at-bg-subtle); color: var(--at-text-secondary); font: var(--at-type-caption); }
.tag-green { background: var(--at-success-bg); color: var(--at-success-text); }
.tag-warn { background: var(--at-surface-raised); color: var(--at-warning-text); box-shadow: inset 0 0 0 1.5px var(--at-warning-icon); font-weight: 700; }
.badge { display: inline-block; padding: 2px 9px; border-radius: var(--at-radius-pill); background: var(--at-action-primary-bg); color: var(--at-action-primary-text); font: var(--at-type-caption); font-size: 0.75rem; font-weight: 700; vertical-align: 0.1em; }
.badge-green { background: var(--at-success-bg); color: var(--at-success-text); }
.badge-soft { background: var(--at-bg-subtle); color: var(--at-text-muted); }
.badge-warn { background: var(--at-warning-bg); color: var(--at-warning-text); }
.badge-accent { background: var(--at-action-accent-bg); color: var(--at-action-accent-text); }

/* ---------- Cartes ---------- */
.card { background: var(--at-surface-card); border-radius: var(--at-radius-xl); }
.card-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--at-space-3); }
.recipe-card { position: relative; overflow: hidden; display: flex; flex-direction: column; border-radius: var(--at-radius-xl); background: var(--at-surface-card); }
.card-link { display: flex; flex-direction: column; flex: 1; color: inherit; text-decoration: none; border-radius: var(--at-radius-xl); }
.card-link:focus-visible { border-radius: var(--at-radius-xl); box-shadow: inset 0 0 0 3px var(--at-border-focus); }
.card-media { position: relative; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--at-photo-ble); }
.card-media img, .hero-media img, .photo-preview img, .thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: fade-in var(--at-duration-base) var(--at-ease-standard); }
@keyframes fade-in { from { opacity: 0; } }
.card-icon { width: 42%; height: 42%; color: var(--at-vert-700); opacity: 0.38; stroke-width: 1.4; }
.has-photo > .card-icon, .has-photo > .hero-icon { display: none; }
.card-body { padding: 12px 14px 16px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card-title { margin: 0; font: var(--at-type-title-3); font-size: 1.0625rem; line-height: 1.2; color: var(--at-text-primary);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin: auto 0 0; font: var(--at-type-body-s); font-weight: 600; color: var(--at-text-secondary); }
.fav-btn {
  position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: var(--at-radius-pill); border: 0;
  background: color-mix(in srgb, var(--at-neutre-25) 92%, transparent); color: var(--at-vert-700);
  display: flex; align-items: center; justify-content: center; cursor: pointer; box-shadow: var(--at-shadow-md);
}
.fav-btn.is-on, .fav-toggle.is-on { color: var(--at-terracotta-600); }
.fav-btn.is-on .icon, .fav-toggle.is-on .icon { fill: currentColor; }
.result-count { font: var(--at-type-body-s); color: var(--at-text-muted); margin: 0 0 var(--at-space-2); }
/* Carte vedette (accueil) */
.feature-row { display: flex; gap: var(--at-space-3); overflow-x: auto; margin: 0 calc(-1 * var(--at-page-margin)); padding: 2px var(--at-page-margin) 8px; scroll-snap-type: x mandatory; scrollbar-width: none; list-style: none; }
.feature-row::-webkit-scrollbar { display: none; }
.feature-row > li { flex: none; width: min(78vw, 300px); scroll-snap-align: start; }
.feature { display: flex; flex-direction: column; height: 100%; border-radius: var(--at-radius-xl); overflow: hidden; background: var(--at-sauge-300); color: var(--at-neutre-900); text-decoration: none; }
.feature.tone-b { background: var(--at-terracotta-200); }
.feature-media { position: relative; height: 150px; background: var(--at-photo-ble); display: flex; align-items: flex-start; padding: 12px; }
.feature.tone-b .feature-media { background: var(--at-photo-peche); }
.feature-media .card-icon { position: absolute; inset: 0; margin: auto; width: 34%; height: 50%; }
.feature-tag { position: relative; z-index: 1; padding: 6px 12px; border-radius: var(--at-radius-pill); background: var(--at-neutre-25); color: var(--at-vert-700); font: var(--at-type-caption); font-weight: 700; }
.feature-body { padding: 14px 16px 18px; display: flex; flex-direction: column; gap: 4px; }
.feature-body h3 { margin: 0; font: var(--at-type-title-3); color: var(--at-neutre-900); }
.feature-body span { font: var(--at-type-body-s); font-weight: 600; color: var(--at-neutre-700); }
.feature.tone-b .feature-body span { color: var(--at-terracotta-800); }
.feature-empty { display: flex; flex-direction: column; gap: var(--at-space-2); align-items: flex-start; padding: var(--at-space-5); border-radius: var(--at-radius-xl); background: var(--at-surface-card); }
.feature-empty p { margin: 0; }
/* Accueil */
.home-block { margin-bottom: var(--at-space-8); }
.head-actions { display: flex; gap: var(--at-space-2); }
.muted-on-brand { color: var(--at-action-primary-text); opacity: 0.8; font: var(--at-type-body-s); font-weight: 600; flex: none !important; }
@media (min-width: 600px) { .home-settings { display: none; } }
/* Liens pilules (accueil) */
.pill-links { display: flex; flex-direction: column; gap: 10px; }
.pill-link {
  display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 0 18px 0 20px; border-radius: var(--at-radius-pill);
  background: var(--at-bg-subtle); color: var(--at-text-brand); text-decoration: none; font: var(--at-type-label); font-size: 1rem;
}
.pill-link > span:first-of-type { flex: 1; }
.pill-link.is-primary { background: var(--at-action-primary-bg); color: var(--at-action-primary-text); }
.tile-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--at-space-3); }
.tile { display: flex; flex-direction: column; gap: 8px; color: var(--at-text-primary); text-decoration: none; }
.tile .thumb { position: relative; height: 96px; border-radius: var(--at-radius-lg); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.tile .thumb .card-icon { width: 34%; height: 60%; }
.tile strong { font: var(--at-type-label); font-size: 0.9375rem; line-height: 1.25; }

/* Teintes par catégorie (fonds « photo » en attendant une vraie photo) */
.tone-petit-dejeuner { background: var(--at-photo-ble); }
.tone-entree { background: var(--at-photo-herbe); }
.tone-salade { background: var(--at-sauge-200); }
.tone-soupe { background: var(--at-photo-peche); }
.tone-plat-principal { background: var(--at-photo-ble); }
.tone-accompagnement { background: var(--at-photo-herbe); }
.tone-collation { background: var(--at-terracotta-200); }
.tone-dessert { background: var(--at-photo-peche); }

/* États vides et avis */
.empty { text-align: center; padding: var(--at-space-10) var(--at-space-4); display: flex; flex-direction: column; align-items: center; gap: var(--at-space-1); }
.empty-icon { width: 72px; height: 72px; padding: 18px; border-radius: 50%; background: var(--at-surface-sauge); color: var(--at-text-brand); margin-bottom: var(--at-space-3); }
.empty h2 { font: var(--at-type-title-2); color: var(--at-text-brand); margin: 0 0 4px; }
.empty p { max-width: 34ch; color: var(--at-text-secondary); margin: 0; }
.empty .btn { margin-top: var(--at-space-4); }
.notice { display: flex; gap: var(--at-space-3); align-items: flex-start; padding: 14px 18px; border-radius: var(--at-radius-lg); background: var(--at-info-bg); color: var(--at-info-text); font: var(--at-type-body-s); }
.notice .icon { flex: none; margin-top: 1px; }
.notice-warn { background: var(--at-warning-bg); color: var(--at-warning-text); }
.notice-warn > .icon { color: var(--at-warning-icon); }
.notice-error { background: var(--at-error-bg); color: var(--at-error-text); display: block; }
.disclaimer { display: flex; gap: var(--at-space-2); font: var(--at-type-body-s); color: var(--at-text-muted); margin-top: var(--at-space-6); }
.disclaimer .icon { width: 18px; height: 18px; margin-top: 2px; }
/* Avertissements allergènes : 3 niveaux (icône + texte, jamais la couleur seule) */
.allergy-1 { display: inline-flex; align-items: center; gap: var(--at-space-2); padding: 10px 16px; border-radius: var(--at-radius-pill); background: var(--at-success-bg); color: var(--at-text-brand); font: var(--at-type-label); }
.allergy-1 .icon { width: 20px; height: 20px; }
.allergy-2 { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--at-radius-lg); background: var(--at-warning-bg); color: var(--at-warning-text); font: var(--at-type-body-s); }
.allergy-2 .dot { width: 36px; height: 36px; flex: none; border-radius: 50%; background: var(--at-warning-icon); color: var(--at-neutre-0); display: flex; align-items: center; justify-content: center; }
.allergy-2 .dot .icon { width: 20px; height: 20px; }
.allergy-2 h2 { color: inherit; font: var(--at-type-label); font-size: 0.9375rem; margin: 0 0 4px; }
.allergy-3 { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--at-radius-lg); background: var(--at-error-bg); color: var(--at-error-text); font: var(--at-type-body-s); }

/* ---------- Fiche recette ---------- */
.recipe { display: flex; flex-direction: column; gap: var(--at-space-5); }
.recipe-hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--at-space-4); }
.hero-media {
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  height: calc(280px + var(--at-safe-top)); margin: 0 calc(-1 * (var(--at-page-margin) + var(--at-safe-right))) 0 calc(-1 * (var(--at-page-margin) + var(--at-safe-left)));
  border-radius: 0 0 var(--at-radius-xl) var(--at-radius-xl);
}
.hero-icon { width: 30%; height: 50%; color: var(--at-vert-700); opacity: 0.35; stroke-width: 1.2; margin-top: var(--at-safe-top); }
.hero-text { min-width: 0; display: flex; flex-direction: column; gap: var(--at-space-2); align-items: flex-start; }
.recipe-title { margin: 0; font: var(--at-type-title-1); letter-spacing: -0.01em; color: var(--at-text-brand); }
.recipe-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font: var(--at-type-body-s); font-weight: 600; color: var(--at-text-secondary); margin: 0; }
.recipe-meta span { display: inline-flex; align-items: center; gap: 6px; }
.recipe-meta .icon { width: 18px; height: 18px; }
.action-bar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--at-space-2); }
.action-bar .btn-accent { grid-column: 1 / -1; }
.action-bar .btn { padding: 0 14px; }
.section { background: var(--at-surface-raised); border: 1.5px solid var(--at-border-default); border-radius: var(--at-radius-lg); padding: var(--at-space-5); }
.section > h2 { display: flex; align-items: center; gap: 8px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--at-space-2); margin-bottom: var(--at-space-2); }
.section-head h2 { margin: 0; }
.callout-calm { background: var(--at-success-bg); border-color: transparent; }
.bullets { margin: 0; padding-left: 1.2rem; }
.bullets li { margin: 4px 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { padding: 10px 0; border-bottom: 1px solid var(--at-border-default); }
.plain-list li:last-child { border-bottom: 0; }
.big-list li { font: var(--at-type-body-l); padding: 14px 0; }
.line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.recipe-columns { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--at-space-5); }

/* Sélecteur de portions — fiche recette (pastille sauge 64) */
.stepper { display: inline-flex; align-items: center; justify-content: space-between; gap: var(--at-space-2); min-height: 64px; padding: 0 8px 0 20px; border-radius: var(--at-radius-pill); background: var(--at-surface-sauge); color: var(--at-text-primary); }
.stepper-label { font: var(--at-type-label); font-size: 0.9375rem; margin-right: var(--at-space-2); }
.stepper-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--at-neutre-25); color: var(--at-vert-700); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.stepper-btn.is-plus { background: var(--at-vert-700); color: var(--at-neutre-25); }
.stepper-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.stepper-value { min-width: 36px; text-align: center; font-family: var(--at-font-display); font-weight: 700; font-size: 1.5rem; font-variant-numeric: tabular-nums; }

/* Ingrédients : quantités en gras, chiffres tabulaires, alignées sur une colonne */
.check-list { list-style: none; margin: 0; padding: 0; }
.check-row { display: grid; grid-template-columns: 28px 88px minmax(0, 1fr); align-items: baseline; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--at-border-default); cursor: pointer; min-height: 52px; }
.check-list li:last-child .check-row { border-bottom: 0; }
.check-row input { align-self: center; }
.check-qty { font-weight: 700; font-variant-numeric: tabular-nums; }
.check-name small { color: var(--at-text-muted); }
.check-row.is-done .check-qty, .check-row.is-done .check-name { color: var(--at-text-muted); text-decoration: line-through; }
.warn-dot { display: inline-flex; color: var(--at-warning-icon); vertical-align: middle; }
.warn-dot .icon { width: 18px; height: 18px; }

/* Étapes : pastille numérotée sur fond lin */
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--at-space-2); }
.step-card { display: flex; gap: var(--at-space-4); padding: 16px 18px; border-radius: var(--at-radius-lg); background: var(--at-surface-card); }
.step-num {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--at-action-primary-bg); color: var(--at-action-primary-text);
  display: flex; align-items: center; justify-content: center; font-family: var(--at-font-display); font-weight: 700; font-size: 1.125rem;
}
.step-card.is-done .step-num { background: var(--at-surface-sauge); color: var(--at-text-primary); }
.step-num .icon { width: 20px; height: 20px; }
.step-body { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; min-width: 0; }
.step-text { margin: 0; line-height: 1.55; }
.step-card.is-done .step-text { text-decoration: line-through; color: var(--at-text-muted); }
.timer-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px; border: 0; border-radius: var(--at-radius-pill); background: var(--at-surface-peche); color: var(--at-warning-text); font: var(--at-type-label); cursor: pointer; }
.timer-chip .icon { width: 18px; height: 18px; }

/* ---------- Mode cuisine (thème sombre, cibles 72 px) ---------- */
body.is-fullscreen { padding: 0; }
body.is-fullscreen .topbar, body.is-fullscreen .nav, body.is-fullscreen .fab { display: none; }
body.is-fullscreen .main { max-width: 900px; padding-top: calc(12px + var(--at-safe-top)); padding-bottom: calc(12px + var(--at-safe-bottom)); }
.cook { min-height: calc(100dvh - 24px - var(--at-safe-top) - var(--at-safe-bottom)); display: flex; flex-direction: column; gap: var(--at-space-4); }
.cook-head { display: flex; align-items: center; gap: var(--at-space-3); }
.cook-head .icon-btn { width: var(--at-touch-cook); height: var(--at-touch-cook); }
.cook-head .btn { min-height: var(--at-touch-cook); }
.cook-title { flex: 1; min-width: 0; }
.cook-title h1 { font: var(--at-type-title-3); margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--at-text-primary); }
.wake-status { font: var(--at-type-caption); color: var(--at-text-muted); margin: 0; }
.wake-status[data-state="on"] { color: var(--at-success-text); }
.cook-progress { display: flex; gap: 6px; }
.cook-progress span { flex: 1; height: 6px; border-radius: 3px; background: var(--at-surface-card); }
.cook-progress span.is-on { background: var(--at-action-primary-bg); }
.cook-body { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: var(--at-space-5); padding: 8px 4px; }
.cook-count { font: var(--at-type-overline); letter-spacing: var(--at-tracking-overline); text-transform: uppercase; color: var(--at-text-brand); margin: 0; }
.cook-step { font: var(--at-type-cook-step); color: var(--at-text-primary); margin: 0; }
.cook-timer { display: flex; flex-wrap: wrap; align-items: center; gap: var(--at-space-4); padding: var(--at-space-4) var(--at-space-5); border-radius: var(--at-radius-xl); background: var(--at-surface-card); }
.cook-timer output { font: var(--at-type-cook-timer); letter-spacing: var(--at-tracking-tight); font-variant-numeric: tabular-nums; color: var(--at-text-primary); flex: 1; }
.cook-timer .btn { min-height: var(--at-touch-cook); }
.cook-timer.is-done { background: var(--at-action-accent-bg); }
.cook-timer.is-done output { color: var(--at-action-accent-text); }
.cook-nav { display: flex; gap: var(--at-space-3); }

/* ---------- Menu de la semaine ---------- */
.page-intro { margin-bottom: var(--at-space-5); }
.page-intro .lead { margin-bottom: var(--at-space-3); }
.days { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--at-space-4); }
.day { padding: var(--at-space-4) var(--at-space-4) var(--at-space-2); border-radius: var(--at-radius-xl); background: var(--at-surface-card); }
.day.is-today { background: var(--at-surface-raised); box-shadow: inset 0 0 0 2px var(--at-action-primary-bg); }
.day-title { font: var(--at-type-title-2); display: flex; align-items: center; gap: var(--at-space-2); margin-bottom: var(--at-space-2); }
.slot { padding: var(--at-space-2) 0; border-top: 1px solid var(--at-border-default); }
.slot-title { font: var(--at-type-overline); letter-spacing: var(--at-tracking-overline); text-transform: uppercase; color: var(--at-text-muted); margin: 0 0 4px; }
.slot-title small { text-transform: none; letter-spacing: 0; font-weight: 500; }
.meals { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.meal { display: flex; align-items: center; gap: 6px; min-height: 56px; padding: 6px 6px 6px 8px; border-radius: var(--at-radius-md); background: var(--at-surface-raised); }
.meal-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; color: var(--at-text-primary); text-decoration: none; font: var(--at-type-label); font-size: 0.9375rem; padding: 4px 0; min-height: 44px; }
.meal-name span { overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.meal-name.is-missing { color: var(--at-error-text); }
.meal-icon { width: 40px; height: 40px; padding: 9px; border-radius: var(--at-radius-sm); background: var(--at-photo-herbe); color: var(--at-vert-700); flex: none; }
.mini-stepper { display: flex; align-items: center; gap: 2px; background: var(--at-action-secondary-bg); border-radius: var(--at-radius-pill); }
.mini-stepper button { width: 40px; height: 44px; border: 0; border-radius: var(--at-radius-pill); background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--at-action-secondary-text); }
.mini-stepper button:disabled { opacity: 0.35; }
.mini-stepper .icon { width: 18px; height: 18px; }
.mini-stepper > span { min-width: 16px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.meal .icon-btn { width: 44px; height: 44px; background: transparent; }
.add-btn {
  display: flex; align-items: center; gap: var(--at-space-2); width: 100%; min-height: var(--at-touch-min); padding: 0 14px; margin: 6px 0 4px;
  border: 1.5px dashed var(--at-border-strong); border-radius: var(--at-radius-pill); background: transparent; color: var(--at-text-brand); font: var(--at-type-label); cursor: pointer;
}
.add-btn:hover { background: var(--at-action-secondary-bg); }
.add-btn .icon { width: 18px; height: 18px; }

/* Sélecteur et listes d'actions (feuilles) */
.pick-list { list-style: none; margin: var(--at-space-2) 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pick { display: flex; align-items: center; gap: var(--at-space-3); width: 100%; min-height: 64px; padding: 8px 12px 8px 8px; border: 0; border-radius: var(--at-radius-lg); background: var(--at-surface-card); text-align: left; cursor: pointer; color: var(--at-text-primary); }
.pick:hover { background: var(--at-action-secondary-bg); }
.pick-icon { width: 48px; height: 48px; padding: 11px; border-radius: var(--at-radius-md); background: var(--at-photo-herbe); color: var(--at-vert-700); }
.pick-text { flex: 1; display: flex; flex-direction: column; }
.pick-text strong { font: var(--at-type-label); font-size: 0.9375rem; }
.pick-text small { color: var(--at-text-muted); }
.pick-fav { color: var(--at-terracotta-600); }
.pick-fav .icon { fill: currentColor; width: 18px; height: 18px; }
.action-list { display: flex; flex-direction: column; gap: 6px; }
.action-item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 60px; padding: 10px 16px;
  border: 0; border-radius: var(--at-radius-lg); background: var(--at-surface-card); color: var(--at-text-primary);
  font: var(--at-type-label); font-size: 0.9375rem; text-align: left; text-decoration: none; cursor: pointer;
}
.action-item:hover { background: var(--at-action-secondary-bg); }
.action-item > span { flex: 1; display: flex; flex-direction: column; }
.action-item small { font: var(--at-type-body-s); color: var(--at-text-muted); }
.action-item > .icon:first-child { color: var(--at-text-brand); }
.action-danger, .action-danger > .icon:first-child { color: var(--at-error-text); }

/* ---------- Courses ---------- */
.shop-head { padding: var(--at-space-5); margin-bottom: var(--at-space-4); display: flex; flex-direction: column; gap: var(--at-space-3); }
.shop-progress p { margin: 0 0 8px; font-weight: 600; }
.bar { height: 10px; border-radius: 5px; background: var(--at-surface-raised); overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--at-action-primary-bg); border-radius: 5px; transition: width var(--at-duration-slow) var(--at-ease-standard); }
.sources { display: flex; flex-wrap: wrap; gap: 6px; }
.source { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 4px 4px 4px 14px; border-radius: var(--at-radius-pill); background: var(--at-surface-raised); font: var(--at-type-body-s); font-weight: 600; }
.source .icon { width: 18px; height: 18px; color: var(--at-text-brand); }
.source a { font-weight: 700; padding-right: 10px; min-height: 36px; display: inline-flex; align-items: center; }
.source-x { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--at-text-secondary); }
.source-x .icon { width: 18px; height: 18px; }
.aisle { margin-bottom: var(--at-space-4); border-radius: var(--at-radius-lg); background: var(--at-surface-raised); border: 1.5px solid var(--at-border-default); }
.aisle-title {
  position: sticky; top: 0; z-index: 5; margin: 0; border-radius: var(--at-radius-lg) var(--at-radius-lg) 0 0;
  display: flex; align-items: center; justify-content: space-between; gap: var(--at-space-2); min-height: 52px; padding: 0 20px;
  background: var(--at-action-secondary-bg); color: var(--at-action-secondary-text); font: var(--at-type-label); font-size: 0.9375rem;
}
.aisle-title .count { font: var(--at-type-caption); }
.shop-list { list-style: none; margin: 0; padding: 0; }
.shop-item { display: flex; align-items: center; gap: 4px; padding-right: 12px; border-bottom: 1px solid var(--at-border-default); }
.shop-item:last-child { border-bottom: 0; }
.shop-check { flex: 1; display: flex; gap: var(--at-space-4); align-items: center; padding: 10px 6px 10px 20px; cursor: pointer; min-height: var(--at-row-shopping); min-width: 0; }
.shop-main { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.shop-name { font-size: 1.0625rem; font-weight: 600; }
.shop-meta, .shop-uses { font: var(--at-type-caption); font-weight: 500; color: var(--at-text-muted); }
.shop-buy { align-self: flex-start; margin: 4px 0 2px; padding: 5px 12px; border-radius: var(--at-radius-pill); background: var(--at-bg-subtle); font: var(--at-type-label); font-size: 0.8125rem; }
.shop-warn { display: flex; gap: 6px; font: var(--at-type-caption); font-weight: 500; color: var(--at-warning-text); }
.shop-warn .icon { width: 16px; height: 16px; margin-top: 1px; color: var(--at-warning-icon); flex: none; }
.shop-item.is-done .shop-name { text-decoration: line-through; color: var(--at-text-muted); }
.shop-item.is-done .shop-buy, .shop-item.is-done .shop-meta, .shop-item.is-done .shop-uses, .shop-item.is-done .shop-warn { opacity: 0.6; }
.shop-item .chip-small { flex: none; }
.main:has(.fab) { padding-bottom: 112px; }
.at-home { padding: var(--at-space-4) var(--at-space-5); margin-top: var(--at-space-2); }
.at-home summary { cursor: pointer; font: var(--at-type-label); min-height: 32px; }
.share-text { font-family: ui-monospace, Menlo, monospace; font-size: 0.85rem; }

/* ---------- Réglages / administration ---------- */
.settings-group { padding: var(--at-space-5); margin-bottom: var(--at-space-4); }
.settings-group > h2 { margin-bottom: var(--at-space-2); }
.settings-group .action-item { background: var(--at-surface-raised); }
.kv { display: flex; justify-content: space-between; gap: var(--at-space-3); border-bottom: 1px solid var(--at-border-default); padding: 10px 0; margin: 0; }
.danger-zone { background: var(--at-error-bg); }
.danger-zone h2 { color: var(--at-error-text); }
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: var(--at-space-4) 0; padding: 4px; background: var(--at-bg-subtle); border-radius: var(--at-radius-pill); scrollbar-width: none; }
.tab { flex: 1 0 auto; text-align: center; padding: 0 16px; border-radius: var(--at-radius-pill); text-decoration: none; color: var(--at-text-secondary); font: var(--at-type-label); min-height: 44px; display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.tab[aria-current="page"] { background: var(--at-action-primary-bg); color: var(--at-action-primary-text); }
.admin-list { list-style: none; margin: 0 0 var(--at-space-4); padding: 0; background: var(--at-surface-raised); border: 1.5px solid var(--at-border-default); border-radius: var(--at-radius-lg); overflow: hidden; }
.admin-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px 12px; border-bottom: 1px solid var(--at-border-default); }
.admin-row:last-child { border-bottom: 0; }
.admin-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--at-space-3); color: inherit; text-decoration: none; min-height: 52px; }
.admin-main > span { display: flex; flex-direction: column; min-width: 0; }
.admin-main small { color: var(--at-text-muted); }
.admin-actions { display: flex; gap: 4px; }
.admin-actions .icon-btn { width: 44px; height: 44px; background: transparent; }
.editor .card { padding: var(--at-space-5); }
.ing-edit-list { list-style: none; margin: 0 0 var(--at-space-3); padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ing-edit { display: flex; gap: 6px; padding: var(--at-space-3); border-radius: var(--at-radius-lg); background: var(--at-surface-raised); }
.ing-edit-grid { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: var(--at-space-2); min-width: 0; }
.ing-name, .ing-note, .ing-label { grid-column: 1 / -1; }
.ing-edit-actions { display: flex; flex-direction: column; }
.ing-edit-actions .icon-btn { width: 44px; height: 44px; background: transparent; }
.photo-edit { display: grid; grid-template-columns: 120px 1fr; gap: var(--at-space-4); align-items: start; }
.photo-preview { position: relative; aspect-ratio: 1; border-radius: var(--at-radius-md); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.sticky-actions {
  position: sticky; bottom: calc(var(--nav-offset) + 8px); z-index: 6;
  display: flex; justify-content: flex-end; gap: var(--at-space-2); padding: 10px; border-radius: var(--at-radius-pill);
  background: var(--at-surface-raised); box-shadow: var(--at-shadow-lg);
}

/* ---------- Feuilles (téléphone) et modales (≥ 600) ---------- */
.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: 100%; max-width: 100%; max-height: 88dvh;
  border-radius: var(--at-radius-xl) var(--at-radius-xl) 0 0; background: var(--at-bg-canvas); color: var(--at-text-primary); box-shadow: var(--at-shadow-lg);
}
.sheet::backdrop { background: rgba(30, 42, 34, 0.45); }
.sheet[open] { animation: sheet-in var(--at-duration-slow) var(--at-ease-standard); }
@keyframes sheet-in { from { transform: translateY(32px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet-inner { display: flex; flex-direction: column; max-height: 88dvh; }
.sheet-grab { align-self: center; width: 40px; height: 5px; border-radius: var(--at-radius-pill); background: var(--at-border-strong); margin-top: 10px; }
.sheet-head { display: flex; align-items: center; gap: var(--at-space-2); padding: 8px 12px 6px 20px; }
.sheet-head h2 { flex: 1; margin: 0; font: var(--at-type-title-2); color: var(--at-text-primary); }
.sheet-body { padding: 6px 20px calc(22px + var(--at-safe-bottom)); overflow-y: auto; overscroll-behavior: contain; }
body:has(.sheet[open]) { overflow: hidden; }

/* ---------- Notifications ---------- */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(var(--nav-offset) + 4px); z-index: var(--at-z-toast);
  display: flex; align-items: center; gap: var(--at-space-3); max-width: 560px; min-height: 60px; margin: 0 auto; padding: 8px 8px 8px 20px;
  border-radius: var(--at-radius-pill); background: var(--at-neutre-900); color: var(--at-neutre-25); box-shadow: var(--at-shadow-lg);
  transform: translateY(16px); opacity: 0; pointer-events: none; transition: transform var(--at-duration-base) var(--at-ease-standard), opacity var(--at-duration-base);
}
.toast.is-visible { transform: none; opacity: 1; }
/* Seuls les boutons de la notification captent le toucher : elle ne bloque jamais ce qu'elle recouvre. */
.toast.is-visible button { pointer-events: auto; }
.toast > span { flex: 1; font: var(--at-type-body); font-size: 0.9375rem; font-weight: 600; }
.toast-error { background: var(--at-rouge-100); color: var(--at-rouge-700); }
.toast-alarm { background: var(--at-terracotta-600); color: var(--at-neutre-0); border-radius: var(--at-radius-xl); }
.toast-btn { border: 0; background: transparent; color: var(--at-terracotta-400); font: var(--at-type-label); font-size: 0.9375rem; padding: 0 18px; border-radius: var(--at-radius-pill); min-height: 44px; cursor: pointer; white-space: nowrap; }
.toast-error .toast-btn, .toast-alarm .toast-btn { background: var(--at-neutre-0); color: var(--at-rouge-700); }
.toast-close { border: 0; background: none; color: inherit; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }
body.is-fullscreen .toast { bottom: calc(var(--at-safe-bottom) + 100px); }
/* Jamais par-dessus le bouton flottant « Ajouter un article » */
body:has(.fab) .toast { bottom: calc(var(--nav-offset) + 72px); }

/* ---------- Tablette : rail 88 ---------- */
@media (min-width: 600px) {
  body { padding-bottom: 0; padding-left: calc(var(--at-rail) + var(--at-safe-left)); }
  html { scroll-padding-bottom: 24px; }
  .nav {
    top: 0; bottom: 0; left: 0; right: auto; width: calc(var(--at-rail) + var(--at-safe-left)); border-radius: 0;
    padding: calc(16px + var(--at-safe-top)) 8px calc(16px + var(--at-safe-bottom)) calc(8px + var(--at-safe-left));
    background: var(--at-bg-subtle); box-shadow: none; display: flex; flex-direction: column; gap: var(--at-space-4); overflow-y: auto;
  }
  .nav-brand { display: flex; justify-content: center; align-items: center; min-height: 56px; color: var(--at-text-brand); text-decoration: none; --logo-a: var(--at-text-brand); --logo-leaf: var(--at-warning-icon); border-radius: var(--at-radius-md); }
  .nav-brand-word { display: none; }
  .nav-list { flex-direction: column; gap: var(--at-space-1); }
  .nav-list li, .nav-list li:has([aria-current="page"]) { flex: none; }
  .nav-link { flex-direction: column; gap: 4px; height: auto; min-height: 64px; padding: 8px 2px; border-radius: var(--at-radius-md); color: var(--at-text-secondary); font: var(--at-type-caption); font-size: 0.75rem; }
  .nav-link .icon { width: 56px; height: 32px; padding: 4px 16px; border-radius: var(--at-radius-pill); }
  .nav-link[aria-current="page"] { background: transparent; color: var(--at-text-brand); }
  .nav-link[aria-current="page"] .icon { background: var(--at-surface-sauge); color: var(--at-text-primary); }
  .nav-list .nav-link:not([aria-current="page"]) .nav-label { position: static; width: auto; height: auto; clip: auto; overflow: hidden; }
  .nav-list .nav-link .nav-badge, .nav-list .nav-link:not([aria-current="page"]) .nav-badge { position: absolute; top: 2px; right: 8px; left: auto; min-width: 20px; height: 20px; line-height: 20px; padding: 0 5px; font-size: 11px; }
  .nav-extra { display: flex; flex-direction: column; gap: var(--at-space-1); margin-top: auto; }
  .fab { bottom: calc(24px + var(--at-safe-bottom)); }
  .toast { bottom: calc(24px + var(--at-safe-bottom)); left: calc(var(--at-rail) + 24px); }
  body:has(.fab) .toast { bottom: calc(96px + var(--at-safe-bottom)); }
  .sticky-actions { bottom: 16px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--at-space-4); }
  .feature-row > li { width: 300px; }
  .tile-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .action-bar { grid-template-columns: auto auto auto; justify-content: start; }
  .action-bar .btn-accent { grid-column: auto; }
  .hero-media { height: calc(320px + var(--at-safe-top)); }
  body.has-hero .topbar { left: calc(var(--at-rail) + var(--at-safe-left)); }
  .days { display: flex; overflow-x: auto; gap: var(--at-space-4); padding-bottom: var(--at-space-3); scroll-snap-type: x proximity; }
  .days > .day { flex: none; width: 320px; scroll-snap-align: start; }
  .sheet { margin: auto; width: min(480px, calc(100% - 32px)); border-radius: var(--at-radius-xl); max-height: 84vh; }
  .sheet-wide { width: min(680px, calc(100% - 32px)); }
  .sheet-grab { display: none; }
  .ing-edit-grid { grid-template-columns: 2fr 1fr 1fr; }
  .ing-name { grid-column: 1 / -1; }
  .ing-note, .ing-label { grid-column: span 1; }
  .chips { margin: 0 0 var(--at-space-2); padding-left: 2px; padding-right: 2px; flex-wrap: wrap; overflow: visible; }
  .feature-row { margin: 0; padding-left: 0; padding-right: 0; }
}

/* ---------- Ordinateur : barre latérale 264 ---------- */
@media (min-width: 1024px) {
  body { padding-left: calc(var(--at-sidebar) + var(--at-safe-left)); }
  .nav { width: calc(var(--at-sidebar) + var(--at-safe-left)); padding: calc(24px + var(--at-safe-top)) 16px 24px calc(16px + var(--at-safe-left)); }
  .nav-brand { justify-content: flex-start; gap: 10px; padding: 0 12px; margin-bottom: var(--at-space-4); }
  .nav-brand .logo-mark { width: 44px; height: 44px; }
  .nav-brand-word { display: inline; font-family: var(--at-font-display); font-weight: 700; font-size: 1.75rem; letter-spacing: -0.03em; color: var(--at-text-brand); }
  .nav-link { flex-direction: row; justify-content: flex-start; gap: 14px; min-height: 52px; padding: 0 16px; border-radius: var(--at-radius-pill); font: var(--at-type-label); font-size: 1rem; }
  .nav-link .icon { width: var(--at-icon); height: var(--at-icon); padding: 0; background: none !important; }
  .nav-link[aria-current="page"] { background: var(--at-surface-sauge); color: var(--at-text-primary); }
  .nav-list .nav-link .nav-badge, .nav-list .nav-link:not([aria-current="page"]) .nav-badge { position: static; margin-left: auto; min-width: 24px; height: 24px; line-height: 24px; padding: 0 8px; font-size: 13px; }
  .nav-extra { border-top: 1.5px solid var(--at-border-default); padding-top: var(--at-space-4); }
  .toast { left: calc(var(--at-sidebar) + 24px); }
  body.has-hero .topbar { left: calc(var(--at-sidebar) + var(--at-safe-left)); }
  .main { padding-top: var(--at-space-6); }
  .recipe-hero { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: center; gap: var(--at-space-8); }
  .hero-media { margin: calc(var(--topbar-h) + var(--at-safe-top)) 0 0; height: auto; aspect-ratio: 4 / 3; border-radius: var(--at-radius-xl); }
  .hero-icon { margin-top: 0; }
  .recipe-columns { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; }
  .recipe-columns > .section:first-child { position: sticky; top: calc(var(--topbar-h) + 16px); }
  .days { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); overflow: visible; }
  .days > .day { width: auto; }
}
@media (min-width: 1440px) {
  .days { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--at-space-3); }
  .days > .day { padding: var(--at-space-3); }
  .meal { flex-wrap: wrap; }
  .meal-name { flex-basis: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .nav, .toast, .action-bar, .fav-btn, .btn, .icon-btn, .fab { display: none !important; }
  body { padding: 0; background: #fff; }
}
