/* Caisse West Up — pensée d'abord pour le tactile (iPhone / iPad) :
   cibles ≥ 44 px, aucune sélection / menu contextuel au doigt long, fenêtres en
   feuille basse sur téléphone, panier « encaisser » toujours à portée de pouce. */
:root {
    --primary: #6750A4;
    --on-primary: #fff;
    --bg: #fff;
    --surface: #f6f3fa;
    --text: #1d1b20;
    --muted: #625b71;
    --border: #d9d3e3;
    --error-bg: #fde7e9;
    --error: #9f1c2b;
    --radius: 0.875rem;
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #cfbcff;
        --on-primary: #381e72;
        --bg: #141218;
        --surface: #211f26;
        --text: #e6e0e9;
        --muted: #cac4d0;
        --border: #49454f;
        --error-bg: #4a1a20;
        --error: #ffb4ab;
    }
}
* { box-sizing: border-box; touch-action: manipulation; }
[x-cloak] { display: none !important; }
/* Taille de l'interface : tout est en rem, --ui-scale (Réglages) le met à l'échelle. */
html { -webkit-text-size-adjust: 100%; font-size: calc(16px * var(--ui-scale, 1)); }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
@supports (height: 100dvh) { html, body { height: 100dvh; } }
body {
    font: 1rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--text);
    background: var(--bg);
    padding: 0 env(safe-area-inset-right, 0px) 0 env(safe-area-inset-left, 0px);
    -webkit-tap-highlight-color: transparent;
    /* Un doigt qui reste posé ne doit ni sélectionner du texte ni ouvrir le menu de partage / d'image. */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
