/* ==========================================================================
   Theme de connexion UNCHK / SEN-ID
   Universite numerique Cheikh Hamidou Kane
   ========================================================================== */

:root {
    --unchk-navy:        #0b2a6b;
    --unchk-navy-deep:   #061c4a;
    --unchk-blue:        #0d47a1;
    --unchk-blue-bright: #1257c7;
    --unchk-blue-hover:  #0b3c8a;
    --unchk-blue-active: #09306e;
    --unchk-blue-soft:   #e8f0fc;
    --unchk-orange:      #f0a02a;
    --unchk-green:       #10a059;
    --unchk-red:         #d92d20;

    --unchk-ink:         #10203c;
    --unchk-ink-soft:    #4a5b78;
    --unchk-ink-faint:   #7787a3;
    --unchk-line:        #d5dfee;
    --unchk-surface:     #ffffff;
    --unchk-canvas:      #eef3fa;

    --unchk-radius:      16px;
    --unchk-radius-sm:   10px;
    --unchk-shadow:      0 18px 48px -18px rgba(11, 42, 107, .34), 0 2px 8px -2px rgba(11, 42, 107, .10);
    --unchk-focus:       0 0 0 4px rgba(18, 87, 199, .20);

    /* Hauteur du bandeau visuel en mode empile (tablette / mobile) */
    --unchk-band:        clamp(150px, 24vh, 232px);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

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

body.unchk-body {
    margin: 0;
    min-height: 100%;
    background: var(--unchk-canvas);
    color: var(--unchk-ink);
    font-family: "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

/* Conteneur general : deux colonnes sur grand ecran, empile en dessous. */
.unchk-login {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(430px, .92fr);
    min-height: 100vh;
    min-height: 100dvh;
}

/* --------------------------------------------------------------------------
   Panneau visuel (banniere institutionnelle)
   -------------------------------------------------------------------------- */

.unchk-hero {
    position: relative;
    overflow: hidden;
    background: var(--unchk-navy);
}

.unchk-hero-media {
    position: absolute;
    inset: 0;
    /* Repli pour les navigateurs sans image-set */
    background-image: url("../img/hero.jpg?v=3");
    background-image: -webkit-image-set(url("../img/hero.webp?v=3") type("image/webp"),
                                        url("../img/hero.jpg?v=3")  type("image/jpeg"));
    background-image: image-set(url("../img/hero.webp?v=3") type("image/webp"),
                                url("../img/hero.jpg?v=3")  type("image/jpeg"));
    background-repeat: no-repeat;
    background-size: cover;
    /* Ancrage a gauche : le logo, le titre et les pictos de la banniere sont
       tous dans le tiers gauche du visuel, ils restent donc toujours visibles
       quel que soit le format du panneau. */
    background-position: left center;
}

/* Fondu vers le panneau de droite, pour eviter une coupe franche. */
.unchk-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(100deg,
                rgba(6, 28, 74, 0) 55%,
                rgba(6, 28, 74, .35) 82%,
                rgba(6, 28, 74, .60) 100%);
    pointer-events: none;
}

/* Filet aux couleurs du drapeau senegalais. */
.unchk-hero-flag {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 2;
    display: flex;
    height: 4px;
}
.unchk-hero-flag span { flex: 1; }
.unchk-flag-green  { background: var(--unchk-green); }
.unchk-flag-yellow { background: var(--unchk-orange); }
.unchk-flag-red    { background: var(--unchk-red); }

/* --------------------------------------------------------------------------
   Panneau formulaire
   -------------------------------------------------------------------------- */

.unchk-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 40px clamp(20px, 4vw, 56px);
    background:
        radial-gradient(120% 90% at 100% 0%, #ffffff 0%, var(--unchk-canvas) 62%);
    padding-bottom: max(40px, env(safe-area-inset-bottom));
}

.unchk-card {
    width: 100%;
    max-width: 452px;
    background: var(--unchk-surface);
    border: 1px solid rgba(213, 223, 238, .9);
    border-radius: var(--unchk-radius);
    box-shadow: var(--unchk-shadow);
    padding: clamp(24px, 3.4vw, 38px);
}

/* --------------------------------------------------------------------------
   En-tete de carte : logo, realm, titre
   -------------------------------------------------------------------------- */

.unchk-card-header {
    position: relative;
    text-align: center;
}

/* En-tete centre : la marque SEN-ID en haut, puis le titre. */
.unchk-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.unchk-brand-mark {
    display: block;
    flex: 0 0 auto;
    width: 82px;
    aspect-ratio: 1 / 1;
    background-image: url("../img/senid-logo.png");
    background-image: -webkit-image-set(url("../img/senid-logo.webp") type("image/webp"),
                                        url("../img/senid-logo.png")  type("image/png"));
    background-image: image-set(url("../img/senid-logo.webp") type("image/webp"),
                                url("../img/senid-logo.png")  type("image/png"));
    background-repeat: no-repeat;
    background-size: contain;
    background-position: center;
}

/* Repli pour les navigateurs sans aspect-ratio. */
@supports not (aspect-ratio: 1) {
    .unchk-brand-mark { height: 82px; }
}

.unchk-brand-side {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}

.unchk-brand-realm {
    flex: 0 1 auto;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--unchk-blue);
    background: var(--unchk-blue-soft);
    border-radius: 999px;
    padding: 5px 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

#kc-page-title {
    margin: 0 0 6px;
    font-size: clamp(20px, 2.4vw, 25px);
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--unchk-navy);
}

