/* Galy Stock - interface utilitaire.
 *
 * Gris neutres, un seul bleu d'accent, et deux couleurs d'état qui ne
 * servent qu'à dire si un produit manque. Le mode sombre est le mode
 * principal (le garage à 23h), le mode clair sert dans la cuisine le matin.
 * Aucune police distante : l'appli doit s'afficher hors ligne, donc la
 * personnalité passe par la graisse et la chasse. Lignes de 60 px, chiffres
 * en monospace : lisible d'une main, l'autre tenant la boîte.
 */

:root {
  color-scheme: dark light;

  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;

  /* sombre */
  --ground: #0e0f11;
  --panel: #17181c;
  --panel-2: #1e2025;
  --line: #2a2d33;
  --line-strong: #3d414a;
  --ink: #f1f2f4;
  --ink-2: #b4b8c0;
  --muted: #848a94;

  --accent: #5b95ff;
  --accent-ink: #08111f;
  --ok: #43d17f;             /* en stock */
  --warn: #e0b341;           /* bas, bientôt périmé */
  --bad: #ff6f6f;            /* vide, périmé */
  --alert: #ff6f6f;

  --radius: 12px;
  --radius-s: 8px;
  --tap: 60px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 6px 20px rgba(0, 0, 0, .4);
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #edeff2;
  --line: #e0e3e8;
  --line-strong: #c3c8d1;
  --ink: #14161a;
  --ink-2: #454b55;
  --muted: #6b7280;
  --accent: #1f6feb;
  --accent-ink: #ffffff;
  --ok: #157f4b;
  --warn: #9a6b00;
  --bad: #d3392c;
  --alert: #d3392c;
  --shadow: 0 1px 2px rgba(20, 25, 35, .06), 0 6px 18px rgba(20, 25, 35, .06);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --ground: #f4f5f7;
    --panel: #ffffff;
    --panel-2: #edeff2;
    --line: #e0e3e8;
    --line-strong: #c3c8d1;
    --ink: #14161a;
    --ink-2: #454b55;
    --muted: #6b7280;
    --accent: #1f6feb;
    --accent-ink: #ffffff;
    --ok: #157f4b;
    --warn: #9a6b00;
    --bad: #d3392c;
    --alert: #d3392c;
    --shadow: 0 1px 2px rgba(20, 25, 35, .06), 0 6px 18px rgba(20, 25, 35, .06);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
#app { position: relative; }

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

/* --- étiquettes au pochoir ------------------------------------------------ */
.stencil {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
}

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-2);
  white-space: nowrap;
}
.chip.is-bad { border-color: var(--bad); color: var(--bad); }
.chip.is-warn { border-color: var(--warn); color: var(--warn); }
.chip.is-ok { border-color: var(--ok); color: var(--ok); }
.chip.is-admin { border-color: var(--accent); color: var(--accent); }

/* --- structure ------------------------------------------------------------ */
.wrap { max-width: 620px; margin: 0 auto; padding: 0 14px 120px; }
.wrap.wide { max-width: 1180px; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  padding-top: max(10px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--ground) 88%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 800; letter-spacing: .1em; text-transform: uppercase; font-size: 13px;
  color: var(--ink); text-decoration: none;
}
.brandmark {
  width: 22px; height: 22px; flex: none;
  display: inline-grid; place-items: center;
  border-radius: 6px; background: var(--accent); color: var(--accent-ink);
}
.brandmark svg { width: 14px; height: 14px; }
.topbar .spacer { flex: 1; }

.iconbtn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--ink-2);
}
.iconbtn:hover { border-color: var(--line-strong); color: var(--ink); }
.iconbtn svg { width: 19px; height: 19px; }

