/* =====================================================================
   WASAFATI — Design system
   Direction : "carnet de cuisine chaleureux" — papier crème, paprika,
   safran, titres éditoriaux (Fraunces), interface ronde (Nunito).
   ===================================================================== */

/* ---------- Polices (auto-hébergées, marchent hors ligne) ---------- */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/fraunces-latin-soft-normal.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-display: swap;
  font-weight: 100 900;
  src: url('../fonts/fraunces-latin-soft-italic.woff2') format('woff2-variations');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('../fonts/nunito-latin-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-display: swap;
  font-weight: 200 1000;
  src: url('../fonts/nunito-latin-ext-wght-normal.woff2') format('woff2-variations');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  /* Marque (tirées du logo) */
  --paprika-50: #FFF2EC;
  --paprika-100: #FFDDCF;
  --paprika-200: #FDBCA3;
  --paprika-300: #F69373;
  --paprika-400: #EC6C44;
  --paprika-500: #E4572E;
  --paprika-600: #C8431D;
  --paprika-700: #A23416;
  --paprika-800: #7C2913;
  --saffron-100: #FEEDC2;
  --saffron-200: #FCDB88;
  --saffron-300: #F8C54B;
  --saffron-400: #F3A712;
  --saffron-500: #D98F00;
  --saffron-700: #8A5A00;
  --cream-50: #FFFCF6;
  --cream-100: #FFF7E8;
  --cream-200: #FFF1D4;
  --cream-300: #F6E4C0;
  --cream-400: #EAD3A6;
  --ink-900: #2B2D42;
  --ink-700: #45475D;
  --ink-600: #575A72;
  --ink-500: #6E7088;
  --ink-300: #B0B1C0;
  --olive-500: #5B7553;
  --olive-100: #E4EDDC;

  /* Sémantique (clair) */
  --bg: var(--cream-200);
  --bg-elev: var(--cream-100);
  --surface: #FFFDF8;
  --surface-2: var(--cream-100);
  --surface-3: var(--cream-300);
  --text: var(--ink-900);
  --text-2: var(--ink-600);
  --text-3: var(--ink-500);
  --border: #EADBBE;
  --border-strong: #DCC69C;
  --primary: var(--paprika-600);
  --primary-hover: var(--paprika-700);
  --primary-soft: var(--paprika-50);
  --primary-text: var(--paprika-700);
  --on-primary: #FFFFFF;
  --accent: var(--saffron-400);
  --accent-soft: var(--saffron-100);
  --success: #3E7B4A;
  --success-soft: #E2F0E2;
  --danger: #B42318;
  --danger-soft: #FDE8E6;
  --warning: var(--saffron-700);
  --focus: 0 0 0 3px rgba(228, 87, 46, 0.35);

  /* Logo */
  --logo-red: #D94B26;
  --logo-yellow: #F2A516;
  --logo-bg: var(--bg);

  /* Typo */
  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-ui: 'Nunito', 'Noto Sans Arabic', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  --fs-3xl: clamp(2rem, 1.4rem + 2.6vw, 3rem);

  /* Espacements (grille 4/8) */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px;
  --s-6: 24px; --s-8: 32px; --s-10: 40px; --s-12: 48px; --s-16: 64px;

  /* Rayons — volontairement variés */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* Ombres chaudes */
  --sh-1: 0 1px 2px rgba(92, 40, 16, 0.06), 0 1px 1px rgba(92, 40, 16, 0.04);
  --sh-2: 0 6px 16px -6px rgba(92, 40, 16, 0.16), 0 2px 4px rgba(92, 40, 16, 0.05);
  --sh-3: 0 18px 40px -16px rgba(92, 40, 16, 0.28), 0 4px 10px rgba(92, 40, 16, 0.06);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.7);

  /* Mouvement */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --t-fast: 150ms;
  --t-med: 240ms;

  /* Calques */
  --z-sticky: 20;
  --z-nav: 30;
  --z-fab: 35;
  --z-drawer: 40;
  --z-modal: 50;
  --z-toast: 60;
  --z-cook: 55;
  --z-splash: 70;

  /* Mise en page */
  --sidebar-w: 264px;
  --tabbar-h: 68px;
  --topbar-h: 60px;
  --content-max: 1180px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  color-scheme: light;
}

[data-theme='dark'] {
  --bg: #17120E;
  --bg-elev: #1E1813;
  --surface: #221B15;
  --surface-2: #2A221B;
  --surface-3: #3A2F25;
  --text: #FFF1D4;
  --text-2: #D9C9AB;
  --text-3: #AE9F85;
  --border: #3A3027;
  --border-strong: #4D4033;
  --primary: var(--paprika-400);
  --primary-hover: var(--paprika-300);
  --primary-soft: rgba(236, 108, 68, 0.14);
  --primary-text: var(--paprika-300);
  --on-primary: #1B0F08;
  --accent: var(--saffron-300);
  --accent-soft: rgba(243, 167, 18, 0.15);
  --success: #7FC48A;
  --success-soft: rgba(127, 196, 138, 0.14);
  --danger: #FF8A7A;
  --danger-soft: rgba(255, 138, 122, 0.14);
  --warning: var(--saffron-300);
  --logo-red: #E8592F;
  --logo-yellow: #F5B12A;
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --sh-2: 0 8px 20px -8px rgba(0, 0, 0, 0.6);
  --sh-3: 0 20px 44px -16px rgba(0, 0, 0, 0.7);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-ui);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
/* Grain papier */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .2 0 0 0 0 .1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
[data-theme='dark'] body::before { opacity: 0.07; }

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--primary-text); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; font-weight: 700; }
h1, h2, .display { font-family: var(--font-display); font-variation-settings: 'SOFT' 100; letter-spacing: -0.01em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-xs); }
::selection { background: var(--saffron-200); color: var(--ink-900); }
[hidden] { display: none !important; }

.icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-sm { width: 18px; height: 18px; }
.icon-xs { width: 15px; height: 15px; }
.icon-lg { width: 28px; height: 28px; }
.icon-xl { width: 40px; height: 40px; stroke-width: 1.6; }
.icon-fill { fill: currentColor; }

.sr-only {
  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: fixed;
  top: -100px; left: 12px;
  z-index: 100;
  background: var(--ink-900);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--r-sm);
}
.skip-link:focus { top: calc(12px + var(--safe-top)); }

/* ---------- Coque de l'appli ---------- */
#app { position: relative; z-index: 2; }
.shell { min-height: 100dvh; }
.main-col { min-width: 0; }
.page {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) calc(var(--tabbar-h) + var(--safe-bottom) + var(--s-8));
  outline: none;
}
.page-enter { animation: pageIn 360ms var(--ease-out) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* Barre du haut (mobile/tablette) */
.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  min-height: calc(var(--topbar-h) + var(--safe-top));
  padding: var(--safe-top) var(--s-4) 0;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--t-med);
}
.topbar.is-scrolled { border-bottom-color: var(--border); }
.topbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.topbar-brand .logo-mark { width: 34px; height: 34px; }
.topbar-brand strong { font-family: var(--font-display); font-size: 1.3rem; letter-spacing: -0.02em; }
.topbar-title { font-weight: 800; font-size: var(--fs-lg); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; gap: var(--s-1); }