/* Trait orange sous le titre, repris du visuel institutionnel. */
#kc-page-title::after {
    content: "";
    display: block;
    width: 42px;
    height: 3px;
    margin: 12px auto 0;
    border-radius: 2px;
    background: var(--unchk-orange);
}

.unchk-content-wrapper .subtitle,
.unchk-label-wrapper.subtitle {
    display: block;
    font-size: 12.5px;
    color: var(--unchk-ink-faint);
    margin-bottom: 6px;
}
.unchk-content-wrapper .required,
.unchk-label-wrapper .required { color: var(--unchk-red); }

#kc-content { margin-top: 22px; }

/* Nom d'utilisateur rappele par Keycloak entre deux etapes. */
#kc-username {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 14px 0 0;
    padding: 10px 14px;
    background: var(--unchk-blue-soft);
    border-radius: var(--unchk-radius-sm);
    font-size: 14px;
}
#kc-attempted-username { color: var(--unchk-navy); font-weight: 600; }
#reset-login { display: inline-flex; text-decoration: none; }
.kc-login-tooltip { position: relative; display: inline-flex; }
.kc-tooltip-text {
    position: absolute;
    left: 50%; bottom: calc(100% + 8px);
    transform: translateX(-50%);
    background: var(--unchk-navy);
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}
.kc-login-tooltip:hover .kc-tooltip-text,
#reset-login:focus-visible .kc-tooltip-text { opacity: 1; }

/* --------------------------------------------------------------------------
   Champs de formulaire
   -------------------------------------------------------------------------- */

.unchk-form-group { margin-bottom: 18px; }

.unchk-label,
.unchk-check-label {
    display: block;
    margin-bottom: 7px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--unchk-ink-soft);
}

.unchk-input {
    width: 100%;
    /* 16px minimum : en dessous, iOS zoome automatiquement a la saisie. */
    font-size: 16px;
    font-family: inherit;
    color: var(--unchk-ink);
    background: #fbfcfe;
    border: 1px solid var(--unchk-line);
    border-radius: var(--unchk-radius-sm);
    padding: 0 14px;
    height: 48px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
    /* Meme raison que pour les boutons : sans prefixe, iOS impose son propre
       fond et son ombre interne aux champs. */
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
}
.unchk-input::placeholder { color: var(--unchk-ink-faint); }
.unchk-input:hover { border-color: #b9c8e0; }
.unchk-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--unchk-blue-bright);
    box-shadow: var(--unchk-focus);
}
.unchk-input[aria-invalid="true"] {
    border-color: var(--unchk-red);
    background: #fff7f6;
}
.unchk-input[aria-invalid="true"]:focus {
    box-shadow: 0 0 0 4px rgba(217, 45, 32, .16);
}

