/* Horizon Comptes — feuille unique, mobile d'abord.
   Palette reprise des bons de livraison Horizon Market : teal, blanc,
   rouge-orangé pour ce qui reste dû, vert pour ce qui est encaissé. */

:root {
  --teal: #1b7a8c;
  --teal-fonce: #14606f;
  --teal-clair: #eaf4f6;
  --accent: #e2543a;
  --accent-clair: #fdeeea;
  --ok: #1a7f37;
  --ok-clair: #e9f5ec;
  --orange: #b8730c;
  --orange-clair: #fdf2e0;
  --bg: #f5f7f8;
  --carte: #ffffff;
  --encre: #16262b;
  --gris: #5d6b70;
  --trait: #dde5e8;
  /* Variantes foncées réservées au TEXTE. Le rouge et l'orange de la marque
     passent le contraste AA en gros caractères seulement (3,77:1 et 3,45:1) :
     en dessous de 24 px il faut ces versions-ci, sinon le père lit mal le
     chiffre qui compte le plus, le solde dû. */
  --accent-texte: #cc3f26;
  --orange-texte: #965d09;
  /* Contour des champs et boutons. `--trait` (1,28:1) convient à une séparation
     de liste, pas à la bordure d'un contrôle : WCAG demande 3:1 pour qu'on voie
     où commence la zone de saisie. */
  --trait-controle: #7a9199;
  --rayon: 12px;
  --nav-h: 62px;
  --ombre: 0 1px 2px rgba(22, 38, 43, 0.06), 0 2px 8px rgba(22, 38, 43, 0.05);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  /* Sans ça, iOS garde 300 ms avant de déclencher un tap (au cas où ce serait
     un double-tap de zoom) : l'app paraît lente à chaque appui. */
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(27, 122, 140, 0.18);
}

/* Un titre ne doit pas laisser un mot seul sur la dernière ligne. */
h1,
h2,
.fiche-nom,
.entete-titre {
  text-wrap: balance;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--encre);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  font-size: 17px;
  line-height: 1.45;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}

body.page-nue {
  padding-bottom: 0;
}

a {
  color: var(--teal-fonce);
}

:focus-visible {
  outline: 3px solid var(--teal);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Barre haute ---------- */

.entete {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--teal);
  color: #fff;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
}

.entete-titre {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.entete-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.entete-form {
  margin: 0;
}

.entete-lien {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  color: #fff;
  font-size: 15px;
  text-decoration: none;
  border-radius: 8px;
}

.entete-lien:hover {
  background: rgba(255, 255, 255, 0.14);
}

.entete-bouton {
  border: 0;
  background: none;
  font: inherit;
  cursor: pointer;
}

.sous-entete {
  background: var(--carte);
  border-bottom: 1px solid var(--trait);
  padding: 12px 16px;
}

.contenu {
  padding: 16px;
  max-width: 900px;
  margin: 0 auto;
}

/* ---------- Cartes et chiffres ---------- */

.card {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 16px;
}

/* Le chiffre principal prend toute la largeur, les deux autres se partagent
   la ligne suivante : sur iPhone les derniers mouvements restent visibles
   sans faire défiler. */
.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  border-left: 5px solid var(--teal);
}

.stat-large {
  grid-column: 1 / -1;
}

.stat-compact {
  padding: 14px;
}

.stat-compact .stat-label,
.stat-compact .stat-note {
  font-size: 13px;
}

.stat-compact .stat-valeur {
  font-size: 25px;
}

.stat-label {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gris);
}

.stat-valeur {
  margin: 4px 0 0;
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.stat-note {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--gris);
}

.stat-du {
  border-left-color: var(--accent);
}
.stat-du .stat-valeur {
  color: var(--accent);
}

.stat-ok {
  border-left-color: var(--ok);
}
.stat-ok .stat-valeur {
  color: var(--ok);
}

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--trait-controle);
  border-radius: var(--rayon);
  background: var(--carte);
  color: var(--encre);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.btn-primary:hover {
  background: var(--teal-fonce);
}

