/* =========================================================================
   PIAMUN GESTION BOARD — feuille unique.
   Un outil de travail : police du système, gris neutres, une seule couleur
   d'accent, petits arrondis, aucune décoration. La densité prime sur l'effet.
   ========================================================================= */

:root {
  --fond: #FFFFFF;
  --surface: #F5F5F7;
  --surface-2: #EBEBEF;
  --texte: #1D1D1F;
  --texte-2: #6E6E73;
  --texte-3: #8E8E93;
  --trait: #E3E3E8;
  --trait-fort: #C7C7CC;

  --accent: #0066CC;
  --accent-survol: #0058B0;
  --accent-pale: #EAF2FC;

  /* montants : le signe porte le sens ; seul le négatif est teinté */
  --recette: #1D1D1F;
  --depense: #C4291C;
  /* graphiques : paire bleu / rouge validée (daltonisme, contraste) */
  --serie-recette: #2A78D6;
  --serie-depense: #E34948;
  --grille: #ECECF0;
  --axe: #C7C7CC;
  --bon: #1C7C3A;
  --alerte: #9A5A00;
  --alerte-pale: #FFF6E5;
  --danger-pale: #FDEEEC;
  --ok-pale: #EAF6EE;

  --police: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  --r: 6px;          /* contrôles */
  --r-panneau: 8px;  /* blocs */
  --cote: 216px;     /* largeur de la barre latérale */
}

* { box-sizing: border-box; }
/* sans cette règle, un display posé par une classe l'emporte sur l'attribut hidden */
[hidden] { display: none !important; }
/* pas de rebond en haut ni en bas de page (Safari iPad 16+) : il entraînait
   le menu et les boutons collés, et un glissé vers le bas rechargeait la page */
html { color-scheme: light; -webkit-text-size-adjust: 100%; overscroll-behavior-y: none; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: var(--police);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { flex: none; display: inline-block; vertical-align: -.2em; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.mono { font-family: var(--mono); font-size: .95em; }
.discret { color: var(--texte-2); }
.saut { position: absolute; left: 8px; top: 8px; z-index: 100; padding: 8px 12px; background: var(--texte); color: #fff; border-radius: var(--r); transform: translateY(-200%); }
.saut:focus { transform: none; }
/* repère invisible : la taille de la page, comparée à la partie visible (crm.js) */
.repere-ecran { position: fixed; inset: 0; z-index: -1; visibility: hidden; pointer-events: none; }

/* ---------- Coquille : barre latérale + contenu ---------- */
.cote {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  /* le menu ne bouge jamais ; pendant une saisie sur iPad, il se prolonge
     seulement vers le bas si la partie visible dépasse la page (crm.js) */
  bottom: min(0px, var(--ecran-bas, 0px));
  width: var(--cote);
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--trait);
}
.cote__marque { display: flex; align-items: baseline; gap: 6px; padding: 18px 18px 14px; color: var(--texte); font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.cote__marque:hover { text-decoration: none; }
.cote__marque span { font-weight: 500; color: var(--texte-2); }
.nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.nav__titre { margin: 16px 8px 4px; font-size: 11px; font-weight: 600; color: var(--texte-3); }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px; border-radius: var(--r);
  color: var(--texte); font-size: 13.5px;
}
.nav a:hover { background: var(--surface-2); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--surface-2); font-weight: 600; }
/* icônes pleines (dossier icon/) : 16 px, à l'échelle d'un texte de 13,5 px */
.nav a .ic { width: 16px; height: 16px; color: var(--texte-2); }
.nav a[aria-current="page"] .ic { color: var(--accent); }
.nav__pastille { margin-left: auto; }

.cote__compte { padding: 12px 18px 16px; border-top: 1px solid var(--trait); }
.cote__nom { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cote__role { font-size: 12px; color: var(--texte-2); }
.cote__quitter { margin-top: 8px; padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; color: var(--accent); cursor: pointer; }
.cote__quitter:hover { text-decoration: underline; }

.principal { margin-left: var(--cote); min-height: 100vh; }
.contenu { max-width: 1320px; padding: 24px 32px 64px; }

/* barre du haut : téléphone et tablette uniquement */
.barre { display: none; }

/* ---------- En-tête de page ---------- */
.entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.entete h1 { font-size: 22px; line-height: 1.2; }
.entete__sous { margin-top: 2px; color: var(--texte-2); font-size: 13px; }
.entete__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 6px 12px;
  border: 1px solid var(--trait-fort); border-radius: var(--r);
  background: var(--fond); color: var(--texte);
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.2;
  cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn--principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--principal:hover { background: var(--accent-survol); border-color: var(--accent-survol); }
.btn--danger { color: var(--depense); }
.btn--danger:hover { background: var(--danger-pale); }
.btn--plein { width: 100%; }
.btn--grand { min-height: 44px; padding: 10px 18px; font-size: 15px; }
.lien-bouton { padding: 0; border: 0; background: none; font: inherit; color: var(--accent); cursor: pointer; }
.lien-bouton:hover { text-decoration: underline; }
.lien-bouton--danger { color: var(--depense); }

/* ---------- Panneaux ---------- */
.panneau { border: 1px solid var(--trait); border-radius: var(--r-panneau); background: var(--fond); }
.panneau__tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--trait); }
.panneau__tete h2 { font-size: 14px; }
.panneau__tete .discret { font-size: 12.5px; }
.panneau__corps { padding: 16px; }
.panneau__vide { padding: 20px 16px; color: var(--texte-2); text-align: center; }
.grille { display: grid; gap: 16px; align-items: start; }
.grille--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grille--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grille--large-etroit { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.pile { display: grid; gap: 16px; align-content: start; }
/* un tableau large (défilant) ne doit jamais élargir toute la colonne */
.grille > *, .pile > * { min-width: 0; }

/* ---------- Chiffres clés ---------- */
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px; margin: 0 0 16px; border: 1px solid var(--trait); border-radius: var(--r-panneau); background: var(--trait); overflow: hidden; }
.chiffres div { padding: 12px 16px; background: var(--fond); }
.chiffres dt { font-size: 12px; color: var(--texte-2); }
.chiffres dd { margin: 2px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.chiffres dd small { font-size: 12px; font-weight: 400; color: var(--texte-2); }

/* ---------- Listes de définitions (infos) ---------- */
.infos { margin: 0; }
.infos div { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--trait); }
.infos div:last-child { border-bottom: 0; }
.infos dt { color: var(--texte-2); }
.infos dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.infos dd .point { white-space: normal; }

