/* Cogesty – feuille de style unique, sans dépendance externe. */
:root {
  --encre: #17262b;
  --encre-douce: #4d5f65;
  --fond: #f4f1ea;
  --carte: #ffffff;
  --trait: #dcd6c8;
  --accent: #0d5c63;
  --accent-fonce: #094248;
  --ambre: #b7791f;
  --rouge: #a8322d;
  --vert: #2f6f4f;
  --rayon: 6px;
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--fond); color: var(--encre); font-size: 16px; line-height: 1.5; }
a { color: var(--accent); }
h1 { font-size: 1.7rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

.entete { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: var(--encre); color: #fff; flex-wrap: wrap; }
.marque { font-weight: 700; font-size: 1.25rem; letter-spacing: .04em; color: #fff; text-decoration: none; }
.marque-seule { color: var(--encre); text-align: center; font-size: 1.6rem; margin: 3rem 0 1rem; }
.entreprise-courante { padding: .15rem .6rem; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; font-size: .85rem; }
.menu { margin-left: auto; display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.menu a, .menu .lien { color: #e6efef; text-decoration: none; font-size: .95rem; }
.menu a:hover, .menu .lien:hover { color: #fff; text-decoration: underline; }
.menu form { margin: 0; }

.contenu { max-width: 1040px; margin: 0 auto; padding: 1.75rem 1.5rem 3rem; }
.page-simple .contenu { max-width: 720px; padding-top: 0; }
.chapo { color: var(--encre-douce); margin: 0 0 1.25rem; }
.aide { color: var(--encre-douce); font-size: .875rem; margin: .25rem 0; }

.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1.5rem; margin: 0 auto 1.25rem; max-width: 460px; }
.carte-large { max-width: none; }
.contenu > h1 + .carte, .contenu > form.carte { margin-left: 0; }
.sous-carte { margin: 1.25rem 0 0; padding-top: 1rem; border-top: 1px solid var(--trait); font-size: .9rem; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.25rem; }
.grille .carte { max-width: none; margin: 0; }
.titre-actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .75rem; }
.titre-actions h1, .titre-actions form { margin: 0; }

.champ { margin-bottom: 1rem; }
.champ label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .25rem; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], select {
  width: 100%; padding: .55rem .65rem; font: inherit; color: inherit; background: #fff;
  border: 1px solid #b9b2a2; border-radius: var(--rayon);
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(13,92,99,.35); outline-offset: 1px; }
.en-erreur input, .en-erreur select { border-color: var(--rouge); }
.errorlist { list-style: none; margin: .3rem 0 0; padding: 0; color: var(--rouge); font-size: .875rem; }
.champ ul:not(.errorlist), .champ > div { list-style: none; padding: 0; margin: 0; }
.champ div > div label, .champ li label { font-weight: 400; display: flex; gap: .5rem; align-items: center; padding: .2rem 0; }
.champ input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.formulaire-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 1.5rem; }
.formulaire-colonnes .actions, .formulaire-colonnes > .message { grid-column: 1 / -1; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .5rem; }

.bouton { display: inline-block; padding: .5rem .95rem; font: inherit; font-weight: 600; font-size: .92rem; color: var(--encre);
  background: #fff; border: 1px solid #b9b2a2; border-radius: var(--rayon); text-decoration: none; cursor: pointer; }
.bouton:hover { border-color: var(--encre); }
.bouton.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.bouton.principal:hover { background: var(--accent-fonce); }
.bouton.danger { color: var(--rouge); border-color: var(--rouge); }
.bouton.large { width: 100%; padding: .7rem; }
.lien { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; text-decoration: underline; }
.en-ligne { display: inline-block; margin: 0 .4rem .4rem 0; }

.messages { list-style: none; padding: 0; margin: 0 0 1.25rem; }
.message { padding: .7rem .9rem; border-radius: var(--rayon); border-left: 4px solid var(--accent); background: #e7f0f0; margin: 0 0 .75rem; }
.message.success { border-color: var(--vert); background: #e8f2ec; }
.message.error { border-color: var(--rouge); background: #f8e9e7; }
.message.warning { border-color: var(--ambre); background: #fbf2df; }
.message .errorlist { margin: 0; color: inherit; font-size: 1rem; }

.tableau { width: 100%; border-collapse: collapse; background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); }
.tableau th, .tableau td { text-align: left; padding: .7rem .9rem; border-bottom: 1px solid var(--trait); vertical-align: middle; }
.tableau th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--encre-douce); background: #faf8f3; }
.tableau tr:last-child td { border-bottom: 0; }
.tableau tr.inactif td { color: var(--encre-douce); }
.tableau form { margin: 0; }

.pastille { display: inline-block; min-width: 2.6rem; text-align: center; padding: .05rem .5rem; border-radius: 999px; font-size: .78rem; font-weight: 700; }
.pastille.oui { background: #dcebe2; color: var(--vert); }
.pastille.non { background: #ece8de; color: var(--encre-douce); }
.droits, .modules { list-style: none; margin: 0 0 1rem; padding: 0; }
.droits li { padding: .3rem 0; display: flex; gap: .6rem; align-items: baseline; }
.droits li.non { color: var(--encre-douce); }
.modules li { display: flex; justify-content: space-between; padding: .45rem 0; border-bottom: 1px dashed var(--trait); }
.modules em { color: var(--encre-douce); font-size: .85rem; }

.fiche { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.5rem; margin: 0 0 1rem; }
.fiche dt { color: var(--encre-douce); }
.fiche dd { margin: 0; font-weight: 600; }
.liste-choix { display: grid; gap: .6rem; }
.choix { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .85rem 1rem; font: inherit; text-align: left;
  background: #fff; border: 1px solid #b9b2a2; border-radius: var(--rayon); cursor: pointer; }
.choix:hover { border-color: var(--accent); }
.choix span { color: var(--encre-douce); font-size: .875rem; }
.etapes { padding-left: 1.25rem; }
.etapes li { margin-bottom: 1rem; }
.qr { margin: .75rem 0; }
.qr svg { background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); }
.codes { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .5rem; margin: 1rem 0; }
.codes li { padding: .5rem; text-align: center; background: #faf8f3; border: 1px solid var(--trait); border-radius: var(--rayon); font-size: 1.05rem; letter-spacing: .08em; }
.lien-a-copier { padding: .8rem; background: #faf8f3; border: 1px solid var(--trait); border-radius: var(--rayon); overflow-wrap: anywhere; user-select: all; }

/* --- Clients et véhicules (étape 3) --- */
input[type=search], input[type=tel], input[type=date], textarea {
  width: 100%; padding: .55rem .65rem; font: inherit; color: inherit; background: #fff;
  border: 1px solid #b9b2a2; border-radius: var(--rayon);
}
textarea { resize: vertical; }
textarea:focus { outline: 3px solid rgba(13,92,99,.35); outline-offset: 1px; }
.en-erreur textarea { border-color: var(--rouge); }
.champ input[type=radio] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }

.fil { margin: 0 0 .4rem; font-size: .875rem; color: var(--encre-douce); }
.recherche { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; margin: 0 0 .5rem; }
.recherche input[type=search] { flex: 1 1 320px; padding: .7rem .85rem; font-size: 1.05rem; }
.case { display: flex; gap: .4rem; align-items: center; font-size: .9rem; color: var(--encre-douce); }
.case input { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
.compte { margin: 0 0 .6rem; }
.vide { padding: 1.5rem; text-align: center; color: var(--encre-douce); background: var(--carte); border: 1px dashed var(--trait); border-radius: var(--rayon); }
.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin-top: 1rem; font-size: .9rem; color: var(--encre-douce); }
.lien-fort { font-weight: 700; text-decoration: none; }
.lien-fort:hover { text-decoration: underline; }
.pastille.pro { background: #e3ecf5; color: #2b4d77; }
h1 .pastille { vertical-align: middle; font-size: .8rem; letter-spacing: 0; }

/* Plaque d'immatriculation */
.plaque { display: inline-block; padding: .08rem .5rem; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-weight: 700;
  font-size: .9rem; letter-spacing: .06em; white-space: nowrap; color: var(--encre); text-decoration: none;
  background: #fff; border: 1.5px solid var(--encre); border-left: .5rem solid #1f4fa3; border-radius: 4px; }
a.plaque:hover { background: #eef3fb; }
.plaque.grande { font-size: 1.3rem; padding: .1rem .7rem; vertical-align: middle; margin-right: .4rem; }
.saisie-plaque { text-transform: uppercase; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .06em; }
.saisie-plaque::placeholder { text-transform: none; letter-spacing: 0; }

.titre-section { margin-top: 1.75rem; }
.titre-section h2 { margin: 0; font-size: 1.25rem; }
h2.suite { margin-top: 1.25rem; }
address { font-style: normal; }
.notes { margin: 0; white-space: normal; }
.titre-actions .actions { margin: 0; }
.modules li a + a { margin-left: auto; padding-left: 1rem; }

/* Formulaire client : sections, et champs affichés selon le type choisi */
.section { border: 0; border-top: 1px solid var(--trait); margin: 0; padding: 1rem 0 .25rem; min-width: 0; }
.section:first-of-type { border-top: 0; padding-top: 0; }
.section legend { padding: 0 .6rem 0 0; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--encre-douce); }
.section-type legend, .section-type .champ > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.section-type .champ > div { display: flex; gap: 1.5rem; }
.section-type .champ div > div label { font-weight: 600; font-size: 1rem; }
.section-large .formulaire-colonnes { display: block; }
.formulaire-client:has(input[name=type][value=professionnel]:checked) .section-particulier,
.formulaire-client:not(:has(input[name=type][value=professionnel]:checked)) .section-professionnel { display: none; }

/* --- Catalogue et taux de TVA (étape 4) --- */
.nombre { text-align: right !important; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tableau tfoot th, .tableau tfoot td { padding: .7rem .9rem; border-top: 2px solid var(--trait); background: #faf8f3; text-align: left; }
.tableau tfoot th { text-transform: none; letter-spacing: 0; font-size: .9rem; color: var(--encre); }
.tableau td .aide { margin: 0; }
.pastille.type-piece { background: #e3ecf5; color: #2b4d77; }
.pastille.type-main_oeuvre { background: #f6ead3; color: #7d5410; }
.pastille.type-forfait { background: #dcebe2; color: var(--vert); }
.pastille.type-divers { background: #ece8de; color: var(--encre-douce); }
.recherche .filtre { width: auto; flex: 0 0 auto; padding: .7rem .65rem; }
.bouton.petit { padding: .3rem .6rem; font-size: .85rem; }
.quantite { display: flex; align-items: center; gap: .5rem; }
.quantite input[type=text] { width: 5.5rem; text-align: right; padding: .35rem .5rem; }
.ajout-composant { margin-top: 1.25rem; }
.ajout-composant .recherche input[type=search] { font-size: 1rem; padding: .55rem .7rem; }
.propositions { margin-top: .5rem; }
.titre-section + .vide, .composants + .aide { margin-bottom: 0; }
.formulaire-article .champ-description, .formulaire-article .champ-mode_prix_forfait { grid-column: 1 / -1; }
.champ-mode_prix_forfait > div { display: flex; gap: 1.5rem; flex-wrap: wrap; }
/* Forfait « somme des composants » : ni prix ni taux à saisir, ils viennent des composants. */
.formulaire-forfait:has(input[name=mode_prix_forfait][value=somme]:checked) .champ-prix_unitaire_ht,
.formulaire-forfait:has(input[name=mode_prix_forfait][value=somme]:checked) .champ-taux_tva { display: none; }

/* --- Devis (étape 5) --- */
.pastille.etat-brouillon { background: #ece8de; color: var(--encre-douce); }
.pastille.etat-envoye { background: #e3ecf5; color: #2b4d77; }
.pastille.etat-accepte { background: #dcebe2; color: var(--vert); }
.pastille.etat-refuse { background: #f8e9e7; color: var(--rouge); }
.pastille.etat-expire { background: #f6ead3; color: #7d5410; }
.pastille.etat-validee { background: #dcebe2; color: var(--vert); }
.pastille.piece-acompte { background: #e3ecf5; color: #2b4d77; }
.pastille.piece-avoir { background: #f6ead3; color: #7d5410; }
.pastille.annulee { background: #f8e9e7; color: var(--rouge); }
code.empreinte { font-size: .78rem; word-break: break-all; }
.contenu > .message { margin-bottom: 1.25rem; }
.contenu:has(.lignes-devis) { max-width: 1200px; }
.lignes-devis th, .lignes-devis td { padding: .55rem .6rem; }
.lignes-devis td:first-child { min-width: 16rem; }
.lignes-devis .gestes { white-space: nowrap; }
.lignes-devis .ligne-titre td { background: #faf8f3; }
.lignes-devis .ligne-titre td:first-child { font-weight: 700; text-transform: uppercase; font-size: .82rem; letter-spacing: .06em; }
.lignes-devis .ligne-commentaire td:first-child { color: var(--encre-douce); font-style: italic; }
.lignes-devis .ligne-enfant td { padding-top: .4rem; padding-bottom: .4rem; font-size: .92rem; }
.lignes-devis .ligne-enfant td:first-child { padding-left: 2.2rem; }
.lignes-devis .ligne-enfant strong { font-weight: 400; }
.lignes-devis .gestes .en-ligne { margin: 0 0 0 .3rem; }
.lignes-devis .quantite input[type=text] { width: 4.5rem; }
.bas-devis { margin-top: 1.25rem; align-items: start; }
.totaux .fiche { grid-template-columns: 1fr max-content; }
.totaux .fiche dd { text-align: right; font-variant-numeric: tabular-nums; }
.totaux .fiche .aide { font-weight: 400; }
.totaux .grand { font-size: 1.25rem; font-weight: 700; color: var(--encre); padding-top: .5rem; border-top: 2px solid var(--trait); margin-top: .25rem; }
.suivi { list-style: none; margin: 0 0 .75rem; padding: 0; }
.suivi li { padding: .2rem 0; }
.formulaire-devis .champ-remise_mode > div, .formulaire-devis .champ-acompte_mode > div { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.formulaire-devis .champ-texte_client, .formulaire-devis .champ-notes_internes, .formulaire-ligne .champ-description { grid-column: 1 / -1; }
.formulaire-devis .formulaire-colonnes:has(.champ-texte_client) { display: block; }
/* Ligne libre : la nature de la pièce ne concerne que les pièces. */
.formulaire-ligne:has(select[name=type]):not(:has(select[name=type] option[value=piece]:checked)) .champ-nature_piece { display: none; }

/* --- PDF et e-mails (étape 6) --- */
input[type=file] { width: 100%; font: inherit; }
input[type=color] { width: 4.5rem; height: 2.4rem; padding: .15rem; cursor: pointer; }
.formulaire-apparence .champ-gabarit > div { display: flex; gap: 1.5rem; flex-wrap: wrap; }
.formulaire-apparence .champ-gabarit > label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.formulaire-apparence .champ-gabarit div > div label { font-weight: 600; font-size: 1rem; }
.cases-en-ligne { display: flex; gap: .25rem 2rem; flex-wrap: wrap; }
.cases-en-ligne .champ, .champ-retirer_logo, .champ-copie_pour_moi { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.cases-en-ligne .champ label, .champ-retirer_logo label, .champ-copie_pour_moi label { order: 2; margin: 0; font-weight: 400; font-size: 1rem; }
.cases-en-ligne .champ .aide, .champ-copie_pour_moi .aide { order: 3; flex-basis: 100%; margin: 0; }
.logo-actuel img { max-height: 90px; max-width: 320px; padding: .5rem; background: #fff; border: 1px solid var(--trait); border-radius: var(--rayon); }
.grille-large-etroite { grid-template-columns: minmax(0, 3fr) minmax(260px, 2fr); align-items: start; }
.variables { grid-template-columns: max-content 1fr; gap: .3rem 1rem; }
.variables dd { font-weight: 400; }
.parametres .choix { text-decoration: none; color: var(--encre); }
.parametres .choix span { text-align: right; }
.formulaire-envoi .piece-jointe { padding: .6rem .8rem; background: #faf8f3; border: 1px solid var(--trait); border-radius: var(--rayon); }
.tableau.envois td { padding: .45rem .6rem; font-size: .92rem; }
.pastille.envoi-envoye { background: #dcebe2; color: var(--vert); }
.pastille.envoi-echec { background: #f8e9e7; color: var(--rouge); }
@media (max-width: 800px) { .grille-large-etroite { grid-template-columns: 1fr; } }

/* Étape 9 : règlements, suivi des factures, journal, clôtures */
.pastille.paiement-non_payee { background: #f6ead3; color: #7d5410; }
.pastille.paiement-partielle { background: #e3ecf5; color: #2b4d77; }
.pastille.paiement-payee { background: #dcebe2; color: var(--vert); }
.pastille.paiement-a_rembourser { background: #f8e9e7; color: var(--rouge); }
.pastille.paiement-annulee { background: #ece8de; color: var(--encre-douce); }
.pastille.paiement-retard { background: #f8e9e7; color: var(--rouge); }
.pastille.genre-encaissement { background: #dcebe2; color: var(--vert); }
.pastille.genre-remboursement { background: #f6ead3; color: #7d5410; }
.pastille.genre-annulation { background: #f8e9e7; color: var(--rouge); }
.pastille.etat-reglement { background: #dcebe2; color: var(--vert); }
.ligne-annulee td { color: var(--encre-douce); text-decoration: line-through; }
.ligne-annulee td .pastille { text-decoration: none; }
.tableau .champ-montant input { max-width: 9rem; text-align: right; }
.empreinte-courte { font-family: ui-monospace, monospace; font-size: .78rem; color: var(--encre-douce); }
.controle-ok { border-left: 4px solid var(--vert); }
.controle-ko { border-left: 4px solid var(--rouge); }

/* Tableau de bord (étape 10) */
.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; margin-bottom: .5rem; }
.tuile { background: var(--carte); border: 1px solid var(--trait); border-radius: var(--rayon); padding: 1rem 1.15rem; }
.tuile p { margin: 0; }
.tuile-titre { font-size: .85rem; font-weight: 600; color: var(--encre-douce); }
.tuile-titre .aide { display: block; font-weight: 400; font-size: .8rem; margin: 0; }
.tuile-valeur { font-size: 1.55rem; font-weight: 700; letter-spacing: -.01em; margin: .35rem 0 .1rem !important; font-variant-numeric: tabular-nums; }
.tuile-unite { font-size: .85rem; font-weight: 600; color: var(--encre-douce); }
.chiffre-cle { font-size: 1.35rem; font-weight: 700; margin: 0 0 .5rem; font-variant-numeric: tabular-nums; }
.chiffre-cle .aide { font-weight: 400; font-size: .9rem; }
.graphique { width: 100%; height: auto; display: block; margin: .25rem 0 .5rem; }
.graphique .barre { fill: var(--accent); }
.graphique .barre.negative { fill: var(--rouge); }
.graphique .barre-zone { fill: transparent; }
.graphique .barre-groupe:hover .barre { fill: var(--accent-fonce); }
.graphique .barre-groupe:hover .barre-zone { fill: rgba(13,92,99,.06); }
.graphique .grille-graphique { stroke: #ece8de; stroke-width: 1; }
.graphique .axe-zero { stroke: #b9b2a2; stroke-width: 1; }
.graphique .axe { font-size: 11px; fill: var(--encre-douce); font-variant-numeric: tabular-nums; }
.tableau-graphique summary, .vos-droits summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.tableau-graphique .tableau { margin-top: .75rem; }
.tableau.compact th, .tableau.compact td { padding: .4rem .55rem; font-size: .9rem; }
.pastille.retard { background: #f6dcda; color: var(--rouge); }
.texte-retard { color: var(--rouge); }
.liste-simple { padding-left: 1.1rem; margin: .25rem 0 .75rem; }
.liste-simple li { margin: .25rem 0; }
.vos-droits { margin-top: 1.25rem; }
.vos-droits[open] summary { margin-bottom: .75rem; }
.periode { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.periode .champ { margin-bottom: .5rem; }
input[type=date] { padding: .5rem .6rem; font: inherit; color: inherit; background: #fff; border: 1px solid #b9b2a2; border-radius: var(--rayon); }
.grille.cartes-tableau { grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); margin-top: 1.25rem; }
.tableau.compact td:first-child a { white-space: nowrap; }
