:root {
  --fond: #f7f8f7;
  --surface: #ffffff;
  --texte: #16211f;
  --discret: #5b6a67;
  --bord: #dde3e1;
  --accent: #1d4ed8;
  --accent-fort: #1e40af;
  --accent-doux: #e8efff;
  --alerte: #fff6db;
  --danger: #b42318;
  --ok: #067647;
  --rayon: 10px;
  --ombre: 0 1px 2px rgb(16 24 40 / 6%), 0 4px 12px rgb(16 24 40 / 5%);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --fond: #0f1514; --surface: #172120; --texte: #e6eeec; --discret: #9fb0ac; --bord: #2a3836;
    --accent: #6b9bff; --accent-fort: #93b5ff; --accent-doux: #1b2747; --alerte: #3a3218; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --fond: #0f1514; --surface: #172120; --texte: #e6eeec; --discret: #9fb0ac; --bord: #2a3836;
  --accent: #6b9bff; --accent-fort: #93b5ff; --accent-doux: #1b2747; --alerte: #3a3218; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fond); color: var(--texte); font: 16px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
a:hover { color: var(--accent-fort); }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); margin: 0.4em 0; }
h2, .h2 { font-size: 1.45rem; margin: 1.6em 0 0.5em; }
h3, .h3 { font-size: 1.1rem; margin: 1.2em 0 0.3em; }
.lead { font-size: 1.15rem; color: var(--discret); }
.discret { color: var(--discret); }
.petit { font-size: 0.85rem; }
.centre { text-align: center; }
.centre-bloc { text-align: center; padding: 3rem 0; }