/* Barre d'onglets (mobile) */
.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-nav);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: end;
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0 var(--s-2) var(--safe-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(1.5) blur(18px);
  -webkit-backdrop-filter: saturate(1.5) blur(18px);
  border-top: 1px solid var(--border);
}
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--tabbar-h);
  min-width: 44px;
  color: var(--text-3);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  transition: color var(--t-fast);
  position: relative;
}
.tab .icon { width: 24px; height: 24px; transition: transform var(--t-med) var(--ease-spring); }
.tab.is-active { color: var(--primary-text); }
.tab.is-active .icon { transform: translateY(-1px); }
.tab.is-active::before {
  content: '';
  position: absolute;
  top: 8px;
  width: 44px; height: 30px;
  border-radius: var(--r-pill);
  background: var(--primary-soft);
  z-index: -1;
  animation: tabPill 260ms var(--ease-spring);
}
@keyframes tabPill { from { transform: scale(0.6); opacity: 0; } }
.tab-fab {
  justify-self: center;
  align-self: center;
  width: 58px; height: 58px;
  margin-bottom: 14px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(145deg, var(--paprika-500), var(--paprika-700));
  box-shadow: 0 10px 22px -8px rgba(162, 52, 22, 0.65), var(--sh-inset);
  text-decoration: none;
  transition: transform var(--t-med) var(--ease-spring), box-shadow var(--t-med);
}
.tab-fab:active { transform: scale(0.94); }
.tab-fab .icon { width: 28px; height: 28px; stroke-width: 2.4; }

/* Barre latérale (ordinateur) */
.sidebar { display: none; }

@media (min-width: 768px) {
  .page { padding: var(--s-6) var(--s-8) calc(var(--tabbar-h) + var(--safe-bottom) + var(--s-10)); }
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); width: min(560px, calc(100% - 48px)); bottom: calc(14px + var(--safe-bottom)); height: var(--tabbar-h); padding: 0 var(--s-3); border: 1px solid var(--border); border-radius: 24px; box-shadow: var(--sh-3); }
}

@media (min-width: 1024px) {
  .shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); }
  .tabbar, .topbar { display: none; }
  .page { padding: var(--s-8) var(--s-10) var(--s-16); }
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: var(--s-2);
    position: sticky;
    top: 0;
    height: 100dvh;
    padding: var(--s-6) var(--s-4);
    border-right: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 60%, transparent);
  }
  .sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; text-decoration: none; color: var(--text); }
  .sidebar-brand .logo-mark { width: 44px; height: 44px; }
  .sidebar-brand strong { font-family: var(--font-display); font-size: 1.6rem; letter-spacing: -0.02em; }
  .sidebar-brand:hover .lm-leaf { animation: leafWiggle 700ms var(--ease-out); }
  .side-link {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 46px;
    padding: 0 14px;
    border-radius: var(--r-md);
    color: var(--text-2);
    text-decoration: none;
    font-weight: 700;
    transition: background var(--t-fast), color var(--t-fast);
  }
  .side-link:hover { background: var(--surface-2); color: var(--text); }
  .side-link.is-active { background: var(--primary-soft); color: var(--primary-text); }
  .side-link .badge { margin-left: auto; }
  .sidebar-cta { margin: var(--s-3) 0 var(--s-4); }
  .sidebar-label { font-size: var(--fs-xs); font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-3); padding: var(--s-4) 14px var(--s-1); }
  .sidebar-user {
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
  }
  .sidebar-user:hover { border-color: var(--border-strong); }
  .sidebar-user > span:not(.avatar) { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
  .sidebar-user small { color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- Boutons ---------- */
.btn {
  --btn-bg: var(--surface);
  --btn-fg: var(--text);
  --btn-bd: var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--btn-bd);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.005em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary {
  --btn-bg: var(--primary);
  --btn-fg: var(--on-primary);
  --btn-bd: transparent;
  box-shadow: 0 8px 18px -10px rgba(162, 52, 22, 0.7), var(--sh-inset);
}
.btn-primary:hover { --btn-bg: var(--primary-hover); }
.btn-accent { --btn-bg: var(--accent); --btn-fg: var(--ink-900); --btn-bd: transparent; }
.btn-accent:hover { --btn-bg: var(--saffron-300); }
.btn-soft { --btn-bg: var(--primary-soft); --btn-fg: var(--primary-text); --btn-bd: transparent; }
.btn-ghost { --btn-bg: transparent; --btn-bd: transparent; }
.btn-ghost:hover { --btn-bg: var(--surface-2); }
.btn-danger { --btn-bg: var(--danger-soft); --btn-fg: var(--danger); --btn-bd: transparent; }
.btn-block { width: 100%; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: 0.85rem; border-radius: var(--r-sm); }
.btn-lg { min-height: 54px; padding: 0 24px; font-size: 1.02rem; border-radius: var(--r-lg); }
.btn-icon { width: 44px; min-height: 44px; padding: 0; border-radius: var(--r-md); }
.btn-icon.btn-sm { width: 38px; min-height: 38px; }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2.5px solid currentColor;
  border-color: var(--btn-fg) transparent var(--btn-fg) transparent;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.link-btn { background: none; border: 0; padding: 0; color: var(--primary-text); font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--s-4); }
.label { font-weight: 800; font-size: 0.9rem; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label small { font-weight: 600; color: var(--text-3); }
.hint { font-size: var(--fs-sm); color: var(--text-3); }
.error-text { font-size: var(--fs-sm); color: var(--danger); font-weight: 700; }
.input, .select, .textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px; /* évite le zoom sur iPhone */
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 0.85; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--paprika-400); box-shadow: var(--focus); }
.input[aria-invalid='true'] { border-color: var(--danger); }
.textarea { min-height: 110px; resize: vertical; line-height: 1.55; }
.select {
  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='%236E7088' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.input-group > .input { padding-left: 44px; }
.input-group > .input-action { position: absolute; right: 4px; }
.form-row { display: grid; gap: var(--s-3); grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* Recherche XL */
.search-xl { position: relative; }
.search-xl .input { min-height: 56px; padding-left: 50px; border-radius: var(--r-lg); font-size: 1.02rem; box-shadow: var(--sh-1); }
.search-xl > .icon { position: absolute; left: 17px; top: 50%; transform: translateY(-50%); color: var(--text-3); }
.search-xl .btn { position: absolute; right: 6px; top: 6px; min-height: 44px; }

/* Contrôle segmenté */
.segmented {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--text-2);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--sh-1); }
.segmented input:focus-visible + span { box-shadow: var(--focus); }

/* Interrupteur */
.switch { position: relative; display: inline-flex; width: 50px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: var(--r-pill); background: var(--surface-3); transition: background var(--t-med); }
.switch span::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: var(--sh-1);
  transition: transform var(--t-med) var(--ease-spring);
}
.switch input:checked + span { background: var(--success); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }

/* ---------- Puces ---------- */
.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 calc(var(--s-4) * -1); padding: 2px var(--s-4); scroll-snap-type: x proximity; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 14px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-weight: 800;
  font-size: 0.86rem;
  white-space: nowrap;
  cursor: pointer;
  scroll-snap-align: start;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.is-active, .chip[aria-pressed='true'] { background: var(--ink-900); border-color: var(--ink-900); color: var(--cream-200); }
[data-theme='dark'] .chip.is-active, [data-theme='dark'] .chip[aria-pressed='true'] { background: var(--cream-200); border-color: var(--cream-200); color: var(--ink-900); }
.chip .icon { width: 17px; height: 17px; }
.chip-remove { display: grid; place-items: center; width: 22px; height: 22px; margin-right: -6px; border: 0; border-radius: 50%; background: transparent; color: inherit; }
.chip-remove:hover { background: var(--surface-3); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.01em;
}
.tag .icon { width: 14px; height: 14px; }
.tag-primary { background: var(--primary-soft); color: var(--primary-text); }
.tag-accent { background: var(--accent-soft); color: var(--warning); }
.tag-success { background: var(--success-soft); color: var(--success); }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-primary); font-size: 0.72rem; font-weight: 900; }

