/* ============================================================
   OPTIGEST — Design System (tokens + composants partagés)
   Artisanal chaleureux • sable, terre cuite, pain doré

   Usage :
     <html data-theme="dark">  (ou "light")
     <link rel="stylesheet" href="{{ url_for('static', filename='css/optigest.css') }}">

   Mood :
     <body data-mood="calme">    (dark sobre — défaut)
     <body data-mood="atelier">  (dark texturé chaleureux)
     <body data-mood="aurore">   (light sablé)

   Format tuiles (data-tile sur <body>) :
     "minimal"   — icône en haut, label en bas
     "iconique"  — gros icône central, label dessous (défaut cuisine)
     "colore"    — aplat de couleur saturé

   Voix typographique (data-type sur <body>) :
     "sobre"     — Fraunces calme (défaut)
     "artisanal" — italique généreux
     "bold"      — Plus Jakarta uppercase

   Réf. : .claude/DESIGN.md
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ============================================================
   1. TOKENS — couleurs, typo, radius, espacements, ombres
   ============================================================ */
:root {
  /* Sable / blanc cassé */
  --sand-50:#FBF6EE; --sand-100:#F5EEE0; --sand-200:#ECE0CB;
  --sand-300:#DCC9A8; --sand-400:#C4A878; --sand-500:#A88955;

  /* Encre — anthracite chaud */
  --ink-50:#F2EEE8; --ink-100:#D9D2C5; --ink-200:#9C948A;
  --ink-300:#6E665C; --ink-400:#443E37; --ink-500:#2A2520;
  --ink-600:#1F1B17; --ink-700:#14110E; --ink-800:#0B0907;

  /* Terre cuite — primaire */
  --terra-50:#FBEEE6; --terra-100:#F4D8C4; --terra-200:#E8B596;
  --terra-300:#D88A65; --terra-400:#C56B43; --terra-500:#B0552F;
  --terra-600:#8E4220; --terra-700:#6B3118;

  /* Pain doré — warning, spotlight */
  --bread-50:#FBF1D5; --bread-100:#F6E0A1; --bread-200:#F0CC72;
  --bread-300:#E5B547; --bread-400:#C99A2B; --bread-500:#9A7418;

  /* Pistache — succès, frais */
  --pistache-50:#EEF1DF; --pistache-100:#D8DFB6; --pistache-200:#B7C282;
  --pistache-300:#8E9C56; --pistache-400:#6E7B3E; --pistache-500:#4F5A2A;

  /* Framboise — danger */
  --berry-50:#F8DDD9; --berry-100:#EFB3AA; --berry-200:#E0827A;
  --berry-300:#C24F4A; --berry-400:#993834; --berry-500:#6E2522;

  /* Bleuet — info, lien */
  --blueb-50:#E2E7EE; --blueb-100:#B8C4D5; --blueb-200:#7E92AF;
  --blueb-300:#4F6788; --blueb-400:#364B6A;

  /* Sémantique LIGHT (défaut) */
  --bg:           var(--sand-50);
  --bg-elev:      #FFFAF1;
  --bg-soft:      var(--sand-100);
  --surface:      #FFFAF1;
  --surface-2:    var(--sand-100);
  --border:       #E6D9BF;
  --border-soft:  #EFE3CB;
  --border-strong:#DCC9A8;          /* hover/focus borders, switch-off track */

  --text:         var(--ink-700);
  --text-muted:   var(--ink-300);
  --text-soft:    var(--ink-200);
  --text-on-dark: var(--sand-50);

  --primary:        var(--terra-500);
  --primary-hover:  var(--terra-600);
  --primary-soft:   var(--terra-50);
  --on-primary:     #FFFAF1;

  --warning:      var(--bread-300);
  --warning-soft: var(--bread-50);
  --success:      var(--pistache-300);
  --success-soft: var(--pistache-50);
  --danger:       var(--berry-300);
  --danger-soft:  var(--berry-50);
  --info:         var(--blueb-300);
  --info-soft:    var(--blueb-50);

  --sidebar-bg:        var(--ink-600);
  --sidebar-fg:        var(--sand-100);
  --sidebar-muted:     #8B8175;
  --sidebar-active-bg: rgba(229,181,71,0.10);
  --sidebar-active-fg: var(--bread-200);
  --sidebar-border:    rgba(245,238,224,0.06);

  /* Typographie */
  --font-display: 'Outfit', system-ui, -apple-system, sans-serif;
  --font-body:    'Outfit', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  --fs-12:12px; --fs-13:13px; --fs-14:14px; --fs-15:15px;
  --fs-16:16px; --fs-18:18px; --fs-20:20px; --fs-24:24px;
  --fs-28:28px; --fs-32:32px; --fs-40:40px; --fs-48:48px;

  /* Radius */
  --r-xs:6px; --r-sm:8px; --r-md:12px; --r-lg:18px;
  --r-xl:24px; --r-2xl:32px; --r-full:999px;

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

  /* Ombres chaudes légères */
  --shadow-xs: 0 1px 2px rgba(45,35,20,.04);
  --shadow-sm: 0 1px 2px rgba(45,35,20,.04), 0 2px 4px rgba(45,35,20,.04);
  --shadow-md: 0 2px 4px rgba(45,35,20,.05), 0 8px 20px rgba(45,35,20,.06);
  --shadow-lg: 0 4px 8px rgba(45,35,20,.06), 0 16px 40px rgba(45,35,20,.08);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,.5);

  --t-fast: 120ms cubic-bezier(.2,.8,.2,1);
  --t-med:  220ms cubic-bezier(.2,.8,.2,1);
}

/* DARK — aligné sur claude-design/tokens.css §148-188 */
:root[data-theme="dark"] {
  --bg:           #15120E;
  --bg-elev:      #1E1A14;
  --bg-soft:      #1A1611;
  --surface:      #211C16;
  --surface-2:    #2A241C;
  --border:       #36301F;
  --border-soft:  #2A2418;
  --border-strong:#4A3F28;          /* hover/focus, switch-off track en dark */

  --text:         #F2EAD8;
  --text-muted:   #B5A98F;
  --text-soft:    #7E725E;
  --text-on-dark: #F2EAD8;

  --primary:        var(--terra-400);
  --primary-hover:  var(--terra-300);
  --primary-soft:   #3A1F12;
  --on-primary:     #FFFAF1;

  --warning:      var(--bread-300);
  --warning-soft: #3A2C0F;
  --success:      var(--pistache-200);
  --success-soft: #2B311C;
  --danger:       var(--berry-200);
  --danger-soft:  #391E1B;
  --info:         var(--blueb-200);
  --info-soft:    #1F2733;

  --sidebar-bg:        #0E0C09;
  --sidebar-fg:        #E8DDC5;
  --sidebar-muted:     #8A7E66;
  --sidebar-active-bg: rgba(229,181,71,0.12);
  --sidebar-active-fg: var(--bread-200);
  --sidebar-border:    rgba(245,238,224,0.07);

  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3), 0 2px 4px rgba(0,0,0,.25);
  --shadow-md: 0 2px 4px rgba(0,0,0,.35), 0 8px 20px rgba(0,0,0,.3);
  --shadow-lg: 0 4px 8px rgba(0,0,0,.4), 0 16px 40px rgba(0,0,0,.45);
}

:root[data-density="compact"] { --row-h:36px; --pad-card:16px; }
:root[data-density="cozy"]    { --row-h:44px; --pad-card:20px; }
:root[data-density="comfy"]   { --row-h:52px; --pad-card:28px; }

/* ============================================================
   2. BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  font-family: var(--font-body);
  font-size: var(--fs-14);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background 300ms ease, color 300ms ease;
}

@media (hover: none) and (pointer: coarse) {
  body {
    transition: none;
    -webkit-tap-highlight-color: transparent;
  }
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 500;
  font-variation-settings: "opsz" 144;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
h1 { font-size: var(--fs-40); line-height: 1.05; letter-spacing: -0.025em; }
h2 { font-size: var(--fs-32); line-height: 1.10; letter-spacing: -0.02em; }
h3 { font-size: var(--fs-24); line-height: 1.15; }
h4 { font-size: var(--fs-20); line-height: 1.20; }
h5 { font-size: var(--fs-16); line-height: 1.30; font-weight: 600; }

p { margin: 0; line-height: 1.55; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

::selection { background: var(--bread-100); color: var(--ink-700); }
:root[data-theme="dark"] ::selection { background: var(--terra-500); color: #FFFAF1; }

/* ============================================================
   3. MOOD — variations d'ambiance (sur <body>)
   ============================================================ */
body[data-mood="calme"] {
  --tile-bg: #1F1A14;
  --tile-bg-hover: #261F18;
  --tile-border: rgba(245,238,224,.08);
  --tile-border-hover: rgba(245,238,224,.16);
  --label-color: var(--sand-50);
  --meta-color: var(--sand-200);
  background: #15120E;
  color: var(--sand-100);
}