/* --- plaque de lieu ------------------------------------------------------- */
.plate {
  margin: 14px 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.plate .head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px 12px;
}
.plate h1 {
  margin: 2px 0 0;
  font-size: 25px; line-height: 1.15; font-weight: 800; letter-spacing: -.01em;
}
.plate .meta { margin-top: 5px; display: flex; flex-wrap: wrap; gap: 6px; }
.plate .photo { width: 100%; display: block; max-height: 260px; object-fit: cover; border-top: 1px solid var(--line); }

.lock {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.lock .digits {
  font-family: var(--mono);
  font-size: clamp(30px, 10vw, 42px);
  font-weight: 700;
  letter-spacing: .08em;
  font-variant-numeric: tabular-nums slashed-zero;
  color: var(--accent);
  line-height: 1;
  word-break: break-all;
}
.lock .digits.pw { font-size: clamp(20px, 6.5vw, 30px); letter-spacing: .04em; cursor: pointer; }
.lock .none { font-size: 15px; color: var(--muted); font-style: italic; }

/* --- compteurs ------------------------------------------------------------ */
.tally { display: flex; gap: 8px; margin-bottom: 12px; }
.tally .t {
  flex: 1; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--panel);
}
.tally .t b { display: block; font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums; }
.tally .t.bad b { color: var(--bad); }
.tally .t.warn b { color: var(--warn); }
.tally .t .stencil { display: block; margin-top: 2px; }

/* --- lignes ----------------------------------------------------------------- */
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); }
.list .group {
  padding: 8px 14px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
}
.list .group:first-child { border-top: 0; }

