/* Pilotage I LOVE SQL — feuille unique, sans dépendance externe.
   Conçue d'abord pour le téléphone (barre d'onglets en bas), élargie sur ordinateur. */
/* Mise en page « téléphone » : règles sous html.mobile, classe posée par static/affichage.js selon le choix
   de l'appareil (Menu → Affichage : automatique, téléphone, ordinateur). Imbrication CSS (Chrome 120+). */

:root {
  --fond: #f2f4f8; --carte: #ffffff; --texte: #18202b; --neutre: #667085; --bord: #e4e7ec;
  --accent: #2f5fd0; --accent-doux: #e8eefc; --barre: #5b82e0;
  --ok: #12825a; --ok-doux: #e3f6ee; --attention: #b35c00; --attention-doux: #fff1e0;
  --urgent: #c42b2b; --urgent-doux: #fde8e8;
  --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --rayon: 14px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0f1318; --carte: #1a2029; --texte: #e8ebf0; --neutre: #9aa4b2; --bord: #2a323d;
    --accent: #7ea0f0; --accent-doux: #1e2a44; --barre: #6f90e6;
    --ok: #4cc28d; --ok-doux: #15302a; --attention: #f0a54a; --attention-doux: #33260f;
    --urgent: #f07070; --urgent-doux: #3a1c1c;
    --ombre: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif; }
a { color: var(--accent); text-decoration: none; }
main { max-width: 1120px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 4px 0 16px; letter-spacing: -.01em; }
h2 { font-size: 16px; margin: 0 0 12px; }
small { font-size: 12px; }
code { background: var(--accent-doux); padding: 1px 5px; border-radius: 5px; font-size: 13px; }

/* --- Barre du haut ------------------------------------------------------------------- */
.barre { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 16px;
  padding: 10px 16px; background: var(--carte); border-bottom: 1px solid var(--bord); box-shadow: var(--ombre); }