.unchk-textarea { height: auto; min-height: 110px; padding: 12px 14px; resize: vertical; }

select.unchk-input {
    background-image: url("../img/chevron.svg");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Groupe mot de passe : le bouton oeil se superpose au champ. */
.unchk-input-group { position: relative; display: block; }
.unchk-input-group .unchk-input { padding-right: 50px; }

.unchk-pw-toggle {
    position: absolute;
    top: 4px; right: 4px;
    /* Cible tactile confortable, conforme aux recommandations mobiles. */
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    color: var(--unchk-ink-faint);
    transition: color .15s ease, background .15s ease;
}
.unchk-pw-toggle:hover {
    color: var(--unchk-blue);
    background: var(--unchk-blue-soft);
}
.unchk-pw-toggle:focus-visible { outline: none; box-shadow: var(--unchk-focus); }

/* Icones dessinees en CSS (aucune dependance a une fonte d'icones). */
.unchk-ico {
    display: inline-block;
    width: 20px; height: 20px;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}
/* L'oeil doit suivre la couleur du bouton (gris au repos, bleu au survol).
   Une image de fond SVG est un document isole : "currentColor" ne s'y resout
   pas et le trace resterait invisible. On peint donc la couleur en fond et on
   decoupe la forme au masque. La regle background-image qui precede sert de
   repli, avec une couleur figee, pour les navigateurs sans masque CSS. */
.unchk-ico-eye {
    background-image: url("../img/eye.svg");
}
.unchk-ico-eye-off {
    background-image: url("../img/eye-off.svg");
}

@supports ((mask-image: none) or (-webkit-mask-image: none)) {
    .unchk-ico-eye,
    .unchk-ico-eye-off {
        background-image: none;
        background-color: currentColor;
        -webkit-mask-repeat: no-repeat;   mask-repeat: no-repeat;
        -webkit-mask-position: center;    mask-position: center;
        -webkit-mask-size: contain;       mask-size: contain;
    }
    .unchk-ico-eye {
        -webkit-mask-image: url("../img/eye.svg");
                mask-image: url("../img/eye.svg");
    }
    .unchk-ico-eye-off {
        -webkit-mask-image: url("../img/eye-off.svg");
                mask-image: url("../img/eye-off.svg");
    }
}
.unchk-ico-reset {
    width: 16px; height: 16px;
    background-image: url("../img/reset.svg");
}
.unchk-ico-auth {
    background-image: url("../img/auth.svg");
}
.unchk-ico-arrow {
    width: 16px; height: 16px;
    background-image: url("../img/arrow.svg");
}

.unchk-input-error {
    display: block;
    margin-top: 7px;
    font-size: 13px;
    color: var(--unchk-red);
}

/* Cases a cocher : zone cliquable elargie. */
.unchk-form-setting { margin-bottom: 20px; }
#kc-form-options { min-height: 24px; }
#kc-form-options .checkbox { margin: 0; }
#kc-form-options .checkbox label {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 14px;
    color: var(--unchk-ink-soft);
    cursor: pointer;
    padding: 4px 0;
}
#kc-form-options input[type="checkbox"],
.unchk-checkbox {
    width: 18px; height: 18px;
    accent-color: var(--unchk-blue);
    margin: 0;
    flex: 0 0 auto;
}

.unchk-form-setting {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}
.unchk-form-options-wrapper { font-size: 14px; }

/* Liens */
a {
    color: var(--unchk-blue);
    text-decoration: none;
    font-weight: 600;
    border-radius: 4px;
}
a:hover { color: var(--unchk-blue-bright); text-decoration: underline; }
a:focus-visible { outline: none; box-shadow: var(--unchk-focus); }

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

