@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap");

:root {
    color-scheme: dark;
    --accent: #9fd3ae;
    --accent-texte: #0f2419;
    --accent-clair: #1f3d2d;
    --texte: #e8efe9;
    --gris: #8fa596;
    --ligne: #24412f;
    --ligne-forte: #2f5440;
    --fond: #0f2419;
    --surface: #143022;
    --survol: #183827;
    --erreur: #f2a39a;
    --rayon: 8px;
}

* { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--texte);
    font: 15px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--texte); text-underline-offset: 3px; }

/* Mise en page */

.page { max-width: 640px; margin: 64px auto; padding: 0 16px; }
.page.large { max-width: 1200px; }

header.titre { margin-bottom: 40px; }
header.titre h1 { margin: 0; font-size: 1.6rem; font-weight: 600; letter-spacing: -.02em; }
header.titre p { margin: 4px 0 0; color: var(--gris); }

.bloc { padding: 28px 0; margin: 0; border-top: 1px solid var(--ligne); }
.bloc h2 {
    margin: 0 0 16px;
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--gris);
}

/* Formulaires */

label { display: block; margin: 14px 0 6px; font-size: .85rem; font-weight: 500; }
label .req { color: var(--gris); }

input[type=text], input[type=email], input[type=tel], input[type=date],
input[type=number], input[type=password], select, textarea {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    font: inherit;
    color: var(--texte);
    background: var(--surface);
    border: 1px solid var(--ligne-forte);
    border-radius: var(--rayon);
    transition: border-color .15s;
}
textarea { height: auto; padding: 10px 12px; }
input::placeholder { color: #5f7a68; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }

select {
    appearance: none;
    padding-right: 36px;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none' stroke='%238fa596' stroke-width='1.5'%3E%3Cpath d='M1 1l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center;
}

input[type=range], input[type=checkbox] { accent-color: var(--accent); }
input[type=range] { height: auto; padding: 0; border: none; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; }

.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 600px) { .grille { grid-template-columns: 1fr; } }

.choix { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.choix label {
    margin: 0;
    padding: 14px 10px;
    text-align: center;
    font-weight: 400;
    border: 1px solid var(--ligne-forte);
    border-radius: var(--rayon);
    cursor: pointer;
    transition: border-color .15s;
}
.choix label:hover { border-color: var(--gris); }
.choix input { display: none; }
.choix label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choix .prix { display: block; margin-top: 2px; font-weight: 600; }

.case { display: flex; align-items: center; gap: 10px; margin-top: 16px; }
.case input { width: auto; }
.case label { font-weight: 400; }

/* Boutons */

button, .bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    padding: 0 18px;
    font: inherit;
    font-weight: 500;
    color: var(--accent-texte);
    background: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--rayon);
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
}
button:hover, .bouton:hover { opacity: .88; }
button.secondaire, .bouton.secondaire { background: transparent; color: var(--texte); border-color: var(--ligne-forte); }
button.petit { height: 30px; padding: 0 10px; font-size: .8rem; }
button.danger { background: transparent; color: var(--erreur); border-color: var(--ligne-forte); }
button:disabled { opacity: .4; cursor: not-allowed; }
form > button[type=submit] { margin-top: 8px; }

/* Récapitulatif prix */

#code-aide { min-height: 1.2em; margin-bottom: 12px; }
.ligne-detail { display: flex; justify-content: space-between; color: var(--gris); font-size: .88rem; }
.total {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--ligne);
}
.total strong { font-size: 1.3rem; font-weight: 600; }

/* Messages */

.alerte, .ok { padding: 12px 14px; margin-bottom: 24px; border-radius: var(--rayon); font-size: .9rem; }
.alerte { background: #2a1a17; border: 1px solid #5a2e28; color: var(--erreur); }
.alerte ul { margin: 0; padding-left: 18px; }
.ok { border: 1px solid var(--ligne-forte); }
.aide { margin-top: 6px; color: var(--gris); font-size: .8rem; }
.aide.erreur { color: var(--erreur); }
.aide.valide { color: var(--accent); }

/* Autocomplétion */

.auto { position: relative; }
.auto ul {
    position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 4px);
    margin: 0; padding: 4px; list-style: none;
    background: var(--surface); border: 1px solid var(--ligne-forte); border-radius: var(--rayon);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}
.auto li { padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: .9rem; }
.auto li:hover, .auto li.actif { background: var(--accent-clair); }

/* Reçu */

.recu dl { display: grid; grid-template-columns: 160px 1fr; margin: 0; }
.recu dt, .recu dd { padding: 8px 0; border-bottom: 1px solid var(--ligne); }
.recu dt { color: var(--gris); font-size: .88rem; }
.recu dd { margin: 0; }
@media (max-width: 520px) {
    .recu dl { grid-template-columns: 1fr; }
    .recu dt { border-bottom: none; padding-bottom: 0; }
}

