/* 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: 72px;
  --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; }
/* 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-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-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; }
.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 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; }
.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%; }

.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; }
.kinds { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.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; }
.sugg { display: grid; gap: 6px; }
.sugg-list { display: grid; gap: 6px; }
.sugg-item {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; text-align: left; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); border-radius: 14px; padding: 11px 13px; cursor: pointer; font-size: 15px; font-weight: 600;
}
.sugg-item small { color: var(--muted); font-size: 12px; white-space: nowrap; font-weight: 500; }
.sugg-item:hover { border-color: var(--brand); }
.sugg-item.is-new { border-style: dashed; border-color: var(--brand); color: var(--brand); }
.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 1fr; align-items: start; gap: 12px; }
.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 flottante sur telephone --- */
.nav {
  position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); z-index: 10;
  display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center; height: var(--nav-h);
  padding: 0 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow-float);
}
.brand { display: none; }
.nav-btn {
  font-size: 11.5px; font-weight: 700; display: grid; justify-items: center; gap: 3px; color: var(--muted); text-decoration: none;
  padding: 8px 0; position: relative; white-space: nowrap; border-radius: 14px;
}
.nav-btn[aria-current="page"] { color: var(--brand); }
.fab {
  width: 60px; height: 60px; margin: -30px 4px 0; border-radius: 20px; 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: 34px; 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) + 26px + 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); }
  .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 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 8px; align-items: start; }
  .cook-grid .col:last-child { grid-column: 1 / -1; }
  .cook-grid .list { grid-template-columns: 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; }
  .cook-grid .col:last-child { grid-column: auto; }
  .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; }
}
