/* Outil privé de factures & devis */
.page-facturation { background: var(--nude); }
.fx-entete { display: flex; justify-content: space-between; align-items: center; padding: 1rem clamp(16px, 4vw, 48px); background: var(--creme); border-bottom: 1px solid rgba(160,118,80,.25); }
.fx-entete p { font-family: var(--titre); font-size: 1.3rem; }
.fx-entete small { font-family: var(--corps); font-size: .75rem; color: var(--texte-doux); }
.fx { max-width: 1400px; margin: 0 auto; padding: 1.5rem clamp(16px, 3vw, 40px) 4rem; }
.fx-alerte { background: var(--creme); border-left: 3px solid var(--dore); padding: .9rem 1.2rem; font-size: .9rem; margin-bottom: 1.2rem; }
.fx-bloc { background: var(--creme); padding: 1.6rem clamp(1rem, 2.5vw, 2rem); margin-bottom: 1.5rem; border: 1px solid rgba(160,118,80,.2); }
.fx-bloc summary { cursor: pointer; font-family: var(--titre); font-size: 1.3rem; }
.fx-bloc h2 { font-family: var(--titre); font-weight: 400; font-size: 1.7rem; margin-bottom: 1rem; }
.fx-bloc h3 { font-family: var(--titre); font-weight: 400; font-size: 1.3rem; margin: 1.6rem 0 .7rem; padding-bottom: .3rem; border-bottom: 1px solid rgba(160,118,80,.25); }
.fx-aide { font-size: .82rem; color: var(--texte-doux); margin: .5rem 0 1rem; }
.fx-champs { display: grid; gap: .8rem 1rem; }
.fx-champs.deux, #reglages { grid-template-columns: 1fr 1fr; }
.fx label { display: flex; flex-direction: column; gap: .3rem; font-size: .78rem; letter-spacing: .05em; color: var(--texte-doux); }
.fx label.plein, .fx-champs .plein { grid-column: 1 / -1; }
.fx input, .fx select, .fx textarea { font: inherit; font-size: .95rem; color: var(--texte); padding: .6rem .7rem; border: 1px solid rgba(160,118,80,.35); background: #fffdfa; border-radius: 0; width: 100%; }
.fx input:focus, .fx select:focus, .fx textarea:focus { outline: 2px solid var(--dore-clair); outline-offset: 0; }
.fx input[readonly] { background: transparent; font-weight: 500; }
.fx label.fx-case { flex-direction: row; align-items: center; gap: .6rem; font-size: .9rem; color: var(--texte); margin-bottom: .8rem; }
.fx-case input { width: auto; }
.fx-ok { color: #3e7b4f; align-self: center; }
#reglages .btn { justify-self: start; }

.fx-grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.fx-type { display: flex; gap: .5rem; margin-bottom: 1.2rem; }
.fx-type label { flex-direction: row; }
.fx-type input { position: absolute; opacity: 0; width: 1px; }
.fx-type span { padding: .6rem 1.6rem; border: 1px solid var(--texte); font-size: .8rem; letter-spacing: .15em; text-transform: uppercase; color: var(--texte); cursor: pointer; }
.fx-type input:checked + span { background: var(--texte); color: var(--creme); }
.fx-type input:disabled + span { opacity: .5; cursor: default; }
.fx-type input:focus-visible + span { outline: 2px solid var(--dore); }

.fx-ajout { display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.fx-ajout select { flex: 1; min-width: 220px; }
.fx-ligne { display: grid; grid-template-columns: 2fr 1.6fr 60px 90px 90px 30px; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.fx-ligne input { padding: .5rem; font-size: .88rem; }
.fx-total-ligne { text-align: right; font-size: .9rem; }
.fx-suppr { border: 0; background: none; font-size: 1.3rem; color: var(--dore-fonce); cursor: pointer; }
.fx-vide { color: var(--texte-doux); font-size: .88rem; font-style: italic; padding: .5rem 0; text-align: center; }
.fx-actions { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: center; margin-top: 1.5rem; }
.fx-actions .lien-fleche { color: var(--texte); background: none; border: 0; cursor: pointer; font: inherit; font-size: .85rem; text-decoration: underline; }
.fx-message { margin-top: 1rem; color: #3e7b4f; font-size: .9rem; }
.fx-import { cursor: pointer; }
.fx-import input { display: none; }

/* Aperçu A4 */
.fx-apercu { position: sticky; top: 1rem; }
.feuille { background: #fff; color: #2b1810; aspect-ratio: 210 / 297; padding: 7% 7% 5%; font-size: clamp(9px, .85vw, 12.5px); line-height: 1.45; box-shadow: 0 10px 40px rgba(59,29,18,.15); display: flex; flex-direction: column; overflow: hidden; }
.f-haut { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 1.4em; border-bottom: 1px solid #c9a37c; }
.f-marque img { width: 5.5em; mix-blend-mode: multiply; }
.f-nom { font-family: var(--titre); letter-spacing: .3em; font-size: 1.3em; margin-top: .3em; }
.f-nom b { font-weight: 500; }
.f-marque p:last-child { font-size: .85em; letter-spacing: .15em; text-transform: uppercase; color: #7d5634; }
.f-titre { text-align: right; }
.f-titre h1 { font-family: var(--titre); font-weight: 400; font-size: 2.6em; line-height: 1; margin-bottom: .3em; color: #3b1d12; }
.f-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 2em; margin: 1.8em 0; }
.f-parties h2 { font-family: var(--corps); font-weight: 500; font-size: .8em; letter-spacing: .2em; text-transform: uppercase; color: #a07650; margin-bottom: .4em; }
.manque { color: #b0412f; font-style: italic; }
.f-table { width: 100%; border-collapse: collapse; }
.f-table th { font-weight: 500; font-size: .8em; letter-spacing: .12em; text-transform: uppercase; text-align: right; padding: .6em .4em; background: #f7eee4; color: #3b1d12; }
.f-table th:first-child, .f-table td:first-child { text-align: left; }
.f-table td { padding: .6em .4em; border-bottom: 1px solid #efe2d4; text-align: right; vertical-align: top; }
.f-table td small { display: block; color: #8a7466; font-size: .88em; }
.f-table .vide { text-align: center; color: #aaa; }
.f-totaux { margin: 1.2em 0 0 auto; width: 55%; }
.f-totaux p { display: flex; justify-content: space-between; padding: .3em 0; }
.f-net { border-top: 1px solid #3b1d12; margin-top: .3em; padding-top: .6em !important; font-size: 1.25em; font-weight: 500; }
.f-tva { justify-content: flex-end !important; font-size: .85em; color: #7d5634; }
.f-bas { margin-top: 1.8em; display: grid; gap: .6em; font-size: .92em; }
.f-note { font-style: italic; }
.f-accord { margin-top: .8em; border: 1px solid #c9a37c; padding: .8em 1em 4em; }
.f-pied { margin-top: auto; padding-top: 1em; border-top: 1px solid #c9a37c; text-align: center; font-size: .8em; letter-spacing: .1em; color: #7d5634; }

/* Historique */
.fx-filtres { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; margin-bottom: 1rem; }
.fx-filtres select { width: auto; }
.fx-filtres p { margin-left: auto; font-size: .92rem; }
.fx-tableau { overflow-x: auto; }
#historique { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 620px; }
#historique th { text-align: left; font-weight: 500; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; color: var(--texte-doux); padding: .6rem; border-bottom: 1px solid var(--dore-clair); }
#historique td { padding: .6rem; border-bottom: 1px solid rgba(160,118,80,.15); }
.fx-btns { white-space: nowrap; }
.fx-btns button { font: inherit; font-size: .78rem; background: none; border: 1px solid rgba(59,29,18,.35); padding: .25rem .6rem; margin-left: .3rem; cursor: pointer; color: var(--texte); }
.fx-btns button:hover { background: var(--texte); color: var(--creme); }
.pastille { font-size: .75rem; padding: .2rem .6rem; border-radius: 99px; }
.pastille.ok { background: #e3efe5; color: #2f6b3f; }
.pastille.attente { background: #f8e6cf; color: #8a5a1c; }

@media (max-width: 980px) {
  .fx-grille { grid-template-columns: 1fr; }
  .fx-apercu { position: static; }
  .feuille { font-size: 2.4vw; }
}
@media (max-width: 600px) {
  .fx-champs.deux, #reglages { grid-template-columns: 1fr; }
  .fx-ligne { grid-template-columns: 1fr 1fr 30px; }
  .fx-ligne input[data-k="designation"], .fx-ligne input[data-k="detail"] { grid-column: 1 / -1; }
  .fx-ligne .fx-total-ligne { grid-column: 3; }
  .fx-entete p small { display: none; }
}

.fx-auto { display: flex; align-items: center; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; padding: .9rem 1.2rem; margin-bottom: 1.2rem; font-size: .9rem; background: var(--creme); border-left: 3px solid var(--dore); }
.fx-auto.ok { border-left-color: #3e7b4f; }
.fx-auto.attention { border-left-color: #b0412f; }
.fx-auto p { flex: 1; min-width: 240px; }
.fx-auto .lien-fleche { background: none; border: 0; font: inherit; font-size: .85rem; text-decoration: underline; cursor: pointer; color: var(--texte); }
.fx-lien { margin-top: 1.2rem; padding: 1.2rem; background: #fffdfa; border: 1px solid var(--dore-clair); }
.fx-lien input { margin: .6rem 0; font-size: .8rem; }

/* Impression / PDF : seule la feuille est imprimée */
@page { size: A4; margin: 0; }
@media print {
  body.page-facturation { background: #fff; margin: 0; }
  .fx-entete, .fx > :not(.fx-grille), #doc, .flottant { display: none !important; }
  .fx, .fx-grille, .fx-apercu { display: block; padding: 0; margin: 0; position: static; }
  .page-facturation .feuille { width: 210mm; height: 297mm; aspect-ratio: auto; box-shadow: none; font-size: 10.5pt; padding: 18mm 16mm 12mm; overflow: hidden; }
}

/* =========================================================
   ESPACE PRO (vue client)
   ========================================================= */
.ep-entete { text-align: center; padding: 4.5rem 16px 2.5rem; background: linear-gradient(180deg, #f9f3ec, #f4eadf); }
.ep-entete h1 { font-family: var(--titre); font-weight: 300; font-size: clamp(2.2rem, 5vw, 3.4rem); margin: .4rem 0; }
.ep-maj { font-size: .82rem; color: var(--texte-doux); }
.ep-chiffres { display: flex; justify-content: center; margin: 2.4rem auto 0; max-width: 760px; }
.ep-chiffres div { flex: 1; padding: 0 1.2rem; }
.ep-chiffres div + div { border-left: 1px solid rgba(160,118,80,.4); }
.ep-chiffres span { font-family: var(--titre); font-size: clamp(1.5rem, 3vw, 2.2rem); }
.ep-chiffres p { font-size: .7rem; letter-spacing: .2em; text-transform: uppercase; color: var(--texte-doux); margin-top: .3rem; }
.ep-liste, .ep-doc { max-width: 1100px; margin: 0 auto; padding: 2.5rem clamp(16px, 3vw, 32px) 4rem; }
.espace-pro #ep-docs { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
.espace-pro #ep-docs th { text-align: left; font-weight: 500; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--texte-doux); padding: .7rem; border-bottom: 1px solid var(--dore-clair); }
.espace-pro #ep-docs td { padding: .8rem .7rem; border-bottom: 1px solid rgba(160,118,80,.15); vertical-align: top; }
.ep-doc-actions { display: flex; gap: 1.5rem; align-items: center; justify-content: center; margin-bottom: 1.8rem; flex-wrap: wrap; }
.ep-fermer { background: none; border: 0; font: inherit; font-size: .85rem; text-decoration: underline; color: var(--texte); cursor: pointer; }
.ep-feuille { max-width: 820px; margin: 0 auto; }
.ep-feuille .feuille { font-size: clamp(8px, 1.45vw, 12.5px); }
.espace-pro .etapes { max-width: 1000px; margin: 0 auto; }
@media (max-width: 600px) {
  .ep-chiffres div { padding: 0 .5rem; }
  .ep-feuille .feuille { font-size: 2.3vw; padding: 6% 5%; }
}
@media print {
  body.espace-pro { background: #fff; }
  .espace-pro .nav, .espace-pro footer, .espace-pro .ep-entete, .espace-pro .ep-liste,
  .espace-pro .ep-doc-actions, .espace-pro #vue-accueil, .espace-pro .flottant { display: none !important; }
  .espace-pro .ep-doc, .espace-pro .ep-feuille { padding: 0; margin: 0; max-width: none; }
  .espace-pro .feuille { width: 210mm; height: 297mm; aspect-ratio: auto; box-shadow: none; font-size: 10.5pt; padding: 18mm 16mm 12mm; }
}

/* Cartes de fidélité */
.fid-form { grid-template-columns: repeat(4, minmax(0, 1fr)) auto; align-items: end; margin-bottom: .4rem; }
#fid-recherche { max-width: 420px; }
.fid-points { letter-spacing: .1em; color: var(--dore-fonce); }
.fid-points i { font-style: normal; color: rgba(160,118,80,.4); }
.fx-btns .fid-principal { background: var(--texte); color: var(--creme); border-color: var(--texte); }
.fid-avantages-cell .pastille { white-space: nowrap; }
@media (max-width: 900px) { .fid-form { grid-template-columns: 1fr 1fr; } }
#fid-table .fx-btns { white-space: normal; min-width: 260px; }
#fid-table .fx-btns button { margin: .15rem .3rem .15rem 0; }
