/* =====================================================================
   Tesla Express — Design system
   Identité : rouge (#d92121) + noir (#141414), fidèle au logo officiel.
   ===================================================================== */

:root {
    /* Marque */
    --rouge: #d92121;
    --rouge-fonce: #b31515;
    --rouge-pale: #fdecec;
    --noir: #141414;
    --noir-2: #1f1f23;

    /* Neutres */
    --bg: #f6f7f9;
    --surface: #ffffff;
    --texte: #1c1c21;
    --texte-2: #5c616b;
    --texte-3: #8b909a;
    --bordure: #e6e8ec;

    /* Sémantique */
    --vert: #16803c;      --vert-pale: #e8f7ee;
    --bleu: #1d5fd6;      --bleu-pale: #e9f0fd;
    --indigo: #5b45d6;    --indigo-pale: #efecfc;
    --ambre: #96660a;     --ambre-pale: #fdf3dd;
    --orange: #c2500b;    --orange-pale: #feeee2;
    --gris: #55595f;      --gris-pale: #eef0f2;

    /* Rythme */
    --radius: 14px;
    --radius-sm: 9px;
    --ombre: 0 1px 2px rgba(20, 20, 20, .04), 0 8px 24px rgba(20, 20, 20, .06);
    --ombre-forte: 0 12px 40px rgba(20, 20, 20, .14);
    --transition: .18s ease;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--texte);
    font-size: 15.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; color: var(--noir); margin: 0 0 .5em; }
h1 { font-size: 30px; letter-spacing: -.02em; }
h2 { font-size: 23px; letter-spacing: -.01em; }
h3 { font-size: 17px; }
p  { margin: 0 0 1em; }
a  { color: var(--rouge); }
img { max-width: 100%; }

/* ------------------------------------------------------------ Layout */

.container {
    width: min(1120px, 92%);
    margin: 0 auto;
    padding: 34px 0 60px;
    min-height: calc(100vh - 320px);
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 22px;
}
.page-head h1 { margin: 0; font-size: 26px; }
.page-head .sous-titre { color: var(--texte-2); margin: 4px 0 0; }

/* ------------------------------------------------------------ Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    border-bottom: 1px solid var(--bordure);
    box-shadow: 0 1px 10px rgba(20, 20, 20, .05);
}

.topbar-inner {
    width: min(1120px, 92%);
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    height: 68px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.brand img {
    height: 52px;
    width: auto;
    mix-blend-mode: multiply; /* efface le fond blanc du JPEG sur fond clair */
}
.brand-nom {
    font-weight: 800;
    font-size: 18px;
    letter-spacing: .02em;
    color: var(--noir);
}
.brand-nom span { color: var(--rouge); }

.nav-principal {
    display: flex;
    align-items: center;
    gap: 4px;
}
.nav-principal a {
    text-decoration: none;
    color: var(--texte-2);
    font-weight: 600;
    font-size: 14.5px;
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-principal a:hover { color: var(--noir); background: var(--gris-pale); }
.nav-principal a.actif { color: var(--rouge); background: var(--rouge-pale); }
.nav-principal .nav-sep { width: 1px; height: 22px; background: var(--bordure); margin: 0 8px; }

.burger {
    display: none;
    background: none;
    border: 1px solid var(--bordure);
    border-radius: var(--radius-sm);
    padding: 8px 11px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    color: var(--noir);
}

/* ----------------------------------------------------------- Boutons */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--rouge);
    color: #fff !important;
    font-weight: 700;
    font-size: 14.5px;
    padding: 11px 20px;
    border: none;
    border-radius: var(--radius-sm);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(217, 33, 33, .25);
}
.btn:hover { background: var(--rouge-fonce); transform: translateY(-1px); }
.btn:active { transform: none; }

.btn-secondary {
    background: var(--noir);
    box-shadow: 0 2px 8px rgba(20, 20, 20, .2);
}
.btn-secondary:hover { background: var(--noir-2); }

