/* ============================================================
   FermeCompta — Feuille de style
   Système « Premium Agritech » : précision agricole.
   Émeraude profond pour la marque et la confiance, orange coucher
   de soleil pour l'action, crème chaud en fond pour le confort de
   lecture en extérieur. Le vert et le rouge restent réservés aux
   SIGNAUX comptables (recette / dépense).
   ============================================================ */

:root {
  /* Fonds & encre */
  --fond: #fdfbf7;              /* crème chaud, moins éblouissant que le blanc */
  --surface: #ffffff;
  --surface-2: #f6f8f7;
  --encre: #121c2a;
  --encre-douce: #404944;
  --ligne: rgba(6, 78, 59, 0.10);
  --ligne-forte: rgba(6, 78, 59, 0.18);

  /* Couleurs de marque */
  --teal: #064e3b;              /* émeraude : navigation, en-têtes */
  --teal-fonce: #003527;
  --teal-clair: #e8f2ee;
  --teal-vif: #2b6954;
  --orange: #fd761a;            /* appels à l'action */
  --orange-fonce: #9d4300;
  --orange-clair: #ffe9d9;

  /* Signaux comptables (uniquement pour les chiffres) */
  --vert: #0b7a53;
  --vert-fond: #e3f3ec;
  --rouge: #ba1a1a;
  --rouge-fond: #ffdad6;
  --ambre: #9d4300;
  --bleu: #2b6954;

  /* Formes — rythme de 8 px, coins généreux */
  --rayon: 24px;                /* cartes et panneaux */
  --rayon-sm: 12px;             /* boutons, champs, puces */
  --ombre: 0 4px 20px rgba(6, 78, 59, 0.05);
  --ombre-forte: 0 12px 32px rgba(6, 78, 59, 0.09);
  --ombre-haute: 0 24px 60px rgba(6, 78, 59, 0.22);

  /* Typographie */
  --police-titre: "Manrope", "Segoe UI", system-ui, sans-serif;
  --police-texte: "Inter", "Segoe UI", system-ui, sans-serif;
}

/* ---------- Icônes ----------
   Tracés SVG en ligne : ils suivent la couleur du texte et
   s'alignent optiquement avec lui. */
.ico {
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  vertical-align: -0.25em;
}
.ico.petite { width: 1em; height: 1em; vertical-align: -0.15em; }
.ico.grosse { width: 1.6em; height: 1.6em; }

* { box-sizing: border-box; }