body[data-mood="atelier"] {
  background: #1A130B;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(229,181,71,.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(176,85,47,.08) 0%, transparent 50%);
  color: #F5E5C8;
  --tile-bg: linear-gradient(165deg, #2B2117 0%, #221A11 100%);
  --tile-bg-hover: linear-gradient(165deg, #322617 0%, #28200F 100%);
  --tile-border: rgba(229,181,71,.12);
  --tile-border-hover: rgba(229,181,71,.25);
  --label-color: #FBF0D6;
  --meta-color: #C9B999;
}

body[data-mood="aurore"] {
  background: #F1E7D2;
  color: var(--ink-700);
  --tile-bg: #FFFAF1;
  --tile-bg-hover: #FFF6E5;
  --tile-border: rgba(45,35,20,.14);
  --tile-border-hover: rgba(45,35,20,.28);
  --label-color: var(--ink-700);
  --meta-color: var(--ink-400);
}

/* Mood `aurore` est conçu pour le thème light. En dark, on neutralise
   ses overrides hardcodés (background/color/tile-*) pour laisser les
   variables sémantiques basculer correctement. Cf. DESIGN.md §3
   "data-theme et data-mood orthogonaux" — fix toggle sombre 2026-05-14. */
html[data-theme="dark"] body[data-mood="aurore"] {
  background: var(--bg);
  color: var(--text);
  --tile-bg: var(--surface);
  --tile-bg-hover: var(--surface-2);
  --tile-border: var(--border);
  --tile-border-hover: var(--border-strong);
  --label-color: var(--text);
  --meta-color: var(--text-muted);
}
html[data-theme="dark"] body[data-mood="aurore"] .tile,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile {
  box-shadow: var(--shadow-sm);
}
html[data-theme="dark"] body[data-mood="aurore"] .tile:hover,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
/* Accents tile en dark+aurore : versions plus claires des couleurs
   pour rester lisibles sur fond sombre */
html[data-theme="dark"] body[data-mood="aurore"] .tile.terra,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile.terra { --accent: var(--terra-300); --accent-soft: rgba(216,138,101,.14); }
html[data-theme="dark"] body[data-mood="aurore"] .tile.bread,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile.bread { --accent: var(--bread-200); --accent-soft: rgba(229,181,71,.14); }
html[data-theme="dark"] body[data-mood="aurore"] .tile.pist,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile.pist  { --accent: var(--pistache-200); --accent-soft: rgba(183,194,130,.14); }
html[data-theme="dark"] body[data-mood="aurore"] .tile.berry,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile.berry { --accent: var(--berry-200); --accent-soft: rgba(224,130,122,.14); }
html[data-theme="dark"] body[data-mood="aurore"] .tile.blue,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile.blue  { --accent: var(--blueb-200); --accent-soft: rgba(126,146,175,.14); }
html[data-theme="dark"] body[data-mood="aurore"] .tile.cream,
html[data-theme="dark"] body[data-mood="aurore"] .lab-tile.cream { --accent: var(--sand-200); --accent-soft: rgba(236,224,203,.10); }

/* Symétrie : moods `calme` / `atelier` sont conçus pour dark.
   En light, neutraliser leurs fonds sombres hardcodés. */
html[data-theme="light"] body[data-mood="calme"],
html[data-theme="light"] body[data-mood="atelier"] {
  background: var(--bg);
  color: var(--text);
  background-image: none;
  --tile-bg: var(--surface);
  --tile-bg-hover: var(--bg-soft);
  --tile-border: var(--border-soft);
  --tile-border-hover: var(--border-strong);
  --label-color: var(--text);
  --meta-color: var(--text-muted);
}
/* Accents renforcés sur fond clair — design system cuisine-app L84-89 */
body[data-mood="aurore"] .tile.terra,
body[data-mood="aurore"] .lab-tile.terra { --accent: var(--terra-600); --accent-soft: rgba(176,85,47,.14); }
body[data-mood="aurore"] .tile.bread,
body[data-mood="aurore"] .lab-tile.bread { --accent: var(--bread-500); --accent-soft: rgba(154,116,24,.16); }
body[data-mood="aurore"] .tile.pist,
body[data-mood="aurore"] .lab-tile.pist  { --accent: var(--pistache-400); --accent-soft: rgba(110,123,62,.14); }
body[data-mood="aurore"] .tile.berry,
body[data-mood="aurore"] .lab-tile.berry { --accent: var(--berry-400); --accent-soft: rgba(153,56,52,.13); }
body[data-mood="aurore"] .tile.blue,
body[data-mood="aurore"] .lab-tile.blue  { --accent: var(--blueb-400); --accent-soft: rgba(54,75,106,.13); }
body[data-mood="aurore"] .tile.cream,
body[data-mood="aurore"] .lab-tile.cream { --accent: var(--ink-500); --accent-soft: rgba(42,37,32,.10); }

body[data-mood="aurore"] .tile,
body[data-mood="aurore"] .lab-tile {
  box-shadow: 0 1px 2px rgba(45,35,20,.05), 0 6px 16px rgba(45,35,20,.09);
}
body[data-mood="aurore"] .tile:hover,
body[data-mood="aurore"] .lab-tile:hover {
  box-shadow: 0 4px 10px rgba(45,35,20,.08), 0 14px 28px rgba(45,35,20,.14);
  transform: translateY(-1px);
}

/* ============================================================
   4. BOUTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  font-size: var(--fs-14);
  font-weight: 700;
  font-family: var(--font-body);
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast),
              border-color var(--t-fast), transform var(--t-fast),
              box-shadow var(--t-fast), filter var(--t-fast);
  white-space: nowrap;
  user-select: none;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .6; cursor: progress; }
.btn .ico,
.btn svg { width: 18px; height: 18px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-sm), var(--shadow-inset); }
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--bg-soft); border-color: var(--border-strong); }

.btn-ghost { color: var(--text); }
.btn-ghost:hover { background: var(--bg-soft); }

.btn-dark { background: var(--ink-600); color: var(--text-on-dark); }
.btn-dark:hover { background: var(--ink-500); }

.btn-danger { background: var(--danger); color: #FFFAF1; }
.btn-danger:hover { filter: brightness(.95); }

.btn-warning { background: var(--bread-300); color: var(--ink-700); }
.btn-warning:hover { filter: brightness(.95); }

.btn-success { background: var(--pistache-300); color: #FFFAF1; }
.btn-success:hover { filter: brightness(.95); }

/* Variantes "topbar" — boutons hauts (cuisine) */
.btn-tb { height: 56px; padding: 0 24px; font-size: var(--fs-15); border-radius: var(--r-lg); }
.btn-tb svg { width: 20px; height: 20px; }
.btn-sync {
  background: rgba(229,181,71,.10);
  color: var(--bread-200);
  border: 1px solid rgba(229,181,71,.18);
}
.btn-sync:hover { background: rgba(229,181,71,.16); }
.btn-sync svg { color: var(--bread-300); }
.btn-logout {
  background: rgba(176,85,47,.10);
  color: #E8B596;
  border: 1px solid rgba(176,85,47,.20);
}
.btn-logout:hover { background: rgba(176,85,47,.18); }
.btn-logout svg { color: var(--terra-300); }
.btn-back {
  background: rgba(245,238,224,.05);
  color: var(--label-color, var(--text));
  border: 1px solid rgba(245,238,224,.10);
}
.btn-back:hover { background: rgba(245,238,224,.10); }

body[data-mood="aurore"] .btn-sync   { background: rgba(229,181,71,.18); color: var(--bread-500); border-color: rgba(229,181,71,.35); }
body[data-mood="aurore"] .btn-logout { background: var(--terra-500); color: #FFFAF1; border-color: transparent; }
body[data-mood="aurore"] .btn-logout svg { color: #FFFAF1; }
body[data-mood="aurore"] .btn-back   { background: rgba(45,35,20,.05); border-color: rgba(45,35,20,.10); }

.btn-sm { height: 32px; padding: 0 12px; font-size: var(--fs-13); border-radius: var(--r-sm); }
.btn-lg { height: 48px; padding: 0 22px; font-size: var(--fs-15); border-radius: var(--r-lg); }
.btn-icon { width: 40px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-pill { border-radius: var(--r-full); }

/* ============================================================
   5. INPUTS / FIELDS
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: var(--fs-13); font-weight: 500; color: var(--text); letter-spacing: 0.01em; }
.field-hint  { font-size: var(--fs-12); color: var(--text-muted); }
.field-error { font-size: var(--fs-12); color: var(--danger); display: flex; align-items: center; gap: 4px; }

.input, .select, .textarea {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-size: var(--fs-14);
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.textarea { height: auto; padding: 12px 14px; min-height: 92px; resize: vertical; line-height: 1.5; }

.input::placeholder, .textarea::placeholder { color: var(--text-soft); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-strong); }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(176,85,47,.18);
}
.input.invalid { border-color: var(--danger); }
.input.invalid:focus { box-shadow: 0 0 0 3px rgba(194,79,74,.18); }
.input:disabled, .textarea:disabled, .select:disabled {
  background: var(--bg-soft); color: var(--text-soft); cursor: not-allowed;
}

.select-wrap { position: relative; }
.select { appearance: none; padding-right: 36px; cursor: pointer; }
.select-wrap::after {
  content: ""; position: absolute;
  right: 14px; top: 50%;
  width: 8px; height: 8px;
  border-right: 1.5px solid var(--text-muted);
  border-bottom: 1.5px solid var(--text-muted);
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
}

.check, .radio {
  appearance: none; width: 18px; height: 18px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface);
  cursor: pointer;
  display: inline-grid; place-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
}
.check { border-radius: 5px; }
.radio { border-radius: 50%; }
.check:checked, .radio:checked { background: var(--primary); border-color: var(--primary); }
.check:checked::after { content: ""; width: 5px; height: 9px; border-right: 2px solid var(--on-primary); border-bottom: 2px solid var(--on-primary); transform: rotate(45deg) translate(-1px,-1px); }
.radio:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--on-primary); }

.switch {
  --w:38px; --h:22px;
  appearance: none; width: var(--w); height: var(--h);
  background: var(--border-strong);
  border-radius: var(--r-full);
  position: relative; cursor: pointer;
  transition: background var(--t-fast);
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: calc(var(--h) - 4px); height: calc(var(--h) - 4px);
  border-radius: 50%; background: #FFFAF1;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast);
}
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(calc(var(--w) - var(--h))); }

/* ============================================================
   6. BADGES
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  font-size: 11.5px; font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--r-full);
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border-soft);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-primary { background: var(--primary-soft); color: var(--terra-700); border-color: transparent; }
.badge-success { background: var(--success-soft); color: var(--pistache-500); border-color: transparent; }
.badge-warning { background: var(--warning-soft); color: var(--bread-500); border-color: transparent; }
.badge-danger  { background: var(--danger-soft);  color: var(--berry-500); border-color: transparent; }
.badge-info    { background: var(--info-soft);    color: var(--blueb-400); border-color: transparent; }
.badge-dark    { background: var(--ink-600); color: var(--sand-100); border-color: transparent; }

:root[data-theme="dark"] .badge-primary { color: var(--terra-100); }
:root[data-theme="dark"] .badge-success { color: var(--pistache-100); }
:root[data-theme="dark"] .badge-warning { color: var(--bread-100); }
:root[data-theme="dark"] .badge-danger  { color: var(--berry-100); }
:root[data-theme="dark"] .badge-info    { color: var(--blueb-100); }

/* ============================================================
   7. CARDS / TABLES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--r-lg);
  padding: var(--pad-card, 20px);
  box-shadow: var(--shadow-xs);
}
.card-elev   { box-shadow: var(--shadow-md); border-color: transparent; }
.card-flat   { background: var(--bg-soft); border: none; box-shadow: none; }
.card-feature{ background: linear-gradient(135deg, var(--terra-50) 0%, var(--bread-50) 100%); border: none; }
:root[data-theme="dark"] .card-feature { background: linear-gradient(135deg, #2A1B12 0%, #2E2412 100%); }
.card-dark   { background: var(--ink-600); color: var(--text-on-dark); border: none; }

.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-title  { font-size: var(--fs-16); font-weight: 600; color: var(--text); }
.card-meta   { font-size: var(--fs-13); color: var(--text-muted); }

.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-14); }
.table thead th {
  text-align: left; font-weight: 600;
  font-size: var(--fs-12); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.table tbody td { padding: 14px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; color: var(--text); }
.table tbody tr:hover td { background: var(--bg-soft); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-variant-numeric: tabular-nums; }

.table-card { background: var(--surface); border: 1px solid var(--border-soft); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-xs); }

/* ============================================================
   8. APP / TOPBAR / GREET (layout cuisine)
   ============================================================ */
.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 36px;
  padding: 8px 4px;
}
.topbar-actions { display: flex; gap: 10px; flex-shrink: 0; }
.topbar-actions form { margin: 0; }

.greet { flex: 1; min-width: 0; }
.greet h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: var(--label-color, var(--text));
  margin: 0;
  font-variation-settings: 'opsz' 144;
}
.greet h1 em { font-style: italic; color: var(--bread-300); }
.greet .meta {
  margin-top: 8px;
  color: var(--meta-color, var(--text-muted));
  opacity: 0.75;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

.page-head { display: flex; align-items: center; gap: 18px; margin-bottom: 36px; }
.page-head-text { flex: 1; min-width: 0; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--label-color, var(--text));
  margin: 0;
  line-height: 1.1;
  font-variation-settings: 'opsz' 144;
}
.page-head .sub { color: var(--meta-color, var(--text-muted)); opacity: .7; margin-top: 6px; font-size: 14px; }
.page-head-actions { display: flex; gap: 10px; flex-shrink: 0; }

/* ============================================================
   9. TUILES — grille principale et lab
   ============================================================ */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .tile-grid { grid-template-columns: 1fr; } }

.tile {
  position: relative;
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-xl);
  padding: 32px 28px;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  text-decoration: none;
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
  -webkit-tap-highlight-color: transparent;
}
.tile:hover { background: var(--tile-bg-hover, var(--bg-soft)); border-color: var(--tile-border-hover, var(--border)); }
.tile:active { transform: scale(.98); }

.tile-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  background: var(--accent-soft, rgba(229,181,71,.12));
  color: var(--accent, var(--bread-300));
  display: grid; place-items: center;
  flex-shrink: 0;
}
.tile-icon svg {
  width: 30px; height: 30px;
  stroke: currentColor; stroke-width: 1.6; fill: none;
  stroke-linecap: round; stroke-linejoin: round;
}
.tile-label {
  font-family: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 26px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--label-color, var(--text));
  line-height: 1.15;
  margin-top: auto;
}
.tile-badge {
  position: absolute;
  top: 24px; right: 24px;
  min-width: 28px; height: 28px;
  padding: 0 9px;
  background: var(--bread-300);
  color: var(--ink-700);
  font-weight: 700;
  font-size: 13px;
  border-radius: var(--r-full);
  display: inline-grid; place-items: center;
  font-variant-numeric: tabular-nums;
}
.tile-badge.danger { background: var(--berry-300); color: #FFFAF1; }

/* Couleurs accent — appliquer en plus de .tile / .lab-tile */
.tile.terra, .lab-tile.terra { --accent:#D88A65; --accent-soft:rgba(216,138,101,.12); --accent-strong:var(--terra-500); }
.tile.bread, .lab-tile.bread { --accent:var(--bread-300); --accent-soft:rgba(229,181,71,.12); --accent-strong:var(--bread-300); }
.tile.pist,  .lab-tile.pist  { --accent:#B7C282; --accent-soft:rgba(183,194,130,.12); --accent-strong:var(--pistache-300); }
.tile.berry, .lab-tile.berry { --accent:#E0827A; --accent-soft:rgba(224,130,122,.12); --accent-strong:var(--berry-300); }
.tile.blue,  .lab-tile.blue  { --accent:#92A5BE; --accent-soft:rgba(146,165,190,.12); --accent-strong:var(--blueb-300); }
.tile.cream, .lab-tile.cream { --accent:#E8DDC5; --accent-soft:rgba(232,221,197,.10); --accent-strong:#D8C9A5; }

/* Style "iconique" — icône central */
body[data-tile="iconique"] .tile,
body[data-tile="iconique"] .lab-tile {
  align-items: center;
  text-align: center;
  padding: 36px 22px;
  min-height: 220px;
  gap: 16px;
  justify-content: center;
}
body[data-tile="iconique"] .tile-icon,
body[data-tile="iconique"] .lab-tile-icon {
  width: 88px; height: 88px;
  border-radius: 26px;
}
body[data-tile="iconique"] .tile-icon svg,
body[data-tile="iconique"] .lab-tile-icon svg { width: 46px; height: 46px; }
body[data-tile="iconique"] .tile-label,
body[data-tile="iconique"] .lab-tile-name { margin-top: 0; font-size: 22px; }

/* Style "colore" — aplats saturés */
body[data-tile="colore"] .tile,
body[data-tile="colore"] .lab-tile {
  background: var(--accent-strong);
  border-color: transparent;
  color: var(--ink-700);
}
body[data-tile="colore"] .tile:hover,
body[data-tile="colore"] .lab-tile:hover { background: var(--accent-strong); filter: brightness(1.08); border-color: transparent; }
body[data-tile="colore"] .tile-icon,
body[data-tile="colore"] .lab-tile-icon { background: rgba(20,17,14,.18); color: var(--ink-700); }
body[data-tile="colore"] .tile-label,
body[data-tile="colore"] .lab-tile-name { color: var(--ink-700); }
body[data-tile="colore"] .tile.terra, body[data-tile="colore"] .tile.berry, body[data-tile="colore"] .tile.blue,
body[data-tile="colore"] .lab-tile.terra, body[data-tile="colore"] .lab-tile.berry, body[data-tile="colore"] .lab-tile.blue { color: #FFFAF1; }
body[data-tile="colore"] .tile.terra .tile-label, body[data-tile="colore"] .tile.berry .tile-label, body[data-tile="colore"] .tile.blue .tile-label,
body[data-tile="colore"] .lab-tile.terra .lab-tile-name, body[data-tile="colore"] .lab-tile.berry .lab-tile-name, body[data-tile="colore"] .lab-tile.blue .lab-tile-name { color: #FFFAF1; }
body[data-tile="colore"] .tile.terra .tile-icon, body[data-tile="colore"] .tile.berry .tile-icon, body[data-tile="colore"] .tile.blue .tile-icon,
body[data-tile="colore"] .lab-tile.terra .lab-tile-icon, body[data-tile="colore"] .lab-tile.berry .lab-tile-icon, body[data-tile="colore"] .lab-tile.blue .lab-tile-icon { background: rgba(255,255,255,.18); color: #FFFAF1; }

/* Lab tiles (grille 4 colonnes) */
.lab-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 900px) { .lab-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px) { .lab-grid { grid-template-columns: repeat(2, 1fr); } }

.lab-tile {
  position: relative;
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-xl);
  padding: 28px 24px;
  min-height: 180px;
  display: flex; flex-direction: column;
  gap: 16px;
  cursor: pointer;
  text-align: left;
  color: var(--label-color, var(--text));
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
}
.lab-tile:hover { background: var(--tile-bg-hover, var(--bg-soft)); border-color: var(--tile-border-hover, var(--border)); }
.lab-tile:active { transform: scale(.98); }
.lab-tile-icon {
  width: 56px; height: 56px;
  border-radius: var(--r-lg);
  background: var(--accent-soft, rgba(229,181,71,.12));
  color: var(--accent, var(--bread-300));
  display: grid; place-items: center;
  flex-shrink: 0;
}
.lab-tile-icon svg { width: 30px; height: 30px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.lab-tile-name { font-family: 'Outfit', 'Plus Jakarta Sans', system-ui, sans-serif; font-size: 24px; font-weight: 600; color: var(--label-color, var(--text)); letter-spacing: -0.005em; line-height: 1.15; margin-top: auto; }
.lab-tile-count { font-size: 13px; color: var(--meta-color, var(--text-muted)); font-variant-numeric: tabular-nums; }
.lab-tile.featured {
  background: var(--bread-300);
  border-color: transparent;
  color: var(--ink-700);
}
.lab-tile.featured .lab-tile-name,
.lab-tile.featured .lab-tile-count { color: var(--ink-700); }
.lab-tile.featured .lab-tile-icon { background: rgba(20,17,14,.18); color: var(--ink-700); }

/* ============================================================
   10. TYPO — voix
   ============================================================ */
body[data-type="artisanal"] .greet h1,
body[data-type="artisanal"] .tile-label,
body[data-type="artisanal"] .lab-tile-name,
body[data-type="artisanal"] .page-head h1 {
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
}
body[data-type="artisanal"] .greet h1 { font-size: 38px; }
body[data-type="artisanal"] .tile-label { font-size: 30px; }
body[data-type="artisanal"] .page-head h1 { font-size: 34px; }
body[data-type="artisanal"] .lab-tile-name { font-size: 24px; }

body[data-type="bold"] .tile-label,
body[data-type="bold"] .lab-tile-name {
  font-family: var(--font-body);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  font-size: 18px;
  line-height: 1.15;
}
body[data-type="bold"] .greet h1,
body[data-type="bold"] .page-head h1 {
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: none;
}
body[data-type="bold"] .greet h1 em { font-style: normal; font-weight: 800; color: var(--bread-300); }
body[data-type="bold"] .lab-tile-name { font-size: 16px; }

/* ============================================================
   11. UTILS
   ============================================================ */
.hstack { display: flex; align-items: center; gap: var(--gap, 12px); }
.vstack { display: flex; flex-direction: column; gap: var(--gap, 12px); }
.spacer { flex: 1; }
.muted  { color: var(--text-muted); }
.soft   { color: var(--text-soft); }
.tnum   { font-variant-numeric: tabular-nums; }
.mono   { font-family: var(--font-mono); }
.serif  { font-family: var(--font-display); }

.divider { height: 1px; background: var(--border-soft); border: 0; margin: 16px 0; }

@keyframes spin     { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
.spin { animation: spin 1s linear infinite; display: inline-block; }
.fade-in-up { animation: fadeInUp .5s cubic-bezier(.16,1,.3,1) backwards; }

/* ============================================================
   12. RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .app { padding: 20px 16px 32px; }
  .topbar { flex-wrap: wrap; }
  .page-head {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }
  .page-head-actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .page-head-actions > * { flex: 1; min-width: 0; }
  .page-head h1 { font-size: 24px; }
  .greet h1 { font-size: 26px; }
  .tile { padding: 24px; min-height: 160px; }
  .tile-label { font-size: 22px; }
  body[data-tile="iconique"] .tile { padding: 28px 18px; min-height: 180px; }
  body[data-tile="iconique"] .tile-icon { width: 72px; height: 72px; border-radius: 22px; }
  body[data-tile="iconique"] .tile-icon svg { width: 38px; height: 38px; }
  body[data-tile="iconique"] .tile-label { font-size: 20px; }
  .btn-tb { height: 48px; padding: 0 18px; font-size: var(--fs-14); }
}

/* ============================================================
   13. COMPOSANTS APPLICATIFS PARTAGÉS
   ============================================================ */

/* --- 13.1 Empty state ---------------------------------------- */
.empty-state {
  margin-top: 32px;
  padding: 56px 32px;
  text-align: center;
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-xl);
  color: var(--meta-color, var(--text-muted));
}
.empty-state-icon {
  width: 72px; height: 72px;
  margin: 0 auto 16px;
  border-radius: 22px;
  display: grid; place-items: center;
  background: rgba(229,181,71,.10);
  color: var(--bread-300);
}
.empty-state-icon svg { width: 38px; height: 38px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.empty-state-icon.terra { background: rgba(216,138,101,.14); color: var(--terra-300); }
.empty-state-icon.pist  { background: rgba(142,156,86,.14); color: #B7C282; }
.empty-state-icon.berry { background: rgba(224,130,122,.14); color: var(--berry-300); }
.empty-state-icon.blue  { background: rgba(146,165,190,.14); color: #92A5BE; }
.empty-state h3 { font-family: var(--font-display); font-size: 22px; color: var(--label-color, var(--text)); margin: 0 0 8px; font-variation-settings: 'opsz' 144; }
.empty-state p  { font-size: 14px; margin: 0; }

/* --- 13.2 Info card ------------------------------------------ */
.info-card {
  margin-top: 32px;
  padding: 20px 24px;
  background: rgba(79,103,136,.10);
  border: 1px solid rgba(79,103,136,.22);
  border-radius: var(--r-lg);
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.info-card-icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  border-radius: 12px;
  background: rgba(79,103,136,.18);
  color: #92A5BE;
  display: grid; place-items: center;
}
.info-card-icon svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.info-card.warning { background: rgba(229,181,71,.10); border-color: rgba(229,181,71,.25); }
.info-card.warning .info-card-icon { background: rgba(229,181,71,.18); color: var(--bread-300); }
.info-card.danger  { background: rgba(194,79,74,.10);  border-color: rgba(194,79,74,.25); }
.info-card.danger  .info-card-icon { background: rgba(194,79,74,.18); color: var(--berry-300); }
.info-card.success { background: rgba(142,156,86,.10); border-color: rgba(142,156,86,.25); }
.info-card.success .info-card-icon { background: rgba(142,156,86,.18); color: #B7C282; }
.info-card h3 { font-family: var(--font-body); font-size: 14px; font-weight: 600; color: var(--label-color, var(--text)); margin: 0 0 4px; }
.info-card p  { font-size: 13px; color: var(--meta-color, var(--text-muted)); line-height: 1.5; margin: 0; }

/* --- 13.3 Labo tile (couleur dynamique DB) ------------------- */
.labo-tile {
  position: relative;
  border-radius: var(--r-xl);
  border: 1px solid transparent;
  padding: 28px 22px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: transform 100ms ease, filter 120ms ease, box-shadow 150ms ease;
  box-shadow: var(--shadow-md);
  -webkit-tap-highlight-color: transparent;
}
.labo-tile:hover  { filter: brightness(1.06); transform: translateY(-2px); }
.labo-tile:active { transform: translateY(0); filter: brightness(.95); }
.labo-tile-name {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1.1;
  font-variation-settings: 'opsz' 144;
}

/* --- 13.4 Pinpad (login PIN) --------------------------------- */
.login-card {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-2xl);
  padding: 56px 52px;
  animation: fadeInUp .5s cubic-bezier(.16,1,.3,1) backwards;
}
.login-card-header { text-align: center; margin-bottom: 32px; }
.login-card-title  {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--label-color, var(--text));
  margin: 0 0 6px;
  font-variation-settings: 'opsz' 144;
}
.login-card-title em { font-style: italic; color: var(--bread-300); }
.login-card-subtitle { color: var(--meta-color, var(--text-muted)); font-size: 14px; opacity: .8; }

.code-display {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 32px;
  padding: 0 16px;
  background: rgba(229,181,71,.06);
  border: 1px solid rgba(229,181,71,.18);
  border-radius: var(--r-lg);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
.code-display.active { border-color: rgba(229,181,71,.45); box-shadow: 0 0 0 4px rgba(229,181,71,.10); }
.code-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(245,238,224,.18);
  transition: background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.code-dot.filled {
  background: var(--terra-500);
  transform: scale(1.45);
  box-shadow: 0 0 0 3px rgba(206,107,69,.20);
}
body[data-mood="aurore"] .code-dot { background: rgba(45,35,20,.18); }
body[data-mood="aurore"] .code-dot.filled {
  background: var(--terra-600, #b8512f);
  box-shadow: 0 0 0 3px rgba(184,81,47,.22);
}
body[data-mood="aurore"] .code-display { background: rgba(229,181,71,.10); }

.pinpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 100%;
  margin: 0 auto;
}
.pinpad-btn {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--tile-border, var(--border-soft));
  background: var(--tile-bg, var(--surface));
  color: var(--label-color, var(--text));
  border-radius: var(--r-lg);
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 38px);
  font-weight: 500;
  font-variation-settings: 'opsz' 144;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, transform 80ms ease, filter 120ms ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.pinpad-btn:hover  { background: var(--tile-bg-hover, var(--bg-soft)); border-color: var(--tile-border-hover, var(--border)); }
.pinpad-btn:active { transform: scale(.96); filter: brightness(.92); }
.pinpad-btn span   { position: absolute; inset: 0; display: grid; place-items: center; }
.pinpad-btn--clear {
  background: rgba(176,85,47,.08);
  color: #E8B596;
  border-color: rgba(176,85,47,.18);
  font-size: clamp(18px, 4vw, 22px);
  font-weight: 600;
  font-family: var(--font-body);
}
.pinpad-btn--clear:hover { background: rgba(176,85,47,.16); }
.pinpad-btn--ok {
  background: var(--bread-300);
  color: var(--ink-700);
  border-color: transparent;
}
.pinpad-btn--ok:hover { filter: brightness(1.05); }
.pinpad-btn--ok span  { font-weight: 700; }

/* Login : occupe tout l'écran sur mobile */
@media (max-width: 540px) {
  body.is-login { place-items: stretch; padding: 12px; }
  body.is-login .app { width: 100%; }
  .login-card {
    max-width: none;
    width: 100%;
    padding: 24px 16px;
    border-radius: var(--r-xl);
  }
  .login-card-header { margin-bottom: 28px; }
  .login-card-title { font-size: 42px; }
  .login-card-subtitle { font-size: 16px; }
  .code-display {
    height: 76px;
    margin-bottom: 28px;
    gap: 22px;
  }
  .code-dot { width: 22px; height: 22px; }
  .pinpad {
    gap: 14px;
    max-width: none;
  }
  .pinpad-btn { font-size: clamp(34px, 9vw, 44px); }
}

@media (max-height: 680px) and (max-width: 540px) {
  .login-card { padding: 22px 18px; }
  .login-card-header { margin-bottom: 16px; }
  .login-card-title { font-size: 32px; }
  .code-display { height: 56px; margin-bottom: 18px; gap: 16px; }
  .code-dot { width: 16px; height: 16px; }
  .pinpad { gap: 10px; }
  .pinpad-btn { font-size: clamp(26px, 7vw, 34px); }
}

/* --- 13.5 Modal & lightbox ----------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(11,9,7,.92);
  backdrop-filter: blur(6px);
  animation: fadeInModal .25s ease-out;
}
.modal-backdrop.active { display: flex; }
@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }

.modal-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border));
  border-radius: var(--r-2xl);
  padding: 32px;
  overflow-y: auto;
  animation: slideUp .3s ease-out;
  box-shadow: var(--shadow-lg);
}
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--tile-border, var(--border));
}
.modal-title {
  font-family: var(--font-display);
  color: var(--label-color, var(--text));
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.015em;
  margin: 0;
  font-variation-settings: 'opsz' 144;
}

.lightbox {
  position: fixed; inset: 0;
  z-index: 10001;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(11,9,7,.97);
  animation: fadeInModal .2s;
}
.lightbox.active { display: flex; }
.lightbox img {
  max-width: 95vw; max-height: 95vh;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  animation: zoomIn .3s ease-out;
}
.lightbox-close { position: absolute; top: 24px; right: 24px; z-index: 10002; }
@keyframes zoomIn { from { transform: scale(.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* --- 13.6 Ingredient card (modal historique) ----------------- */
.ingredient-card {
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-left: 3px solid var(--bread-300);
  border-radius: var(--r-lg);
  padding: 16px 20px;
  margin-bottom: 12px;
  transition: filter var(--t-fast), border-color var(--t-fast);
}
.ingredient-card:hover { border-left-color: var(--terra-400); }
.ingredient-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.ingredient-card .ingredient-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--bread-200);
  margin-bottom: 4px;
}
.ingredient-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.ingredient-detail-item {
  background: var(--tile-bg, var(--surface));
  padding: 10px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--tile-border, var(--border-soft));
}
.ingredient-detail-label {
  font-size: 11px;
  color: var(--meta-color, var(--text-muted));
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.ingredient-detail-value {
  font-size: 14px;
  color: var(--label-color, var(--text));
  font-weight: 600;
}
.ingredients-summary {
  margin-top: 24px;
  padding: 16px 20px;
  background: rgba(229,181,71,.08);
  border: 1px solid rgba(229,181,71,.20);
  border-radius: var(--r-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.ingredients-summary-text { font-size: 14px; color: var(--bread-200); font-weight: 600; }

.ingredient-photos-section { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--tile-border, var(--border-soft)); }
.ingredient-photos-header { font-size: 12px; color: var(--meta-color, var(--text-muted)); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 12px; }
.ingredient-photos-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.ingredient-photo-item {
  position: relative;
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  aspect-ratio: 1;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
.ingredient-photo-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.ingredient-photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ingredient-photo-overlay {
  position: absolute; inset: 0;
  background: rgba(11,9,7,.55);
  display: grid; place-items: center;
  opacity: 0;
  transition: opacity var(--t-fast);
  color: #FFFAF1;
  font-weight: 600;
  font-size: 22px;
}
.ingredient-photo-item:hover .ingredient-photo-overlay { opacity: 1; }
.ingredient-photo-meta {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(11,9,7,.85), transparent);
  padding: 6px 8px 4px;
  font-size: 11px;
  color: var(--sand-50);
}

/* --- 13.7 Spinner -------------------------------------------- */
.spinner {
  border: 3px solid rgba(229,181,71,.18);
  border-top: 3px solid var(--bread-300);
  border-radius: 50%;
  width: 40px; height: 40px;
  animation: spin 1s linear infinite;
  margin: 0 auto;
}

/* --- 13.8 Badge "voir détails" ------------------------------- */
.badge-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(79,103,136,.18);
  color: #92A5BE;
  padding: 6px 14px;
  border-radius: var(--r-full);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: filter var(--t-fast), transform var(--t-fast);
  border: 1px solid rgba(79,103,136,.30);
}
.badge-action:hover { filter: brightness(1.1); transform: scale(1.04); }

/* --- 13.9 DataTables — adapté Optigest ----------------------- */
.dt-optigest .dataTables_wrapper {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  padding: 24px;
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
}
.dt-optigest table.dataTable { width: 100% !important; background: transparent; border-collapse: separate; border-spacing: 0; }
.dt-optigest table.dataTable thead th {
  background: transparent;
  color: var(--text-muted);
  border-bottom: 1px solid var(--tile-border, var(--border));
  padding: 12px;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  font-family: var(--font-body);
}
.dt-optigest table.dataTable tbody td {
  padding: 12px;
  border-bottom: 1px solid var(--tile-border, var(--border-soft));
  color: var(--label-color, var(--text));
  font-size: 14px;
}
.dt-optigest table.dataTable tbody tr:hover td { background: rgba(229,181,71,.06) !important; }

.dt-optigest .dataTables_filter input,
.dt-optigest .dataTables_length select,
.dt-optigest .filters th input,
.dt-optigest .filters th select {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border));
  color: var(--label-color, var(--text));
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
}
.dt-optigest .dataTables_filter input { margin-left: 8px; }
.dt-optigest .dataTables_length select { margin: 0 8px; }
.dt-optigest .dataTables_info { color: var(--meta-color, var(--text-muted)); font-size: 13px; padding-top: 12px; }

.dt-optigest .dataTables_paginate .paginate_button {
  background: var(--tile-bg, var(--surface)) !important;
  border: 1px solid var(--tile-border, var(--border)) !important;
  color: var(--label-color, var(--text)) !important;
  padding: 6px 12px !important;
  margin: 0 4px !important;
  border-radius: var(--r-sm) !important;
}
.dt-optigest .dataTables_paginate .paginate_button:hover {
  background: rgba(229,181,71,.10) !important;
  border-color: rgba(229,181,71,.30) !important;
}
.dt-optigest .dataTables_paginate .paginate_button.current {
  background: var(--bread-300) !important;
  border-color: var(--bread-300) !important;
  color: var(--ink-700) !important;
}

.dt-optigest .dt-buttons { margin-bottom: 16px; display: flex; gap: 8px; flex-wrap: wrap; }
.dt-optigest .dt-button {
  background: var(--pistache-300) !important;
  color: #FFFAF1 !important;
  border: none !important;
  padding: 10px 16px !important;
  border-radius: var(--r-md) !important;
  font-family: var(--font-body) !important;
  font-weight: 600 !important;
  cursor: pointer !important;
  transition: filter var(--t-fast), transform var(--t-fast) !important;
  font-size: 14px !important;
}
.dt-optigest .dt-button:hover { filter: brightness(1.08) !important; transform: translateY(-1px); }

.date-filter-bar {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  padding: 16px 24px;
  border-radius: var(--r-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.date-filter-bar label { color: var(--label-color, var(--text)); font-weight: 600; margin-right: 12px; font-size: 14px; }
.date-filter-bar input[type="text"] {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border));
  color: var(--label-color, var(--text));
  padding: 8px 12px;
  border-radius: var(--r-md);
  font-family: var(--font-body);
  font-size: 14px;
  min-width: 250px;
}

/* --- 13.10 Section card (regroupements de contenu) ----------- */
.section-card {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-xl);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-xs);
}
.section-card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  color: var(--label-color, var(--text));
  margin: 0 0 16px;
  letter-spacing: -0.01em;
  font-variation-settings: 'opsz' 144;
}

/* --- 13.11 Layout login (page centrée) ----------------------- */
body.is-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* --- 13.12 Recette — multiplicateur, mode toggle, ingredient list, étapes --- */
.multiplier-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.multiplier-bar .field-label { margin-right: 8px; }
.mult-btn {
  height: 40px;
  min-width: 56px;
  padding: 0 14px;
  border-radius: var(--r-md);
  background: rgba(79,103,136,.12);
  color: var(--blueb-200);
  border: 1px solid rgba(79,103,136,.28);
  font-weight: 600;
  font-size: var(--fs-14);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.mult-btn:hover { background: rgba(79,103,136,.20); }
.mult-btn.active {
  background: var(--terra-500);
  border-color: var(--terra-500);
  color: var(--on-primary);
}
.mult-custom { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.mult-custom .input { width: 80px; height: 40px; text-align: center; font-weight: 600; }

.recipe-mode-toggle {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 16px 20px;
  background: rgba(142,156,86,.08);
  border: 1px solid rgba(142,156,86,.22);
  border-radius: var(--r-lg);
  margin-bottom: 16px;
}
.recipe-mode-toggle.active { background: rgba(142,156,86,.14); border-color: rgba(142,156,86,.40); }
.recipe-controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.recipe-action-btn { display: none; }
.recipe-action-btn.active { display: inline-flex; }
.progress-indicator {
  display: none;
  font-size: var(--fs-16);
  font-weight: 700;
  color: var(--pistache-200);
  font-variant-numeric: tabular-nums;
}
.progress-indicator.active { display: inline-block; }

.ingredient-list { display: flex; flex-direction: column; gap: 12px; }
.ingredient-item {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(79,103,136,.08);
  border: 1px solid rgba(79,103,136,.22);
  border-left: 4px solid var(--blueb-300);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  user-select: none;
}
.ingredient-item:hover { background: rgba(79,103,136,.14); }
.ingredient-item.checked {
  background: rgba(142,156,86,.14);
  border-left-color: var(--pistache-300);
  opacity: .75;
}
.ingredient-item.checked .ingredient-name,
.ingredient-item.checked .ingredient-qty-value { text-decoration: line-through; }
.ingredient-checkbox {
  display: none;
  width: 26px; height: 26px;
  border: 2px solid var(--blueb-300);
  border-radius: 50%;
  flex-shrink: 0;
  align-items: center; justify-content: center;
  background: transparent;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.ingredient-checkbox.active { display: inline-flex; }
.ingredient-item.checked .ingredient-checkbox {
  background: var(--pistache-300);
  border-color: var(--pistache-300);
}
.ingredient-item.checked .ingredient-checkbox::after {
  content: ""; width: 6px; height: 11px;
  border-right: 2px solid #FFFAF1;
  border-bottom: 2px solid #FFFAF1;
  transform: rotate(45deg) translate(-1px,-1px);
}
.ingredient-left { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.ingredient-number {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: rgba(79,103,136,.20);
  color: var(--blueb-200);
  font-weight: 700;
  font-size: var(--fs-14);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.ingredient-item.checked .ingredient-number { background: rgba(142,156,86,.25); color: var(--pistache-200); }
.ingredient-item .ingredient-name { font-size: var(--fs-16); font-weight: 600; color: var(--label-color, var(--text)); line-height: 1.3; }
.ingredient-right {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px;
  background: rgba(79,103,136,.16);
  border-radius: var(--r-md);
  flex-wrap: wrap;
}
.ingredient-item.checked .ingredient-right { background: rgba(142,156,86,.22); }
.ingredient-qty-value { font-size: 24px; font-weight: 800; color: var(--blueb-200); line-height: 1; font-variant-numeric: tabular-nums; }
.ingredient-item.checked .ingredient-qty-value { color: var(--pistache-200); }
.ingredient-unit { font-size: var(--fs-15); color: var(--text-muted); font-weight: 600; }
.qty-original { color: var(--text-muted); font-size: var(--fs-13); font-weight: normal; }

.ingredient-photo-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--terra-500);
  color: var(--on-primary);
  border: none;
  display: none;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: filter var(--t-fast), transform var(--t-fast);
  box-shadow: var(--shadow-sm);
}
.ingredient-photo-btn.active { display: inline-flex; }
.ingredient-photo-btn:hover { filter: brightness(1.08); transform: scale(1.05); }
.ingredient-photo-btn svg { width: 22px; height: 22px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ingredient-photo-count {
  display: none;
  min-width: 22px; padding: 2px 8px;
  border-radius: var(--r-full);
  background: var(--berry-300);
  color: #FFFAF1;
  font-size: 12px; font-weight: 700;
  text-align: center;
}
.ingredient-photo-count.active { display: inline-flex; align-items: center; justify-content: center; }
.ingredient-photos-container {
  display: none;
  flex-wrap: wrap; gap: 8px;
  padding-left: 60px; margin-top: -4px;
}
.ingredient-photos-container.active { display: flex; }
.photo-thumbnail {
  position: relative;
  width: 96px; height: 96px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 2px solid var(--terra-500);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-fast);
}
.photo-thumbnail:hover { transform: scale(1.05); }
.photo-thumbnail img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-delete-btn {
  position: absolute;
  top: 4px; right: 4px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--berry-300);
  color: #FFFAF1;
  border: none;
  cursor: pointer;
  display: grid; place-items: center;
  font-size: 14px;
  box-shadow: var(--shadow-sm);
}

.etape-list { display: flex; flex-direction: column; gap: 12px; }
.etape-item {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 16px;
  background: rgba(176,85,47,.06);
  border: 1px solid rgba(176,85,47,.18);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
}
.etape-item:hover { background: rgba(176,85,47,.12); border-color: rgba(176,85,47,.30); }
.etape-item.checked { background: rgba(142,156,86,.12); border-color: rgba(142,156,86,.30); }
.etape-checkbox {
  width: 26px; height: 26px;
  border: 2px solid rgba(176,85,47,.45);
  border-radius: 7px;
  flex-shrink: 0;
  margin-top: 2px;
  background: transparent;
  display: grid; place-items: center;
}
.etape-item.checked .etape-checkbox { background: var(--pistache-300); border-color: var(--pistache-300); }
.etape-item.checked .etape-checkbox::after {
  content: ""; width: 6px; height: 11px;
  border-right: 2px solid #FFFAF1;
  border-bottom: 2px solid #FFFAF1;
  transform: rotate(45deg) translate(-1px,-1px);
}
.etape-number {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--terra-500);
  color: var(--on-primary);
  font-weight: 700; font-size: var(--fs-14);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.etape-description { flex: 1; line-height: 1.55; color: var(--label-color, var(--text)); font-size: var(--fs-14); }
.etape-item.checked .etape-description { opacity: .65; text-decoration: line-through; }

@media (max-width: 720px) {
  .ingredient-item { flex-direction: column; align-items: flex-start; gap: 12px; }
  .ingredient-left, .ingredient-right { width: 100%; }
  .ingredient-photos-container { padding-left: 0; }
}

/* --- 13.13 Toast notification ------------------------------- */
.toast-notification {
  position: fixed;
  top: 20px; right: 20px;
  z-index: 10002;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: var(--pistache-300);
  color: #FFFAF1;
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  max-width: 400px;
  opacity: 0;
  transform: translateX(420px);
  transition: opacity var(--t-med), transform var(--t-med);
}
.toast-notification.show { opacity: 1; transform: translateX(0); }
.toast-notification.warning { background: var(--bread-300); color: var(--ink-700); }
.toast-notification.error { background: var(--berry-300); }
.toast-icon { font-size: 18px; flex-shrink: 0; font-weight: 700; }
.toast-content { flex: 1; min-width: 0; }
.toast-title { font-weight: 700; font-size: var(--fs-14); margin-bottom: 2px; }
.toast-message { font-size: var(--fs-13); opacity: .92; line-height: 1.4; }
.toast-close {
  background: none; border: none; color: inherit;
  font-size: 20px; cursor: pointer;
  width: 24px; height: 24px;
  display: grid; place-items: center;
  opacity: .8;
}
.toast-close:hover { opacity: 1; }

/* --- 13.14 Camera modal (recette photo) --------------------- */
.camera-modal {
  position: fixed; inset: 0;
  z-index: 10000;
  display: none;
  align-items: center; justify-content: center;
}
.camera-modal.active { display: flex; }
.camera-modal-backdrop { position: absolute; inset: 0; background: rgba(11,9,7,.95); backdrop-filter: blur(4px); }
.camera-modal-content {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--tile-border, var(--border));
  border-radius: var(--r-xl);
  overflow: hidden;
  max-width: 90vw; max-height: 90vh;
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
}
.camera-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--tile-border, var(--border-soft));
}
.camera-header h3 { margin: 0; color: var(--label-color, var(--text)); font-size: var(--fs-18); }
.camera-modal video {
  display: block;
  width: 100%; max-width: 800px;
  background: #000;
  object-fit: cover;
}
.camera-controls {
  padding: 18px;
  display: flex; justify-content: center; gap: 12px;
  background: var(--bg-soft);
}
@media (max-width: 768px) {
  .camera-modal-content { max-width: 100vw; max-height: 100vh; border-radius: 0; width: 100%; height: 100%; }
  .camera-modal video { height: calc(100vh - 140px); max-height: none; }
}

/* --- 13.15 Étiquette form layout (.user-layout, .qty-panel, .keypad, .num-btn, .allergenes) --- */
.user-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  margin-top: 16px;
}
@media (max-width: 900px) { .user-layout { grid-template-columns: 1fr; } }
.qty-panel {
  background: var(--bg-soft);
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-lg);
  padding: 18px;
}
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.num-btn {
  height: 56px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--tile-border, var(--border));
  color: var(--label-color, var(--text));
  font-size: var(--fs-20);
  font-weight: 600;
  font-family: var(--font-display);
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.num-btn:hover { background: var(--bg-soft); border-color: var(--border-strong); }
.num-btn:active { transform: scale(.96); }
.qty-input { font-size: var(--fs-24); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

.allergenes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.allergene-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-md);
  cursor: pointer;
  font-size: var(--fs-13);
}
.allergene-item:hover { border-color: var(--border-strong); }