.btn-outline {
    background: transparent;
    color: var(--noir) !important;
    border: 1.5px solid var(--bordure);
    box-shadow: none;
}
.btn-outline:hover { background: var(--gris-pale); border-color: #d4d7dc; }

.btn-ghost {
    background: transparent;
    color: var(--rouge) !important;
    box-shadow: none;
}
.btn-ghost:hover { background: var(--rouge-pale); }

.btn-small { padding: 7px 13px; font-size: 13.5px; }
.btn-large { padding: 14px 28px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

/* -------------------------------------------------------------- Hero */

.hero {
    background:
        radial-gradient(900px 420px at 85% -10%, rgba(217, 33, 33, .28), transparent 60%),
        radial-gradient(600px 300px at 0% 110%, rgba(217, 33, 33, .16), transparent 55%),
        linear-gradient(160deg, #17171b 0%, #101013 100%);
    color: #fff;
    border-radius: 22px;
    padding: clamp(38px, 6vw, 70px) clamp(24px, 5vw, 64px);
    display: grid;
    grid-template-columns: 1.2fr .8fr;
    gap: 40px;
    align-items: center;
    overflow: hidden;
}
.hero h1 {
    color: #fff;
    font-size: clamp(30px, 4.5vw, 46px);
    margin-bottom: 14px;
}
.hero h1 em { color: #ff5a5a; font-style: normal; }
.hero p { color: #c9cbd1; font-size: 17px; max-width: 46ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero-visuel {
    background: #fff;
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--ombre-forte);
    justify-self: end;
    max-width: 320px;
}
.hero-badges { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.hero-badges span {
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .14);
    color: #e6e7ea;
    font-size: 13px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
}

/* ------------------------------------------------------------- Cartes */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 18px;
    margin-top: 26px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--ombre);
}
.card h3 { margin-bottom: 8px; }
.card p { color: var(--texte-2); margin: 0; font-size: 14.5px; }

.card-icone {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--rouge-pale);
    color: var(--rouge);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    margin-bottom: 14px;
}

a.link-card {
    text-decoration: none;
    transition: var(--transition);
    display: block;
}
a.link-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--ombre-forte);
    border-color: #f3c1c1;
}

/* ------------------------------------------------------------- Stats */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 18px;
    margin: 22px 0;
}
.stat {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 20px 22px;
    box-shadow: var(--ombre);
    display: flex;
    align-items: center;
    gap: 16px;
}
.stat-icone {
    width: 46px; height: 46px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 21px;
    flex-shrink: 0;
}
.stat-valeur { font-size: 27px; font-weight: 800; color: var(--noir); line-height: 1.1; }
.stat-libelle { color: var(--texte-2); font-size: 13.5px; font-weight: 600; }

/* --------------------------------------------------------- Formulaires */

.form {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--ombre);
    max-width: 860px;
}
.form-etroit { max-width: 460px; margin: 0 auto; }

.form-section {
    border: none;
    padding: 0;
    margin: 0 0 26px;
}
.form-section legend,
.form-section-titre {
    font-weight: 800;
    font-size: 15px;
    color: var(--noir);
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 4px;
    padding: 0;
}
.form-section-titre .num {
    background: var(--rouge);
    color: #fff;
    width: 24px; height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12.5px;
}
.form-section .hint { color: var(--texte-3); font-size: 13px; margin: 0 0 14px; }

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 18px;
}
.form-grid .plein { grid-column: 1 / -1; }

label {
    display: block;
    margin-top: 14px;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13.5px;
    color: var(--texte);
}
label .req { color: var(--rouge); }

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], textarea, select {
    width: 100%;
    padding: 11px 13px;
    font-size: 14.5px;
    font-family: inherit;
    color: var(--texte);
    background: #fbfbfc;
    border: 1.5px solid var(--bordure);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--rouge);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(217, 33, 33, .12);
}
textarea { min-height: 88px; resize: vertical; }

.checkline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}
.checkline input { width: 18px; height: 18px; accent-color: var(--rouge); }

.form-actions { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 12px; }