.visuellement-cache {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* L'attribut hidden doit toujours gagner, même sur les éléments
   qui ont un display défini plus bas (ex : .modal-fond en flex). */
[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  max-width: 100%;
  overflow-x: hidden;
  background: var(--fond);
}

body {
  margin: 0;
  font-family: var(--police-texte);
  background: var(--fond);
  color: var(--encre);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  max-width: 100%;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ============================================================
   Menu latéral
   ------------------------------------------------------------
   Largeur pleine sur grand écran, réduit aux icônes d'un clic,
   et tiroir coulissant sur téléphone (bouton ☰).
   ============================================================ */
:root {
  --menu-large: 250px;
  --menu-reduit: 72px;
}

.barre-laterale {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 40;
  width: var(--menu-large);
  display: flex;
  flex-direction: column;
  background: var(--teal);
  color: #fff6ee;
  border-right: 3px solid var(--orange);
  transition: width 0.22s ease, transform 0.24s ease;
  /* Volontairement « visible » : la poignée de repli déborde sur le
     contenu et serait tranchée en deux par un overflow caché.
     C'est la liste des menus qui gère son propre défilement. */
  overflow: visible;
}

/* ----- En-tête du menu ----- */
.bl-entete {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 14px;
  border-bottom: 1px solid rgba(255, 246, 238, 0.14);
  position: relative;
}
.logo {
  flex-shrink: 0;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border-radius: 12px;
  font-size: 1.25rem;
}
.logo-image { width: 42px; height: 42px; display: block; object-fit: contain; border-radius: 12px; }
.bl-identite { min-width: 0; }
.bl-identite strong {
  display: block;
  font-family: var(--police-titre);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  line-height: 1.1;
  white-space: nowrap;
}
.bl-identite small {
  font-size: 0.74rem;
  opacity: 0.78;
  white-space: nowrap;
}

/* Poignée de réduction (le chevron) */
.bl-bascule {
  position: absolute;
  right: -13px;
  top: 26px;
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--fond);
  background: var(--orange);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: transform 0.22s ease;
}
.bl-bascule:hover { background: var(--orange-fonce); }

/* ----- Éléments de menu ----- */
.bl-menu {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.onglet {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 11px 12px;
  border-radius: var(--rayon-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  color: rgba(255, 246, 238, 0.82);
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}
.onglet:hover { background: rgba(255, 246, 238, 0.12); color: #fff6ee; }
.onglet.actif {
  background: var(--orange);
  color: #fff;
  font-weight: 800;
}
.bl-ico {
  flex-shrink: 0;
  width: 24px;
  font-size: 1.1rem;
  text-align: center;
  line-height: 1;
}
.bl-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

.bl-separateur {
  height: 1px;
  background: rgba(255, 246, 238, 0.14);
  margin: 8px 12px;
}

/* ----- Pied du menu : la ferme active ----- */
.bl-pied {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255, 246, 238, 0.14);
}
.bl-ferme {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 9px 12px;
  border-radius: var(--rayon-sm);
  background: rgba(255, 246, 238, 0.1);
}
.bl-ferme .bl-txt { display: flex; flex-direction: column; line-height: 1.25; }
.bl-ferme strong {
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bl-ferme small { font-size: 0.72rem; opacity: 0.75; white-space: nowrap; }

/* ----- Menu réduit : les icônes seules ----- */
body.menu-reduit .barre-laterale { width: var(--menu-reduit); }
body.menu-reduit .bl-identite,
body.menu-reduit .bl-txt { display: none; }
body.menu-reduit .bl-entete { justify-content: center; padding: 16px 8px; }
body.menu-reduit .onglet,
body.menu-reduit .bl-ferme { justify-content: center; padding-left: 0; padding-right: 0; }
body.menu-reduit .bl-bascule { transform: rotate(180deg); }
body.menu-reduit .colonne-contenu { margin-left: var(--menu-reduit); }
body.menu-reduit #zone-vocale,
body.menu-reduit .banniere-installation { left: calc(var(--menu-reduit) + 14px); }

/* ============================================================
   Colonne de contenu & barre du haut
   ============================================================ */
.colonne-contenu {
  margin-left: var(--menu-large);
  transition: margin-left 0.22s ease;
  min-width: 0;
}

header {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  background: rgba(255, 253, 250, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--ligne);
}

#titre-page {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--police-titre);
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--encre);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Bouton ☰ : seulement sur téléphone */
.btn-menu {
  display: none;
  border: none;
  background: transparent;
  color: var(--encre);
  font-size: 1.4rem;
  line-height: 1;
  padding: 4px 6px;
  cursor: pointer;
  border-radius: 8px;
}
.btn-menu:hover { background: var(--surface-2); }

.actions-entete {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-installer-app {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(253, 118, 26, 0.32);
  border-radius: 99px;
  background: var(--orange-clair);
  color: var(--orange-fonce);
  padding: 7px 12px;
  font: 800 0.8rem var(--police-texte);
  cursor: pointer;
  white-space: nowrap;
}
.btn-installer-app:hover,
.btn-installer-app:focus-visible {
  background: var(--orange);
  color: #fff;
  outline: none;
}

.etiquette-ferme {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-clair);
  border: 1px solid rgba(13, 95, 90, 0.22);
  border-radius: 99px;
  padding: 5px 12px;
  max-width: 230px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Voile sombre derrière le tiroir, sur téléphone */
.voile-menu {
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(20, 12, 8, 0.5);
  animation: apparition-fond 0.2s ease;
}

/* ---------- Contenu ---------- */
main {
  max-width: 1020px;
  margin: 0 auto;
  /* Le bas laisse juste la place de la barre vocale flottante (~150 px),
     sans creuser un grand vide sous le contenu. */
  padding: 24px 20px 185px;
}

h2 {
  font-family: var(--police-titre);
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  margin: 4px 0 18px;
  color: var(--encre);
}
h3 {
  margin: 0 0 14px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--encre-douce);
}

.entete-dashboard {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 4px 0 18px;
}
.entete-dashboard h2 { margin: 0; }
.note-mois-dashboard { margin: 4px 0 0; }
.choix-dashboard {
  display: grid;
  grid-template-columns: minmax(86px, auto) minmax(170px, 1fr);
  gap: 10px;
  align-items: end;
  width: min(360px, 48vw);
}
.choix-dashboard label,
.choix-mois-dashboard {
  color: var(--encre-douce);
  font-size: 0.7rem;
}
.choix-dashboard select,
.choix-dashboard input,
.choix-mois-dashboard select {
  margin-top: 4px;
  min-height: 42px;
  color: var(--encre);
  font-size: 0.86rem;
  font-weight: 700;
}
.choix-dashboard label[hidden] { display: none; }

.etat-vide {
  text-align: center;
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 36px 22px;
  margin-bottom: 22px;
}
.etat-vide .grand {
  font-family: var(--police-titre);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin: 0 0 10px;
}
.etat-vide em { color: var(--teal); font-style: normal; font-weight: 600; }

/* ---------- Cartes de synthèse ---------- */
.cartes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 22px;
}

.carte {
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.carte-titre {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.carte-valeur {
  font-family: var(--police-titre);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.carte.recette .carte-valeur { color: var(--vert); }
.carte.depense .carte-valeur { color: var(--rouge); }
.carte.solde   .carte-valeur { color: var(--encre); }
.carte.total   .carte-valeur { color: var(--teal); }

/* ---------- Panneaux ---------- */
.panneau {
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 18px;
  margin-bottom: 22px;
}

.zone-danger-ferme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-color: #efc2c2;
  box-shadow: none;
}
.zone-danger-ferme h3 { color: var(--rouge); }
.zone-danger-ferme .aide { margin: 0; }
.zone-danger-ferme .btn { flex: none; }

.deux-colonnes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px;
}

/* ---------- Barres par catégorie ---------- */
.ligne-barre {
  display: grid;
  grid-template-columns: 128px 1fr 88px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.85rem;
}
.ligne-barre-action {
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: var(--rayon-sm);
  padding: 4px 6px;
}
.ligne-barre-action:hover,
.ligne-barre-action:focus-visible {
  background: var(--surface-2);
  outline: none;
}
.barre-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-fond {
  background: #f2e6dc;
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}
.barre-remplissage {
  height: 100%;
  border-radius: 99px;
  transition: width 0.45s ease;
}
.barre-remplissage.depense { background: var(--rouge); }
.barre-remplissage.recette { background: var(--vert); }
.barre-montant {
  text-align: right;
  font-weight: 700;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.filtre-journal-actif {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--ligne);
  background: var(--vert-fond);
  color: var(--vert);
  border-radius: var(--rayon-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 0.86rem;
}
.filtre-journal-actif span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}
.filtre-journal-actif strong { color: var(--encre); }

/* ---------- Graphe 6 mois ---------- */
.graphe {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 150px;
  padding-top: 10px;
}
.colonne-mois {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.colonne-barres {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 112px;
}
.mini-barre {
  width: 13px;
  border-radius: 4px 4px 0 0;
  min-height: 3px;
  transition: height 0.45s ease;
}
.mini-barre.recette { background: var(--vert); }
.mini-barre.depense { background: var(--rouge); }
.colonne-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--encre-douce);
}

.legende {
  display: flex;
  gap: 18px;
  justify-content: center;
  font-size: 0.78rem;
  color: var(--encre-douce);
  margin-top: 10px;
}
.pastille {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 5px;
}
.pastille.recette { background: var(--vert); }
.pastille.depense { background: var(--rouge); }

/* ---------- Dernières opérations ---------- */
.op-recente {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--ligne);
}
.op-recente:last-child { border-bottom: none; }
.op-infos { flex: 1; min-width: 0; }
.op-infos strong { display: block; font-size: 0.9rem; font-weight: 700; }
.op-infos small {
  color: var(--encre-douce);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- Badges & montants ---------- */
.badge {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 99px;
  white-space: nowrap;
}
.badge-recette { background: var(--vert-fond); color: var(--vert); }
.badge-depense { background: var(--rouge-fond); color: var(--rouge); }

.montant-positif, .montant-negatif {
  font-weight: 800;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.montant-positif { color: var(--vert); }
.montant-negatif { color: var(--rouge); }

/* ---------- Barre d'outils ---------- */
.barre-outils {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.barre-outils select {
  padding: 10px 12px;
  border-radius: var(--rayon-sm);
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--encre);
  cursor: pointer;
}
.barre-outils select:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 3px var(--orange-clair);
}
.espace { flex: 1; }

/* ---------- Boutons ---------- */
.btn {
  border: none;
  background: var(--orange);
  color: #ffffff;
  padding: 10px 18px;
  border-radius: var(--rayon-sm);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.btn:hover { background: var(--orange-fonce); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
  outline: 3px solid var(--orange-clair);
  outline-offset: 2px;
}

.btn.secondaire {
  background: var(--surface);
  color: var(--teal);
  border: 1.5px solid var(--teal);
}
.btn.secondaire:hover { background: var(--teal-clair); }

.btn.petit { padding: 7px 13px; font-size: 0.82rem; }

.btn.danger, .btn.discret {
  background: transparent;
  padding: 5px 8px;
}
.btn.danger { color: var(--rouge); }
.btn.discret { color: var(--encre-douce); }
.btn.danger:hover, .btn.discret:hover { background: var(--surface-2); }

/* ---------- Tableau ---------- */
.tableau-conteneur { overflow-x: auto; padding: 4px 0 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { padding: 12px 14px; text-align: left; }
thead th {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--encre-douce);
  border-bottom: 2px solid var(--ligne-forte);
}
tbody tr {
  border-bottom: 1px solid var(--ligne);
  transition: background 0.12s;
}
tbody tr:hover { background: var(--surface-2); }
tfoot td {
  font-weight: 800;
  border-top: 2px solid var(--ligne-forte);
  background: var(--surface-2);
}
.droite { text-align: right; }
.cellule-vide { text-align: center; color: var(--encre-douce); padding: 28px; }

/* ---------- Choix de dates précises (journal & rapport) ---------- */
.dates-perso {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dates-perso label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.dates-perso input[type="date"] {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--encre);
  background: var(--surface);
  border: 1.5px solid var(--ligne-forte);
  border-radius: 10px;
  padding: 8px 10px;
}
.dates-perso input[type="date"]:focus {
  outline: none;
  border-color: var(--orange);
}

/* Explication placée sous la barre d'outils des dettes & créances. */
.aide-credits {
  margin: -4px 0 14px;
  max-width: 720px;
}

/* ---------- Journal : un tableau par mois / catégorie / bande ---------- */
.groupe-journal { padding-top: 16px; }
.groupe-journal + .groupe-journal { margin-top: 16px; }

.groupe-entete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--ligne-forte);
}
.groupe-titre h3 { margin: 0; font-size: 1.05rem; }
.groupe-titre small { color: var(--encre-douce); font-size: 0.76rem; }

.groupe-totaux {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  flex-wrap: wrap;
}
.groupe-solde {
  font-size: 0.95rem;
  font-weight: 800;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--surface-2);
}
/* L'en-tête du groupe porte déjà les totaux : le tableau reste sobre. */
.groupe-journal thead th { border-bottom: 1px solid var(--ligne); }
/* Une date ne se coupe pas en deux lignes. */
.groupe-journal tbody td:first-child { white-space: nowrap; }