/* ---------- Tableaux denses ---------- */
.table-defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 7px 12px; text-align: left; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.table th { font-size: 12px; font-weight: 500; color: var(--texte-2); white-space: nowrap; background: var(--fond); position: sticky; top: 0; z-index: 1; }
.table tbody tr:hover td { background: #FAFAFC; }
.table tbody tr:last-child td { border-bottom: 0; }
.table .montant, .table .nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .action { text-align: right; width: 1%; white-space: nowrap; }
.table tr.est-inactif td { color: var(--texte-3); }
/* fournisseur habituel, sous le nom du produit */
.stock__fournisseur { display: block; font-size: 12px; color: var(--texte-2); }
.table th button { padding: 0; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; }
.table th button::after { content: ""; display: inline-block; width: 8px; margin-left: 3px; }
.table th[aria-sort="ascending"] button::after { content: "▲"; font-size: 8px; }
.table th[aria-sort="descending"] button::after { content: "▼"; font-size: 8px; }

/* montants signés : le signe porte le sens, la couleur ne fait que le doubler */
.recette { color: var(--recette); }
.depense { color: var(--depense); }

/* ---------- Étiquettes ---------- */
.etiquette { display: inline-block; padding: 1px 7px; border-radius: 4px; background: var(--surface-2); color: var(--texte-2); font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.etiquette--accent { background: var(--accent-pale); color: var(--accent); }
.etiquette--ok { background: var(--ok-pale); color: var(--bon); }
.etiquette--alerte { background: var(--alerte-pale); color: var(--alerte); }
.etiquette--danger { background: var(--danger-pale); color: var(--depense); }
.point { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.point::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--bon); }
.point--off::before { background: var(--trait-fort); }

/* ---------- Formulaires ---------- */
.form { display: grid; gap: 12px; }
.champs { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); align-items: end; }
.champ { display: grid; gap: 4px; min-width: 0; }
.champ > span, .champ > label { font-size: 12px; font-weight: 500; color: var(--texte-2); }
.champ--large { grid-column: 1 / -1; }
/* Safari (Mac, iPad) dessine ses propres champs : ombre intérieure, listes
   déroulantes arrondies qui ignorent hauteur et marges, champs date qui
   s'écrasent quand ils sont vides. */
