/* A97 Élevage. Palette des produits A97 (CRM, Vin) : fond ivoire neutre, ardoise,
   accent bleu. Clair uniquement, comme les autres produits. */
:root {
  --fond: #FAF9F5;
  --surface: #ffffff;
  --sourd: #F5F4ED;
  --bord: #e2e8f0;
  --texte: #1e293b;
  --texte-2: #64748b;
  --texte-3: #94a3b8;
  --accent: #2563EB;
  --accent-fonce: #1d4ed8;
  --accent-clair: #eff6ff;
  --erreur: #b91c1c;
  --erreur-fond: #fef2f2;
  --succes: #047857;
  --succes-fond: #ecfdf5;
  --ambre: #b45309;
  --ambre-fond: #fffbeb;
  --encre: #1A1A2E;
  --or: #C9A84C;
  /* Largeur du contenu, la même pour le bandeau et la page : les bords
     s'alignent sur chaque écran. Toute la largeur de l'écran, avec une petite
     marge sur les côtés (demande de Patrick du 24/11/2026). */
  --largeur: 100vw;
  --marge: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
a { color: var(--accent); }
h1, h2 { text-wrap: balance; }
.chargement { padding: 40px; color: var(--texte-2); text-align: center; }

/* Logotype commun aux produits A97 */
.logotype { display: inline-flex; align-items: baseline; font-weight: 800; letter-spacing: .08em; color: var(--encre); text-decoration: none; }
.logotype .n { color: var(--or); }
.logotype .app {
  align-self: flex-start; transform: translateY(-2px); margin-left: 7px; padding: 1px 7px 2px;
  border: 1.5px solid rgba(26, 26, 46, .4); border-radius: 999px; background: #fff; color: var(--encre);
  font-size: 9.5px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; line-height: 1.3;
}

/* Champs et boutons */
label { font-size: 12.5px; color: var(--texte-2); }
input, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--bord); border-radius: 8px;
  background: var(--surface); color: var(--texte); font: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  padding: 9px 14px; border: 1px solid var(--accent); border-radius: 8px; background: var(--accent);
  color: #fff; font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap;
}
button:hover { background: var(--accent-fonce); }
button:disabled { opacity: .55; cursor: default; }
button.secondaire { background: var(--surface); color: var(--texte); border-color: var(--bord); }
button.secondaire:hover { background: var(--sourd); }
button.lien { background: none; border: 0; color: var(--accent); padding: 4px 0; font-weight: 500; }
.erreur { color: var(--erreur); background: var(--erreur-fond); border-radius: 8px; padding: 8px 11px; font-size: 13px; }
.info { color: var(--texte-2); font-size: 13px; }
.champ { display: flex; flex-direction: column; gap: 5px; }

/* Connexion et mot de passe obligatoire */
.connexion { min-height: 100vh; display: grid; place-items: center; padding: 20px max(16px, env(safe-area-inset-right, 0px)) 20px max(16px, env(safe-area-inset-left, 0px)); }
.connexion form {
  width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--bord);
  border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 14px;
}
.connexion .logotype { justify-content: center; font-size: 26px; letter-spacing: .1em; margin: 4px 0 6px; }
.connexion .logotype .app { transform: translateY(-3px); margin-left: 8px; padding: 2px 8px 3px; font-size: 10.5px; }
.connexion h2 { margin: 0; font-size: 16px; text-align: center; }
.connexion button[type=submit] { margin-top: 4px; }

/* Cadre de l'application : bandeau (logo, fil, compte) puis onglets de la
   section, et page ; tous à la même largeur (.cadre) pour que les bords
   s'alignent. */
