/* Congel, version « sorbet » : des cartes blanches et arrondies, une couleur
   par categorie (pistache, framboise, mangue...), le bleu canard pour les
   actions. Telephone : barre en bas. Tablette : rail a gauche. Ordinateur :
   menu lateral, et les pages s'etalent en colonnes. */
:root {
  --bg: #F3F6F7; --surface: #FFFFFF; --surface-2: #F9FBFB; --ink: #1F2328; --muted: #687076;
  --line: #E3E8EA; --line-strong: #CAD3D6;
  --brand: #0E7C86; --brand-ink: #FFFFFF; --brand-soft: #DBF0F1; --brand-deep: #095E66;
  --tape: #FFE7A8; --tape-ink: #3B2F12;
  --ok: #23845A; --warn: #A65A00; --warn-soft: #FFF0D9; --danger: #C2334D; --danger-soft: #FDE6EB;
  --toast-bg: #1F2328; --toast-fg: #F3F6F7; --toast-acc: #8FDCE2;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4;
  --shadow-card: 0 1px 2px rgba(20,40,48,.05), 0 6px 18px -10px rgba(20,40,48,.2);
  --shadow-float: 0 10px 30px -12px rgba(20,40,48,.38);
  --radius: 18px;
  --font-display: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-marker: "Permanent Marker", "Segoe Print", "Comic Sans MS", cursive;
  --nav-h: 56px;
  --rail: 0px;
  color-scheme: light;
}
/* Sombre : choisi, ou automatique quand le systeme est en sombre. */
:root[data-theme="dark"] {
    --bg: #10171A; --surface: #18222A; --surface-2: #141D23; --ink: #E8EEF0; --muted: #9AABB2;
    --line: #25333B; --line-strong: #364852;
    --brand: #4FC7CF; --brand-ink: #062226; --brand-soft: #123B3E; --brand-deep: #86DDE2;
    --tape: #E9D08A; --tape-ink: #2A2210;
    --ok: #63D19B; --warn: #F5B556; --warn-soft: #3A2B12; --danger: #FF8EA2; --danger-soft: #3D1C29;
    --toast-bg: #E8EEF0; --toast-fg: #10171A; --toast-acc: #0E7C86;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 8px 20px -12px rgba(0,0,0,.6);
    --shadow-float: 0 12px 30px -10px rgba(0,0,0,.7);
    color-scheme: dark;
  }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    --bg: #10171A; --surface: #18222A; --surface-2: #141D23; --ink: #E8EEF0; --muted: #9AABB2;
    --line: #25333B; --line-strong: #364852;
    --brand: #4FC7CF; --brand-ink: #062226; --brand-soft: #123B3E; --brand-deep: #86DDE2;
    --tape: #E9D08A; --tape-ink: #2A2210;
    --ok: #63D19B; --warn: #F5B556; --warn-soft: #3A2B12; --danger: #FF8EA2; --danger-soft: #3D1C29;
    --toast-bg: #E8EEF0; --toast-fg: #10171A; --toast-acc: #0E7C86;
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181;
    --shadow-card: 0 1px 2px rgba(0,0,0,.35), 0 8px 20px -12px rgba(0,0,0,.6);
    --shadow-float: 0 12px 30px -10px rgba(0,0,0,.7);
    color-scheme: dark;
  }
}