/* ---------- Cartes & sections ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-1);
}
.card-pad { padding: var(--s-5); }
@media (min-width: 768px) { .card-pad { padding: var(--s-6); } }
.section { margin-top: var(--s-10); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-4); margin-bottom: var(--s-4); }
.section-title { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 700; display: flex; align-items: center; gap: 10px; }
.section-title em { font-style: italic; color: var(--primary-text); font-weight: 600; }
.section-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: var(--fs-sm); color: var(--primary-text); text-decoration: none; white-space: nowrap; }
.section-link:hover { text-decoration: underline; }
.page-head { margin-bottom: var(--s-6); }
.page-head h1 { font-size: var(--fs-2xl); }
.page-head p { color: var(--text-2); margin-top: 6px; max-width: 60ch; }
.eyebrow { font-size: var(--fs-xs); font-weight: 900; text-transform: uppercase; letter-spacing: 0.12em; color: var(--primary-text); display: inline-flex; align-items: center; gap: 6px; }
.squiggle { position: relative; white-space: nowrap; }
.squiggle::after {
  content: '';
  position: absolute;
  left: -2%; right: -2%; bottom: -0.18em;
  height: 0.38em;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M2 8 C 20 2, 30 11, 48 6 S 80 2, 96 7 S 112 6, 118 4' fill='none' stroke='%23F3A712' stroke-width='4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
  z-index: -1;
}
.divider { height: 1px; background: var(--border); margin: var(--s-6) 0; border: 0; }

/* ---------- Accueil ---------- */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  padding: var(--s-6) var(--s-5) var(--s-5);
  border-radius: var(--r-xl);
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(243, 167, 18, 0.35), transparent 55%),
    radial-gradient(90% 80% at 0% 100%, rgba(228, 87, 46, 0.18), transparent 60%),
    var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--sh-2);
}
.hero-mark { position: absolute; right: -36px; top: -30px; width: 210px; opacity: 0.16; z-index: -1; transform: rotate(12deg); }
.hero-date { font-size: var(--fs-sm); font-weight: 800; color: var(--text-3); text-transform: capitalize; }
.hero h1 { font-size: var(--fs-3xl); margin-top: 4px; max-width: 16ch; }
.hero h1 em { font-style: italic; font-weight: 500; color: var(--primary-text); }
.hero .search-xl { margin-top: var(--s-5); max-width: 560px; }
@media (min-width: 768px) {
  .hero { padding: var(--s-10) var(--s-10) var(--s-8); }
  .hero-mark { width: 320px; right: -20px; top: -40px; }
}

.quick-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); margin-top: var(--s-5); }
@media (min-width: 768px) { .quick-grid { grid-template-columns: repeat(4, 1fr); gap: var(--s-4); } }
.quick {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--s-3);
  padding: var(--s-4);
  min-height: 118px;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
  overflow: hidden;
  transition: border-color var(--t-med), box-shadow var(--t-med), transform var(--t-med) var(--ease-out);
}
.quick:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); }
.quick:active { transform: scale(0.985); }
.quick-icon { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: #fff; }
.quick-icon .icon { width: 24px; height: 24px; }
.quick strong { font-weight: 900; font-size: 1rem; line-height: 1.2; }
.quick small { color: var(--text-3); font-weight: 700; font-size: 0.8rem; line-height: 1.3; }
.quick .icon-arrow { position: absolute; right: 14px; top: 16px; color: var(--text-3); width: 18px; height: 18px; transition: transform var(--t-med) var(--ease-out), color var(--t-med); }
.quick:hover .icon-arrow { transform: translate(2px, -2px); color: var(--text); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s-3); }
@media (min-width: 768px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: var(--s-4) var(--s-5); border-radius: var(--r-md); background: var(--surface); border: 1px dashed var(--border-strong); }
.stat b { display: block; font-family: var(--font-display); font-size: 2rem; line-height: 1.1; font-weight: 700; }
.stat span { color: var(--text-3); font-weight: 800; font-size: var(--fs-sm); display: flex; align-items: center; gap: 6px; }

.daily {
  display: grid;
  grid-template-columns: 1fr;
  overflow: hidden;
  border-radius: var(--r-xl);
  background: var(--ink-900);
  color: var(--cream-200);
  text-decoration: none;
  box-shadow: var(--sh-3);
}
.daily-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.daily-media img, .daily-media .cover-fallback { width: 100%; height: 100%; object-fit: cover; transition: transform 700ms var(--ease-out); }
.daily:hover .daily-media img { transform: scale(1.04); }
.daily-body { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-3); justify-content: center; }
.daily-body .eyebrow { color: var(--saffron-300); }
.daily-body h3 { font-family: var(--font-display); font-size: var(--fs-2xl); font-weight: 600; }
.daily-body p { color: rgba(255, 241, 212, 0.75); }
.daily .tag { background: rgba(255, 241, 212, 0.12); color: var(--cream-200); }
@media (min-width: 768px) { .daily { grid-template-columns: 1.1fr 1fr; } .daily-media { aspect-ratio: auto; min-height: 280px; } }

/* ---------- Cartes recette ---------- */
.recipe-grid { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
@media (max-width: 479px) { .recipe-grid.is-compact { grid-template-columns: repeat(2, 1fr); gap: var(--s-3); } }
.recipe-row { display: flex; gap: var(--s-4); overflow-x: auto; scrollbar-width: none; scroll-snap-type: x mandatory; margin: 0 calc(var(--s-4) * -1); padding: 4px var(--s-4) var(--s-4); }
.recipe-row::-webkit-scrollbar { display: none; }
.recipe-row > * { flex: 0 0 min(78%, 280px); scroll-snap-align: start; }
@media (min-width: 1024px) { .recipe-row { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; margin: 0; padding: 0; } .recipe-row > * { flex: initial; } }

.rcard {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--sh-1);
  transition: box-shadow var(--t-med), border-color var(--t-med), transform var(--t-med) var(--ease-out);
}
.rcard:hover { box-shadow: var(--sh-3); border-color: var(--border-strong); transform: translateY(-3px); }
.rcard-media { position: relative; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.rcard-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 600ms var(--ease-out); }
.rcard:hover .rcard-media img { transform: scale(1.05); }
.rcard-body { padding: var(--s-3) var(--s-4) var(--s-4); display: flex; flex-direction: column; gap: 6px; flex: 1; }
.rcard-cat { font-size: 0.72rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.1em; display: flex; align-items: center; gap: 6px; }
.rcard-title { font-family: var(--font-display); font-weight: 600; font-size: 1.15rem; line-height: 1.22; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rcard-meta { margin-top: auto; padding-top: 6px; display: flex; flex-wrap: wrap; gap: 6px 12px; color: var(--text-3); font-size: 0.8rem; font-weight: 800; }
.rcard-meta span { display: inline-flex; align-items: center; gap: 4px; }
.rcard-meta .icon { width: 15px; height: 15px; }
.rcard-fav {
  position: absolute;
  top: 10px; right: 10px;
  z-index: 2;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(255, 252, 246, 0.92);
  color: var(--ink-700);
  box-shadow: var(--sh-2);
  transition: transform var(--t-med) var(--ease-spring), color var(--t-fast);
}
.rcard-fav:hover { transform: scale(1.08); }
.rcard-fav.is-on { color: var(--paprika-500); }
.rcard-fav.is-on .icon { fill: currentColor; animation: heartPop 420ms var(--ease-spring); }
@keyframes heartPop { 40% { transform: scale(1.35); } }
.rcard-badge { position: absolute; left: 10px; top: 10px; z-index: 2; }
.rcard-badge .tag { background: rgba(43, 45, 66, 0.82); color: #fff; backdrop-filter: blur(6px); }

/* Liste */
.recipe-list { display: flex; flex-direction: column; gap: var(--s-3); }
.recipe-list .rcard { flex-direction: row; align-items: stretch; }
.recipe-list .rcard-media { flex: 0 0 112px; aspect-ratio: 1; }
.recipe-list .rcard-fav { top: 8px; right: 8px; width: 34px; height: 34px; box-shadow: none; background: var(--surface-2); }
.recipe-list .rcard-body { padding: var(--s-3) var(--s-4); padding-right: 48px; }
@media (min-width: 768px) { .recipe-list .rcard-media { flex-basis: 150px; } }

/* Couverture de remplacement (sans photo) */
.cover-fallback {
  position: relative;
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  color: #fff;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.22) 0 2px, transparent 3px) 0 0 / 26px 26px,
    radial-gradient(120% 120% at 100% 0%, rgba(255, 255, 255, 0.25), transparent 50%),
    var(--cat, var(--paprika-500));
}
.cover-fallback .icon { width: 30%; height: 30%; max-width: 72px; max-height: 72px; stroke-width: 1.5; opacity: 0.95; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.18)); }