/* ---------- Journal : le bilan de ce qui est affiché ---------- */
.bilan-journal {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 30px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.bj-poste { display: flex; flex-direction: column; gap: 2px; }
.bj-poste span {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.bj-poste strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.bj-solde {
  padding-left: 30px;
  border-left: 1px solid var(--ligne);
}
.bj-solde strong { font-size: 1.4rem; font-family: var(--police-titre); }

/* ---------- Rapport ---------- */
.table-rapport { font-size: 0.88rem; }
.table-rapport td { padding: 10px 4px; }
.table-rapport td:last-child {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.table-rapport tr { border-bottom: 1px solid var(--ligne); }
.table-rapport tr.ligne-total td {
  border-top: 2px solid var(--orange);
  border-bottom: none;
  font-weight: 800;
  color: var(--encre);
  padding-top: 12px;
}

/* ---------- Barre vocale flottante ---------- */
#zone-vocale {
  position: fixed;
  bottom: 16px;
  /* Centrée sur la COLONNE DE CONTENU, pas sur la fenêtre : sinon elle
     glisse sous le menu et laisse un grand vide à droite. */
  left: calc(var(--menu-large) + 14px);
  right: 14px;
  /* width:auto laisse left/right définir la bande disponible,
     et margin:auto centre la barre dedans. */
  width: auto;
  margin: 0 auto;
  transition: left 0.22s ease;
  max-width: 780px;
  background: var(--surface);
  border: 1.5px solid var(--ligne-forte);
  border-radius: 20px;
  box-shadow: 0 10px 34px rgba(36, 22, 16, 0.16);
  padding: 12px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  z-index: 30;
}

#transcription-live {
  background: var(--teal-clair);
  color: var(--teal);
  border-radius: var(--rayon-sm);
  padding: 9px 16px;
  font-weight: 600;
  font-style: italic;
  width: 100%;
  text-align: center;
}

.exemples {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
}
.chip {
  border: 1.5px solid var(--ligne);
  background: var(--fond);
  border-radius: 99px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--encre-douce);
  transition: all 0.15s;
}
.chip:hover {
  background: var(--orange-clair);
  border-color: var(--orange);
  color: var(--orange-fonce);
}

.barre-vocale {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: center;
}
#saisie-texte {
  flex: 1;
  min-width: 0;
  padding: 13px 18px;
  border-radius: 99px;
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--encre);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#saisie-texte:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-clair);
}
#saisie-texte::placeholder { color: #b7a396; }

.btn.rond {
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 1.02rem;
  padding: 0;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn.micro {
  font-size: 1.3rem;
  width: 54px; height: 54px;
  background: var(--orange);
  box-shadow: 0 5px 14px rgba(226, 87, 31, 0.4);
}
.btn.micro:hover { background: var(--orange-fonce); }
.btn.micro.actif {
  background: var(--rouge);
  animation: pulsation 1.2s infinite;
}
@keyframes pulsation {
  0%   { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0.5); }
  70%  { box-shadow: 0 0 0 18px rgba(192, 57, 43, 0); }
  100% { box-shadow: 0 0 0 0 rgba(192, 57, 43, 0); }
}

#statut-vocal {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--encre-douce);
  min-height: 1.1em;
  text-align: center;
}

/* ---------- Fenêtre modale ---------- */
.modal-fond {
  position: fixed;
  inset: 0;
  background: rgba(20, 12, 8, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
  animation: apparition-fond 0.18s ease;
}
@keyframes apparition-fond {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-boite {
  background: var(--surface);
  border: 1.5px solid var(--ligne-forte);
  border-top: 4px solid var(--orange);
  border-radius: 18px;
  padding: 24px;
  width: 100%;
  max-width: 540px;
  box-shadow: var(--ombre-haute);
  animation: apparition-boite 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes apparition-boite {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-boite h3 {
  margin-top: 0;
  font-family: var(--police-titre);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  text-transform: none;
  color: var(--encre);
}

.note-analyse {
  background: var(--teal-clair);
  color: var(--teal);
  border-left: 3px solid var(--teal);
  border-radius: var(--rayon-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  font-weight: 600;
}

.grille-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 14px;
}

/* Champs de formulaire (modale, réglages, assistant, connexion) */
.modal-boite label,
.grille-reglages label,
#form-auth label,
#form-config label,
.config-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--encre-douce);
}

.modal-boite input, .modal-boite select,
.grille-reglages input, .grille-reglages select,
#form-auth input,
#form-config input, #form-config select {
  padding: 11px 13px;
  border-radius: var(--rayon-sm);
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: normal;
  text-transform: none;
  color: var(--encre);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.modal-boite input:focus, .modal-boite select:focus,
.grille-reglages input:focus, .grille-reglages select:focus,
#form-auth input:focus,
#form-config input:focus, #form-config select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-clair);
  outline: none;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ============================================================
   Compte & synchronisation
   ============================================================ */
.zone-compte {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
}

.badge-sync {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--ligne-forte);
  flex-shrink: 0;
  transition: background 0.3s;
}
.badge-sync.ok   { background: var(--vert); box-shadow: 0 0 0 3px var(--vert-fond); }
.badge-sync.sync { background: var(--ambre); animation: clignote 1s infinite; }
.badge-sync.off  { background: var(--ambre); }
.badge-sync.err  { background: var(--rouge); box-shadow: 0 0 0 3px var(--rouge-fond); }
@keyframes clignote { 50% { opacity: 0.35; } }

.btn-compte {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.btn-compte .avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--teal);
  border: 1.5px solid var(--orange);
  color: #fff6ee;
  font-family: var(--police-titre);
  font-weight: 800;
  font-size: 1rem;
}
.btn-compte:hover .avatar { background: var(--orange); }

.menu-compte {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 232px;
  background: var(--surface);
  border: 1.5px solid var(--ligne-forte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-haute);
  padding: 8px;
  z-index: 40;
  animation: apparition-boite 0.16s ease;
}
.menu-email {
  padding: 8px 12px 4px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--encre);
  overflow: hidden; text-overflow: ellipsis;
}
.menu-sync-etat {
  padding: 0 12px 8px;
  font-size: 0.76rem;
  color: var(--encre-douce);
  border-bottom: 1px solid var(--ligne);
  margin-bottom: 6px;
}
.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 9px 12px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--encre);
  cursor: pointer;
}
.menu-item:hover { background: var(--orange-clair); color: var(--orange-fonce); }

.lien {
  background: none;
  border: none;
  padding: 0;
  color: var(--orange-fonce);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.lien:hover { color: var(--teal); }

/* ============================================================
   Écrans pleine page : connexion & assistant
   ============================================================ */
.auth-fond, .config-fond {
  position: fixed;
  inset: 0;
  background: var(--teal);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}
#ecran-auth.auth-fond {
  align-items: flex-start;
  background: #eef3f0;
}
.auth-fond { z-index: 60; }
.config-fond { z-index: 55; }

.auth-carte, .config-carte {
  background: var(--surface);
  border-top: 4px solid var(--orange);
  border-radius: 18px;
  box-shadow: var(--ombre-haute);
  padding: 30px 28px;
  width: 100%;
  animation: apparition-boite 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
.auth-carte { max-width: 430px; border-radius: 8px; }
.config-carte { max-width: 620px; }

#ecran-auth > .auth-carte {
  display: grid;
  grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
  width: min(960px, 100%);
  max-width: 960px;
  min-height: min(680px, calc(100dvh - 40px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--ligne);
  border-top: 0;
  border-radius: 8px;
  margin: auto 0;
}
.auth-visuel {
  position: relative;
  min-height: 100%;
  overflow: hidden;
  background: var(--teal);
}
.auth-visuel > img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.auth-visuel-voile {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 52, 43, 0.08), rgba(0, 52, 43, 0.86));
}
.auth-visuel-contenu {
  position: absolute;
  left: 30px;
  right: 30px;
  bottom: 32px;
  color: #fff;
}
.auth-visuel-contenu .logo-image {
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.18));
}
.auth-visuel-contenu strong {
  display: block;
  font-family: var(--police-titre);
  font-size: 1.8rem;
  line-height: 1.1;
}
.auth-visuel-contenu p {
  margin: 7px 0 0;
  font-size: 1rem;
}
.auth-contenu {
  align-self: center;
  width: 100%;
  padding: 32px 42px;
}
#ecran-auth .auth-logo { display: none; }

