/* CRM UniOhm — charte graphique 2026 : barre latérale noire, fond crème, cartes blanches, boutons verts à texte noir. */
/* Polices hébergées avec le CRM (licence OFL, voir fonts/LICENSE-OFL.txt) : rien n'est chargé chez Google. */
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('../fonts/inter-latin-700-normal.woff') format('woff'); }
@font-face { font-family: 'Inter'; font-weight: 800; font-display: swap; src: url('../fonts/inter-latin-800-normal.woff') format('woff'); }
@font-face { font-family: 'Montserrat'; font-weight: 300; font-display: swap; src: url('../fonts/montserrat-latin-300-normal.woff') format('woff'); }
@font-face { font-family: 'Montserrat'; font-weight: 400; font-display: swap; src: url('../fonts/montserrat-latin-400-normal.woff') format('woff'); }
@font-face { font-family: 'Montserrat'; font-weight: 500; font-display: swap; src: url('../fonts/montserrat-latin-400-normal.woff') format('woff'); }
@font-face { font-family: 'Montserrat'; font-weight: 600; font-display: swap; src: url('../fonts/montserrat-latin-600-normal.woff') format('woff'); }
:root {
  --vert: #41BF91; --vert-clair: #7ED9AE; --vert-pale: #D1E4DB; --creme: #EFEFEA;
  --noir: #000; --gris: #B9BDBB; --blanc: #fff;
  --texte-doux: #5a615e; --vert-encre: #1d7f5c;
  --alerte: #9a5200; --alerte-fond: #fbeeda; --erreur: #b3261e; --erreur-fond: #f9e3e1;
  --titre: 'Inter', system-ui, 'Segoe UI', sans-serif;
  --texte: 'Montserrat', 'Inter', system-ui, 'Segoe UI', sans-serif;
  --rayon: 10px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; display: grid; grid-template-columns: 232px 1fr;
  background: var(--creme); color: var(--noir); font-family: var(--texte); font-size: 14px; line-height: 1.55;
}
h1, h2, h3 { font-family: var(--titre); font-weight: 800; line-height: 1.15; margin: 0; text-wrap: balance; }
h1 { font-size: 1.75rem; letter-spacing: -.015em; }
h2 { font-size: 1.15rem; }
h3 { font-size: .95rem; }
p { margin: 0; }
a { color: var(--vert-encre); }
:focus-visible { outline: 2px solid var(--vert); outline-offset: 2px; }