/* --- 13.17 Editor (étiquette) layout ------------------------ */
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 24px;
}
@media (max-width: 1024px) { .editor-grid { grid-template-columns: 1fr; } }
.editor-canvas {
  display: block;
  width: 100%; height: auto;
  background: #FFFAF1;
  border: 1px solid var(--tile-border, var(--border));
  border-radius: var(--r-md);
  cursor: crosshair;
}
.editor-preview {
  display: block;
  width: 100%; height: auto;
  background: #FFFAF1;
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-md);
}
.rect-item {
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px;
  background: var(--bg-soft);
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-md);
  margin-bottom: 10px;
}
.rect-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rect-badge {
  min-width: 36px; height: 32px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  background: var(--terra-500); color: var(--on-primary);
  display: grid; place-items: center;
  font-weight: 700; font-size: var(--fs-13);
}
.rect-field { flex: 1; min-width: 160px; }
.rect-color input[type="color"] {
  width: 40px; height: 40px;
  padding: 0; border: 1px solid var(--tile-border, var(--border));
  border-radius: var(--r-sm);
  cursor: pointer; background: transparent;
}
.rect-font input[type="number"] { width: 72px; height: 40px; padding: 0 8px; }
.rect-align { display: inline-flex; gap: 4px; }
.align-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--tile-border, var(--border));
  background: var(--surface);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: grid; place-items: center;
}
.align-btn[aria-pressed="true"] { background: var(--terra-500); color: var(--on-primary); border-color: var(--terra-500); }
.rect-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.rect-advanced[data-open="false"] { display: none; }
.rect-advanced[data-open="true"] { display: block; padding-top: 8px; border-top: 1px dashed var(--tile-border, var(--border-soft)); }