/* ------------------------------------------------------------ Tables */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    box-shadow: var(--ombre);
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14.5px;
    min-width: 640px;
}
.table th {
    text-align: left;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--texte-3);
    font-weight: 700;
    padding: 14px 18px;
    border-bottom: 1px solid var(--bordure);
    background: #fafbfc;
    white-space: nowrap;
}
.table td {
    padding: 14px 18px;
    border-bottom: 1px solid #f0f1f4;
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table .actions { white-space: nowrap; }
.table .actions a { font-weight: 600; font-size: 13.5px; text-decoration: none; }

.code-suivi {
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--noir);
}

.table-vide {
    text-align: center;
    color: var(--texte-2);
    padding: 46px 20px !important;
}

/* ------------------------------------------------------------- Badges */

.badge {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 700;
    white-space: nowrap;
}
.st-gray   { background: var(--gris-pale);   color: var(--gris); }
.st-blue   { background: var(--bleu-pale);   color: var(--bleu); }
.st-indigo { background: var(--indigo-pale); color: var(--indigo); }
.st-amber  { background: var(--ambre-pale);  color: var(--ambre); }
.st-green  { background: var(--vert-pale);   color: var(--vert); }
.st-red    { background: var(--rouge-pale);  color: var(--rouge-fonce); }
.st-orange { background: var(--orange-pale); color: var(--orange); }