.auth-logo {
  display: flex; align-items: center; gap: 11px;
  margin-bottom: 18px;
}
.auth-logo .logo {
  width: 40px; height: 40px; font-size: 1.2rem;
  background: transparent;
}
.auth-logo .logo-image { width: 40px; height: 40px; }
.auth-logo strong {
  font-family: var(--police-titre);
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--encre);
}

.auth-carte h3, .config-carte h3 {
  font-family: var(--police-titre);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.6px;
  text-transform: none;
  color: var(--encre);
  margin: 0 0 4px;
}
.auth-sous, .config-sous {
  color: var(--encre-douce);
  font-size: 0.88rem;
  margin: 0 0 20px;
}

.auth-onglets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin: 0 0 14px;
  border-radius: 8px;
  background: var(--surface-2);
}
.auth-onglet {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--encre-douce);
  font: 700 0.86rem var(--police-texte);
  cursor: pointer;
}
.auth-onglet.actif {
  background: var(--surface);
  color: var(--encre);
  box-shadow: 0 2px 8px rgba(36, 22, 16, 0.1);
}
.facultatif {
  color: var(--encre-douce);
  font-size: 0.75rem;
  font-weight: 500;
}
.champ-mot-de-passe {
  position: relative;
  display: block;
}
.champ-mot-de-passe input { width: 100%; padding-right: 46px !important; }
.afficher-mdp {
  position: absolute;
  top: 50%;
  right: 5px;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--encre-douce);
  cursor: pointer;
}
.afficher-mdp:hover, .afficher-mdp:focus-visible {
  background: var(--surface-2);
  color: var(--teal);
  outline: none;
}
.auth-mdp-oublie {
  align-self: flex-end;
  margin-top: -8px;
  font-size: 0.78rem;
}
.auth-conditions {
  margin: -2px 8px 0;
  text-align: center;
  color: var(--encre-douce);
  font-size: 0.72rem;
}
#form-auth, #form-config { display: flex; flex-direction: column; gap: 14px; }
.auth-submit, .config-submit { width: 100%; padding: 13px; font-size: 0.95rem; margin-top: 4px; }

.auth-erreur {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  padding: 10px 13px;
  border-radius: var(--rayon-sm);
  background: var(--rouge-fond);
  color: var(--rouge);
  border-left: 3px solid var(--rouge);
}
.auth-erreur.info {
  background: var(--vert-fond);
  color: var(--vert);
  border-left-color: var(--vert);
}

.auth-bascule {
  text-align: center;
  font-size: 0.86rem;
  color: var(--encre-douce);
  margin: 18px 0 10px;
}
.auth-essai {
  margin-top: 4px;
}
.discret-equipe {
  border: 0;
  background: transparent;
  color: var(--teal);
  font-weight: 700;
  cursor: pointer;
}
.discret-equipe:hover { background: var(--teal-clair); }
body.modal-operation-ouverte { overflow: hidden; }
.auth-note-essai {
  margin: 8px 0 0;
  text-align: center;
  color: var(--encre-douce);
  font-size: 0.78rem;
}
.auth-pied {
  text-align: center;
  font-size: 0.72rem;
  color: var(--encre-douce);
  opacity: 0.7;
  margin: 20px 0 0;
}

.auth-alternatives {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.auth-alternatives > div { min-width: 0; }
.auth-alternatives .auth-submit {
  min-height: 46px;
  margin: 0;
}
.auth-alternatives .auth-note-essai,
.auth-alternatives .auth-note-equipe {
  margin: 7px 4px 0;
  line-height: 1.35;
}
#auth-options-secondaires[hidden] { display: none; }

@media (min-width: 721px) and (max-height: 800px) {
  #ecran-auth .auth-contenu { padding: 20px 34px; }
  #ecran-auth .auth-sous { margin-bottom: 12px; }
  #ecran-auth .auth-onglets { margin-bottom: 10px; }
  #ecran-auth #form-auth { gap: 9px; }
  #ecran-auth .auth-separateur { margin: 12px 0 10px; }
  #ecran-auth .auth-alternatives .auth-note-essai,
  #ecran-auth .auth-alternatives .auth-note-equipe { display: none; }
  #ecran-auth .auth-pied { margin-top: 10px; }
}

/* ============================================================
   Onglet « Ma ferme » : métiers & catégories
   ============================================================ */
.aide {
  color: var(--encre-douce);
  font-size: 0.86rem;
  margin: -6px 0 16px;
  max-width: 68ch;
}
.aide strong { color: var(--encre); }

.sous-titre {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--encre-douce);
  margin: 0 0 10px;
}

.grille-reglages {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.grille-metiers {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 11px;
}

.grille-details-operation {
  display: grid;
  grid-template-columns: 0.8fr 1fr 1.25fr;
  gap: 12px;
}
.grille-details-operation > label { min-width: 0; }
.grille-details-operation input { width: 100%; min-width: 0; }
.carte-metier {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  padding: 14px;
  border-radius: var(--rayon);
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.carte-metier:hover {
  border-color: var(--orange);
  transform: translateY(-2px);
}
.carte-metier.actif {
  border-color: var(--orange);
  background: var(--orange-clair);
  box-shadow: inset 0 0 0 1px var(--orange);
}
.metier-icone { font-size: 1.5rem; line-height: 1.2; }
.metier-nom {
  font-weight: 800;
  font-size: 0.88rem;
  color: var(--encre);
}
.metier-desc {
  font-size: 0.76rem;
  color: var(--encre-douce);
}

.liste-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 12px;
}
.puce-categorie {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 99px;
  background: var(--fond);
  border: 1.5px solid var(--ligne);
  color: var(--encre);
}
.puce-categorie.perso {
  background: var(--orange-clair);
  border-color: var(--orange);
  color: var(--orange-fonce);
}
.puce-categorie .retirer {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: 0.65;
}
.puce-categorie .retirer:hover { opacity: 1; color: var(--rouge); }

/* ---------- Équipe de la ferme ---------- */
.op-quantite {
  display: inline-block;
  margin: 3px 0 0 6px;
  color: var(--teal);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}
.op-infos .op-quantite { margin-left: 0; }

.op-auteur {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-clair);
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
  vertical-align: middle;
}

.ligne-membre {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid var(--ligne);
  font-size: 0.88rem;
  flex-wrap: wrap;
}
.ligne-membre:last-of-type { border-bottom: none; }
.ligne-membre .qui {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.code-invitation {
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 2.5px;
  background: var(--orange-clair);
  color: var(--orange-fonce);
  border: 1.5px dashed var(--orange);
  border-radius: 8px;
  padding: 3px 10px;
}

.role-pill {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--teal-clair);
  color: var(--teal);
  white-space: nowrap;
}
.role-pill.attente {
  background: var(--orange-clair);
  color: var(--orange-fonce);
}

.info-ouvrier {
  background: var(--teal-clair);
  border-left: 3px solid var(--teal);
  border-radius: var(--rayon-sm);
  padding: 12px 14px;
  font-size: 0.88rem;
  color: var(--encre);
}

.lecture-seule {
  opacity: 0.55;
  pointer-events: none;
}

/* Numéro de l'ouvrier : cliquable pour l'appeler directement */
.tel-membre {
  font-size: 0.78rem;
  color: var(--encre-douce);
  text-decoration: none;
  white-space: nowrap;
}
a.tel-membre:hover { color: var(--teal); text-decoration: underline; }

.menu-detail {
  padding: 0 12px 6px;
  font-size: 0.76rem;
  color: var(--encre-douce);
}

/* ---------- Écran de connexion : entrée « ouvrier » ---------- */
.auth-separateur {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0 14px;
  color: var(--encre-douce);
  font-size: 0.76rem;
  font-weight: 600;
}
.auth-separateur::before,
.auth-separateur::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ligne);
}
.auth-note-equipe {
  text-align: center;
  font-size: 0.76rem;
  color: var(--encre-douce);
  margin: 8px 0 14px;
}