body.is-login .app { padding: 0; max-width: 560px; }
@media (max-width: 540px) {
  body.is-login .app { max-width: none; padding: 12px; }
}

/* --- 13.18 Task cards (cleaning user dashboard) -------------- */
.task-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 900px) { .task-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .task-grid { grid-template-columns: 1fr; } }

.task-card {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-xl);
  padding: 18px 18px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  position: relative;
  box-shadow: var(--shadow-xs);
}
.task-card.is-todo { border-color: rgba(229,181,71,.45); box-shadow: 0 0 0 1px rgba(229,181,71,.12) inset; }
.task-card.is-done {
  border-color: rgba(142,156,86,.45);
  box-shadow: 0 0 0 1px rgba(142,156,86,.12) inset;
  background: rgba(142,156,86,.04);
}
/* Une fois validée, la carte s'efface visuellement (désaturation + opacité)
   pour mettre en avant les tâches restant à faire. Le badge de statut et
   le bouton désactivé restent lisibles. */
.task-card.is-done .task-card-name,
.task-card.is-done .cleaning-pictograms,
.task-card.is-done .cleaning-action-banner {
  filter: saturate(.35);
  opacity: .55;
}
.task-card.is-done .cleaning-picto-icon { background: rgba(142,156,86,.10); }
.task-card.is-done .cleaning-picto-icon svg { stroke: var(--pistache-400); }
.task-card.is-done .cleaning-action-banner {
  background: rgba(142,156,86,.06);
  border-color: rgba(142,156,86,.20);
  color: var(--pistache-400);
}
.task-card.is-done .task-card-name::after {
  content: ' ✓';
  color: var(--pistache-300);
  font-weight: 800;
  filter: none;
  opacity: 1;
}
.task-card.is-idle { border-color: var(--tile-border, var(--border-soft)); }
.task-card-header { width: 100%; display: flex; align-items: flex-start; justify-content: center; position: relative; }
.task-card-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--label-color, var(--text));
  margin: 0;
  font-variation-settings: 'opsz' 144;
}
.task-card-meta { color: var(--meta-color, var(--text-muted)); font-size: 13px; margin-top: 2px; }
.task-info-btn {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--tile-border, var(--border));
  background: var(--bg-soft, rgba(245,238,224,.04));
  color: var(--blueb-300);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: filter var(--t-fast), transform var(--t-fast), border-color var(--t-fast);
}
.task-info-btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.task-info-btn:hover { transform: translateY(-1px); border-color: rgba(79,103,136,.5); }
.task-action { width: 100%; display: flex; justify-content: center; }
.task-action form, .task-action .btn { width: 100%; max-width: 220px; }