.btn-danger {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-lg {
  width: 100%;
  min-height: 54px;
  font-size: 18px;
}

.btn-geant {
  width: 100%;
  min-height: 64px;
  font-size: 20px;
  margin-bottom: 20px;
}

/* ---------- Formulaires ---------- */

.label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gris);
}

.champ {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--trait-controle);
  border-radius: var(--rayon);
  background: var(--carte);
  color: var(--encre);
  font: inherit;
}

/* 17px minimum : en dessous, iOS zoome sur le champ au focus. */
.champ-lg {
  font-size: 20px;
  min-height: 56px;
}

.champ:focus {
  border-color: var(--teal);
}

.alerte {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--rayon);
  background: var(--accent-clair);
  color: #8c2d18;
  font-weight: 600;
}

/* ---------- Login ---------- */

.login {
  max-width: 380px;
  margin: 0 auto;
  padding: 48px 20px calc(env(safe-area-inset-bottom) + 24px);
}

.login-marque {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
  border-radius: 18px;
  background: var(--teal);
  color: #fff;
  font-size: 30px;
  font-weight: 700;
}

.login-nom {
  margin: 12px 0 0;
  font-size: 20px;
  font-weight: 700;
}

.login-form {
  display: grid;
  gap: 14px;
}

/* ---------- Blocs et listes ---------- */

.bloc {
  margin-bottom: 20px;
}

.bloc-titre {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gris);
}

.vide {
  margin: 0;
  padding: 24px 16px;
  background: var(--carte);
  border: 1px dashed var(--trait);
  border-radius: var(--rayon);
  color: var(--gris);
  text-align: center;
}

.mouvements {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  overflow: hidden;
}

.mouvement + .mouvement {
  border-top: 1px solid var(--trait);
}

.mouvement-lien {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 14px;
  color: inherit;
  text-decoration: none;
}

.mouvement-lien:hover {
  background: var(--teal-clair);
}

.mouvement-date {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--gris);
  font-variant-numeric: tabular-nums;
}

.mouvement-texte {
  flex: 1 1 auto;
  min-width: 0;
}

.mouvement-client {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mouvement-libelle {
  display: block;
  font-size: 14px;
  color: var(--gris);
}

.mouvement-montant {
  flex: 0 0 auto;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.montant-du {
  color: var(--encre);
}

.montant-ok {
  color: var(--ok);
}

/* ---------- Badges de statut ---------- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: var(--teal-clair);
  color: var(--teal-fonce);
  white-space: nowrap;
}

.badge-impaye {
  background: var(--accent-clair);
  color: #8c2d18;
}

.badge-partiel {
  background: var(--orange-clair);
  color: var(--orange-texte);
}

.badge-solde {
  background: var(--ok-clair);
  color: var(--ok);
}

/* ---------- Tableaux ---------- */

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

th,
td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--trait);
  white-space: nowrap;
}

