/* =========================================================
   Espace admin — reprend les tokens de styles.css
   Pensé pour être utilisable au téléphone, sur chantier.
   ========================================================= */

.admin {
  background: #EFEBE3;
  min-height: 100vh;
}

.chargement {
  text-align: center;
  padding: 80px 20px;
  color: var(--ink-3);
  font-size: 15px;
}

.btn--ghost {
  background: transparent;
  border: 1px solid var(--beige);
  color: var(--ink-2);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
}
.btn--ghost:hover { background: #fff; color: var(--navy); }

/* --------------------------------------------------------- connexion */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login__card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 36px 30px 30px;
  box-shadow: 0 24px 60px rgba(28, 42, 36, .12);
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
}
.login__logo { height: 52px; width: auto; margin: 0 auto; }
.login__card h1 {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0;
  color: var(--navy);
}
.login__sous { margin: -8px 0 4px; font-size: 14px; color: var(--ink-3); }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid #DADCE0;
  border-radius: var(--pill);
  background: #fff;
  color: #3C4043;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  transition: box-shadow .15s ease, background .15s ease;
}
.btn-google:hover { background: #F8F9FA; box-shadow: 0 1px 6px rgba(28, 42, 36, .16); }
.btn-google svg { width: 19px; height: 19px; flex: none; }
.login__retour { font-size: 13px; color: var(--ink-3); }
.login__retour:hover { color: var(--navy); }

/* --------------------------------------------------------- tableau de bord */
.board {
  max-width: 940px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}
.board__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.board__brand { display: flex; align-items: center; gap: 12px; }
.board__brand img { height: 40px; width: auto; }
.board__titre {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  color: var(--navy);
}
.board__sous { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.board__actions { display: flex; gap: 8px; }

.board__barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.filtres { display: flex; gap: 6px; flex-wrap: wrap; }
.filtre {
  border: 1px solid var(--beige);
  background: transparent;
  border-radius: var(--pill);
  padding: 9px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.filtre:hover { background: #fff; }
.filtre.is-actif {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
#recherche,
#recherche-documents {
  flex: 1;
  min-width: 200px;
  padding: 11px 14px;
  border: 1px solid var(--beige);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font-body);
  background: #fff;
  outline: none;
}
#recherche:focus,
#recherche-documents:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 75, .18); }

.board__alerte {
  background: #FDF3E7;
  border: 1px solid #E8D2AE;
  color: #7A5312;
  border-radius: 12px;
  padding: 12px 15px;
  font-size: 13.5px;
  line-height: 1.5;
  margin: 0 0 16px;
}
.board__vide { text-align: center; color: var(--ink-3); padding: 40px 0; font-size: 15px; }

/* --------------------------------------------------------- fiches */
.liste { display: flex; flex-direction: column; gap: 12px; }

.fiche {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 18px 20px;
  border-left: 4px solid var(--beige);
}
.fiche[data-statut="nouvelle"] { border-left-color: var(--gold); }
.fiche[data-statut="en_cours"] { border-left-color: #3E7CB1; }
.fiche[data-statut="traitee"]  { border-left-color: var(--ok-icon); }

.fiche__haut {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.fiche__nom {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}
.fiche__date {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-3);
}

.badge {
  display: inline-block;
  border-radius: 6px;
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.badge--nouvelle { background: #FBF1DC; color: #7A5312; }
.badge--en_cours { background: #E7F0F8; color: #24587F; }
.badge--traitee  { background: var(--ok-bg); color: var(--ok-text); }

.fiche__contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 12px 0;
}
.fiche__contacts a,
.fiche__contacts span {
  font-size: 14.5px;
  color: var(--navy);
  font-weight: 600;
}
.fiche__contacts a { border-bottom: 1px solid rgba(18, 58, 102, .25); }
.fiche__contacts a:hover { border-color: var(--navy); }

.fiche__message {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
  background: #FAF8F4;
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 14px;
  white-space: pre-wrap;
}

.fiche__pied {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.statut-btn {
  border: 1px solid var(--beige);
  background: transparent;
  border-radius: var(--pill);
  padding: 8px 14px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink-2);
  cursor: pointer;
}
.statut-btn:hover { background: #FAF8F4; }
.statut-btn.is-actif { background: var(--navy); border-color: var(--navy); color: #fff; }
.statut-btn:disabled { opacity: .5; cursor: not-allowed; }

.fiche__note {
  width: 100%;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 10px;
  font-family: var(--font-body);
  font-size: 14px;
  resize: vertical;
  min-height: 44px;
  outline: none;
  background: #fff;
}
.fiche__note:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 75, .18); }
.fiche__etat {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-left: auto;
}

/* --------------------------------------------------------- mobile */
@media (max-width: 640px) {
  .board { padding: 18px 14px 90px; }
  .board__head { flex-direction: column; align-items: flex-start; }
  .board__actions { width: 100%; }
  .btn--ghost { flex: 1; }
  .fiche { padding: 16px; }
  .fiche__contacts { flex-direction: column; gap: 8px; }
  .fiche__contacts a { font-size: 16px; }
  .statut-btn { flex: 1; min-width: 96px; text-align: center; }
  .fiche__etat { margin: 6px 0 0; width: 100%; }
}

/* =========================================================
   Onglets
   ========================================================= */
.onglets {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--beige);
  margin-bottom: 18px;
}
.onglet {
  border: none;
  background: transparent;
  padding: 10px 18px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-3);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.onglet:hover { color: var(--navy); }
.onglet.is-actif { color: var(--navy); border-bottom-color: var(--gold); }

/* =========================================================
   Facturation
   ========================================================= */
.facturation__barre {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.facturation__actions { display: flex; gap: 8px; }
.facturation__actions .btn { padding: 10px 18px; font-size: 14px; }
.facturation__resume { font-size: 13.5px; color: var(--ink-3); margin: 0 0 16px; }

.facturation__recherche {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.periode-active {
  flex: none;
  padding: 9px 14px;
  border: 1px solid var(--navy);
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.periode-active[hidden] { display: none; }
.periode-active:hover { background: #0E2E52; }

/* ---------------------------------------------- chiffre d'affaires */
.chiffres {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
}
.chiffres > summary {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}
.chiffres > summary::-webkit-details-marker { display: none; }
.chiffres > summary::before { content: '▸ '; color: var(--gold); }
.chiffres[open] > summary::before { content: '▾ '; }

.chiffres__tete {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 14px 0 12px;
}
.chiffres__tete label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.chiffres__tete select {
  padding: 8px 10px;
  border: 1px solid var(--field-border);
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  background: #fff;
}
.chiffres__bilan { margin-left: auto; font-size: 13.5px; color: var(--ink-2); }
.chiffres__bilan strong { font-family: var(--font-display); font-size: 19px; color: var(--navy); }

.chiffres__mois {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}
.mois {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--beige);
  border-radius: 10px;
  background: #FAF8F4;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-body);
}
.mois:hover { border-color: var(--gold); }
.mois__nom { font-size: 11.5px; text-transform: capitalize; color: var(--ink-3); }
.mois__montant { font-family: var(--font-display); font-weight: 700; font-size: 14.5px; color: var(--navy); }
.mois--vide .mois__montant { color: var(--ink-3); font-weight: 500; }
.mois.is-actif { background: var(--navy); border-color: var(--navy); }
.mois.is-actif .mois__nom { color: rgba(255, 255, 255, .75); }
.mois.is-actif .mois__montant { color: #fff; }
.chiffres__note { font-size: 12px; color: var(--ink-3); margin: 12px 0 0; }
#chiffres-annee-filtre.is-actif { background: var(--navy); border-color: var(--navy); color: #fff; }

.doc {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 16px 18px;
  border-left: 4px solid var(--beige);
}
.doc__haut { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.doc__numero { font-family: var(--font-mono); font-weight: 500; font-size: 14px; color: var(--navy); }
.doc__client { font-family: var(--font-display); font-weight: 700; font-size: 17px; margin-top: 6px; }
.doc__meta { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.doc__actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.badge--devis-brouillon, .badge--facture-brouillon { background: #EFEDE8; color: #6B6355; }
.badge--devis-envoye, .badge--facture-envoyee { background: #E7F0F8; color: #24587F; }
.badge--devis-accepte, .badge--facture-payee { background: var(--ok-bg); color: var(--ok-text); }
.badge--devis-refuse, .badge--facture-annulee { background: #F8E9E9; color: #A32B2B; }

/* --------------------------------------------------------- éditeur */
.editeur {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(20, 36, 58, .55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
  overflow-y: auto;
}
.editeur__panneau {
  width: 100%;
  max-width: 820px;
  background: #fff;
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.editeur__tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--beige);
}
.editeur__tete h2 { font-family: var(--font-display); font-size: 20px; margin: 0; color: var(--navy); }
.editeur__corps { padding: 22px 24px; }

.champ-grille {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.champ-grille label,
.editeur__corps > label,
.editeur__pied > label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.champ-large { grid-column: 1 / -1; }

/* Aide sous un champ : dit la règle sans alourdir le libellé. */
.champ-aide { font-size: 11.5px; font-weight: 500; color: var(--ink-3); }

.champ-case {
  flex-direction: row !important;
  align-items: center;
  gap: 9px !important;
  font-weight: 500;
  cursor: pointer;
}
.champ-case input { width: 16px; height: 16px; accent-color: var(--navy); cursor: pointer; }

.bloc-chantier {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding-left: 12px;
  border-left: 2px solid var(--beige);
}
.bloc-chantier[hidden] { display: none; }
.editeur input,
.editeur select,
.editeur textarea {
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.editeur input:focus,
.editeur select:focus,
.editeur textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, .18);
}

/* Une facture définitive se relit mais ne se retouche plus : le bandeau
   l'annonce avant que l'utilisateur ne bute sur des champs inertes. */
.editeur__fige {
  background: #FBF1DC;
  border-left: 3px solid var(--gold);
  border-radius: 0 9px 9px 0;
  padding: 12px 14px;
  margin: 0 0 18px;
  font-size: 13.5px;
  color: #6B5312;
}
.editeur__corps input:disabled,
.editeur__corps select:disabled,
.editeur__corps textarea:disabled {
  background: #F7F5F1;
  color: var(--ink-2);
  cursor: default;
}
.editeur__corps button:disabled { opacity: .35; cursor: default; }

.lignes { width: 100%; border-collapse: collapse; margin-bottom: 10px; }
.lignes th {
  text-align: left;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--ink-3);
  padding: 6px 6px;
  border-bottom: 1px solid var(--beige);
}
/* Alignement en haut : une ligne qui porte un détail est plus haute, et sa
   quantité doit rester en face de sa désignation. */
.lignes td { padding: 5px 6px 5px 0; vertical-align: top; }
.lignes input { width: 100%; }
.lignes [data-total] { line-height: 39px; }
.lignes .col-actions { padding-top: 13px; }

/* Détail d'une prestation : marque et modèle, ce qui est compris. Replié tant
   qu'il est vide — une ligne sur deux n'en a pas besoin. */
.ligne-detail {
  border: none;
  background: transparent;
  padding: 2px 0 0;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
}
.ligne-detail:hover { color: var(--navy); }
.ligne-note {
  width: 100%;
  margin-top: 4px;
  font-size: 13px;
  resize: vertical;
}
.col-num { text-align: right; width: 110px; }
.lignes .col-num input { text-align: right; }

/* Remise : un montant et son unité, assez étroits pour ne pas voler la
   place de la désignation. */
.col-remise { width: 130px; }
.col-remise,
.champ-remise { display: flex; gap: 4px; align-items: center; }
.col-remise input { min-width: 0; }
.col-remise select,
.champ-remise select { width: 58px; flex: none; padding-left: 8px; padding-right: 4px; }
.champ-remise input { flex: 1; min-width: 0; }
/* Une section regroupe les lignes qui la suivent : elle se lit comme un
   intertitre, pas comme une prestation. */
.lignes .ligne-section td { border-top: 1px solid var(--beige); padding-top: 10px; }
.lignes .ligne-section input {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--navy);
  background: #FAF8F4;
}
.lignes .ligne-section [data-total] {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
}

.col-actions { width: 76px; white-space: nowrap; text-align: right; }
.ligne-bouger,
.ligne-suppr {
  border: none;
  background: transparent;
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.ligne-bouger { font-size: 14px; }
.ligne-bouger:hover { color: var(--navy); }
.ligne-suppr:hover { color: var(--err); }

.lignes__ajouts { display: flex; flex-wrap: wrap; gap: 8px; }

.editeur__pied { margin-top: 20px; }
.totaux { text-align: right; margin-top: 8px; }
.totaux__ligne { display: flex; justify-content: flex-end; gap: 16px; align-items: baseline; }
.totaux__ligne strong { font-family: var(--font-display); font-size: 22px; color: var(--navy); }
.totaux__ligne--detail { font-size: 13px; color: var(--ink-2); }
.totaux__ligne--detail strong { font-size: 15px; font-weight: 600; }
.totaux__ligne--detail[hidden] { display: none; }
.totaux__mention { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.editeur__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--beige);
  background: #FAF8F4;
}
.editeur__actions .form-error { margin-right: auto; }

/* =========================================================
   Aperçu imprimable — A4
   ========================================================= */
.apercu { display: none; }

.page {
  width: 210mm;
  min-height: 297mm;
  padding: 18mm 16mm;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 10.5pt;
  line-height: 1.5;
}
.page__tete { display: flex; justify-content: space-between; gap: 20mm; margin-bottom: 12mm; }
.page__logo { height: 16mm; width: auto; display: block; margin-bottom: 3mm; }
.page__raison { font-family: var(--font-display); font-weight: 700; font-size: 14pt; color: var(--navy); }
.page__ligne { font-size: 9pt; color: var(--ink-2); }
.page__titre { text-align: right; }
.page__titre h1 {
  font-family: var(--font-display);
  font-size: 26pt;
  margin: 0;
  color: var(--navy);
  letter-spacing: -.02em;
}
.page__numero { font-family: var(--font-mono); font-size: 11pt; color: var(--gold); margin-bottom: 2mm; }

.page__adresses {
  display: flex;
  align-items: flex-start;
  gap: 8mm;
  margin-bottom: 8mm;
}
.page__client {
  flex: 1 1 0;
  border-left: 3px solid var(--gold);
  padding-left: 5mm;
  font-size: 10pt;
}
.page__chantier { border-left-color: var(--navy); }
.page__label {
  font-family: var(--font-mono);
  font-size: 8pt;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-3);
}
.page__client-nom { font-weight: 700; font-size: 12pt; }
.page__brouillon {
  border: 1px solid var(--gold);
  background: #FBF1DC;
  color: #6B5312;
  padding: 3mm 4mm;
  margin: 0 0 6mm;
  font-size: 9.5pt;
  font-weight: 600;
}
.page__objet { margin: 0 0 6mm; }

.page__lignes { width: 100%; border-collapse: collapse; margin-bottom: 8mm; }
.page__lignes th {
  text-align: left;
  font-size: 8.5pt;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--navy);
  padding: 2mm 1mm;
}
.page__lignes td { padding: 2.5mm 1mm; border-bottom: 1px solid #EDE9E1; }
.page__lignes td { vertical-align: top; }
/* Le détail se lit sous la désignation, en retrait de ton. */
.page__detail {
  margin-top: 1mm;
  font-size: 9pt;
  color: var(--ink-2);
  white-space: pre-line;
}
.page__lignes tr { break-inside: avoid; }
.page__lignes .page__section td {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--navy);
  background: #FAF8F4;
  border-bottom: 1px solid var(--navy);
  padding-top: 3.5mm;
  /* Un intitulé de section ne reste pas seul en bas de page. */
  break-after: avoid;
}

.page__totaux { margin-left: auto; width: 75mm; }
.page__totaux div { display: flex; justify-content: space-between; padding: 1.5mm 0; }
.page__totaux strong { font-family: var(--font-display); }
.page__du {
  border-top: 1px solid var(--navy);
  margin-top: 1mm;
  padding-top: 2mm !important;
  font-size: 12pt;
  color: var(--navy);
}
.page__tva {
  display: block !important;
  font-size: 8.5pt;
  color: var(--ink-3);
  margin-top: 2mm;
  text-align: right;
}
.page__notes { margin: 8mm 0 0; font-size: 9.5pt; color: var(--ink-2); white-space: pre-wrap; }
.page__accord { margin-top: 10mm; font-size: 9.5pt; }
.page__cadre { height: 28mm; border: 1px solid #D8D2C6; border-radius: 2mm; margin-top: 3mm; }
.page__mentions { margin-top: 10mm; font-size: 8.5pt; color: var(--ink-3); }
.page__pied {
  margin-top: 12mm;
  padding-top: 3mm;
  border-top: 1px solid #EDE9E1;
  font-size: 8pt;
  color: var(--ink-3);
  text-align: center;
}

@media print {
  /* Les marges viennent de la boîte de page et non du padding du document :
     elles valent alors pour toutes les pages d'une facture qui en compte
     plusieurs, et rien ne dépasse si le navigateur impose les siennes. */
  @page { size: A4; margin: 15mm; }

  body.impression > *:not(.apercu) { display: none !important; }

  /* .admin étire le corps sur 100vh — soit une feuille entière à l'impression,
     quelle que soit la longueur du document : le dépassement d'un rien suffit
     alors à ouvrir une seconde page vide. */
  html, body.impression { height: auto; min-height: 0; }
  body.impression { background: #fff; }

  .apercu { display: block !important; }

  /* Largeur physique arrêtée par le document, et non héritée de la boîte de
     page : si le navigateur met en page à la largeur de la fenêtre plutôt qu'à
     celle de la feuille, la facture tient quand même dans la feuille au lieu
     d'être coupée à droite. 180 mm pour 210 mm de feuille : la marge tient
     dans la boîte de page quand elle est respectée, et dans celle que le
     navigateur impose sinon. Calée à gauche et non centrée :
     centrer dans une mise en page plus large que la feuille repousserait la
     facture hors du bord droit. */
  .page {
    width: 180mm;
    max-width: 100%;
    min-height: 0;
    margin: 0;
    padding: 0;
  }

  /* Si la zone imprimable est plus étroite que prévu, l'en-tête, les adresses
     et les totaux passent à la ligne plutôt que d'être coupés au bord. */
  .page__tete { flex-wrap: wrap; gap: 8mm; }
  .page__adresses { flex-wrap: wrap; }
  .page__totaux { max-width: 100%; }
}

@media (max-width: 640px) {
  .champ-grille { grid-template-columns: 1fr; }
  .bloc-chantier { grid-template-columns: 1fr; }
  .facturation__barre { flex-direction: column; align-items: stretch; }
  .chiffres__mois { grid-template-columns: repeat(2, 1fr); }
  .chiffres__bilan { margin-left: 0; }
  .facturation__actions .btn { flex: 1; }
  .editeur { padding: 0; }
  .editeur__panneau { border-radius: 0; min-height: 100vh; }
  .lignes thead { display: none; }
  .lignes tr { display: grid; grid-template-columns: 1fr auto; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--beige); }
  .lignes td { padding: 0; }
  .lignes td:first-child { grid-column: 1 / -1; }
  .col-remise { width: auto; }
  .col-num { width: auto; text-align: left; }
  .col-actions { width: auto; text-align: right; }
}

/* =========================================================
   Catalogue de prestations
   ========================================================= */
.sous-onglets { display: flex; gap: 6px; margin-bottom: 16px; }
.sous-onglet {
  border: 1px solid var(--beige);
  background: transparent;
  border-radius: var(--pill);
  padding: 8px 16px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink-2);
  cursor: pointer;
}
.sous-onglet:hover { background: #fff; }
.sous-onglet.is-actif { background: var(--navy); border-color: var(--navy); color: #fff; }

.service-form {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.service-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.service-form input,
.service-form select {
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 9px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 400;
  color: var(--ink);
  background: #fff;
  outline: none;
}
.service-form input:focus,
.service-form select:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 162, 75, .18);
}
.service-form__actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
.service-form__actions .form-error { margin-right: auto; }

.service {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.service__texte { flex: 1; min-width: 200px; }
.service__libelle { font-family: var(--font-display); font-weight: 700; font-size: 16px; }
.service__desc { font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.service__prix {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--navy);
  white-space: nowrap;
}
.service__unite { font-family: var(--font-body); font-weight: 500; font-size: 12.5px; color: var(--ink-3); }
.service__actions { display: flex; gap: 6px; }

.ajout-prestation {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: #FAF8F4;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 14px;
}
.ajout-prestation label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.ajout-prestation select { flex: 1; min-width: 220px; }

@media (max-width: 640px) {
  .service-form { grid-template-columns: 1fr; }
  .service { flex-direction: column; align-items: flex-start; gap: 8px; }
}

.statut-btn--valider { color: var(--navy); border-color: var(--gold); background: #FBF1DC; font-weight: 700; }
.statut-btn--valider:hover { background: var(--gold); color: var(--navy-deep); }
.statut-btn--danger { color: var(--err); border-color: rgba(163, 43, 43, .35); }
.statut-btn--danger:hover { background: #FBEDED; border-color: var(--err); }