/* Status pill (réutilisable) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: var(--r-full);
  border: 1px solid transparent;
  font-family: var(--font-body);
}
.status-pill.is-todo  { color: var(--bread-300);    border-color: rgba(229,181,71,.35); background: rgba(229,181,71,.10); }
.status-pill.is-done  { color: #B7C282;             border-color: rgba(142,156,86,.35); background: rgba(142,156,86,.10); }
.status-pill.is-idle  { color: var(--meta-color, var(--text-muted)); border-color: var(--tile-border, var(--border-soft)); background: rgba(245,238,224,.04); }

/* Plans groupés (cleaning user dashboard v3) — accordéon */
.cleaning-plan-section { margin-bottom: 18px; }

/* Header cliquable (button reset + layout flex) */
.cleaning-plan-header {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px 10px 0;
  margin-bottom: 12px;
  border: 0;
  background: transparent;
  border-bottom: 2px solid var(--terra-300);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--label-color, var(--text));
  -webkit-tap-highlight-color: transparent;
  transition: background var(--t-fast);
  flex-wrap: wrap;
}
.cleaning-plan-header:hover {
  background: var(--bg-soft, rgba(245,238,224,.04));
}
.cleaning-plan-chevron {
  width: 28px; height: 28px;
  border-radius: var(--r-full);
  background: var(--bg-soft, rgba(245,238,224,.06));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--terra-500);
  flex-shrink: 0;
  transition: transform var(--t-fast);
}
.cleaning-plan-chevron svg {
  width: 14px; height: 14px;
  fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
/* État ouvert : chevron pointe vers le bas */
.cleaning-plan-section:not([data-collapsed]) .cleaning-plan-chevron {
  transform: rotate(90deg);
}

.cleaning-plan-headline {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cleaning-plan-name {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--label-color, var(--text));
  letter-spacing: -.005em;
}
.cleaning-plan-icon {
  width: 22px; height: 22px;
  fill: none; stroke: var(--terra-500);
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.cleaning-plan-desc {
  font-size: 13px;
  color: var(--meta-color, var(--text-muted));
}
.cleaning-plan-progress {
  min-width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.cleaning-progress-text {
  font-size: 12px;
  color: var(--meta-color, var(--text-muted));
  display: block;
  text-align: right;
}
.cleaning-progress-bar {
  height: 6px;
  background: var(--bg-soft, rgba(245,238,224,.08));
  border-radius: var(--r-full);
  overflow: hidden;
  border: 1px solid var(--tile-border, var(--border-soft));
  display: block;
}
.cleaning-progress-fill {
  height: 100%;
  background: var(--pistache-300);
  border-radius: var(--r-full);
  transition: width var(--t-med);
  display: block;
}
/* Compteur lorsque pas de tâches dues aujourd'hui */
.cleaning-plan-count {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--bg-soft, rgba(245,238,224,.06));
  border: 1px solid var(--tile-border, var(--border-soft));
  color: var(--meta-color, var(--text-muted));
  flex-shrink: 0;
}

/* Replié : on cache la grille de tâches */
.cleaning-plan-section[data-collapsed] [data-plan-body] {
  display: none;
}
.cleaning-plan-section[data-collapsed] .cleaning-plan-header {
  margin-bottom: 0;
  border-bottom-style: dashed;
  opacity: .85;
}

@media (max-width: 540px) {
  .cleaning-plan-name { font-size: 17px; }
  .cleaning-plan-progress { min-width: 100%; order: 3; }
}

/* Détail compact d'une tâche (carte) — fiche pratique visuelle compacte */

/* Pictogrammes en grille compacte (label sous l'icône, sans titre redondant).
   Préparation et Observation déplacées dans la modale détail (bouton ⓘ). */
.cleaning-pictograms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(72px, 1fr));
  gap: 4px;
  margin: 8px 0;
}
.cleaning-picto {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 3px;
  padding: 5px 3px;
  border-radius: var(--r-xs);
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
}
.cleaning-picto-icon {
  width: 26px; height: 26px;
  border-radius: var(--r-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.cleaning-picto-icon svg {
  width: 16px; height: 16px;
  fill: none; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.cleaning-picto-value {
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--label-color, var(--text));
  word-break: break-word;
  hyphens: auto;
  -webkit-hyphens: auto;
  /* Pas de clamp : on affiche le texte complet (la hauteur s'aligne
     automatiquement sur le picto le plus haut de la rangée). */
}

/* Variations colorimétriques par type */
.cleaning-picto[data-kind="product"] .cleaning-picto-icon { background: rgba(79,103,136,.10); }
.cleaning-picto[data-kind="product"] .cleaning-picto-icon svg { stroke: var(--blueb-300); }
.cleaning-picto[data-kind="dosage"]  .cleaning-picto-icon { background: rgba(229,181,71,.12); }
.cleaning-picto[data-kind="dosage"]  .cleaning-picto-icon svg { stroke: var(--bread-400); }
.cleaning-picto[data-kind="contact"] .cleaning-picto-icon { background: rgba(176,85,47,.10); }
.cleaning-picto[data-kind="contact"] .cleaning-picto-icon svg { stroke: var(--terra-500); }
.cleaning-picto[data-kind="rinse"]   .cleaning-picto-icon { background: rgba(79,103,136,.10); }
.cleaning-picto[data-kind="rinse"]   .cleaning-picto-icon svg { stroke: var(--blueb-300); }
.cleaning-picto[data-kind="dry"]     .cleaning-picto-icon { background: rgba(142,156,86,.12); }
.cleaning-picto[data-kind="dry"]     .cleaning-picto-icon svg { stroke: var(--pistache-400); }

/* Bande Action — geste principal, compacte */
.cleaning-action-banner {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--r-xs);
  background: rgba(176,85,47,.08);
  border: 1px solid rgba(176,85,47,.22);
  color: var(--terra-600);
  font-size: 11.5px;
  font-weight: 600;
  margin: 4px 0;
  line-height: 1.3;
}
.cleaning-action-banner svg {
  width: 14px; height: 14px;
  fill: none; stroke: var(--terra-500);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

.cleaning-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--tile-border, var(--border-soft));
}