th {
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

td.montant,
th.montant {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

tbody tr:last-child td {
  border-bottom: 0;
}

/* Tableaux de chiffres en mode carte sur téléphone.
   Un tableau à huit colonnes ne rentre pas dans 390 px : en le laissant tel
   quel, le père voyait le nom du client mais devait faire défiler de côté pour
   lire le solde dû, c'est-à-dire la seule colonne qui l'intéresse. Chaque
   ligne devient un bloc, et l'intitulé de colonne passe devant la valeur. */
@media (max-width: 899px) {
  /* `table.` : `.balance` et `.lignes-table` imposent une largeur minimale et
     sont déclarés plus bas dans la feuille — à spécificité égale, ils
     gagneraient et les montants resteraient hors écran. */
  table.table-cartes {
    min-width: 0;
  }

  .table-cartes thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  /* Colonne flex plutôt que bloc : le nom du client remonte en tête de carte
     quelle que soit sa position dans le tableau d'origine. */
  .table-cartes tr {
    display: flex;
    flex-direction: column;
    padding: 12px 14px;
    border-bottom: 1px solid var(--trait);
  }

  .table-cartes .cellule-titre {
    order: -1;
  }

  .table-cartes tbody tr:last-child {
    border-bottom: 0;
  }

  .table-cartes td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 3px 0;
    border-bottom: 0;
    white-space: normal;
    text-align: right;
  }

  .table-cartes td::before {
    content: attr(data-label);
    flex: 0 0 auto;
    color: var(--gris);
    font-size: 14px;
    font-weight: 600;
    text-align: left;
  }

  /* La première cellule sert de titre de carte : pas d'intitulé devant elle.
     Vaut aussi pour le `th` de la ligne de total. */
  .table-cartes td.cellule-titre,
  .table-cartes th.cellule-titre {
    display: block;
    margin-bottom: 6px;
    font-size: 17px;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
  }

  /* Annule le fond teal de l'en-tête, mais seulement pour un `th` promu en
     titre de carte : un `td` doit garder le fond de sa ligne. */
  .table-cartes th.cellule-titre {
    background: none;
  }

  /* Le liseré de la ligne d'ouverture couvre la carte entière, pas deux
     cellules sur quatre. */
  .table-cartes tr.releve-ouverture {
    background: var(--teal-clair);
  }

  .table-cartes tr.releve-ouverture td {
    background: none;
  }

  .table-cartes td.cellule-titre::before,
  .table-cartes th.cellule-titre::before {
    content: none;
  }

  /* Une cellule vide n'a pas à occuper une ligne pour ne rien dire. */
  .table-cartes td.cellule-vide {
    display: none;
  }

  .table-cartes .total-general td {
    color: #fff;
  }

  .table-cartes .total-general td::before {
    color: rgba(255, 255, 255, 0.85);
  }
}

/* ---------- Navigation basse ---------- */

.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  background: var(--carte);
  border-top: 1px solid var(--trait);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav-lien {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-height: var(--nav-h);
  padding: 6px 2px;
  color: var(--gris);
  font-size: 11px;
  font-weight: 600;
  text-decoration: none;
}

.nav-icone {
  font-size: 22px;
  line-height: 1;
}

.nav-lien.is-active {
  color: var(--teal-fonce);
  background: var(--teal-clair);
  box-shadow: inset 0 3px 0 var(--teal);
}

/* ---------- Listes cliquables (clients, bons, paiements) ---------- */

.liste {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  overflow: hidden;
}

.liste li + li {
  border-top: 1px solid var(--trait);
}

.liste-lien {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 60px;
  padding: 10px 14px;
  color: inherit;
  text-decoration: none;
}

.liste-lien:hover {
  background: var(--teal-clair);
}

.liste-date {
  flex: 0 0 auto;
  font-size: 13px;
  color: var(--gris);
  font-variant-numeric: tabular-nums;
}

.liste-principal {
  flex: 1 1 auto;
  min-width: 0;
}

.liste-titre {
  display: block;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.liste-sous {
  display: block;
  font-size: 14px;
  color: var(--gris);
}

.liste-droite {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.liste-montant {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.montant-du-fort {
  color: var(--accent-texte);
}

.gris {
  color: var(--gris);
  font-weight: 400;
}

.fil {
  margin: 0 0 12px;
  font-size: 15px;
}

.lien-discret {
  display: inline-block;
  margin-top: 4px;
  font-size: 15px;
}

/* ---------- Recherche, filtres, navigation par mois ---------- */

.recherche {
  display: flex;
  gap: 8px;
}

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
}

.chip {
  flex: 0 0 auto;
  padding: 8px 14px;
  border: 1px solid var(--trait-controle);
  border-radius: 999px;
  background: var(--carte);
  color: var(--gris);
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.chip.is-active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.mois-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mois-libelle {
  font-weight: 700;
}

/* ---------- Fiches ---------- */

.fiche-entete {
  margin-bottom: 16px;
}

.fiche-code {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gris);
}

.fiche-nom {
  margin: 4px 0 0;
  font-size: 24px;
  line-height: 1.2;
}

.fiche-meta {
  margin: 6px 0 0;
  color: var(--gris);
}

.fiche-badges {
  margin: 10px 0 0;
}

.fiche-notes {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--trait);
  white-space: pre-wrap;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.actions form {
  margin: 0;
}

.actions-3 .btn {
  flex: 1 1 30%;
}

.releve-ouverture td {
  background: var(--teal-clair);
  font-weight: 600;
}

/* ---------- Formulaires ---------- */

.form {
  margin-bottom: 20px;
}

.champ-groupe {
  margin: 0 0 16px;
}

.label-bloc {
  margin-bottom: 8px;
}

.aide {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--gris);
}

.form-actions {
  margin-top: 20px;
}

.radios {
  display: flex;
  gap: 8px;
}

.radio {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--trait-controle);
  border-radius: var(--rayon);
  background: var(--carte);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.radio:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-clair);
  color: var(--teal-fonce);
}