/* --- Couleurs des categories --- */
.tone-pistachio { --tone: #23875A; --tone-soft: #DDF4E6; }
.tone-raspberry { --tone: #D23A6B; --tone-soft: #FDE3EC; }
.tone-mango     { --tone: #B9720B; --tone-soft: #FFEFCF; }
.tone-coral     { --tone: #D1532E; --tone-soft: #FDE5DB; }
.tone-lavender  { --tone: #7A4FE0; --tone-soft: #EEE6FF; }
.tone-apple     { --tone: #5E8A12; --tone-soft: #ECF5D6; }
.tone-tomato    { --tone: #C93A2E; --tone-soft: #FCE2DE; }
.tone-pumpkin   { --tone: #C76A12; --tone-soft: #FDEBD7; }
.tone-blueberry { --tone: #3B5BD6; --tone-soft: #E3E9FD; }
.tone-crust     { --tone: #9A6326; --tone-soft: #F6EAD9; }
.tone-slate     { --tone: #5F5B7C; --tone-soft: #ECEAF3; }
.tone-sky       { --tone: #0B7FA8; --tone-soft: #DDF1F8; }
/* Sombre : choisi, ou automatique quand le systeme est en sombre. */
:root[data-theme="dark"] .tone-pistachio { --tone: #7BE0A8; --tone-soft: #173A2A; }
:root[data-theme="dark"] .tone-raspberry { --tone: #FF8DB2; --tone-soft: #401A2B; }
:root[data-theme="dark"] .tone-mango { --tone: #FFC566; --tone-soft: #3D2D10; }
:root[data-theme="dark"] .tone-coral { --tone: #FF9C7A; --tone-soft: #40221A; }
:root[data-theme="dark"] .tone-lavender { --tone: #BFA4FF; --tone-soft: #2E2350; }
:root[data-theme="dark"] .tone-apple { --tone: #B6DB63; --tone-soft: #27330F; }
:root[data-theme="dark"] .tone-tomato { --tone: #FF8F84; --tone-soft: #401E1B; }
:root[data-theme="dark"] .tone-pumpkin { --tone: #FFB46A; --tone-soft: #3D2810; }
:root[data-theme="dark"] .tone-blueberry { --tone: #A3B6FF; --tone-soft: #1E2A52; }
:root[data-theme="dark"] .tone-sky { --tone: #6CCDF0; --tone-soft: #123445; }
:root[data-theme="dark"] .tone-crust { --tone: #E5B57A; --tone-soft: #352717; }
:root[data-theme="dark"] .tone-slate { --tone: #C1BDDB; --tone-soft: #2A2742; }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .tone-pistachio { --tone: #7BE0A8; --tone-soft: #173A2A; }
  :root[data-theme="auto"] .tone-raspberry { --tone: #FF8DB2; --tone-soft: #401A2B; }
  :root[data-theme="auto"] .tone-mango { --tone: #FFC566; --tone-soft: #3D2D10; }
  :root[data-theme="auto"] .tone-coral { --tone: #FF9C7A; --tone-soft: #40221A; }
  :root[data-theme="auto"] .tone-lavender { --tone: #BFA4FF; --tone-soft: #2E2350; }
  :root[data-theme="auto"] .tone-apple { --tone: #B6DB63; --tone-soft: #27330F; }
  :root[data-theme="auto"] .tone-tomato { --tone: #FF8F84; --tone-soft: #401E1B; }
  :root[data-theme="auto"] .tone-pumpkin { --tone: #FFB46A; --tone-soft: #3D2810; }
  :root[data-theme="auto"] .tone-blueberry { --tone: #A3B6FF; --tone-soft: #1E2A52; }
  :root[data-theme="auto"] .tone-sky { --tone: #6CCDF0; --tone-soft: #123445; }
  :root[data-theme="auto"] .tone-crust { --tone: #E5B57A; --tone-soft: #352717; }
  :root[data-theme="auto"] .tone-slate { --tone: #C1BDDB; --tone-soft: #2A2742; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15.5px; line-height: 1.4; }
a { color: var(--brand); }
:focus-visible { outline: 2.5px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
form.inline, .inline { display: inline; margin: 0; }
button, input, select, textarea { font-family: inherit; }

.app { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + 40px + env(safe-area-inset-bottom, 0px)); }

/* --- En-tetes --- */
.top {
  position: sticky; top: 0; z-index: 3; display: grid; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.title-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.title { font-family: var(--font-display); font-weight: 800; font-size: 32px; letter-spacing: -.02em; line-height: 1.1; }
.date { font-size: 13.5px; color: var(--muted); }
.bar {
  position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 8px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.bar-title { font-family: var(--font-display); font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.back, .bar-link { font-weight: 700; text-decoration: none; padding: 8px 6px; font-size: 15px; }
.back { justify-self: start; }
/* Bouton principal d'une fiche, en haut a droite : toujours visible. */
.bar-btn {
  justify-self: end; border: 0; border-radius: 12px; padding: 9px 16px; background: var(--brand); color: var(--brand-ink);
  font-weight: 800; font-size: 15px; cursor: pointer; box-shadow: 0 6px 14px -8px var(--brand);
}
.bar-btn:hover { background: var(--brand-deep); }
.bar-link { justify-self: end; }

.search {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1.5px solid var(--line);
  border-radius: 14px; padding: 0 12px; box-shadow: var(--shadow-card);
}
.search svg { flex: none; color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; font: inherit; font-size: 16px; padding: 11px 0; color: var(--ink); outline: none; }
.search:focus-within { border-color: var(--brand); }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 16px; padding: 4px; }
.seg.four { grid-template-columns: repeat(4, 1fr); }
.seg.two { grid-template-columns: repeat(2, 1fr); }
.seg button, .seg a {
  font-size: 14.5px; font-weight: 700; border: 0; border-radius: 12px; padding: 9px 4px; background: transparent;
  color: var(--muted); cursor: pointer; text-align: center; text-decoration: none; transition: background .15s, color .15s;
}
.seg button span { font-weight: 600; font-size: 12.5px; margin-left: 4px; opacity: .8; }
.seg [aria-selected="true"], .seg [aria-current="page"] { background: var(--brand); color: var(--brand-ink); }

/* --- Cartes produit --- */
.alert {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 6px 16px 0;
  font-size: 14.5px; border-radius: 16px; padding: 12px 14px; background: var(--warn-soft); color: var(--warn); text-decoration: none;
}
.alert-go { font-weight: 800; white-space: nowrap; }
.totals { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 16px 0; font-size: 13px; color: var(--muted); }
.totals span { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; }
.totals b { color: var(--ink); font-size: 14.5px; font-variant-numeric: tabular-nums; }
.group {
  font-family: var(--font-body); font-size: 13px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 20px 16px 8px; display: flex; gap: 8px; align-items: center;
}
.dot { width: 10px; height: 10px; border-radius: 4px; background: var(--tone); display: inline-block; }
.n { font-size: 11.5px; letter-spacing: 0; border-radius: 999px; padding: 2px 8px; background: var(--brand-soft); color: var(--brand-deep); }

.list { list-style: none; margin: 0; padding: 0 12px; display: grid; gap: 8px; }
.list.spaced { margin-top: 12px; }
.row {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 10px 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.row.is-out { opacity: .72; }
.row.is-out .pastille { filter: grayscale(.8); }
.row:target { animation: flash 1.8s ease-out; }
@keyframes flash { from { box-shadow: 0 0 0 3px var(--brand); } to { box-shadow: var(--shadow-card); } }
.row-main { color: inherit; text-decoration: none; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; row-gap: 2px; align-items: center; min-width: 0; padding: 2px 0; }
.row-main > .name, .row-main > .meta { grid-column: 2; }
.row-main > .pastille { grid-row: 1 / span 2; }
.name { font-weight: 700; font-size: 16px; }
.meta { font-size: 12.5px; color: var(--muted); }
.t-warn { color: var(--warn); font-weight: 700; }
.t-danger { color: var(--danger); font-weight: 700; }

.pastille {
  width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: var(--tone-soft); color: var(--tone); font-family: var(--font-display); font-weight: 800; font-size: 20px; line-height: 1;
}
.pastille-lg { width: 60px; height: 60px; border-radius: 18px; font-size: 30px; }

.counts { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.count { display: flex; align-items: center; gap: 10px; }
.qty-block { display: grid; justify-items: end; line-height: 1.05; min-width: 2.6em; }
.qty-block b { font-variant-numeric: tabular-nums; font-size: 21px; font-weight: 800; }
.qty-block small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.minus {
  flex: none; width: 40px; height: 40px; border-radius: 13px; border: 0; background: var(--brand-soft); color: var(--brand-deep);
  font-size: 28px; font-weight: 600; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0 0 3px;
  touch-action: manipulation; transition: transform .08s, background .15s;
}
.minus:hover { background: var(--brand); color: var(--brand-ink); }
.minus:active { transform: scale(.92); }
.pill {
  display: inline-block; font-size: 13.5px; font-weight: 700; border: 0; color: var(--brand-deep); background: var(--brand-soft);
  border-radius: 999px; padding: 8px 14px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.pill.is-off { background: var(--line); color: var(--muted); }

.hint { font-size: 13px; color: var(--muted); padding: 8px 16px 0; }
.hint.flush, .flush { padding: 0; }
.empty { padding: 14px 16px; color: var(--muted); font-size: 14.5px; }
.list > .empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-state {
  margin: 18px 16px 0; padding: 22px; border-radius: 22px; display: grid; gap: 6px; font-size: 15px;
  background: linear-gradient(135deg, var(--brand-soft), var(--surface)); border: 1px solid var(--line);
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.pad-chips { padding: 14px 16px 0; }
.sort { align-items: center; }
.sort-label { font-size: 13px; color: var(--muted); margin-right: 2px; }
.chip {
  font-size: 14px; display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--ink); border-radius: 999px; padding: 7px 13px; cursor: pointer; text-decoration: none; position: relative; font-weight: 600;
}
.chip small { color: var(--muted); font-size: 12px; font-weight: 500; }
.chip[aria-pressed="true"], .chip[aria-current="page"], .chip:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.chip input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.chip:has(input:focus-visible) { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.account { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 30px 16px 0; font-size: 13.5px; color: var(--muted); }
.link { background: transparent; border: 0; color: var(--brand); font-weight: 700; cursor: pointer; padding: 4px; font-size: 14px; text-decoration: none; }
.link.small { font-size: 12.5px; }
.center-form { display: flex; justify-content: center; padding-top: 8px; }
.strong-link { font-weight: 700; color: var(--ink); text-decoration: none; }
.spacer { height: 20px; }

.glyph { display: inline-block; flex: none; background: var(--brand); }
.g-cube_large { width: 12px; height: 12px; border-radius: 3px; }
.g-cube_small { width: 7px; height: 7px; border-radius: 2px; }
.g-jar { width: 10px; height: 12px; border-radius: 2px 2px 4px 4px; background: transparent; border: 2px solid var(--brand); }
.g-portion { width: 14px; height: 9px; border-radius: 3px; background: transparent; border: 2px solid var(--brand); }
.g-bag { width: 11px; height: 13px; border-radius: 2px 2px 4px 4px; background: var(--brand-soft); border: 2px solid var(--brand); }
.g-piece { width: 10px; height: 10px; border-radius: 50%; }
.g-pack { width: 13px; height: 11px; border-radius: 2px; background: transparent; border: 2px solid var(--brand); border-top-width: 4px; }
.g-bottle { width: 7px; height: 14px; border-radius: 3px 3px 2px 2px; }

.ghost {
  display: block; text-align: center; font-size: 14.5px; font-weight: 700; margin: 14px 12px 0; border: 1.5px dashed var(--line-strong);
  color: var(--brand); background: transparent; border-radius: var(--radius); padding: 13px; text-decoration: none;
}
.ghost:hover { border-color: var(--brand); background: var(--brand-soft); }
.ghost.flat { margin: 0; }

/* --- Fiche produit --- */
.pad { padding: 8px 16px 0; display: grid; gap: 12px; }
.product-head { display: flex; align-items: center; gap: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12.5px; font-weight: 700; border-radius: 999px; padding: 3px 10px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); }
.sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 8px; }
.sum div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-card); }
.sum b { display: block; font-size: 30px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.sum span { font-size: 13px; color: var(--muted); }
.rate { font-size: 14px; line-height: 1.5; background: var(--brand-soft); color: var(--ink); border-radius: 14px; padding: 11px 14px; }
.lot {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; padding: 12px 12px 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card);
}
.tape {
  display: inline-block; font-family: var(--font-marker); color: var(--tape-ink); background: var(--tape); padding: 3px 10px 1px;
  transform: rotate(-1.5deg); clip-path: polygon(1.5% 4%, 98% 0, 100% 94%, 0 100%); white-space: nowrap; font-size: 14px;
}
.lot .tape { justify-self: start; grid-column: 1 / -1; }
.tape-line { margin: 6px 0 0; }
.lot-info { font-size: 14.5px; }
.lot-act { display: grid; justify-items: center; gap: 2px; }
.throw { background: transparent; border: 0; color: var(--danger); font-size: 13px; font-weight: 700; cursor: pointer; padding: 3px; }
.lot-edit { font-size: 12.5px; color: var(--muted); }
.hist { list-style: none; margin: 0 12px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }
.hist li { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 10px 12px 10px 10px; border-top: 1px solid var(--line); font-size: 14px; }
.hist li:first-child { border-top: 0; }
.delta { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; }
.delta.pos { color: var(--ok); }
.delta.bad { color: var(--danger); }

/* --- Formulaires --- */
.form { padding: 4px 16px 0; display: grid; gap: 4px; }
.field { border: 0; margin: 0; padding: 16px 0 0; display: grid; gap: 8px; min-width: 0; }
legend.label { margin-bottom: 8px; }
.label { font-size: 12.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 0; }
.opt { text-transform: none; letter-spacing: 0; font-weight: 500; }
.input {
  font: inherit; font-size: 16px; width: 100%; border: 1.5px solid var(--line-strong); border-radius: 14px; padding: 11px 13px;
  background: var(--surface); color: var(--ink);
}
.input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.input.narrow { width: 7em; }
.errors { background: var(--danger-soft); color: var(--danger); border-radius: 14px; padding: 11px 16px; font-size: 14.5px; margin-top: 10px; }
.errors ul { margin: 0; padding-left: 1.1em; }
/* Categorie oubliee pour un nouveau produit (lot-form#submit). */
.field.is-missing .label::after { content: " · à choisir"; color: var(--danger); text-transform: none; letter-spacing: 0; }
.field.is-missing .chip { border-color: var(--danger); }
.kinds { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 760px) { .kinds { grid-template-columns: repeat(4, 1fr); } }
.kind-option {
  display: grid; gap: 2px; justify-items: center; text-align: center; padding: 12px 6px; border-radius: 16px;
  border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; position: relative; box-shadow: var(--shadow-card);
}
.kind-option b { font-size: 16px; }
.kind-option small { font-size: 12px; color: var(--muted); }
.kind-option input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.kind-option:has(input:checked) { border-color: var(--brand); background: var(--brand); color: var(--brand-ink); }
.kind-option:has(input:checked) small { color: var(--brand-ink); opacity: .85; }
.kind-option:has(input:focus-visible) { outline: 2.5px solid var(--brand); outline-offset: 2px; }
/* Autocompletion : une liste flottante sous le champ, seulement en tapant. */
.namebox { position: relative; }
.sugg { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 6; }
.sugg-list {
  display: grid; gap: 2px; padding: 6px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow-float);
}
.sugg-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 0;
  background: transparent; color: var(--ink); border-radius: 11px; padding: 10px 11px; cursor: pointer; font-size: 15.5px; font-weight: 500;
}
.sugg-item b { font-weight: 800; }
.sugg-item small { color: var(--muted); font-size: 12px; white-space: nowrap; font-weight: 500; }
.sugg-item:hover, .sugg-item[aria-selected="true"] { background: var(--brand-soft); }
.sugg-item.is-new { color: var(--brand-deep); font-weight: 700; border-top: 1px dashed var(--line-strong); border-radius: 0 0 11px 11px; }
.sugg-item.is-new:first-child { border-top: 0; border-radius: 11px; }
.picked { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--brand-soft); border: 1.5px solid var(--brand); border-radius: 16px; padding: 11px 14px; }
.picked > div { display: grid; min-width: 0; }
.stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; }
.stepper > button { width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--brand-soft); color: var(--brand-deep); font-size: 24px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.qty {
  width: 3.2ch; border: 0; background: transparent; color: var(--ink); text-align: center; font-family: var(--font-body);
  font-weight: 800; font-size: 30px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; padding: 0;
}
.qty::-webkit-inner-spin-button, .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.weight { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.dates { grid-template-columns: 1fr; align-items: start; gap: 12px; }  /* l'une sous l'autre : la DLC a besoin de place (date ou duree) */
.dates > div { display: grid; gap: 6px; min-width: 0; align-content: start; }
.dates .input { padding: 9px 10px; font-size: 15px; }
.dlc { font-weight: 800; font-size: 16px; margin: 6px 0 0; display: grid; gap: 2px; }
.dlc-box { display: grid; gap: 2px; justify-items: start; }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
.cta { padding: 22px 0 10px; display: grid; gap: 6px; }
.btn {
  font-size: 16.5px; font-weight: 800; border: 0; border-radius: 16px; padding: 15px; background: var(--brand); color: var(--brand-ink);
  cursor: pointer; text-align: center; text-decoration: none; box-shadow: 0 8px 18px -10px var(--brand);
}
.btn:hover { background: var(--brand-deep); }
.btn.alt { background: transparent; color: var(--brand); padding: 8px; box-shadow: none; }
.checklist { list-style: none; margin: 0 12px; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }
.checklist li { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-right: 8px; }
.checklist li:first-child { border-top: 0; }
.checklist form { flex: 1; min-width: 0; }
.checklist form.inline { flex: none; }
.checklist label { display: flex; gap: 12px; align-items: center; padding: 12px 14px; cursor: pointer; font-size: 15.5px; }
.checklist input[type="checkbox"] { width: 21px; height: 21px; accent-color: var(--brand); flex: none; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }
.checklist > .empty { list-style: none; }
.remove { background: transparent; border: 0; color: var(--muted); font-size: 21px; padding: 4px 8px; cursor: pointer; }
.addline { display: flex; gap: 8px; padding: 12px 12px 4px; align-items: center; }
.addline .input { padding: 9px 12px; }

/* --- Rapports --- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: grid; gap: 2px; min-width: 0; box-shadow: var(--shadow-card); }
.k-l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.k-v { font-weight: 800; font-size: 26px; line-height: 1.15; }
.k-d { font-size: 12px; color: var(--muted); }
.k-note { font-size: 12px; color: var(--muted); margin-top: -2px; }
.report-grid { display: grid; gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 14px 14px 10px; display: grid; gap: 10px; position: relative; min-width: 0; box-shadow: var(--shadow-card); align-content: start; }
.card h2 { font-family: var(--font-display); font-weight: 750; font-size: 18px; letter-spacing: -.01em; }
.card .sub { font-size: 12.5px; color: var(--muted); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i, .tip i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.tip i { margin-right: 5px; }
.sw1 { background: var(--s1); } .sw2 { background: var(--s2); } .sw3 { background: var(--s3); } .sw4 { background: var(--s4); } .sw5 { background: var(--s5); }
.viz { display: block; width: 100%; height: auto; overflow: visible; }
.viz text { font-family: var(--font-body); font-size: 9.5px; fill: var(--muted); }
.viz .grid { stroke: var(--line); stroke-width: 1; }
.viz .base { stroke: var(--line-strong); stroke-width: 1; }
.viz .s1 { fill: var(--s1); } .viz .s2 { fill: var(--s2); } .viz .s3 { fill: var(--s3); } .viz .s4 { fill: var(--s4); } .viz .s5 { fill: var(--s5); }
.viz .hit { fill: transparent; cursor: pointer; }
.viz .hit.on { fill: var(--brand-soft); opacity: .6; }
.tip {
  position: absolute; top: 70px; transform: translateX(-50%); pointer-events: none; background: var(--toast-bg); color: var(--toast-fg);
  font-size: 12.5px; line-height: 1.45; border-radius: 10px; padding: 7px 10px; z-index: 2; white-space: nowrap; box-shadow: var(--shadow-float);
}
.figures summary { font-size: 14px; font-weight: 700; color: var(--brand); cursor: pointer; padding: 4px 0; }
.tbl { max-height: 280px; overflow: auto; margin-top: 6px; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.tbl th, .tbl td { padding: 5px 6px; text-align: right; white-space: nowrap; border-top: 1px solid var(--line); }
.tbl th { position: sticky; top: 0; background: var(--surface); color: var(--muted); font-weight: 700; border-top: 0; }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.bars li { display: grid; grid-template-columns: 8.5em minmax(0, 1fr) 4em; gap: 10px; align-items: center; font-size: 13px; }
.b-n { display: grid; line-height: 1.25; min-width: 0; }
.b-n span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.b-n a { color: var(--ink); text-decoration: none; }
.b-n small { color: var(--muted); font-size: 11.5px; }
.b-t { display: block; height: 12px; }
.b-t i { display: block; height: 12px; background: var(--s1); border-radius: 0 6px 6px 0; min-width: 2px; }
.b-v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }

/* --- Navigation : barre collee en bas sur telephone, rien ne passe dessous --- */
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center;
  /* La barre d'accueil de l'iPhone empiete un peu sur la marge : moins haut. */
  --nav-pad: max(4px, calc(env(safe-area-inset-bottom, 0px) - 16px));
  height: calc(var(--nav-h) + var(--nav-pad)); padding: 0 6px var(--nav-pad);
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 18px -14px rgba(0, 0, 0, .35);
}
.brand { display: none; }
.nav .desk-only { display: none; }
.nav-btn {
  font-size: 11px; font-weight: 700; display: grid; justify-items: center; gap: 2px; color: var(--muted); text-decoration: none;
  padding: 5px 0; position: relative; white-space: nowrap; border-radius: 14px;
}
.nav-btn[aria-current="page"] { color: var(--brand); }
.nav-btn svg { width: 21px; height: 21px; }
.fab {
  width: 52px; height: 52px; margin: -22px 4px 0; border-radius: 17px; background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center; text-decoration: none; box-shadow: 0 10px 20px -8px var(--brand); transform: rotate(-4deg);
}
.fab-plus { font-size: 30px; line-height: 1; transform: rotate(4deg); margin-top: -3px; }
.fab-label { display: none; }
.badge {
  position: absolute; top: 2px; left: calc(50% + 6px); min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; line-height: 19px; text-align: center; font-variant-numeric: tabular-nums;
}

/* --- Bandeau --- */
.toast {
  position: fixed; left: 14px; right: 14px; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom, 0px)); z-index: 11;
  max-width: 520px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--toast-bg); color: var(--toast-fg); border-radius: 16px; padding: 12px 12px 12px 16px; font-size: 14.5px; box-shadow: var(--shadow-float);
}
.toast.is-alert { background: var(--danger); color: #fff; }
.undo-form { margin: 0; }
.undo { background: transparent; border: 0; color: var(--toast-acc); font-weight: 800; cursor: pointer; padding: 6px 4px; white-space: nowrap; font-size: 14.5px; }

/* --- Connexion --- */
.auth {
  min-height: 100dvh; display: grid; place-items: center; padding: 28px 16px;
  background:
    radial-gradient(circle at 12% 18%, #DDF4E6 0 90px, transparent 91px),
    radial-gradient(circle at 88% 12%, #FDE3EC 0 70px, transparent 71px),
    radial-gradient(circle at 85% 88%, #FFEFCF 0 110px, transparent 111px),
    radial-gradient(circle at 8% 92%, #DBF0F1 0 80px, transparent 81px),
    var(--bg);
}
/* Sombre : choisi, ou automatique quand le systeme est en sombre. */
:root[data-theme="dark"] .auth {
    background:
      radial-gradient(circle at 12% 18%, #173A2A 0 90px, transparent 91px),
      radial-gradient(circle at 88% 12%, #401A2B 0 70px, transparent 71px),
      radial-gradient(circle at 85% 88%, #3D2D10 0 110px, transparent 111px),
      radial-gradient(circle at 8% 92%, #123B3E 0 80px, transparent 81px),
      var(--bg);
  }
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] .auth {
    background:
      radial-gradient(circle at 12% 18%, #173A2A 0 90px, transparent 91px),
      radial-gradient(circle at 88% 12%, #401A2B 0 70px, transparent 71px),
      radial-gradient(circle at 85% 88%, #3D2D10 0 110px, transparent 111px),
      radial-gradient(circle at 8% 92%, #123B3E 0 80px, transparent 81px),
      var(--bg);
  }
}
.login {
  width: min(100%, 420px); display: grid; gap: 14px; justify-items: center; text-align: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: 28px; padding: 28px 22px; box-shadow: var(--shadow-float);
}
.login-mark { width: 76px; height: 76px; transform: rotate(-4deg); }
.mark-bg { fill: var(--brand); }
.mark-cube { fill: var(--brand-ink); }
.mark-cube.is-taken { opacity: .35; }
.login h1 { font-family: var(--font-display); font-weight: 800; font-size: 38px; letter-spacing: -.02em; }
.login-lede { margin: -6px 0 4px; color: var(--muted); }
.login-alert { background: var(--danger-soft); color: var(--danger); border-radius: 14px; padding: 10px 14px; font-size: 14.5px; width: 100%; }
.login-note { color: var(--muted); font-size: 14.5px; }
.login-form { width: 100%; margin: 0; display: grid; gap: 2px; text-align: left; }
.login-form .btn { margin-top: 16px; }
.login .errors { text-align: left; }
.password { position: relative; }
.password .input { padding-right: 88px; }
.password .link { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
.remember { padding-top: 14px; }
.or { display: flex; align-items: center; gap: 12px; width: 100%; color: var(--muted); font-size: 13.5px; }
.or::before, .or::after { content: ""; flex: 1; border-top: 1px solid var(--line-strong); }
.login .button_to { width: 100%; margin: 0; }
.btn-google {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); box-shadow: none;
}
.btn-google:hover { background: var(--surface-2); border-color: var(--brand); }
.login-foot { font-size: 14.5px; color: var(--muted); margin-top: 4px; }
.flush-group { padding-left: 0; padding-top: 28px; }

/* --- Colonnes des pages (sur telephone, une seule) --- */
.product-page, .cook-grid { display: grid; gap: 4px; }
.product-side .ghost { margin-inline: 16px; }

/* ===================== Tablette : rail a gauche ===================== */
@media (min-width: 760px) {
  :root { --rail: 96px; }
  body { font-size: 16px; }
  .app { margin-left: var(--rail); padding: 0 12px 48px; max-width: 1280px; }
  .nav {
    left: 0; right: auto; top: 0; bottom: 0; width: var(--rail); height: auto; border-radius: 0; border: 0;
    border-right: 1px solid var(--line); box-shadow: none; display: flex; flex-direction: column; align-items: stretch;
    justify-content: flex-start; gap: 6px; padding: 18px 10px; grid-template-columns: none;
  }
  .brand { display: grid; justify-items: center; gap: 4px; text-decoration: none; color: var(--ink); margin-bottom: 14px; }
  .brand svg { width: 44px; height: 44px; transform: rotate(-4deg); }
  .brand span { font-family: var(--font-display); font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
  .nav-btn { padding: 10px 4px; font-size: 12px; }
  .nav-btn[aria-current="page"] { background: var(--brand-soft); }
  .nav .desk-only { display: grid; }
  .nav .phone-only { display: none; }
  .fab { order: 1; margin: 6px auto 12px; width: 56px; height: 56px; transform: none; border-radius: 18px; }
  .fab-plus { transform: none; }
  .brand { order: 0; }
  .nav-btn { order: 2; }
  .toast { bottom: 24px; left: calc(var(--rail) + 24px); }

  .top, .bar { padding-left: 12px; padding-right: 12px; }
  .top { padding-top: 24px; }
  .title { font-size: 38px; }
  .top .search { max-width: 520px; }
  .top .seg { max-width: 520px; }
  .top .title-row + .search, .top .search + .seg { width: 100%; }

  .list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; padding: 0 12px; }
  .alert, .totals, .pad-chips, .group, .hint, .empty-state { margin-left: 0; margin-right: 0; padding-left: 12px; padding-right: 12px; }
  .alert { margin: 8px 12px 0; }
  .empty-state { margin: 18px 12px 0; }

  .form { max-width: 720px; margin: 0 auto; padding: 4px 12px 0; }
  .bar:has(+ .form) { max-width: 744px; margin: 0 auto; }
  .kpis { grid-template-columns: repeat(4, 1fr); }
  .report-grid { grid-template-columns: 3fr 2fr; align-items: start; }
  .viz text { font-size: 8px; }
  .cook-grid .list { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
  .hist, .checklist { margin: 0 12px; }
  .narrow { max-width: 820px; }
}

/* ===================== Ordinateur : menu lateral ===================== */
@media (min-width: 1100px) {
  :root { --rail: 236px; }
  .app { padding: 0 28px 56px; }
  .nav { padding: 24px 16px; gap: 4px; }
  .brand { grid-template-columns: auto 1fr; justify-items: start; align-items: center; gap: 12px; padding: 0 8px; margin-bottom: 22px; }
  .brand svg { width: 42px; height: 42px; }
  .brand span { font-size: 24px; }
  .nav-btn { grid-template-columns: 24px 1fr; justify-items: start; align-items: center; gap: 12px; padding: 11px 12px; font-size: 15px; }
  .badge { position: static; justify-self: end; grid-column: 3; }
  .nav-btn:has(.badge) { grid-template-columns: 24px 1fr auto; }
  .fab { width: auto; height: auto; border-radius: 16px; padding: 13px 16px; margin: 0 0 18px; display: flex; gap: 10px; justify-content: center; }
  .fab-plus { font-size: 24px; margin: -2px 0 0; }
  .fab-label { display: inline; font-weight: 800; font-size: 16px; }
  .toast { left: calc(var(--rail) + 28px); }

  .list { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
  .product-page { grid-template-columns: 360px minmax(0, 1fr); gap: 0 24px; align-items: start; padding-top: 8px; }
  .product-side { position: sticky; top: 80px; }
  .product-side .pad { padding-top: 12px; }
  .product-main .list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .cook-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 12px; align-items: start; }
  .cook-grid .list { grid-template-columns: 1fr; }
  /* Sur ordinateur, les trois sections sont cote a cote : pas d'onglets. */
  .cook-tabs { display: none; }
  .kpis { gap: 12px; }
  .k-v { font-size: 30px; }
  .report-grid { gap: 16px; }
}
@media (prefers-reduced-motion: reduce) { .row:target { animation: none; } .minus { transition: none; } }

/* --- Choix de l'apparence --- */
.theme-switch { display: inline-grid; grid-template-columns: repeat(3, auto); gap: 4px; background: var(--surface); border: 1.5px solid var(--line); border-radius: 14px; padding: 4px; justify-self: start; }
.theme-switch button { border: 0; background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; padding: 7px 14px; border-radius: 10px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); }
.nav-theme { display: none; }
@media (min-width: 1100px) {
  .nav-theme { display: block; order: 3; margin-top: auto; padding: 0 4px; }
  .nav-theme .theme-switch { display: grid; width: 100%; }
  .nav-theme .theme-switch button { padding: 7px 6px; font-size: 13px; }
}

/* DLC saisie en duree : nombre + unite, la date calculee dessous. */
.dlc-duration { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.dlc-duration .input.narrow { width: 6.5em; }
.dlc-duration select.input.narrow { width: 9em; }
/* iOS donne aux champs date une largeur propre qui deborde de l'ecran. */
input[type="date"].input { display: block; min-width: 0; max-width: 100%; -webkit-appearance: none; appearance: none; }
.dlc-duration .hint { flex-basis: 100%; }

/* Le type d'un produit ne s'affiche qu'en recherche, ou tous les types se melangent. */
.kind-tag { display: none; font-weight: 700; color: var(--ink); }
.searching .kind-tag { display: inline; }

/* --- « A cuisiner » : onglets, filtres, groupes par categorie --- */
.top.static { position: static; backdrop-filter: none; -webkit-backdrop-filter: none; }
.filters { display: grid; gap: 8px; }
.chips.scroll {
  flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 2px;
  -webkit-overflow-scrolling: touch;
}
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex: none; }
/* Filtres du stock : rangement puis categorie, l'une sous l'autre. */
.pad-chips.scroll { margin: 0; padding: 10px 16px 2px; }
.pad-chips + .pad-chips { padding-top: 8px; }
.cook-grid .col { display: grid; align-content: start; }
.cook-group .group { padding-top: 14px; }
.kind-name { font-weight: 700; color: var(--ink); }
/* Telephone et tablette : l'onglet dit deja la section ; « Ma liste » n'a pas de filtres. */
@media (max-width: 1099px) {
  .cook-grid .col.is-off { display: none; }
  .col-title { display: none; }
  [data-cook-section="list"] .filters { display: none; }
}

/* --- Menus « Ajouter » et « Plus » --- */
.menu { list-style: none; margin: 4px 12px 0; padding: 0; display: grid; gap: 10px; max-width: 640px; }
.menu-item {
  display: grid; grid-template-columns: 46px 1fr auto; gap: 14px; align-items: center; padding: 14px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-card); color: var(--ink); text-decoration: none;
}
a.menu-item:hover { border-color: var(--brand); }
.menu-item b { display: block; font-size: 16.5px; }
.menu-item small { display: block; color: var(--muted); font-size: 13.5px; }
.menu-item.is-soon { opacity: .6; box-shadow: none; border-style: dashed; }
.menu-icon {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; font-size: 19px;
  background: var(--tone-soft); color: var(--tone);
}
.menu-go { color: var(--muted); font-size: 22px; }
.more-theme { padding-top: 26px; }

/* --- Courses --- */
.estimate { font-size: 15px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.estimate b { color: var(--ink); font-size: 20px; }
.estimate small { font-size: 12.5px; }
.shopping { display: grid; gap: 4px; }
.shopping .checklist { margin: 0 12px; }
.item-text { display: grid; gap: 1px; min-width: 0; }
.item-name { font-weight: 650; }
.checklist input:checked + .item-text .item-name { text-decoration: line-through; color: var(--muted); }
.checklist input:checked + .item-text { text-decoration: none; }
.qty-step { display: inline-flex; align-items: center; gap: 4px; font-variant-numeric: tabular-nums; }
.qty-step b { min-width: 2.2em; text-align: center; font-size: 14.5px; }
.step {
  width: 30px; height: 30px; border-radius: 10px; border: 0; background: var(--brand-soft); color: var(--brand-deep);
  font-size: 18px; font-weight: 700; cursor: pointer; display: grid; place-items: center; padding: 0;
}

/* --- « A finir » --- */
.alerts-grid { display: grid; gap: 8px; }
@media (min-width: 760px) {
  .menu { margin: 4px 12px 0; }
  .shopping { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); align-items: start; gap: 0 12px; }
  .shopping .checklist { margin: 0; }
}
@media (min-width: 1100px) {
  .alerts-grid { grid-template-columns: 3fr 2fr; gap: 0 16px; align-items: start; }
  .alerts-grid .list { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
}

/* --- Importer un ticket --- */
.receipt-upload { padding-top: 12px; max-width: 640px; }
.dropzone {
  display: grid; justify-items: center; gap: 6px; text-align: center; padding: 34px 18px; cursor: pointer;
  border: 2px dashed var(--line-strong); border-radius: 22px; background: var(--surface); color: var(--ink);
}
.dropzone:hover, .dropzone:focus-within { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.dropzone b { font-size: 18px; }
.dropzone small { color: var(--muted); font-size: 14px; }
.dropzone-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink); font-size: 26px; font-weight: 800; }
.dropzone.is-busy { pointer-events: none; border-style: solid; border-color: var(--brand); }
.dropzone.is-busy .dropzone-icon { animation: pulse 1s ease-in-out infinite alternate; }
@keyframes pulse { from { opacity: .45; } to { opacity: 1; } }
.receipt-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.receipt-head b { display: block; font-size: 18px; }
.receipt-date { display: grid; gap: 4px; }
.receipt .alert { margin: 0; }
.rlines li { align-items: flex-start; padding-right: 0; }
.rcheck { padding: 14px 4px 14px 14px; }
.rlines details { flex: 1; min-width: 0; }
.rlines summary { list-style: none; cursor: pointer; padding: 12px 14px 12px 8px; display: grid; gap: 1px; position: relative; padding-right: 32px; }
.rlines summary::-webkit-details-marker { display: none; }
.rlines summary::after { content: "›"; position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 20px; transition: transform .15s; }
.rlines details[open] summary::after { transform: translateY(-50%) rotate(90deg); }
.rname { font-weight: 650; }
.rline:has(input[type=checkbox]:not(:checked)) .rname { text-decoration: line-through; color: var(--muted); }
.rfields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 0 14px 14px 8px; }
.rfield { display: grid; gap: 4px; min-width: 0; }
.rfield.wide, .rfields .hint { grid-column: 1 / -1; }
.rfield .input { padding: 9px 10px; font-size: 15px; }
.t-brand { color: var(--brand); font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .dropzone.is-busy .dropzone-icon { animation: none; } }
/* Les champs d'une ligne ouverte : pas la mise en page des cases de la liste. */
.rlines label.rfield { display: grid; gap: 4px; padding: 0; cursor: auto; font-size: 15px; align-items: start; }
.rlines label.rcheck { display: block; padding: 14px 4px 14px 14px; }
.rlines label.rfield .input { width: 100%; }

/* --- Rapports : periodes, tableaux, gaspillage --- */
.top .chips .chip[aria-current="page"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.kpis.two { grid-template-columns: 1fr 1fr; }
.tbl.flat { max-height: none; }
.tbl .dot { vertical-align: middle; margin-right: 4px; }
.tbl small { color: var(--muted); }
.b-t i.waste { background: var(--danger); }
.b-v small { color: var(--muted); font-weight: 600; font-size: 11px; }
.bars li { grid-template-columns: 9em minmax(0, 1fr) auto; }
.tbl .sq { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: middle; margin-right: 4px; }
@media (max-width: 759px) { .tbl .wide-only { display: none; } }

/* Filtres de rangement du stock : une seule ligne (defile si l'ecran est tres etroit). */
.storages { flex-wrap: nowrap; gap: 5px; overflow-x: auto; scrollbar-width: none; }
.storages::-webkit-scrollbar { display: none; }
.storages .chip { flex: none; padding: 7px 10px; font-size: 13.5px; }

/* --- Scanner --- */
.scan-page { max-width: 560px; padding-top: 8px; }
.scanner { position: relative; aspect-ratio: 4 / 3; border-radius: 22px; overflow: hidden; background: #0b1013; }
.scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 28% 12%; border: 3px solid rgba(255, 255, 255, .9); border-radius: 16px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scan-page.is-found .scan-frame { border-color: var(--brand); }
.scan-page.is-off .scanner { aspect-ratio: 4 / 1.4; }
.scan-page.is-off .scan-frame { display: none; }
.scan-status { font-weight: 700; text-align: center; }
.scan-result { max-width: 560px; }
.scan-result .product-head .title { font-size: 28px; }
.scan-stock { font-size: 16px; }
.btn.scan-main { width: 100%; display: grid; justify-items: center; gap: 2px; padding: 16px; font-size: 20px; }
.btn.scan-main small { font-size: 13px; font-weight: 600; opacity: .85; }
.btn.alt-solid { width: 100%; background: var(--brand-soft); color: var(--brand-deep); box-shadow: none; }
.restock { display: grid; gap: 10px; margin: 0; }
.restock-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.scan-result .rfield, .scan-form .rfield { display: grid; gap: 4px; min-width: 0; }
.scan-form { display: grid; gap: 12px; margin: 0; }
.suggest-list li { padding: 0; }
.suggest-list form { flex: 1; }
.suggest { width: 100%; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 14px; background: transparent; border: 0; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.suggest b { display: block; }
.search-scan { flex: none; display: grid; place-items: center; width: 38px; height: 38px; margin-right: -6px; border-radius: 11px; color: var(--brand); text-decoration: none; }
.search-scan:hover { background: var(--brand-soft); }
.scan-result .checklist { margin: 0; }

/* Relecture d'un ticket : quantite et congel sur la ligne. */
.rmain { flex: 1; min-width: 0; }
.rlines .rmain summary { padding-bottom: 4px; }
.rctl { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 14px 12px 8px; }
.qstep { display: inline-flex; align-items: center; gap: 4px; }
.qty-in { width: 3.2em; text-align: center; font: inherit; font-weight: 700; font-variant-numeric: tabular-nums; border: 1.5px solid var(--line); border-radius: 10px; padding: 5px 2px; background: var(--surface); color: var(--ink); -moz-appearance: textfield; }
.qty-in::-webkit-inner-spin-button, .qty-in::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.freeze-chip { border: 1.5px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13.5px; font-weight: 700; cursor: pointer; }
.freeze-chip[aria-pressed="true"] { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.rline:has(.rcheck input[type="checkbox"]:not(:checked)) .rctl { opacity: .4; pointer-events: none; }
.pick-go { font-weight: 800; color: var(--brand); background: var(--brand-soft); border-radius: 10px; padding: 4px 9px; font-size: 14px; }
.scan-page .seg { margin-bottom: 2px; }
