/* Pacific Caisse (habillage Pacific Studio, depuis la 4.27.0) — chargé APRÈS app.css, responsive.css et design.css.
   Même univers que la plateforme (fond sable, encre, Geist et Instrument Serif), menu sombre,
   aucun accent vert : l'accent est l'encre. Les couleurs d'état (rupture, alerte, erreur) restent.
   Retirer ce fichier de index.php et offline.html rend l'apparence 4.26 à l'identique. */

@font-face { font-family: "Geist"; src: url("../fonts/geist-latin.woff2") format("woff2"); font-weight: 300 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Instrument Serif"; src: url("../fonts/instrument-serif-italic-latin.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }

/* ---------- 1. Jetons ---------- */
:root {
  --ink: #141413;
  --ink-2: #3C3B38;
  --muted: #6F6C65;
  --faint: #A9A59D;
  --line: #E7E4DD;
  --line-soft: #EFECE6;
  --line-strong: #D9D5CC;
  --canvas: #F4F2EE;
  --panel: #FFFFFF;
  --panel-soft: #FAF9F6;
  --panel-sunk: #F2F0EB;
  --strong: #141413;
  --strong-hover: #2E2D2A;
  --strong-text: #FFFFFF;
  --sidebar: #0F1313;
  --sidebar-line: #262A2A;
  --radius: 16px;
  --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-serif: "Instrument Serif", ui-serif, Georgia, serif;
  --ps-shadow-1: 0 1px 2px rgba(30, 24, 12, .04), 0 2px 10px -4px rgba(30, 24, 12, .06);
  --ps-shadow-2: 0 1px 2px rgba(30, 24, 12, .04), 0 16px 34px -14px rgba(30, 24, 12, .16);
  --ps-ring: 0 0 0 4px rgba(20, 20, 19, .08);
  /* Pas de vert : « en stock », « à jour », « ouverte » passent à l'encre sur fond sable. */
  --green: #2E2D2A;
  --green-soft: #ECE9E3;
}
:root[data-theme="dark"] {
  --green: #E4E1DA;
  --green-soft: #24292A;
  --ink: #F1F0EC;
  --ink-2: #CDCBC5;
  --muted: #9A978F;
  --faint: #5E5C57;
  --line: #2A2E2E;
  --line-soft: #222626;
  --line-strong: #383D3D;
  --canvas: #0B0C0C;
  --panel: #141616;
  --panel-soft: #181B1B;
  --panel-sunk: #1E2222;
  --strong: #F1F0EC;
  --strong-hover: #FFFFFF;
  --strong-text: #111211;
  --sidebar: #070909;
  --sidebar-line: #1C2020;
  --ps-ring: 0 0 0 4px rgba(241, 240, 236, .12);
}

body { font-family: var(--font-sans); background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }

/* ---------- 2. Démarrage et connexion ---------- */
.boot-screen { background: var(--canvas); }
.boot-screen img { width: min(300px, 62vw); }
.auth-page { background: var(--canvas); }
.auth-brand { background: #0F1313; }
.auth-brand::after { border-color: rgba(243, 241, 236, .07); }
.auth-brand img { filter: none; width: min(300px, 78%); }
.auth-promise h2, .subscription-page .auth-promise h2 { font-family: var(--font-serif); font-style: italic; font-weight: 400; letter-spacing: -.01em; }
.auth-promise p { color: #C9C6BF; }
.auth-features span { color: #E4E1DA; }
.auth-features i { background: #F3F1EC; }
.brand-overline { color: #A9A59D; }
.auth-card h1 { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: 40px; letter-spacing: -.01em; }
.auth-card .eyebrow { letter-spacing: .18em; }
.auth-mobile-logo img { width: 190px; }

/* ---------- 3. Menu (sombre) ---------- */
.sidebar { background: var(--sidebar); border-right-color: var(--sidebar-line); }
/* Logo complet Pacific Studio.dev, nom du produit en dessous. */
.sidebar-logo.ps-brand { display: flex; flex-direction: column; align-items: flex-start; gap: 9px; padding: 8px 10px 20px; margin-bottom: 8px; border-bottom: 1px solid var(--sidebar-line); }
.sidebar-logo.ps-brand img { width: 164px; max-width: 100%; height: auto; filter: none; }
.sidebar-logo.ps-brand small { color: #A9A59D; font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.nav-button { color: #B9B6AF; font-weight: 550; border-radius: 12px; min-height: 46px; }
.nav-button:hover { color: #FFFFFF; background: rgba(243, 241, 236, .06); }
.nav-button.active { color: #FFFFFF; background: #262B2B; font-weight: 650; }
.nav-button .count { background: #F3F1EC; color: #141413; }
.workspace-card { border-color: #2C3131; background: #161B1B; border-radius: 14px; padding: 13px 14px; }
.workspace-card:hover { border-color: #3A4040; background: #1B2121; }
.workspace-label { color: #A9A59D; letter-spacing: .14em; }
.workspace-action { color: #D9D5CC; }
.user-chip .avatar { background: #F3F1EC; color: #141413; }
.user-chip small { color: #A9A59D; }

/* En-tête du téléphone : logo Pacific Studio.dev, nom du commerce. */
.mobile-header img.ps-mobile-logo { width: 104px; max-width: 34vw; height: auto; flex: none; }

/* ---------- 4. Pages ---------- */
.app-main { background: var(--canvas); }
.page-head { border: 0; background: transparent; box-shadow: none; padding: 4px 0 2px; align-items: flex-end; }
.page-head h1 { font-family: var(--font-serif); font-style: italic; font-weight: 400; font-size: clamp(32px, 3vw, 44px); letter-spacing: -.01em; line-height: 1.02; }
.page-head p { color: var(--muted); font-size: 13px; }
.panel, .catalog-panel, .ticket-panel, .entity-card, .stat, .management-kpi { border-color: var(--line); border-radius: 20px; box-shadow: var(--ps-shadow-1); }
.ticket-panel { box-shadow: var(--ps-shadow-2); }
.session-pill.open { background: var(--panel-sunk); color: var(--ink); }
.management-tabs { border-radius: 14px; border-color: var(--line); }
.management-tabs button.active { background: var(--strong); color: var(--strong-text); }
.data-table th { background: var(--panel-soft); color: var(--muted); font-weight: 600; }
.table-wrap { border-color: var(--line); border-radius: 14px; }

/* ---------- 5. Caisse ---------- */
.scanner-box { border: 1.5px solid var(--ink); border-radius: 16px; min-height: 58px; box-shadow: var(--ps-ring); }
.scanner-box input { font-size: 16px; text-overflow: ellipsis; }
.scanner-box.reading { box-shadow: 0 0 0 5px rgba(20, 20, 19, .10); }
.scanner-state { background: var(--panel-sunk); color: var(--ink-2); border-radius: 10px; letter-spacing: .08em; }
.scanner-state i { background: var(--ink); }
.chip { min-height: 40px; padding: 0 16px; border-color: var(--line); background: var(--panel); color: var(--ink-2); font-weight: 550; }
.chip:hover { border-color: var(--line-strong); }
.chip.active { background: var(--strong); border-color: var(--strong); color: var(--strong-text); }
.product-card { border-color: var(--line); border-radius: 16px; padding: 14px; box-shadow: 0 1px 2px rgba(30, 24, 12, .04); }
.product-card:hover { border-color: var(--line-strong); box-shadow: var(--ps-shadow-2); transform: translateY(-1px); }
.product-card h3 { font-weight: 600; letter-spacing: -.005em; }
.product-mark { border-radius: 12px; }
.product-price { font-variant-numeric: tabular-nums; }

/* ---------- 6. Boutons ---------- */
.button { border-radius: 12px; min-height: 44px; font-weight: 650; letter-spacing: -.005em; }
.button.primary { background: var(--strong); color: var(--strong-text); }
.button.primary:hover { background: var(--strong-hover); }
.button.secondary { background: var(--panel); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.button.secondary:hover { background: var(--panel-soft); }
:root[data-theme="dark"] .button.secondary { background: var(--panel-soft); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.icon-button { border-radius: 11px; }

/* ---------- 7. Fenêtres et formulaires organisés ---------- */
.modal-backdrop { background: rgba(15, 19, 19, .55); }
.modal { border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 40px 90px -24px rgba(30, 24, 12, .38), 0 10px 24px -10px rgba(30, 24, 12, .14); }
.modal-head { padding: 20px 24px 18px; align-items: center; }
.modal-head h2 { font-size: 20px; font-weight: 650; letter-spacing: -.015em; }
.modal-head p { font-size: 12.5px; margin-top: 2px; }
.modal-body { padding: 20px 24px; }
.modal-body:has(.form-section) { background: var(--panel-soft); }
.modal-actions { position: sticky; bottom: 0; z-index: 2; padding: 14px 24px; background: var(--panel); border-top-color: var(--line); }

/* Un bloc = une carte titrée ; les champs vont par deux sur grand écran. */
.form-section { padding: 16px 18px 4px; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.form-section:last-child { padding-bottom: 4px; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.form-section-head { margin: 0 0 14px; }
.form-section-head strong { font-size: 14px; font-weight: 650; color: var(--ink); letter-spacing: -.005em; }
.form-section-head small { margin-top: 3px; font-size: 12px; line-height: 1.45; color: var(--muted); }
.form-grid { gap: 0 16px; }
.field { gap: 6px; margin-bottom: 14px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, .field textarea, .input { min-height: 46px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--panel); font-size: 15px; font-weight: 450; color: var(--ink); }
.field textarea { padding-top: 12px; }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--ink); box-shadow: var(--ps-ring); }
.field input:disabled, .field select:disabled { background: var(--panel-sunk); color: var(--muted); }
.field-note { font-size: 11.5px; font-weight: 450; line-height: 1.45; color: var(--muted); }
.field > small { font-size: 11px; font-weight: 450; }
.form-aside { margin: 0 0 12px; padding: 12px 14px; border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--panel); }
.checkbox-field.option-card { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); cursor: pointer; }
.checkbox-field.option-card input { width: 20px; height: 20px; min-height: 0; margin: 1px 0 0; accent-color: var(--ink); flex: none; }
.checkbox-field.option-card b, .checkbox-field.option-card small { display: block; }
.checkbox-field.option-card b { font-size: 14px; font-weight: 600; color: var(--ink); }
.checkbox-field.option-card small { margin-top: 2px; font-size: 12px; font-weight: 450; color: var(--muted); }
.switch-label input, .module-selector input[type=checkbox], .business-type input, .prep-option input { accent-color: var(--ink); }
.account-active { align-self: center; margin-bottom: 14px; font-size: 13px; color: var(--ink-2); }
.organized-form .auth-error:not(.hidden) { margin-top: 12px; }
.permission-grid { border-radius: 14px; }
.product-image-uploader { border-radius: 14px; }

/* Les verts écrits en dur dans app.css et design.css passent eux aussi à l'encre. */
.tax-checklist li.done, .agent-status.ok { border-color: var(--line-strong); background: var(--panel-sunk); }
.subscription-badge.ok, .line-discount-tag { background: var(--green-soft); color: var(--green); }
.paywall-features li::before { border-color: var(--ink); }
.kb-ok { background: var(--strong); color: var(--strong-text); }
.kb-display.kb-fresh { color: #F3F1EC; }
.rest-order.rest-done { border-color: var(--line-strong); }
.receive-result.is-set { color: var(--ink); }

/* ---------- 8. Téléphone ---------- */
/* Sous 900 px, le menu devient la barre du bas (app.css) : le bloc de marque y reste masqué. */
@media (max-width: 900px) {
  .sidebar-logo.ps-brand { display: none; }
  .nav-button.active { background: #262B2B; }
}
@media (max-width: 760px) {
  .modal-backdrop { align-items: end; padding-bottom: 0; }
  .modal { border-radius: 22px 22px 0 0; }
  .modal-head { padding-inline: 16px; }
  .modal-body { padding: 16px; }
  .modal-actions { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .form-section { padding: 14px 14px 2px; }
  .page-head h1 { font-size: 32px; }
}
@media (prefers-reduced-motion: reduce) { .product-card:hover { transform: none; } }

/* ---------- 9. Toutes les tailles : fenêtres ---------- */
/* Montants proposés à l'encaissement : autant par ligne que la place le permet (trois sur téléphone au lieu de deux). */
.amount-presets { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
/* Cases à cocher simples dans une fenêtre (Imprimante, Taux de TVA) : la case à côté de son texte, pas un grand carré vide au-dessus. */
.modal .field.checkbox-field:not(.option-card) { display: flex; align-items: center; gap: 10px; }
.modal .field.checkbox-field:not(.option-card) input { flex: none; width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--ink); }
/* Imprimante : la fenêtre ne dépasse pas 560 px, une colonne partout (les choix des listes étaient coupés) ; titre,
 * contenu et pied sur les mêmes marges de 16 px (les blocs dépassaient de 8 px l'alignement de la croix et des boutons). */
#printerSettingsForm .form-grid { grid-template-columns: minmax(0, 1fr); }
#printerSettingsForm .form-grid .wide { grid-column: auto; }
.modal:has(#printerSettingsForm) > :is(.modal-head, .modal-body, .modal-actions) { padding-inline: 16px; }
#printerSettingsForm .form-section { padding-inline: 14px; }
/* Au doigt : boutons de 44 px dans les fenêtres de vente et les Réglages. */
@media (pointer: coarse) {
  .payment-mode button, .amount-presets button, .settings-tabs button, .settings-check, .modal .field.checkbox-field:not(.option-card) { min-height: 44px; }
  .amount-presets button { font-size: 14px; }
}
/* Écran bas (tablette en paysage 960 × 528, téléphone couché) : la fenêtre devient une feuille collée en bas, en-tête
 * et pied resserrés, sous-titre à côté du titre. Les règles du clavier tactile (.kb-open, plus précises) restent prioritaires. */
@media (max-height: 600px) {
  .modal-backdrop { align-items: end; padding: max(6px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left)); }
  .modal { max-height: calc(100vh - max(6px, env(safe-area-inset-top))); max-height: calc(100dvh - max(6px, env(safe-area-inset-top))); border-radius: 22px 22px 0 0; }
  .kb-open .modal { border-radius: 22px; }
  .modal-head { padding: 8px 16px; }
  .modal-head > div { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; min-width: 0; }
  .modal-head h2 { font-size: 17px; }
  .modal-body { padding: 12px 16px; }
  .modal-actions { padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); }
  .payment-total { margin-bottom: 10px; padding: 10px 14px; }
  .payment-total strong { font-size: 22px; }
  .credit-pay { margin: 10px 0; padding: 8px 10px; }
  .choice { min-height: 0; padding: 8px 10px; }
  .choice strong { margin-top: 4px; }
}
/* Encaissement sur écran bas et téléphone : tuiles des moyens de paiement compactes, pictogramme à gauche, nom et
 * indication à droite (≈ 55 px au lieu de 99, rien de retiré). Seules les tuiles-boutons de l'encaissement sont visées. */
@media (max-height: 760px), (max-width: 660px) {
  .choice-grid > button.choice { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 8px; min-height: 0; padding: 9px 10px; }
  .choice-grid > button.choice > .icon { grid-row: span 2; }
  .choice-grid > button.choice strong { margin-top: 0; }
}
/* Encaissement en espèces sur un écran couché pas assez haut pour la fenêtre d'une colonne (≈ 870 px à la souris, 890 au
 * doigt, plus la marge) : tablettes 960 × 528 et 853 × 533, portables 1440 × 900 et 1536 × 864, caisses 1366 × 768 et
 * 1024 × 768, appli Windows 1050 × 700. Fenêtre élargie en deux colonnes, le total, le bon et les moyens à gauche,
 * « Montant reçu », les montants et la monnaie à rendre à droite, tout visible sans défiler. Colonnes CSS : l'ordre du
 * code est gardé, la colonne de droite commence à l'arrondi s'il y en a un, sinon à « Montant reçu ». Pas avec le
 * clavier intégré de la caisse ouvert sur le côté (.kb-open) : la place manque, la fenêtre reste sur une colonne.
 * Dès 840 px (« Carte bancaire » tient sur une ligne dans sa tuile) et en paysage seulement : une tablette en portrait
 * ne bascule pas quand le clavier Android abaisse la page. */
@media (min-width: 840px) and (max-height: 940px) and (orientation: landscape) {
  :root:not(.kb-open) .modal:has(#amountReceived) { width: min(880px, 100%); }
  :root:not(.kb-open) .modal:has(#amountReceived) .modal-body { columns: 2; column-gap: 24px; }
  :root:not(.kb-open) .modal:has(#amountReceived) .modal-body > * { break-inside: avoid; }
  :root:not(.kb-open) .modal-body > label.field:has(> #amountReceived):not(.total-row.grand + label),
  :root:not(.kb-open) .modal-body > .total-row:has(+ .total-row.grand + label.field > #amountReceived) { break-before: column; margin-top: 0 !important; }
  :root:not(.kb-open) .modal:has(#amountReceived) .choice-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  :root:not(.kb-open) .modal:has(#amountReceived) .choice-grid:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  :root:not(.kb-open) .modal:has(#amountReceived) .choice-grid > button.choice { display: block; min-height: 0; padding: 8px 10px; line-height: 1.25; }
  :root:not(.kb-open) .modal:has(#amountReceived) .choice-grid > button.choice > .icon { display: block; margin-bottom: 4px; }
  :root:not(.kb-open) .modal:has(#amountReceived) .choice-grid > button.choice strong { margin-top: 0; }
  :root:not(.kb-open) .modal:has(#amountReceived) .choice-grid > button.choice small { display: block; }
}
@media (min-width: 840px) and (max-height: 600px) {
  :root:not(.kb-open) .modal:has(#amountReceived) .payment-total { margin-bottom: 8px; padding-block: 6px; }
  :root:not(.kb-open) .modal:has(#amountReceived) .credit-pay { margin-block: 8px; padding-block: 6px; }
  :root:not(.kb-open) .modal:has(#amountReceived) .credit-pay-head { margin-bottom: 4px; }
  :root:not(.kb-open) .modal:has(#amountReceived) .payment-mode { margin-bottom: 10px; }
}
/* Feuille sur toute la largeur jusqu'à 660 px (petite tablette en portrait comprise). */
@media (max-width: 660px) {
  .modal { width: 100%; }
}
/* Petit téléphone : « Paiement multiple » sur une ligne, code du bon lisible en entier, quatre montants en 2 × 2. */
@media (max-width: 430px) {
  .payment-mode button { padding-inline: 6px; font-size: 13px; }
  .credit-pay-input input { letter-spacing: 0; padding-inline: 10px; }
  .credit-pay-input .button { padding-inline: 12px; }
  .amount-presets:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* À la souris : barre de défilement fine dans les fenêtres (la barre classique rendait carrés leurs coins de droite). */
@media (pointer: fine) {
  .modal { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
}
/* Pictogramme d'un bouton : jamais écrasé quand le libellé passe sur deux lignes (« Effacer ses données »). */
.button > .icon { flex: none; }

/* ---------- 10. Toutes les tailles : pages ---------- */
/* Écran bas (portable de 650 à 760 px de haut, tablette en paysage) : en-tête de page resserré, les données d'abord. */
@media (min-width: 901px) and (max-height: 760px) {
  .app-main { padding-top: 16px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 30px; }
}
/* Très bas (tablette 960 × 528, téléphone couché) : titre plus petit, sous-titre des en-têtes de page masqué (le compteur
 * « n en cours » de la cuisine, dans un div.page-head, reste), chiffres resserrés. Aucun chiffre n'est retiré. */
@media (max-height: 620px) {
  .app-main { padding-top: 12px; }
  .page-head { align-items: center; margin-bottom: 10px; }
  .page-head h1 { font-size: 24px; }
  header.page-head > div > p { display: none; }
  .rest-sync { margin: 2px 0 8px; }
  .stats { gap: 8px; margin-bottom: 10px; }
  .stat { padding: 9px 12px; }
  .stat strong { margin-top: 2px; font-size: 17px; }
  /* Cuisine : sous-titre fixe masqué, cartes resserrées (environ 45 px de moins chacune) ; les boutons gardent leur taille. */
  .rest-subtitle { display: none; }
  .rest-order { padding: 10px 12px; margin-bottom: 8px; }
  .rest-order h3 { margin: 6px 0 2px; }
  .rest-order ul { margin: 8px 0; }
  .rest-order li { margin: 4px 0; }
  .rest-card-actions { margin-top: 8px; gap: 6px; }
}
/* Ventes sur écran bas : les chiffres du jour sur une rangée, le tableau des ventes remonte. */
@media (min-width: 661px) and (max-height: 620px) {
  .page-head + .stats { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
}

/* Gestion, écran bas : onglets, en-têtes de section et cases de chiffres resserrés (rien n'est caché). */
@media (max-height: 760px) {
  .management-tabs { margin-bottom: 10px; }
  .management-section-hero { margin-bottom: 12px; padding: 12px 16px; }
  .management-section-hero .eyebrow { margin-bottom: 4px; }
  .management-kpi-grid, .management-kpi-grid.compact { margin-bottom: 12px; }
  .management-kpi { min-height: 0; padding: 11px 13px; }
}
/* Tablette tactile basse : les onglets de Gestion sur une rangée qui défile au doigt (shell.js amène l'onglet actif au
 * milieu). À la souris, ils restent sur plusieurs rangées, faute de barre de défilement ; dès 1200 px de large aussi
 * (deux rangées montrent tout), sauf sur un écran très bas. */
@media (pointer: coarse) and (min-width: 900px) and (max-width: 1199px) and (max-height: 760px), (pointer: coarse) and (min-width: 900px) and (max-height: 620px) {
  .management-tabs { flex-wrap: nowrap; overflow-x: auto; }
}
@media (pointer: coarse) {
  .management-tabs button { min-height: 44px; }
}
/* Rangée qui défile de côté (onglets de Gestion et du stock, boutons et filtres du stock ; classes posées par shell.js
 * selon la position) : un fondu annonce ce qui est caché à droite, à gauche ou des deux côtés ; au bout, aucun. Les
 * gros boutons du stock ont un fondu plus long, pour que le dernier visible pâlisse nettement. */
.inventory-tabs, .inventory-actions, .inventory-filters { position: relative; }
.management-tabs.suite-droite, .inventory-tabs.suite-droite, .inventory-filters.suite-droite { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent); }
.management-tabs.suite-gauche, .inventory-tabs.suite-gauche, .inventory-actions.suite-gauche, .inventory-filters.suite-gauche { -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px); mask-image: linear-gradient(90deg, transparent, #000 24px); }
.management-tabs.suite-gauche.suite-droite, .inventory-tabs.suite-gauche.suite-droite, .inventory-filters.suite-gauche.suite-droite { -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 24px), transparent); }
.inventory-actions.suite-droite { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 48px), transparent); }
.inventory-actions.suite-gauche.suite-droite { -webkit-mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 48px), transparent); mask-image: linear-gradient(90deg, transparent, #000 24px, #000 calc(100% - 48px), transparent); }
/* Puces de période (Statistiques, Collaborateurs, Exports, type de carte à l'encaissement) : à la ligne plutôt que hors champ. */
.period-buttons, .custom-period { flex-wrap: wrap; }
/* Gestion sur téléphone : les boutons d'un en-tête de section (Collaborateurs, Bons & avoirs…) se partagent une rangée
 * quand ils tiennent, au lieu d'une rangée chacun. */
@media (max-width: 760px) {
  .management-section-hero .row-actions .button { flex: 1 1 auto; width: auto; }
}
/* Exports : autant de colonnes que la place le permet (une sur téléphone, jusqu'à sept sur grand écran) ; marges des
 * boutons réduites pour que « Mouvements d'espèces » tienne sur une ligne. */
.export-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); }
.export-grid .button { padding-inline: 8px; }
/* Abonnements : les boutons passent sous le texte de l'espace quand les deux ne tiennent pas côte à côte. */
.subscription-row { flex-wrap: wrap; }
/* Gestion : une note placée sous un tableau (Bons & avoirs, Collaborateurs, Statistiques › Rentabilité) ne colle plus à
 * sa bordure ; passe devant .panel > p. */
.management-panel > .table-wrap + p { margin-top: 12px; }
/* Cases de chiffres de 561 à 980 px : trois par rangée quand elles tiennent, au lieu de deux imposées. */
@media (min-width: 561px) and (max-width: 980px) {
  .management-kpi-grid.compact { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}
/* Pas de case de chiffres seule sous les autres. Grille = largeur − 78 px sans menu (≤ 900 px), − 158 px avec le rail,
 * − 322 px menu déplié. 4 cases : 2 + 2 tant qu'elles ne tiennent pas sur une rangée (4 × 180 + 3 × 11 = 753 px) ;
 * 5 cases : 3 + 2 tant qu'elles ne tiennent pas (5 × 170 + 4 × 11 = 894 px). */
@media (min-width: 561px) and (max-width: 830px) {
  .management-kpi-grid.compact:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 831px) and (max-width: 1066px) {
  .management-kpi-grid.compact:has(> :nth-child(5):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 901px) and (max-width: 1034px) {
  .app-shell:not(.sidebar-collapsed) .management-kpi-grid.compact:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Tableaux de 761 à 1100 px (Gestion, stock) : ils se resserrent au lieu de cacher leur dernière colonne (Modifier,
 * « À reverser »), comme dans l'application Windows. */
@media (min-width: 761px) and (max-width: 1100px) {
  .management-panel .data-table, .inventory-stock-panel .data-table { min-width: 0; }
  .management-panel .data-table th, .management-panel .data-table td, .inventory-stock-panel .data-table th, .inventory-stock-panel .data-table td { padding-inline: 10px; }
  .management-contact-table td:nth-child(2) strong { overflow-wrap: anywhere; }
}
/* Équipe : une fiche par compte jusqu'à 1100 px (nom, n°, rôle et statut, puis la connexion, puis tous les boutons). */
.data-table.users-table { min-width: 0; }
.users-table .row-actions { flex-wrap: wrap; justify-content: flex-start; }
@media (max-width: 1100px) {
  .data-table.users-table, .users-table tbody { display: block; }
  .users-table thead { display: none; }
  .users-table tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  .users-table tr:last-child { border-bottom: 0; }
  .data-table.users-table td { padding: 0; border: 0; }
  /* Libellé tiré du title de la cellule, que la traduction thaïe des pages traduit (un texte écrit ici ne le serait pas). */
  .users-table td:nth-child(5)::before { content: attr(title) "\00a0: "; color: var(--muted); }
  .users-table td:nth-child(5), .users-table td:last-child { flex: 1 0 100%; }
}
/* Journaux d'audit et des abonnements : resserrés dès 761 px (celui des abonnements n'est pas dans un .management-panel) ;
 * sur téléphone, une fiche par ligne : date, auteur, action ou espace, puis le texte entier, puis l'IP. */
.data-table.log-table { min-width: 0; }
@media (max-width: 760px) {
  .data-table.log-table, .log-table tbody { display: block; }
  .log-table thead { display: none; }
  .log-table tr { display: flex; flex-wrap: wrap; gap: 4px 12px; padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
  .log-table tr:last-child { border-bottom: 0; }
  .data-table.log-table td { padding: 0; border: 0; overflow-wrap: anywhere; }
  .log-table td:nth-child(4), .log-table td[colspan] { flex: 1 0 100%; }
  /* L'IP n'existe que pour le propriétaire : son en-tête, masqué ici, portait le cadre vert de la vue propriétaire. */
  .log-table td.mono { padding: 2px 6px; white-space: normal; outline: 2px solid #22c55e; outline-offset: -2px; }
}
/* Bons & avoirs, Collaborateurs : sur téléphone, une fiche par ligne (et une pour le total) au lieu d'un tableau de
 * 760 px qui défile de côté. Libellés posés par position : le HTML des cellules ne change pas (les tests le comparent) ;
 * en thaï, :lang(th) reprend les traductions des en-têtes (i18n-th-pages.js), car la page ne traduit pas un texte écrit
 * ici. Les lignes restent cliquables (data-action est sur le tr). */
@media (max-width: 760px) {
  .data-table.stack-table, .stack-table tbody, .stack-table tfoot { display: block; min-width: 0; }
  .stack-table thead { display: none; }
  .stack-table tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); }
  .stack-table tbody tr:last-child, .stack-table tfoot tr { border-bottom: 0; }
  .stack-table tfoot tr { border-top: 1px solid var(--line); background: var(--panel-soft); }
  .data-table.stack-table td { min-width: 0; padding: 0; border: 0; background: none; }
  .stack-table td:first-child, .stack-table td[colspan] { grid-column: 1 / -1; }
  .stack-table td:not(:first-child)::before { display: block; margin-bottom: 2px; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
  .collab-table td:nth-child(2)::before { content: "Encaissé"; }
  .collab-table td:nth-child(3)::before { content: "Net TPE"; }
  .collab-table td:nth-child(4)::before { content: "Net espèce"; }
  .collab-table td:nth-child(5)::before { content: "Commission"; }
  .collab-table td:nth-child(6)::before { content: "Loyer"; }
  .collab-table td:nth-child(7)::before { content: "À reverser"; }
  .credit-table td:nth-child(2)::before { content: "Porteur"; }
  .credit-table td:nth-child(3)::before { content: "Solde"; }
  .credit-table td:nth-child(4)::before { content: "État"; }
  .credit-table td:nth-child(5)::before { content: "Validité"; }
  .credit-table td:nth-child(6)::before { content: "Émis le"; }
  .collab-table td:nth-child(2):lang(th)::before { content: "เก็บเงินแล้ว"; }
  .collab-table td:nth-child(3):lang(th)::before { content: "สุทธิบัตร"; }
  .collab-table td:nth-child(4):lang(th)::before { content: "สุทธิเงินสด"; }
  .collab-table td:nth-child(5):lang(th)::before { content: "ค่าคอมมิชชัน"; }
  .collab-table td:nth-child(6):lang(th)::before { content: "ค่าเช่า"; }
  .collab-table td:nth-child(7):lang(th)::before { content: "ต้องจ่ายคืน"; }
  .credit-table td:nth-child(2):lang(th)::before { content: "ผู้ถือ"; }
  .credit-table td:nth-child(3):lang(th)::before { content: "ยอดคงเหลือ"; }
  .credit-table td:nth-child(4):lang(th)::before { content: "สถานะ"; }
  .credit-table td:nth-child(5):lang(th)::before { content: "ใช้ได้ถึง"; }
  .credit-table td:nth-child(6):lang(th)::before { content: "ออกเมื่อ"; }
}

/* Articles : chiffres sur une rangée de petites cases quand la place ou la hauteur manque (la revue d'inventaire,
 * .compact, garde les siennes). */
@media (max-width: 1100px), (max-height: 760px) {
  .inventory-stats:not(.compact) { display: flex; flex-wrap: wrap; gap: 8px; }
  .inventory-stats:not(.compact) article { flex: 1 1 0; min-width: max-content; padding: 10px 12px; }
  .inventory-stats:not(.compact) article > strong { font-size: 19px; white-space: nowrap; overflow-wrap: normal; }
}
/* Leur légende (« au prix d'achat »…) ne s'efface qu'en largeur étroite ou sur écran très bas. */
@media (max-width: 1100px), (max-height: 620px) {
  .inventory-stats:not(.compact) article > small { display: none; }
}
/* Recherche d'article : tout le champ de 44 px réagit au toucher, pas seulement une bande de 22 px ; son indication
 * finit par « … » quand le champ est étroit, comme celle des Ventes, au lieu d'être coupée en plein mot. */
.inventory-search input { align-self: stretch; text-overflow: ellipsis; }
/* Écran bas : boutons d'action du stock un peu plus serrés (six sur une rangée dès ≈ 940 px de panneau) ; la recherche
 * garde sa ligne plutôt que d'être coincée à côté d'eux. */
@media (min-width: 661px) and (max-height: 760px) {
  .inventory-search { min-width: min(100%, 360px); }
  .inventory-actions { gap: 6px; }
  .inventory-actions .button { min-height: 40px; padding-inline: 12px; }
}
/* Téléphone, et tablette tactile sur un écran bas : les boutons d'action du stock sur une rangée qui défile au doigt,
 * « Nouvel article » en premier, « Importer le menu » (import CSV/XLSX, rare) en dernier (sur deux rangées, ils
 * repoussaient la liste des articles sous le bord). */
@media (max-width: 660px), (pointer: coarse) and (max-height: 760px) {
  .inventory-actions { display: flex; flex-wrap: nowrap; gap: 6px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; }
  .inventory-actions .button { flex: 0 0 auto; width: auto; white-space: nowrap; }
  .inventory-actions .button[data-action=new-product] { order: -1; }
  .inventory-actions .button[data-action=import-products] { order: 1; }
}

/* Cuisine : les colonnes restent côte à côte et défilent de côté, « Prête » et « Servie, à encaisser » ne passent plus
 * sous toute la colonne « À préparer ». 158 px au moins : quatre colonnes tiennent dès 680 px utiles (téléphone couché
 * 740, 960 menu déplié) ; marges de côté réduites pour garder 118 px par carte (« Bon cuisine » sur une ligne). */
@media (max-width: 1250px) {
  .rest-board { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(max(158px, calc((100% - 48px) / 4)), 1fr); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: 4px; }
  .rest-column { scroll-snap-align: start; padding-inline: 8px; }
  .rest-order { padding-inline: 10px; }
}
@media (max-width: 1500px) {
  .rest-board.rest-board-five { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(max(158px, calc((100% - 64px) / 5)), 1fr); overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding-bottom: 4px; }
}
/* Téléphone : une colonne à la fois (85 %). De 481 à 650 px (petite tablette en portrait), la règle ci-dessus montre
 * trois colonnes de 158 px et le début de la quatrième. */
@media (max-width: 480px) {
  .rest-board, .rest-board.rest-board-five { grid-auto-columns: 85%; }
}
/* En-tête de la cuisine : ses boutons groupés à droite, sur une ligne ; ils passent sous le titre quand il manquerait de place. */
.page-head > .rest-toolbar { padding: 0; justify-content: flex-end; }
@media (min-width: 700px) {
  .page-head > .rest-toolbar { flex-shrink: 0; flex-wrap: nowrap; margin-left: auto; }
  .page-head > .rest-toolbar .button { white-space: nowrap; }
  .page-head:has(> .rest-toolbar) { flex-wrap: wrap; }
  .page-head:has(> .rest-toolbar) > div:first-child { flex: 1 1 180px; }
}

/* Ventes : recherche sur une ligne dès 661 px ; de 641 à 1180 px, le tableau se resserre au lieu de couper Statut et Total. */
@media (min-width: 661px) {
  .sales-search .field { flex-basis: 150px; }
  .sales-search .field:first-of-type { flex-basis: 200px; }
}
/* Tablette en portrait assez haute : la recherche reprend sa ligne, son indication se lit en entier. */
@media (min-width: 661px) and (max-width: 900px) and (min-height: 621px) {
  .sales-search .field:first-of-type { flex-basis: 100%; }
}
.sales-search input[type=search] { text-overflow: ellipsis; }
/* Le n° de ticket peut passer à la ligne avant son dernier segment (<wbr> posé par screen-management.js) et le total
 * reste sur une ligne : le tableau tient à 740 et 768 px. */
@media (min-width: 641px) and (max-width: 1180px) {
  .data-table.sales-table { min-width: 0; }
  .sales-table th, .sales-table td { padding-inline: 8px; }
  .data-table.sales-table td.mono { white-space: normal; }
  .sales-table td:nth-last-child(2) strong { white-space: nowrap; }
}
/* Ventes en fiches (téléphone) : pas de ligne « — » pour une vente sans collaborateur. */
@media (max-width: 640px) {
  .data-table.sales-table td.sale-collaborators.is-empty { display: none; }
}
/* Bouton « Scanner un ticket » aligné sur ses voisins de l'en-tête. */
.page-actions .camera-text-button { margin: 0; }
/* Clôture jusqu'à 660 px : n° de session sur sa ligne, boutons et pastille dessous. */
@media (max-width: 660px) {
  .session-live-head { display: block; }
  .session-live-actions { margin-top: 10px; }
}
/* Clôture : sans mouvement de caisse, la case vide ne repousse plus le comptage sous le bord. */
.cash-movements .empty-state { padding: 14px 10px; }
.modal-body .manager-list > .empty-state { padding: 14px 12px; }

/* Fiche client et Ajuster (compte, fidélité) : champs alignés, la liste n'est plus coupée. */
@media (min-width: 721px) { .loyalty-adjust { grid-template-columns: auto 120px minmax(0, 1fr) auto; } }
@media (min-width: 721px) and (max-width: 820px) {
  .loyalty-adjust { grid-template-columns: auto 120px minmax(0, 1fr); }
  .loyalty-adjust > .button { grid-column: 1 / -1; justify-self: end; }
}
.modal .loyalty-adjust .field { margin-bottom: 0; }
@media (max-height: 620px) {
  .detail-hero { margin-bottom: 8px; padding: 10px 12px; }
  .detail-hero .eyebrow { margin-bottom: 2px; }
  .entity-avatar.large { width: 44px; height: 44px; }
  /* Fiche article et autres formulaires en blocs : plus de champs visibles entre l'en-tête et le pied. */
  .form-section { margin-bottom: 10px; padding: 12px 14px 2px; }
  .form-section-head { margin-bottom: 8px; }
  .modal .field { margin-bottom: 10px; }
  .modal { scroll-padding-block: 64px; }
}

/* Puces de la page de connexion : le point reste rond et se cale sur la première ligne quand le texte en prend deux. */
.auth-features span { align-items: flex-start; }
.auth-features i { flex: none; margin-top: .5em; }
/* Connexion sur un écran bas (tablette en paysage, téléphone couché) : le pavé de code et le formulaire restent à l'écran. */
@media (min-width: 661px) and (max-height: 600px) {
  .auth-page:not(.subscription-page) .auth-form-wrap { padding-block: 12px; }
  .pin-stage h1 { margin-bottom: 2px; font-size: 26px; }
  .pin-subtitle { margin-bottom: 10px; }
  .pin-dots { margin-bottom: 10px; }
}
@media (min-width: 661px) and (max-height: 500px) {
  .auth-page:not(.subscription-page) .auth-brand { padding: 24px 32px; }
  .auth-page:not(.subscription-page) .auth-features { display: none; }
  .auth-page:not(.subscription-page) .auth-form-wrap { padding: 8px 30px; }
  .auth-page:not(.subscription-page) .auth-card > h1 { font-size: 32px; }
  .auth-page:not(.subscription-page) .auth-card > p { margin-bottom: 14px; }
  .pin-key { width: 54px; height: 54px; font-size: 24px; }
  .pin-pad { gap: 6px; margin-top: 4px; }
}

/* Articles sur écran bas : onglets, chiffres, panneau, outils et en-tête du tableau resserrés (≈ 50 px), la première
 * ligne du stock entre dans l'écran. */
@media (min-width: 661px) and (max-height: 620px) {
  .inventory-tabs { margin-bottom: 10px; }
  .inventory-stats:not(.compact) { margin-bottom: 10px; }
  .inventory-stats:not(.compact) article { padding: 7px 12px; }
  .inventory-stock-panel { padding: 12px; }
  .inventory-toolbar { row-gap: 8px; margin-bottom: 8px; }
  .inventory-filters { margin-bottom: 8px; }
  .inventory-stock-panel .data-table th { padding-block: 6px; }
}
/* Écran couché de moins de 900 px ou très bas, au doigt : recherche et boutons du stock sur la même ligne. */
@media (pointer: coarse) and (min-width: 661px) and (max-width: 900px) and (max-height: 560px), (pointer: coarse) and (min-width: 661px) and (max-height: 480px) {
  .inventory-toolbar { flex-wrap: nowrap; }
  .inventory-search { flex: 1 1 220px; min-width: 200px; }
  .inventory-actions { min-width: 0; }
}
/* Fiches du stock : « Tout sélectionner » au-dessus de la liste. */
.inventory-select-all { display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 6px; color: var(--muted); font-size: 13px; font-weight: 650; cursor: pointer; }
/* Petit téléphone : les quatre onglets du stock tiennent sur la largeur. */
@media (max-width: 410px) {
  .inventory-tabs { gap: 3px; }
  .inventory-tabs button { padding-inline: 7px; font-size: 13px; }
}