.cadre {
  width: 100%; max-width: calc(var(--largeur) + 2 * var(--marge)); margin: 0 auto;
  padding-left: max(var(--marge), env(safe-area-inset-left, 0px)); padding-right: max(var(--marge), env(safe-area-inset-right, 0px));
}
header { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--bord); }
.barre-haut { display: flex; align-items: center; gap: 12px 20px; min-height: 56px; flex-wrap: wrap; }
header .logotype { font-size: 20px; }
.fil { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.fil a { color: var(--texte-2); text-decoration: none; white-space: nowrap; }
.fil a:hover { color: var(--texte); }
.fil .section-courante { color: var(--texte); font-weight: 700; }
.fil .separateur { color: var(--texte-3); }
.qui { margin-left: auto; display: flex; align-items: center; gap: 4px 14px; flex-wrap: wrap; justify-content: flex-end; color: var(--texte-2); font-size: 13px; }
.qui a { color: var(--texte-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.qui a:hover, .qui a.actif { color: var(--texte); }
.qui a.actif { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--accent); }
.qui .compte { color: var(--texte); font-weight: 600; }
nav.onglets { border-top: 1px solid var(--bord); }
nav.onglets .cadre { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
/* Le texte du premier onglet s'aligne sur le logo et sur la page. */
nav.onglets .cadre { padding-left: max(calc(var(--marge) - 12px), env(safe-area-inset-left, 0px)); }
nav.onglets a {
  display: flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--texte-2); text-decoration: none;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; white-space: nowrap;
}
nav.onglets a:hover { color: var(--texte); }
nav.onglets a.actif { color: var(--texte); border-bottom-color: var(--accent); font-weight: 600; }
main { padding-top: 24px; padding-bottom: 48px; }
main h1 { font-size: 22px; line-height: 1.3; margin: 0 0 6px; }
.carte { background: var(--surface); border: 1px solid var(--bord); border-radius: 12px; padding: 20px; }
.carte.etroite { max-width: 480px; }
.pile { display: flex; flex-direction: column; gap: 16px; }

/* Utilisateurs */
.barre { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.barre .champ { flex: 1 1 180px; }
.tableau { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-2); padding: 8px 10px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
tr.inactif td { color: var(--texte-3); }
td.actions .boutons { display: flex; flex-wrap: nowrap; gap: 6px; justify-content: flex-end; }
td.actions button { padding: 5px 10px; font-size: 12.5px; font-weight: 500; }
.pastille { display: inline-flex; font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.pastille.admin { background: var(--accent-clair); color: var(--accent-fonce); }
.pastille.utilisateur { background: var(--sourd); color: var(--texte-2); }
.pastille.attente { background: var(--ambre-fond); color: var(--ambre); }
.pastille.off { background: var(--sourd); color: var(--texte-3); }
.provisoire { background: var(--succes-fond); border: 1px solid #a7f3d0; border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; }
.provisoire code { font-size: 18px; font-weight: 700; letter-spacing: .06em; color: var(--texte); user-select: all; }
.formulaire-court { max-width: 420px; display: flex; flex-direction: column; gap: 12px; }

/* ── Écrans métier ─────────────────────────────────────────────────────────── */
main h2 { font-size: 16px; margin: 8px 0 0; }
.sous-titre { margin: 0 0 12px; font-size: 15px; }
.boutons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* Lien en forme de bouton : même taille qu'un bouton, pour qu'ils s'alignent. */
a.bouton {
  display: inline-flex; align-items: center; justify-content: center; padding: 9px 14px; border: 1px solid var(--accent); border-radius: 8px;
  background: var(--accent); color: #fff; font-weight: 600; text-decoration: none; white-space: nowrap;
}
a.bouton:hover { background: var(--accent-fonce); }
a.bouton.secondaire { background: var(--surface); color: var(--texte); border-color: var(--bord); }
a.bouton.secondaire:hover { background: var(--sourd); }
button.lien.danger { color: var(--erreur); }
.titre-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.titre-actions h1, .titre-actions h2 { margin: 0; }
/* Titre suivi d'une liste de choix étiquetée : alignés par le bas. */
.titre-actions:has(.champ) { align-items: flex-end; }
.titre-actions .champ { flex: 0 0 auto; min-width: 160px; }
.titre-actions .boutons:has(.champ) { align-items: flex-end; }
.retour { font-size: 13px; text-decoration: none; }
.aide { font-size: 12px; color: var(--texte-2); }
.case { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--texte); }
.case input { width: auto; }
.succes { color: var(--succes); background: var(--succes-fond); border-radius: 8px; padding: 8px 11px; font-size: 13.5px; }
.alerte { color: var(--ambre); background: var(--ambre-fond); border-radius: 8px; padding: 8px 11px; font-size: 13.5px; font-weight: 600; }
.bord-erreur { border-color: #fecaca; }
.liste { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* Tableaux de données */
td.nombre, th.nombre { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.negatif { color: var(--erreur); font-weight: 600; }
tr.cliquable { cursor: pointer; }
tr.cliquable:hover td { background: var(--sourd); }
td a { font-weight: 600; text-decoration: none; white-space: nowrap; }
.tableau td { padding: 7px 10px; }

/* Filtres */
.filtres { align-items: flex-end; }
.filtres .champ { flex: 0 1 170px; }
.filtres .info { padding-bottom: 9px; }

/* Accueil */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.tuile {
  display: flex; flex-direction: column; gap: 2px; padding: 18px 20px; border: 1px solid var(--bord);
  border-radius: 12px; background: var(--surface); color: var(--texte-2); text-decoration: none;
}
.tuile .valeur { font-size: 26px; line-height: 1.25; font-weight: 700; color: var(--texte); font-variant-numeric: tabular-nums; }
.boutons-accueil { display: flex; gap: 10px; flex-wrap: wrap; }

/* Fiche animal */
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px 24px; margin: 0; }
.grille dt { font-size: 12px; color: var(--texte-2); }
.grille dd { margin: 2px 0 0; font-weight: 600; }
.pastille.actif { background: var(--succes-fond); color: var(--succes); }
h1 .pastille { vertical-align: middle; font-size: 12px; }

/* Saisie des pesées */
.saisie { display: grid; grid-template-columns: 2fr 1.3fr 1fr 0.8fr 1.6fr; gap: 12px; align-items: start; }
.saisie input { font-size: 16px; padding: 11px 12px; }
form .pile, form.pile { gap: 12px; }

/* Fenêtres de dialogue */
.dialogue {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); border: 1px solid var(--bord);
  border-radius: 14px; padding: 22px; background: var(--surface); color: var(--texte);
}
.dialogue::backdrop { background: rgba(15, 23, 42, .35); }
.dialogue h2 { margin: 0 0 14px; font-size: 17px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Analyse et Synthèse : couleurs des évaluations, reprises du classeur */
td.evaluation { white-space: nowrap; font-size: 12.5px; }
.eval-perte { background: #FFC7CE; color: #9C0006; font-weight: 700; }
.eval-faible { background: #FFEB9C; color: #9C5700; }
.eval-correct { background: #EDF5E1; color: #375623; }
.eval-bon { background: #C6EFCE; color: #006100; font-weight: 700; }
.eval-verifier { background: #DDEBF7; color: #1F4E79; font-weight: 700; }
tr.inactif td.evaluation { opacity: .6; }
td.action { min-width: 190px; font-size: 12px; line-height: 1.35; color: var(--texte-2); }
td.non-pese { background: #FCE4D6; color: #C65911; font-weight: 700; }
td.poids-entree { font-style: italic; }
.compteurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
button.compteur {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px;
  border: 2px solid transparent; border-radius: 10px; font-weight: 500; white-space: normal; text-align: left;
}
button.compteur .valeur { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
button.compteur:hover { filter: brightness(.97); }
button.compteur.choisi { border-color: currentColor; }
button.compteur.eval-perte:hover { background: #FFC7CE; }
button.compteur.eval-faible:hover { background: #FFEB9C; }
button.compteur.eval-correct:hover { background: #EDF5E1; }
button.compteur.eval-bon:hover { background: #C6EFCE; }
button.compteur.eval-verifier:hover { background: #DDEBF7; }
details.seuils { padding: 14px 20px; }
details.seuils summary { cursor: pointer; font-size: 13px; color: var(--texte-2); }
details.seuils[open] summary { margin-bottom: 14px; }
details.seuils .barre .champ { flex: 0 1 170px; }
.entete-synthese { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; }
.tableau-synthese td { padding: 5px 8px; }

/* Inventaire */
table.inventaire td { padding: 4px 6px; }
table.inventaire td.saisie-cellule input { padding: 6px 8px; font-size: 14px; }
input.saisie-poids { width: 92px; }
input.saisie-loge { width: 64px; }
input.saisie-comm { min-width: 160px; }
input.loge-changee { background: #FCE4D6; color: #833C0B; font-weight: 700; border-color: #F8CBAD; }
td.positif { color: #375623; font-weight: 600; }
td.alerte-gmq { background: var(--erreur-fond); }
td.etat-ligne { white-space: nowrap; }
.statut-saisie { display: inline-block; width: 1.2em; text-align: center; font-weight: 700; color: var(--texte-3); }
.statut-saisie.ok { color: var(--succes); }
.statut-saisie.ko { color: var(--erreur); cursor: help; }
.bandeau-inventaire { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: var(--texte); border-color: var(--accent); background: var(--accent-clair); }
.bandeau-inventaire span { color: var(--accent-fonce); }
.dialogue .alerte, .dialogue .erreur { font-weight: 500; }
.dialogue .liste { margin-top: 4px; }

/* Courbes de la fiche animal */
.courbes { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.graphique { margin: 0; }
.graphique figcaption { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.graphique svg { width: 100%; height: auto; display: block; overflow: visible; }
.graphique text { font-size: 11px; fill: var(--texte-2); font-variant-numeric: tabular-nums; }
.graphique .grille line { stroke: var(--bord); stroke-width: 1; }
.graphique .repere line { stroke: var(--ambre); stroke-width: 1; stroke-dasharray: 5 4; }
.graphique .repere text { fill: var(--ambre); font-size: 10.5px; }
.graphique .repere.zero line { stroke: var(--texte-2); stroke-dasharray: none; }
.graphique .trace { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; }
.graphique .point { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.graphique .point.alerte { stroke: var(--erreur); fill: var(--erreur-fond); }

/* Observations */
.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }
.tableau-obs td { padding: 6px 10px; }
.tableau-obs tr.total td { font-weight: 700; border-top: 2px solid var(--bord); background: var(--sourd); }
textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--bord); border-radius: 8px; background: var(--surface);
  color: var(--texte); font: inherit; line-height: 1.5; resize: vertical;
}
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.texte-imprime { display: none; white-space: pre-wrap; }
.texte-analyse { line-height: 1.5; max-width: 900px; }
.texte-analyse h3 { font-size: 15px; margin: 14px 0 4px; }
.texte-analyse p { margin: 4px 0; }
.texte-analyse ul { margin: 4px 0; padding-left: 22px; }
.texte-analyse li { margin: 2px 0; }
.analyse-claude textarea { min-height: 0; }
.texte-version { white-space: pre-wrap; padding: 10px 12px; background: var(--sourd); border-radius: 8px; font-size: 13px; }
.versions { margin-top: 10px; gap: 12px; }

/* Saisie terrain (téléphone) : gros champs, gros boutons */
.terrain { max-width: 560px; margin: 0 auto; }
.bandeau-terrain { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 14px; }
.attente-envoi { color: var(--ambre); font-weight: 600; }
button.petit { padding: 4px 10px; font-size: 12.5px; }
input.grand { font-size: 22px; padding: 14px 14px; font-variant-numeric: tabular-nums; }
.grand-bouton { width: 100%; padding: 16px; font-size: 18px; border-radius: 10px; }
button.danger:not(.lien) { background: var(--erreur); border-color: var(--erreur); }
button.danger:not(.lien):hover { background: #991b1b; }
.choix-animaux { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
button.choix { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 12px 14px; font-weight: 500; white-space: normal; text-align: left; }
button.choix strong { font-size: 16px; }
button.choix span { font-size: 12px; color: var(--texte-2); }
.boucle-terrain { margin: 0; font-size: 22px; font-variant-numeric: tabular-nums; }
.grille-terrain { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 16px; margin: 0; }
.grille-terrain dt { font-size: 12px; color: var(--texte-2); }
.grille-terrain dd { margin: 2px 0 0; font-weight: 600; font-size: 15px; }
.apercu { margin: -4px 0 0; font-size: 14px; font-weight: 600; color: var(--texte-2); min-height: 1.5em; }
.apercu.negatif { color: var(--erreur); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
button.chip { padding: 8px 12px; border-radius: 999px; background: var(--surface); color: var(--texte); border-color: var(--bord); font-weight: 500; font-size: 13.5px; }
button.chip:hover { background: var(--sourd); }
button.chip.choisi { background: var(--accent-clair); border-color: var(--accent); color: var(--accent-fonce); font-weight: 700; }
.deux-terrain { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.alerte-terrain { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 10px; background: var(--erreur-fond); color: var(--erreur); border: 1px solid #fecaca; font-size: 14.5px; }
.ligne-file { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 14px; }
.loge-restants { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.terrain details summary { cursor: pointer; font-weight: 600; }

/* Pages larges (Analyse, Pesées, Inventaire) : toute la largeur de l'écran, et
   tableau resserré pour voir toutes les colonnes sans faire défiler. */
table.analyse { font-size: 12.5px; }
table.analyse th { white-space: normal; vertical-align: bottom; padding: 6px 6px; font-size: 10.5px; line-height: 1.25; }
table.analyse td { padding: 5px 6px; }
table.analyse td.evaluation { font-size: 12px; }

/* Tri des tableaux : titres cliquables, flèche sur la colonne triée */
th.triable { cursor: pointer; user-select: none; }
th.triable:hover { color: var(--texte); background: var(--sourd); }
th.triable::after { content: ' ↕'; color: var(--texte-3); font-size: 10px; }
th.tri-asc::after { content: ' ▲'; color: var(--accent); }
th.tri-desc::after { content: ' ▼'; color: var(--accent); }
@media print { th.triable::after { content: none; } }

/* Impression : seule la synthèse, sur A4 portrait, couleurs conservées */
@page { size: A4 portrait; margin: 10mm; }
@media print {
  body { background: #fff; font-size: 11px; }
  header, .ecran-seul, .dialogue { display: none !important; }
  main.cadre { max-width: none; padding: 0; }
  .synthese { gap: 8px; }
  .synthese h1 { font-size: 16px; }
  .tableau { overflow: visible; }
  .tableau-synthese th { font-size: 9px; padding: 4px 6px; }
  .tableau-synthese td { padding: 3px 6px; }
  .tableau-synthese thead { display: table-header-group; } /* en-tête répété sur chaque page */
  .tableau-synthese tr { break-inside: avoid; }
  td a { color: inherit; }
  .observations .carte { break-inside: avoid; padding: 10px 0; border: 0; }
  .texte-imprime { display: block; }
  .observations .carte.analyse-claude { break-inside: auto; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

@media (max-width: 760px) {
  .saisie { grid-template-columns: 1fr 1fr; }
  .saisie .champ:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  :root { --marge: 10px; }
  header { position: static; } /* bandeau haut sur téléphone : ne pas le garder à l'écran */
  .barre-haut { padding-top: 8px; padding-bottom: 8px; }
  .fil { order: 3; width: 100%; }
  .qui { gap: 4px 12px; }
  main { padding-top: 16px; }
  .deux { grid-template-columns: 1fr; }
  .filtres .champ { flex: 1 1 140px; }
  input, select, textarea { font-size: 16px; } /* évite le zoom automatique d'iOS */
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* Alimentation */
.saisie-ration { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.saisie-ration input { font-size: 16px; padding: 11px 12px; }
.calcul-ration { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--accent-clair); color: var(--texte); font-size: 14px; }
.calcul-ration:empty { display: none; }
.detail-ms { display: block; font-size: 11.5px; font-weight: 400; color: var(--texte-2); white-space: nowrap; }
.calcul-ration .alerte { display: inline-block; padding: 2px 6px; }
td.alerte { border-radius: 0; padding: 6px 8px; }
.alimentation tr.choisie td { background: var(--accent-clair); }
.alimentation td.a-saisir { color: var(--ambre); font-style: italic; }
.alimentation td.incomplet { color: var(--ambre); font-weight: 600; }
.alimentation td.fort { font-weight: 700; }
.alimentation .titre-actions .champ { flex: 0 0 160px; }
.reglages-ration summary { cursor: pointer; font-weight: 600; }
.reglages-ration[open] summary { margin-bottom: 14px; }
.tuile.a-faire .valeur { color: var(--ambre); }

/* Accueil : deux sections illustrées */
.sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 18px; }
.tuile-section {
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--bord); border-radius: 14px;
  background: var(--surface); color: var(--texte); text-decoration: none; transition: box-shadow .15s, transform .15s;
}
.tuile-section:hover { box-shadow: 0 6px 20px rgba(15, 23, 42, .12); transform: translateY(-1px); }
.tuile-section img { width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; display: block; background: var(--sourd); }
.tuile-section .titre-section { font-size: 20px; font-weight: 700; padding: 14px 18px 2px; }
.tuile-section .texte-section { color: var(--texte-2); font-size: 14px; padding: 0 18px 16px; }

/* Exploitation */
table.indicateurs tr.sous-ligne td:first-child, table.historique tr.sous-ligne td:first-child { padding-left: 26px; color: var(--texte-2); }
table.indicateurs tr.total td, table.historique tr.total td { font-weight: 700; }
td.fort { font-weight: 700; }
dd.normal { font-weight: 400; }
.inventaire-pre .saisie-boucle { font-size: 28px; letter-spacing: .1em; padding: 12px 14px; font-variant-numeric: tabular-nums; }
.statuts-pre { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.statuts-pre button { background: var(--surface); color: var(--texte); border: 2px solid var(--bord); }
.statuts-pre .statut-present.choisi { background: var(--succes-fond); color: var(--succes); border-color: var(--succes); }
.statuts-pre .statut-absent.choisi { background: var(--ambre-fond); color: var(--ambre); border-color: var(--ambre); }
.choix-pre { text-align: left; justify-content: flex-start; }
.cases-anomalies { gap: 8px; }
.ligne-produit .champ { flex: 1 1 140px; }
code.formule, textarea.formule { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
code.formule { white-space: pre-wrap; word-break: break-word; }
.statuts-pre button:hover { background: var(--sourd); }
.statuts-pre .statut-present.choisi:hover { background: var(--succes-fond); }
.statuts-pre .statut-absent.choisi:hover { background: var(--ambre-fond); }

/* ── Présentation commune (revue du 19/11/2026) ───────────────────────────── */
/* Titres de partie : même taille partout, sans marge en trop dans une carte. */
main h2, .sous-titre { font-size: 16px; line-height: 1.35; margin: 0 0 12px; }
main h3.sous-titre { font-size: 14.5px; }
.pile > .sous-titre, .pile > h2, .titre-actions .sous-titre { margin-bottom: 0; }
.dialogue h2 { margin: 0 0 14px; font-size: 17px; }
/* Titre de groupe (écran Import / export). */
.titre-groupe { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--bord); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em; color: var(--texte-2); }
/* Texte d'explication : lignes de longueur lisible, même sur une page large. */
main .pile > p.info, .carte > p.info, .carte > .pile > p.info { max-width: 110ch; }
main .pile > p.info { margin: 0; }
.retour { align-self: flex-start; }
/* Parties repliables : même présentation partout. */
details > summary { cursor: pointer; font-weight: 600; }
details.carte[open] > summary { margin-bottom: 14px; }
details details > summary { font-weight: 500; }
/* Accueil : centré. */
.accueil { max-width: 980px; width: 100%; margin: 0 auto; }
.entete-accueil { text-align: center; }
.entete-accueil h1 { font-size: 26px; }
.entete-accueil p { margin: 0; }
.sections { margin-top: 8px; }
.tuile-section .titre-section, .tuile-section .texte-section { text-align: center; }
/* Tableaux : en-têtes alignés comme leur colonne, lignes repérables. */
th.nombre { text-align: right; }
.tableau table { min-width: 100%; }
td .info { font-size: 12.5px; }
select.choix-acces { width: auto; min-width: 150px; padding: 5px 8px; font-size: 13px; }
table.utilisateurs td { white-space: nowrap; }
/* Message vide ou de chargement dans une carte. */
.carte > p.info:only-child, .tableau > p.info:only-child { margin: 0; }
/* Export : choix des onglets */
.groupe-onglets { border: 1px solid var(--bord); border-radius: 10px; padding: 10px 14px 12px; margin: 0; }
.groupe-onglets legend { padding: 0 6px; font-weight: 600; font-size: 13.5px; }
.groupe-onglets legend .lien { font-size: 12.5px; margin-left: 6px; }
.cases-onglets { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px 16px; }

/* Animaux : cases de sélection et liste pour le vacher */
th.case-choix, td.case-choix { width: 36px; text-align: center; cursor: default; }
td.case-choix input, th.case-choix input { width: 18px; height: 18px; margin: 0; cursor: pointer; }
.liste-vacher td.notes { min-width: 260px; }
.liste-vacher td.case-a-cocher { text-align: center; font-size: 16px; }
.liste-vacher .consigne-imprimee { font-weight: 600; }
@media print {
  .liste-vacher .tableau-synthese td { padding: 8px 6px; font-size: 12px; } /* place pour écrire à la main */
  .liste-vacher .tableau-synthese td.notes { border-left: 1px solid #999; }
}

/* ── Exploitation : revue du 26/11/2026 ───────────────────────────────────── */
/* Indicateurs et historique : première colonne fixe, colonnes de chiffres de
   même largeur (le tableau défile s'il est plus large que l'écran). */
/* La largeur du tableau est posée par l'écran (style) selon le nombre de
   colonnes : colonnes étroites et égales ; sur un petit écran, il défile. */
table.indicateurs, table.historique { table-layout: fixed; }
table.indicateurs th.nombre, table.indicateurs td.nombre,
table.historique th.nombre, table.historique td.nombre { text-align: center; padding-left: 6px; padding-right: 6px; }
table.indicateurs th, table.historique th { white-space: normal; overflow-wrap: anywhere; vertical-align: bottom; line-height: 1.3; }
table.indicateurs th:first-child, table.indicateurs td:first-child,
table.historique th:first-child, table.historique td:first-child { width: 260px; white-space: normal; }
@media (max-width: 640px) {
  table.indicateurs th:first-child, table.indicateurs td:first-child,
  table.historique th:first-child, table.historique td:first-child { width: 190px; }
}

/* Animaux de l'exploitation */
table.liste-animaux td { white-space: nowrap; }
table.liste-animaux td.commentaire-animal { white-space: normal; min-width: 180px; max-width: 320px; }
table.liste-animaux tr.ligne-atelier td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
ul.commentaires { list-style: none; padding-left: 0; gap: 8px; }

/* Prévisionnel de vente */
table.grille-previsionnel th.nombre, table.grille-previsionnel td.nombre { text-align: center; }
table.grille-previsionnel td.saisie-cellule { padding: 4px; text-align: center; }
table.grille-previsionnel td.saisie-cellule input { display: block; width: 64px; margin: 0 auto; padding: 6px; text-align: center; font-variant-numeric: tabular-nums; }
table.grille-previsionnel td.saisie-cellule .detail-ms { text-align: center; }
table.grille-previsionnel input.enregistre { border-color: var(--succes); }
table.grille-previsionnel input.erreur-saisie { border-color: var(--erreur); background: var(--erreur-fond); }
table.grille-previsionnel td:first-child { white-space: nowrap; font-weight: 600; }
.choix-annee { align-items: center; gap: 10px; }
.choix-annee strong { font-size: 18px; min-width: 3em; text-align: center; }

/* Inventaire : saisie au téléphone */
.statuts-pre .grand-bouton { min-height: 64px; font-size: 20px; font-weight: 700; }
.choix-pre { width: 100%; min-height: 48px; }
details.anomalies-pre summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
details.anomalies-pre[open] summary { margin-bottom: 8px; }
.cases-anomalies .case { min-height: 36px; }
@media (max-width: 640px) {
  .masquer-mobile { display: none; }
  .inventaire-pre .tuiles { grid-template-columns: 1fr 1fr; }
  .inventaire-pre .tuile .valeur { font-size: 22px; }
  .inventaire-pre .boutons button, .inventaires-pre form button { width: 100%; }
  .boucle-terrain { font-size: 26px; text-align: center; }
}

/* Animaux : filtre par loge, menu déroulant à cases (plusieurs loges possibles) */
.menu-cases { position: relative; min-width: 140px; }
.menu-cases summary { list-style: none; cursor: pointer; padding: 9px 30px 9px 11px; border: 1px solid var(--bord); border-radius: 8px; color: var(--texte);
  background: var(--surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; position: relative; }
.menu-cases summary::-webkit-details-marker { display: none; }
.menu-cases summary::after { content: '▾'; position: absolute; right: 10px; top: 50%; transform: translateY(-50%); }
.menu-cases-liste { position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; max-height: 320px; overflow-y: auto;
  padding: 6px 10px; border: 1px solid var(--bord); border-radius: 6px; background: var(--surface); box-shadow: 0 4px 14px rgba(0,0,0,.15); }
.menu-cases-liste .case { min-height: 32px; white-space: nowrap; }
