/* ---------- Polices (embarquées, pour fonctionner hors ligne) ---------- */

@font-face {
  font-family: 'Fraunces';
  src: url('../fonts/fraunces.woff2') format('woff2');
  font-weight: 600 700;
  font-display: swap;
}
@font-face {
  font-family: 'DM Sans';
  src: url('../fonts/dm-sans.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('../fonts/dm-mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'DM Mono';
  src: url('../fonts/dm-mono-500.woff2') format('woff2');
  font-weight: 500;
  font-display: swap;
}

/* ---------- Palette (maquette/*.dc.html) ---------- */

:root {
  --bg: #F4F1EA;
  --surface: #FFFFFF;
  --ink: #1F2A24;
  --ink-soft: #4A564E;
  --muted: #5E6B62;
  --faint: #9AA59D;
  --border: #D9D3C5;
  --divider: #ECE8DE;

  --courses: #2F6B4F;
  --courses-dark: #1F4D38;
  --articles: #B5542A;
  --tendances: #2C5A8C;
  --recettes: #7A4E8E;
  --recettes-dark: #5B3A6B;

  /* Couleur de l'app (Mes recettes : le violet de l'onglet Recettes de Mes courses) */
  --accent: var(--recettes);

  --danger: #B3261E;
  --danger-bg: #FBE9E7;
  --danger-ink: #5C1A14;
  --success-bg: #E2EFE6;
  --promo-bg: #F6E6D9;
  --promo-ink: #8A3F1C;

  --serif: 'Fraunces', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'DM Mono', ui-monospace, monospace;

  /* Marges de sécurité (encoche, barre d'accueil) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);

  color-scheme: light;
}

/* ---------- Base ---------- */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--recettes); }

/* Sur iPhone, un champ en dessous de 16 px fait zoomer la page au focus. */
input, select, textarea { font-size: 16px; }

:focus-visible {
  outline: 2.5px solid var(--ink);
  outline-offset: 2px;
  border-radius: 10px;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

.noscript { padding: 24px; font-family: var(--sans); }

/* ---------- Écrans ---------- */

.screen {
  width: 100%;
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding:
    calc(var(--safe-top) + 8px)
    calc(var(--safe-right) + 20px)
    calc(var(--safe-bottom) + 24px)
    calc(var(--safe-left) + 20px);
  animation: push-in 260ms cubic-bezier(.2, .8, .2, 1);
}

@keyframes push-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .screen { animation: none; }
}

/* ---------- Textes ---------- */

.eyebrow {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.title, .title-small {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  font-optical-sizing: auto;
  line-height: 1.1;
}
.title { font-size: 34px; }
.title-small { font-size: 28px; line-height: 1.15; }
.summary { margin: 0; font-size: 15px; color: var(--ink-soft); }

.section-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- En-tête des sections ---------- */

.section-header { display: flex; flex-direction: column; gap: 6px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: flex-start;
  min-height: 44px;
  padding: 0 8px 0 0;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--recettes);
  text-decoration: none;
  touch-action: manipulation;
}
.back-link:active { color: var(--recettes-dark); }