/* Squelettes */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-2);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 1.3s infinite;
}
[data-theme='dark'] .skeleton::after { background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-card { border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.sk-card .skeleton:first-child { aspect-ratio: 4 / 3; border-radius: 0; }
.sk-line { height: 14px; margin: 12px 16px 0; }
.sk-line.short { width: 45%; margin-bottom: 16px; }

/* État vide */
.empty {
  text-align: center;
  padding: var(--s-10) var(--s-5);
  border-radius: var(--r-xl);
  border: 2px dashed var(--border-strong);
  background: color-mix(in srgb, var(--surface) 60%, transparent);
}
.empty-art { width: 120px; margin: 0 auto var(--s-4); }
.empty h3 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; }
.empty p { color: var(--text-2); margin: 8px auto 0; max-width: 42ch; }
.empty .btn-row { justify-content: center; margin-top: var(--s-5); }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--s-3); align-items: center; }

/* ---------- Barre d'outils liste ---------- */
.toolbar { display: flex; gap: var(--s-3); align-items: center; }
.toolbar .search-xl { flex: 1; }
.toolbar .search-xl .input { min-height: 50px; border-radius: var(--r-md); }
.toolbar-sub { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin: var(--s-4) 0; }
.result-count { font-weight: 800; color: var(--text-3); font-size: var(--fs-sm); }
.sticky-filters { position: sticky; top: calc(var(--topbar-h) + var(--safe-top)); z-index: 5; background: var(--bg); padding: var(--s-2) 0; }
@media (min-width: 1024px) { .sticky-filters { top: 0; } }

/* ---------- Détail recette ---------- */
.detail-hero { position: relative; margin: calc(var(--s-4) * -1) calc(var(--s-4) * -1) 0; }
.detail-cover { position: relative; aspect-ratio: 4 / 3; max-height: 62vh; width: 100%; overflow: hidden; background: var(--surface-2); }
.detail-cover img, .detail-cover .cover-fallback { width: 100%; height: 100%; object-fit: cover; }
.detail-cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0, 0, 0, 0.32), transparent 28%, transparent 60%, rgba(23, 18, 14, 0.25)); pointer-events: none; }
.detail-floating { position: absolute; top: calc(12px + var(--safe-top)); left: 12px; right: 12px; display: flex; justify-content: space-between; z-index: 3; }
.fab-glass { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 252, 246, 0.92); color: var(--ink-900); box-shadow: var(--sh-2); text-decoration: none; }
.fab-glass.is-on { color: var(--paprika-500); }
.fab-glass.is-on .icon { fill: currentColor; }
.detail-sheet { position: relative; z-index: 2; margin-top: -28px; padding: var(--s-6) var(--s-4) 0; border-radius: var(--r-xl) var(--r-xl) 0 0; background: var(--bg); }
.detail-title { font-size: var(--fs-3xl); margin-top: 8px; }
.detail-desc { color: var(--text-2); margin-top: var(--s-3); font-size: 1.05rem; max-width: 65ch; }
.meta-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: var(--s-5); border-radius: var(--r-lg); overflow: hidden; background: var(--border); border: 1px solid var(--border); }
.meta-strip > div { background: var(--surface); padding: var(--s-3) var(--s-2); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.meta-strip .icon { color: var(--primary-text); width: 20px; height: 20px; }
.meta-strip b { font-weight: 900; font-size: 0.95rem; line-height: 1.2; }
.meta-strip small { color: var(--text-3); font-weight: 700; font-size: 0.72rem; }
.action-bar { display: flex; gap: var(--s-2); overflow-x: auto; scrollbar-width: none; margin: var(--s-5) calc(var(--s-4) * -1) 0; padding: 2px var(--s-4); }
.action-bar::-webkit-scrollbar { display: none; }
.action-bar .btn { flex-shrink: 0; }
.detail-layout { display: grid; gap: var(--s-6); margin-top: var(--s-6); }
@media (min-width: 768px) {
  .detail-hero { margin: 0; }
  .detail-cover { border-radius: var(--r-xl); aspect-ratio: 21 / 9; }
  .detail-floating { top: 14px; left: 14px; right: 14px; }
  .detail-sheet { margin-top: 0; padding: var(--s-6) 0 0; background: none; }
  .action-bar { margin: var(--s-5) 0 0; padding: 2px 0; flex-wrap: wrap; }
}
@media (min-width: 1024px) { .detail-layout { grid-template-columns: minmax(300px, 0.9fr) 1.4fr; align-items: start; } .detail-aside { position: sticky; top: var(--s-6); } }

.servings { display: flex; align-items: center; gap: var(--s-2); }
.servings output { min-width: 3ch; text-align: center; font-weight: 900; font-size: 1.15rem; }
.ing-list { list-style: none; display: flex; flex-direction: column; }
.ing-item { display: flex; align-items: flex-start; gap: var(--s-3); padding: 12px 2px; border-bottom: 1px dashed var(--border); cursor: pointer; }
.ing-item:last-child { border-bottom: 0; }
.ing-check { width: 24px; height: 24px; flex-shrink: 0; margin-top: 1px; border-radius: 8px; border: 2px solid var(--border-strong); display: grid; place-items: center; color: transparent; transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast); }
.ing-item.is-done .ing-check { background: var(--success); border-color: var(--success); color: #fff; }
.ing-item.is-done .ing-text { text-decoration: line-through; color: var(--text-3); }
.ing-qty { font-weight: 900; color: var(--primary-text); white-space: nowrap; }
.ing-text { flex: 1; }
.steps { list-style: none; counter-reset: step; display: flex; flex-direction: column; gap: var(--s-3); }
.step { display: grid; grid-template-columns: 40px 1fr; gap: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--border); cursor: pointer; transition: opacity var(--t-med), border-color var(--t-fast); }
.step::before { counter-increment: step; content: counter(step); width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--warning); font-weight: 900; font-family: var(--font-display); font-size: 1.1rem; }
.step.is-done { opacity: 0.55; }
.step.is-done::before { content: '✓'; background: var(--success-soft); color: var(--success); }
.step p { line-height: 1.65; }
.step .tag { margin-top: 8px; }
.touch-card { position: relative; padding: var(--s-5); border-radius: var(--r-lg); background: var(--accent-soft); border: 1.5px dashed var(--saffron-400); }
.touch-card h3 { font-family: var(--font-display); font-weight: 600; display: flex; align-items: center; gap: 8px; color: var(--warning); font-size: 1.1rem; }
.touch-card p { margin-top: 8px; color: var(--text); white-space: pre-line; }
.stars { display: inline-flex; gap: 2px; }
.stars button { border: 0; background: none; padding: 4px; color: var(--border-strong); border-radius: 8px; }
.stars button.is-on { color: var(--saffron-400); }
.stars button.is-on .icon { fill: currentColor; }
.stars-static { display: inline-flex; gap: 1px; color: var(--saffron-400); }
.stars-static .icon { width: 14px; height: 14px; fill: currentColor; }