/* Bouton "Validé" — affiché après émargement */
.btn.btn-validated {
  background: var(--pistache-100);
  color: var(--pistache-500);
  border: 1px solid var(--pistache-300);
  cursor: default;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 1;
}
.btn.btn-validated:disabled,
.btn.btn-validated[disabled] {
  background: var(--pistache-100);
  color: var(--pistache-500);
  border-color: var(--pistache-300);
  opacity: 1;
}
.btn-validated-icon {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor;
  stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}
/* Quand la carte est désaturée (is-done), on rend le bouton plein contraste
   pour qu'il soit le seul élément vif et lisible de la carte */
.task-card.is-done .task-action .btn-validated {
  filter: none;
  opacity: 1;
}

/* Mobile : encore plus compact */
@media (max-width: 480px) {
  .cleaning-pictograms { grid-template-columns: repeat(4, 1fr); gap: 3px; }
  .cleaning-picto { padding: 4px 2px; }
  .cleaning-picto-icon { width: 22px; height: 22px; }
  .cleaning-picto-icon svg { width: 14px; height: 14px; }
  .cleaning-picto-value { font-size: 10px; }
  .cleaning-action-banner { font-size: 11px; padding: 4px 6px; }
}

/* Modale procédure détaillée */
.cleaning-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  line-height: 1.5;
}
.cleaning-modal-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-sm);
}
.cleaning-modal-row dt {
  font-weight: 600;
  color: var(--terra-500);
  font-size: 13px;
}
.cleaning-modal-row dd {
  margin: 0;
  font-size: 14px;
  color: var(--label-color, var(--text));
}
@media (max-width: 600px) {
  .cleaning-modal-row { grid-template-columns: 1fr; gap: 4px; }
}

/* --- 13.19 Folder/accordion section (labels index) ----------- */
.folder-section + .folder-section { margin-top: 16px; }
.folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin-bottom: 16px;
  padding: 16px 18px;
  border-radius: var(--r-lg);
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  text-align: left;
  font-family: var(--font-body);
  color: var(--label-color, var(--text));
}
.folder-header:hover { border-color: var(--tile-border-hover, var(--border)); background: var(--tile-bg-hover, var(--bg-soft)); }
.folder-header-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.folder-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  margin: 0;
  color: var(--label-color, var(--text));
  font-variation-settings: 'opsz' 144;
}
.folder-chevron {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--tile-border, var(--border-soft));
  background: var(--bg-soft, rgba(245,238,224,.04));
  color: var(--meta-color, var(--text-muted));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  transition: transform var(--t-fast);
}
.folder-chevron svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.folder-section.is-open .folder-chevron { transform: rotate(90deg); }
.folder-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
  padding: 0 10px;
  border-radius: var(--r-full);
  background: rgba(229,181,71,.14);
  color: var(--bread-300);
  font-weight: 700;
  font-size: 13px;
}
.folder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
@media (max-width: 900px) { .folder-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .folder-grid { grid-template-columns: 1fr; } }

/* --- 13.20 Labels layout + Quantity panel + keypad ------------ */
.labels-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) {
  .labels-layout { grid-template-columns: 1fr; }
  .labels-layout .quantity-panel { position: static; }
}
.quantity-panel {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-xl);
  padding: 22px;
  position: sticky;
  top: 24px;
  box-shadow: var(--shadow-xs);
}
.quantity-display {
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-lg);
  padding: 22px;
  text-align: center;
  margin-bottom: 18px;
}
.quantity-display-label { color: var(--meta-color, var(--text-muted)); font-size: 13px; margin-bottom: 6px; }
.quantity-display-value {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 500;
  color: var(--bread-300);
  line-height: 1;
  font-variation-settings: 'opsz' 144;
  font-variant-numeric: tabular-nums;
}
.keypad-btn {
  height: 60px;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  border-radius: var(--r-lg);
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  color: var(--label-color, var(--text));
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  font-variation-settings: 'opsz' 144;
}
.keypad-btn:hover { background: var(--tile-bg-hover, var(--bg-soft)); border-color: var(--tile-border-hover, var(--border)); }
.keypad-btn:active { transform: scale(.96); }
.keypad-btn.is-clear { background: rgba(194,79,74,.10); color: var(--berry-300); border-color: rgba(194,79,74,.25); }
.keypad-btn.is-clear:hover { background: rgba(194,79,74,.18); }
.keypad-btn.span-2 { grid-column: span 2; }

/* --- 13.21 Product tile (labels) ----------------------------- */
.product-tile {
  min-height: 110px;
  border-radius: var(--r-lg);
  border: 1px solid rgba(245,238,224,.12);
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  font-variation-settings: 'opsz' 144;
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
  color: #FFFAF1;
}
.product-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); filter: brightness(1.05); }
.product-tile:active { transform: translateY(-1px); }