.conteneur { max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.conteneur-large { max-width: 1440px; margin: 0 auto; padding: 0 16px; }
.etroit { max-width: 760px; margin-left: auto; margin-right: auto; }

.btn { display: inline-flex; align-items: center; gap: 0.4em; padding: 0.6em 1.1em; border-radius: 8px; border: 1px solid var(--accent); background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; transition: background 0.15s; }
.btn:hover { background: var(--accent-fort); color: #fff; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.btn-second { background: var(--surface); color: var(--accent); }
.btn-second:hover { background: var(--accent-doux); color: var(--accent-fort); }
.btn-grand { padding: 0.8em 1.4em; font-size: 1.05rem; }
.btn-petit { padding: 0.35em 0.8em; font-size: 0.9rem; }
.lien { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; padding: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

.entete { background: var(--surface); border-bottom: 1px solid var(--bord); }
.entete-in { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 60px; flex-wrap: wrap; }
.entete nav { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; }
.entete nav a:not(.btn) { color: var(--texte); text-decoration: none; font-weight: 500; }
.logo { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.15rem; color: var(--texte); text-decoration: none; margin: 0; }
.logo-marque { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; font-size: 1rem; }
@media (max-width: 640px) { .entete nav a:not(.btn) { display: none; } }

.heros { padding: 3rem 0 2rem; }
.heros-in { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: center; }
@media (max-width: 860px) { .heros-in { grid-template-columns: 1fr; } .apercu-heros { display: none; } }
.surtitre { color: var(--accent); font-weight: 600; margin: 0; }
.apercu-heros { margin: 0; }
.mini-facture { background: #fff; color: #1d2422; border-radius: 8px; box-shadow: 0 10px 40px rgb(16 24 40 / 14%); padding: 1.6rem; font-size: 0.85rem; transform: rotate(1.5deg); }
.mf-haut { display: flex; justify-content: space-between; border-bottom: 2px solid #0f766e; padding-bottom: 0.5rem; margin-bottom: 1rem; }
.mf-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1rem; color: #4a5654; }
.mf-ligne, .mf-total { display: flex; justify-content: space-between; padding: 0.35rem 0; border-bottom: 1px solid #e6eae9; }
.mf-total { font-weight: 700; border: 0; font-size: 1rem; }
.mf-mention { font-size: 0.75rem; color: #5b6a67; margin: 0.8rem 0 0; }

.grille-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1rem; margin-top: 1rem; }
.carte { display: block; background: var(--surface); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 1.2rem 1.3rem; color: inherit; text-decoration: none; margin-bottom: 1rem; }
.carte .h3 { margin-top: 0; }
a.carte:hover { border-color: var(--accent); }
.bande { margin: 3rem auto; }
.pastilles { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.8rem 0; }
.pastilles a { background: var(--surface); border: 1px solid var(--bord); border-radius: 999px; padding: 0.35em 0.9em; text-decoration: none; color: var(--texte); font-size: 0.95rem; }
.pastilles a:hover { border-color: var(--accent); color: var(--accent); }

.fil { font-size: 0.85rem; color: var(--discret); margin-top: 1.5rem; }
.fil a { color: var(--discret); }
.tableau-defile { overflow-x: auto; }
.tableau { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--rayon); overflow: hidden; border: 1px solid var(--bord); font-size: 0.95rem; }
.tableau th, .tableau td { padding: 0.6rem 0.8rem; text-align: left; border-bottom: 1px solid var(--bord); }
.tableau td:nth-child(n+2), .tableau th:nth-child(n+2) { text-align: right; white-space: nowrap; }
.tableau tfoot td { font-weight: 700; }
.encart { background: var(--accent-doux); border-radius: var(--rayon); padding: 1.2rem 1.4rem; margin: 2rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.encart p { margin: 0; }
.article blockquote { border-left: 3px solid var(--accent); margin: 1rem 0; padding: 0.5rem 1rem; background: var(--surface); }
.faq details { background: var(--surface); border: 1px solid var(--bord); border-radius: 8px; padding: 0.8rem 1rem; margin-bottom: 0.5rem; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 0.6rem 0 0; color: var(--discret); }
.alerte { background: var(--alerte); border-radius: 8px; padding: 0.7rem 1rem; }
.liste-guides .carte p { color: var(--discret); margin: 0; }

.offres { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.2rem; max-width: 820px; margin: 2rem auto; }
.offre { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 1.6rem; display: flex; flex-direction: column; gap: 0.6rem; }
.offre h2 { margin: 0; }
.offre-pro { border: 2px solid var(--accent); box-shadow: var(--ombre); }
.prix { font-size: 2.2rem; font-weight: 800; margin: 0; }
.prix small { font-size: 1rem; font-weight: 500; color: var(--discret); }
.coches { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.coches li { padding-left: 1.6em; position: relative; margin: 0.35em 0; }
.coches li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }
.attente input, .ligne-form input { flex: 1; min-width: 0; }
.attente { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.attente p { flex-basis: 100%; margin: 0; }
.ligne-form { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.retour { min-height: 1.4em; color: var(--accent-fort); font-weight: 500; }
.cle { font: 700 1.4rem ui-monospace, monospace; background: var(--surface); border: 2px dashed var(--accent); border-radius: 8px; padding: 0.8rem; user-select: all; }

.pied { border-top: 1px solid var(--bord); background: var(--surface); margin-top: 4rem; padding: 2rem 0 1rem; }
.pied-in { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 1.5rem; }
.pied-in a { display: block; color: var(--discret); text-decoration: none; font-size: 0.92rem; margin: 0.25rem 0; }
.pied-in a:hover { color: var(--accent); }
.pied-titre { font-weight: 700; margin: 0 0 0.4rem; }
@media (max-width: 760px) { .pied-in { grid-template-columns: 1fr 1fr; } }

/* ---------- Formulaires ---------- */
input, select, textarea { font: inherit; color: var(--texte); background: var(--surface); border: 1px solid var(--bord); border-radius: 7px; padding: 0.45em 0.6em; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.88rem; font-weight: 500; color: var(--discret); }
label.case { flex-direction: row; align-items: center; gap: 0.5rem; color: var(--texte); }
label.case input { width: auto; }
[hidden] { display: none !important; }

/* ---------- Éditeur ---------- */
.carte-chiffres { background: var(--surface); border: 1px solid var(--bord); border-radius: 14px; padding: 1.4rem; box-shadow: var(--ombre); }
.carte-chiffres p { margin: 0.6rem 0; padding-bottom: 0.6rem; border-bottom: 1px solid var(--bord); }
.carte-chiffres p:last-child { border: 0; }
.carte-chiffres strong { display: block; font-size: 1.5rem; color: var(--accent); }
.choix-metier { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1.2rem 0 0.4rem; }
.choix-metier select { flex: 1 1 260px; font-size: 1.05rem; padding: 0.7em; }

/* ---------- Assistant ---------- */
.etapes { position: sticky; top: 0; z-index: 5; background: var(--surface); border-bottom: 1px solid var(--bord); }
.etapes-in { display: flex; gap: 0.3rem; overflow-x: auto; padding-top: 0.5rem; padding-bottom: 0.5rem; }
.etapes a { display: flex; align-items: center; gap: 0.4rem; padding: 0.4rem 0.8rem; border-radius: 8px; color: var(--discret); text-decoration: none; white-space: nowrap; font-weight: 500; }
.etapes a span { display: inline-grid; place-items: center; width: 1.5rem; height: 1.5rem; border-radius: 50%; background: var(--fond); font-size: 0.8rem; }
.etapes a.actif { background: var(--accent-doux); color: var(--accent-fort); }
.etapes a.actif span { background: var(--accent); color: #fff; }
.app { padding-top: 1.2rem; }
.champs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; }
.champs .large { grid-column: 1 / -1; }
@media (max-width: 560px) { .champs { grid-template-columns: 1fr; } }
.unite { padding: 1rem; }
.unite-tete { display: flex; gap: 0.8rem; align-items: center; margin-bottom: 0.6rem; }
.unite-nom { font-weight: 700; font-size: 1.1rem; }
.danger { color: #b42318; }
.risque { border: 1px solid var(--bord); border-radius: 8px; margin-bottom: 0.5rem; background: var(--fond); }
.risque > summary { padding: 0.6rem 0.8rem; cursor: pointer; display: flex; gap: 0.5rem; align-items: baseline; flex-wrap: wrap; }
.risque > summary .discret { font-size: 0.88rem; }
.risque-corps { padding: 0 0.8rem 0.8rem; display: grid; gap: 0.7rem; }
.cotation { display: grid; grid-template-columns: 1fr 1fr auto; gap: 0.6rem; align-items: end; }
@media (max-width: 560px) { .cotation { grid-template-columns: 1fr 1fr; } }
.criticite { margin: 0; padding-bottom: 0.4rem; }
fieldset { border: 1px solid var(--bord); border-radius: 8px; padding: 0.5rem 0.8rem 0.7rem; margin: 0; }
legend { font-weight: 600; font-size: 0.9rem; padding: 0 0.3rem; }
fieldset label.case { font-weight: 400; font-size: 0.93rem; margin: 0.25rem 0; align-items: flex-start; }
fieldset label.case input { margin-top: 0.3rem; }
.prio { display: inline-block; border-radius: 5px; padding: 0.05em 0.45em; font-weight: 700; font-size: 0.8em; color: #fff; }
.prio.p1 { background: #c2410c; }
.prio.p2 { background: #ca8a04; }
.prio.p3 { background: #15803d; }
.aide summary { cursor: pointer; font-weight: 600; }
.plan input, .plan select { min-width: 8rem; padding: 0.3em 0.4em; }
.plan td { vertical-align: top; text-align: left !important; white-space: normal !important; }
.liste-choix { display: grid; gap: 0.4rem; max-height: 60vh; overflow-y: auto; margin-top: 0.8rem; }
.choix { text-align: left; background: var(--fond); border: 1px solid var(--bord); border-radius: 8px; padding: 0.6rem 0.8rem; cursor: pointer; font: inherit; color: inherit; display: grid; gap: 0.2rem; }
.choix:hover { border-color: var(--accent); }
.choix span { font-size: 0.85rem; color: var(--discret); }
.barre-doc { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.barre-doc h1 { margin: 0; }
.barre-doc-actions { max-width: 420px; }
.barre-doc-actions .btn { margin: 0 0.3rem 0.4rem 0; }
.barre-doc-actions p { margin: 0.3rem 0; }

/* Le document reste clair en thème sombre : c'est une pièce imprimable */
.doc { background: #fff; color: #1d2422; max-width: 900px; margin: 1rem auto; padding: 2.5rem 3rem; box-shadow: var(--ombre); border-radius: 4px; font-size: 0.92rem; line-height: 1.5; position: relative; overflow: hidden; }
@media (max-width: 640px) { .doc { padding: 1.2rem; } }
.doc h3 { color: #1d4ed8; border-bottom: 2px solid #1d4ed8; padding-bottom: 0.2rem; margin-top: 2rem; }
.doc h4 { margin: 1.2rem 0 0.4rem; }
.d-garde { text-align: center; padding: 2rem 0 1.5rem; border-bottom: 1px solid #dde3e1; }
.d-sur { text-transform: uppercase; letter-spacing: 0.08em; color: #1d4ed8; font-weight: 700; }
.d-titre { font-size: 2rem; margin: 0.5rem 0; }
.d-infos { margin: 1.5rem auto; text-align: left; border-collapse: collapse; }
.d-infos th { padding: 0.3rem 1rem 0.3rem 0; color: #5b6a67; font-weight: 500; vertical-align: top; }
.d-ref { font-size: 0.8rem; color: #5b6a67; }
.d-table { width: 100%; border-collapse: collapse; margin: 0.5rem 0 1rem; font-size: 0.85rem; }
.d-table th { background: #eef2ff; text-align: left; padding: 0.4rem; border: 1px solid #c7d2e5; }
.d-table td { padding: 0.4rem; border: 1px solid #dbe1ec; vertical-align: top; }
.d-signature { margin-top: 2rem; }
.d-cadre { border: 1px solid #c9d1cf; height: 5rem; width: 50%; }
.d-apercu-note { text-align: center; color: #b42318; font-weight: 700; margin-top: 1rem; }
.filigrane { background-image: url("data:image/svg+xml,%3Csvg%20xmlns%3D%27http%3A//www.w3.org/2000/svg%27%20width%3D%27460%27%20height%3D%27260%27%3E%3Ctext%20x%3D%2720%27%20y%3D%27150%27%20transform%3D%27rotate%28-25%20230%20130%29%27%20font-family%3D%27Arial%27%20font-weight%3D%27700%27%20font-size%3D%2730%27%20fill%3D%27rgba%28180%2C35%2C24%2C0.16%29%27%3EAPER%C3%87U%20%E2%80%93%20NON%20FINALIS%C3%89%3C/text%3E%3C/svg%3E"); background-repeat: repeat; }
.modale { border: 0; border-radius: 14px; padding: 1.2rem 1.4rem; width: min(640px, calc(100vw - 32px)); background: var(--surface); color: var(--texte); }
.modale::backdrop { background: rgb(10 20 30 / 45%); }
.modale-tete { display: flex; justify-content: space-between; align-items: center; }
.modale-tete h2 { margin: 0; }
.fermer { border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--discret); }

@page { size: A4; margin: 14mm 12mm; }
@media print {
  body { background: #fff; }
  body > *:not(main), .etapes, .barre-doc, #bandeau, .app > p, dialog, .etape:not(#document) { display: none !important; }
  #document { display: block !important; }
  .doc { box-shadow: none; padding: 0; margin: 0; max-width: none; font-size: 9.5pt; overflow: visible; }
  .doc h3 { break-after: avoid; }
  .d-table tr { break-inside: avoid; }
  .d-garde { break-after: page; padding-top: 30%; border: 0; }
  .prio, .d-table th, .filigrane { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