.row {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: var(--tap);
  padding: 10px 14px 10px 22px;
  background: transparent; border: 0; border-bottom: 1px solid var(--line);
  text-align: left; color: inherit;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.row:last-child { border-bottom: 0; }
.row:active { background: var(--panel-2); }
.row .bar { position: absolute; left: 0; top: 0; bottom: 0; width: 8px; background: var(--line-strong); }
.row.is-ok .bar { background: var(--ok); }
.row.is-bas .bar, .row.is-bientot .bar { background: var(--warn); }
/* Les rayures obliques disent « manque » sans dépendre de la couleur. */
.row.is-vide .bar, .row.is-perime .bar {
  background: repeating-linear-gradient(135deg, var(--bad) 0 5px, color-mix(in srgb, var(--bad) 35%, var(--panel)) 5px 10px);
}
.row .body { flex: 1; min-width: 0; }
.row .name { font-size: 17px; font-weight: 650; line-height: 1.25; }
.row .sub { margin-top: 3px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.row .sub .ref { font-family: var(--mono); font-size: 12px; }
.row .sub .bad { color: var(--bad); font-weight: 600; }
.row .sub .warn { color: var(--warn); font-weight: 600; }

.row .qty {
  flex: none; min-width: 64px; height: 42px; padding: 0 10px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong); border-radius: var(--radius-s);
  font-family: var(--mono); font-size: 17px; font-weight: 700; letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.row.is-vide .qty, .row.is-perime .qty { border-color: var(--bad); color: var(--bad); }
.row.is-bas .qty { border-color: var(--warn); color: var(--warn); }

@keyframes flash { from { background: color-mix(in srgb, var(--accent) 22%, transparent); } to { background: transparent; } }
.row.flash { animation: flash .5s ease-out; }

/* Le nom est un bouton (détail), les deux flancs sont + et − : trois cibles
 * sur une ligne de 60 px, sans que le pouce hésite. */
.row .body { background: transparent; border: 0; padding: 0; text-align: left; color: inherit; font: inherit; }
.row .qty .u { font-size: 12px; color: var(--muted); font-weight: 600; }
.row .step {
  flex: none; width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--panel-2); color: var(--ink);
}
.row .step svg { width: 18px; height: 18px; }
.row .step:active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.row .qty { min-width: 54px; }
@media (max-width: 400px) { .row { padding-right: 8px; gap: 8px; } .row .qty { min-width: 46px; padding: 0 4px; } }

.bigsteps { display: flex; gap: 10px; margin: 0 0 4px; }
.bigsteps .btn { flex: 1; min-height: 72px; font-size: 22px; font-family: var(--mono); }
.bigsteps .btn svg { width: 24px; height: 24px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips button {
  padding: 8px 12px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--panel); color: var(--ink-2);
  font-size: 13px; font-weight: 700;
}
.chips button:active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.searchbar { margin-bottom: 12px; }
.addline { display: flex; gap: 8px; margin-bottom: 12px; }
.addline input { flex: 1; }
.addline .btn { flex: none; width: 50px; padding: 0; }

.tally button.t { text-align: left; color: inherit; font: inherit; cursor: pointer; }
.tally button.t:active { background: var(--panel-2); }

/* Liste de courses : une case ronde à gauche, la ligne entière est la cible. */
.pick {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: var(--tap); padding: 10px 14px;
  border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; text-align: left;
}
.pick:last-child { border-bottom: 0; }
.pick:active { background: var(--panel-2); }
.pick input { width: 22px; height: 22px; min-height: 0; flex: none; accent-color: var(--accent); }
.pick .box {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line-strong); display: grid; place-items: center; color: var(--accent-ink);
}
.pick .box.on { background: var(--accent); border-color: var(--accent); }
.pick .box svg { width: 16px; height: 16px; }
.pick .body { flex: 1; min-width: 0; }
.pick .name { font-size: 16px; font-weight: 650; }
.pick .sub { margin-top: 2px; font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.pick .sub .bad { color: var(--bad); font-weight: 600; }
.pick .sub .warn { color: var(--warn); font-weight: 600; }
.pick .iconbtn { width: 36px; height: 36px; font-size: 20px; }

.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  width: 52px; height: 52px; flex: none;
  font-size: 24px; font-weight: 700;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.stepper button:active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper b { min-width: 52px; text-align: center; font-family: var(--mono); font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* --- boutons -------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  background: var(--panel); color: var(--ink);
  font-size: 15px; font-weight: 700; letter-spacing: .02em;
  text-decoration: none;
}
.btn:hover { border-color: var(--ink-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--alert); border-color: color-mix(in srgb, var(--alert) 55%, var(--line)); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: 13px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn svg { width: 18px; height: 18px; }

.actions { display: flex; gap: 10px; margin: 14px 0; }
.actions .btn { flex: 1; }

/* --- champs --------------------------------------------------------------- */
.field { margin-bottom: 14px; }
.field > label { display: block; margin-bottom: 6px; }
input[type="text"], input[type="search"], input[type="number"], input[type="password"], input[type="date"], select, textarea {
  width: 100%; min-height: 50px; padding: 10px 13px;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-s);
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
textarea { min-height: 84px; resize: vertical; }
::placeholder { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; }
.check input { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }

/* --- pavé numérique ------------------------------------------------------- */
.pin { display: flex; justify-content: center; gap: 12px; margin: 26px 0 22px; }
.pin i {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: transparent;
  transition: transform .12s ease, background .12s ease;
}
.pin i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.15); }
.pin.bad { animation: shake .4s; }
@keyframes shake { 25% { transform: translateX(-9px); } 50% { transform: translateX(9px); } 75% { transform: translateX(-5px); } }

.keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 320px; margin: 0 auto; }
.keys button {
  height: 68px;
  font-family: var(--mono); font-size: 27px; font-weight: 600;
  background: var(--panel); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
}
.keys button:active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.keys button.blank { background: transparent; border-color: transparent; pointer-events: none; }
.keys button.wide { font-size: 15px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* --- cartes / panneaux ---------------------------------------------------- */
.card {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 16px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 800; }
.card .qr { display: block; margin: 0 auto; background: #fff; padding: 8px; border-radius: var(--radius-s); max-width: 100%; height: auto; }

.placelink {
  display: flex; align-items: center; gap: 13px;
  width: 100%; min-height: var(--tap); padding: 12px 14px;
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: inherit; text-align: left; text-decoration: none;
}
.placelink:last-child { border-bottom: 0; }
.placelink:active { background: var(--panel-2); }
.placelink .kind {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); color: var(--muted);
}
.placelink .kind svg { width: 20px; height: 20px; }
.placelink .n { flex: 1; min-width: 0; }
.placelink .n b { display: block; font-size: 17px; font-weight: 650; }
.placelink .n span { font-size: 13px; color: var(--muted); }
.placelink .count { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
.placelink .count.warn { color: var(--warn); }
.placelink .count.bad { color: var(--bad); }
.placelink.sub { padding-left: 34px; }

/* --- bandeaux ------------------------------------------------------------- */
.note {
  padding: 12px 14px; border-radius: var(--radius-s);
  border: 1px solid var(--line-strong); background: var(--panel);
  font-size: 14px; margin-bottom: 14px;
}
.note.warn { border-color: color-mix(in srgb, var(--accent) 60%, var(--line)); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.note.bad { border-color: color-mix(in srgb, var(--alert) 60%, var(--line)); background: color-mix(in srgb, var(--alert) 10%, var(--panel)); color: var(--ink); }

.offline {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: var(--accent); color: var(--accent-ink);
  font-size: 13px; font-weight: 700; letter-spacing: .04em; text-align: center;
  transform: translateY(110%); transition: transform .25s ease;
}
.offline.on { transform: none; }

.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 50;
  max-width: 90vw; padding: 12px 18px;
  display: flex; align-items: center; gap: 12px;
  background: var(--ink); color: var(--ground);
  border-radius: 999px; font-size: 14px; font-weight: 650;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .4);
  opacity: 0; visibility: hidden; pointer-events: none;
  transform: translate(-50%, 14px);
  transition: transform .22s cubic-bezier(.2, .9, .3, 1.2), opacity .18s ease, visibility .18s;
}
.toast.on { opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); }
.toast-act {
  flex: none; padding: 4px 11px;
  background: transparent; color: var(--ground);
  border: 1px solid var(--ground); border-radius: 999px;
  font-size: 13px; font-weight: 700;
}

/* --- barre d'action collée en bas ---------------------------------------- */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; gap: 10px;
  padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--ground) 92%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.dock .btn { flex: 1; }

/* --- feuilles ------------------------------------------------------------- */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--ground);
}
.sheet .sheet-head { display: flex; gap: 10px; align-items: center; padding: 12px 14px; padding-top: max(12px, env(safe-area-inset-top)); border-bottom: 1px solid var(--line); }
.sheet .sheet-body { flex: 1; overflow: auto; padding: 14px; padding-bottom: 40px; }