.section-body {
  flex-grow: 1;
  min-height: 0;
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ---------- Cartes ---------- */

.card {
  padding: 16px;
  background: var(--surface);
  border-radius: 18px;
}

.empty-line { margin: 24px 0; text-align: center; color: var(--muted); }
.empty__title { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
.empty__text { margin: 0; line-height: 1.45; color: var(--ink-soft); }

/* ---------- Barres du haut (fiche, formulaire) ---------- */

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 48px;
}

.top-bar__title { margin: 0; font-size: 16px; font-weight: 600; }

.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 22px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  touch-action: manipulation;
}
.pill-button--accent { border: none; background: var(--accent); color: #FFFFFF; }
.pill-button:disabled { opacity: 0.6; }

.text-button {
  min-height: 44px;
  padding: 0 4px;
  border: none;
  background: none;
  font-size: 15px;
  font-weight: 500;
  color: var(--recettes);
  touch-action: manipulation;
}
.text-button--muted { color: var(--ink-soft); }

/* ---------- Champs ---------- */

.field {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
.field::placeholder { color: var(--muted); opacity: 1; }
.field:focus { outline: none; border-color: var(--ink); }
.field[aria-invalid='true'] { border-color: var(--danger); }

select.field {
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%231F2A24' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

input[type='search']::-webkit-search-cancel-button { -webkit-appearance: none; }

.field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: none;
}
.field-label { padding: 0; font-size: 14px; font-weight: 600; }
.field-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field-error { margin: 0; font-size: 14px; line-height: 1.4; color: var(--danger); }

.form { display: flex; flex-direction: column; gap: 16px; }
.form__note { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }

/* ---------- Liste : recherche, filtres, lignes ---------- */

.toolbar { display: flex; gap: 8px; align-items: center; }
.toolbar .field { flex-grow: 1; padding: 0 16px; }

.icon-button {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  touch-action: manipulation;
}
.icon-button:active { transform: scale(0.96); }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -20px;
  padding: 4px 20px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  position: relative;
  flex-shrink: 0;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  touch-action: manipulation;
}
/* Zone tactile de 44 px autour d'une pastille de 36 px */
.chip::after { content: ''; position: absolute; inset: -4px 0; }
.chip[aria-pressed='true'] { border-color: var(--ink); background: var(--ink); color: #FFFFFF; }

.rows { display: flex; flex-direction: column; gap: 8px; }

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px 14px 10px 10px;
  border-radius: 14px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  touch-action: manipulation;
}
.row:active { background: #FBFAF7; }

/* ---------- Fiche ---------- */

.stack { margin-top: 8px; display: flex; flex-direction: column; gap: 14px; }

.photo-area { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.photo {
  position: relative;
  width: 100%;
  height: 110px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  border-radius: 18px;
  border: 2px dashed var(--faint);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
/* Photo entière (pas recadrée), sur fond blanc */
.photo.has-photo { height: 200px; border: none; background: var(--surface); }
.photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.photo__change {
  position: absolute;
  right: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(31, 42, 36, 0.72);
  color: #FFFFFF;
  font-size: 13px;
}
.photo:has(input:focus-visible) { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.detail-head { display: flex; flex-direction: column; gap: 6px; }
.detail-head .title-small { overflow-wrap: anywhere; }

.card { display: flex; flex-direction: column; gap: 10px; }
.card .section-label { margin: 0; }
.card__text { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }

.button {
  flex-grow: 1;
  min-height: 48px;
  padding: 0 16px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 600;
  touch-action: manipulation;
}
.button--outline { border: 1.5px solid var(--border); background: var(--surface); color: var(--ink); }
.button--danger { border: none; background: var(--danger); color: #FFFFFF; }
.button--danger-outline { border: 1.5px solid var(--danger); background: none; color: var(--danger); }

.confirm {
  padding: 14px;
  border-radius: 14px;
  background: var(--danger-bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.confirm p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--danger-ink); }
.confirm__buttons { display: flex; gap: 8px; }
.confirm .button { min-height: 44px; border-radius: 12px; }

/* ---------- Messages ---------- */

.notice {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--success-bg);
  color: var(--courses-dark);
  font-size: 14px;
  line-height: 1.45;
}
.notice.is-busy { background: var(--surface); color: var(--ink-soft); }

.field-row { display: flex; gap: 8px; }
.text-button--start { align-self: flex-start; padding: 0; }

/* ---------- Lecteur de codes-barres ---------- */

.scanner {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: #000000;
  color: #FFFFFF;
}

.app-footer { margin: auto 0 0; padding-top: 32px; text-align: center; font-size: 13px; line-height: 1.5; color: var(--muted); }
.app-footer p { margin: 0; }

/* ---------- Articles à valider ---------- */

.button--accent { border: none; background: var(--accent); color: #FFFFFF; }
.button:disabled { opacity: 0.6; }

/* ---------- Courses ---------- */

.top-bar--compact { min-height: 44px; }

.chip--tab { min-height: 40px; padding: 0 16px; border-radius: 20px; }
.chip--tab::after { inset: -2px 0; }
.chip[aria-selected='true'] { border-color: var(--ink); background: var(--ink); color: #FFFFFF; }

.suggestions {
  margin: 0;
  padding: 4px;
  list-style: none;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: 0 4px 14px rgba(31, 42, 36, 0.1);
}
.suggestion {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: none;
  border-radius: 10px;
  background: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  text-align: left;
  font-size: 15px;
  font-weight: 600;
}
.suggestion:active { background: var(--bg); }
.suggestion__meta { flex-shrink: 0; font-size: 13px; font-weight: 400; color: var(--muted); }

.items { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }

.item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px 6px 6px;
  border-radius: 14px;
  background: var(--surface);
  transition: opacity 150ms ease;
}

.checkbox {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--faint);
  background: var(--surface);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------- Fenêtres (du bas de l'écran) ---------- */

.sheet { position: fixed; inset: 0; z-index: 20; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 42, 36, 0.4);
  animation: fade-in 180ms ease;
}

.sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  max-width: 480px;
  margin: 0 auto;
  max-height: calc(100dvh - var(--safe-top) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px calc(var(--safe-right) + 20px) calc(var(--safe-bottom) + 20px) calc(var(--safe-left) + 20px);
  border-radius: 22px 22px 0 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: slide-up 240ms cubic-bezier(.2, .8, .2, 1);
}
.sheet__panel--tall { height: calc(100dvh - var(--safe-top) - 24px); }

@keyframes slide-up {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .sheet__panel, .sheet__backdrop { animation: none; }
}

.sheet__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.sheet__title { margin: 0; font-family: var(--serif); font-size: 22px; font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; }

.stepper-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 8px 8px 16px;
  border-radius: 14px;
  background: var(--surface);
}
.stepper { display: flex; align-items: center; gap: 4px; }
.stepper button {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 22px;
  touch-action: manipulation;
}
.stepper span { min-width: 64px; text-align: center; font-size: 17px; font-weight: 600; }

/* ---------- Classement par catégorie ---------- */

.chips--wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 4px 0; }

/* ---------- Saisie d'un achat ---------- */

.button-row { display: flex; gap: 8px; }

/* ---------- Tendances ---------- */

.history { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }

/* ---------- Monnaie (accueil) ---------- */

.currency { position: relative; }

/* ---------- Gestion des catégories ---------- */

.sheet__hint { margin: -4px 0 0; font-size: 14px; line-height: 1.45; color: var(--muted); }

.icon-button--small { width: 40px; height: 40px; border-radius: 12px; }
.icon-button:disabled { opacity: 0.35; }

/* ---------- Recettes ---------- */

.button--dashed {
  min-height: 52px;
  border: 1.5px dashed var(--faint);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.button--big {
  min-height: 56px;
  border-radius: 16px;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.recipe-cards { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.recipe-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-radius: 16px;
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  touch-action: manipulation;
}
.recipe-card > svg { flex-shrink: 0; color: var(--faint); }
.recipe-card__icon {
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.recipe-card__main { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.recipe-card__name { font-size: 17px; font-weight: 600; line-height: 1.25; overflow-wrap: anywhere; }
.recipe-card__meta { font-size: 13px; color: var(--muted); }

.ingredients { padding: 12px; gap: 4px; }
.ingredients__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px 6px; }
.ingredients__hint { font-size: 13px; color: var(--muted); }
.ingredients__list { margin: 0; padding: 0; list-style: none; }

.ingredient {
  width: 100%;
  min-height: 48px;
  padding: 4px;
  border: none;
  border-radius: 10px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  touch-action: manipulation;
}
.ingredient .checkbox { flex-shrink: 0; border-color: var(--accent); background: var(--accent); }
.ingredient.is-owned { opacity: 0.5; }
.ingredient.is-owned .checkbox { border-color: var(--faint); background: var(--surface); }
.ingredient.is-owned .ingredient__name { text-decoration: line-through; }
.ingredient__name { flex-grow: 1; min-width: 0; font-size: 15px; overflow-wrap: anywhere; }
.ingredient__qty { flex-shrink: 0; font-size: 15px; font-weight: 600; }

.recipe-notes { white-space: pre-wrap; font-size: 15px; color: var(--ink); }

.added-banner {
  min-height: 56px;
  padding: 8px 8px 8px 16px;
  border-radius: 16px;
  background: var(--success-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--courses-dark);
}
.added-banner__hint { flex-shrink: 0; font-size: 13px; font-weight: 500; }

/* Formulaire : une ligne par ingrédient (nom, puis quantité et unité) */
.ingredient-rows { margin: 0 0 4px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.ingredient-row {
  padding: 8px;
  border-radius: 14px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.ingredient-row .field { height: 44px; border-radius: 10px; }
.ingredient-row__name { position: relative; }
.ingredient-row__linked {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--success-bg);
  color: var(--courses-dark);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
}
.ingredient-row__amount { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 40px; gap: 6px; align-items: center; }
.ingredient-row .suggestions { box-shadow: none; border: 1.5px solid var(--border); }

.field--area { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.45; resize: vertical; }

/* ---------- Recettes : import, photo, temps ---------- */

.button-row .button--dashed { flex: 1; min-width: 0; padding: 0 10px; font-size: 15px; font-weight: 600; }
.recipe-card__photo { object-fit: cover; background: var(--bg); }
.recipe-photo { width: 100%; height: 200px; border-radius: 20px; object-fit: cover; background: var(--surface); }
.recipe-times { margin: 0; font-size: 14px; color: var(--ink-soft); }
.source-link { align-self: flex-start; min-height: 44px; display: inline-flex; align-items: center; font-size: 14px; font-weight: 600; color: var(--recettes); }
.field-row .pill-button { flex-shrink: 0; min-height: 48px; }

.cost-card__total { margin: 0; font-family: var(--serif); font-size: 26px; font-weight: 700; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.cost-card__per { font-family: var(--sans); font-size: 14px; font-weight: 500; color: var(--ink-soft); }

/* ---------- Glissement des lignes d'articles ---------- */

.button--icon { display: flex; align-items: center; justify-content: center; gap: 8px; }

/* ---------- Réglages et sauvegarde ---------- */

.icon-button--round { width: 44px; height: 44px; border-radius: 22px; }

/* ---------- Compte et synchronisation ---------- */

.account-links { display: flex; flex-direction: column; align-items: flex-start; }
.account-status { margin: 0; font-size: 14px; font-weight: 600; color: var(--courses-dark); }
.choice {
  padding: 14px;
  border-radius: 14px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.choice__title { margin: 0; font-weight: 600; line-height: 1.45; }
.choice .form__note { margin-bottom: 4px; }

.backup-last { margin: 0; font-size: 14px; font-weight: 600; }
.button--file { cursor: pointer; }
.button--file:has(input:focus-visible) { outline: 2.5px solid var(--ink); outline-offset: 2px; }

.backup-reminder {
  margin-top: 28px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1.5px dashed var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
  text-decoration: none;
}
.backup-reminder svg { flex-shrink: 0; color: var(--recettes); }
.backup-reminder strong { color: var(--recettes); }
.section-body .backup-reminder { margin-top: 0; }

/* ---------- Démarrage impossible (voir index.html) ---------- */

.boot-error { display: flex; flex-direction: column; gap: 14px; padding-top: 48px; }
.boot-error .button { flex-grow: 0; }
.boot-error__details {
  margin: 0;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface);
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---------- Prix des lignes de liste ---------- */

.chip--tab svg { margin-left: 2px; vertical-align: -3px; }

/* ---------- Tirer pour actualiser ---------- */

.pull-refresh {
  position: fixed;
  top: calc(var(--safe-top) + 4px);
  left: 50%;
  z-index: 40;
  transform: translate(-50%, -90px);
  padding: 8px 14px;
  border-radius: 20px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 14px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  transition: transform 180ms ease;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}
.pull-refresh[data-state='pull'], .pull-refresh[data-state='ready'] { transition: none; }
.pull-refresh__spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #FFFFFF;
}
.pull-refresh[data-state='busy'] .pull-refresh__spinner { animation: spin 0.8s linear infinite; }
.pull-refresh[data-state='done'] .pull-refresh__spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Grand écran (Mac, iPad à l'horizontale) ---------- */

@media (hover: hover) {
  .row:hover, .suggestion:hover { background: #FBFAF7; }
  .button:hover, .pill-button:hover, .chip:hover, .icon-button:hover { filter: brightness(0.97); }
  .text-button:hover, .back-link:hover { text-decoration: underline; text-underline-offset: 3px; }
  button, a, summary { cursor: pointer; }
}

@media (min-width: 760px) {
  .screen {
    max-width: 760px;
    padding-top: calc(var(--safe-top) + 28px);
    padding-left: calc(var(--safe-left) + 32px);
    padding-right: calc(var(--safe-right) + 32px);
  }
  .title { font-size: 40px; }

  /* Fenêtres : au centre de l'écran plutôt qu'en bas. */
  .sheet { display: flex; align-items: center; justify-content: center; }
  .sheet__panel {
    position: relative;
    bottom: auto !important;
    width: min(540px, calc(100vw - 48px));
    max-height: 86vh;
    border-radius: 22px;
    padding-bottom: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
  }
  .sheet__panel--tall { height: auto; min-height: 60vh; }

  /* Listes d'articles, de recettes, de magasins : sur deux colonnes. */
  .rows, .recipe-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .sheet .rows { grid-template-columns: 1fr; }
}

@media (min-width: 1100px) {
  .screen { max-width: 980px; }
}

/* ---------- Verrouillage par Face ID (lock.js, identique dans les 3 apps) ---------- */

.lock-content { display: contents; }
.is-locked body { overflow: hidden; }
.lock-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--safe-top) + 24px) calc(var(--safe-right) + 28px) calc(var(--safe-bottom) + 24px) calc(var(--safe-left) + 28px);
}
.lock-screen__body { width: 100%; max-width: 360px; display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.lock-screen__icon {
  width: 72px;
  height: 72px;
  border-radius: 36px;
  background: var(--surface);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lock-screen__title { margin: 4px 0 0; font-family: var(--serif); font-size: 30px; font-weight: 700; line-height: 1.1; }
.lock-screen__text { margin: 0 0 12px; color: var(--muted); }
.lock-screen__button { align-self: stretch; flex-grow: 0; }
.lock-screen__note { margin: 0; font-size: 14px; line-height: 1.45; color: var(--ink-soft); }
.lock-screen__reset { display: flex; flex-direction: column; gap: 10px; align-self: stretch; }
.lock-screen__reset .button { flex-grow: 0; }
.lock-screen { cursor: pointer; }

/* ---------- Prix promo ---------- */

:root { --promo-dot: #E09B00; }

/* ---------- Suggestions : mots clés et « déjà dans la liste » ---------- */

.suggestions .suggestion__meta { flex-shrink: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

/* Ligne montrée depuis une suggestion (« déjà dans la liste ») */
@keyframes item-flash {
  0%, 60% { box-shadow: 0 0 0 3px var(--accent); background: var(--success-bg); }
  100% { box-shadow: 0 0 0 0 transparent; }
}