/* ---------- Notification (arrivée d'un ouvrier, bienvenue) ---------- */
.notification {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  width: calc(100% - 28px);
  max-width: 520px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--teal);
  color: #fff6ee;
  border-left: 4px solid var(--orange);
  border-radius: var(--rayon);
  box-shadow: 0 10px 30px rgba(36, 22, 16, 0.28);
  padding: 13px 15px;
  font-size: 0.9rem;
  font-weight: 600;
  animation: descente-notif 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
@keyframes descente-notif {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
#notification-texte { flex: 1; }
#notification-fermer {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0 2px;
  flex-shrink: 0;
}
#notification-fermer:hover { opacity: 1; }

/* ---------- Corrections du micro ---------- */
.liste-corrections {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.puce-correction {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--teal-clair);
  border: 1.5px solid rgba(13, 95, 90, 0.28);
  color: var(--encre);
}
.puce-correction em { font-style: italic; color: var(--encre-douce); }
.puce-correction strong { font-weight: 800; color: var(--teal); }
.puce-correction .retirer {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0 0 0 2px;
  opacity: 0.65;
}
.puce-correction .retirer:hover { opacity: 1; color: var(--rouge); }

.ajout-correction {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ajout-correction input {
  flex: 1 1 180px;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--rayon-sm);
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--encre);
}
.ajout-correction input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-clair);
  outline: none;
}
.ajout-correction .fleche {
  color: var(--encre-douce);
  font-weight: 800;
  flex-shrink: 0;
}

/* Bouton de relecture dans la fenêtre de confirmation */
.reanalyser { width: 100%; margin-top: 10px; }
.doux {
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--encre-douce);
  opacity: 0.85;
}

.ajout-categorie { display: flex; gap: 8px; }
.ajout-categorie input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: var(--rayon-sm);
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  font-family: inherit;
  font-size: 0.85rem;
  color: var(--encre);
}
.ajout-categorie input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px var(--orange-clair);
  outline: none;
}

/* ============================================================
   Mes bandes (lots & rentabilité)
   ============================================================ */
.carte-bande {
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-left: 4px solid var(--vert);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.carte-bande.deficit { border-left-color: var(--rouge); }

.bande-entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.bande-titre { min-width: 0; }
.bande-titre strong {
  font-family: var(--police-titre);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-right: 8px;
}
.bande-titre small {
  display: block;
  margin-top: 3px;
  font-size: 0.78rem;
  color: var(--encre-douce);
}
.bande-actions { display: flex; gap: 2px; flex-shrink: 0; }

.badge-bande {
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 9px;
  border-radius: 99px;
  vertical-align: middle;
  white-space: nowrap;
}
.badge-bande.en-cours { background: var(--vert-fond); color: var(--vert); }
.badge-bande.terminee { background: #eee7df; color: var(--encre-douce); }

.bande-chiffres {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ligne);
}
.bande-stat { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bande-stat .k {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.bande-stat .v {
  font-family: var(--police-titre);
  font-size: 1.05rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.4px;
}
.bande-stat .v small {
  font-family: var(--police-texte);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--encre-douce);
}

.bande-pilotage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--ligne);
}
.bande-pilotage > div {
  background: var(--surface-2);
  border-radius: var(--rayon-sm);
  padding: 10px 11px;
  min-width: 0;
}
.bande-pilotage .k {
  display: block;
  margin-bottom: 4px;
  font-size: 0.63rem;
  font-weight: 800;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.bande-pilotage strong {
  display: block;
  font-size: 0.86rem;
  line-height: 1.25;
  color: var(--encre);
}
.bande-standard-note {
  margin: -4px 0 10px;
  color: var(--encre-douce);
  font-size: 0.72rem;
}
.bande-alertes {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}
.bande-alertes p {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  border: 1px solid rgba(192, 31, 36, 0.18);
  background: var(--rouge-fond);
  color: var(--rouge);
  border-radius: var(--rayon-sm);
  padding: 9px 11px;
  font-size: 0.8rem;
  font-weight: 700;
}
.bande-alertes svg {
  flex: 0 0 auto;
  margin-top: 1px;
}

.taux-mortalite, .alerte-mortalite {
  font-family: var(--police-texte);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
  vertical-align: middle;
  white-space: nowrap;
}
.taux-mortalite { background: var(--surface-2); color: var(--encre-douce); }
.alerte-mortalite { background: var(--rouge-fond); color: var(--rouge); }

.bande-marge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-top: 13px;
}
.bande-marge .k {
  display: block;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.bande-marge .v {
  font-family: var(--police-titre);
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  font-variant-numeric: tabular-nums;
}
.bande-marge.gain .v { color: var(--vert); }
.bande-marge.perte .v { color: var(--rouge); }
.bande-marge .par-sujet {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--encre-douce);
}
.bande-marge .par-sujet strong {
  color: var(--encre);
  font-variant-numeric: tabular-nums;
}

.bande-vide, .bande-notes {
  margin: 13px 0 0;
  font-size: 0.82rem;
  color: var(--encre-douce);
  background: var(--surface-2);
  border-radius: var(--rayon-sm);
  padding: 10px 12px;
}

.liste-mortalites-bande {
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-sm);
  background: var(--surface-2);
  padding: 10px;
  margin: 10px 0 14px;
}
.liste-mortalites-titre {
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.ligne-mortalite {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--ligne);
}
.ligne-mortalite:first-of-type { border-top: 0; }
.ligne-mortalite.active {
  background: var(--orange-clair);
  border-radius: var(--rayon-sm);
  padding-inline: 8px;
}
.ligne-mortalite strong {
  font-family: var(--police-titre);
  font-size: 1rem;
  margin-right: 8px;
}
.ligne-mortalite span {
  color: var(--encre-douce);
  font-size: 0.82rem;
}
.ligne-mortalite small {
  display: block;
  margin-top: 2px;
  color: var(--encre-douce);
}
.ligne-mortalite-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* Rattachement d'une opération à une bande, dans le journal */
.op-bande {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.66rem;
  font-weight: 700;
  color: var(--orange-fonce);
  background: var(--orange-clair);
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
  vertical-align: middle;
}

/* ============================================================
   Dettes & créances
   ============================================================ */

/* ----- Bloc « Paiement » dans la fenêtre de saisie ----- */
.bloc-paiement {
  background: var(--surface-2);
  border: 1.5px solid var(--ligne);
  border-radius: var(--rayon-sm);
  padding: 12px 13px;
  margin-top: 4px;
}
.etiquette-bloc {
  display: block;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.9px;
  text-transform: uppercase;
  color: var(--encre-douce);
  margin-bottom: 9px;
}
.choix-paiement {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}
.opt-paiement {
  flex: 1 1 auto;
  border: 1.5px solid var(--ligne);
  background: var(--surface);
  border-radius: 99px;
  padding: 8px 13px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--encre-douce);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s;
}
.opt-paiement:hover { border-color: var(--orange); color: var(--orange-fonce); }
.opt-paiement.actif {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 800;
}
#details-credit { margin-top: 12px; }
.apercu-reste {
  margin: 8px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--orange-fonce);
}

/* ----- Pastille « reste dû » dans les listes ----- */
.op-impaye {
  display: inline-block;
  margin-left: 6px;
  font-size: 0.66rem;
  font-weight: 800;
  color: var(--ambre);
  background: #fdf1dc;
  border-radius: 99px;
  padding: 2px 8px;
  white-space: nowrap;
  vertical-align: middle;
}
.op-impaye.retard { color: var(--rouge); background: var(--rouge-fond); }

