/* 99 — application d'essai. Style « registre » (achromatic ledger) : aucune couleur dans le cadre,
   l'argent en encre, une seule teinte de donnée, le rouge pour ce qui est dû et le vert pour ce qui est payé.
   Sol couleur pierre (boutique). Polices du système : rien à télécharger, lisible sur Windows et Android.
   Grille : rail 84 px + contenu ; marges 24 px (16 px au téléphone) ; un seul écart de 12 px entre panneaux. */

:root {
  --sol: #f4f3f1;
  --surface: #ffffff;
  --releve: #e9e7e3;
  --releve-fort: #dedbd6;
  --bord: #e2dfda;
  --filet: #edebe7;
  --controle: #c9c5be;
  --encre: #141414;
  --gris: #5f5b55;
  --gris-clair: #8a857e;
  --primaire: #161616;
  --primaire-survol: #2e2e2e;
  --donnee: #1d5fbf;
  --dette: #b3261e;
  --paye: #1b7a3a;
  --whatsapp: #17803d;
  --whatsapp-survol: #12692f;
  --alerte: #8a4b0f;
  --pastille-dette: #fdecea; --pastille-dette-encre: #7d1b16;
  --pastille-paye: #dff6e6; --pastille-paye-encre: #0f4a24;
  --pastille-alerte: #fdf3e1; --pastille-alerte-encre: #7a420d;
  --pastille-neutre: #ecebe8; --pastille-neutre-encre: #3d3a36;
  --pastille-donnee: #e6eefb; --pastille-donnee-encre: #163f80;
  --rayon: 8px;
  --rayon-ctrl: 6px;
  --pas: 12px;
  --marge: 24px;
  --h-ctrl: 40px;
  --rail: 84px;
  --barre: 52px;
  --fs-titre: 22px;
  --fs-section: 15px;
  --fs-chiffre: 30px;
  --fs-corps: 15px;
  --fs-petit: 13px;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --ombre-flotte: 0 12px 32px rgba(20, 18, 15, .16), 0 2px 6px rgba(20, 18, 15, .08);
  --sortie: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sol); color: var(--encre); font: 400 var(--fs-corps)/1.45 var(--police);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior: none;
}
::selection { background: #cfe0f8; color: var(--encre); }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-titre); font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; }
h2 { font-size: var(--fs-section); font-weight: 600; line-height: 1.3; }
h3 { font-size: var(--fs-corps); font-weight: 600; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--donnee); outline-offset: 2px; }
.planche { position: absolute; width: 0; height: 0; overflow: hidden; }
.ic { display: inline-block; vertical-align: -0.25em; width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.ic.petit { width: 16px; height: 16px; }
.chiffres, .montant, td.nombre { font-variant-numeric: tabular-nums; }
.visuel-cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sans-script { padding: 24px; }

/* Démarrage */
.demarrage { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 12px; color: var(--gris); }
.marque-grande { width: 48px; height: 48px; stroke-width: 2; color: var(--encre); }

/* Cadre : rail à gauche (PC), barre en haut, onglets en bas (téléphone) */
.coque {
  display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); grid-template-rows: var(--barre) minmax(0, 1fr);
  height: 100dvh; overflow: hidden;
}
.rail {
  grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 10px 8px;
  border-right: 1px solid var(--bord); background: var(--sol); overflow-y: auto;
}
.rail .marque { display: grid; place-items: center; height: 44px; margin-bottom: 10px; color: var(--encre); border-radius: var(--rayon); }
.rail .marque .ic { width: 30px; height: 30px; stroke-width: 2.2; }
.rail-lien {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 2px 7px; border-radius: var(--rayon);
  color: var(--gris); text-decoration: none; font-size: 12px; font-weight: 500; line-height: 1.15; text-align: center;
  transition: background-color 150ms var(--sortie), color 150ms var(--sortie);
}
.rail-lien .ic { width: 22px; height: 22px; }
.rail-lien:hover { background: var(--releve); color: var(--encre); }
.rail-lien[aria-current="page"] { background: var(--surface); color: var(--encre); box-shadow: inset 0 0 0 1px var(--bord); }
.rail-lien[aria-current="page"] .ic { stroke-width: 2.1; }
.rail .bas { margin-top: auto; }
.barre {
  display: flex; align-items: center; gap: 12px; padding: 0 var(--marge); border-bottom: 1px solid var(--bord); min-width: 0;
}
.barre .entreprise { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.barre .moi { color: var(--gris); font-size: var(--fs-petit); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 30ch; }
.barre .espace { flex: 1; }
.ecran { overflow-y: auto; overflow-x: hidden; min-width: 0; min-height: 0; padding: var(--marge); outline: none; }
.ecran.plein { display: flex; flex-direction: column; overflow: hidden; }
.onglets { display: none; }

/* Voyant de synchronisation */
.synchro {
  display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 10px; border-radius: 999px; border: 1px solid var(--bord);
  background: var(--surface); color: var(--encre); font-size: var(--fs-petit); font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms var(--sortie), transform 100ms var(--sortie);
}
.synchro:hover { background: var(--releve); }
.synchro:active { transform: scale(.97); }
.synchro .ic { width: 16px; height: 16px; }
.synchro[data-etat="ok"] .ic { color: var(--paye); }
.synchro[data-etat="attente"] .ic { color: var(--alerte); }
.synchro[data-etat="horsligne"] { color: var(--gris); background: var(--releve); }
.synchro[data-etat="bloque"], .synchro[data-etat="refus"] { color: var(--pastille-dette-encre); background: var(--pastille-dette); border-color: #f3c9c4; }
.synchro[data-etat="encours"] .ic { animation: tourne 900ms linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--h-ctrl); padding: 0 16px;
  border: 0; border-radius: var(--rayon-ctrl); background: var(--releve); color: var(--encre); font-weight: 550; font-size: var(--fs-corps);
  text-decoration: none; cursor: pointer; white-space: nowrap; user-select: none; -webkit-user-select: none; touch-action: manipulation;
  transition: background-color 150ms var(--sortie), transform 100ms var(--sortie), opacity 150ms;
}
.bouton:hover { background: var(--releve-fort); }
.bouton:active { transform: scale(.97); }
.bouton:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.bouton.primaire { background: var(--primaire); color: #fff; }
.bouton.primaire:hover { background: var(--primaire-survol); }
.bouton.whatsapp { background: var(--whatsapp); color: #fff; }
.bouton.whatsapp:hover { background: var(--whatsapp-survol); }
.bouton.danger { background: var(--pastille-dette); color: var(--dette); }
.bouton.danger:hover { background: #f9d9d5; }
.bouton.fantome { background: transparent; }
.bouton.fantome:hover { background: var(--releve); }
.bouton.contour { background: var(--surface); box-shadow: inset 0 0 0 1px var(--controle); }
.bouton.contour:hover { background: var(--sol); }
.bouton.icone { width: var(--h-ctrl); padding: 0; }
.bouton.petit { height: 32px; padding: 0 12px; font-size: var(--fs-petit); }
.bouton.petit.icone { width: 32px; }
.bouton.grand { height: 52px; font-size: 16px; padding: 0 20px; }
.bouton .ic { width: 18px; height: 18px; }

/* Champs */
.champ { display: grid; gap: 6px; min-width: 0; }
.champ > span, .etiquette-champ { font-size: var(--fs-petit); font-weight: 550; color: var(--gris); }
.saisie, .champ input, .champ select, .champ textarea {
  width: 100%; min-width: 0; height: var(--h-ctrl); padding: 0 12px; border: 1px solid var(--controle); border-radius: var(--rayon-ctrl);
  background: var(--surface); color: var(--encre); font-size: 16px; transition: border-color 150ms, box-shadow 150ms;
}
.champ textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.saisie:focus, .champ input:focus, .champ select:focus, .champ textarea:focus { outline: none; border-color: var(--donnee); box-shadow: 0 0 0 3px #d3e2f8; }
.champ input[aria-invalid="true"] { border-color: var(--dette); }
.prefixe { display: flex; align-items: stretch; }
.prefixe > b { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--controle); border-right: 0; border-radius: var(--rayon-ctrl) 0 0 var(--rayon-ctrl); background: var(--sol); font-weight: 500; color: var(--gris); }
.prefixe > input { border-radius: 0 var(--rayon-ctrl) var(--rayon-ctrl) 0; }
.recherche { position: relative; flex: 1; min-width: 0; }
.recherche .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--gris); pointer-events: none; }
.recherche input { width: 100%; padding-left: 38px; }
.aide { font-size: var(--fs-petit); color: var(--gris); }
.grille-champs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grille-champs .large { grid-column: 1 / -1; }
details.plus summary { cursor: pointer; color: var(--gris); font-size: var(--fs-petit); font-weight: 550; padding: 4px 0; }
details.plus[open] summary { margin-bottom: 12px; }

/* Choix en boutons (sens d'un appel, moyen de paiement) */
/* Tous les boutons d'un choix ont la même hauteur, même si un nom passe sur deux lignes (bug 11) :
   la légende garde sa propre rangée, les rangées de boutons sont égales. */
.choix { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: auto; grid-auto-rows: 1fr; border: 0; padding: 0; margin: 0; min-width: 0; }
.choix.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choix.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.choix legend { grid-column: 1 / -1; padding: 0; margin-bottom: 6px; float: left; width: 100%; }
.choix label { position: relative; display: flex; }
.choix label > span { flex: 1; }
.choix input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choix span {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 6px 8px; border-radius: var(--rayon-ctrl);
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--controle); font-weight: 550; font-size: 14px; text-align: center; line-height: 1.15;
  transition: background-color 150ms, box-shadow 150ms, color 150ms, transform 100ms;
}
.choix label:active span { transform: scale(.97); }
.choix input:checked + span { background: var(--primaire); color: #fff; box-shadow: none; }
.choix input:focus-visible + span { outline: 2px solid var(--donnee); outline-offset: 2px; }

/* Puces de filtre */
.puces { display: flex; gap: 8px; flex-wrap: wrap; }
.puce {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 999px; border: 0;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--bord); color: var(--encre); font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background-color 150ms, transform 100ms;
}
.puce:hover { background: var(--releve); }
.puce:active { transform: scale(.97); }
.puce[aria-pressed="true"] { background: var(--primaire); color: #fff; box-shadow: none; }
/* Dans les zones qui défilent (catégories, tuiles, cartes), le contour du clavier est tracé à l'intérieur : il n'est jamais rogné (bug 13). */
.puce:focus-visible, .tuile:focus-visible, .carte:focus-visible { outline-offset: -2px; }
.puce .compte { font-variant-numeric: tabular-nums; color: var(--gris); font-weight: 500; }
.puce[aria-pressed="true"] .compte { color: #cfcfcf; }
.puce .rond { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.puce.etiquette-portee { background: var(--pastille-neutre); box-shadow: none; cursor: default; height: 30px; padding: 0 6px 0 12px; max-width: 100%; }
.puce.etiquette-portee > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.puce.etiquette-portee button { flex: none; }
.puce.etiquette-portee button { display: grid; place-items: center; width: 22px; height: 22px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--gris); }
.puce.etiquette-portee button:hover { background: var(--releve-fort); color: var(--encre); }

/* Pastilles d'état, dans les lignes seulement */
.pastille { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.pastille.dette { background: var(--pastille-dette); color: var(--pastille-dette-encre); }
.pastille.paye { background: var(--pastille-paye); color: var(--pastille-paye-encre); }
.pastille.alerte { background: var(--pastille-alerte); color: var(--pastille-alerte-encre); }
.pastille.neutre { background: var(--pastille-neutre); color: var(--pastille-neutre-encre); }
.pastille.donnee { background: var(--pastille-donnee); color: var(--pastille-donnee-encre); }

/* Panneaux et titres */
.titre-ecran { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; min-height: var(--h-ctrl); }
.titre-ecran h1 { margin-right: auto; }
.titre-ecran .sous-titre { flex-basis: 100%; color: var(--gris); margin-top: -10px; }
.panneau { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); min-width: 0; }
.panneau-entete { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; min-height: 52px; }
.panneau-entete h2 { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.panneau-entete .nombre { color: var(--gris); font-weight: 500; font-variant-numeric: tabular-nums; }
.panneau-corps { padding: 4px 16px 16px; }
.lien-voir { color: var(--gris); font-size: var(--fs-petit); font-weight: 550; text-decoration: none; display: inline-flex; align-items: center; gap: 2px; }
.lien-voir:hover { color: var(--encre); }

/* Listes de lignes */
.lignes { list-style: none; margin: 0; padding: 0; }
/* Une ligne garde le nom lisible : si la place manque, les boutons passent dessous, à droite. */
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 60px; padding: 8px 0; border-top: 1px solid var(--filet); min-width: 0; }
.lignes > .ligne:first-child { border-top: 0; }
.panneau .lignes { padding: 0 16px 6px; }
a.ligne, button.ligne { text-decoration: none; color: inherit; background: none; border-left: 0; border-right: 0; border-bottom: 0; width: 100%; text-align: left; cursor: pointer; font: inherit; }
.ligne.cliquable { cursor: pointer; border-radius: var(--rayon-ctrl); margin: 0 -8px; padding: 8px; transition: background-color 120ms; }
.lignes > .ligne.cliquable { border-top-color: transparent; box-shadow: 0 -1px 0 var(--filet); }
.ligne.cliquable:hover { background: var(--sol); }
.ligne.choisie { background: var(--releve); }
.avatar {
  display: grid; place-items: center; width: 38px; height: 38px; flex: none; border-radius: 50%; font-size: 13px; font-weight: 650;
  background: hsl(var(--h, 30) 38% 92%); color: hsl(var(--h, 30) 40% 26%); letter-spacing: .01em;
}
.avatar.t0 { --h: 15; } .avatar.t1 { --h: 45; } .avatar.t2 { --h: 75; } .avatar.t3 { --h: 105; } .avatar.t4 { --h: 135; } .avatar.t5 { --h: 165; }
.avatar.t6 { --h: 195; } .avatar.t7 { --h: 225; } .avatar.t8 { --h: 255; } .avatar.t9 { --h: 285; } .avatar.t10 { --h: 315; } .avatar.t11 { --h: 345; }
.avatar.ic-fond { background: var(--releve); color: var(--gris); }
.avatar.ic-fond .ic { width: 18px; height: 18px; }
.ligne-texte { flex: 1 1 150px; min-width: 0; display: grid; gap: 1px; text-decoration: none; color: inherit; }
a.ligne-texte:hover .titre { text-decoration: underline; text-underline-offset: 3px; }
.ligne-texte .titre { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-texte .sous { font-size: var(--fs-petit); color: var(--gris); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Sous-titre en morceaux insécables (numéro, échéance) : s'il manque de place, il passe à la ligne entre deux morceaux (bug 9). */
.ligne-texte .sous.coupable { white-space: normal; }
.ligne-montant { display: grid; justify-items: end; gap: 3px; flex: none; text-align: right; }
.montant { font-weight: 650; white-space: nowrap; font-variant-numeric: tabular-nums; }
.montant.dette { color: var(--dette); }
.montant.avoir { color: var(--donnee); }
.montant.zero { color: var(--gris-clair); font-weight: 500; }
.montant.paye { color: var(--paye); }
.ligne-actions { display: flex; gap: 6px; flex: none; margin-left: auto; }
.plus-de-lignes { display: flex; justify-content: center; padding: 12px 0 4px; }

/* États vides */
.vide { display: grid; justify-items: start; gap: 8px; padding: 18px 0 10px; color: var(--gris); }
.vide .ic { width: 24px; height: 24px; color: var(--gris-clair); }
.vide strong { color: var(--encre); font-weight: 600; }
.vide.centre { justify-items: center; text-align: center; padding: 48px 16px; }
.panneau-corps.vide { display: flex; align-items: center; gap: 10px; padding: 6px 16px 18px; }
.panneau-corps.vide .ic { width: 20px; height: 20px; }

/* Aujourd'hui */
.jour { display: grid; gap: var(--pas); grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.bande-ventes { grid-column: 1 / -1; display: flex; align-items: stretch; flex-wrap: wrap; gap: 0; padding: 0; }
.bande-ventes .bloc { padding: 16px 20px; display: grid; gap: 4px; align-content: start; border-left: 1px solid var(--filet); min-width: 0; }
.bande-ventes .bloc:first-child { border-left: 0; padding-right: 28px; }
.bande-ventes .libelle { font-size: var(--fs-petit); color: var(--gris); font-weight: 500; }
.bande-ventes .chiffre { font-size: var(--fs-chiffre); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; color: var(--donnee); font-variant-numeric: tabular-nums; white-space: nowrap; }
.bande-ventes .valeur { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bande-ventes .moyens { flex: 1; display: flex; flex-wrap: wrap; gap: 6px 22px; align-content: center; }
.bande-ventes .moyen { display: grid; gap: 1px; }
.bande-ventes .moyen b { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bande-ventes .moyen span { font-size: var(--fs-petit); color: var(--gris); }
.bande-ventes .agir { display: flex; align-items: center; padding: 16px 20px; margin-left: auto; }
.pleine-largeur { grid-column: 1 / -1; }
.constat { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--encre); font-weight: 500; }
.constat .ic { color: var(--alerte); }

/* Caisse */
.caisse { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: var(--pas); flex: 1; min-height: 0; }
.articles { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.articles-outils { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.articles-outils .puces { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; overflow-y: auto; align-content: start; padding: 2px 2px 12px; min-height: 0; }
.tuile {
  display: grid; align-content: space-between; gap: 8px; min-height: 92px; padding: 12px; border: 0; border-radius: var(--rayon); text-align: left;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--bord); cursor: pointer; min-width: 0;
  transition: box-shadow 150ms, transform 100ms var(--sortie), background-color 150ms;
}
.tuile:hover { box-shadow: inset 0 0 0 1px var(--controle); }
.tuile:active { transform: scale(.97); background: var(--sol); }
.tuile .nom { font-weight: 550; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.tuile .prix { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 4px; font-weight: 650; font-variant-numeric: tabular-nums; }
.tuile .prix > span:first-child { white-space: nowrap; }
.tuile .unite { color: var(--gris); font-weight: 400; font-size: var(--fs-petit); }
.tuile.libre { background: transparent; box-shadow: inset 0 0 0 1px var(--controle); border: 0; outline: 1px dashed transparent; }
.tuile.libre { box-shadow: none; border: 1px dashed var(--controle); }
.tuile.libre .nom { display: flex; align-items: center; gap: 6px; }
.tuiles > .vide { grid-column: 1 / -1; } /* le message « aucun article » prend toute la largeur (bug 8) */
.ticket { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ticket-lignes { flex: 1; overflow-y: auto; padding: 0 16px; min-height: 60px; }
.ticket-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 6px 0; border-top: 1px solid var(--filet); }
.ticket-ligne:first-child { border-top: 0; }
.ticket-ligne .nom { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-ligne .total-ligne { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ticket-ligne .reglage { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--gris); font-size: var(--fs-petit); }
.ticket-ligne.nouvelle { animation: arrive 260ms var(--sortie); }
@keyframes arrive { from { background: #e8f0fc; } to { background: transparent; } }
.pas { display: inline-flex; align-items: center; border-radius: var(--rayon-ctrl); box-shadow: inset 0 0 0 1px var(--controle); background: var(--surface); }
.pas button { width: 34px; height: 32px; border: 0; background: none; cursor: pointer; display: grid; place-items: center; border-radius: var(--rayon-ctrl); color: var(--encre); }
.pas button:hover { background: var(--releve); }
.pas button:active { transform: scale(.94); }
.pas input { width: 52px; height: 32px; border: 0; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; background: transparent; font-size: 15px; }
.pas input:focus { outline: none; background: var(--sol); }
.prix-ligne { width: 96px; height: 32px; padding: 0 8px; border: 1px solid var(--controle); border-radius: var(--rayon-ctrl); text-align: right; font-variant-numeric: tabular-nums; font-size: 15px; background: var(--surface); }
.ticket-pied { border-top: 1px solid var(--bord); padding: 8px 16px 12px; display: grid; gap: 8px; background: var(--surface); }
.ticket-pied .choix span { min-height: 38px; }
.ticket-pied .choix legend { margin-bottom: 4px; }
.ticket-total { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; line-height: 1.15; }
.ticket-total .chiffre { font-size: var(--fs-chiffre); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ticket-ligne-simple { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.ticket-ligne-simple > span { color: var(--gris); font-size: 14px; white-space: nowrap; }
.ticket-ligne-simple input { width: 130px; height: 36px; text-align: right; font-variant-numeric: tabular-nums; }
.client-choisi { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 6px 4px 8px; border-radius: var(--rayon-ctrl); background: var(--sol); }
.client-choisi .avatar { width: 32px; height: 32px; font-size: 12px; }
.client-choisi .ligne-texte .titre { font-size: 14px; }
.reste { display: flex; justify-content: space-between; gap: 10px; color: var(--dette); font-weight: 600; font-size: 14px; }
.message-ticket { font-size: 14px; color: var(--pastille-dette-encre); background: var(--pastille-dette); border-radius: var(--rayon-ctrl); padding: 8px 10px; }
.barre-ticket { display: none; }
[data-fermer-ticket] { display: none; }

/* Clients : liste et fiche côte à côte */
.maitre-detail { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: var(--pas); flex: 1; min-height: 0; }
.maitre { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.maitre-outils { display: grid; gap: 10px; padding: 14px 16px 10px; border-bottom: 1px solid var(--filet); }
.maitre-outils .ligne-outils { display: flex; gap: 8px; }
.maitre .lignes { overflow-y: auto; flex: 1; padding: 4px 16px 8px; }
.maitre .ligne { flex-wrap: nowrap; } /* le montant dû reste à droite du nom, même dans une liste étroite (bug 7) */
.maitre .total { padding: 0 16px 10px; color: var(--gris); font-size: var(--fs-petit); }
.detail { overflow-y: auto; min-height: 0; }
.fiche { display: grid; gap: var(--pas); align-content: start; }
.fiche-entete { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 6px 16px; align-items: center; padding: 18px 20px; }
.fiche-entete .avatar { width: 56px; height: 56px; font-size: 18px; grid-row: span 2; }
.fiche-entete h1 { overflow-wrap: anywhere; }
.fiche-entete .meta { color: var(--gris); display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; }
.fiche-entete .meta a { text-decoration: none; }
.fiche-entete .meta a:hover { text-decoration: underline; }
.fiche-solde { grid-row: span 2; display: grid; justify-items: end; gap: 2px; text-align: right; }
.fiche-solde .chiffre { font-size: var(--fs-chiffre); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fiche-solde .libelle { font-size: var(--fs-petit); color: var(--gris); }
.fiche-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; }
.fiche-colonnes { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--pas); align-items: start; }
.historique .ligne { align-items: flex-start; min-height: 52px; }
.historique .ligne-texte .titre { white-space: pre-line; overflow-wrap: anywhere; }
.historique .titre.repliable { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; cursor: pointer; }
.historique .titre.repliable.ouvert { display: block; -webkit-line-clamp: unset; }
.historique .avatar { width: 32px; height: 32px; }
.retour-liste { display: none; }

/* Dettes */
.resume-dettes { display: flex; flex-wrap: wrap; gap: 10px 32px; align-items: flex-end; padding: 16px 20px; margin-bottom: var(--pas); }
.resume-dettes .bloc { display: grid; gap: 2px; }
.resume-dettes .libelle { font-size: var(--fs-petit); color: var(--gris); }
.resume-dettes .chiffre { font-size: var(--fs-chiffre); font-weight: 700; letter-spacing: -0.02em; color: var(--dette); font-variant-numeric: tabular-nums; white-space: nowrap; }
.resume-dettes .valeur { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }

/* Appels */
.appels { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: var(--pas); align-items: start; }
.formulaire { display: grid; gap: 14px; padding: 16px; }
.contact-trouve { display: flex; align-items: center; gap: 8px; min-height: 22px; font-size: 14px; color: var(--gris); }
.contact-trouve b { color: var(--encre); font-weight: 600; }
.pile { display: grid; gap: var(--pas); align-content: start; min-width: 0; }

/* Suivi en colonnes */
.suivi-outils { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.suivi-outils select { width: auto; max-width: 280px; }
.tableau { display: flex; gap: var(--pas); overflow-x: auto; overflow-y: hidden; flex: 1; min-height: 0; padding-bottom: 6px; overscroll-behavior-x: contain; }
.colonne { flex: 0 0 272px; display: flex; flex-direction: column; min-height: 0; background: var(--releve); border-radius: var(--rayon); transition: box-shadow 120ms, background-color 120ms; }
.colonne.survolee { background: #dfe7f3; box-shadow: inset 0 0 0 2px var(--donnee); }
.colonne-entete { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 12px 12px 8px; }
.colonne-entete h2 { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.colonne-entete .nombre { color: var(--gris); font-size: var(--fs-petit); font-variant-numeric: tabular-nums; }
.colonne-entete .somme { grid-column: 1 / -1; color: var(--gris); font-size: var(--fs-petit); font-variant-numeric: tabular-nums; }
.cartes { display: grid; gap: 8px; align-content: start; padding: 0 8px 10px; overflow-y: auto; min-height: 60px; }
.carte {
  display: grid; gap: 6px; padding: 10px 12px; border-radius: var(--rayon-ctrl); background: var(--surface); box-shadow: 0 1px 0 rgba(20, 18, 15, .06), inset 0 0 0 1px var(--bord);
  text-align: left; border: 0; cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none; width: 100%; font: inherit; color: inherit;
  transition: transform 100ms var(--sortie), box-shadow 150ms;
}
.carte:active { cursor: grabbing; }
.carte .titre { font-weight: 550; overflow-wrap: anywhere; }
.carte .bas { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: var(--fs-petit); color: var(--gris); }
.carte .bas .date { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.carte .bas .montant { color: var(--encre); font-size: 14px; }
.carte.fantome-carte { position: fixed; z-index: 50; pointer-events: none; box-shadow: var(--ombre-flotte); transform: rotate(1.5deg); opacity: .96; }
.carte.en-glisse { opacity: .35; }

/* Catalogue */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 550; color: var(--gris); padding: 10px 12px; }
.table td { padding: 10px 12px; border-top: 1px solid var(--filet); vertical-align: middle; }
.table td.nombre, .table th.nombre { text-align: right; white-space: nowrap; }
.table td.nom { font-weight: 550; overflow-wrap: anywhere; }
.table tr.retire td { color: var(--gris-clair); }
.table td.actions { text-align: right; white-space: nowrap; width: 1%; }

/* Réglages */
.reglages { display: grid; gap: 0; max-width: 1040px; }
.section-reglage { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 24px; padding: 24px 0; border-top: 1px solid var(--bord); }
.section-reglage:first-child { border-top: 0; padding-top: 0; }
.section-reglage .description { color: var(--gris); font-size: 14px; margin-top: 4px; }
.section-reglage .contenu { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; display: grid; gap: 12px; min-width: 0; align-content: start; }
.section-reglage .contenu > .bouton { justify-self: start; }
.section-reglage h3 { margin-top: 6px; }
.paires { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 20px; }
.paires dt { color: var(--gris); }
.paires dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }

/* Connexion (25/11) : à gauche ce que fait 99, à droite le formulaire ; une seule colonne sous 900 px. */
.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 32px 16px; }
.connexion-boite { width: min(980px, 100%); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 56px; align-items: center; }
.connexion-accueil { display: grid; gap: 18px; align-content: center; }
.connexion-marque { display: flex; align-items: center; }
.connexion-marque .ic { width: 44px; height: 44px; stroke-width: 2.2; }
.connexion .segment button { white-space: nowrap; }
.connexion-accueil h1 { font-size: 34px; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; max-width: 16ch; text-wrap: balance; }
.connexion-promesse { color: var(--gris); font-size: 16px; max-width: 40ch; }
.connexion-points { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 12px; }
.connexion-points li { display: flex; align-items: center; gap: 12px; color: var(--encre); }
.connexion-points .ic { flex: none; width: 34px; height: 34px; padding: 7px; border-radius: 8px; background: var(--surface); border: 1px solid var(--bord); }
.connexion .panneau { padding: 24px; display: grid; gap: 18px; box-shadow: 0 1px 2px rgba(20, 18, 15, .06), 0 8px 24px rgba(20, 18, 15, .06); }
.connexion-titre h2 { font-size: 19px; font-weight: 650; }
.connexion-titre p { color: var(--gris); font-size: 14px; margin-top: 2px; }
.connexion .note-essai { font-size: var(--fs-petit); color: var(--gris); text-align: center; }
.case { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border: 1px solid var(--bord); border-radius: var(--rayon-ctrl); background: var(--sol); cursor: pointer; }
.case input { flex: none; width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--primaire); cursor: pointer; }
.case span { display: grid; gap: 2px; }
.case b { font-weight: 600; font-size: 14px; }
.case small { color: var(--gris); font-size: 13px; }
@media (max-width: 900px) {
  .connexion { place-items: start center; padding-top: 24px; }
  .connexion-boite { grid-template-columns: minmax(0, 1fr); gap: 18px; width: min(440px, 100%); }
  .connexion-accueil { gap: 6px; }
  .connexion-accueil h1 { font-size: 20px; max-width: none; }
  .connexion .panneau { padding: 18px 16px; }
  .connexion .segment button { font-size: 14px; }
  .connexion-promesse, .connexion-points { display: none; }
}
.erreur-forme { color: var(--pastille-dette-encre); background: var(--pastille-dette); border-radius: var(--rayon-ctrl); padding: 10px 12px; font-size: 14px; }
.segment { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 9px; background: var(--releve); gap: 3px; }
.segment button { height: 36px; border: 0; border-radius: 7px; background: transparent; font-weight: 550; cursor: pointer; color: var(--gris); }
.segment button[aria-pressed="true"] { background: var(--surface); color: var(--encre); box-shadow: 0 1px 2px rgba(20, 18, 15, .12); }

/* Écran bloqué (poste révoqué, autre onglet) */
.blocage { min-height: 100dvh; display: grid; place-items: center; padding: 24px; }
.blocage .panneau { max-width: 460px; padding: 24px; display: grid; gap: 14px; }

/* Fenêtres (feuilles) */
dialog.feuille {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 0; border: 0; border-radius: 12px; background: var(--surface); color: var(--encre);
  box-shadow: var(--ombre-flotte); overflow: hidden;
}
dialog.feuille.large { width: min(720px, calc(100vw - 32px)); }
dialog.feuille[open] { display: flex; flex-direction: column; animation: monte 220ms var(--sortie); }
dialog.feuille::backdrop { background: rgba(20, 18, 15, .38); animation: fondu 200ms ease-out; }
@keyframes monte { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes fondu { from { opacity: 0; } }
.feuille-forme { display: flex; flex-direction: column; min-height: 0; max-height: calc(100dvh - 48px); }
.feuille-entete { display: flex; align-items: center; gap: 12px; padding: 14px 12px 10px 20px; }
.feuille-entete h2 { flex: 1; font-size: 17px; }
.feuille-corps { padding: 6px 20px 18px; overflow-y: auto; display: grid; gap: 14px; min-height: 0; }
.feuille-corps .texte { color: var(--encre); line-height: 1.5; }
.feuille-erreur { margin: 0 20px 12px; color: var(--pastille-dette-encre); background: var(--pastille-dette); border-radius: var(--rayon-ctrl); padding: 10px 12px; font-size: 14px; }
.feuille-pied { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 16px; border-top: 1px solid var(--filet); }
.resultats { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }

/* Annonces */
.annonces { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; width: max-content; max-width: calc(100vw - 32px); }
.annonce {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; background: var(--primaire); color: #fff; font-weight: 500;
  box-shadow: var(--ombre-flotte); animation: monte 220ms var(--sortie); max-width: 100%;
}
.annonce .ic { color: #8fd8a6; }
.annonce.erreur { background: #7d1b16; }
.annonce.erreur .ic { color: #ffc9c3; }
.annonce.sort { opacity: 0; transform: translateY(6px); transition: opacity 200ms, transform 200ms; }

/* Statistiques : quatre chiffres avec leur écart, ventes par jour en barres (hauteur posée par le script), listes */
.titre-ecran .puces { flex-wrap: nowrap; }
.stats { display: grid; gap: var(--pas); grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.indicateurs { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.indicateurs .bloc { padding: 16px 20px; display: grid; gap: 4px; align-content: start; border-left: 1px solid var(--filet); min-width: 0; }
.indicateurs .bloc:first-child { border-left: 0; }
.indicateurs .libelle { font-size: var(--fs-petit); color: var(--gris); font-weight: 500; }
.indicateurs .chiffre { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ecart { font-size: var(--fs-petit); font-weight: 600; font-variant-numeric: tabular-nums; }
.ecart.hausse { color: var(--paye); }
.ecart.baisse { color: var(--dette); }
.ecart.egal { color: var(--gris); }
.histo { display: flex; align-items: stretch; gap: 8px; height: 180px; padding: 4px 16px 14px; }
.histo.serre { gap: 3px; }
.histo-jour { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.histo-fond { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.histo-valeur { width: 100%; max-width: 44px; height: var(--part, 0%); min-height: 2px; background: var(--donnee); border-radius: 4px 4px 0 0; }
.histo-date { font-size: 11.5px; color: var(--gris); white-space: nowrap; height: 16px; }
.histo-jour:first-child { align-items: flex-start; }
.histo-jour:last-child { align-items: flex-end; }

/* Tablette et petit PC */
@media (max-width: 1180px) {
  .jour { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .caisse { grid-template-columns: minmax(0, 1fr) 360px; }
  .maitre-detail { grid-template-columns: 330px minmax(0, 1fr); }
  .fiche-colonnes { grid-template-columns: minmax(0, 1fr); }
  .section-reglage { grid-template-columns: 220px minmax(0, 1fr); }
  .indicateurs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .indicateurs .bloc:nth-child(3) { border-left: 0; }
  .indicateurs .bloc:nth-child(n+3) { border-top: 1px solid var(--filet); }
}

/* Téléphone */
@media (max-width: 760px) {
  :root { --marge: 16px; --h-ctrl: 44px; --fs-titre: 21px; --fs-chiffre: 28px; }
  .coque { grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--barre) minmax(0, 1fr) auto; }
  .rail { display: none; }
  .barre { padding: 0 12px 0 var(--marge); }
  .barre .moi { display: none; }
  .onglets {
    display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1px solid var(--bord); background: var(--sol);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .onglets a, .onglets button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; border: 0; background: none; border-radius: var(--rayon);
    color: var(--gris); font-size: 11.5px; font-weight: 550; text-decoration: none; cursor: pointer;
  }
  .onglets [aria-current="page"] { color: var(--encre); background: var(--surface); }
  .onglets .ic { width: 22px; height: 22px; }
  .jour { grid-template-columns: minmax(0, 1fr); }
  .bande-ventes .bloc { border-left: 0; padding: 14px 16px 4px; }
  .bande-ventes .moyens { padding: 8px 16px 14px; flex-basis: 100%; }
  .bande-ventes .agir { display: none; }
  .titre-ecran { margin-bottom: 14px; }
  .titre-ecran .bouton:not(.toujours) .texte-bouton { display: none; }
  .titre-ecran .bouton:not(.toujours) { width: var(--h-ctrl); padding: 0; }
  .caisse { grid-template-columns: minmax(0, 1fr); }
  .caisse .ticket { display: none; }
  .caisse.ticket-ouvert .ticket { display: flex; position: fixed; inset: 0; z-index: 40; border-radius: 0; border: 0; }
  .caisse.ticket-ouvert .ticket .panneau-entete { padding-top: calc(14px + env(safe-area-inset-top)); }
  [data-fermer-ticket] { display: inline-flex; }
  .barre-ticket {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 52px; padding: 0 16px; margin-top: 8px; border: 0; border-radius: var(--rayon);
    background: var(--primaire); color: #fff; font-weight: 600; cursor: pointer; width: 100%; font-size: 15px;
  }
  .barre-ticket .montant { color: #fff; }
  .tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ligne-texte { flex-basis: 110px; }
  .maitre-detail { grid-template-columns: minmax(0, 1fr); }
  .maitre-detail.avec-detail .maitre { display: none; }
  .maitre-detail:not(.avec-detail) .detail { display: none; }
  .retour-liste { display: inline-flex; margin-bottom: 8px; }
  .fiche-entete { grid-template-columns: auto minmax(0, 1fr); padding: 16px; }
  .fiche-entete .avatar { grid-row: auto; width: 44px; height: 44px; font-size: 15px; }
  .fiche-entete .meta { grid-column: 1 / -1; order: 1; }
  .fiche-solde { grid-column: 1 / -1; grid-row: auto; justify-items: start; text-align: left; order: 2; }
  .fiche-actions { order: 3; }
  .fiche-actions .bouton { flex: 1 1 auto; }
  .appels { grid-template-columns: minmax(0, 1fr); }
  .stats, .indicateurs { grid-template-columns: minmax(0, 1fr); }
  .indicateurs .bloc { border-left: 0; border-top: 1px solid var(--filet); padding: 12px 16px; }
  .indicateurs .bloc:first-child { border-top: 0; }
  .colonne { flex-basis: 82vw; }
  .section-reglage { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grille-champs { grid-template-columns: minmax(0, 1fr); }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; }
  .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; padding: 10px 0; border-top: 1px solid var(--filet); }
  .table td { border: 0; padding: 0; }
  .table td.nom { grid-column: 1; }
  .table td.prix { grid-column: 2; grid-row: 1; }
  .table td.secondaire { grid-column: 1; font-size: var(--fs-petit); color: var(--gris); }
  .table td.actions { grid-column: 2; grid-row: 2 / span 2; align-self: center; width: auto; }
  dialog.feuille { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 14px 14px 0 0; }
  dialog.feuille[open] { animation: monte-bas 260ms var(--sortie); }
  .feuille-forme { max-height: 92dvh; }
  .feuille-pied { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .feuille-pied .bouton { flex: 1; }
  .annonces { bottom: calc(76px + env(safe-area-inset-bottom)); }
  /* Ticket ouvert en plein écran : l'annonce passe en haut, sur l'en-tête, et ne cache plus le total ni « Valider » (bug 16). */
  body:has(.caisse.ticket-ouvert) .annonces { top: calc(8px + env(safe-area-inset-top)); bottom: auto; }
  .choix.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } /* « Aujourd’hui » ne touche plus les bords (bug 14) */
  @keyframes monte-bas { from { transform: translateY(100%); } to { transform: none; } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .synchro[data-etat="encours"] .ic { animation: none; }
}