/* Barre latérale */
.side { background: var(--noir); color: var(--creme); display: flex; flex-direction: column; gap: 1.6rem; padding: 1.4rem 1rem; position: sticky; top: 0; height: 100vh; }
.side-logo img { width: 150px; display: block; margin: .2rem .4rem; }
.nav { display: flex; flex-direction: column; gap: .15rem; }
.nav a, .nav-off { display: flex; justify-content: space-between; align-items: center; padding: .55rem .75rem; border-radius: 7px; color: var(--creme); text-decoration: none; font-weight: 500; }
.nav a:hover { background: #1b1f1d; }
.nav a.actif { background: var(--vert); color: var(--noir); font-weight: 600; }
.nav-off { color: #6f7672; cursor: default; }
.nav-off small { font-size: .66rem; border: 1px solid #3a403d; border-radius: 99px; padding: 0 .45rem; }
.side-pied { margin-top: auto; font-size: .72rem; color: #8d938f; padding: 0 .4rem; }

/* Zone principale */
main { position: relative; z-index: 1; padding: 2rem clamp(16px, 3vw, 2.5rem) 4rem; display: flex; flex-direction: column; gap: 1.4rem; min-width: 0; max-width: 1240px; outline: none; }
.entete { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 1rem; }
.entete p { color: var(--texte-doux); margin-top: .3rem; }
.outils { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.filigrane { position: fixed; right: -6vw; bottom: -14vh; width: 60vh; opacity: .05; pointer-events: none; z-index: 0; }

.carte { background: var(--blanc); border: 1px solid var(--vert-pale); border-radius: var(--rayon); padding: 1.1rem 1.2rem; min-width: 0; }
.carte > h2 { margin-bottom: .8rem; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; align-items: start; }

/* Chiffres clés */
.kpi { display: flex; flex-direction: column; gap: .2rem; }
.kpi small { font-size: .72rem; color: var(--texte-doux); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi b { font-family: var(--titre); font-weight: 800; font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.kpi span { font-size: .8rem; color: var(--texte-doux); }
.kpi.attente b { color: var(--gris); }

/* Boutons */
button, .bouton { font: inherit; font-weight: 600; border-radius: 7px; padding: .55rem 1rem; border: 1px solid transparent; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .4rem; }
.principal { background: var(--vert); color: var(--noir); }
.principal:hover { background: var(--vert-clair); }
.secondaire { background: var(--blanc); color: var(--noir); border-color: var(--gris); }
.secondaire:hover { border-color: var(--noir); }
.danger { background: transparent; color: var(--erreur); border-color: transparent; }
.danger:hover { background: var(--erreur-fond); }
.petit { padding: .3rem .6rem; font-size: .8rem; }
button:disabled { opacity: .5; cursor: default; }

/* Champs */
input, select, textarea { font: inherit; border: 1px solid var(--gris); border-radius: 7px; padding: .5rem .65rem; background: var(--blanc); color: var(--noir); width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--vert); outline: 2px solid var(--vert-pale); }
textarea { min-height: 5rem; resize: vertical; }
.recherche { width: min(320px, 100%); }
label.champ { display: flex; flex-direction: column; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--texte-doux); }
label.champ.large { grid-column: 1 / -1; }
.case { display: flex; align-items: center; gap: .5rem; font-size: .85rem; }
.case input { width: auto; }
.form-grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem 1rem; }
.err { color: var(--erreur); font-size: .75rem; font-weight: 500; }
.invalide { border-color: var(--erreur); }
.segment { display: inline-flex; border: 1px solid var(--gris); border-radius: 7px; overflow: hidden; }
.segment label { padding: .4rem .9rem; cursor: pointer; font-size: .85rem; font-weight: 500; }
.segment input { position: absolute; opacity: 0; width: 1px; }
.segment input:checked + span { font-weight: 700; }
.segment label:has(input:checked) { background: var(--noir); color: var(--creme); }
.segment label:has(input:focus-visible) { outline: 2px solid var(--vert); outline-offset: -2px; }

/* Tableaux */
.tableau { overflow-x: auto; background: var(--blanc); border: 1px solid var(--vert-pale); border-radius: var(--rayon); }
table { border-collapse: collapse; width: 100%; font-size: .85rem; }
th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-doux); font-weight: 600; padding: .65rem .8rem; border-bottom: 1px solid var(--vert-pale); white-space: nowrap; }
td { padding: .6rem .8rem; border-bottom: 1px solid var(--vert-pale); vertical-align: middle; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }
tbody tr.cliquable { cursor: pointer; }
tbody tr.cliquable:hover { background: #f6f9f7; }
td.num, th.num { text-align: right; white-space: nowrap; }
.nom { font-weight: 600; }
.sous { display: block; font-size: .76rem; color: var(--texte-doux); }
.vide { padding: 2.5rem 1rem; text-align: center; color: var(--texte-doux); }
.vide b { display: block; color: var(--noir); font-family: var(--titre); font-size: 1rem; margin-bottom: .3rem; }

/* Badges */
.badge { display: inline-block; font-size: .68rem; font-weight: 600; padding: .08rem .5rem; border-radius: 99px; background: var(--vert-pale); color: var(--noir); white-space: nowrap; vertical-align: middle; }
.badge.exemple { background: var(--alerte-fond); color: var(--alerte); }
.badge.noir { background: var(--noir); color: var(--creme); }
.badge.gris { background: #eceeed; color: var(--texte-doux); }

/* Bandeaux */
.bandeau { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .8rem; padding: .8rem 1rem; border-radius: var(--rayon); font-size: .88rem; }
.bandeau.alerte { background: var(--alerte-fond); color: var(--alerte); border: 1px solid #ecc994; }
.bandeau.info { background: var(--vert-pale); }
.calcul { background: var(--vert-pale); border-radius: 7px; padding: .55rem .8rem; font-size: .85rem; }
.calcul b { font-variant-numeric: tabular-nums; }

/* Fenêtre de formulaire */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 48px); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 48px); }
.fen-tete { padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--vert-pale); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.fen-corps { padding: 1.2rem 1.4rem; overflow-y: auto; display: flex; flex-direction: column; gap: 1rem; }
.fen-corps > *, .pile > * { flex-shrink: 0; }
.fen-corps > .segment { align-self: flex-start; }
.fen-pied { padding: .9rem 1.4rem; border-top: 1px solid var(--vert-pale); display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; }
.fen-pied .danger { margin-right: auto; }
.fermer { background: none; border: 0; font-size: 1.4rem; line-height: 1; padding: .2rem .5rem; color: var(--texte-doux); }

/* Réglages */
.ligne-frais { display: grid; grid-template-columns: minmax(0, 1fr) 96px auto; gap: .5rem; align-items: center; }
.total { display: flex; justify-content: space-between; font-weight: 700; padding-top: .7rem; border-top: 2px solid var(--noir); font-variant-numeric: tabular-nums; }
.exemples-km { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: .5rem; }
.exemples-km div { background: var(--creme); border-radius: 7px; padding: .45rem .6rem; font-size: .8rem; }
.exemples-km b { display: block; font-size: 1rem; font-variant-numeric: tabular-nums; }
.pile { display: flex; flex-direction: column; gap: .9rem; }

/* Toast */
#toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(150%); background: var(--noir); color: var(--creme); padding: .65rem 1.1rem; border-radius: 8px; font-weight: 500; transition: transform .2s; z-index: 50; max-width: calc(100vw - 32px); }
#toast:not(.visible) { visibility: hidden; transition: transform .2s, visibility 0s .2s; }
#toast.visible { transform: translateX(-50%) translateY(0); }
td.tel { white-space: nowrap; }
#toast.erreur { background: var(--erreur); color: #fff; }

/* Phase 2 : chantiers et rentabilité */
.pastille { font-size: .66rem; font-weight: 700; background: var(--alerte-fond); color: var(--alerte); border-radius: 99px; padding: 0 .45rem; }
.onglets { display: flex; flex-wrap: wrap; gap: .35rem; }
.onglets a { padding: .35rem .85rem; border-radius: 99px; border: 1px solid var(--gris); color: var(--noir); text-decoration: none; font-size: .82rem; font-weight: 500; font-variant-numeric: tabular-nums; background: var(--blanc); }
.onglets a.actif { background: var(--noir); color: var(--creme); border-color: var(--noir); font-weight: 600; }
.onglets a .pastille { margin-left: .3rem; }
.retour { font-size: .85rem; text-decoration: none; font-weight: 500; }
.bon { color: var(--vert-encre); font-weight: 600; }
.faible { color: var(--alerte); font-weight: 600; }
.neg { color: var(--erreur); font-weight: 600; }
.kpi b.bon, .kpi b.faible, .kpi b.neg { font-weight: 800; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .7rem; }
.kpis .kpi { background: var(--blanc); border: 1px solid var(--vert-pale); border-radius: var(--rayon); padding: .8rem 1rem; }
.kpis .kpi b { font-size: 1.3rem; }
.liste { display: flex; flex-direction: column; }
.liste-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .8rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--vert-pale); font-size: .86rem; }
.liste-ligne:last-child { border-bottom: 0; }
.liste-ligne .montant { font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
details.lignes summary { cursor: pointer; font-size: .76rem; color: var(--texte-doux); }
details.lignes ul { margin: .3rem 0 0; padding-left: 1rem; font-size: .76rem; color: var(--texte-doux); }
.badge.paye { background: var(--vert-pale); }
.badge.envoye { background: var(--alerte-fond); color: var(--alerte); }
.badge.retard { background: var(--erreur-fond); color: var(--erreur); }
.barre { height: 8px; border-radius: 4px; background: var(--vert); min-width: 2px; }
.barre.neg { background: var(--erreur); }
.cellule-barre { width: 120px; }
select.action { width: auto; max-width: 260px; font-size: .8rem; padding: .3rem .5rem; }
.ajout-heures { display: grid; grid-template-columns: 150px 90px minmax(0, 1fr) auto; gap: .5rem; align-items: end; }
@media (max-width: 640px) { .ajout-heures { grid-template-columns: 1fr 1fr; } }
.note-calcul { font-size: .78rem; color: var(--texte-doux); }

/* Connexion (version en ligne) */
body.hors-connexion { grid-template-columns: 1fr; }
body.hors-connexion .side { display: none; }
.ecran-connexion { min-height: 100vh; display: grid; place-items: center; padding: 2rem 16px; }
.boite-connexion { width: min(420px, 100%); display: flex; flex-direction: column; gap: 1.2rem; }
.boite-connexion .logo-connexion { background: var(--noir); border-radius: var(--rayon); padding: 1.2rem; display: flex; justify-content: center; }
.boite-connexion .logo-connexion img { width: 180px; }
.boite-connexion form { display: flex; flex-direction: column; gap: .9rem; }
.boite-connexion input.code { font-size: 1.4rem; letter-spacing: .35em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { background: #fff; border: 1px solid var(--vert-pale); border-radius: 8px; padding: .6rem; width: 220px; max-width: 100%; align-self: center; }
.qr svg { display: block; width: 100%; height: auto; }
.secret { font-family: ui-monospace, Consolas, monospace; font-size: .95rem; background: var(--creme); border-radius: 6px; padding: .5rem .7rem; text-align: center; user-select: all; word-break: break-all; }
#compte { font-size: .78rem; color: var(--creme); display: flex; flex-direction: column; gap: .3rem; margin-bottom: .6rem; }
#compte button { background: none; border: 1px solid #3a403d; color: var(--creme); padding: .3rem .6rem; font-size: .75rem; align-self: flex-start; }
#compte button:hover { border-color: var(--vert); }

/* Phase 3 : demandes */
.etape { display: inline-block; font-size: .7rem; font-weight: 600; padding: .1rem .55rem; border-radius: 99px; white-space: nowrap; background: #eceeed; color: var(--noir); }
.etape.e-nouvelle { background: var(--creme); border: 1px solid var(--gris); }
.etape.e-planifiee, .etape.e-visite { background: var(--vert-pale); }
.etape.e-devis { background: var(--vert-clair); }
.etape.e-gagnee, .etape.e-realisee { background: var(--vert); }
.etape.e-perdue, .etape.e-annulee { background: #eceeed; color: var(--texte-doux); }
.badge.alerte { background: var(--alerte-fond); color: var(--alerte); }
.badge.urgent { background: var(--erreur-fond); color: var(--erreur); }
tr.en-alerte td:first-child { box-shadow: inset 3px 0 0 var(--alerte); }
.etapes { display: flex; flex-wrap: wrap; gap: .3rem; }
.etapes button { border-radius: 99px; padding: .4rem .9rem; font-size: .82rem; background: var(--blanc); border: 1px solid var(--gris); color: var(--noir); font-weight: 500; }
.etapes button.fait { background: var(--vert-pale); border-color: var(--vert-pale); }
.etapes button.actuelle { background: var(--noir); color: var(--creme); border-color: var(--noir); font-weight: 700; }
.etapes button.fin { border-style: dashed; }
.chrono { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.chrono li { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: .8rem; padding: .5rem 0; border-bottom: 1px solid var(--vert-pale); font-size: .85rem; }
.chrono li:last-child { border-bottom: 0; }
.chrono time { color: var(--texte-doux); font-size: .76rem; font-variant-numeric: tabular-nums; }
.infos { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .45rem 1rem; font-size: .88rem; margin: 0; }
.infos dt { color: var(--texte-doux); font-size: .78rem; font-weight: 600; }
.infos dd { margin: 0; }
.selectionnable { user-select: all; }
.etapes-motif { display: flex; flex-wrap: wrap; gap: .5rem; align-items: end; }

@media (max-width: 820px) {
  body { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .8rem 16px; }
  .side-logo img { width: 110px; }
  .nav { flex-direction: row; flex-wrap: wrap; }
  .nav-off, .side-pied { display: none; }
}
@media (prefers-reduced-motion: reduce) { #toast { transition: none; } }