.marque { display: flex; align-items: center; gap: 10px; color: var(--texte); font-weight: 700; white-space: nowrap; }
.marque small { color: var(--neutre); font-weight: 500; margin-left: 4px; }
.logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, #2f5fd0, #6b8ff0); color: #fff; font-size: 13px; letter-spacing: .02em; }
nav.nav-large { display: flex; flex-wrap: wrap; gap: 2px; flex: 1; }
nav.nav-large a { color: var(--neutre); padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
nav.nav-large a:hover { background: var(--fond); color: var(--texte); }
nav.nav-large a.actif { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.pastille { display: inline-block; min-width: 18px; margin-left: 5px; padding: 0 5px; border-radius: 9px;
  background: var(--urgent); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 700; }

/* --- Onglets du bas (téléphone) ----------------------------------------------------- */
.onglets { display: none; }
html.mobile {
  .nav-large { display: none !important; }
  .barre { justify-content: center; padding: 8px 12px; }
  body.avec-nav main { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  .onglets { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--carte); border-top: 1px solid var(--bord); box-shadow: 0 -2px 12px rgba(0, 0, 0, .06);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .onglets > a, .onglets summary { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0;
    color: var(--neutre); font-size: 11px; list-style: none; cursor: pointer; border-radius: 10px; }
  .onglets summary::-webkit-details-marker { display: none; }
  .onglets .icone { position: relative; font-size: 21px; line-height: 1.2; }
  .onglets .icone .pastille { position: absolute; top: -4px; left: 16px; margin: 0; }
  .onglets .actif { color: var(--accent); font-weight: 700; }
  .plus .menu { position: fixed; right: 8px; bottom: calc(72px + env(safe-area-inset-bottom)); min-width: 220px;
    background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: 0 8px 30px rgba(0, 0, 0, .18);
    padding: 6px; display: flex; flex-direction: column; }
  .plus .menu a, .plus .menu button { padding: 12px 14px; border-radius: 10px; color: var(--texte); font-size: 15px; text-align: left; }
  .plus .menu a.actif { background: var(--accent-doux); color: var(--accent); }
  .plus .menu form { margin: 4px 0 0; border-top: 1px solid var(--bord); padding-top: 4px; }
  .plus .menu button { width: 100%; border: 0; background: none; font-weight: 500; }
}

/* --- Cartes et tuiles ---------------------------------------------------------------- */
.carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px;
  margin-bottom: 14px; box-shadow: var(--ombre); overflow-x: auto; }
.entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tuile { position: relative; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px; box-shadow: var(--ombre); overflow: hidden; }
.tuile::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.tuile:nth-child(2)::before { background: #7c5cd6; }
.tuile:nth-child(3)::before { background: var(--attention); }
.tuile:nth-child(4)::before { background: var(--ok); }
.etiquette { color: var(--neutre); font-size: 13px; font-weight: 500; }
.valeur { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.detail, .neutre { color: var(--neutre); font-size: 13px; }
.a-venir-tuile { opacity: .6; }
html.mobile {
  main { padding: 12px; }
  h1 { font-size: 20px; }
  .tuiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tuile { padding: 12px; }
  .valeur { font-size: 20px; }
  .detail { font-size: 12px; }
  .carte { padding: 14px; }
}

/* --- Tableaux : fiches empilées sur téléphone ---------------------------------------- */
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--bord); }
th { color: var(--neutre); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
tbody tr:hover { background: var(--fond); }
.num { text-align: right; white-space: nowrap; }
td small { color: var(--neutre); }
html.mobile {
  table, thead, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr { padding: 10px 0; border-bottom: 1px solid var(--bord); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
  tbody tr:hover { background: none; }
  td { border: 0; padding: 0; }
  td:first-child { grid-column: 1 / -1; font-weight: 600; }
  td.num { text-align: right; font-weight: 600; }
  td:not(:first-child):not(.num) { color: var(--neutre); font-size: 13px; }
}

/* --- Listes de tâches et d'alertes ---------------------------------------------------- */
.alertes, .taches { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.alertes li, .taches li { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: 10px 12px; border-radius: 10px; background: var(--fond); border-left: 4px solid var(--neutre); }
.alertes li.attention, .taches li.attention { border-color: var(--attention); background: var(--attention-doux); }
.alertes li.urgent, .taches li.urgent { border-color: var(--urgent); background: var(--urgent-doux); }
.alertes small { color: var(--neutre); white-space: nowrap; }
.taches li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.taches .source { color: var(--neutre); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.taches small { color: var(--neutre); }
.taches a { color: var(--texte); font-weight: 500; }
.taches form { margin: 0; flex-shrink: 0; }

/* --- Graphiques ---------------------------------------------------------------------- */
.histo { width: 100%; height: auto; max-height: 240px; }
.histo rect { fill: var(--barre); }
.histo text { fill: var(--neutre); font-size: 12px; }
.histo text.val { fill: var(--texte); font-size: 11px; }
.histo rect.entree { fill: var(--ok); }
.histo rect.sortie { fill: var(--attention); }
.histo polyline.solde { stroke: var(--accent); stroke-width: 2.5; }
.legende .pt { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 10px; vertical-align: middle; }
.legende .pt.entree { background: var(--ok); } .legende .pt.sortie { background: var(--attention); } .legende .pt.solde { background: var(--accent); }
.analyse { white-space: pre-wrap; font: inherit; margin: 0; }

/* --- Formulaires ------------------------------------------------------------------- */
button { font: inherit; font-weight: 600; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--accent);
  background: var(--accent); color: #fff; cursor: pointer; }
button:active { transform: scale(.98); }
button.discret { background: transparent; color: var(--accent); border-color: var(--bord); }
button.petit { padding: 6px 12px; font-size: 13px; }
input, select, textarea { font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 10px;
  background: var(--carte); color: var(--texte); width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-doux); border-color: var(--accent); }
input[type=file] { padding: 8px; }
textarea { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
label { font-size: 13px; color: var(--neutre); }
.ligne { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ligne input, .ligne select { flex: 1; min-width: 180px; width: auto; }
.pile { display: flex; flex-direction: column; gap: 10px; max-width: 900px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.deux > * { min-width: 0; }
details summary { cursor: pointer; padding: 4px 0; color: var(--accent); }
details input { margin-top: 8px; }

.message { color: var(--ok); background: var(--ok-doux); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.erreur { color: var(--urgent); background: var(--urgent-doux); padding: 10px 14px; border-radius: 10px; margin: 0 0 12px; }
.ok { color: var(--ok); } .ko { color: var(--urgent); font-weight: 600; }
.niveau-attention { color: var(--attention); } .niveau-urgent { color: var(--urgent); font-weight: 600; }
.statut-dolibarr, .statut-pret { color: var(--ok); font-weight: 600; }
.statut-a_qualifier, .statut-erreur, .statut-a_verifier { color: var(--attention); font-weight: 600; }
.statut-simulation { color: var(--neutre); }

/* --- Tickets ------------------------------------------------------------------------- */
.capture { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.bouton-photo { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  width: 100%; min-height: 46vh; border-radius: 22px; cursor: pointer; color: #fff; text-align: center;
  background: linear-gradient(145deg, #2f5fd0, #5b82e0); box-shadow: 0 10px 30px rgba(47, 95, 208, .35); }
.bouton-photo:active { transform: scale(.985); }
.bouton-photo .appareil { font-size: 72px; line-height: 1; }
.bouton-photo strong { font-size: 22px; }
.bouton-photo span { font-size: 14px; opacity: .85; }
.bouton-photo input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.bouton-photo.envoi { background: linear-gradient(145deg, #12825a, #3ba77b); }
.bouton-photo.envoi .appareil { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.88); opacity: .7; } }
.secondaire { display: flex; gap: 8px; width: 100%; }
.secondaire label { flex: 1; text-align: center; padding: 12px; border: 1px solid var(--bord); border-radius: 12px;
  background: var(--carte); color: var(--accent); font-weight: 600; font-size: 14px; cursor: pointer; position: relative; }
.secondaire label input { position: absolute; inset: 0; opacity: 0; }
.compteurs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.puce { padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--fond); color: var(--neutre); }
.puce.attention { background: var(--attention-doux); color: var(--attention); }
.puce.ok { background: var(--ok-doux); color: var(--ok); }
.ticket { display: grid; grid-template-columns: 120px 1fr; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--bord); }
.ticket img { width: 120px; border-radius: 10px; }
.ticket > form:last-child { grid-column: 2; }
.tourner { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.tourner button { font-size: 20px; line-height: 1; padding: 6px 14px; }
.vignettes { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.vignettes img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 10px; }
html:not(.mobile) { .bouton-photo { min-height: 220px; max-width: 560px; } .secondaire { max-width: 560px; } }
html.mobile {
  .ticket { grid-template-columns: 1fr; }
  .ticket img { width: 100%; max-height: 45vh; object-fit: contain; background: var(--fond); }
  .ticket > form:last-child { grid-column: 1; }
}

/* --- Connexion et divers --------------------------------------------------------------- */
.connexion { max-width: 380px; margin: 10vh auto; }
.connexion h1 { text-align: center; }
.connexion form { display: flex; flex-direction: column; gap: 10px; }
.qr svg { width: 200px; height: 200px; background: #fff; padding: 8px; border-radius: 10px; }

/* --- Lisibilité sur téléphone : tailles relevées (retour de Julien, OnePlus) ------------- */
html.mobile {
  body { font-size: 17px; line-height: 1.55; }
  h1 { font-size: 24px; }
  h2 { font-size: 19px; }
  small, .detail, .neutre, td small, .taches small, .alertes small { font-size: 14px; }
  .etiquette { font-size: 15px; }
  .valeur { font-size: 24px; }
  .taches .source { font-size: 12.5px; }
  .onglets > a, .onglets summary { font-size: 12.5px; }
  .onglets .icone { font-size: 24px; }
  .plus .menu a, .plus .menu button { font-size: 17px; padding: 14px 16px; }
  label, .puce { font-size: 15px; }
  td:not(:first-child):not(.num) { font-size: 15px; }
  th { font-size: 13px; }
  code { font-size: 14px; }
  button { font-size: 17px; padding: 12px 18px; }
  button.petit { font-size: 15px; }
  .marque { font-size: 18px; }
  .bouton-photo strong { font-size: 24px; }
  .bouton-photo span { font-size: 16px; }
  .secondaire label { font-size: 16px; }
  .histo text { font-size: 15px; }
  .histo text.val { font-size: 13px; }
}

a.tuile { color: var(--texte); }
a.tuile:hover { border-color: var(--accent); }

/* --- Case « Exercice en cours uniquement » -------------------------------------------- */
.periode { display: flex; justify-content: flex-end; margin: 0 0 10px; }
.interrupteur { display: inline-flex; align-items: center; gap: 8px; background: var(--carte); color: var(--texte);
  border: 1px solid var(--bord); border-radius: 999px; padding: 7px 14px 7px 8px; font-weight: 600; font-size: 14px; box-shadow: var(--ombre); }
.interrupteur .case { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 6px;
  border: 2px solid var(--bord); color: #fff; font-size: 14px; line-height: 1; }
.interrupteur.coche { background: var(--accent-doux); border-color: var(--accent); color: var(--accent); }
.interrupteur.coche .case { background: var(--accent); border-color: var(--accent); }
html.mobile { .periode { justify-content: stretch; } .interrupteur { width: 100%; justify-content: center; font-size: 16px; } }

/* --- Comparaison d'un doublon probable ---------------------------------------------------- */
.comparaison { padding: 14px 0; border-bottom: 1px solid var(--bord); }
.cote-a-cote { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cote-a-cote figure { margin: 0; background: var(--fond); border-radius: 12px; padding: 8px; }
.cote-a-cote img { width: 100%; max-height: 55vh; object-fit: contain; border-radius: 8px; background: #fff; }
.cote-a-cote figcaption { font-size: 13px; color: var(--neutre); margin-top: 6px; line-height: 1.4; }
.cote-a-cote figcaption strong { color: var(--texte); }
.decision { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.decision form > button { width: 100%; }
html.mobile { .cote-a-cote figcaption { font-size: 14px; } }

/* --- Traitement au pouce (pièces à qualifier, tâches) ------------------------------------- */
.qualifier { max-width: 640px; }
.apercu-piece img { width: 100%; max-height: 55vh; object-fit: contain; object-position: top;
  border: 1px solid var(--bord); border-radius: 10px; background: #fff; }
button.gros { padding: 16px; font-size: 18px; }
.qualifier label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: var(--neutre); }
.qualifier input, .qualifier select { font-size: 17px; }
.taches li a.action { display: inline-block; margin-top: 6px; padding: 8px 14px; border-radius: 10px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; align-self: flex-start; }
html.mobile {
  .taches li { padding: 14px; }
  .taches a { font-size: 16px; }
}

/* --- Jamais plus large que l'écran ---------------------------------------------------------
   Une image large (aperçu de 900 px) ou un long nom de fichier élargissait la page : le téléphone
   dézoomait alors toute la page (constaté le 01/10/2026 sur l'écran « Qualifier »). */
img, svg, video { max-width: 100%; height: auto; }
main, .carte, section, form, .pile, .ligne, label { min-width: 0; }
.carte, p, li, td, small, code { overflow-wrap: anywhere; }
.apercu-piece { display: block; }
.apercu-piece img { display: block; width: 100%; height: auto; }
html.mobile {
  /* Aperçu compact : le formulaire reste visible sans défiler ; un appui ouvre le PDF en grand. */
  .apercu-piece img { max-height: 32vh; object-fit: cover; object-position: top; }
}

/* --- Interface simplifiée (01/10/2026) : trois entrées + menu --------------------------------- */
.plus-large { position: relative; }
.plus-large summary { list-style: none; cursor: pointer; color: var(--neutre); padding: 6px 10px; border-radius: 8px; font-size: 14px; }
.plus-large summary::-webkit-details-marker { display: none; }
.plus-large summary.actif { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.menu-large { position: absolute; top: 36px; left: 0; z-index: 40; display: flex; flex-direction: column; gap: 2px; min-width: 230px;
  padding: 8px; background: var(--carte, #fff); border: 1px solid var(--bord); border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.menu-large a, .menu-large button { padding: 10px 12px; border-radius: 8px; color: var(--texte); text-align: left; width: 100%; }
.menu-large a.actif { background: var(--accent-doux); color: var(--accent); }
.tuiles-3 { grid-template-columns: repeat(3, 1fr) !important; }
html.mobile {
  .tuiles-3 { gap: 8px; }
  .tuiles-3 .tuile { padding: 10px; }
  .tuiles-3 .valeur { font-size: 20px; }
  .tuiles-3 .detail { font-size: 12px; }
}
.bouton-microsoft { display: block; text-align: center; padding: 16px; border-radius: 12px; font-size: 18px; font-weight: 700;
  background: #2f2f2f; color: #fff; text-decoration: none; }
.bouton-microsoft::before { content: "▦ "; color: #f25022; }
.version { display: block; padding: 8px 12px; color: var(--neutre); font-size: 12px; }
[hidden] { display: none !important; }

/* --- Paquets de tâches (01/10/2026) ---------------------------------------------------------- */
.taches li.paquet > div { width: 100%; }
.titre-paquet { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.titre-paquet .compte { min-width: 24px; padding: 0 8px; border-radius: 12px; background: var(--carte); border: 1px solid var(--bord);
  font-size: 13px; line-height: 22px; text-align: center; color: var(--neutre); }
.taches details summary { cursor: pointer; color: var(--neutre); font-size: 14px; margin-top: 8px; }
.sous-taches { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.taches .sous-taches li { background: var(--carte); border: 1px solid var(--bord); padding: 10px; }
.taches .sous-taches a { font-size: 15px; }

/* --- Fiches et tuiles alignées sur téléphone (01/10/2026, retour de Julien : « cartes mal foutues,
   pas d'entête, pas aligné ») ------------------------------------------------------------------- */
html.mobile {
  /* Fiche : 1re cellule en titre, puis les autres sur deux colonnes, intitulé au-dessus de la valeur. */
  tbody tr { grid-template-columns: 1fr 1fr; gap: 8px 12px; padding: 12px 0; align-items: start; }
  td:first-child { font-size: 16px; }
  td[data-label]:not(:first-child)::before { content: attr(data-label); display: block; font-size: 12px; font-weight: 500;
    color: var(--neutre); text-transform: uppercase; letter-spacing: .03em; }
  td:not(:first-child) { min-width: 0; }
  td.num { text-align: left; font-weight: 600; }
  /* Tuiles (hors accueil) : une par ligne, intitulé et détail à gauche, montant à droite. */
  .tuiles:not(.tuiles-3) { grid-template-columns: 1fr; gap: 8px; }
  .tuiles:not(.tuiles-3) .tuile { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; }
  .tuiles:not(.tuiles-3) .tuile > * { grid-column: 1; }
  .tuiles:not(.tuiles-3) .tuile > .valeur { grid-column: 2; grid-row: 1 / span 4; text-align: right; font-size: 22px; }
  /* Accueil : trois tuiles de même hauteur, montants sur la même ligne. */
  .tuiles-3 .tuile { justify-content: flex-start; }
  .tuiles-3 .etiquette { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .tuiles-3 .valeur { white-space: nowrap; }
  /* Titres de carte : titre et bouton l'un sous l'autre plutôt que serrés. */
  .entete { flex-wrap: wrap; }
}

/* --- Listes en fiches (factures fournisseurs, 01/10/2026) ------------------------------------------ */
a.bouton { display: inline-block; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: #fff;
  font-weight: 600; text-decoration: none; white-space: nowrap; }
.fiches { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; }
.fiches li { border-top: 1px solid var(--bord); }
.fiches li:first-child { border-top: 0; }
.fiches li > a, .fiches li > div { display: flex; flex-direction: column; gap: 3px; padding: 12px 2px; color: var(--texte);
  text-decoration: none; min-width: 0; }
.fiches li > a:active { background: var(--fond); }
.fiche-ligne { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fiche-titre { font-weight: 600; font-size: 16px; min-width: 0; }
.fiche-montant { font-weight: 700; font-size: 16px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.fiche-detail { color: var(--neutre); font-size: 14px; }
.fiche-ligne > span:last-child { white-space: nowrap; flex-shrink: 0; overflow-wrap: normal; }

/* --- Lot 1 de la revue UX (01/10/2026) : confirmation, cibles tactiles, menu en feuille ----------- */
.bandeau { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px;
  padding: 10px 14px; border-radius: 12px; background: var(--ok-doux); color: var(--ok); font-weight: 600;
  transition: opacity .6s; }
.bandeau form { margin: 0; }
.bandeau button { min-height: 40px; }
.bandeau.disparait { opacity: 0; pointer-events: none; height: 0; padding: 0; margin: 0; overflow: hidden; }
html.mobile {
  .bandeau { position: fixed; left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 35;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18); background: var(--carte); border: 1px solid var(--ok); margin: 0; }
  .bandeau.disparait { padding: 0; border: 0; }
  /* Cibles tactiles : 48 px minimum (« Détail » faisait 30 px). */
  .taches summary, .plus-tard > summary, .ajout-tache > summary { min-height: 48px; display: flex; align-items: center; }
  .taches li a.action, a.bouton, .taches form button, button.petit, .qualifier button { min-height: 48px; }
  .taches form button { min-width: 72px; }
  /* Menu : feuille au-dessus d'un voile sombre ; toucher le voile ferme le menu. */
  .plus[open] .voile { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 0; }
  .plus .menu { z-index: 1; }
}
.voile { display: none; }
.plus[open] .voile { display: block; }
.tuile-alerte::before { background: var(--urgent) !important; }
.tuile-alerte .detail { color: var(--urgent); font-weight: 600; }
.compteur-file { font-weight: 700; color: var(--neutre); padding: 4px 10px; border-radius: 12px; background: var(--carte);
  border: 1px solid var(--bord); }
a.bouton.discret { background: transparent; color: var(--accent); border: 1px solid var(--bord); text-align: center; }
.plus-tard { margin-top: 14px; }
.plus-tard > summary { color: var(--neutre); font-weight: 600; }
.plus-tard .taches { margin-top: 8px; }
.ajout-tache { margin-top: 12px; }
.ajout-tache > summary { color: var(--accent); font-weight: 600; }
.ajout-tache form { margin-top: 8px; }
/* Triangle des volets, perdu avec display:flex sur summary. */
.taches summary, .plus-tard > summary, .ajout-tache > summary { list-style: none; }
.taches summary::-webkit-details-marker, .plus-tard > summary::-webkit-details-marker { display: none; }
.taches summary::before, .plus-tard > summary::before { content: "▸"; display: inline-block; width: 1.2em; }
.taches details[open] > summary::before, .plus-tard[open] > summary::before { content: "▾"; }

/* --- Écrans de traitement en file (lot 2, 01/10/2026) -------------------------------------------- */
.pastilles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pastille-choix { min-height: 56px; background: var(--carte); color: var(--texte); border: 1px solid var(--bord);
  font-weight: 600; font-size: 15px; line-height: 1.2; white-space: normal; }
.pastille-choix:active { background: var(--accent-doux); border-color: var(--accent); }
.case-ligne { display: flex; gap: 10px; align-items: flex-start; color: var(--texte); font-size: 15px; }
.case-ligne input[type=checkbox] { width: 22px; height: 22px; flex-shrink: 0; margin-top: 2px; }
.case-ligne .motif { margin-top: 6px; font-size: 15px; }
.fiche-coche { display: flex; gap: 12px; align-items: flex-start; padding: 12px 2px; cursor: pointer; color: var(--texte); }
.fiche-coche input { width: 24px; height: 24px; flex-shrink: 0; margin-top: 2px; }
.fiche-corps { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.barre-action { width: 100%; margin-top: 12px; }
.bouton-photo.compact { min-height: 120px; }
.pas-de-piece { margin-top: 12px; }
.pas-de-piece > summary { min-height: 48px; display: flex; align-items: center; font-weight: 600; }
.fiche-montant.ok { color: var(--ok); }
.qualifier .case-ligne { flex-direction: row; color: var(--texte); }
.qualifier .bouton-photo { color: #fff; flex-direction: column; }
.qualifier .bouton-photo strong { color: #fff; }

/* --- Lot 3 (01/10/2026) : ligne d'état, onglet Argent, replis ------------------------------------- */
.etat { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin: 0 0 12px; border-radius: 12px;
  font-weight: 600; text-decoration: none; color: var(--texte); border: 1px solid var(--bord); background: var(--carte); }
.etat .pastille-etat { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.etat-vert .pastille-etat { background: var(--ok); }
.etat-orange { border-color: var(--attention); background: var(--attention-doux); }
.etat-orange .pastille-etat { background: var(--attention); }
.etat-rouge { border-color: var(--urgent); background: var(--urgent-doux); }
.etat-rouge .pastille-etat { background: var(--urgent); }
.releve-accueil { margin: -6px 0 12px; text-align: right; }
.releve { margin: 0 0 10px; color: var(--neutre); font-size: 14px; }
.releve-ancien { color: var(--attention); font-weight: 600; }
details.repli { padding: 0; }
details.repli > summary { padding: 14px 16px; font-weight: 700; font-size: 16px; color: var(--texte); min-height: 48px;
  display: flex; align-items: center; gap: 8px; list-style: none; }
details.repli > summary::-webkit-details-marker { display: none; }
details.repli > summary::before { content: "▸"; color: var(--neutre); }
details.repli[open] > summary::before { content: "▾"; }
details.repli > :not(summary) { margin-left: 16px; margin-right: 16px; }
details.repli[open] { padding-bottom: 12px; }
details.repli.exercice > summary small { font-weight: 500; }
.note-claude > summary { color: var(--texte); }
.analyse h3 { font-size: 16px; margin: 14px 0 6px; }
.analyse ul { padding-left: 20px; margin: 6px 0; }
.analyse li { margin: 6px 0; }
.analyse p { margin: 6px 0; }
details.repli.analyse-jour > summary { display: block; line-height: 1.4; }
details.repli.analyse-jour > summary::before { margin-right: 6px; }

/* --- Fenêtre (aperçu du document signé, 01/10/2026) ---------------------------------------------- */
dialog.fenetre { width: min(720px, calc(100vw - 24px)); max-height: calc(100vh - 32px); padding: 16px; border: 0;
  border-radius: 16px; background: var(--carte); color: var(--texte); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); overflow: auto; }
dialog.fenetre::backdrop { background: rgba(0, 0, 0, .55); }
.fenetre-entete { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.fenetre-entete form { margin: 0; }
.fenetre-pages { display: flex; flex-direction: column; gap: 10px; margin: 10px 0 14px; }
.fenetre-pages img { width: 100%; border: 1px solid var(--bord); border-radius: 8px; background: #fff; }
dialog.fenetre .deux form { margin: 0; }
.proposition { margin: 8px 0 0; padding: 8px 12px; border-radius: 10px; background: var(--accent-doux); color: var(--texte); font-size: 14px; }

/* --- Choix de l'affichage dans le menu (01/10/2026) ------------------------------------------------ */
.choix-affichage { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 4px; border-top: 1px solid var(--bord); }
.choix-affichage span { width: 100%; color: var(--neutre); font-size: 13px; font-weight: 600; }
.choix-affichage button { flex: 1; padding: 8px 6px; font-size: 14px; background: var(--carte); color: var(--texte);
  border: 1px solid var(--bord); min-height: 44px; }
html[data-affichage="auto"] [data-affichage-choix="auto"],
html[data-affichage="telephone"] [data-affichage-choix="telephone"],
html[data-affichage="ordinateur"] [data-affichage-choix="ordinateur"] { background: var(--accent-doux); color: var(--accent); border-color: var(--accent); }

/* --- Encours des tickets (01/10/2026) ---------------------------------------------------------- */
.etapes { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 4px; }
.etapes li { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; }
.etapes li div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.etapes small { color: var(--neutre); font-size: 13px; }
.num-etape { flex-shrink: 0; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 14px; background: var(--fond); color: var(--neutre); border: 1px solid var(--bord); }
.etapes li.actif .num-etape { background: var(--accent); color: #fff; border-color: var(--accent); }
.etapes li.fait .num-etape { background: var(--ok); color: #fff; border-color: var(--ok); }
.etapes li.alerte .num-etape { background: var(--attention); color: #fff; border-color: var(--attention); }
.etapes li.vide strong { color: var(--neutre); font-weight: 500; }

/* --- Bouton photo au premier plan dans la barre du bas (01/10/2026) ------------------------------ */
.photo-rapide-form { margin: 0; display: flex; justify-content: center; }
.photo-rapide { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: var(--accent); font-weight: 700; font-size: 12.5px; cursor: pointer; }
.photo-rapide .rond { display: grid; place-items: center; width: 60px; height: 60px; margin-top: -26px; border-radius: 50%;
  font-size: 28px; background: linear-gradient(145deg, #2f5fd0, #5b82e0); box-shadow: 0 6px 18px rgba(47, 95, 208, .45);
  border: 4px solid var(--carte); }
.photo-rapide input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.photo-rapide.envoi .rond { background: linear-gradient(145deg, #12825a, #3ba77b); animation: pulse 1s ease-in-out infinite; }

/* Bouton discret (analyses : clore, historiser, rétablir) */
button.lien { background: none; border: 0; color: var(--accent); padding: 4px 0; min-height: 0; text-decoration: underline; cursor: pointer; font-size: 14px; }

/* Réaction de Claude à un traitement (app/activite.py) */
.reaction { margin: 0 0 12px; padding: 10px 14px; border-radius: 12px; background: var(--accent-doux); border-left: 4px solid var(--accent); }
.reaction small { opacity: .7; }