/* ----- Bandeau trésorerie du tableau de bord ----- */
.bandeau-tresorerie {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1.5px solid var(--ligne);
  border-left: 4px solid var(--teal);
  border-radius: var(--rayon);
  padding: 14px 18px;
  margin-bottom: 22px;
}
.tr-bloc { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.tr-cle {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: var(--encre-douce);
}
.tr-valeur {
  font-family: var(--police-titre);
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
}
.tr-bloc small { font-size: 0.72rem; color: var(--encre-douce); }
.bandeau-tresorerie .btn { margin-left: auto; }

/* ----- Cartes du haut de l'onglet ----- */
.cartes.deux { grid-template-columns: 1fr 1fr; }
.carte-detail { font-size: 0.74rem; color: var(--encre-douce); }

/* ----- Lignes de créance / dette ----- */
.ligne-credit {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 2px;
  border-bottom: 1px solid var(--ligne);
  flex-wrap: wrap;
}
.ligne-credit:last-child { border-bottom: none; }
.ligne-credit.en-retard { background: rgba(192, 57, 43, 0.04); }

.credit-qui { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 1px; }
.credit-qui strong { font-size: 0.92rem; font-weight: 700; }
.credit-qui small {
  font-size: 0.78rem;
  color: var(--encre-douce);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.credit-qui .avance { color: var(--vert); font-weight: 600; }

.credit-chiffres {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  font-variant-numeric: tabular-nums;
}
.credit-chiffres > span:first-child { font-size: 1rem; }

.echeance {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--encre-douce);
  background: var(--surface-2);
  border-radius: 99px;
  padding: 2px 9px;
  white-space: nowrap;
}
.echeance.bientot { color: var(--ambre); background: #fdf1dc; }
.echeance.retard { color: var(--rouge); background: var(--rouge-fond); }

.entete-tiers {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 2px solid var(--or-clair, var(--ligne-forte));
}
.entete-tiers strong {
  font-family: var(--police-titre);
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

/* Pastille de rappel dans le menu latéral */
.pastille-menu {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--rouge);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
body.menu-reduit .pastille-menu {
  position: absolute;
  margin: 0;
  transform: translate(14px, -12px);
}
body.menu-reduit .onglet { position: relative; }

/* ============================================================
   Rapport analytique
   ============================================================ */
.rapport-entete {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.fil-ariane {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--encre-douce);
}
.fil-ariane span { opacity: 0.5; margin: 0 4px; }
.titre-analyse {
  font-family: var(--police-titre);
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  color: var(--teal-fonce);
}
.rapport-controles { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.selecteur-periode {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--ligne);
  border-radius: var(--rayon-sm);
  padding: 4px 12px;
  color: var(--teal);
  box-shadow: var(--ombre);
}
.selecteur-periode select {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--encre);
  padding: 7px 2px;
  cursor: pointer;
  outline: none;
}

/* ---------- Cartes d'indicateurs ---------- */
.grille-kpi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.kpi {
  position: relative;
  background: var(--surface);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 20px 22px;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.kpi:hover { box-shadow: var(--ombre-forte); transform: translateY(-2px); }
/* Liseré vertical coloré, marque du système */
.kpi::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}
.kpi.accent-vert::before   { background: var(--vert); }
.kpi.accent-orange::before { background: var(--orange); }
.kpi.accent-teal::before   { background: var(--teal); }

.kpi-haut {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.kpi-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--rayon-sm);
  background: var(--surface-2);
  color: var(--teal);
}
.kpi.accent-orange .kpi-ico { background: var(--orange-clair); color: var(--orange-fonce); }
.kpi.accent-vert .kpi-ico { background: var(--vert-fond); color: var(--vert); }

.delta {
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.delta.bon { color: var(--vert); }
.delta.mauvais { color: var(--rouge); }
.delta.neutre { color: var(--encre-douce); font-weight: 600; }

.kpi-libelle {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--encre-douce);
}
.kpi-valeur {
  margin: 2px 0 0;
  font-family: var(--police-titre);
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--encre);
}
.kpi-valeur small {
  font-family: var(--police-texte);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--encre-douce);
  margin-left: 2px;
}

/* ---------- Courbe & encart d'analyse ---------- */
.grille-analyse {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  align-items: stretch;
}
.panneau-courbe { margin-bottom: 0; display: flex; flex-direction: column; }
.entete-courbe {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.titre-graphe {
  font-family: var(--police-titre);
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--encre);
  margin: 0;
}
.sous-graphe {
  margin: 2px 0 0;
  font-size: 0.85rem;
  color: var(--encre-douce);
}
.graphe-svg { width: 100%; height: 230px; margin-top: 8px; }
.graphe-svg .axe {
  font-family: var(--police-texte);
  font-size: 11px;
  fill: var(--encre-douce);
}
.graphe-svg .milieu { text-anchor: middle; }

/* Encart sombre : le contrepoint visuel du système */
.carte-analyse {
  background: linear-gradient(160deg, var(--teal), var(--teal-fonce));
  color: #eaf1ee;
  border-radius: var(--rayon);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--ombre-forte);
}
.puce-analyse {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 99px;
  padding: 5px 12px;
  margin-bottom: 16px;
}
.carte-analyse h3 {
  font-family: var(--police-titre);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: none;
  color: #fff;
  margin: 0 0 6px;
}
.analyse-sous {
  margin: 0;
  font-size: 0.85rem;
  color: rgba(234, 241, 238, 0.75);
  line-height: 1.5;
}
.analyse-chiffre {
  font-family: var(--police-titre);
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: #fff;
  margin: 18px 0 0;
  line-height: 1;
}
.analyse-chiffre small {
  font-family: var(--police-texte);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary-fixed-dim, #95d3ba);
  margin-left: 6px;
}
.analyse-separateur {
  height: 1px;
  background: rgba(255, 255, 255, 0.18);
  margin: 20px 0 14px;
}
.analyse-cle {
  margin: 0 0 4px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #95d3ba;
}
.analyse-citation {
  margin: 0;
  font-size: 0.9rem;
  font-style: italic;
  line-height: 1.5;
  color: rgba(234, 241, 238, 0.92);
}