.case {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  font-weight: 600;
}

.case input,
.radio input {
  width: 22px;
  height: 22px;
}

.solde-info {
  margin: -8px 0 16px;
  padding: 12px 14px;
  border-radius: var(--rayon);
  background: var(--teal-clair);
  color: var(--teal-fonce);
  font-weight: 600;
}

.zone-danger {
  border-color: var(--accent);
}

/* ---------- Éditeur de lignes ---------- */

.lignes {
  margin-bottom: 16px;
}

.lignes-table {
  min-width: 540px;
}

.lignes-table td {
  padding: 6px 8px;
  vertical-align: middle;
}

/* 16 px minimum : en dessous, iOS zoome sur le champ au focus. */
.champ-ligne {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--trait-controle);
  border-radius: 8px;
  background: var(--carte);
  color: var(--encre);
  font-family: inherit;
  font-size: 16px;
}

.champ-nombre {
  width: 92px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.ligne-illisible td:first-child {
  border-left: 4px solid var(--orange);
}

.ligne-outils {
  width: 44px;
}

.btn-ligne {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--trait-controle);
  border-radius: 8px;
  background: var(--carte);
  color: var(--gris);
  font: inherit;
  cursor: pointer;
}

.btn-ligne:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-sm {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 15px;
}

.tag {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.tag-illisible {
  background: var(--orange-clair);
  color: var(--orange-texte);
}

/* Deux lectures OCR qui ne disent pas la même chose : à trancher sur la photo. */
.tag-divergent {
  background: var(--orange-clair);
  color: var(--orange-texte);
  margin-left: 4px;
}

/* Le calcul ne tombe pas juste — presque toujours l'addition du père sur le
   papier, pas une erreur de lecture. Rouge pour attirer l'œil, sans rien corriger. */
.tag-calcul {
  background: var(--accent-clair);
  color: #8c2d18;
  margin-left: 4px;
}

.tag-doute {
  background: #eceff1;
  color: var(--gris);
  margin-left: 4px;
}

.aide-catalogue {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--gris);
}

.aide-ecart {
  color: var(--orange-texte);
  font-weight: 600;
}

/* ---------- Capture ---------- */

.depot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 180px;
  margin-bottom: 16px;
  padding: 24px 16px;
  border: 2px dashed var(--teal);
  border-radius: var(--rayon);
  background: var(--teal-clair);
  color: var(--teal-fonce);
  text-align: center;
  cursor: pointer;
}

.depot-icone {
  font-size: 44px;
  line-height: 1;
}

.depot-texte {
  font-size: 18px;
  font-weight: 700;
}

.depot-sous {
  font-size: 14px;
  color: var(--gris);
}

.depot-champ {
  margin-top: 12px;
  font-size: 14px;
}

.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}

.job {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

.job-photo {
  flex: 0 0 auto;
}

.job-photo img {
  width: 72px;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--trait);
  background: var(--bg);
}

.job-corps {
  flex: 1 1 auto;
  min-width: 0;
}