.unchk-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 22px;
    font-family: inherit;
    font-size: 15px;
    font-weight: 650;
    letter-spacing: .01em;
    border-radius: var(--unchk-radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
    /* Sans le prefixe, Safari et iOS conservent l'apparence native de
       input[type=submit] — un bouton a degrade vertical. background-image
       neutralise en plus le fond dessine par le navigateur, au cas ou
       l'apparence ne serait pas honoree. */
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    background-image: none;
    text-shadow: none;
}
.unchk-btn:focus-visible { outline: none; box-shadow: var(--unchk-focus); }
.unchk-btn:disabled { opacity: .6; cursor: not-allowed; }

/* Aplat, sans degrade : la couleur institutionnelle se suffit. */
.unchk-btn-primary {
    color: #fff;
    background: var(--unchk-blue);
}
.unchk-btn-primary:hover:not(:disabled)  { background: var(--unchk-blue-hover); }
.unchk-btn-primary:active:not(:disabled) { background: var(--unchk-blue-active); }

.unchk-btn-default,
.unchk-btn-secondary {
    color: var(--unchk-navy);
    background: #fff;
    border-color: var(--unchk-line);
}
.unchk-btn-default:hover,
.unchk-btn-secondary:hover { background: var(--unchk-blue-soft); border-color: #b9c8e0; }

.unchk-btn-block { width: 100%; }
.unchk-btn-lg { min-height: 50px; font-size: 15.5px; }

#kc-form-buttons { margin-top: 4px; margin-bottom: 0; }
/* Keycloak empile parfois plusieurs boutons (annuler / valider). */
#kc-form-buttons .unchk-btn + .unchk-btn { margin-top: 10px; }

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

.unchk-alert {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-bottom: 20px;
    padding: 13px 15px;
    border-radius: var(--unchk-radius-sm);
    border: 1px solid;
    border-left-width: 4px;
    font-size: 14px;
    line-height: 1.5;
}
.unchk-alert-icon { flex: 0 0 auto; display: flex; padding-top: 1px; }
.unchk-alert-title { display: block; }

.unchk-alert-error   { background: #fef4f3; border-color: #f7c9c4; color: #8a1f16; }
.unchk-alert-warning { background: #fff9ec; border-color: #f5dca6; color: #7a5410; }
.unchk-alert-success { background: #f1faf4; border-color: #b6e2c6; color: #0f6135; }
.unchk-alert-info    { background: #f1f6fe; border-color: #bfd6f5; color: #123a76; }

.unchk-ico-error {
    background-image: url("../img/alert-error.svg");
}
.unchk-ico-warning {
    background-image: url("../img/alert-warning.svg");
}
.unchk-ico-success {
    background-image: url("../img/alert-success.svg");
}
.unchk-ico-info {
    background-image: url("../img/alert-info.svg");
}

/* --------------------------------------------------------------------------
   Fournisseurs d'identite externes
   -------------------------------------------------------------------------- */

.unchk-social-section { margin-top: 26px; }
.unchk-social-section hr {
    border: 0;
    border-top: 1px solid var(--unchk-line);
    margin: 0 0 18px;
}
.unchk-social-section h2 {
    margin: 0 0 14px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--unchk-ink-faint);
}

.unchk-social-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}
.unchk-social-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.unchk-social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 46px;
    padding: 0 14px;
    font-size: 14.5px;
    font-weight: 600;
    color: var(--unchk-navy);
    background: #fff;
    border: 1px solid var(--unchk-line);
    border-radius: var(--unchk-radius-sm);
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.unchk-social-btn:hover {
    background: var(--unchk-blue-soft);
    border-color: #b9c8e0;
    text-decoration: none;
}
.unchk-social-btn-disabled { opacity: .55; pointer-events: none; }
.unchk-social-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unchk-idp-logo { flex: 0 0 auto; }

/* --------------------------------------------------------------------------
   Choix du second facteur (select-authenticator)
   -------------------------------------------------------------------------- */

.unchk-auth-list { display: grid; gap: 10px; margin-top: 4px; }
.unchk-auth-item {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 14px 16px;
    border: 1px solid var(--unchk-line);
    border-radius: var(--unchk-radius-sm);
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.unchk-auth-item:hover { background: var(--unchk-blue-soft); border-color: #b9c8e0; }
.unchk-auth-item-icon { flex: 0 0 auto; display: flex; }
.unchk-auth-item-body { flex: 1 1 auto; min-width: 0; }
.unchk-auth-item-heading { font-weight: 650; color: var(--unchk-navy); }
.unchk-auth-item-desc { font-size: 13px; color: var(--unchk-ink-faint); }
.unchk-auth-item-fill { flex: 1 1 auto; }
.unchk-auth-item-arrow { flex: 0 0 auto; display: flex; }

/* --------------------------------------------------------------------------
   Zone d'information / inscription
   -------------------------------------------------------------------------- */

.unchk-signup {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--unchk-line);
    font-size: 14px;
    color: var(--unchk-ink-soft);
    text-align: center;
}
#kc-registration-container, #kc-registration { display: inline; }

#kc-select-try-another-way-form { margin-top: 16px; text-align: center; font-size: 14px; }

/* Pied de page interne de Keycloak (footer.ftl). */
#kc-footer { margin-top: 18px; font-size: 13px; color: var(--unchk-ink-faint); }

/* --------------------------------------------------------------------------
   Selecteur de langue
   -------------------------------------------------------------------------- */

.unchk-locale {
    position: absolute;
    top: -2px; right: 0;
    z-index: 5;
}
.unchk-locale-dropdown { position: relative; }

#kc-current-locale-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 34px;
    padding: 0 11px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--unchk-ink-soft);
    background: #fff;
    border: 1px solid var(--unchk-line);
    border-radius: 999px;
    cursor: pointer;
}
#kc-current-locale-link::after {
    content: "";
    width: 12px; height: 12px;
    background: url("../img/chevron.svg") no-repeat center / contain;
}
#kc-current-locale-link:hover { border-color: #b9c8e0; color: var(--unchk-navy); }
#kc-current-locale-link:focus-visible { outline: none; box-shadow: var(--unchk-focus); }

.unchk-locale-list {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 168px;
    max-height: 264px;
    overflow-y: auto;
    list-style: none;
    margin: 0;
    padding: 6px;
    background: #fff;
    border: 1px solid var(--unchk-line);
    border-radius: 12px;
    box-shadow: 0 14px 34px -14px rgba(11, 42, 107, .40);
    display: none;
}
/* Keycloak (menu-button-links.js) bascule aria-expanded sur le bouton. */
#kc-current-locale-link[aria-expanded="true"] + .unchk-locale-list { display: block; }
.unchk-locale-dropdown:hover .unchk-locale-list,
.unchk-locale-list:focus-within { display: block; }

.unchk-locale-item { margin: 0; }
.unchk-locale-link {
    display: block;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--unchk-ink);
    text-decoration: none;
}
.unchk-locale-link:hover { background: var(--unchk-blue-soft); text-decoration: none; }

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