/* ---------- Rentabilité par bande ---------- */
.barres-bandes {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  height: 210px;
  margin-top: 16px;
}
.colonne-bande {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  height: 100%;
}
.valeur-bande {
  font-family: var(--police-titre);
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.piste-bande {
  flex: 1;
  width: 100%;
  max-width: 68px;
  display: flex;
  align-items: flex-end;
}
.barre-bande {
  width: 100%;
  border-radius: 8px 8px 0 0;
  transition: height 0.5s ease;
}
.barre-bande.positive { background: linear-gradient(180deg, var(--teal-vif), var(--teal)); }
.barre-bande.negative { background: linear-gradient(180deg, #d97b6c, var(--rouge)); }
.nom-bande {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--encre-douce);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

/* ---------- Parts par catégorie ---------- */
.ligne-part {
  display: grid;
  grid-template-columns: 130px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 7px 0;
  font-size: 0.86rem;
}
.part-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-piste {
  height: 8px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.part-barre { height: 100%; border-radius: 99px; transition: width 0.5s ease; }
.part-barre.recette { background: var(--vert); }
.part-barre.depense { background: var(--orange); }
.part-valeur { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.part-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--ligne);
  font-weight: 700;
}
.part-total strong {
  font-family: var(--police-titre);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Stock
   ============================================================ */
.carte-article { border-left: 4px solid var(--vert); }
.carte-article.bas { border-left-color: var(--ambre); }
.carte-article.vide { border-left-color: var(--rouge); }

.art-entete {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.art-titre { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.art-titre h3 {
  font-family: var(--police-titre);
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.3px;
  text-transform: none;
  color: var(--encre);
}
.art-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }

.etat-stock {
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 99px;
  white-space: nowrap;
}
.etat-stock.ok   { background: var(--vert-fond); color: var(--vert); }
.etat-stock.bas  { background: #fdf1dc; color: var(--ambre); }
.etat-stock.vide { background: var(--rouge-fond); color: var(--rouge); }

.art-quantite {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.art-restant {
  font-family: var(--police-titre);
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.art-unite { font-size: 0.85rem; color: var(--encre-douce); font-weight: 600; }
.art-jours {
  margin-left: auto;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--encre-douce);
  background: var(--surface-2);
  border-radius: 99px;
  padding: 3px 10px;
  white-space: nowrap;
}
.barre-remplissage.ok   { background: var(--vert); }
.barre-remplissage.bas  { background: var(--ambre); }
.barre-remplissage.vide { background: var(--rouge); }
.art-seuil {
  display: block;
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--encre-douce);
}

.stock-historique {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--ligne);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.mvt {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.8rem;
  flex-wrap: wrap;
}
.mvt-sens {
  font-weight: 800;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 99px;
  white-space: nowrap;
}
.mvt-sens.entree { background: var(--vert-fond); color: var(--vert); }
.mvt-sens.sortie { background: var(--orange-clair); color: var(--orange-fonce); }
.mvt-qte { font-weight: 700; font-variant-numeric: tabular-nums; }
.mvt-date { color: var(--encre-douce); }
.mvt small { color: var(--encre-douce); font-style: italic; }

/* ============================================================
   Rappels
   ============================================================ */
.ligne-rappel {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 4px 12px 10px;
  border-bottom: 1px solid var(--ligne);
  border-left: 3px solid transparent;
  flex-wrap: wrap;
}
.ligne-rappel:last-child { border-bottom: none; }
.ligne-rappel.retard { border-left-color: var(--rouge); background: rgba(192, 57, 43, 0.04); }
.ligne-rappel.bientot { border-left-color: var(--ambre); }
.ligne-rappel.est-fait { opacity: 0.55; }
.ligne-rappel.est-fait .rappel-texte strong { text-decoration: line-through; }

.rappel-ico { font-size: 1.3rem; flex-shrink: 0; line-height: 1; }
.rappel-texte { flex: 1; min-width: 150px; display: flex; flex-direction: column; gap: 2px; }
.rappel-texte strong { font-size: 0.92rem; font-weight: 700; }
.rappel-texte small { font-size: 0.76rem; color: var(--encre-douce); }
.rappel-texte em { font-style: italic; }

.etat-rappel {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--surface-2);
  color: var(--encre-douce);
  white-space: nowrap;
}
.etat-rappel.retard { background: var(--rouge-fond); color: var(--rouge); }
.etat-rappel.bientot { background: #fdf1dc; color: var(--ambre); }
.etat-rappel.fait { background: var(--vert-fond); color: var(--vert); }

.rappel-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }

/* ============================================================
   Corbeille
   ============================================================ */
.ligne-corbeille {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--ligne);
  flex-wrap: wrap;
}
.ligne-corbeille:last-child { border-bottom: none; }

.corb-ico {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--encre-douce);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* base 170px (et non « auto ») : sinon une longue description compte pour
   sa largeur maximale et fait passer les boutons à la ligne pour rien. */
.corb-infos { flex: 1 1 170px; min-width: 170px; display: flex; flex-direction: column; gap: 2px; }
.corb-infos strong { font-size: 0.92rem; font-weight: 700; }
.corb-infos small {
  font-size: 0.76rem;
  color: var(--encre-douce);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.corb-quand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  align-items: flex-end;
  font-size: 0.74rem;
  color: var(--encre-douce);
  white-space: nowrap;
}
.corb-emporte {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--teal);
  background: var(--teal-clair);
  border-radius: 99px;
  padding: 2px 9px;
}

.corb-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }

/* ---------- Rattrapage : « supprimé — annuler » ---------- */
.annulation {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 75;
  width: calc(100% - 28px);
  max-width: 540px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  color: var(--encre);
  border: 1.5px solid var(--ligne-forte);
  border-left: 4px solid var(--orange);
  border-radius: var(--rayon);
  box-shadow: 0 12px 34px rgba(36, 22, 16, 0.2);
  padding: 11px 13px;
  font-size: 0.88rem;
  font-weight: 600;
  animation: descente-notif 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.15);
}
/* Si une notification occupe déjà le haut de l'écran, on se place dessous. */
#notification:not([hidden]) ~ .annulation { top: 84px; }

.annulation-ico { color: var(--encre-douce); flex-shrink: 0; display: flex; }
/* Le libellé peut passer à la ligne : mieux vaut une barre un peu plus
   haute qu'un nom d'opération coupé au milieu. */
#annulation-texte { flex: 1; min-width: 0; }
.annulation-fermer {
  border: none;
  background: transparent;
  color: var(--encre-douce);
  cursor: pointer;
  padding: 2px;
  display: flex;
  flex-shrink: 0;
}
.annulation-fermer:hover { color: var(--encre); }

/* ---------- Invitation d'installation PWA ---------- */
.banniere-installation {
  position: fixed;
  left: calc(var(--menu-large) + 14px);
  right: 14px;
  bottom: 122px;
  z-index: 34;
  width: auto;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  color: var(--encre);
  border: 1.5px solid rgba(253, 118, 26, 0.42);
  border-radius: 18px;
  box-shadow: 0 14px 36px rgba(36, 22, 16, 0.22);
  padding: 14px;
  animation: montee-installation 0.28s ease-out;
}
.installation-icone {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--orange-clair);
  color: var(--orange-fonce);
  font-size: 1.25rem;
  flex-shrink: 0;
}
.installation-texte {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.installation-texte strong {
  font-family: var(--police-titre);
  font-size: 1rem;
  font-weight: 800;
}
.installation-texte span {
  font-size: 0.86rem;
  color: var(--encre-douce);
  line-height: 1.35;
}
.installation-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.installation-actions .btn.texte {
  border: none;
  background: transparent;
  color: var(--encre-douce);
  box-shadow: none;
  padding-inline: 8px;
}
.installation-fermer {
  border: none;
  background: transparent;
  color: var(--encre-douce);
  cursor: pointer;
  padding: 2px;
  display: flex;
  flex-shrink: 0;
}
.installation-fermer:hover { color: var(--encre); }
@keyframes montee-installation {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ============================================================
   Sélecteur de ferme (menu latéral)
   ============================================================ */
.bl-ferme {
  width: 100%;
  border: none;
  font-family: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  position: relative;
}
.bl-ferme:hover { background: rgba(255, 246, 238, 0.18); }
.bl-chevron {
  margin-left: auto;
  font-size: 1rem;
  opacity: 0.7;
  flex-shrink: 0;
  line-height: 1;
}
body.menu-reduit .bl-chevron { display: none; }

.menu-fermes {
  position: absolute;
  bottom: 74px;
  left: 10px;
  right: 10px;
  background: var(--surface);
  border: 1.5px solid var(--ligne-forte);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-haute);
  padding: 6px;
  z-index: 45;
  max-height: 60vh;
  overflow-y: auto;
  animation: apparition-boite 0.16s ease;
}
body.menu-reduit .menu-fermes { left: 10px; width: 240px; right: auto; }

.item-ferme {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: none;
  background: transparent;
  padding: 9px 11px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.86rem;
  color: var(--encre);
  cursor: pointer;
  text-align: left;
}
.item-ferme:hover { background: var(--orange-clair); }
.item-ferme.actif { background: var(--teal-clair); }
.item-ferme.ajouter { color: var(--teal); font-weight: 700; }
.if-nom {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.if-role { font-size: 0.7rem; color: var(--encre-douce); white-space: nowrap; }
.if-coche { color: var(--teal); font-weight: 800; }
.mf-separateur { height: 1px; background: var(--ligne); margin: 5px 8px; }

/* ============================================================
   Écrans étroits
   ============================================================ */
@media (max-width: 900px) {
  .cartes { grid-template-columns: 1fr 1fr; }
  .bande-chiffres { grid-template-columns: 1fr 1fr; gap: 12px; }
  .bande-pilotage { grid-template-columns: 1fr; }
  .bande-marge { flex-direction: column; align-items: flex-start; }
  .bande-marge .par-sujet { text-align: left; }
  .grille-kpi { grid-template-columns: 1fr; }
  .grille-analyse { grid-template-columns: 1fr; }
}

/* Écrans moyens : le menu démarre réduit pour laisser la place au contenu */
@media (max-width: 1080px) and (min-width: 721px) {
  .barre-laterale { width: var(--menu-reduit); }
  .bl-identite, .bl-txt { display: none; }
  .bl-entete { justify-content: center; padding: 16px 8px; }
  .onglet, .bl-ferme { justify-content: center; padding-left: 0; padding-right: 0; }
  .colonne-contenu { margin-left: var(--menu-reduit); }
  #zone-vocale { left: calc(var(--menu-reduit) + 14px); }
  /* La poignée inverse alors le sens : elle sert à déplier. */
  .bl-bascule { transform: rotate(180deg); }
  body.menu-deplie .barre-laterale { width: var(--menu-large); }
  body.menu-deplie .bl-identite,
  body.menu-deplie .bl-txt { display: block; }
  body.menu-deplie .bl-ferme .bl-txt { display: flex; }
  body.menu-deplie .bl-entete { justify-content: flex-start; padding: 16px 14px; }
  body.menu-deplie .onglet,
  body.menu-deplie .bl-ferme { justify-content: flex-start; padding-left: 12px; padding-right: 12px; }
  body.menu-deplie .colonne-contenu { margin-left: var(--menu-large); }
  body.menu-deplie #zone-vocale { left: calc(var(--menu-large) + 14px); }
  body.menu-deplie .bl-bascule { transform: none; }
}

/* ---------- Téléphone : le menu devient un tiroir ---------- */
@media (max-width: 720px) {
  html, body { overscroll-behavior-y: none; }
  .barre-laterale {
    width: min(84vw, var(--menu-large));
    transform: translateX(-101%);   /* caché hors de l'écran */
    box-shadow: 8px 0 30px rgba(36, 22, 16, 0.28);
  }
  body.menu-ouvert .barre-laterale { transform: translateX(0); }
  /* Sur téléphone, le menu est toujours déplié quand il est visible. */
  body.menu-reduit .barre-laterale { width: min(84vw, var(--menu-large)); }
  body.menu-reduit .bl-identite,
  body.menu-reduit .bl-txt { display: block; }
  body.menu-reduit .bl-ferme .bl-txt { display: flex; }
  body.menu-reduit .bl-entete { justify-content: flex-start; padding: 16px 14px; }
  body.menu-reduit .onglet,
  body.menu-reduit .bl-ferme { justify-content: flex-start; padding-left: 12px; padding-right: 12px; }
  .bl-bascule { display: none; }        /* on ferme en touchant le voile */
  .colonne-contenu,
  body.menu-reduit .colonne-contenu { margin-left: 0; }
  /* Plus de menu à contourner : la barre vocale reprend toute la largeur. */
  #zone-vocale,
  body.menu-reduit #zone-vocale,
  .banniere-installation,
  body.menu-reduit .banniere-installation {
    left: max(8px, env(safe-area-inset-left));
    right: max(8px, env(safe-area-inset-right));
  }
  .btn-menu { display: block; }

  header { padding: 10px 14px; }
  #titre-page { font-size: 1rem; }
  .actions-entete { gap: 8px; }
  .btn-installer-app {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 0;
    font-size: 0;
  }
  .btn-installer-app .ico { font-size: 1rem; }
  .etiquette-ferme { display: none; }
  main { padding: 18px 14px calc(158px + env(safe-area-inset-bottom)); }
  h2 { font-size: 1.42rem; }
  .entete-dashboard {
    align-items: flex-start;
    gap: 12px;
    margin-top: 0;
  }
  .entete-dashboard > div { min-width: 0; }
  .choix-dashboard {
    width: 100%;
    grid-template-columns: 92px 1fr;
  }
  .choix-dashboard select,
  .choix-dashboard input,
  .choix-mois-dashboard select { width: 100%; }
  .carte-valeur { font-size: 1.28rem; }
  .deux-colonnes { grid-template-columns: 1fr; }
  .grille-form { grid-template-columns: 1fr; }
  .grille-details-operation { grid-template-columns: 1fr; }
  .grille-reglages { grid-template-columns: 1fr; }
  .grille-metiers { grid-template-columns: 1fr 1fr; }
  .exemples { display: none; }
  #zone-vocale {
    bottom: max(8px, env(safe-area-inset-bottom));
    max-width: none;
    padding: 10px;
    border-radius: 16px;
  }
  .banniere-installation {
    bottom: calc(104px + env(safe-area-inset-bottom));
    max-width: none;
    grid-template-columns: auto 1fr auto;
    gap: 10px;
    padding: 12px;
    border-radius: 16px;
  }
  .installation-icone {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .installation-texte strong { font-size: 0.98rem; }
  .installation-texte span { font-size: 0.82rem; }
  .barre-vocale { gap: 8px; }
  #saisie-texte { padding: 12px 14px; font-size: 16px; }
  .btn.rond { width: 48px; height: 48px; }

  /* Journal : chaque opération devient une ligne compacte lisible, sans
     tableau plus large que l'écran ni colonne coupée sur Safari. */
  .groupe-journal { padding: 14px 12px; overflow: hidden; }
  .groupe-entete { align-items: flex-start; gap: 8px; }
  .groupe-totaux { width: 100%; gap: 8px 14px; }
  .groupe-solde { margin-left: auto; }
  .groupe-journal .tableau-conteneur { overflow: visible; padding-top: 0; }
  .journal-tableau,
  .journal-tableau tbody { display: block; width: 100%; }
  .journal-tableau thead { display: none; }
  .journal-tableau tbody tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "type date"
      "categorie montant"
      "description description"
      "actions actions";
    gap: 7px 12px;
    width: 100%;
    padding: 14px 2px;
  }
  .journal-tableau tbody td {
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
  }
  .journal-tableau .journal-date {
    grid-area: date;
    color: var(--encre-douce);
    font-size: 0.78rem;
    white-space: nowrap;
  }
  .journal-tableau .journal-type { grid-area: type; }
  .journal-tableau .journal-categorie {
    grid-area: categorie;
    font-weight: 700;
    overflow-wrap: anywhere;
  }
  .journal-tableau .journal-description {
    grid-area: description;
    color: var(--encre-douce);
    overflow-wrap: anywhere;
  }
  .journal-tableau .journal-montant {
    grid-area: montant;
    text-align: right;
    font-weight: 800;
    white-space: nowrap;
  }
  .journal-tableau .journal-actions {
    grid-area: actions;
    display: flex;
    justify-content: flex-end;
    gap: 2px;
  }
  .journal-tableau .journal-actions:empty { display: none; }
  .bilan-journal {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
  }
  .bj-solde {
    grid-column: 1 / -1;
    padding: 14px 0 0;
    border-left: 0;
    border-top: 1px solid var(--ligne);
  }
  #modal {
    align-items: center;
    padding: 8px;
    overflow: hidden;
  }
  #modal .modal-boite {
    display: flex;
    flex-direction: column;
    height: calc(100dvh - 16px);
    max-height: calc(100dvh - 16px);
    padding: 16px;
    overflow: hidden;
  }
  #modal .modal-boite h3 {
    flex: none;
    margin-bottom: 10px;
  }
  #modal #form-operation {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;
  }
  #modal .operation-defile {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 2px 2px 14px;
  }
  #modal .modal-actions {
    flex: none;
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--ligne);
    background: var(--surface);
  }
  #modal .modal-actions .btn { flex: 1; }
  .auth-fond, .config-fond {
    align-items: flex-start;
    padding: 14px;
  }
  .auth-carte, .config-carte {
    margin: auto 0;
    padding: 24px 18px;
  }
  .auth-carte { margin: 0; }
  #ecran-auth > .auth-carte {
    display: block;
    width: 100%;
    min-height: 0;
    overflow: visible;
    border-top: 4px solid var(--orange);
  }
  #ecran-auth .auth-visuel { display: none; }
  #ecran-auth .auth-contenu { padding: 24px 18px; }
  #ecran-auth .auth-logo { display: flex; }
  #ecran-auth .auth-alternatives { grid-template-columns: 1fr; }
  .zone-danger-ferme { align-items: stretch; flex-direction: column; }
  .zone-danger-ferme .btn { width: 100%; }
  #form-auth input { font-size: 16px; }
  .config-carte {
    max-height: none;
    overflow: visible;
  }
  .config-carte .carte-metier {
    padding: 10px;
    min-height: 62px;
  }
  .config-carte .metier-desc { display: none; }
  /* Corbeille : on lit le libellé, puis la date, puis les boutons. */
  .corb-quand {
    order: 2;
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }
  .corb-actions { order: 3; margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