/* --- 13.22 CTA card (gros raccourci pleine largeur) ---------- */
.cta-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 88px;
  padding: 20px 24px;
  border-radius: var(--r-lg);
  background: var(--terra-500);
  color: #FFFAF1;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  transition: filter var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  font-variation-settings: 'opsz' 144;
  margin-top: 18px;
}
.cta-card:hover { filter: brightness(1.05); transform: translateY(-2px); box-shadow: var(--shadow-md); text-decoration: none; }
.cta-card svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* --- 13.23 Print loading overlay (impression étiquettes) ----- */
.print-loading-overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(11,9,7,.85);
  backdrop-filter: blur(6px);
  z-index: 12000;
}
.print-loading-overlay.active { display: flex; }
.print-loading-modal {
  width: min(460px, calc(100vw - 32px));
  border-radius: var(--r-2xl);
  border: 1px solid var(--tile-border, var(--border));
  background: var(--tile-bg, var(--surface));
  box-shadow: var(--shadow-lg);
  padding: 28px;
  text-align: center;
}
.print-loading-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  color: var(--label-color, var(--text));
  margin: 0 0 8px;
  font-variation-settings: 'opsz' 144;
}
.print-loading-subtitle { color: var(--meta-color, var(--text-muted)); margin: 0 0 20px; font-size: 14px; line-height: 1.5; }
.print-loading-bar {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: 10px;
  border-radius: var(--r-full);
  background: rgba(245,238,224,.10);
}
.print-loading-bar::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 -35%;
  width: 35%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(229,181,71,0), var(--bread-300), var(--terra-400));
  animation: print-loading-slide 1.15s ease-in-out infinite;
}
.print-loading-count { margin-top: 14px; color: var(--meta-color, var(--text-muted)); font-size: 13px; font-weight: 600; }
@keyframes print-loading-slide {
  0%   { transform: translateX(0); }
  100% { transform: translateX(390%); }
}

/* --- 13.24 Detail grid (modal détails) ----------------------- */
.detail-grid { display: grid; gap: 18px; }
.detail-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  align-items: start;
}
.detail-item--full { grid-template-columns: 1fr; }
.detail-item-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--bread-300);
}
.detail-item-value { color: var(--label-color, var(--text)); font-size: 14px; line-height: 1.55; }
.detail-rejection {
  padding: 14px 16px;
  background: rgba(194,79,74,.10);
  border-left: 3px solid var(--berry-300);
  border-radius: var(--r-md);
  color: var(--berry-300);
  font-size: 14px;
  line-height: 1.5;
}
@media (max-width: 560px) { .detail-item { grid-template-columns: 1fr; } }

/* --- 13.25 Choice buttons (radio-like quick picks) ----------- */
.choice-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.choice-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 14px;
  border-radius: var(--r-full);
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
  color: var(--label-color, var(--text));
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}
.choice-btn:hover { background: var(--tile-bg-hover, var(--bg-soft)); border-color: var(--tile-border-hover, var(--border)); }
.choice-btn.is-active { background: rgba(229,181,71,.14); border-color: var(--bread-300); color: var(--bread-300); }

.choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 8px;
}
@media (max-width: 560px) { .choice-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.choice-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
  color: var(--label-color, var(--text));
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  text-align: center;
}
.choice-tile:hover { background: var(--tile-bg-hover, var(--bg-soft)); border-color: var(--tile-border-hover, var(--border)); }
.choice-tile.is-active { background: rgba(229,181,71,.14); border-color: var(--bread-300); color: var(--bread-300); }
.choice-tile input { position: absolute; opacity: 0; pointer-events: none; }

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px 16px;
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-md);
  padding: 16px;
}
@media (max-width: 720px) { .checkbox-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .checkbox-grid { grid-template-columns: 1fr; } }
.checkbox-grid label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--label-color, var(--text));
  font-size: 14px;
  cursor: pointer;
}

/* --- 13.26 Releve frigo (saisie température) ----------------- */
.releve-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.releve-meta-grid .meta-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--meta-color, var(--text-muted)); margin-bottom: 4px; }
.releve-meta-grid .meta-value { font-size: 18px; font-weight: 700; color: var(--label-color, var(--text)); }
.quick-frigos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.quick-frigo-btn {
  border: 1px solid var(--tile-border, var(--border));
  background: var(--tile-bg, var(--surface));
  color: var(--label-color, var(--text));
  border-radius: var(--r-full);
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: background 120ms ease, border-color 120ms ease;
}
.quick-frigo-btn:hover { background: var(--tile-bg-hover, var(--bg-soft)); }
.quick-frigo-btn.active { border-color: var(--bread-300); background: rgba(229,181,71,.18); color: var(--bread-200); }
@media (max-width: 720px) { .releve-meta-grid { grid-template-columns: 1fr; } }

/* --- 13.27 Frigo admin (cartes + filtres + statuts) ---------- */
.frigo-filter-card {
  background: rgba(79,103,136,.06);
  border: 1px solid rgba(79,103,136,.18);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
  display: grid;
  gap: 16px;
}
.frigo-filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
.labo-panel { margin-bottom: 16px; animation: fadeInUp .4s cubic-bezier(.16,1,.3,1) backwards; }
.labo-panel-head {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: background 150ms ease, border-color 150ms ease;
}
.labo-panel-head:hover { background: var(--tile-bg-hover, var(--bg-soft)); border-color: var(--bread-300); }
.labo-panel-head.is-open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.labo-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.labo-dot-ok { background: var(--pistache-300); box-shadow: 0 0 0 3px rgba(142,156,86,.22); }
.labo-dot-alert { background: var(--berry-300); box-shadow: 0 0 0 3px rgba(194,79,74,.25); animation: pulse-dot 2s ease-in-out infinite; }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: .5; } }
.labo-panel-title { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--label-color, var(--text)); margin: 0; }
.labo-panel-meta { font-size: 13px; color: var(--meta-color, var(--text-muted)); margin-top: 2px; }
.labo-chevron { margin-left: auto; transition: transform 200ms ease; color: var(--text-muted); flex-shrink: 0; }
.labo-panel-head.is-open .labo-chevron { transform: rotate(180deg); }
.labo-panel-body {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-top: none;
  border-radius: 0 0 var(--r-lg) var(--r-lg);
  padding: 20px 22px;
  display: none;
}
.labo-panel-body.is-open { display: block; }
.frigo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-top: 16px; }
.frigo-card {
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 2px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-lg);
  padding: 18px;
  transition: border-color 150ms ease, transform 150ms ease;
}
.frigo-card:hover { transform: translateY(-2px); }
.frigo-card.status-success { border-color: var(--pistache-300); }
.frigo-card.status-warning { border-color: var(--bread-300); }
.frigo-card.status-danger  { border-color: var(--berry-300); animation: pulse-dot 2s ease-in-out infinite; }
.frigo-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.frigo-card-name { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--label-color, var(--text)); }
.frigo-card-temp { background: rgba(79,103,136,.08); border-radius: var(--r-md); padding: 12px; }
.frigo-card-temp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.frigo-card-temp-row .meta-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--meta-color, var(--text-muted)); margin-bottom: 4px; }
.frigo-card-temp-row .temp-val { font-size: 18px; font-weight: 700; color: var(--label-color, var(--text)); }
.frigo-card-last { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--tile-border, var(--border-soft)); }
.frigo-card-actions { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.add-frigo-form {
  background: rgba(176,85,47,.06);
  border: 1px solid rgba(176,85,47,.18);
  border-radius: var(--r-md);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}
@media (max-width: 720px) { .add-frigo-form { grid-template-columns: 1fr; } .frigo-grid { grid-template-columns: 1fr; } }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card-mini {
  background: var(--bg-soft, rgba(245,238,224,.04));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-radius: var(--r-md);
  padding: 12px;
  text-align: center;
}
.stat-card-mini .stat-value { font-size: 22px; font-weight: 700; color: var(--bread-300); font-variant-numeric: tabular-nums; }
.stat-card-mini .stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--meta-color, var(--text-muted)); margin-top: 4px; }
.period-btn-group { display: flex; gap: 4px; flex-wrap: wrap; }
.period-btn-group .btn.active { background: var(--bread-300); color: var(--ink-700); border-color: transparent; }

/* --- 13.28 Production KDS (écran cuisine) -------------------- */
body.is-prod-kds { overflow: hidden; height: 100dvh; }
body.is-prod-kds .app { padding: 0; max-width: none; }
.prod-page-header {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--prod-header-h, 56px);
  z-index: 50;
  background: var(--ink-700);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.prod-page-header h1 { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--sand-100); margin: 0; white-space: nowrap; }
.prod-counter-pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: var(--r-full); white-space: nowrap; border: 1px solid; }
.prod-counter-open { background: rgba(79,103,136,.18); color: var(--blueb-200); border-color: var(--blueb-300); }
.prod-counter-wip  { background: rgba(229,181,71,.18); color: var(--bread-200); border-color: var(--bread-300); }
.prod-counter-done { background: rgba(142,156,86,.18); color: var(--pistache-200); border-color: var(--pistache-300); }
.prod-date-nav { display: flex; align-items: center; gap: 4px; }
.prod-date-nav a, .prod-date-nav input[type="date"] {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--r-sm); padding: 4px 10px;
  font-size: 13px; text-decoration: none; transition: background 120ms ease;
  font-family: var(--font-body);
}
.prod-date-nav a:hover { background: var(--bg-soft); }
.prod-date-nav input[type="date"] { color-scheme: dark; cursor: pointer; }
.prod-cards-area {
  position: fixed;
  top: var(--prod-header-h, 56px);
  left: 0; right: 0; bottom: 0;
  padding: 8px;
  overflow: hidden;
}
.prod-cards-grid { width: 100%; height: 100%; display: grid; gap: 8px; }
.prod-slot-empty { border-radius: var(--r-md); border: 2px dashed rgba(245,238,224,.06); background: rgba(245,238,224,.015); }
.prod-card { border-radius: var(--r-md); border: 2px solid; display: flex; flex-direction: column; overflow: hidden; min-height: 0; transition: border-color .3s, background .3s; position: relative; cursor: pointer; }
.prod-card:active { opacity: .85; }
.prod-card.status-0 { border-color: var(--blueb-300); background: rgba(79,103,136,.16); }
.prod-card.status-1 { border-color: var(--bread-300); background: rgba(229,181,71,.14); }
.prod-card.status-2 { border-color: var(--pistache-300); background: rgba(142,156,86,.12); opacity: .7; }
.prod-card-head { flex-shrink: 0; display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 10px; }
.prod-card.status-0 .prod-card-head { background: var(--blueb-400); }
.prod-card.status-1 .prod-card-head { background: var(--bread-500); }
.prod-card.status-2 .prod-card-head { background: var(--pistache-500); }
.prod-partner-name { font-weight: 700; font-size: .9em; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.prod-status-badge { font-size: .58em; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 1px 6px; border-radius: var(--r-full); background: rgba(11,9,7,.3); color: #fff; white-space: nowrap; }
.prod-card-body { flex: 1; display: flex; flex-direction: column; padding: 5px 0 0; min-height: 0; overflow: hidden; }
.prod-items-list { list-style: none; flex: 1; display: grid; grid-template-columns: 1fr; align-content: stretch; overflow: hidden; padding: 0 6px; gap: 0; margin: 0; }
.prod-items-list.overflowing { overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(245,238,224,.15) transparent; }
.prod-item-row { display: flex; align-items: center; gap: 5px; padding: 2px 4px; border-radius: 5px; cursor: pointer; user-select: none; transition: background .1s; flex-shrink: 0; color: var(--sand-100); }
.prod-item-row:hover  { background: rgba(245,238,224,.07); }
.prod-item-row:active { background: rgba(245,238,224,.13); }
.prod-item-row.checked { opacity: .4; }
.prod-item-row.checked .prod-item-name { text-decoration: line-through; }
.prod-item-check { flex-shrink: 0; width: 1em; height: 1em; border-radius: 3px; border: 1.5px solid rgba(245,238,224,.3); display: flex; align-items: center; justify-content: center; transition: background .1s; }
.prod-item-row.checked .prod-item-check { background: var(--pistache-300); border-color: var(--pistache-300); }
.prod-item-check svg { opacity: 0; transition: opacity .1s; }
.prod-item-row.checked .prod-item-check svg { opacity: 1; }
.prod-item-qty  { font-weight: 800; font-size: .82em; color: rgba(245,238,224,.55); flex-shrink: 0; min-width: 2em; text-align: right; }
.prod-item-name { flex: 1; font-size: .88em; white-space: normal; overflow-wrap: break-word; line-height: 1.2; }
.prod-card-footer { flex-shrink: 0; padding: 3px 10px 4px; border-top: 1px solid rgba(245,238,224,.06); display: flex; align-items: center; gap: 8px; }
.prod-progress-bar { flex: 1; height: 3px; background: rgba(245,238,224,.1); border-radius: 99px; overflow: hidden; }
.prod-progress-fill { height: 100%; border-radius: 99px; transition: width .3s; }
.prod-card.status-0 .prod-progress-fill { background: var(--blueb-300); }
.prod-card.status-1 .prod-progress-fill { background: var(--bread-300); }
.prod-card.status-2 .prod-progress-fill { background: var(--pistache-300); }
.prod-prog-label { font-size: .58em; color: var(--text-muted); white-space: nowrap; }
.prod-page-dots { display: flex; gap: 6px; align-items: center; position: fixed; bottom: 10px; left: 50%; transform: translateX(-50%); z-index: 50; }
.prod-page-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: background .2s, transform .2s; cursor: pointer; }
.prod-page-dot.active { background: var(--text); transform: scale(1.3); }
.prod-empty-page { grid-column: 1/-1; grid-row: 1/-1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 14px; text-align: center; }
.prod-empty-page svg { opacity: .3; }
.prod-toast { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%) translateY(10px); background: var(--surface); border: 1px solid var(--border); color: var(--text); padding: 6px 16px; border-radius: var(--r-sm); font-size: 13px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 200; white-space: nowrap; }
.prod-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.prod-page-indicator { font-size: 12px; color: var(--text-muted); background: var(--surface); border: 1px solid var(--border); padding: 2px 10px; border-radius: var(--r-full); }
@media (orientation: portrait) and (max-width: 768px) {
  body.is-prod-kds { --prod-header-h: 48px; }
  body.is-prod-kds .prod-counter-pill { display: none; }
  body.is-prod-kds .prod-cards-area { overflow-y: auto; overflow-x: hidden; }
  body.is-prod-kds .prod-cards-grid { height: auto !important; grid-template-columns: 1fr !important; grid-template-rows: none !important; font-size: 15px !important; }
  body.is-prod-kds .prod-slot-empty { display: none; }
  body.is-prod-kds .prod-card { min-height: 0; }
  body.is-prod-kds .prod-card-body { overflow: visible; }
  body.is-prod-kds .prod-items-list { display: flex !important; flex-direction: column !important; grid-template-columns: unset !important; font-size: inherit !important; overflow: visible; }
  body.is-prod-kds .prod-card-head { padding: 10px 14px; }
  body.is-prod-kds .prod-item-row { padding: 8px 6px; }
}