/* --- tableaux (administration) ------------------------------------------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 14px 0 16px; padding-bottom: 4px; }
.tabs button {
  flex: none; padding: 9px 15px;
  border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--ink-2);
  font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
}
.tabs button.on { background: var(--ink); border-color: var(--ink); color: var(--ground); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 800; white-space: nowrap; }
tbody tr:hover { background: var(--panel-2); }
td .mono, .mono { font-family: var(--mono); font-size: 13px; }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }

.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.kpi { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 14px 16px; }
.kpi b { display: block; font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi.bad b { color: var(--bad); }
.kpi.warn b { color: var(--warn); }

.rowline { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rowline .grow { flex: 1; min-width: 140px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); }
.hex {
  font-family: var(--mono); font-size: 12px; line-height: 1.5;
  word-break: break-all; padding: 10px 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  user-select: all;
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; padding-top: 3px; }
.kv dd { margin: 0; font-family: var(--mono); word-break: break-all; }

/* --- fil d'historique ----------------------------------------------------- */
.feedline {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.feedline:last-child { border-bottom: 0; }
.feedline .what { flex: 1; min-width: 0; line-height: 1.45; }
.feedline .when { flex: none; font-size: 12px; padding-top: 2px; }

/* --- entrée en scène ------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .stagger > * { animation: rise .32s both; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
  .stagger > *:nth-child(1) { animation-delay: .01s; }
  .stagger > *:nth-child(2) { animation-delay: .03s; }
  .stagger > *:nth-child(3) { animation-delay: .05s; }
  .stagger > *:nth-child(4) { animation-delay: .07s; }
  .stagger > *:nth-child(5) { animation-delay: .09s; }
  .stagger > *:nth-child(n+6) { animation-delay: .11s; }
}

@media (min-width: 760px) {
  body { font-size: 16px; }
  .wrap { padding-bottom: 60px; }
  .dock { position: static; border: 0; padding: 0; margin: 16px 0; background: none; backdrop-filter: none; }
}

/* --- l'administration sur un téléphone ------------------------------------ */
/* Les tableaux deviennent des fiches empilées, chaque cellule portant son
 * intitulé. Si on ajoute une colonne, lui mettre un data-label. */
@media (max-width: 760px) {
  .wrap.wide { padding-left: 12px; padding-right: 12px; }

  .tablewrap { border: 0; background: transparent; overflow: visible; }
  .tablewrap table, .tablewrap tbody, .tablewrap tr, .tablewrap td { display: block; width: 100%; }
  .tablewrap thead { display: none; }
  .tablewrap tr {
    border: 1px solid var(--line); border-radius: var(--radius);
    background: var(--panel); padding: 12px 14px; margin-bottom: 10px;
  }
  .tablewrap tr:hover { background: var(--panel); }
  .tablewrap td { border: 0; padding: 3px 0; }
  .tablewrap td:empty { display: none; }
  .tablewrap td.right { text-align: left; }
  .tablewrap td[data-label]::before {
    content: attr(data-label) " ";
    display: block; margin-bottom: 2px;
    font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: var(--muted);
  }
  .tablewrap td.acts {
    display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; padding-top: 10px;
    border-top: 1px solid var(--line);
  }
  .tablewrap td.acts .btn { flex: 1 1 calc(50% - 8px); min-height: 44px; }

  .grid2 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 11px 12px; }
  .kpi b { font-size: 24px; }

  .tabs { scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { padding: 9px 13px; font-size: 12px; }

  .rowline { gap: 8px; }
  .rowline .grow { min-width: 100%; }
  .rowline .btn.small, .rowline select { min-height: 44px; }

  .card { padding: 13px; }
  .card h2 { font-size: 13px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
}

@media (min-width: 1100px) {
  .wrap.wide { max-width: 1320px; }
  .grid2 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
}

/* --- bandeau d'onglets en bas (administration au téléphone) --------------- */
/* Quatre destinations au pouce, le reste derrière « Plus ». */
.tabbar { display: none; }

@media (max-width: 760px) {
  .tabs.desk { display: none; }

  .tabbar {
    display: flex;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 35;
    background: color-mix(in srgb, var(--ground) 94%, transparent);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .tabbar button {
    flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px 7px; min-height: 58px;
    background: transparent; border: 0;
    color: var(--muted);
  }
  .tabbar button svg { width: 22px; height: 22px; }
  .tabbar button span {
    font-size: 10px; font-weight: 700; letter-spacing: .02em;
    max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
  .tabbar button.on { color: var(--accent); }
  .tabbar button:active { background: var(--panel-2); }

  .wrap.wide { padding-bottom: 96px; }
}

@media print {
  .topbar, .tabs, .tabbar, .dock, .offline, .toast, .btn { display: none !important; }
  :root { --ground: #fff; --panel: #fff; --panel-2: #fff; --ink: #000; --ink-2: #333; --muted: #555; --line: #ccc; --line-strong: #888; }
  .wrap { max-width: none; padding: 0; }
  .card { break-inside: avoid; border: 0; padding: 0; }
}
