/* Charte SPM Saumur — générateur de devis et back-office */
:root {
    --rouge: #e30613;
    --rouge-fonce: #b8040f;
    --nuit: #020d26;
    --nuit-2: #06163a;
    --gris: #ededed;
    --gris-clair: #f6f6f6;
    --texte: #1d2433;
    --texte-2: #5b6475;
    --bord: #d9dde5;
    --ok: #1d7a46;
    --rayon: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--gris-clair);
    color: var(--texte);
    font: 16px/1.5 Rubik, system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: var(--rouge); }
h1, h2, h3 { color: var(--nuit); line-height: 1.25; margin: 0 0 .6em; }
h1 { font-size: clamp(1.5rem, 3vw, 2rem); }
h2 { font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; }

/* En-tête */
.entete { background: var(--nuit); border-bottom: 4px solid var(--rouge); }
.entete__in { max-width: 1180px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.entete__logo img { display: block; height: 48px; width: auto; }
.entete__titre { font-weight: 500; color: #fff; }
.entete .discret { color: #c9d1e3; }
.langues { display: flex; gap: 4px; }
.langues a { padding: 4px 8px; border-radius: 6px; color: #c9d1e3; text-decoration: none; font-weight: 500; font-size: .9rem; }
.langues a:hover { color: #fff; }
.langues a[aria-current] { background: var(--rouge); color: #fff; }

/* Mise en page */
.page { max-width: 1180px; margin: 0 auto; padding: 24px 16px 48px; }
.titre p { color: var(--texte-2); max-width: 60ch; margin-top: 0; }
.grille { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.recap { position: sticky; top: 16px; display: grid; gap: 16px; }
@media (max-width: 900px) {
    .grille { grid-template-columns: minmax(0, 1fr); }
    .recap { position: static; }
}

.carte { background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 20px; margin-bottom: 16px; }
.recap .carte { margin-bottom: 0; }
.num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--rouge); color: #fff; font-size: .9rem; flex: none; }

/* Champs */
.champs { display: grid; gap: 14px 18px; }
.champs--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 600px) { .champs--2 { grid-template-columns: minmax(0, 1fr); } }
.champ { min-width: 0; }
.champ[hidden] { display: none; }
fieldset.champ { border: 0; margin: 0; padding: 0; }
label, legend { display: block; font-weight: 500; font-size: .92rem; margin-bottom: 4px; color: var(--nuit); }
abbr[title] { color: var(--rouge); text-decoration: none; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
    width: 100%; font: inherit; color: inherit; background: #fff;
    border: 1px solid var(--bord); border-radius: 8px; padding: 9px 11px; min-height: 42px;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--nuit); outline-offset: 1px; border-color: var(--nuit); }
input[type=file] { font: inherit; max-width: 100%; }
.unite { display: flex; }
.unite input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.unite span { display: grid; place-items: center; padding: 0 10px; background: var(--gris); border: 1px solid var(--bord); border-left: 0; border-radius: 0 8px 8px 0; color: var(--texte-2); font-size: .9rem; }
.aide { color: var(--texte-2); font-size: .88rem; margin: 4px 0 0; }
.champ--erreur input, .champ--erreur select { border-color: var(--rouge); }
.err { color: var(--rouge); font-size: .88rem; margin: 4px 0 0; }
.pastilles { display: flex; flex-wrap: wrap; gap: 8px; }
.pastille { font-weight: 400; border: 1px solid var(--bord); border-radius: 999px; padding: 6px 12px; cursor: pointer; margin: 0; }
.pastille:has(input:checked) { border-color: var(--nuit); background: var(--nuit); color: #fff; }
.cases label { font-weight: 400; display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.piege { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* Boutons */
.bouton { display: inline-block; font: inherit; font-weight: 500; border: 0; border-radius: 8px; background: var(--rouge); color: #fff; padding: 10px 18px; cursor: pointer; text-decoration: none; }
.bouton:hover { background: var(--rouge-fonce); }
.bouton--grand { margin-top: 16px; padding: 13px 26px; font-size: 1.05rem; }
.bouton--sec { background: #fff; color: var(--nuit); border: 1px solid var(--bord); }
.bouton--sec:hover { background: var(--gris); }
.bouton--petit { padding: 5px 10px; font-size: .88rem; }

/* Récapitulatif et conseils */
.recap dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: .92rem; }
.recap dt { color: var(--texte-2); }
.recap dd { margin: 0; font-weight: 500; }
.recap dd.vide { grid-column: 1 / -1; font-weight: 400; color: var(--texte-2); }
.course { margin: 12px 0 0; padding-top: 12px; border-top: 1px solid var(--gris); font-weight: 500; }
.conseils { border-left: 4px solid var(--rouge); }
.conseils ul { margin: 0; padding-left: 18px; }
.conseils li { margin-bottom: 6px; }

.alerte { background: #fde8ea; border: 1px solid var(--rouge); color: var(--rouge-fonce); border-radius: var(--rayon); padding: 12px 16px; margin-bottom: 16px; }
.succes { background: #e6f4ec; border: 1px solid var(--ok); color: var(--ok); border-radius: var(--rayon); padding: 12px 16px; margin-bottom: 16px; }
.merci { max-width: 640px; margin: 40px auto; text-align: center; }

.pied { text-align: center; color: var(--texte-2); font-size: .88rem; padding: 24px 16px; }
.pied a { color: inherit; }

/* Back-office */
.onglets { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--bord); }
.onglets a { padding: 10px 14px; text-decoration: none; color: var(--texte-2); font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.onglets a[aria-current] { color: var(--nuit); border-color: var(--rouge); }
.badge { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--rouge); color: #fff; font-size: .78rem; text-align: center; }
.tableau-wrap { overflow-x: auto; }
table.tableau { width: 100%; border-collapse: collapse; font-size: .92rem; background: #fff; }
.tableau th, .tableau td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--gris); vertical-align: top; }
.tableau th { color: var(--texte-2); font-weight: 500; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }
.tableau tr.inactif td { color: var(--texte-2); text-decoration: line-through; }
.tableau tbody tr:hover { background: var(--gris-clair); }
.tableau input[type=text], .tableau input[type=number] { min-height: 34px; padding: 5px 8px; }
.statut { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .8rem; font-weight: 500; white-space: nowrap; }
.statut--nouvelle { background: #fde8ea; color: var(--rouge-fonce); }
.statut--en_cours { background: #fff2d6; color: #8a5a00; }
.statut--chiffree { background: #e6f4ec; color: var(--ok); }
.statut--archivee { background: var(--gris); color: var(--texte-2); }
.filtres { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
.filtres .champ { min-width: 160px; }
.fiche { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
@media (max-width: 900px) { .fiche { grid-template-columns: minmax(0, 1fr); } }
.fiche dl { display: grid; grid-template-columns: minmax(140px, 40%) 1fr; gap: 6px 14px; margin: 0; }
.fiche dt { color: var(--texte-2); }
.fiche dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .82rem; color: var(--texte-2); }
.matrice label { font-weight: 400; display: flex; gap: 8px; align-items: baseline; }
.matrice .champs { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ligne-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.discret { color: var(--texte-2); font-size: .88rem; }

/* Grille de compatibilité (restrictions) */
.ok { color: var(--ok); }
.ko { color: var(--rouge); }
.puce { display: inline-block; margin: 4px 6px 0 0; padding: 3px 10px; border: 1px solid var(--bord); border-radius: 999px; text-decoration: none; color: var(--nuit); font-size: .85rem; }
.compat th[scope=row] { white-space: nowrap; color: var(--nuit); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: .92rem; }
.grille__coin { font-size: .75rem; vertical-align: bottom; white-space: nowrap; }
.grille__col { vertical-align: bottom; text-align: center; padding: 8px 4px; min-width: 46px; }
.grille__col span { display: inline-block; writing-mode: vertical-rl; transform: rotate(180deg); white-space: nowrap; max-height: 160px; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--nuit); }
.grille__case { text-align: center; padding: 4px; }
.grille__case label { display: inline-block; margin: 0; cursor: pointer; }
.grille__case input { position: absolute; opacity: 0; pointer-events: none; }
.grille__case span { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: #e6f4ec; color: var(--ok); font-weight: 700; transition: background .12s; }
.grille__case span::before { content: "✓"; }
.grille__case input:checked + span { background: #fde8ea; color: var(--rouge); }
.grille__case input:checked + span::before { content: "✕"; }
.grille__case input:focus-visible + span { outline: 2px solid var(--nuit); outline-offset: 2px; }
.grille__case label:hover span { filter: brightness(.94); }
.grille__actions { white-space: nowrap; }
.compat tr.inactif th, .compat th.inactif span { text-decoration: line-through; color: var(--texte-2); }
.compat tr.inactif td { text-decoration: none; }
.grille__pied { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; }

/* Aide par étape */
.champ__tete { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.aide-bouton { font: inherit; font-size: .82rem; font-weight: 500; color: var(--rouge); background: none; border: 0; padding: 0 0 4px; cursor: pointer; white-space: nowrap; }
.aide-bouton span { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--rouge); color: #fff; font-size: .75rem; margin-right: 2px; }
.aide-bouton:hover { text-decoration: underline; }
.aide-fenetre { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: var(--rayon); padding: 20px; box-shadow: 0 20px 60px rgba(2, 13, 38, .35); }
.aide-fenetre::backdrop { background: rgba(2, 13, 38, .55); }
.aide-fenetre__tete { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.aide-fenetre__tete h2 { margin: 0; }
.aide-fenetre__fermer { font-size: 1.6rem; line-height: 1; border: 0; background: none; cursor: pointer; color: var(--texte-2); padding: 0 4px; }
.aide-fenetre__intro { margin: 10px 0 4px; }
.aide-options { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 14px; }
.aide-option { display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: inherit; background: #fff; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 12px; cursor: pointer; }
.aide-option:hover:not(:disabled) { border-color: var(--nuit); box-shadow: 0 2px 10px rgba(2, 13, 38, .1); }
.aide-option img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 6px; background: var(--gris); }
.aide-option strong { color: var(--nuit); }
.aide-option span { font-size: .88rem; color: var(--texte-2); }
.aide-option em { font-size: .8rem; color: var(--rouge); font-style: normal; }
.aide-option--choisie { border: 2px solid var(--rouge); }
.aide-option:disabled { opacity: .5; cursor: not-allowed; }
details.carte > summary { cursor: pointer; }
details.carte[open] > summary { margin-bottom: 8px; }

/* Schéma des cotes (section Dimensions) */
.schema-cotes { margin: 12px 0 16px; padding: 12px; background: var(--gris-clair); border-radius: var(--rayon); text-align: center; }
.schema-cotes img { width: 100%; max-width: 520px; height: auto; }
.schema-cotes figcaption { font-size: .88rem; color: var(--texte-2); margin-top: 4px; }
.lettre-cote { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--rouge); color: #fff; font-size: .75rem; font-weight: 700; margin-right: 4px; vertical-align: 1px; }
.aide-option img[src$=".svg"] { object-fit: contain; background: #f6f6f6; }

/* Forme du soufflet : cartes illustrées */
.formes { grid-column: 1 / -1; }
.formes__liste { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.forme { position: relative; display: flex; flex-direction: column; gap: 4px; margin: 0; padding: 10px; border: 1px solid var(--bord); border-radius: var(--rayon); cursor: pointer; font-weight: 400; background: #fff; }
.forme input { position: absolute; opacity: 0; pointer-events: none; }
.forme img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: contain; background: var(--gris-clair); border-radius: 6px; }
.forme strong { color: var(--nuit); }
.forme span { font-size: .84rem; color: var(--texte-2); }
.forme:hover { border-color: var(--nuit); }
.forme:has(input:checked) { border: 2px solid var(--rouge); padding: 9px; }
.forme:has(input:focus-visible) { outline: 2px solid var(--nuit); outline-offset: 2px; }

/* Panier : plusieurs soufflets par demande */
.bandeau-soufflet { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--nuit); color: #fff; border-radius: var(--rayon); padding: 10px 16px; margin-bottom: 12px; }
.bandeau-soufflet--modif { background: #8a5a00; }
.bouton--sec-fort { background: var(--nuit); }
.bouton--sec-fort:hover { background: var(--nuit-2); }
.bouton--danger { color: var(--rouge); }
.panier { border: 2px solid var(--nuit); }
.panier__liste { list-style: none; margin: 0; padding: 0; }
.panier__ligne { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--gris); }
.panier__ligne:first-child { border-top: 0; }
.panier__ligne--modif { background: #fff2d6; margin: 0 -12px; padding: 10px 12px; border-radius: 8px; }
.panier__texte { min-width: 0; flex: 1 1 260px; }
.panier__texte .discret { display: block; }
.panier__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.plan-actuel { margin: 0 0 6px; font-size: .9rem; }
.plan-actuel label { display: inline; font-weight: 400; margin-left: 8px; }
.recap-panier { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--nuit); font-weight: 500; }

/* Back-office : un bloc par soufflet dans une demande */
.soufflet-bo h3 { font-size: .95rem; margin: 14px 0 6px; color: var(--nuit); }
.soufflet-bo__grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
@media (max-width: 700px) { .soufflet-bo__grille { grid-template-columns: minmax(0, 1fr); } }
.soufflet-bo dl { grid-template-columns: minmax(120px, 45%) 1fr; font-size: .92rem; }