/* ---------- Nutrition ---------- */
.nutri { display: grid; grid-template-columns: auto 1fr; gap: var(--s-5); align-items: center; }
.donut { position: relative; width: 132px; height: 132px; }
.donut svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.donut circle { fill: none; stroke-width: 14; }
.donut .track { stroke: var(--surface-2); }
.donut .seg { transition: stroke-dasharray 900ms var(--ease-out), stroke-dashoffset 900ms var(--ease-out); stroke-linecap: butt; }
.donut-center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1.1; }
.donut-center b { display: block; font-family: var(--font-display); font-size: 1.7rem; }
.donut-center small { font-weight: 800; color: var(--text-3); font-size: 0.75rem; }
.macro-list { display: flex; flex-direction: column; gap: var(--s-3); }
.macro { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; font-weight: 800; font-size: 0.92rem; }
.macro-dot { width: 12px; height: 12px; border-radius: 4px; }
.macro-bar { grid-column: 2 / -1; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.macro-bar span { display: block; height: 100%; border-radius: inherit; transform-origin: left; animation: barIn 900ms var(--ease-out) both; }
@keyframes barIn { from { transform: scaleX(0); } }
.nutri-note { font-size: var(--fs-sm); color: var(--text-3); margin-top: var(--s-3); display: flex; gap: 6px; align-items: flex-start; }
.nutri-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.nutri-table th { text-align: left; font-size: var(--fs-xs); text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); padding: 8px 6px; border-bottom: 1px solid var(--border); }
.nutri-table td { padding: 10px 6px; border-bottom: 1px dashed var(--border); }
.nutri-table td.num, .nutri-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.nutri-table tr.is-missing td:first-child { color: var(--warning); }
.table-wrap { overflow-x: auto; }

/* ---------- Éditeur ---------- */
.editor { display: grid; gap: var(--s-5); }
@media (min-width: 1024px) { .editor { grid-template-columns: 1.5fr 1fr; align-items: start; } .editor-aside { position: sticky; top: var(--s-6); display: grid; gap: var(--s-5); } }
.editor-section h2 { font-family: var(--font-display); font-size: var(--fs-xl); font-weight: 600; display: flex; align-items: center; gap: 10px; margin-bottom: var(--s-4); }
.editor-section h2 .num { width: 30px; height: 30px; border-radius: 10px; background: var(--ink-900); color: var(--cream-200); font-family: var(--font-ui); font-size: 0.9rem; display: grid; place-items: center; font-weight: 900; }
[data-theme='dark'] .editor-section h2 .num { background: var(--cream-200); color: var(--ink-900); }
.photo-drop {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 10;
  border-radius: var(--r-lg);
  border: 2px dashed var(--border-strong);
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
  text-align: center;
  color: var(--text-2);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.photo-drop:hover, .photo-drop.is-over { border-color: var(--paprika-400); background: var(--primary-soft); }
.photo-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-drop-actions { position: absolute; right: 10px; bottom: 10px; display: flex; gap: 8px; z-index: 2; }
.photo-hint { display: flex; flex-direction: column; align-items: center; gap: 8px; font-weight: 800; padding: var(--s-4); }
.photo-hint small { font-weight: 600; color: var(--text-3); }
.row-list { display: flex; flex-direction: column; gap: var(--s-2); }
.ing-row { display: grid; grid-template-columns: 72px 104px 1fr 40px; gap: var(--s-2); align-items: center; animation: rowIn 260ms var(--ease-out); }
.ing-row .input, .ing-row .select { min-height: 44px; padding: 8px 10px; }
.ing-row .select { padding-right: 28px; background-position: right 6px center; }
.ing-row.is-unknown .input-name { border-color: var(--saffron-400); }
@media (max-width: 479px) {
  .ing-row { grid-template-columns: 64px 92px 1fr 36px; gap: 6px; }
}
.step-row { display: grid; grid-template-columns: 32px 1fr 40px; gap: var(--s-2); align-items: start; animation: rowIn 260ms var(--ease-out); }
.step-row .num { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--warning); font-weight: 900; margin-top: 6px; }
.step-row .textarea { min-height: 76px; }
.step-row .step-min { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.step-row .step-min .input { width: 90px; min-height: 38px; padding: 6px 10px; }
.row-tools { display: flex; flex-direction: column; gap: 4px; }
@keyframes rowIn { from { opacity: 0; transform: translateY(-6px); } }
.save-bar {
  position: sticky;
  bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 10px);
  z-index: var(--z-sticky);
  display: flex;
  gap: var(--s-3);
  justify-content: flex-end;
  padding: var(--s-3);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--sh-3);
}
@media (min-width: 768px) { .save-bar { bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 28px); } }
@media (min-width: 1024px) { .save-bar { bottom: var(--s-4); } }
.save-bar .draft-state { margin-right: auto; align-self: center; font-size: var(--fs-sm); color: var(--text-3); font-weight: 700; display: flex; align-items: center; gap: 6px; }

/* ---------- Frigo ---------- */
.fridge-box { padding: var(--s-5); }
.fridge-input { display: flex; gap: var(--s-2); }
.fridge-input .input { flex: 1; }
.match-meter { height: 8px; border-radius: 8px; background: var(--surface-2); overflow: hidden; }
.match-meter span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--saffron-400), var(--success)); }
.missing { font-size: 0.82rem; color: var(--text-3); font-weight: 700; }
.missing b { color: var(--warning); }
.suggest-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: var(--s-3); }
.suggest-list button { border: 1px dashed var(--border-strong); background: transparent; border-radius: var(--r-pill); padding: 6px 12px; font-weight: 800; font-size: 0.82rem; color: var(--text-2); }
.suggest-list button:hover { border-style: solid; color: var(--text); }