.job-statut {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}

.job-erreur {
  margin: 0 0 8px;
  font-size: 14px;
  color: #8c2d18;
  word-break: break-word;
}

.job .actions {
  margin-bottom: 0;
}

.job .btn-sm {
  min-height: 40px;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--trait);
  border-top-color: var(--teal);
  border-radius: 50%;
  animation: hc-tourne 0.8s linear infinite;
}

@keyframes hc-tourne {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
}

/* ---------- Écran de validation OCR ---------- */

.validation {
  display: grid;
  gap: 16px;
}

/* La photo reste visible pendant qu'on corrige les champs : c'est elle qui fait
   foi, pas ce que le modèle a lu. */
.validation-photo img {
  width: 100%;
  max-height: 42vh;
  object-fit: contain;
  border-radius: var(--rayon);
  border: 1px solid var(--trait);
  background: var(--carte);
}

.bloc-champ {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--teal-clair);
}

.bloc-champ legend {
  padding: 0 6px;
}

.nouveau-client {
  margin-top: 4px;
}

.indice {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: var(--rayon);
  font-weight: 600;
}

.indice-attention {
  background: var(--orange-clair);
  color: var(--orange-texte);
}

.alerte-attention {
  border-color: var(--orange-texte);
  background: var(--orange-clair);
  color: var(--orange-texte);
}

.notes-ocr {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-left: 4px solid var(--teal);
  background: var(--teal-clair);
  font-size: 15px;
}

.somme-indicateur {
  margin: -8px 0 16px;
  font-size: 15px;
  color: var(--gris);
}

.somme-ecart {
  color: var(--accent-texte);
}

.validation .form-actions {
  display: grid;
  gap: 10px;
}

/* ---------- Rapport et import ---------- */

.balance {
  min-width: 900px;
}

.total-general th,
.total-general td {
  background: var(--teal-fonce);
  color: #fff;
  font-weight: 700;
  border-bottom: 0;
}

.petit {
  font-size: 13px;
}

.liste-erreurs {
  margin: 0;
  padding: 12px 16px 12px 34px;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  color: #8c2d18;
  font-size: 15px;
}

@media (min-width: 900px) {
  .validation {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }

  .validation-photo {
    position: sticky;
    top: 76px;
  }

  .validation-photo img {
    max-height: 78vh;
  }
}

/* ---------- Badges complémentaires ---------- */

.badge-brouillon,
.badge-annule {
  background: #eceff1;
  color: var(--gris);
}

.badge-methode {
  background: var(--teal-clair);
  color: var(--teal-fonce);
}

/* ---------- Historique (audit) ---------- */

.historique {
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  color: var(--gris);
  font-size: 15px;
}

.historique summary {
  cursor: pointer;
  font-weight: 600;
}

.historique ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Écrans larges ---------- */

@media (min-width: 700px) {
  .stats {
    grid-template-columns: repeat(3, 1fr);
  }

  .stat-large {
    grid-column: auto;
  }

  .stat-compact {
    padding: 16px;
  }

  .stat-compact .stat-valeur {
    font-size: 34px;
  }

  .btn-geant {
    max-width: 420px;
  }
}

/* Bouton en cours d'envoi : le père doit voir que ça travaille, sinon il
   appuie une deuxième fois (voir la garde anti double-envoi dans app.js). */
.btn-occupe {
  opacity: 0.75;
  cursor: progress;
}

.btn-occupe::after {
  content: '';
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: hc-tourne 0.8s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .btn-occupe::after {
    animation: none;
  }
}

/* Le rapport Balance a neuf colonnes : dans 900 px, la colonne « Solde dû »
   tombait hors cadre sur ordinateur. */
.contenu-large {
  max-width: 1240px;
}

/* Le code client double la colonne « Code » : il ne sert qu'en mode carte,
   où cette colonne est masquée. */
.code-carte {
  display: none;
}

@media (max-width: 899px) {
  .code-carte {
    display: inline;
  }
}