/* Vente terminée */

.fin { text-align: center; padding: 48px 0; }
.fin h2 { font-size: 1.3rem; text-transform: none; letter-spacing: -.01em; color: var(--texte); }
.fin p { color: var(--gris); margin: 6px 0; }
.fin a { color: var(--texte); }

/* Administration */

nav.onglets { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 28px; border-bottom: 1px solid var(--ligne); }
nav.onglets a {
    padding: 10px 0;
    margin-bottom: -1px;
    font-size: .9rem;
    color: var(--gris);
    text-decoration: none;
    border-bottom: 2px solid transparent;
}
nav.onglets a:hover { color: var(--texte); }
nav.onglets a.actif { color: var(--texte); font-weight: 500; border-bottom-color: var(--accent); }

.barre-admin { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.outils { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.outils label { margin: 0; }
.outils select { width: auto; min-width: 220px; }

.tableau-wrap { overflow-x: auto; border: 1px solid var(--ligne); border-radius: var(--rayon); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { padding: 10px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--ligne); }
th { background: var(--surface); color: var(--gris); font-size: .75rem; font-weight: 500; }
tbody tr:hover { background: var(--survol); }
tr:last-child td { border-bottom: none; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.kpi { padding: 16px; background: var(--surface); border: 1px solid var(--ligne); border-radius: var(--rayon); }
.kpi span { display: block; color: var(--gris); font-size: .8rem; }
.kpi strong { display: block; margin-top: 4px; font-size: 1.4rem; font-weight: 600; }

.graphes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 0 32px; }
.barres .ligne { display: grid; grid-template-columns: 120px 1fr 32px; gap: 10px; align-items: center; margin: 8px 0; font-size: .85rem; }
.barres .piste { height: 6px; background: var(--ligne); border-radius: 99px; overflow: hidden; }
.barres .rempli { height: 100%; background: var(--accent); border-radius: 99px; }
.barres .val { text-align: right; color: var(--gris); }

#carte { height: 420px; margin-top: 12px; border: 1px solid var(--ligne); border-radius: var(--rayon); }

.jauge { height: 6px; margin-top: 10px; background: var(--ligne); border-radius: 99px; overflow: hidden; }
.jauge div { height: 100%; background: var(--accent); }

.liste-config .rang { display: grid; grid-template-columns: 1fr 140px 42px; gap: 8px; margin-bottom: 8px; }
.liste-config .rang.simple { grid-template-columns: 1fr 42px; }
.liste-config .rang button.petit { height: 42px; }

/* Pied de page */

footer.pied { margin: 48px 0 24px; text-align: center; font-size: .8rem; }
footer.pied a { color: var(--gris); text-decoration: none; }

/* Impression */

@media print {
    :root { color-scheme: light; --texte: #1f1f1f; --gris: #666; --ligne: #ddd; --fond: #fff; --accent: #2f4f3e; }
    body { background: #fff; }
    .no-print, footer.pied { display: none !important; }
    .page { margin: 0; max-width: none; }
}

@media (max-width: 600px) {
    .page { margin: 32px auto; }
    .outils select { min-width: 0; width: 100%; }
}

/* Carte : contrôles Leaflet lisibles sur fond sombre */
.leaflet-container a { color: #1f1f1f; }
#carte { border-color: var(--ligne-forte); }
/* Page contact */
.contact dl {
    display: grid;
    grid-template-columns: 120px 1fr;
    margin: 0;
}

.contact dt, .contact dd {
    padding: 12px 0;
    border-bottom: 1px solid var(--ligne);
}

.contact dt {
    color: var(--gris);
    font-size: .88rem;
}

.contact dd {
    margin: 0;
    font-size: 1.05rem;
}

.contact dd a {
    color: var(--accent);
    text-decoration: none;
}

.contact dd a:hover {
    text-decoration: underline;
}

.contact h2 {
    text-transform: none;
    letter-spacing: 0;
    font-size: 1rem;
    color: var(--texte);
}

/* Code de réduction discret */
.code-reduc {
    margin: 14px 0 12px;
}

.code-reduc summary {
    display: inline-block;
    font-size: .8rem;
    color: var(--gris);
    cursor: pointer;
    list-style: none;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.code-reduc summary::-webkit-details-marker {
    display: none;
}

.code-reduc summary:hover {
    color: var(--texte);
}

.code-reduc[open] summary {
    margin-bottom: 8px;
}

.code-reduc input {
    max-width: 240px;
    height: 36px;
    font-size: .9rem;
}

.code-reduc #code-aide {
    min-height: 0;
    margin-bottom: 0;
}

.ligne-detail[hidden] {
    display: none;
}