/* ------------------------------------------------------------- Alertes */

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 14.5px;
    border: 1px solid transparent;
}
.alert-success { background: var(--vert-pale);  color: var(--vert);   border-color: #bfe8cd; }
.alert-error   { background: var(--rouge-pale); color: var(--rouge-fonce); border-color: #f5c6c6; }
.alert-info    { background: var(--bleu-pale);  color: var(--bleu);   border-color: #c4d7f7; }
.alert-warning { background: var(--ambre-pale); color: var(--ambre);  border-color: #efdcae; }

/* ----------------------------------------------------------- Timeline */

.timeline {
    list-style: none;
    margin: 0;
    padding: 6px 0 0 6px;
}
.timeline li {
    position: relative;
    padding: 0 0 26px 30px;
    border-left: 2px solid var(--bordure);
}
.timeline li:last-child { border-left-color: transparent; padding-bottom: 4px; }
.timeline li::before {
    content: "";
    position: absolute;
    left: -8px;
    top: 1px;
    width: 14px; height: 14px;
    border-radius: 999px;
    background: var(--surface);
    border: 3px solid var(--texte-3);
}
.timeline li.courant::before { border-color: var(--rouge); background: var(--rouge-pale); }
.timeline li.livre::before   { border-color: var(--vert); background: var(--vert-pale); }
.timeline .tl-titre { font-weight: 700; color: var(--noir); }
.timeline .tl-desc  { color: var(--texte-2); font-size: 14px; margin: 2px 0; }
.timeline .tl-date  { color: var(--texte-3); font-size: 12.5px; }

/* ------------------------------------------------- Détails (dl grille) */

.detail-grille {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 2px 26px;
    margin: 0;
}
.detail-grille div { padding: 9px 0; border-bottom: 1px dashed #eceef1; }
.detail-grille dt {
    font-size: 12.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--texte-3);
}
.detail-grille dd { margin: 2px 0 0; font-weight: 600; color: var(--texte); }

.deux-colonnes {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 22px;
    align-items: start;
}

/* -------------------------------------------------------- Étapes (accueil) */

.etapes {
    counter-reset: etape;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-top: 26px;
}
.etape {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--ombre);
    position: relative;
}
.etape::before {
    counter-increment: etape;
    content: counter(etape, decimal-leading-zero);
    font-size: 30px;
    font-weight: 800;
    color: var(--rouge-pale);
    -webkit-text-stroke: 1.5px var(--rouge);
    display: block;
    margin-bottom: 10px;
}

.section-titre { margin-top: 54px; }
.section-titre h2 { margin-bottom: 4px; }
.section-titre p { color: var(--texte-2); margin: 0; }

/* -------------------------------------------------------------- Footer */

.footer {
    background: var(--noir);
    color: #b9bcc2;
    margin-top: 40px;
}
.footer-inner {
    width: min(1120px, 92%);
    margin: 0 auto;
    padding: 40px 0 26px;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 30px;
}
.footer h4 { color: #fff; font-size: 14.5px; margin-bottom: 12px; }
.footer a { color: #b9bcc2; text-decoration: none; display: block; padding: 3px 0; font-size: 14px; }
.footer a:hover { color: #fff; }
.footer p { font-size: 14px; }
.footer-bas {
    border-top: 1px solid rgba(255, 255, 255, .1);
    text-align: center;
    padding: 16px;
    font-size: 13px;
    color: #8b8f97;
}
.footer .brand-nom { color: #fff; font-size: 17px; }

/* ------------------------------------------------------------ Divers */

.filtres {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
    align-items: center;
}
.filtres input[type="text"], .filtres select { width: auto; min-width: 200px; }

.pagination { display: flex; gap: 6px; margin-top: 18px; justify-content: center; }
.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--bordure);
    background: var(--surface);
    text-decoration: none;
    color: var(--texte);
    font-weight: 600;
    font-size: 14px;
}
.pagination .courante { background: var(--rouge); color: #fff; border-color: var(--rouge); }
.pagination a:hover { border-color: var(--rouge); color: var(--rouge); }

.muted { color: var(--texte-3); }
.mt-0 { margin-top: 0; }

.success-box {
    background: var(--surface);
    border: 1px solid #bfe8cd;
    border-top: 4px solid var(--vert);
    border-radius: var(--radius);
    box-shadow: var(--ombre);
    padding: 34px;
    text-align: center;
    max-width: 560px;
    margin: 30px auto;
}
.success-box .gros-code {
    font-family: Consolas, monospace;
    font-size: 22px;
    font-weight: 800;
    background: var(--gris-pale);
    border-radius: var(--radius-sm);
    padding: 10px 18px;
    display: inline-block;
    margin: 12px 0 18px;
}

/* ------------------------------------------------------ Back-office */

.topbar-admin { background: var(--noir); border-bottom-color: #2c2c30; }
.topbar-admin .brand img { background: #fff; border-radius: 8px; padding: 2px; mix-blend-mode: normal; height: 44px; }
.topbar-admin .brand-nom { color: #fff; }
.topbar-admin .brand-nom span { color: #ff5a5a; }
.topbar-admin .nav-principal a { color: #b9bcc2; }
.topbar-admin .nav-principal a:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.topbar-admin .nav-principal a.actif { color: #ff5a5a; background: rgba(217, 33, 33, .16); }
.topbar-admin .nav-principal .nav-sep { background: #35353a; }
.topbar-admin .burger { color: #fff; border-color: #3a3a3e; }

.badge-compteur {
    background: var(--rouge);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 999px;
    padding: 2px 7px;
    margin-left: 5px;
    vertical-align: middle;
}

.form-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.form-inline input, .form-inline select { width: auto; padding: 8px 10px; font-size: 13.5px; }

details.message-detail summary { cursor: pointer; font-weight: 600; color: var(--rouge); font-size: 13.5px; }
details.message-detail p {
    background: var(--gris-pale);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin: 8px 0 0;
    white-space: pre-wrap;
}

/* --------------------------------------------------------- Responsive */

@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; }
    .hero-visuel { display: none; }
    .deux-colonnes { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 760px) {
    .burger { display: block; }
    .nav-principal {
        display: none;
        position: absolute;
        top: 68px;
        left: 0; right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--bordure);
        box-shadow: var(--ombre-forte);
        flex-direction: column;
        align-items: stretch;
        padding: 12px 5%;
        gap: 2px;
    }
    .nav-principal.ouvert { display: flex; }
    .topbar-admin .nav-principal { background: var(--noir); }
    .nav-principal a { padding: 12px 14px; }
    .nav-principal .nav-sep { display: none; }

    .form-grid { grid-template-columns: 1fr; }
    .page-head { flex-direction: column; align-items: flex-start; }
    .container { padding-top: 22px; }
    h1 { font-size: 24px; }
}
