:root {
    --bleu: #16306b;
    --bleu-2: #2456b8;
    --bleu-clair: #3f7be0;
    --accent: #4f46e5;
    --vert: #15824a;
    --vert-bg: #e7f7ee;
    --rouge: #c0392b;
    --rouge-bg: #fdecec;
    --orange: #b9740a;
    --orange-bg: #fff5e3;
    --bg: #eef1f8;
    --carte-bg: #ffffff;
    --bord: #e1e6f0;
    --texte: #1b2330;
    --gris: #6b7488;
    --ombre: 0 10px 30px rgba(20, 40, 90, .08);
    --ombre-sm: 0 2px 8px rgba(20, 40, 90, .06);
    --radius: 14px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

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

a { color: var(--bleu-2); }

/* ---------- Bandeau mode test ---------- */
.bandeau-test {
    background: repeating-linear-gradient(45deg, #d98213, #d98213 12px, #c8770f 12px, #c8770f 24px);
    color: #fff;
    text-align: center;
    padding: 7px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .03em;
}

/* ---------- En-tête ---------- */
.entete {
    background: linear-gradient(100deg, var(--bleu) 0%, var(--bleu-2) 100%);
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 26px;
    box-shadow: var(--ombre-sm);
}
.entete .marque { font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 10px; }
.entete .marque .logo {
    width: 30px; height: 30px; border-radius: 8px;
    background: rgba(255,255,255,.16);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 16px;
}
.entete .marque span { font-weight: 400; opacity: .82; }
.entete nav { display: flex; flex-wrap: wrap; gap: 6px; }
.entete nav a {
    color: #fff; text-decoration: none;
    padding: 7px 13px; border-radius: 8px; font-size: 14.5px;
    transition: background .15s ease;
}
.entete nav a:hover { background: rgba(255,255,255,.14); }
.entete nav .lien-deco { opacity: .85; }

/* ---------- Mise en page ---------- */
.contenu { max-width: 900px; margin: 30px auto; padding: 0 20px; animation: apparait .35s ease; }
.contenu-paiement { max-width: 640px; }
@keyframes apparait { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

h1 { font-size: 25px; margin: 0 0 8px; color: var(--bleu); letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 30px 0 12px; color: var(--bleu); }
.sous-titre { color: var(--gris); margin: 0 0 22px; max-width: 60ch; }

/* ---------- Cartes ---------- */
.carte {
    background: var(--carte-bg);
    border: 1px solid var(--bord);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--ombre);
}
.carte-paiement { margin-top: 18px; }

/* ---------- Connexion ---------- */
.login-page {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 100% -10%, rgba(63,123,224,.25), transparent 60%),
        radial-gradient(900px 500px at -10% 110%, rgba(79,70,229,.22), transparent 55%),
        linear-gradient(160deg, #11244e, #1c3c82);
}
.carte-login {
    width: 100%; max-width: 380px;
    background: rgba(255,255,255,.98);
    backdrop-filter: blur(6px);
}
.carte-login .logo-rond {
    width: 54px; height: 54px; border-radius: 14px; margin: 0 auto 14px;
    background: linear-gradient(135deg, var(--bleu-2), var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-size: 24px; box-shadow: 0 6px 16px rgba(36,86,184,.35);
}
.carte-login h1 { text-align: center; font-size: 21px; }
.carte-login .sous-titre { text-align: center; }

/* ---------- Étapes ---------- */
.stepper {
    display: flex; align-items: center; gap: 8px;
    margin: 0 0 26px; padding: 0; list-style: none;
}
.stepper > li { display: flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.stepper > li.trait-li { flex: 1 1 auto; min-width: 14px; }
.stepper .step-num {
    width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700;
    background: #fff; color: var(--gris); border: 2px solid var(--bord);
    transition: all .2s ease;
}
.stepper .step-label { font-size: 13.5px; color: var(--gris); white-space: nowrap; }
.stepper .trait { flex: 1; height: 2px; background: var(--bord); border-radius: 2px; min-width: 12px; }
.stepper li.is-active .step-num { background: var(--bleu-2); color: #fff; border-color: var(--bleu-2); box-shadow: 0 0 0 4px rgba(36,86,184,.15); }
.stepper li.is-active .step-label { color: var(--bleu); font-weight: 600; }
.stepper li.is-done .step-num { background: var(--vert); color: #fff; border-color: var(--vert); }
.stepper li.is-done .step-label { color: var(--texte); }

/* ---------- Formulaires ---------- */
.formulaire label, .carte-login label {
    display: block; margin-bottom: 17px; font-weight: 600; font-size: 14px;
}
input[type=text], input[type=password], input[type=email], select {
    width: 100%; margin-top: 7px; padding: 11px 13px;
    border: 1px solid var(--bord); border-radius: 10px;
    font-size: 15px; font-weight: 400; font-family: inherit; color: var(--texte);
    background: #fff; transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: #aab1c2; }
input:focus, select:focus {
    outline: none; border-color: var(--bleu-clair);
    box-shadow: 0 0 0 3px rgba(63,123,224,.18);
}
.form-hint { display: block; margin-top: 6px; font-weight: 400; font-size: 12.5px; color: var(--gris); }

/* case à cocher 3DS */
.check {
    display: flex; align-items: flex-start; gap: 10px;
    padding: 13px 15px; border: 1px solid var(--bord); border-radius: 10px;
    background: #fafbfe; margin-bottom: 17px; cursor: pointer; font-weight: 500; font-size: 14px;
}
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--bleu-2); }
.check .check-txt small { display: block; color: var(--gris); font-weight: 400; font-size: 12.5px; }

/* ---------- Boutons ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 12px 20px; border: 1px solid var(--bord); border-radius: 10px;
    background: #fff; color: var(--bleu); font-size: 15px; font-weight: 600;
    text-decoration: none; cursor: pointer; font-family: inherit;
    transition: transform .08s ease, box-shadow .15s ease, background .15s ease;
}
.btn:hover { box-shadow: var(--ombre-sm); }
.btn:active { transform: translateY(1px); }
.btn-principal {
    background: linear-gradient(100deg, var(--bleu-2), var(--accent));
    color: #fff; border: none; box-shadow: 0 6px 16px rgba(36,86,184,.28);
    width: 100%;
}
.btn-principal:hover { box-shadow: 0 10px 22px rgba(36,86,184,.36); }
.btn-gros { padding: 16px 24px; font-size: 16px; }
.cartes-actions { display: flex; gap: 12px; flex-wrap: wrap; margin: 20px 0; }
.cartes-actions .btn { width: auto; }

/* ---------- Barre de filtres (tableau de bord) ---------- */
.filtres { display: flex; flex-direction: column; gap: 10px; margin: 0 0 18px; }
.filtres-ligne { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filtres input[type=search], .filtres select { width: auto; margin-top: 0; flex: 1 1 180px; min-width: 150px; }
.filtres .btn { width: auto; }
.filtre-date { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; font-size: 13.5px; color: var(--gris); }
.filtre-date input[type=date] {
    width: auto; margin-top: 0; padding: 9px 11px;
    border: 1px solid var(--bord); border-radius: 10px;
    font-size: 14px; font-family: inherit; color: var(--texte); background: #fff;
}
.filtre-date input[type=date]:focus { outline: none; border-color: var(--bleu-clair); box-shadow: 0 0 0 3px rgba(63,123,224,.18); }

/* ---------- Blocs de clés (Paramètres) ---------- */
.bloc-cles {
    border: 1px solid var(--bord); border-radius: 10px;
    padding: 14px 16px 2px; margin: 0 0 17px; background: #fafbfe;
}
.bloc-cles legend { padding: 0 8px; font-size: 13px; font-weight: 700; color: var(--bleu); }
.bloc-cles code { font-size: 12px; }

/* boutons secondaires / lignes d'actions */
.btn-danger { color: var(--rouge); border-color: #f3c3bd; width: auto; }
.btn-danger:hover { background: var(--rouge-bg); }
.form-inline { display: inline; }
.actions-cellule { display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.actions-cellule .btn { width: auto; padding: 7px 13px; font-size: 13.5px; }

/* ---------- Alertes ---------- */
.alerte.ok { background: var(--vert-bg); color: #0f6b3c; border-color: #bfe6cf; }
.alerte { padding: 13px 16px; border-radius: 10px; margin: 0 0 20px; font-size: 14px; border: 1px solid transparent; }
.alerte.ko { background: var(--rouge-bg); color: #97251a; border-color: #f3c3bd; }
.alerte.warn { background: var(--orange-bg); color: #8a5705; border-color: #f3dcb0; }
.alerte ul { margin: 8px 0 0 18px; }

/* ---------- Tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; border-radius: 12px; overflow: hidden; box-shadow: var(--ombre-sm); }
.tableau th, .tableau td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--bord); }
.tableau thead th { background: #f3f6fc; color: var(--bleu); font-size: 12.5px; text-transform: uppercase; letter-spacing: .03em; }
.tableau tbody tr:last-child td { border-bottom: none; }
.tableau tbody tr:hover { background: #f8faff; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--gris); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Pastilles ---------- */
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.pastille::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pastille.ok { background: var(--vert-bg); color: var(--vert); }
.pastille.ko { background: var(--rouge-bg); color: var(--rouge); }
.pastille.warn { background: var(--orange-bg); color: var(--orange); }

.vide { color: var(--gris); font-style: italic; }

/* ---------- Résultat ---------- */
.resultat { text-align: center; }
.resultat .icone {
    width: 72px; height: 72px; border-radius: 50%; margin: 4px auto 14px;
    display: flex; align-items: center; justify-content: center; font-size: 38px; color: #fff;
    animation: pop .35s ease;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.resultat-ok .icone { background: var(--vert); box-shadow: 0 8px 20px rgba(21,130,74,.35); }
.resultat-ko .icone { background: var(--rouge); box-shadow: 0 8px 20px rgba(192,57,43,.32); }
.resultat-warn .icone { background: var(--orange); box-shadow: 0 8px 20px rgba(185,116,10,.32); }
.resultat h2.titre-res { margin: 0 0 6px; font-size: 22px; }
.resultat .tableau { text-align: left; margin-top: 18px; }
.resultat .tableau th { width: 42%; background: #fff; text-transform: none; letter-spacing: normal; font-size: 13.5px; color: var(--gris); }

.recap { color: var(--gris); margin-bottom: 18px; }
.recap strong { color: var(--texte); }
.aide-paiement { color: var(--gris); font-size: 14px; margin-top: 16px; }
.lien-retour { font-size: 14px; display: inline-block; margin-top: 8px; }

/* ---------- Zone formulaire embarqué ---------- */
.zone-carte { min-height: 90px; }
.chargement-carte { display: flex; align-items: center; gap: 12px; color: var(--gris); font-size: 14px; padding: 18px 0; }

/* ---------- Pied ---------- */
.pied { text-align: center; color: var(--gris); font-size: 12px; padding: 34px 16px; }
code { background: #eef2fb; padding: 2px 6px; border-radius: 5px; font-size: 13px; }

/* ---------- Spinner + overlay ---------- */
.spinner {
    width: 22px; height: 22px; border-radius: 50%;
    border: 3px solid rgba(36,86,184,.25); border-top-color: var(--bleu-2);
    animation: tourne .7s linear infinite; flex: 0 0 auto;
}
.spinner.blanc { border-color: rgba(255,255,255,.4); border-top-color: #fff; }
@keyframes tourne { to { transform: rotate(360deg); } }

.overlay {
    position: fixed; inset: 0; z-index: 9999;
    background: rgba(17, 28, 56, .55); backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center;
}
.overlay.actif { display: flex; animation: apparait .2s ease; }
.overlay-box {
    background: #fff; border-radius: 16px; padding: 26px 30px;
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    box-shadow: var(--ombre); max-width: 300px; text-align: center;
}
.overlay-box .spinner { width: 34px; height: 34px; }
.overlay-box p { margin: 0; font-weight: 600; color: var(--bleu); }
.overlay-box small { color: var(--gris); font-weight: 400; }

/* boutons en cours de chargement */
.btn.is-loading { pointer-events: none; opacity: .85; }

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
    .entete { padding: 12px 16px; }
    .contenu { margin: 20px auto; }
    .carte { padding: 20px; }
    .stepper .step-label { display: none; }
    .stepper li { flex: 0 0 auto; }
    .stepper .trait { min-width: 18px; }
}