/* --- 13.29 Commandes (dashboard live "commandes en cours") ---- */
.cmd-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.cmd-summary { font-size: 14px; color: var(--meta-color, var(--text-muted)); }
.cmd-summary strong { color: var(--label-color, var(--text)); font-weight: 700; }

.cmd-loading { text-align: center; padding: 48px 0; color: var(--meta-color, var(--text-muted)); }
.cmd-loading p { margin: 16px 0 0; font-size: 14px; }

.cmd-refresh.is-loading svg { animation: spin 1s linear infinite; }

.cmd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  align-content: start;          /* évite l'étirement vertical des cartes (peu de rows) */
  grid-auto-rows: max-content;
}

.cmd-card {
  background: var(--tile-bg, var(--surface));
  border: 1px solid var(--tile-border, var(--border-soft));
  border-left-width: 3px;
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.cmd-card.is-overdue  { border-left-color: var(--berry-300); }
.cmd-card.is-today    { border-left-color: var(--bread-300); }
.cmd-card.is-upcoming { border-left-color: var(--blueb-300); }
.cmd-card.is-unknown  { border-left-color: var(--border-strong, var(--border)); }

.cmd-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.cmd-card-partner {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -.005em;
  line-height: 1.25;
  color: var(--label-color, var(--text));
}
.cmd-card-head .badge { flex-shrink: 0; white-space: nowrap; }

.cmd-card-sub {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--meta-color, var(--text-muted));
}
.cmd-card-sub .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .5; }

.cmd-items {
  list-style: none;
  margin: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--tile-border, var(--border-soft));
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cmd-item { display: flex; align-items: baseline; gap: 8px; font-size: 13.5px; }
.cmd-item-qty {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--primary);
  min-width: 30px;
}
.cmd-item-name { color: var(--label-color, var(--text)); }

.cmd-card-foot { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 520px) {
  .cmd-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   14. DARK OVERRIDES — recalibrages spécifiques data-theme=dark
   Aligné sur claude-design/tokens.css §148-188.
   Les variables sémantiques (--bg, --surface, --border, --text…)
   basculent automatiquement ; cette section couvre les rares cas
   qui ne peuvent pas l'être par variable seule.
   ============================================================ */

/* 14.1 — Inputs / fields : autofill webkit + knob switch */
:root[data-theme="dark"] .input,
:root[data-theme="dark"] .select,
:root[data-theme="dark"] .textarea {
  background: var(--surface);
  color: var(--text);
}
:root[data-theme="dark"] .input::placeholder,
:root[data-theme="dark"] .textarea::placeholder { color: var(--text-soft); }

/* Chromium force un fond clair sur autofill — neutralise via inset */
:root[data-theme="dark"] .input:-webkit-autofill,
:root[data-theme="dark"] .select:-webkit-autofill,
:root[data-theme="dark"] .textarea:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--surface) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out;
}

/* Knob du switch : crème sourd plutôt que blanc dur */
:root[data-theme="dark"] .switch::after { background: var(--ink-50); }

/* Focus ring : terra-400 + halo plus marqué pour compenser le fond sombre */
:root[data-theme="dark"] .input:focus,
:root[data-theme="dark"] .select:focus,
:root[data-theme="dark"] .textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(216,138,101,.22);
}
:root[data-theme="dark"] .input.invalid:focus {
  box-shadow: 0 0 0 3px rgba(224,130,122,.22);
}

/* 14.2 — Scrollbar (Webkit + Firefox) */
:root[data-theme="dark"] {
  scrollbar-color: var(--border-strong) var(--bg);
}
:root[data-theme="dark"] ::-webkit-scrollbar { width: 12px; height: 12px; }
:root[data-theme="dark"] ::-webkit-scrollbar-track { background: var(--bg); }
:root[data-theme="dark"] ::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 3px solid var(--bg);
  border-radius: var(--r-full);
}
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover { background: var(--ink-300); }

/* 14.3 — DataTables (search input/select de pagination) */
:root[data-theme="dark"] .dataTables_filter input,
:root[data-theme="dark"] .dataTables_length select,
:root[data-theme="dark"] div.dt-container .dt-search input,
:root[data-theme="dark"] div.dt-container .dt-length select {
  background: var(--surface) !important;
  color: var(--text) !important;
  border: 1px solid var(--border) !important;
}
:root[data-theme="dark"] .dataTables_info,
:root[data-theme="dark"] .dataTables_length,
:root[data-theme="dark"] .dataTables_filter,
:root[data-theme="dark"] div.dt-container .dt-info { color: var(--text-muted) !important; }
:root[data-theme="dark"] .paginate_button { color: var(--text-muted) !important; }
:root[data-theme="dark"] .paginate_button.current { background: var(--primary-soft) !important; color: var(--text) !important; border-color: transparent !important; }

/* 14.4 — Tables : hover row plus contrasté */
:root[data-theme="dark"] .table tbody tr:hover td { background: var(--surface-2); }

/* 14.5 — Avatar / disabled inputs : éviter l'apparition de gris clairs */
:root[data-theme="dark"] .avatar { background: var(--surface-2); color: var(--text-muted); }
:root[data-theme="dark"] .input:disabled,
:root[data-theme="dark"] .select:disabled,
:root[data-theme="dark"] .textarea:disabled {
  background: var(--bg-soft); color: var(--text-soft);
  border-color: var(--border-soft);
}

/* 14.6 — Badges : assouplir le fond hex légacy */
:root[data-theme="dark"] .badge { background: var(--surface-2); border-color: var(--border-soft); color: var(--text); }

/* 14.7 — Code display (pinpad) : visibilité des dots vides */
:root[data-theme="dark"] .code-dot { background: rgba(245,238,224,.14); }

/* ============================================================
   15. MOODS DARK — affinage calme / atelier
   Inputs et controls reprennent les surfaces du mood pour ne
   pas créer d'îlots visuels (contrainte UX cuisine sombre).
   ============================================================ */
body[data-mood="calme"][data-theme="dark"] .input,
body[data-mood="calme"][data-theme="dark"] .select,
body[data-mood="calme"][data-theme="dark"] .textarea,
body[data-mood="calme"] .input,
body[data-mood="calme"] .select,
body[data-mood="calme"] .textarea {
  background: var(--tile-bg, var(--surface));
  border-color: var(--tile-border, var(--border));
  color: var(--label-color, var(--text));
}
body[data-mood="calme"] .input:hover,
body[data-mood="calme"] .select:hover,
body[data-mood="calme"] .textarea:hover { border-color: var(--tile-border-hover, var(--border-strong)); }
body[data-mood="calme"] .check,
body[data-mood="calme"] .radio { border-color: var(--tile-border, var(--border-strong)); background: var(--tile-bg, var(--surface)); }
body[data-mood="calme"] .switch { background: var(--tile-border-hover, var(--border-strong)); }

body[data-mood="atelier"] .input,
body[data-mood="atelier"] .select,
body[data-mood="atelier"] .textarea {
  background: rgba(43,33,23,.6);                /* surface tile-bg aplatie */
  border-color: var(--tile-border, var(--border));
  color: var(--label-color, var(--text));
}
body[data-mood="atelier"] .input:hover,
body[data-mood="atelier"] .select:hover,
body[data-mood="atelier"] .textarea:hover { border-color: var(--tile-border-hover, var(--border-strong)); }
body[data-mood="atelier"] .input:focus,
body[data-mood="atelier"] .select:focus,
body[data-mood="atelier"] .textarea:focus {
  border-color: var(--bread-300);
  box-shadow: 0 0 0 3px rgba(229,181,71,.18);
}
body[data-mood="atelier"] .check,
body[data-mood="atelier"] .radio { border-color: var(--tile-border-hover, var(--border-strong)); background: rgba(43,33,23,.6); }
body[data-mood="atelier"] .switch { background: var(--tile-border-hover, var(--border-strong)); }
body[data-mood="atelier"] .switch:checked { background: var(--bread-300); }

/* Cards/sections sur moods dark : éviter la double bordure quand
   la card est posée directement sur le fond mood (qui a déjà sa texture) */
body[data-mood="calme"] .card,
body[data-mood="atelier"] .card,
body[data-mood="calme"] .section-card,
body[data-mood="atelier"] .section-card {
  background: var(--tile-bg, var(--surface));
  border-color: var(--tile-border, var(--border-soft));
  color: var(--label-color, var(--text));
}
body[data-mood="atelier"] .card-elev,
body[data-mood="atelier"] .section-card { box-shadow: 0 1px 2px rgba(0,0,0,.35), 0 8px 22px rgba(0,0,0,.35); }

/* Badges en mood sombre : harmoniser le fond neutre sur la tile-bg */
body[data-mood="calme"] .badge,
body[data-mood="atelier"] .badge { background: rgba(245,238,224,.06); border-color: rgba(245,238,224,.10); color: var(--label-color, var(--text)); }
