/* ==========================================================================
   portailaccpt — pages du portail (accueil, connexion, comptes)
   Présentation alignée sur le portail app.lfpl.fr : barre blanche, fond
   #eef2f7, tuiles blanches à filet coloré. Les outils (simulateur, FAFA,
   administration) gardent leur propre feuille app.css.
   Aucun style en ligne : la CSP du .htaccess (style-src 'self') l'interdit.
   ========================================================================== */

:root {
    --navy: #2D427B;
    --blue: #416EA9;
    --blue-2: #325491;
    --gold: #C19A2A;
    --gold-fonce: #A8841F;   /* pastille d'icône : contraste 3,5:1 avec le blanc */
    --green: #0F6E56;
    --red: #D8171C;
    --red-fonce: #B3261E;
    --ink: #2b3444;
    --muted: #5F6B7A;        /* 4,8:1 sur le fond : lisible en petit corps (WCAG AA) */
    --bg: #eef2f7;
    --line: #e5e9f0;
    --surface-2: #f4f7fb;
    --rayon: 16px;
    --rayon-petit: 9px;
    --ombre: 0 2px 6px rgba(20, 30, 60, .05);
    --ombre-survol: 0 10px 24px rgba(20, 30, 60, .12);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--blue); text-underline-offset: 2px; }
a:hover { color: var(--blue-2); }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

[hidden] { display: none !important; }

.visuellement-cache {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10;
    background: #fff;
    color: var(--navy);
    font-weight: 700;
    padding: 12px 16px;
    border-radius: var(--rayon-petit);
    box-shadow: var(--ombre-survol);
}
.skip:focus { left: 12px; top: 12px; }

/* --------------------------------------------------------------- barre haute */

.top {
    background: #fff;
    border-bottom: 1px solid var(--line);
    padding: 14px 26px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.top__marque {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-height: 44px;
}
.top img { height: 38px; width: auto; }
.top .brand { font-weight: 700; color: var(--navy); }
.top .sp { margin-left: auto; }
.top form { margin: 0; }
.top .help {
    border: 1px solid var(--line);
    border-radius: var(--rayon-petit);
    padding: 8px 12px;
    min-height: 40px;
    color: var(--navy);
    background: #fff;
    font: inherit;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    gap: 7px;
    align-items: center;
    cursor: pointer;
    transition: background .12s, border-color .12s;
}
.top .help:hover { background: var(--surface-2); border-color: #d7dee9; }
.top__compte {
    max-width: 22ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ gabarit */

.wrap {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 40px 24px 56px;
    flex: 1 0 auto;
}
.wrap--etroit { max-width: 600px; }

.head {
    display: flex;
    align-items: flex-end;
    gap: 24px;
    flex-wrap: wrap;
    margin-bottom: 30px;
}
.head .txt { flex: 1 1 320px; }

h1 { font-size: 26px; color: var(--navy); margin: 0 0 4px; font-weight: 800; line-height: 1.25; }
.h1__accroche { font-weight: 600; color: var(--blue-2); }
.sub { color: var(--muted); margin: 0; }

.fil { margin: 0 0 16px; font-size: 14px; font-weight: 600; }
.fil a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; text-decoration: none; }
.fil a:hover { text-decoration: underline; }

/* ------------------------------------------------------------------- tuiles */

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 22px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.tile {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--rayon);
    padding: 26px 24px 22px 30px;
    text-decoration: none;
    color: inherit;
    overflow: hidden;
    box-shadow: var(--ombre);
    transition: transform .12s, box-shadow .12s;
}
a.tile:hover, a.tile:focus-visible { transform: translateY(-3px); box-shadow: var(--ombre-survol); color: inherit; }
a.tile:active { transform: translateY(-1px); }

.bar { position: absolute; left: 0; top: 0; bottom: 0; width: 6px; }

.ic {
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    border-radius: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    margin-bottom: 14px;
}

.tile__titre { margin: 0; font-size: 19px; color: var(--navy); font-weight: 700; line-height: 1.3; }
.tile .sub2 { margin: 2px 0 0; font-size: 13.5px; font-weight: 700; color: var(--blue-2); }
.tile p { margin: 8px 0 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.tile .sub2 + p { margin-top: 8px; }
.tile .go { margin-top: auto; padding-top: 16px; font-weight: 700; color: var(--blue); font-size: 14px; }

.badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--bg);
    color: var(--muted);
    border-radius: 20px;
    padding: 3px 11px;
    font-size: 11.5px;
    font-weight: 700;
}

.tile.off { cursor: default; box-shadow: none; background: #f8fafc; }
.tile.off .ic, .tile.off .bar { filter: grayscale(1); opacity: .55; }
.tile.off .go { color: var(--muted); font-weight: 600; }

/* Couleurs par outil (classes : la CSP interdit les attributs style). */
.tile--bleu .bar, .tile--bleu .ic, .panneau--bleu .bar, .panneau--bleu .ic { background: var(--navy); }
.tile--vert .bar, .tile--vert .ic, .panneau--vert .bar, .panneau--vert .ic { background: var(--green); }
.tile--or .bar, .panneau--or .bar { background: var(--gold); }
.tile--or .ic, .panneau--or .ic { background: var(--gold-fonce); }

/* ----------------------------------------------------------------- panneaux */

.panneau {
    position: relative;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--rayon);
    padding: 28px 28px 26px 34px;
    box-shadow: var(--ombre);
    overflow: hidden;
}
.panneau + .panneau { margin-top: 22px; }