img, svg { -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none; }
img { pointer-events: none; }
button { -webkit-appearance: none; appearance: none; }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; text-align: center; }
h3 { margin: 0; font-size: 1rem; }
.muted { color: var(--muted); font-size: .9rem; }
.icon { width: 1.375rem; height: 1.375rem; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Écrans plein page (connexion…) : défilent si le clavier prend la place */
.center { height: 100%; overflow-y: auto; display: flex; padding: calc(1rem + var(--safe-top)) 1rem calc(1rem + var(--safe-bottom)); }
.center > * { margin: auto; }
.card { width: 100%; max-width: 23.75rem; background: var(--surface); border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: 0.875rem; }
.logo { align-self: center; border-radius: 1rem; }
.stack { display: flex; flex-direction: column; gap: 0.875rem; }
label { display: flex; flex-direction: column; gap: 0.375rem; font-weight: 600; font-size: .9rem; }
input {
    font: inherit; padding: 0.75rem 0.875rem; min-height: 3rem; border-radius: 0.75rem; width: 100%;
    border: 1px solid var(--border); background: var(--bg); color: var(--text);
    -webkit-appearance: none; appearance: none;
}
input[type="checkbox"] { width: 1.5rem; height: 1.5rem; min-height: 0; padding: 0; flex: none; accent-color: var(--primary); -webkit-appearance: auto; appearance: auto; }
input[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; }
input:focus-visible, .btn:focus-visible, .chip:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
label:has(> input[type="checkbox"]) { flex-direction: row; align-items: center; gap: 0.75rem; min-height: 2.75rem; font-size: 1rem; }

.btn {
    font: inherit; font-weight: 600; min-height: 3rem; padding: 0 1.125rem; border-radius: 62.4375rem;
    border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; text-align: center;
}
.btn:active:not(:disabled) { filter: brightness(.94); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-small { min-height: 2.75rem; padding: 0 0.875rem; font-size: .92rem; }
.btn-block { width: 100%; }
.icon-btn { flex: none; width: 3rem; height: 3rem; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--text); display: grid; place-items: center; cursor: pointer; padding: 0; }

.sep { display: flex; align-items: center; gap: 0.625rem; color: var(--muted); font-size: .85rem; }
.sep::before, .sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

.alert { margin: 0; padding: 0.625rem 0.875rem; border-radius: 0.625rem; background: var(--error-bg); color: var(--error); font-weight: 600; }

.spinner { width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0.3125rem solid var(--border); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Caisse ───────────────────────────────────────── */
.app { display: flex; flex-direction: column; height: 100%; }
.bar { display: flex; align-items: center; gap: 0.625rem; padding: calc(0.5rem + var(--safe-top)) 0.75rem 0.5rem; border-bottom: 1px solid var(--border); background: var(--surface); flex: none; }
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.brand img { width: 2rem; height: 2rem; border-radius: 0.5625rem; }
.grow { flex: 1; min-width: 0; }
.who { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.pill { display: inline-flex; align-items: center; gap: 0.375rem; min-height: 2rem; padding: 0 0.75rem; border-radius: 62.4375rem; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.pill.ok { background: var(--primary); color: var(--on-primary); }
.pill.closed { background: var(--border); color: var(--text); }
.badge { padding: 2px 0.625rem; border-radius: 62.4375rem; font-size: .8rem; font-weight: 700; }
.badge.ok { background: var(--primary); color: var(--on-primary); }
.bar-actions { display: none; align-items: center; gap: 0.5rem; }
.only-wide { display: none; }
@media (min-width: 1000px) {
    .bar-actions { display: flex; }
    .narrow-only { display: none; }
    .only-wide { display: inline-flex; }
}

/* Bandeaux d'état sous l'en-tête (hors ligne, ventes à synchroniser, caisse fermée) */
.notices { flex: none; }
.notice { display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.75rem; font-size: .92rem; font-weight: 600; background: var(--error-bg); color: var(--error); border-bottom: 1px solid var(--border); }
.notice.info { background: var(--surface); color: var(--text); }
.notice span { flex: 1; min-width: 0; }

.body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.catalog { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: calc(6.5rem + var(--safe-bottom)); }
.catalog-head { position: sticky; top: 0; z-index: 3; background: var(--bg); padding: 0.625rem 0.75rem 0; }
.tools { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.tools .search { grid-column: 1 / -1; position: relative; }
.tools .search input { padding-right: 3rem; }
.tools .clear { position: absolute; right: 2px; top: 2px; width: 2.75rem; height: 2.75rem; border: 0; background: transparent; color: var(--muted); font-size: 1.3rem; cursor: pointer; }
.tools .btn { min-height: 3rem; padding: 0 0.75rem; white-space: nowrap; }
@media (min-width: 600px) {
    .tools { grid-template-columns: 1fr auto auto; }
    .tools .search { grid-column: auto; }
}
/* Écran bas (téléphone en paysage) : l'en-tête du catalogue défile avec la liste pour laisser la place aux articles. */
@media (max-height: 500px) {
    .catalog-head { position: static; }
    .tools { grid-template-columns: 1fr auto auto; }
    .tools .search { grid-column: auto; }
    .bar { padding-top: calc(0.25rem + var(--safe-top)); padding-bottom: 0.25rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(8.125rem, 1fr)); }
}
.chips { display: flex; flex-wrap: nowrap; gap: 0.5rem; margin: 0 -0.75rem; padding: 0.625rem 2.75rem 0.625rem 0.75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; scroll-snap-type: x proximity; scroll-padding-left: 0.75rem; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; scroll-snap-align: start; font: inherit; font-weight: 600; min-height: 2.75rem; padding: 0 1rem; border-radius: 62.4375rem; border: 1px solid var(--border); background: var(--bg); color: var(--text); cursor: pointer; white-space: nowrap; }
.chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--tile-min, 9.375rem), 1fr)); gap: 0.625rem; padding: 0.375rem 0.75rem; }
.product { position: relative; font: inherit; color: inherit; text-align: left; border: 0; cursor: pointer; background: var(--surface); border-radius: var(--radius); padding: 0.5rem; display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; }
.product:active { transform: scale(.97); }
.thumb { aspect-ratio: 1; border-radius: 0.625rem; background: var(--border); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 599px) { .thumb { aspect-ratio: 4 / 3; } }
.name { font-weight: 600; font-size: .95rem; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.price { font-variant-numeric: tabular-nums; font-weight: 700; margin-top: auto; }
.member { color: var(--primary); font-weight: 600; }
.price .member { display: block; font-size: .8rem; font-weight: 600; }
.qty-badge { position: absolute; top: 0.75rem; right: 0.75rem; min-width: 1.875rem; height: 1.875rem; padding: 0 0.5625rem; border-radius: 62.4375rem; background: var(--primary); color: var(--on-primary); font-weight: 800; display: grid; place-items: center; box-shadow: 0 2px 0.5rem rgba(0,0,0,.3); }
@media (hover: hover) { .product:hover { filter: brightness(.97); } }

/* ── Panier ───────────────────────────────────────── */
.cart { border-left: 1px solid var(--border); background: var(--surface); display: none; flex-direction: column; min-height: 0; }
.cart-bar, .cart-backdrop { display: none; }
.cart-content { display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; min-height: 0; flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.member-chip { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.625rem 0.75rem; border-radius: 0.75rem; background: var(--bg); border: 1px solid var(--primary); }
.member-chip small { display: block; }
.lines { list-style: none; margin: 0; padding: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1 1 auto; min-height: 7.5rem; display: flex; flex-direction: column; gap: 0.625rem; }
.lines li { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "main total" "qty qty"; gap: 0.375rem 0.625rem; align-items: start; padding-bottom: 0.625rem; border-bottom: 1px solid var(--border); }
.lines li:last-child { border-bottom: 0; }
.line-main { grid-area: main; min-width: 0; overflow-wrap: anywhere; font-weight: 600; }
.line-main small { display: block; font-size: .8rem; font-weight: 500; }
.lines .qty { grid-area: qty; }
.lines .line-total { grid-area: total; }
.lines .empty { display: block; padding: 1.5rem 0; text-align: center; border: 0; }
.qty { display: flex; align-items: center; gap: 0.625rem; font-variant-numeric: tabular-nums; font-weight: 700; }
.qty > span { min-width: 1.6ch; text-align: center; }
.round { flex: none; width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 1px solid var(--border); background: var(--bg); color: var(--text); font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; padding: 0; }
.round:active { background: var(--border); }
.round.small { width: 2.5rem; height: 2.5rem; font-size: 1.1rem; }
.line-total { min-width: 4rem; text-align: right; font-variant-numeric: tabular-nums; }
.solidary { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.375rem; flex-wrap: wrap; font-weight: 500; }
.solidary small { flex-basis: 100%; }
.discounts { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.discounts .chip { min-height: 2.75rem; padding: 0 0.875rem; font-size: .92rem; }
.totals { margin: 0; display: flex; flex-direction: column; gap: 0.25rem; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; gap: 0.75rem; }
.totals dt, .totals dd { margin: 0; }
.totals dd { text-align: right; }
.totals .grand { font-size: 1.4rem; font-weight: 800; padding-top: 0.375rem; border-top: 1px solid var(--border); }
.cart-secondary { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cart-secondary .btn { flex: 1 1 8.75rem; }
.cart-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 0.625rem; position: sticky; bottom: -1rem; margin: 0 -1rem -1rem; padding: 0.625rem 1rem 1rem; background: var(--surface); border-top: 1px solid var(--border); }
.cart-actions .btn { min-height: 3.25rem; }
.stack-toggle { display: flex; flex-direction: column; gap: 2px; padding: 0.5rem 0.75rem; border-radius: 0.75rem; border: 1px dashed var(--primary); }
.stack-toggle label { font-weight: 600; font-size: .95rem; }

/* Tablette / grand écran : panier fixe à droite */
@media (min-width: 760px) {
    .body { grid-template-columns: minmax(0, 1fr) clamp(20rem, 38vw, 23.75rem); }
    .cart { display: flex; }
    .catalog { padding-bottom: 1.5rem; }
}
/* Téléphone : le panier est un tiroir en bas, avec « Encaisser » toujours visible */
@media (max-width: 759px) {
    .cart { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; max-height: 88%; border-left: 0; border-top: 1px solid var(--border); border-radius: 1.25rem 1.25rem 0 0; box-shadow: 0 -0.25rem 1.25rem rgba(0,0,0,.18); padding-bottom: var(--safe-bottom); }
    .cart::before { content: ""; position: absolute; top: 0.375rem; left: 50%; width: 2.5rem; height: 0.25rem; margin-left: -1.25rem; border-radius: 2px; background: var(--border); }
    .cart-bar { display: flex; align-items: center; gap: 0.625rem; padding: 1rem 0.75rem 0.625rem; }
    .cart-toggle { flex: 1; min-width: 0; min-height: 3.5rem; display: flex; align-items: center; gap: 0.75rem; padding: 0 0.25rem; border: 0; background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
    .cart-toggle .count { position: relative; display: grid; place-items: center; }
    .cart-toggle .count b { position: absolute; top: -0.5rem; right: -0.75rem; min-width: 1.375rem; height: 1.375rem; padding: 0 0.375rem; border-radius: 62.4375rem; background: var(--primary); color: var(--on-primary); font-size: .8rem; display: grid; place-items: center; }
    .cart-toggle .total { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
    .cart-toggle .hint { margin-left: auto; color: var(--muted); font-size: .85rem; }
    .cart-pay { min-height: 3.5rem; padding: 0 1.5rem; font-size: 1.05rem; }
    .cart:not(.open) .cart-content { display: none; }
    .cart.open .cart-toggle .hint { visibility: hidden; }
    .cart-backdrop { display: block; position: fixed; inset: 0; z-index: 9; background: rgba(0,0,0,.4); cursor: pointer; touch-action: none; }
    .lines { flex: none; overflow: visible; min-height: 0; }
    .cart-actions { grid-template-columns: 1fr; }
    .cart-actions .btn-primary { display: none; }
    .toast { bottom: calc(6rem + var(--safe-bottom)) !important; }
}

/* ── Fenêtres ─────────────────────────────────────── */
/* L'overlay épouse la zone réellement visible (clavier iOS exclu, --vvh/--vvt posés par app.js). */
.overlay { cursor: pointer; position: fixed; left: 0; right: 0; top: var(--vvt, 0px); height: var(--vvh, 100%); background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 1rem; z-index: 20; }
.sheet { cursor: default; width: 100%; max-width: 28.75rem; max-height: 100%; display: flex; flex-direction: column; background: var(--bg); border-radius: var(--radius); padding: 0; overflow: hidden; }
.sheet.wide { max-width: 35rem; }
.sheet-head { flex: none; padding: 1.125rem 1.25rem 0.375rem; }
.sheet h2 { margin: 0; font-size: 1.2rem; }
.sheet-body { flex: 1; min-height: 0; padding: 0.5rem 1.25rem 0.75rem; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 0.75rem; }
.sheet-summary { flex: none; padding: 0.625rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface); }
.sheet-actions { flex: none; display: flex; gap: 0.5rem; flex-wrap: wrap; padding: 0.75rem 1.25rem calc(0.75rem + var(--safe-bottom)); border-top: 1px solid var(--border); background: var(--bg); }
.sheet-actions .btn { flex: 1 1 auto; min-width: 6.875rem; }
.sheet-actions .btn-primary { flex-grow: 2; }
.sheet-inner { display: contents; }
@media (max-width: 599px) {
    .overlay { align-items: flex-end; padding: 0; }
    .sheet, .sheet.wide { max-width: none; max-height: 96%; border-radius: 1.25rem 1.25rem 0 0; }
}
.results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.result { width: 100%; text-align: left; font: inherit; color: inherit; border: 1px solid var(--border); background: var(--surface); border-radius: 0.75rem; padding: 0.75rem 0.875rem; cursor: pointer; display: flex; flex-direction: column; gap: 2px; min-height: 3.5rem; }
.result:active { background: var(--border); }
.camera video { width: 100%; border-radius: 0.75rem; background: #000; aspect-ratio: 4 / 3; object-fit: cover; }
.menu-item { display: flex; align-items: center; gap: 0.875rem; width: 100%; min-height: 3.625rem; padding: 0 1rem; border: 1px solid var(--border); border-radius: 0.875rem; background: var(--surface); color: var(--text); font: inherit; font-weight: 600; text-align: left; cursor: pointer; }
.menu-item:active { background: var(--border); }
.menu-item:disabled { opacity: .5; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); z-index: 30; max-width: 90%; text-align: center; padding: 0.75rem 1.125rem; border-radius: 62.4375rem; background: var(--text); color: var(--bg); font-weight: 600; box-shadow: 0 0.25rem 1rem rgba(0,0,0,.25); }
.toast.bad { background: var(--error); color: #fff; }

/* ── Encaissement ─────────────────────────────────── */
.pay-total { margin: 0; font-size: 2.6rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; }
.change { margin: 0; text-align: center; font-size: 1.5rem; font-weight: 800; color: var(--primary); }
.center-text { text-align: center; margin: 0; }
.qr { width: min(17.5rem, 70vw); margin: 0 auto; background: #fff; padding: 0.5rem; border-radius: 0.75rem; }
.qr svg { width: 100%; height: auto; display: block; }
.success-mark { margin: 0; text-align: center; font-size: 2.2rem; font-weight: 800; color: var(--primary); }
.actions-inline { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.actions-inline .btn { flex: 1 1 auto; min-width: 6.875rem; min-height: 3.25rem; }
.actions-inline .btn-primary { flex-grow: 2; }
.pay-methods .btn { min-height: 3.5rem; font-size: 1.05rem; }
.cash-chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(6rem, 1fr)); gap: 0.5rem; }
.cash-chips .chip { min-height: 3.25rem; font-size: 1.05rem; }

/* Attente / ventes */
.held-row { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; }
li.held-row { padding: 0.5rem 0; border-bottom: 1px solid var(--border); }
li.held-row small { display: block; }

/* Comptage : une ligne par valeur (libellé à gauche, − 0 + à droite) */
.count-group h3 { margin: 0.5rem 0; font-size: 1rem; color: var(--muted); }
.count-grid { display: grid; grid-template-columns: 1fr; gap: 0.5rem; }
@media (min-width: 600px) { .count-grid { grid-template-columns: repeat(2, 1fr); } }
.count-cell { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.375rem 0.625rem; border: 1px solid var(--border); border-radius: 0.75rem; background: var(--surface); }
.count-label { font-weight: 700; }
.count-input { width: 4rem; text-align: center; padding: 0.375rem 0.25rem; -moz-appearance: textfield; appearance: textfield; }
.count-input::-webkit-inner-spin-button, .count-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
/* z-index : le comptage s'ouvre par-dessus l'ouverture / la clôture */
.overlay:has(.sheet.wide[aria-label="Comptage des espèces"]) { z-index: 25; }

/* ── Pavé numérique de montant (mode centimes) ────── */
.field { display: flex; flex-direction: column; gap: 0.375rem; }
.field-label { font-weight: 600; font-size: .9rem; }
.amount { display: flex; flex-direction: column; gap: 0.625rem; }
.amount-display { display: flex; align-items: center; gap: 0.5rem; min-height: 4rem; padding: 0.375rem 1rem 0.375rem 0.5rem; border: 2px solid var(--primary); border-radius: 0.875rem; background: var(--bg); font-variant-numeric: tabular-nums; }
.amount-value { flex: 1; text-align: right; font-size: 2rem; font-weight: 800; }
.amount-value.zero { color: var(--muted); }
.amount-unit { font-size: 1.4rem; font-weight: 700; color: var(--muted); }
.amount-clear { flex: none; min-height: 2.75rem; padding: 0 0.875rem; border: 0; border-radius: 62.4375rem; background: var(--surface); color: var(--text); font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
.numpad button { min-height: 3.5rem; border-radius: 0.875rem; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: 1.5rem; font-weight: 700; cursor: pointer; }
.numpad button:active { background: var(--border); }
@media (max-height: 700px) { .numpad button { min-height: 3rem; font-size: 1.3rem; } .amount-display { min-height: 3.5rem; } }

/* ── Menu (s'ouvre en haut, sous le bouton) ───────── */
.overlay.menu-overlay { align-items: flex-start; justify-content: flex-end; padding: calc(var(--safe-top) + 3.6rem) 0.75rem 0; }
.overlay.menu-overlay .sheet { max-width: 20rem; box-shadow: 0 0.5rem 2rem rgba(0,0,0,.3); }
.menu-user { margin: 0; padding: 0 0.25rem; }
.sheet-body > .menu-item { flex: none; }
@media (max-width: 599px) {
    .overlay.menu-overlay { padding: var(--safe-top) 0 0; }
    .overlay.menu-overlay .sheet { max-width: none; border-radius: 0 0 1.25rem 1.25rem; }
}

/* ── Pages (Ventes, Catalogue, Réductions) ────────── */
.page { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 0 0.75rem calc(1.5rem + var(--safe-bottom)); display: flex; flex-direction: column; gap: 0.75rem; }
.page-bar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0 0.4rem; background: var(--bg); }
.page-bar h2 { margin: 0; font-size: 1.2rem; }
.seg { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.seg.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -0.75rem; padding: 0 0.75rem 0.25rem; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.seg.scroll::-webkit-scrollbar { display: none; }
.summary-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: 0.5rem; }
.card-mini { padding: 0.6rem 0.8rem; border-radius: 0.85rem; background: var(--surface); }
.card-mini small { display: block; color: var(--muted); font-size: 0.8rem; }
.card-mini b { display: block; font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.row-wrap { display: flex; align-items: center; gap: 0.4rem; }
.row { flex: 1; min-width: 0; display: flex; align-items: center; gap: 0.75rem; width: 100%; padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: 0.85rem; background: var(--surface); color: inherit; font: inherit; text-align: left; min-height: 3.5rem; cursor: pointer; }
.row:active { background: var(--border); }
.row .main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.row .main strong { overflow-wrap: anywhere; }
.row .main small { overflow-wrap: anywhere; }
.row > strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.thumb-s { width: 2.75rem; height: 2.75rem; border-radius: 0.6rem; background: var(--border); overflow: hidden; flex: none; }
.thumb-s img, .thumb-l img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-l { width: 5rem; height: 5rem; border-radius: 0.8rem; background: var(--border); overflow: hidden; flex: none; }
.photo-row { display: flex; align-items: center; gap: 0.75rem; }
.tags { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 62.4375rem; font-size: 0.72rem; font-weight: 700; background: var(--border); color: var(--text); }
.tag.warn { background: var(--error-bg); color: var(--error); }
.move { display: flex; flex-direction: column; gap: 0.25rem; }
.cat-tools { display: flex; align-items: center; gap: 0.5rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.stock-qty { justify-content: center; }
.btn.danger { color: var(--error); border-color: var(--error); }
.pick-list { list-style: none; margin: 0; padding: 0; max-height: 14rem; overflow-y: auto; border: 1px solid var(--border); border-radius: 0.75rem; }
.pick-list li { border-bottom: 1px solid var(--border); padding: 0 0.6rem; }
.pick-list li:last-child { border-bottom: 0; }

/* Les éléments d'une page ne rétrécissent jamais : sinon, avec beaucoup de lignes, la rangée des catégories
   (qui défile en horizontal) était écrasée « derrière » la liste. */
.page > * { flex: none; }
.page-head { position: sticky; top: 0; z-index: 3; background: var(--bg); margin: 0 -0.75rem; padding: 0 0.75rem 0.4rem; }
.page-head .page-bar { position: static; padding-bottom: 0.4rem; }
.filter-row { flex-direction: row; align-items: center; gap: 0.75rem; min-height: 2.75rem; font-weight: 600; }

/* Paiement HelloAsso en attente : petit témoin qui pulse tant que la vérification tourne */
.hello-status .dot { display: inline-block; width: 0.6rem; height: 0.6rem; margin-right: 0.35rem; border-radius: 50%; background: var(--primary); animation: pulse 1.2s ease-in-out infinite; }
.hello-status .dot.off { background: var(--error); animation: none; }
@keyframes pulse { 50% { opacity: .25; } }
.center-spinner { align-self: center; }