input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"],
input[type="number"], input[type="date"], input[type="search"], select, textarea {
  -webkit-appearance: none; appearance: none;
  width: 100%; min-height: 32px; margin: 0; padding: 5px 9px;
  border: 1px solid var(--trait-fort); border-radius: var(--r);
  background-color: var(--fond); color: var(--texte);
  font: inherit; font-size: 13.5px; line-height: 1.3;
}
select {
  padding-right: 28px; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236E6E73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 10px 6px;
}
input[type="date"] { display: block; min-width: 0; }
input[type="date"]::-webkit-date-and-time-value { min-height: 1.3em; text-align: left; }
input[type="date"]::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; }
input[type="number"] { -moz-appearance: textfield; }
textarea { min-height: 72px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 102, 204, .15); }
input[readonly] { background: var(--surface); color: var(--texte-2); }
.case { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.case input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.aide { font-size: 12px; color: var(--texte-2); }
/* « facultatif », précision glissée dans une étiquette */
label .aide, .champ > span .aide { margin-left: 4px; font-weight: 400; color: var(--texte-3); }
.form__pied { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }

/* ---------- Messages ---------- */
.message { padding: 10px 12px; border-radius: var(--r); background: var(--surface); font-size: 13px; }
.message--alerte { background: var(--alerte-pale); color: #6B3F00; }
.message--erreur { background: var(--danger-pale); color: #8C1D13; }
.message--ok { background: var(--ok-pale); color: #145A2A; }

/* code d'accès affiché une seule fois */
.code-unique { display: grid; gap: 8px; margin-bottom: 16px; padding: 14px 16px; border: 1px solid var(--accent); border-radius: var(--r-panneau); background: var(--accent-pale); }
.code-unique__code { font-family: var(--mono); font-size: 20px; font-weight: 600; letter-spacing: .08em; user-select: all; }

/* ---------- Notifications ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom) + var(--ecran-bas, 0px)); z-index: 60; transform: translateX(-50%); display: grid; gap: 8px; justify-items: center; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto;
  display: flex; align-items: center; gap: 10px;
  max-width: 100%; padding: 9px 10px 9px 14px;
  border-radius: var(--r-panneau);
  background: rgba(29, 29, 31, .94); color: #fff;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.toast--erreur { background: #8C1D13; }
.toast__texte { flex: 1; }
.toast__fermer { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: rgba(255, 255, 255, .7); font-size: 13px; cursor: pointer; }
.toast__fermer:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.toast.est-sortant { opacity: 0; transition: opacity .2s ease; }

/* ---------- Fenêtre de confirmation ---------- */
.confirmation { width: min(400px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--trait); border-radius: var(--r-panneau); box-shadow: 0 20px 50px rgba(0, 0, 0, .2); }
.confirmation::backdrop { background: rgba(0, 0, 0, .3); }
.confirmation__corps { padding: 18px 18px 12px; }
.confirmation__corps h2 { font-size: 15px; margin-bottom: 4px; }
.confirmation__corps p { color: var(--texte-2); }
.confirmation__pied { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }

/* ---------- Connexion ---------- */
.page-connexion { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: var(--surface); }
.connexion { width: min(360px, 100%); }
.connexion__marque { margin-bottom: 20px; text-align: center; font-size: 17px; font-weight: 700; letter-spacing: .02em; }
.connexion__marque span { font-weight: 500; color: var(--texte-2); }
.connexion__carte { padding: 24px; border: 1px solid var(--trait); border-radius: var(--r-panneau); background: var(--fond); }
.connexion__carte h1 { font-size: 17px; }
.connexion__carte > p { margin-top: 4px; color: var(--texte-2); font-size: 13px; }
.connexion__carte form { margin-top: 18px; }
.connexion__code { font-family: var(--mono); font-size: 15px !important; letter-spacing: .06em; text-transform: uppercase; min-height: 40px !important; }
.connexion__pied { margin-top: 14px; text-align: center; font-size: 12px; color: var(--texte-3); }

/* ---------- iPad en portrait : la barre latérale devient une colonne d'icônes
   (on garde la navigation sous le pouce sans perdre la largeur des tableaux) */
@media (min-width: 768px) and (max-width: 1099px) {
  :root { --cote: 84px; }
  .cote__marque { justify-content: center; padding: 18px 4px 14px; font-size: 13px; }
  .cote__marque span { display: none; }
  .nav { padding: 2px 6px; }
  .nav a { flex-direction: column; gap: 4px; padding: 9px 2px; font-size: 11px; line-height: 1.15; text-align: center; }
  .nav a .ic { width: 22px; height: 22px; }
  .nav__titre { height: 1px; margin: 10px 10px; overflow: hidden; background: var(--trait); color: transparent; }
  .cote__compte { padding: 10px 4px 14px; text-align: center; }
  .cote__nom, .cote__role { display: none; }
  .cote__quitter { font-size: 11.5px; }
  .contenu { padding: 20px 24px 56px; }
  .grille--2, .grille--3, .grille--large-etroit { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Téléphone : la barre latérale glisse par-dessus (tiroir) ---------- */
@media (max-width: 767px) {
  .cote { transform: translateX(-100%); transition: transform .2s ease; box-shadow: none; }
  body.nav-ouverte .cote { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .2); }
  .voile { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .25); }
  .principal { margin-left: 0; }
  .barre {
    position: sticky; top: var(--ecran-haut, 0px); z-index: 20;
    display: flex; align-items: center; gap: 10px;
    height: 48px; padding: 0 12px;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--trait);
  }
  .barre__menu { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: var(--r); background: none; color: var(--texte); cursor: pointer; }
  .barre__menu:hover { background: var(--surface); }
  .barre__titre { font-size: 15px; font-weight: 600; }
  .contenu { padding: 16px 16px 48px; }
  .grille--2, .grille--3, .grille--large-etroit { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  .entete h1 { font-size: 19px; }
  .infos div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .chiffres dd { font-size: 19px; }
}
/* écran tactile : cibles de 44 px (recommandation Apple), et 16 px dans les
   champs — en dessous, Safari sur iPhone zoome la page à chaque saisie */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 10px 16px; font-size: 15px; }
  input[type="text"], input[type="password"], input[type="email"], input[type="tel"], input[type="url"],
  input[type="number"], input[type="date"], input[type="search"], select { min-height: 44px; font-size: 16px; }
  textarea { font-size: 16px; }
  .nav a { min-height: 44px; }
  .lien-bouton { min-height: 36px; }
  .table th, .table td { padding-top: 10px; padding-bottom: 10px; }
  .case input { width: 22px; height: 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- Barre de filtres : une ligne d'outils au-dessus des listes ---------- */
/* pas d'étiquette au-dessus de chaque champ : la première option d'une liste
   dit ce qu'elle filtre (« Toutes catégories »), le nom exact est lu par
   les lecteurs d'écran (aria-label) */
.barre-filtres { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.barre-filtres > * { flex: 0 1 auto; width: auto; }
.barre-filtres__recherche { position: relative; flex: 1 1 180px; max-width: 360px; }
.barre-filtres__recherche .ic { position: absolute; left: 10px; top: 50%; margin-top: -8px; color: var(--texte-3); pointer-events: none; }
.barre-filtres__recherche input { padding-left: 32px; }
.barre-filtres select { max-width: 172px; }
.barre-filtres__periode { display: inline-flex; align-items: center; gap: 6px; }
.barre-filtres__periode input { width: 136px; }
.barre-filtres__periode span { color: var(--texte-3); }
.barre-filtres__actions { display: inline-flex; align-items: center; gap: 12px; margin-left: auto; }
.pagination { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.journal__details { color: var(--texte-2); min-width: 260px; }
/* code refusé, blocage, session volée, page refusée : l'action en rouge (le texte dit déjà quoi) */
.journal__action { min-width: 130px; }
.journal__ip { font-size: 11.5px; }
.journal__alerte .journal__action { color: var(--depense); font-weight: 500; }
@media (max-width: 767px) {
  .barre-filtres__recherche { max-width: none; flex-basis: 100%; }
  .barre-filtres select { flex: 1 1 140px; max-width: none; }
  .barre-filtres__periode { flex: 1 1 100%; }
  .barre-filtres__periode input { flex: 1; width: auto; }
  .barre-filtres__actions { margin-left: 0; }
}

/* =========================================================================
   Modules : composants communs
   ========================================================================= */
.message--page { margin-bottom: 16px; }
.fil { margin: 0 0 8px; font-size: 13px; }
.fil a { display: inline-flex; align-items: center; gap: 4px; color: var(--texte-2); }
.fil a:hover { color: var(--accent); text-decoration: none; }
.pile--serree { gap: 10px; }
.grille--serree { gap: 24px; }
.panneau--etroit { max-width: 760px; }
.panneau__note { padding: 0 16px 14px; }
.sous-titre { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--texte-2); }
.montant-grand { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rappels { display: flex; flex-wrap: wrap; gap: 8px; margin: -4px 0 16px; }
.rappels a:hover { text-decoration: none; filter: brightness(.96); }
.etats { white-space: nowrap; }
.etats .etiquette + .etiquette { margin-left: 4px; }
.etiquette .ic { vertical-align: -2px; margin-right: 2px; }
.chiffres--pile { grid-template-columns: minmax(0, 1fr); margin: 0; border: 0; }
.chiffres--pile div { padding: 6px 0; }
.form--ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.form__pied--inverse { flex-direction: row-reverse; justify-content: flex-start; }
.form__pied--inverse .btn:last-child { margin-right: auto; }
input[type="file"] { font: inherit; font-size: 13px; max-width: 100%; }
.saisie-montant { width: 110px !important; text-align: right; font-variant-numeric: tabular-nums; }
.table-defile--haute { max-height: 420px; overflow-y: auto; }
.table--saisie td { padding: 4px 8px; }
.table--saisie select { min-width: 190px; }
.table--saisie input { width: 110px; text-align: right; }
.champ--recherche { width: 260px !important; }

/* sélecteur à deux choix (dépense / recette) */
.segments { display: inline-flex; gap: 2px; margin: 0 0 4px; padding: 2px; border: 0; border-radius: var(--r); background: var(--surface-2); width: max-content; }
.segments label { cursor: pointer; }
.segments input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments span { display: block; padding: 5px 14px; border-radius: 5px; font-size: 13.5px; font-weight: 500; color: var(--texte-2); }
.segments input:checked + span { background: var(--fond); color: var(--texte); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.segments input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

/* volet repliable (actions secondaires) */
.volet { border: 1px solid var(--trait); border-radius: var(--r); }
.volet > summary { padding: 8px 12px; cursor: pointer; font-weight: 500; list-style: none; }
.volet > summary::-webkit-details-marker { display: none; }
.volet > summary::before { content: "\203A"; display: inline-block; width: 14px; color: var(--texte-3); transition: transform .15s ease; }
.volet[open] > summary::before { transform: rotate(90deg); }
.volet > form, .volet > div { padding: 4px 12px 12px; }
.volet--panneau { margin: 0; border: 0; border-top: 1px solid var(--trait); border-radius: 0; }
.volet--panneau > summary { padding: 10px 16px; font-size: 13px; color: var(--accent); }
.volet--panneau > form, .volet--panneau > div { padding: 4px 16px 16px; }

/* listes simples : libellé à gauche, montant à droite */
.liste-liens { list-style: none; margin: 0; padding: 0; }
.liste-liens li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 16px; border-top: 1px solid var(--trait); }
.liste-liens li:first-child { border-top: 0; }
.liste-liens li.est-inactif, .liste-liens li.est-inactif a { color: var(--texte-3); }

/* jauge (budget, versements reçus) */
.jauge { display: inline-flex; align-items: center; gap: 8px; width: 100%; min-width: 120px; }
.jauge svg { flex: 1; height: 6px; }
.jauge .num { font-size: 12px; color: var(--texte-2); min-width: 38px; text-align: right; }
.jauge__fond { fill: var(--surface-2); }
.jauge__plein { fill: var(--serie-recette); }
.jauge--alerte .jauge__plein { fill: var(--serie-depense); }
.jauge--large { margin-top: 12px; }
.budget__jauge-col { width: 28%; }

/* ---------- Caisse : sessions ---------- */
.sessions { list-style: none; margin: 0; padding: 0; }
.session { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-top: 1px solid var(--trait); }
.session:first-child { border-top: 0; }
.session__infos { flex: 1; min-width: 0; display: grid; gap: 2px; }
.session__infos .discret { font-size: 12.5px; }
.session__total { display: grid; justify-items: end; font-weight: 600; }
.session__actions { display: flex; gap: 6px; }
.ecart { padding: 8px 12px; border-radius: var(--r); background: var(--surface); font-weight: 600; font-variant-numeric: tabular-nums; }
.ecart--manque { background: var(--danger-pale); color: #8C1D13; }
.ecart--trop { background: var(--alerte-pale); color: #6B3F00; }
.ecart--juste { background: var(--ok-pale); color: #145A2A; }

/* ---------- Partenaires (liste dense) ---------- */
.partenaire { display: flex; align-items: center; gap: 10px; }
.partenaire > span { display: grid; }
.logo-actuel img { object-fit: contain; border-radius: 8px; background: var(--fond); border: 1px solid var(--trait); }
.notes { line-height: 1.55; }
.logo-actuel { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }

/* =========================================================================
   Écran de caisse
   Téléphone : tuiles, puis panier résumé collé en bas (une main).
   iPad (768 px et plus) : tuiles à gauche, panier détaillé à droite,
   « Encaisser » en bas à droite, sous le pouce. Pas de survol : tout se
   fait au toucher, cibles de 44 px au moins.
   ========================================================================= */
.page-caisse { background: var(--surface); overscroll-behavior: none; }
.pos { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; background: var(--surface); }
.pos__principal { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pos__tete { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 12px; padding-top: calc(6px + env(safe-area-inset-top)); background: rgba(255, 255, 255, .94); -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--trait); }
.pos__retour { display: grid; place-items: center; width: 44px; height: 44px; border-radius: var(--r); color: var(--texte); }
.pos__retour:hover { background: var(--surface); }
.pos__session { flex: 1; min-width: 0; display: grid; line-height: 1.25; }
.pos__session strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.pos__session span { font-size: 12.5px; color: var(--texte-2); }
.pos__cloturer { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; border-radius: var(--r); font-size: 15px; font-weight: 500; }
.pos__cloturer:hover { background: var(--surface); text-decoration: none; }
.pos__compteurs { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 1px; margin: 0; background: var(--trait); border-bottom: 1px solid var(--trait); }
.pos__compteurs div { padding: 8px 12px; background: var(--fond); }
.pos__compteurs dt { font-size: 12px; color: var(--texte-2); }
.pos__compteurs dd { margin: 0; font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.pos__bandeau { margin: 0; padding: 10px 12px; background: var(--alerte-pale); color: #6B3F00; font-size: 14px; }
.pos__bandeau--grave { background: var(--danger-pale); color: #8C1D13; font-weight: 500; }
.pos__grille { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 10px; align-content: start; }
@media (min-width: 480px) { .pos__grille { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.tuile { position: relative; }
.tuile__ajouter {
  width: 100%; min-height: 108px; padding: 12px 12px 10px;
  display: grid; align-content: space-between; justify-items: start; gap: 2px;
  border: 1px solid var(--trait); border-radius: var(--r-panneau);
  background: var(--fond); color: var(--texte); font: inherit; text-align: left;
  cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  transition: transform .06s ease, border-color .12s ease;
}
.tuile__ajouter:active { transform: scale(.97); background: var(--surface); }
.tuile--choisie .tuile__ajouter { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tuile__emoji { font-size: 24px; line-height: 1; }
.tuile__nom { padding-right: 30px; font-size: 15px; font-weight: 600; line-height: 1.2; }
.tuile__prix { font-size: 15px; font-variant-numeric: tabular-nums; }
.tuile__stock { font-size: 12px; color: var(--texte-3); }
.tuile--epuise .tuile__stock { color: var(--depense); font-weight: 600; }
.tuile__qte { position: absolute; top: 8px; right: 8px; min-width: 28px; height: 28px; padding: 0 8px; display: grid; place-items: center; border-radius: 14px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; }
.tuile__retirer { position: absolute; right: 6px; bottom: 6px; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 1px solid var(--trait-fort); border-radius: 22px; background: var(--fond); color: var(--texte); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.tuile__retirer:active { background: var(--surface-2); }

/* panier : résumé en bas sur téléphone */
.pos__pied { position: sticky; bottom: 0; z-index: 5; display: grid; gap: 8px; padding: 10px 12px; padding-bottom: calc(10px + env(safe-area-inset-bottom)); background: var(--fond); border-top: 1px solid var(--trait); box-shadow: 0 -6px 20px rgba(0, 0, 0, .05); }
.pos__titre-panier, .pos__lignes { display: none; }
.pos__derniere, .pos__panier { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.pos__derniere { color: var(--texte-2); }
.pos__derniere .lien-bouton, .pos__panier .lien-bouton { min-height: 36px; font-size: 14px; }
.pos__panier { font-weight: 500; }
.pos__moyens { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; padding: 2px; border-radius: var(--r); background: var(--surface-2); }
.pos__moyens button { min-height: 44px; padding: 4px; border: 0; border-radius: 5px; background: transparent; color: var(--texte-2); font: inherit; font-size: 15px; font-weight: 500; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pos__moyens button[aria-checked="true"] { background: var(--fond); color: var(--texte); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
/* « Lydia / virement » passe sur deux lignes dans un bouton d'un tiers de
   largeur : le bouton dit « Lydia », le nom complet reste lu (aria-label) */
.pos__moyen-suite { display: none; }
.pos__encaisser { min-height: 56px; border: 0; border-radius: var(--r-panneau); background: var(--accent); color: #fff; font: inherit; font-size: 18px; font-weight: 600; cursor: pointer; touch-action: manipulation; font-variant-numeric: tabular-nums; -webkit-tap-highlight-color: transparent; }
.pos__encaisser:active { background: var(--accent-survol); }
.pos__encaisser:disabled { background: var(--surface-2); color: var(--texte-3); cursor: default; }
.page-caisse .toasts { bottom: calc(220px + env(safe-area-inset-bottom)); }

/* iPad : deux colonnes, chaque colonne défile seule, le panier reste en place */
@media (min-width: 768px) {
  .pos { display: grid; grid-template-columns: minmax(0, 1fr) 340px; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
  .pos__principal { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .pos__grille { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px; }
  .tuile__ajouter { min-height: 124px; padding: 14px 14px 12px; }
  .tuile__nom { font-size: 16px; }
  .tuile__prix { font-size: 16px; }
  .pos__compteurs div { padding: 10px 16px; }
  .pos__compteurs dd { font-size: 22px; }
  .pos__tete { padding-left: 8px; padding-right: 12px; }

  .pos__pied {
    position: static; display: flex; flex-direction: column; gap: 10px; min-height: 0;
    padding: 0 16px 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom));
    border-top: 0; border-left: 1px solid var(--trait); box-shadow: none;
  }
  .pos__titre-panier {
    display: flex; align-items: center; min-height: 52px; margin: 0 -16px; padding: 6px 16px; padding-top: calc(6px + env(safe-area-inset-top));
    border-bottom: 1px solid var(--trait); font-size: 16px;
  }
  .pos__lignes { display: block; flex: 1; min-height: 0; margin: 0 -16px; padding: 0; list-style: none; overflow-y: auto; }
  /* le nom sur sa ligne, puis quantité à gauche et total à droite : un nom
     long (« Coca-Cola 33 cl ») reste lisible dans une colonne étroite */
  .pos__ligne {
    display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "nom nom" "quantite total";
    align-items: center; gap: 2px 8px; padding: 8px 16px; border-bottom: 1px solid var(--trait); font-size: 15px;
  }
  .pos__ligne-nom { grid-area: nom; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
  .pos__ligne-quantite { grid-area: quantite; }
  .pos__ligne-total { grid-area: total; }
  .pos__ligne-quantite { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-variant-numeric: tabular-nums; }
  .pos__ligne-quantite span { min-width: 26px; text-align: center; }
  .pos__ligne-quantite button { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 22px; background: var(--surface); color: var(--texte); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .pos__ligne-quantite button:active { background: var(--surface-2); }
  .pos__ligne-total { text-align: right; font-variant-numeric: tabular-nums; }
  .pos__lignes-vide { padding: 28px 16px; text-align: center; color: var(--texte-3); font-size: 14px; }
  .pos__panier { font-size: 15px; }
  .pos__derniere { padding-top: 8px; border-top: 1px solid var(--trait); }
  .page-caisse .toasts { left: calc((100% - 340px) / 2); bottom: calc(20px + env(safe-area-inset-bottom)); }
}
/* iPad en paysage, MacBook : un panier plus large */
@media (min-width: 1100px) {
  .pos { grid-template-columns: minmax(0, 1fr) 380px; }
  .pos__grille { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
  .page-caisse .toasts { left: calc((100% - 380px) / 2); }
}

/* =========================================================================
   Tableau de bord
   ========================================================================= */
.bilan { display: grid; grid-template-columns: minmax(240px, .8fr) minmax(0, 2fr); gap: 1px; margin-bottom: 16px; border: 1px solid var(--trait); border-radius: var(--r-panneau); background: var(--trait); overflow: hidden; }
.bilan__solde { padding: 18px 20px; background: var(--fond); }
.bilan__titre { font-size: 12.5px; color: var(--texte-2); }
.bilan__valeur { margin: 2px 0 8px; font-size: 44px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.statut { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 4px; font-size: 12.5px; font-weight: 600; }
.statut--bon { background: var(--ok-pale); color: var(--bon); }
.statut--critique { background: var(--danger-pale); color: var(--depense); }
.bilan__mois { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1px; margin: 0; background: var(--trait); }
.bilan__mois > div { padding: 18px 20px; background: var(--fond); }
.bilan__mois dt { font-size: 12.5px; color: var(--texte-2); }
.bilan__mois dd { margin: 4px 0 0; font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.bilan__mois dd.bilan__delta { margin-top: 2px; font-size: 12px; font-weight: 500; color: var(--texte-2); letter-spacing: 0; }
.bilan__delta.hausse::before { content: "\25B2  "; font-size: 9px; color: var(--bon); }
.bilan__delta.baisse::before { content: "\25BC  "; font-size: 9px; color: var(--depense); }
.panneau--direct { margin-bottom: 16px; }
.direct { display: inline-block; width: 8px; height: 8px; margin-right: 8px; border-radius: 50%; background: var(--bon); box-shadow: 0 0 0 3px var(--ok-pale); vertical-align: 1px; }

.legende { display: flex; flex-wrap: wrap; gap: 4px 16px; list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
.legende li { display: inline-flex; align-items: center; gap: 6px; }
.legende__marque { width: 10px; height: 10px; border-radius: 2px; }
.legende__marque--recette { background: var(--serie-recette); }
.legende__marque--depense { background: var(--serie-depense); }

.graphique { position: relative; padding: 12px 12px 8px; }
.graphique__cadre { overflow-x: auto; }
.graphique__svg { display: block; width: 100%; min-width: 540px; height: auto; font-family: var(--police); }
.graphique__vide { padding: 28px 8px; text-align: center; color: var(--texte-2); }
.graphique__grille { stroke: var(--grille); stroke-width: 1; shape-rendering: crispEdges; }
.graphique__axe { stroke: var(--axe); stroke-width: 1; shape-rendering: crispEdges; }
.graphique__graduation { fill: var(--texte-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.graphique__etiquette { fill: var(--texte); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.graphique__recette { fill: var(--serie-recette); }
.graphique__depense { fill: var(--serie-depense); }
.graphique__ligne { fill: none; stroke: var(--texte); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphique__aire--positif { fill: var(--serie-recette); fill-opacity: .1; }
.graphique__aire--negatif { fill: var(--serie-depense); fill-opacity: .12; }
.graphique__point, .graphique__curseur { fill: var(--texte); stroke: var(--fond); stroke-width: 2; }
.graphique__zone { fill: transparent; cursor: crosshair; }
.graphique__repere { stroke: var(--axe); stroke-width: 1; opacity: 0; pointer-events: none; }
.graphique__curseur { opacity: 0; pointer-events: none; }
.graphique__repere.est-visible, .graphique__curseur.est-visible { opacity: 1; }
.graphique__bulle { position: absolute; z-index: 3; min-width: 150px; padding: 8px 10px; border-radius: var(--r); background: rgba(29, 29, 31, .94); color: #fff; font-size: 12.5px; line-height: 1.5; font-variant-numeric: tabular-nums; pointer-events: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.graphique__bulle strong { display: block; font-weight: 600; }

.barres { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.barres li { display: grid; grid-template-columns: minmax(90px, 140px) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 13px; }
.barres__nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barres__svg { width: 100%; height: 8px; }
.barres--recette .barres__barre { fill: var(--serie-recette); }
.barres--depense .barres__barre { fill: var(--serie-depense); }
.barres__valeur { font-weight: 500; text-align: right; min-width: 80px; }

.alertes, .entrees { list-style: none; margin: 0; padding: 0; }
.alertes li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 9px 16px; border-top: 1px solid var(--trait); }
.alertes li:first-child, .entrees li:first-child { border-top: 0; }
.alertes .ic { color: var(--alerte); }
.alertes .discret { font-size: 12.5px; }
.entrees li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 16px; border-top: 1px solid var(--trait); }
.entrees__texte { display: grid; min-width: 0; }
.entrees__texte a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entrees__montant { font-weight: 600; }
.entrees li.est-inactif, .entrees li.est-inactif a { color: var(--texte-3); }

@media (max-width: 1099px) {
  .bilan { grid-template-columns: minmax(0, 1fr); }
  .bilan__valeur { font-size: 40px; }
}
@media (max-width: 767px) {
  .session { flex-wrap: wrap; }
  .session__actions { width: 100%; }
  .session__actions .btn { flex: 1; }
  .barres li { grid-template-columns: minmax(80px, 110px) minmax(0, 1fr) auto; }
  .champ--recherche { width: 100% !important; }
}

/* =========================================================================
   Outils communs des listes : filtres par statut, bascule fiches / liste
   ========================================================================= */
.outils-liste { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 12px; }
.outils-liste .barre-filtres { margin-bottom: 0; }
.barre-filtres--seule { flex: 1 1 320px; }
.barre-filtres--seule .barre-filtres__recherche { max-width: 420px; }
.bascule { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--r); background: var(--surface-2); }
.bascule a { display: inline-flex; align-items: center; min-height: 28px; padding: 0 14px; border-radius: 5px; color: var(--texte-2); font-size: 13px; font-weight: 500; }
.bascule a:hover { color: var(--texte); text-decoration: none; }
.bascule a[aria-current="page"] { background: var(--fond); color: var(--texte); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.puces-statut { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.outils-liste .puces-statut { margin-bottom: 0; }
.puces-statut a { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 12px; border: 1px solid var(--trait); border-radius: 999px; background: var(--fond); color: var(--texte); font-size: 13px; }
.puces-statut a:hover { border-color: var(--trait-fort); text-decoration: none; }
.puces-statut a span { color: var(--texte-3); font-variant-numeric: tabular-nums; }
.puces-statut a[aria-current="page"] { border-color: var(--texte); background: var(--texte); color: #fff; }
.puces-statut a[aria-current="page"] span { color: rgba(255, 255, 255, .7); }
.nav__pastille { min-width: 20px; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; }

/* =========================================================================
   Partenaires : fiches
   ========================================================================= */
.avatar-partenaire { flex: none; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--trait); background: var(--fond); object-fit: contain; }
.table .avatar-partenaire { width: 24px; height: 24px; border-radius: 5px; }
.avatar-partenaire--initiales { display: grid; place-items: center; background: var(--surface-2); color: var(--texte-2); font-size: 15px; font-weight: 700; letter-spacing: .02em; }
.table .avatar-partenaire--initiales { font-size: 10px; }

.cartes-partenaires { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.carte-partenaire {
  height: 100%; display: flex; flex-direction: column; gap: 10px; padding: 16px;
  border: 1px solid var(--trait); border-radius: var(--r-panneau); background: var(--fond); color: var(--texte);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.carte-partenaire:hover { border-color: var(--trait-fort); box-shadow: 0 4px 16px rgba(0, 0, 0, .06); text-decoration: none; }
.carte-partenaire:active { background: var(--surface); }
.carte-partenaire.est-inactif { opacity: .6; }
.carte-partenaire__tete { display: flex; align-items: center; gap: 12px; min-width: 0; }
.carte-partenaire__nom { display: grid; min-width: 0; }
.carte-partenaire__nom strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-partenaire__nom span { font-size: 12.5px; color: var(--texte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.carte-partenaire__etats { display: flex; flex-wrap: wrap; gap: 4px; }
.carte-partenaire__objet { flex: 1; color: var(--texte); font-size: 13.5px; line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.carte-partenaire__objet.est-vide { color: var(--texte-3); font-style: italic; }
.carte-partenaire__budget { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding-top: 10px; border-top: 1px solid var(--trait); font-size: 12.5px; color: var(--texte-2); }
.carte-partenaire__budget strong { color: var(--texte); font-weight: 600; }
.carte-partenaire__budget .jauge { flex: 1 1 100%; min-width: 0; }
.carte-partenaire__contact { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--texte-2); min-width: 0; }
.carte-partenaire__contact span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* fiche en lecture */
.fiche-tete { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.fiche-tete__logo { flex: none; width: 72px; height: 72px; border-radius: 14px; border: 1px solid var(--trait); background: var(--fond); object-fit: contain; }
.fiche-tete__logo--initiales { display: grid; place-items: center; background: var(--surface-2); color: var(--texte-2); font-size: 24px; font-weight: 700; }
.fiche-tete__identite { flex: 1; min-width: 220px; display: grid; gap: 4px; }
.fiche-tete__identite h1 { font-size: 24px; line-height: 1.15; }
.fiche-tete__raison { color: var(--texte-2); font-size: 13.5px; }
.fiche-tete__etats { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.fiche-tete__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.fiche-tete__actions select { width: auto; }
.fiche-objet { font-size: 15px; line-height: 1.5; }
.fiche-objet.est-vide { color: var(--texte-3); font-style: italic; }
.fiche-trace { padding: 0 4px; }
.contacts { list-style: none; margin: 0; padding: 0; }
.contact { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--trait); }
.contact:first-child { border-top: 0; }
.contact__avatar { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-pale); color: var(--accent); font-size: 13px; font-weight: 700; }
.contact__texte { flex: 1; min-width: 0; display: grid; gap: 1px; }
.contact__texte .discret { font-size: 12.5px; }
.contact__liens { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; }
.formulaire-fiche .panneau__corps.champs { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form__pied--collant { position: sticky; bottom: var(--ecran-bas, 0px); z-index: 4; margin: 0 -4px; padding: 12px 4px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(rgba(255, 255, 255, 0), var(--fond) 30%); }

/* =========================================================================
   Messages : liste à gauche, message à droite
   ========================================================================= */
.boite { display: grid; grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); gap: 16px; align-items: start; }
.boite__liste { max-height: calc(100vh - 230px); max-height: calc(100dvh - 230px); overflow-y: auto; }
.boite__liste ul { list-style: none; margin: 0; padding: 0; }
.boite__liste li + li { border-top: 1px solid var(--trait); }
.apercu { position: relative; display: grid; gap: 3px; padding: 12px 16px 12px 26px; color: var(--texte); }
.apercu:hover { background: #FAFAFC; text-decoration: none; }
.apercu[aria-current="true"] { background: var(--accent-pale); }
.apercu--nouveau::before { content: ""; position: absolute; left: 10px; top: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.apercu__ligne { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.apercu__nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 500; }
.apercu--nouveau .apercu__nom { font-weight: 700; }
.apercu__date { flex: none; font-size: 12px; color: var(--texte-3); }
.apercu__sujet { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--texte-2); }
.apercu__extrait { font-size: 12.5px; color: var(--texte-3); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.boite__message { padding: 20px 24px 24px; min-height: 320px; }
.boite__vide { padding: 80px 16px; text-align: center; color: var(--texte-3); }
.boite__retour { display: none; align-items: center; gap: 4px; margin-bottom: 12px; font-size: 13px; color: var(--texte-2); }
.message-tete { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--trait); }
.message-tete__qui { display: flex; align-items: center; gap: 12px; min-width: 0; }
.message-tete__qui h2 { font-size: 17px; }
.message-tete__qui p { font-size: 13px; color: var(--texte-2); overflow-wrap: anywhere; }
.message-tete__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.message-corps { padding: 20px 0; font-size: 15px; line-height: 1.6; overflow-wrap: anywhere; }
.message-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 16px 0; border-top: 1px solid var(--trait); }
.message-actions .aide { flex: 1 1 100%; }
.message-suivi { padding-top: 16px; border-top: 1px solid var(--trait); }
.message-suivi .form__pied .aide { margin-right: auto; }

/* sous 1100 px : la liste OU le message, jamais les deux côte à côte */
@media (max-width: 1099px) {
  .boite { grid-template-columns: minmax(0, 1fr); }
  .boite__liste { max-height: none; }
  .boite--ouverte .boite__liste { display: none; }
  .boite:not(.boite--ouverte) .boite__message { display: none; }
  .boite__retour { display: inline-flex; }
}
@media (max-width: 767px) {
  .boite__message { padding: 16px; }
  .fiche-tete__logo { width: 56px; height: 56px; }
  .fiche-tete__identite h1 { font-size: 20px; }
  .cartes-partenaires { grid-template-columns: minmax(0, 1fr); }
}
@media (pointer: coarse) {
  .bascule a, .puces-statut a { min-height: 40px; }
  .apercu { padding-top: 14px; padding-bottom: 14px; }
}

/* ---------- Entrées et sorties de stock ---------- */
.panneau__pied { padding: 10px 16px; border-top: 1px solid var(--trait); font-size: 13px; }
.lien-suite { font-size: 13px; }
.panneau__tete .bascule a { min-height: 26px; padding: 0 10px; font-size: 12.5px; }
.mouvement__detail { min-width: 180px; }
/* les en-têtes de ligne d'un pied de tableau ne collent pas en haut de l'écran */
.table tfoot th { position: static; background: none; }
.table--flux tfoot th, .table--flux tfoot td { border-bottom: 0; }
.table--flux tfoot tr:first-child th, .table--flux tfoot tr:first-child td { border-top: 1px solid var(--trait-fort); }
.table--flux tfoot th { color: var(--texte); font-size: 13px; font-weight: 500; }
@media (pointer: coarse) {
  .panneau__tete .bascule a { min-height: 36px; }
}

/* ---------- Caisse : ventes restées sur l'appareil ---------- */
.files-caisse { display: grid; gap: 8px; margin-bottom: 16px; }
.message .lien-bouton { font-size: inherit; text-decoration: underline; }
.message a { color: inherit; text-decoration: underline; font-weight: 600; }

/* formulaire envoyé : un second appui ne repart pas (crm.js) */
form.est-en-cours button[type="submit"] { opacity: .55; cursor: progress; }

/* ---------- Chargement ----------
   Réseau lent : la page arrive par morceaux (panneaux vides, graphiques à
   moitié dessinés). Tant qu'elle n'est pas complète (<html class="attente">),
   une barre défile en haut et un indicateur remplace le contenu ; crm.js
   retire la classe dès que la page est entière. Sans script, tout réapparaît
   de soi-même au bout de 8 s. Page rapide : ni barre ni indicateur (délai).
   En quittant une page (lien, formulaire), la barre revient (« navigation »)
   et l'ancienne page pâlit : on voit que la suivante arrive. */
.chargement { position: fixed; inset: 0 0 auto 0; z-index: 90; height: 3px; overflow: hidden; pointer-events: none; visibility: hidden; }
.chargement::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 35%; background: var(--accent); animation: chargement-barre 1.1s ease-in-out infinite; }
html.attente .chargement { animation: chargement-montre 0s .25s both, chargement-cache 0s 8s forwards; }
html.navigation .chargement { animation: chargement-montre 0s .15s both; }
html.attente .contenu, html.attente .pos { visibility: hidden; animation: chargement-montre 0s 8s forwards; }
html.navigation .contenu, html.navigation .pos { opacity: .55; transition: opacity .2s .25s; }
html.attente .principal::after, html.attente body.page-caisse::after {
  content: ""; position: absolute; top: 160px; left: 50%; width: 26px; height: 26px; margin-left: -13px;
  border: 2.5px solid var(--trait); border-top-color: var(--accent); border-radius: 50%;
  animation: chargement-tour .8s linear infinite, chargement-montre 0s .25s both, chargement-cache 0s 8s forwards;
}
html.attente body.page-caisse::after { position: fixed; }
.principal { position: relative; }
@keyframes chargement-barre { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
@keyframes chargement-tour { to { transform: rotate(360deg); } }
@keyframes chargement-montre { from { visibility: hidden; } to { visibility: visible; } }
@keyframes chargement-cache { to { visibility: hidden; } }
/* sans animations, rien ne réapparaîtrait seul : on ne cache rien */
@media (prefers-reduced-motion: reduce) {
  html.attente .contenu, html.attente .pos { visibility: visible; }
  html.attente .principal::after, html.attente body.page-caisse::after { display: none; }
}

/* ---------- Caisse : planning, personnes à la caisse, corrections ---------- */
.pos__session .pos__vendeurs { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; color: var(--texte-2); }
.choix-vendeurs { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
.choix-vendeurs legend { margin-bottom: 6px; padding: 0; font-size: 12px; font-weight: 500; color: var(--texte-2); }
.choix-vendeurs__comptes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.case--carte { padding: 8px 10px; border: 1px solid var(--trait); border-radius: var(--r); background: var(--fond); }
.case--carte:has(input:checked) { border-color: var(--accent); background: var(--accent-pale); }
.case--carte .aide { display: block; }
.creneaux-prochains { list-style: none; margin: 0; padding: 0; }
.creneaux-prochains li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 9px 16px; border-bottom: 1px solid var(--trait); }
.creneaux-prochains li:last-child { border-bottom: 0; }
.creneaux-prochains__quand { min-width: 170px; font-variant-numeric: tabular-nums; font-weight: 500; }
.actions-ligne { display: inline-flex; gap: 12px; align-items: center; }
.actions-ligne form { display: inline; }
.session__infos .etiquette { margin-left: 6px; }
.ligne-correction { display: grid; grid-template-columns: minmax(0, 1fr) 110px; gap: 8px; }

/* ---------- Pré-budget ---------- */
.prebudget__quoi { min-width: 240px; }
.prebudget__quoi strong { display: block; font-weight: 600; }
.prebudget__quoi .aide { display: block; }
.prebudget__note { color: var(--texte-2); }
.table--prebudget td { vertical-align: top; }
.table--prebudget .montant .aide, .table--prebudget td > .aide { display: block; }
.prebudget__actions { display: grid; gap: 6px; justify-items: end; }
.prebudget__decision { display: grid; gap: 6px; min-width: 210px; }
.prebudget__decision input { min-height: 30px; font-size: 13px; }