.panneau__entete { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 20px; }
.panneau__entete .ic { margin-bottom: 0; }
.panneau__titre { font-size: 22px; margin: 4px 0 2px; color: var(--navy); font-weight: 800; line-height: 1.25; }
.panneau__titre--petit { font-size: 18px; margin: 0 0 16px; }
.panneau__intro { margin: 0; color: var(--muted); font-size: 15px; }

.panneau__lien {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    flex-wrap: wrap;
    margin: 20px 0 0;
    padding-top: 18px;
    border-top: 1px solid var(--line);
    font-size: 14px;
    color: var(--muted);
}
.panneau__lien svg { flex: 0 0 auto; margin-top: 2px; color: var(--blue-2); }
.panneau__lien > span { flex: 1 1 0; min-width: 12rem; }
.panneau__lien a { font-weight: 700; }

/* --------------------------------------------------------------- formulaires */

.formulaire { display: grid; gap: 18px; margin: 0; }
.formulaire + .formulaire { margin-top: 12px; }

.champ { display: grid; gap: 6px; }
.champ__etiquette { font-size: 14px; font-weight: 700; color: var(--navy); }
.champ__aide { font-size: 13px; color: var(--muted); }
.champ__aide--etat:empty { display: none; }
.champ__aide--etat.est-ok { color: var(--green); font-weight: 600; }
.champ__aide--etat.est-ko { color: var(--red-fonce); font-weight: 600; }
.champ__erreur { font-size: 13px; color: var(--red-fonce); font-weight: 600; }
.champ__alerte {
    justify-self: start;
    font-size: 12.5px;
    font-weight: 700;
    color: #7a5a00;
    background: #fff4d6;
    border-radius: 6px;
    padding: 2px 8px;
}

.controle {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    font: inherit;
    font-size: 16px;   /* 16 px minimum : iOS ne zoome pas au focus */
    color: var(--ink);
    background: #fff;
    border: 1px solid #cfd7e3;
    border-radius: var(--rayon-petit);
    transition: border-color .12s, box-shadow .12s;
}
.controle::placeholder { color: #8a95a3; }
.controle:hover { border-color: #b7c2d3; }
.controle:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px rgba(65, 110, 169, .2); }
.champ--erreur .controle { border-color: var(--red-fonce); }
.champ--erreur .controle:focus { box-shadow: 0 0 0 3px rgba(179, 38, 30, .18); }

.champ-mdp { position: relative; }
.champ-mdp .controle { padding-right: 96px; }
.champ-mdp__bascule {
    position: absolute;
    top: 4px;
    right: 4px;
    bottom: 4px;
    min-width: 84px;
    padding: 0 12px;
    font: inherit;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--blue-2);
    background: var(--surface-2);
    border: 0;
    border-radius: 7px;
    cursor: pointer;
}
.champ-mdp__bascule:hover { background: #e7edf5; }

.bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 10px 20px;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    border-radius: var(--rayon-petit);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .12s, border-color .12s, transform .06s;
}
.bouton:active { transform: translateY(1px); }
.bouton--primaire { background: var(--navy); color: #fff; }
.bouton--primaire:hover { background: var(--blue-2); color: #fff; }
.bouton--secondaire { background: #fff; color: var(--navy); border-color: var(--line); }
.bouton--secondaire:hover { background: var(--surface-2); }
.bouton--large { width: 100%; }
.bouton[aria-busy="true"] { cursor: progress; opacity: .8; }
.bouton[aria-busy="true"]::before {
    content: "";
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: rotation .7s linear infinite;
}
@keyframes rotation { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ alertes */

.alerte {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    margin: 0 0 18px;
    border-radius: 11px;
    border: 1px solid;
    font-size: 14.5px;
}
.alerte__icone { flex: 0 0 auto; margin-top: 1px; }
.alerte__titre { margin: 0 0 2px; font-weight: 700; }
.alerte__texte { margin: 0; }
.alerte--erreur { background: #fdf0ef; border-color: #f3c9c5; color: #8c1d16; }
.alerte--succes { background: #ecf7f3; border-color: #bfe3d6; color: #0b5a46; }
.alerte--info { background: #eef3fa; border-color: #cddbee; color: var(--navy); }

/* -------------------------------------------------------------------- fiche */

.fiche { display: grid; gap: 0; margin: 0; }
.fiche div {
    display: grid;
    grid-template-columns: minmax(150px, 40%) 1fr;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px solid var(--line);
}
.fiche dt { font-size: 14px; font-weight: 700; color: var(--muted); }
.fiche dd { margin: 0; overflow-wrap: anywhere; }

/* --------------------------------------------------------------- pied de page */

footer.site {
    width: 100%;
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px 40px;
    font-size: 13px;
    color: var(--muted);
}
footer.site p { margin: 0; }

/* ----------------------------------------------------------------- responsive */

@media (max-width: 640px) {
    .top { padding: 10px 16px; gap: 8px; }
    /* Masqué visuellement, pas pour les lecteurs d'écran : c'est le nom du lien d'accueil. */
    .top .brand {
        position: absolute;
        width: 1px; height: 1px;
        overflow: hidden; clip: rect(0, 0, 0, 0);
        white-space: nowrap;
    }
    .top .help { padding: 8px 10px; }
    .top__compte { max-width: 14ch; }
    .wrap { padding: 26px 16px 40px; }
    .grid { grid-template-columns: 1fr; gap: 16px; }
    h1 { font-size: 22px; }
    .h1__accroche { display: block; font-size: 17px; }
    .panneau { padding: 22px 18px 20px 24px; }
    .panneau__entete .ic { width: 46px; height: 46px; flex-basis: 46px; }
    .fiche div { grid-template-columns: 1fr; gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
    a.tile:hover, a.tile:focus-visible { transform: none; }
}