.unchk-legal {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 452px;
    width: 100%;
    font-size: 12.5px;
    line-height: 1.5;
    color: var(--unchk-ink-faint);
    text-align: left;
}
.unchk-legal-flag {
    flex: 0 0 auto;
    width: 26px; height: 3px;
    border-radius: 2px;
    background: linear-gradient(to right,
                var(--unchk-green) 0 33.33%,
                var(--unchk-orange) 33.33% 66.66%,
                var(--unchk-red) 66.66% 100%);
}

/* ==========================================================================
   Adaptatif
   ========================================================================== */

/* Ecrans intermediaires : on resserre la colonne de droite. */
@media (max-width: 1180px) {
    .unchk-login { grid-template-columns: minmax(0, 1fr) minmax(400px, .85fr); }
}

/* --------------------------------------------------------------------------
   Tablette et mobile : mise en page empilee.
   Le visuel devient un bandeau superieur, la carte remonte par-dessus.
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
    .unchk-login {
        grid-template-columns: 1fr;
        grid-template-rows: var(--unchk-band) 1fr;
    }

    .unchk-hero { min-height: var(--unchk-band); }

    /* Cadrage haut-gauche : le logo de la banniere reste dans le bandeau. */
    .unchk-hero-media {
        background-position: left top;
        background-image: url("../img/hero-sm.jpg?v=3");
        background-image: -webkit-image-set(url("../img/hero-sm.webp?v=3") type("image/webp"),
                                            url("../img/hero-sm.jpg?v=3")  type("image/jpeg"));
        background-image: image-set(url("../img/hero-sm.webp?v=3") type("image/webp"),
                                    url("../img/hero-sm.jpg?v=3")  type("image/jpeg"));
    }

    .unchk-hero::after {
        background: linear-gradient(180deg,
                    rgba(6, 28, 74, 0) 45%,
                    rgba(6, 28, 74, .28) 100%);
    }

    .unchk-panel {
        justify-content: flex-start;
        padding: 0 clamp(16px, 4vw, 32px) 32px;
        padding-bottom: max(32px, env(safe-area-inset-bottom));
        background: var(--unchk-canvas);
    }

    .unchk-card {
        max-width: 540px;
        /* Chevauchement du bandeau : la carte doit passer au-dessus. */
        margin-top: -34px;
        position: relative;
        z-index: 3;
    }

    .unchk-legal { max-width: 540px; margin-top: 18px; }
}