/* ---------- Chef IA (chat) ---------- */
.chat {
  display: grid;
  grid-template-columns: 1fr;
  height: calc(100dvh - var(--topbar-h) - var(--safe-top) - var(--tabbar-h) - var(--safe-bottom));
  margin: calc(var(--s-4) * -1) calc(var(--s-4) * -1) 0;
}
@media (min-width: 768px) { .chat { margin: calc(var(--s-6) * -1) calc(var(--s-8) * -1) 0; height: calc(100dvh - var(--topbar-h) - var(--safe-top) - var(--tabbar-h) - 28px - var(--safe-bottom)); } }
@media (min-width: 1024px) { .chat { grid-template-columns: 290px 1fr; height: 100dvh; margin: calc(var(--s-8) * -1) calc(var(--s-10) * -1) calc(var(--s-16) * -1); } }
.chat-side { display: none; border-right: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 55%, transparent); padding: var(--s-5) var(--s-3); overflow-y: auto; }
@media (min-width: 1024px) { .chat-side { display: flex; flex-direction: column; gap: var(--s-2); } }
.chat-side.is-open { display: flex; flex-direction: column; gap: var(--s-2); position: fixed; inset: 0 25% 0 0; z-index: var(--z-drawer); background: var(--surface); box-shadow: var(--sh-3); padding-top: calc(var(--s-5) + var(--safe-top)); animation: drawerIn 280ms var(--ease-out); }
@keyframes drawerIn { from { transform: translateX(-100%); } }
.drawer-backdrop { position: fixed; inset: 0; z-index: calc(var(--z-drawer) - 1); background: rgba(23, 18, 14, 0.45); animation: fadeIn 200ms; }
.conv { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--r-sm); color: var(--text-2); text-decoration: none; font-weight: 700; font-size: 0.9rem; }
.conv span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv:hover { background: var(--surface-2); color: var(--text); }
.conv.is-active { background: var(--primary-soft); color: var(--primary-text); }
.conv .del { opacity: 0; border: 0; background: none; color: inherit; padding: 4px; border-radius: 6px; }
.conv:hover .del, .conv.is-active .del { opacity: 1; }
.chat-main { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.chat-head { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--border); }
.chat-head h1 { font-size: 1.15rem; font-family: var(--font-ui); font-weight: 900; }
.chat-head small { color: var(--text-3); font-weight: 700; display: flex; align-items: center; gap: 6px; }
.chat-avatar { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); flex-shrink: 0; }
.chat-avatar .logo-mark { width: 30px; height: 30px; }
.online-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 3px var(--success-soft); }
.chat-scroll { flex: 1; overflow-y: auto; padding: var(--s-5) var(--s-4); display: flex; flex-direction: column; gap: var(--s-4); scroll-behavior: smooth; overscroll-behavior: contain; }
.chat-welcome { margin: auto 0; text-align: center; padding: var(--s-6) 0; }
.chat-welcome .logo-mark { width: 92px; margin: 0 auto var(--s-4); }
.chat-welcome h2 { font-size: var(--fs-2xl); }
.chat-welcome p { color: var(--text-2); margin: 8px auto 0; max-width: 44ch; }
.prompt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--s-3); margin-top: var(--s-6); text-align: left; }
.prompt-card { display: flex; gap: 12px; align-items: flex-start; padding: var(--s-4); border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); color: var(--text); text-align: left; cursor: pointer; transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast); }
.prompt-card:hover { border-color: var(--border-strong); box-shadow: var(--sh-2); transform: translateY(-2px); }
.prompt-card .pc-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary-text); flex-shrink: 0; }
.prompt-card b { display: block; font-weight: 900; font-size: 0.93rem; }
.prompt-card small { color: var(--text-3); font-weight: 700; line-height: 1.35; display: block; margin-top: 2px; }
.msg { display: flex; gap: var(--s-3); max-width: 860px; width: 100%; animation: msgIn 320ms var(--ease-out); }
@keyframes msgIn { from { opacity: 0; transform: translateY(8px); } }
.msg-user { margin-left: auto; justify-content: flex-end; }
.bubble { padding: 12px 16px; border-radius: 20px; line-height: 1.6; max-width: min(100%, 720px); overflow-wrap: anywhere; }
.msg-user .bubble { background: var(--ink-900); color: var(--cream-200); border-bottom-right-radius: 6px; white-space: pre-wrap; }
[data-theme='dark'] .msg-user .bubble { background: var(--paprika-600); color: #fff; }
.msg-ai .bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 6px; }
.msg-ai .chat-avatar { width: 34px; height: 34px; border-radius: 12px; }
.msg-ai .chat-avatar .logo-mark { width: 24px; height: 24px; }
.md h3, .md h4 { font-family: var(--font-display); font-size: 1.12rem; margin: 14px 0 6px; font-weight: 700; }
.md h3:first-child, .md h4:first-child, .md p:first-child { margin-top: 0; }
.md p { margin: 8px 0; }
.md ul, .md ol { padding-left: 1.3em; margin: 8px 0; }
.md li { margin: 3px 0; }
.md li::marker { color: var(--primary-text); font-weight: 900; }
.md strong { font-weight: 900; }
.md code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: 0.9em; }
.msg-actions { display: flex; gap: 4px; margin-top: 8px; }
.msg-actions .btn { min-height: 32px; padding: 0 10px; font-size: 0.8rem; color: var(--text-3); }
.ai-recipe { margin-top: var(--s-3); padding: var(--s-4); border-radius: var(--r-md); background: var(--accent-soft); border: 1.5px dashed var(--saffron-400); }
.ai-recipe h4 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
.ai-recipe .chips { margin: 8px 0 12px; }
.typing { display: inline-flex; gap: 5px; padding: 6px 2px; }
.typing span { width: 8px; height: 8px; border-radius: 50%; background: var(--paprika-400); animation: typing 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; background: var(--saffron-400); }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-6px); opacity: 1; } }
.composer { padding: var(--s-3) var(--s-4) var(--s-4); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 92%, transparent); }
.composer-chips { margin-bottom: var(--s-2); }
.composer-box { display: flex; align-items: flex-end; gap: var(--s-2); padding: 6px 6px 6px 14px; border-radius: 22px; border: 1.5px solid var(--border); background: var(--surface); box-shadow: var(--sh-1); transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.composer-box:focus-within { border-color: var(--paprika-400); box-shadow: var(--focus); }
.composer-box textarea { flex: 1; border: 0; background: transparent; resize: none; min-height: 44px; max-height: 180px; padding: 10px 0; font-size: 16px; line-height: 1.45; outline: none; }
.composer-box .btn-icon { border-radius: 16px; }
.composer-foot { margin-top: 6px; font-size: 0.72rem; color: var(--text-3); text-align: center; }
.focus-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 12px; border-radius: var(--r-pill); background: var(--accent-soft); color: var(--warning); font-weight: 800; font-size: 0.8rem; margin-bottom: 8px; }
.focus-pill button { border: 0; background: none; color: inherit; display: grid; place-items: center; padding: 2px; border-radius: 50%; }

/* ---------- Mode cuisine ---------- */
.cook {
  position: fixed;
  inset: 0;
  z-index: var(--z-cook);
  display: flex;
  flex-direction: column;
  background: var(--ink-900);
  color: var(--cream-200);
  padding: calc(var(--s-4) + var(--safe-top)) var(--s-5) calc(var(--s-5) + var(--safe-bottom));
  animation: fadeIn 260ms;
}
.cook-top { display: flex; align-items: center; gap: var(--s-3); }
.cook-top .btn { --btn-bg: rgba(255, 241, 212, 0.1); --btn-fg: var(--cream-200); --btn-bd: transparent; }
.cook-progress { flex: 1; height: 6px; border-radius: 6px; background: rgba(255, 241, 212, 0.15); overflow: hidden; }
.cook-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--saffron-400), var(--paprika-400)); border-radius: inherit; transition: width 400ms var(--ease-out); }
.cook-body { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 760px; width: 100%; margin: 0 auto; overflow-y: auto; padding: var(--s-6) 0; }
.cook-step-num { font-family: var(--font-display); font-style: italic; color: var(--saffron-300); font-size: 1.2rem; }
.cook-text { font-family: var(--font-display); font-size: clamp(1.5rem, 1.1rem + 2.2vw, 2.4rem); line-height: 1.3; margin-top: var(--s-3); font-weight: 500; animation: stepIn 380ms var(--ease-out); }
@keyframes stepIn { from { opacity: 0; transform: translateX(16px); } }
.cook-timer { margin-top: var(--s-6); display: flex; align-items: center; gap: var(--s-4); padding: var(--s-4); border-radius: var(--r-lg); background: rgba(255, 241, 212, 0.08); }
.cook-timer b { font-variant-numeric: tabular-nums; font-size: 2.2rem; font-weight: 900; letter-spacing: 0.02em; min-width: 5ch; }
.cook-timer.is-done { background: rgba(127, 196, 138, 0.18); animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(127, 196, 138, 0.12); } }
.cook-nav { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-3); max-width: 760px; width: 100%; margin: 0 auto; }
.cook-nav .btn { min-height: 58px; font-size: 1.05rem; }
.cook-nav .btn-ghost { --btn-fg: var(--cream-200); --btn-bg: rgba(255, 241, 212, 0.08); }
.cook-ings { position: fixed; inset: auto 0 0 0; max-height: 70vh; overflow-y: auto; background: var(--surface); color: var(--text); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: var(--s-5) var(--s-5) calc(var(--s-5) + var(--safe-bottom)); z-index: 2; animation: sheetIn 300ms var(--ease-out); }

