/* Socle visuel commun aux modules OrthoSuite (calculateurs, CISS…).
   Chaque page définit ses couleurs d'accent : --accent, --accent-fonce, --accent-doux,
   --accent-pale et --accent-rgb (composantes R, G, B de --accent). */
:root {
    --encre: #1F2333;
    --encre-douce: #3B4152;
    --attenue: #5E6578;
    --trait: #E3E7EE;
    --fond: #F4F6FA;
    --carte: #FFFFFF;
    --champ: #FAFBFC;
    --ok: #15803D; --ok-doux: #DCFCE7;
    --attention: #B45309; --attention-doux: #FEF3C7;
    --alerte: #B91C1C; --alerte-doux: #FEE2E2;
    --info: #1D4ED8; --info-doux: #DBEAFE;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    font-family: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    color: var(--encre);
    background:
        radial-gradient(1000px 520px at 90% -10%, rgba(var(--accent-rgb), .12), transparent 62%),
        radial-gradient(900px 480px at -12% 110%, rgba(0, 180, 255, .08), transparent 60%),
        var(--fond);
    background-attachment: fixed;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
[hidden] { display: none !important; }
.conteneur { width: 100%; max-width: 1120px; margin: 0 auto; padding-left: 24px; padding-right: 24px; }

/* Barre du haut */
.barre { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 20px; padding-bottom: 20px; }
.retour {
    display: inline-flex; align-items: center; gap: 8px;
    color: var(--encre-douce); font-weight: 500; text-decoration: none;
    padding: 6px 12px 6px 8px; margin-left: -8px; border-radius: 10px;
    transition: background .15s ease, color .15s ease;
}
.retour:hover { background: rgba(255, 255, 255, .8); color: var(--encre); }
.retour svg { width: 18px; height: 18px; }

/* Titres */
.surtitre {
    display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px;
    font-size: .8rem; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; color: var(--accent);
}
.surtitre span { background: var(--accent-doux); color: var(--accent-fonce); letter-spacing: .02em; padding: 2px 8px; border-radius: 6px; }
h1 { margin: 0; font-size: clamp(1.9rem, 3.6vw, 2.6rem); line-height: 1.1; font-weight: 600; letter-spacing: -.025em; }
.chapeau { margin: 14px 0 0; font-size: 1.06rem; line-height: 1.6; color: var(--attenue); max-width: 620px; }

/* Cartes */
.carte {
    background: var(--carte); border: 1px solid var(--trait); border-radius: 20px;
    padding: 26px; box-shadow: 0 1px 2px rgba(31, 35, 51, .04), 0 20px 40px -26px rgba(31, 35, 51, .18);
}
.carte > h2 { margin: 0; font-size: 1.2rem; font-weight: 600; letter-spacing: -.01em; }
.carte > .aide { margin: 6px 0 20px; font-size: .92rem; line-height: 1.5; color: var(--attenue); }

/* Champs */
.champ { margin-bottom: 18px; min-width: 0; }
.champ > label, .champ > legend, .etiquette { display: block; margin: 0 0 8px; padding: 0; font-size: .9rem; font-weight: 600; color: var(--encre-douce); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.saisie {
    width: 100%; font: inherit; font-size: 1rem; color: var(--encre);
    background: var(--champ); border: 1px solid var(--trait); border-radius: 12px;
    padding: 11px 14px; transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.saisie::placeholder { color: #9AA1B1; }
.saisie:hover { border-color: #CBD2DD; }
.saisie:focus { outline: none; background: #fff; border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .15); }
.saisie[aria-invalid="true"] { border-color: var(--alerte); box-shadow: 0 0 0 4px rgba(185, 28, 28, .1); }
select.saisie {
    appearance: none; -webkit-appearance: none; cursor: pointer; padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235E6578' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 12px center; background-size: 16px;
}
.avec-unite { position: relative; }
.avec-unite .saisie { padding-right: 48px; }
.unite { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: .9rem; color: var(--attenue); pointer-events: none; }

/* Choix exclusifs en pastilles (boutons radio) */
.pastilles { display: grid; gap: 8px; }
.pastille { position: relative; }
.pastille input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pastille span {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 54px; padding: 8px 10px; text-align: center; line-height: 1.2;
    background: var(--champ); border: 1px solid var(--trait); border-radius: 12px;
    font-weight: 600; color: var(--encre-douce);
    transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.pastille span small { font-size: .78rem; font-weight: 500; color: var(--attenue); margin-top: 3px; }
.pastille input:hover + span { border-color: #CBD2DD; }
.pastille input:checked + span { background: var(--accent-pale); border-color: var(--accent); color: var(--accent-fonce); box-shadow: inset 0 0 0 1px var(--accent); }
.pastille input:checked + span small { color: var(--accent-fonce); }
.pastille input:focus-visible + span { box-shadow: 0 0 0 4px rgba(var(--accent-rgb), .22); }

/* Commutateur segmenté (ex. Exo / Éso) */
.segmente { display: inline-flex; padding: 3px; gap: 2px; background: #EEF1F5; border-radius: 10px; }
.segmente label { position: relative; }
.segmente input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segmente span {
    display: block; padding: 6px 12px; border-radius: 8px; font-size: .88rem; font-weight: 600; color: var(--attenue);
    transition: background .15s ease, color .15s ease, box-shadow .15s ease; white-space: nowrap;
}
.segmente input:checked + span { background: #fff; color: var(--accent-fonce); box-shadow: 0 1px 3px rgba(31, 35, 51, .12); }
.segmente input:focus-visible + span { box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .3); }

/* Boutons */
.bouton {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font: inherit; font-size: 1.02rem; font-weight: 600; color: #fff; text-decoration: none;
    background: var(--accent); border: 0; border-radius: 12px; padding: 13px 20px; cursor: pointer;
    box-shadow: 0 8px 20px -10px rgba(var(--accent-rgb), .7);
    transition: background .15s ease, transform .15s ease, box-shadow .15s ease;
}
.bouton svg { width: 20px; height: 20px; transition: transform .2s ease; }
.bouton:hover:not(:disabled) { background: var(--accent-fonce); }
.bouton:hover:not(:disabled) svg.fleche { transform: translateX(3px); }
.bouton:active:not(:disabled) { transform: translateY(1px); }
.bouton:disabled { background: #B8C2CE; box-shadow: none; cursor: not-allowed; }
.bouton-secondaire {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font: inherit; font-size: .95rem; font-weight: 600; color: var(--encre); text-decoration: none;
    background: var(--carte); border: 1px solid var(--trait); border-radius: 11px; padding: 10px 16px; cursor: pointer;
    box-shadow: 0 1px 2px rgba(31, 35, 51, .05); transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.bouton-secondaire:hover { border-color: #C9CFDB; box-shadow: 0 4px 12px rgba(31, 35, 51, .08); }
.bouton-secondaire svg { width: 18px; height: 18px; }
.lien {
    font: inherit; font-weight: 500; color: var(--attenue); background: none; border: 0; padding: 6px 8px;
    border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.lien:hover { color: var(--encre); background: rgba(31, 35, 51, .05); }
.bouton:focus-visible, .bouton-secondaire:focus-visible, .lien:focus-visible { outline: 3px solid rgba(var(--accent-rgb), .4); outline-offset: 2px; }

/* Badges d'interprétation */
.badge {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: .85rem; font-weight: 600; padding: 4px 10px; border-radius: 999px;
    background: #F1F3F7; color: var(--encre-douce);
}
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.ok { background: var(--ok-doux); color: var(--ok); }
.badge.attention { background: var(--attention-doux); color: var(--attention); }
.badge.alerte { background: var(--alerte-doux); color: var(--alerte); }
.badge.info { background: var(--info-doux); color: var(--info); }

.note { margin: 16px 0 0; font-size: .85rem; line-height: 1.5; color: var(--attenue); }
.vide { color: var(--attenue); font-size: .95rem; line-height: 1.5; }

footer { padding-top: 8px; padding-bottom: 24px; text-align: center; font-size: .85rem; color: var(--attenue); }
footer a { color: inherit; text-underline-offset: 3px; }

.apparition { animation: apparition .4s ease both; }
@keyframes apparition { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (max-width: 560px) {
    .conteneur { padding-left: 16px; padding-right: 16px; }
    .barre { padding-top: 14px; padding-bottom: 14px; }
    .carte { padding: 20px 18px; border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
    .apparition { animation: none; }
    .bouton, .bouton svg, .pastille span, .segmente span { transition: none; }
}
@media print {
    body { background: #fff; padding: 0; }
    .barre, footer, .ne-pas-imprimer { display: none !important; }
    .carte { box-shadow: none; break-inside: avoid; }
}