/* --------------------------------------------------------------------------
   Mobile
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    :root { --unchk-band: clamp(132px, 21vh, 176px); }

    body.unchk-body { font-size: 14.5px; }

    .unchk-card {
        padding: 22px 18px 24px;
        border-radius: 14px;
        margin-top: -28px;
    }

    .unchk-brand { margin-bottom: 18px; }
    .unchk-brand-mark { width: 72px; }
    .unchk-brand-realm { font-size: 10px; padding: 4px 9px; }

    #kc-page-title { font-size: 20px; }
    #kc-content { margin-top: 18px; }

    /* La ligne "se souvenir de moi" / "mot de passe oublie" passe en colonne. */
    .unchk-form-setting {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .unchk-social-grid { grid-template-columns: 1fr; }

    .unchk-locale-list { max-height: 50vh; }

    .unchk-legal { font-size: 12px; }
}

/* Tres petits ecrans. */
@media (max-width: 380px) {
    .unchk-card { padding: 18px 14px 20px; }
    .unchk-brand-mark { width: 64px; }
    .unchk-brand-realm { display: none; }
    #kc-page-title { font-size: 18.5px; }
}

/* Telephone en paysage : le bandeau mange toute la hauteur utile. */
@media (max-height: 560px) and (orientation: landscape) and (max-width: 1023px) {
    :root { --unchk-band: 104px; }
    .unchk-card { margin-top: -22px; }
}

/* Ecrans larges mais peu hauts : on evite de rogner le haut de la banniere. */
@media (min-width: 1024px) and (max-height: 700px) {
    .unchk-hero-media { background-position: left top; }
    .unchk-panel { padding-top: 28px; padding-bottom: 28px; }
}

/* --------------------------------------------------------------------------
   Preferences utilisateur / accessibilite
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: .01ms !important;
        animation-duration: .01ms !important;
    }
}

@media (prefers-contrast: more) {
    .unchk-input { border-color: #8b9cb8; }
    .unchk-label { color: var(--unchk-ink); }
    .unchk-legal { color: var(--unchk-ink-soft); }
}

/* Impression : uniquement le contenu utile. */
@media print {
    .unchk-hero, .unchk-locale { display: none; }
    .unchk-login { display: block; }
    .unchk-card { box-shadow: none; border: 1px solid #ccc; max-width: none; }
}