/* ---------- Modale / feuille ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(23, 18, 14, 0.5);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn 200ms;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  padding: var(--s-3) var(--s-5) calc(var(--s-5) + var(--safe-bottom));
  box-shadow: var(--sh-3);
  animation: sheetIn 320ms var(--ease-out);
}
.modal::before { content: ''; display: block; width: 44px; height: 5px; border-radius: 5px; background: var(--border-strong); margin: 0 auto var(--s-4); }
@keyframes sheetIn { from { transform: translateY(100%); } }
.modal-head { display: flex; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-4); }
.modal-head h2 { flex: 1; font-size: var(--fs-xl); }
.modal-head p { color: var(--text-2); margin-top: 4px; font-size: 0.95rem; font-family: var(--font-ui); }
.modal-foot { display: flex; gap: var(--s-3); justify-content: flex-end; margin-top: var(--s-6); flex-wrap: wrap; }
.modal-foot .btn { flex: 1; }
@media (min-width: 640px) {
  .modal-backdrop { align-items: center; padding: var(--s-6); }
  .modal { max-width: 520px; border-radius: var(--r-xl); padding: var(--s-6); animation: modalIn 280ms var(--ease-out); }
  .modal::before { display: none; }
  .modal-foot .btn { flex: 0 0 auto; }
  .modal-wide { max-width: 720px; }
}
@keyframes modalIn { from { opacity: 0; transform: translateY(14px) scale(0.98); } }
.pick-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.pick-item { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--r-md); border: 1px solid var(--border); background: var(--surface); text-align: left; color: var(--text); font-weight: 800; }
.pick-item:hover { border-color: var(--border-strong); background: var(--surface-2); }
.pick-thumb { width: 46px; height: 46px; border-radius: 12px; overflow: hidden; flex-shrink: 0; }
.pick-thumb img, .pick-thumb .cover-fallback { width: 100%; height: 100%; object-fit: cover; }
.pick-thumb .cover-fallback .icon { width: 50%; height: 50%; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 50%; transform: translateX(-50%); top: calc(12px + var(--safe-top)); z-index: var(--z-toast); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100% - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); background: var(--ink-900); color: var(--cream-200); box-shadow: var(--sh-3); font-weight: 700; font-size: 0.93rem; animation: toastIn 360ms var(--ease-spring); }
[data-theme='dark'] .toast { background: var(--cream-200); color: var(--ink-900); }
.toast .icon { width: 20px; height: 20px; }
.toast-success .icon { color: #7FC48A; }
.toast-error .icon { color: #FF8A7A; }
[data-theme='dark'] .toast-success .icon { color: var(--success); }
[data-theme='dark'] .toast-error .icon { color: #B42318; }
.toast span { flex: 1; }
.toast .btn { min-height: 34px; padding: 0 12px; font-size: 0.82rem; --btn-bg: rgba(255, 241, 212, 0.14); --btn-fg: inherit; --btn-bd: transparent; }
.toast.is-leaving { animation: toastOut 220ms forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(0.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

.offline-banner { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 24px); z-index: var(--z-toast); display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r-pill); background: var(--ink-900); color: var(--cream-200); font-weight: 800; font-size: 0.85rem; box-shadow: var(--sh-3); }
@media (min-width: 1024px) { .offline-banner { bottom: 20px; } }

/* ---------- Écran de démarrage ---------- */
.splash {
  position: fixed;
  inset: 0;
  z-index: var(--z-splash);
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 420ms var(--ease-out), visibility 420ms;
}
.splash.is-hidden { opacity: 0; visibility: hidden; }
.splash .logo-full { width: min(220px, 52vw); }
.splash-bar { width: 120px; height: 4px; margin: 26px auto 0; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.splash-bar span { display: block; width: 40%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--saffron-400), var(--paprika-500)); animation: splashBar 1.1s ease-in-out infinite; }
@keyframes splashBar { 0% { transform: translateX(-110%); } 100% { transform: translateX(260%); } }

/* ---------- Logo & animations ---------- */
.logo-full { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.logo-full .logo-mark { width: 100%; }
.logo-word { font-family: var(--font-ui); font-weight: 900; font-size: 2.2rem; letter-spacing: -0.01em; color: var(--text); display: inline-flex; line-height: 1; }
.logo-word span { display: inline-block; }
.logo-sm .logo-word { font-size: 1.4rem; }
.logo-lg .logo-word { font-size: 3rem; }
.logo-full.is-animated .logo-word span { animation: letterUp 520ms var(--ease-spring) both; animation-delay: calc(1.05s + var(--i) * 45ms); }
@keyframes letterUp { from { opacity: 0; transform: translateY(14px); } }

.logo-mark .lm-puff, .logo-mark .lm-body, .logo-mark .lm-leaf { transform-box: fill-box; }
.logo-mark .lm-puff { transform-origin: center; }
.logo-mark .lm-leaf { transform-origin: 0% 100%; }
.logo-mark.is-animated .lm-body { animation: lmFade 420ms var(--ease-out) 0.85s both; }
.logo-mark.is-animated .lm-puff-l { animation: lmPop 560ms var(--ease-spring) 0.05s both; }
.logo-mark.is-animated .lm-puff-c { animation: lmPop 600ms var(--ease-spring) 0.18s both; }
.logo-mark.is-animated .lm-puff-r { animation: lmPop 560ms var(--ease-spring) 0.31s both; }
.logo-mark.is-animated .lm-seams { animation: lmFade 300ms ease 0.7s both; }
.logo-mark.is-animated .lm-w-gap,
.logo-mark.is-animated .lm-w-stroke { stroke-dasharray: 100; animation: lmDraw 700ms var(--ease-out) 0.45s both; }
.logo-mark.is-animated .lm-leaf { animation: lmLeaf 640ms var(--ease-spring) 0.95s both; }
@keyframes lmPop { from { transform: scale(0); } }
@keyframes lmFade { from { opacity: 0; } }
@keyframes lmDraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes lmLeaf { from { transform: scale(0) rotate(-40deg); opacity: 0; } }
@keyframes leafWiggle { 30% { transform: rotate(-14deg); } 60% { transform: rotate(8deg); } }
.logo-mark .lm-steam path { opacity: 0; stroke-dasharray: 30; animation: steam 2.6s ease-in-out infinite; }
.logo-mark .lm-steam .lm-steam-2 { animation-delay: 0.5s; }
.logo-mark .lm-steam .lm-steam-3 { animation-delay: 1s; }
@keyframes steam {
  0% { opacity: 0; transform: translateY(6px); stroke-dashoffset: 30; }
  30% { opacity: 0.9; }
  70% { opacity: 0.6; stroke-dashoffset: 0; }
  100% { opacity: 0; transform: translateY(-8px); stroke-dashoffset: -30; }
}
.logo-mark:hover .lm-leaf, .topbar-brand:hover .lm-leaf { animation: leafWiggle 700ms var(--ease-out); }

/* ---------- Authentification ---------- */
.auth { min-height: 100dvh; display: grid; grid-template-columns: 1fr; position: relative; z-index: 2; }
.auth-art { display: none; }
.auth-main { display: flex; flex-direction: column; justify-content: center; padding: calc(var(--s-8) + var(--safe-top)) var(--s-5) calc(var(--s-8) + var(--safe-bottom)); }
.auth-card { width: 100%; max-width: 430px; margin: 0 auto; }
.auth-card .logo-full { width: 150px; margin: 0 auto var(--s-6); }
.auth-card h1 { font-size: var(--fs-2xl); text-align: center; }
.auth-card > p { color: var(--text-2); text-align: center; margin: 8px 0 var(--s-6); }
.auth-foot { text-align: center; margin-top: var(--s-6); color: var(--text-2); font-weight: 700; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin-top: 8px; }
.pw-meter span { height: 5px; border-radius: 5px; background: var(--surface-3); transition: background var(--t-med); }
.pw-meter[data-score='1'] span:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-score='2'] span:nth-child(-n+2) { background: var(--saffron-400); }
.pw-meter[data-score='3'] span:nth-child(-n+3) { background: var(--olive-500); }
.pw-meter[data-score='4'] span { background: var(--success); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--r-md); font-weight: 700; font-size: 0.92rem; margin-bottom: var(--s-4); }
.alert-error { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-info { background: var(--accent-soft); color: var(--warning); }
@media (min-width: 960px) {
  .auth { grid-template-columns: 1.05fr 1fr; }
  .auth-art {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: var(--s-12);
    position: relative;
    overflow: hidden;
    background:
      radial-gradient(70% 60% at 20% 15%, rgba(243, 167, 18, 0.35), transparent 60%),
      radial-gradient(70% 70% at 90% 90%, rgba(228, 87, 46, 0.45), transparent 60%),
      var(--ink-900);
    color: var(--cream-200);
    --logo-bg: var(--ink-900);
  }
  .auth-art .logo-full { width: 230px; --text: var(--cream-200); }
  .auth-art h2 { font-size: clamp(2.2rem, 1.5rem + 2vw, 3.3rem); font-weight: 500; max-width: 14ch; }
  .auth-art h2 em { color: var(--saffron-300); }
  .auth-feats { display: grid; gap: var(--s-4); margin-top: var(--s-8); list-style: none; }
  .auth-feats li { display: flex; gap: 14px; align-items: flex-start; }
  .auth-feats .af-icon { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: rgba(255, 241, 212, 0.1); color: var(--saffron-300); flex-shrink: 0; }
  .auth-feats b { display: block; }
  .auth-feats small { color: rgba(255, 241, 212, 0.68); font-weight: 600; font-size: 0.92rem; }
  .auth-art-foot { font-size: var(--fs-sm); color: rgba(255, 241, 212, 0.5); font-weight: 700; }
  .auth-main .auth-card .logo-full { display: none; }
}

/* ---------- Réglages ---------- */
.settings { display: grid; gap: var(--s-5); }
@media (min-width: 1024px) { .settings { grid-template-columns: 1fr 1fr; align-items: start; } }
.set-group h2 { font-family: var(--font-display); font-size: var(--fs-lg); font-weight: 600; display: flex; align-items: center; gap: 10px; padding: var(--s-5) var(--s-5) var(--s-2); }
.set-row { display: flex; align-items: center; gap: var(--s-3); padding: var(--s-4) var(--s-5); border-top: 1px solid var(--border); }
.set-row:first-of-type { border-top: 0; }
.set-row > div { flex: 1; min-width: 0; }
.set-row b { display: block; font-weight: 800; }
.set-row small { color: var(--text-3); font-weight: 600; display: block; line-height: 1.4; }
.set-icon { width: 40px; height: 40px; border-radius: 13px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); flex-shrink: 0; }
.avatar { width: 44px; height: 44px; border-radius: 15px; display: grid; place-items: center; background: linear-gradient(145deg, var(--saffron-400), var(--paprika-500)); color: #fff; font-weight: 900; font-size: 1.1rem; flex-shrink: 0; }
.avatar-lg { width: 64px; height: 64px; border-radius: 22px; font-size: 1.6rem; }
.ios-steps { list-style: none; counter-reset: ios; display: grid; gap: var(--s-3); margin-top: var(--s-3); }
.ios-steps li { counter-increment: ios; display: flex; gap: 12px; align-items: center; font-weight: 700; }
.ios-steps li::before { content: counter(ios); width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text); font-weight: 900; display: grid; place-items: center; flex-shrink: 0; }
.ios-steps .icon { display: inline; vertical-align: -5px; color: #0A84FF; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--r-pill); font-weight: 800; font-size: 0.78rem; }
.status-on { background: var(--success-soft); color: var(--success); }
.status-off { background: var(--surface-2); color: var(--text-3); }
.reminder-item { display: flex; align-items: center; gap: var(--s-3); padding: 12px var(--s-5); border-top: 1px dashed var(--border); }
.reminder-item > div { flex: 1; min-width: 0; }
.reminder-item b { display: block; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reminder-item small { color: var(--text-3); font-weight: 700; }

/* ---------- Divers ---------- */
.grid-2 { display: grid; gap: var(--s-5); }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.muted { color: var(--text-3); }
.text-sm { font-size: var(--fs-sm); }
.center { text-align: center; }
.mt-2 { margin-top: var(--s-2); } .mt-3 { margin-top: var(--s-3); } .mt-4 { margin-top: var(--s-4); } .mt-6 { margin-top: var(--s-6); } .mt-8 { margin-top: var(--s-8); }
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: var(--s-2); } .gap-3 { gap: var(--s-3); } .wrap { flex-wrap: wrap; } .grow { flex: 1; min-width: 0; } .between { justify-content: space-between; }
[dir='auto'] { unicode-bidi: plaintext; }

/* ---------- Mouvement réduit ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  [data-aos] { opacity: 1 !important; transform: none !important; }
}

/* ---------- Impression ---------- */
@media print {
  body::before, .sidebar, .tabbar, .topbar, .action-bar, .detail-floating, .save-bar, #toasts, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .page { padding: 0; max-width: none; }
  .detail-cover { max-height: 260px; border-radius: 12px; }
  .detail-sheet { margin: 0; padding: 16px 0 0; }
  .step, .card { break-inside: avoid; box-shadow: none; border-color: #ddd; }
  .detail-layout { grid-template-columns: 1fr 1.5fr; }
}

/* ---------- Pages "sans barre du haut" (détail, chef) ---------- */
@media (max-width: 1023px) {
  .shell.is-bare .topbar { display: none; }
  .shell.is-bare .page-recipes { padding-top: 0; }
  .shell.is-bare .chat {
    margin-top: 0;
    height: calc(100dvh - var(--tabbar-h) - var(--safe-bottom));
  }
  .shell.is-bare .chat-head { padding-top: calc(var(--s-3) + var(--safe-top)); }
}
@media (min-width: 768px) and (max-width: 1023px) {
  .shell.is-bare .chat { margin-top: calc(var(--s-6) * -1); height: calc(100dvh - var(--tabbar-h) - var(--safe-bottom) - 28px); }
  .shell.is-bare .page-recipes { padding-top: var(--s-6); }
}
@media (min-width: 1024px) { .chat-menu { display: none; } }
.chip-radio { position: relative; }
.chip-radio input:focus-visible + .chip { box-shadow: var(--focus); }
.chip-radio input:checked + .chip { background: var(--ink-900); border-color: var(--ink-900); color: var(--cream-200); }
[data-theme='dark'] .chip-radio input:checked + .chip { background: var(--cream-200); border-color: var(--cream-200); color: var(--ink-900); }
.modal .field + .field { margin-top: var(--s-5); }
.page-chef { padding-bottom: 0; }
@media (min-width: 1024px) { .page-chef { max-width: none; } }
.detail-floating .fab-glass:active { transform: scale(0.94); }
.search-xl:has(.btn) .input { padding-right: 118px; }
.macro > span:nth-child(3) { white-space: nowrap; font-variant-numeric: tabular-nums; }
@media (max-width: 479px) { .donut { width: 116px; height: 116px; } .nutri { gap: var(--s-4); } }
@media (max-width: 559px) {
  .ing-row { grid-template-columns: 74px 1fr 36px; grid-template-areas: 'name name del' 'qty unit .'; gap: 6px; padding-bottom: 10px; border-bottom: 1px dashed var(--border); }
  .ing-row[aria-hidden='true'] { display: none; }
  .ing-row > [data-f='qty'] { grid-area: qty; }
  .ing-row > [data-f='unit'] { grid-area: unit; }
  .ing-row > [data-f='name'] { grid-area: name; }
  .ing-row > .btn { grid-area: del; }
  .editor .card-pad { padding: var(--s-4); }
}
.offline-banner { white-space: nowrap; max-width: calc(100% - 24px); }
