.auth-body {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 12% 20%, rgba(37, 99, 235, 0.18), transparent 30%),
        radial-gradient(circle at 88% 16%, rgba(30, 64, 175, 0.15), transparent 28%),
        var(--sf-app-bg);
}

html[data-theme="dark"] .auth-body {
    background:
        radial-gradient(circle at 12% 20%, rgba(59, 130, 246, 0.15), transparent 30%),
        radial-gradient(circle at 88% 16%, rgba(37, 99, 235, 0.2), transparent 28%),
        var(--sf-app-bg);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.auth-showcase {
    padding: 4.5rem clamp(1.5rem, 4vw, 4rem);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-showcase__content {
    max-width: 560px;
}

.auth-showcase__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.auth-home-link {
    margin-top: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: fit-content;
    text-decoration: none;
    font-size: 0.84rem;
    font-weight: 700;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    border-radius: 999px;
    padding: 0.34rem 0.72rem;
    transition: transform 0.15s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.auth-home-link svg {
    width: 0.9rem;
    height: 0.9rem;
}

.auth-home-link:hover {
    transform: translateY(-1px);
    border-color: #93c5fd;
    background: #dbeafe;
}

.auth-home-link:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}

.brand-mark__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 0.65rem;
    display: inline-grid;
    place-items: center;
    background: linear-gradient(145deg, #2563eb, #1d4ed8);
    color: #ffffff;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.28);
}

.brand-mark__icon svg {
    width: 1.1rem;
    height: 1.1rem;
}

.auth-badge {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-size: 0.78rem;
}

.theme-toggle,
.password-toggle {
    border: 1px solid var(--sf-input-border);
    background: var(--sf-input-bg);
    color: var(--sf-input-fg);
    border-radius: var(--sf-btn-radius);
    padding: 0 0.75rem;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.theme-toggle {
    width: var(--sf-btn-height-sm);
    height: var(--sf-btn-height-sm);
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle:hover,
.password-toggle:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 15px rgba(15, 23, 42, 0.08);
    border-color: #94a3b8;
}

.theme-toggle:focus-visible,
.password-toggle:focus-visible,
.btn-primary:focus-visible,
.form-options a:focus-visible,
.auth-card__footer a:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.28);
    outline-offset: 2px;
}

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

.auth-showcase h1 {
    margin: 1rem 0 0.8rem;
    font-size: clamp(1.95rem, 3vw, 2.9rem);
    line-height: 1.17;
    color: #0f172a;
}

.auth-showcase__content > * {
    opacity: 0;
    transform: translateY(14px);
    animation: riseIn 0.55s ease forwards;
}

.auth-showcase__content > *:nth-child(1) { animation-delay: 0.05s; }
.auth-showcase__content > *:nth-child(2) { animation-delay: 0.12s; }
.auth-showcase__content > *:nth-child(3) { animation-delay: 0.19s; }
.auth-showcase__content > *:nth-child(4) { animation-delay: 0.26s; }
.auth-showcase__content > *:nth-child(5) { animation-delay: 0.33s; }
.auth-showcase__content > *:nth-child(6) { animation-delay: 0.4s; }
.auth-showcase__content > *:nth-child(7) { animation-delay: 0.47s; }

.auth-showcase p {
    margin: 0;
    color: #334155;
    font-size: 1rem;
    line-height: 1.7;
}

html[data-theme="dark"] .auth-showcase h1 {
    color: #e2e8f0;
}

html[data-theme="dark"] .auth-showcase p,
html[data-theme="dark"] .auth-highlights li {
    color: #cbd5e1;
}

html[data-theme="dark"] .auth-home-link {
    color: #93c5fd;
    border-color: #334155;
    background: rgba(30, 58, 138, 0.28);
}

html[data-theme="dark"] .auth-home-link:hover {
    border-color: #60a5fa;
    background: rgba(30, 64, 175, 0.35);
}
html[data-theme="dark"] .auth-badge {
    background: rgba(30, 58, 138, 0.34);
    color: #bfdbfe;
}

.auth-highlights {
    margin: 1.4rem 0 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 0.8rem;
}

.auth-highlights li {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    color: #1e293b;
    font-weight: 500;
}

.vector-scene {
    margin: 1.2rem 0 0;
    border-radius: 1rem;
    overflow: hidden;
    border: 1px solid #dbeafe;
    background: linear-gradient(180deg, #f8fbff, #eaf2ff);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.vector-scene svg {
    width: 100%;
    height: auto;
    display: block;
}

html[data-theme="dark"] .vector-scene {
    border-color: #334155;
    background: linear-gradient(180deg, #0f172a, #0b1220);
}

html[data-theme="dark"] .vector-scene svg rect[fill="#e8f0ff"] {
    fill: #1e293b;
}

html[data-theme="dark"] .vector-scene svg rect[fill="#dbeafe"] {
    fill: #334155;
}

.hi-icon {
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 0.55rem;
    display: inline-grid;
    place-items: center;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    flex: 0 0 auto;
}

.hi-icon svg {
    width: 1rem;
    height: 1rem;
}

.auth-metrics {
    margin-top: 1.4rem;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.metric-card {
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid #dbe5f3;
    border-radius: 0.85rem;
    padding: 0.7rem 0.8rem;
}

.metric-card strong {
    display: block;
    font-size: 1.1rem;
    color: #0f172a;
}

.metric-card span {
    color: #475569;
    font-size: 0.84rem;
}

.avatar-cluster {
    margin-top: 1rem;
    display: flex;
    align-items: center;
}

.avatar-icon,
.avatar-more {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #f4f7ff;
    display: inline-grid;
    place-items: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    margin-right: -10px;
}

.avatar-icon:nth-child(1) { background: linear-gradient(135deg, #2563eb, #1e40af); }
.avatar-icon:nth-child(2) { background: linear-gradient(135deg, #0ea5e9, #0369a1); }
.avatar-icon:nth-child(3) { background: linear-gradient(135deg, #22c55e, #15803d); }
.avatar-more { background: #1e293b; }

html[data-theme="dark"] .metric-card {
    background: rgba(15, 23, 42, 0.82);
    border-color: #334155;
}

html[data-theme="dark"] .metric-card strong {
    color: #e2e8f0;
}

html[data-theme="dark"] .metric-card span {
    color: #94a3b8;
}

.auth-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.auth-card {
    width: 100%;
    max-width: 460px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 1.2rem;
    box-shadow: 0 20px 42px rgba(15, 23, 42, 0.12);
    padding: clamp(1.4rem, 3vw, 2rem);
}

.auth-card {
    animation: fadeInScale 0.5s ease;
}

html[data-theme="dark"] .auth-card {
    background: #0f172a;
    border-color: #1e293b;
    box-shadow: 0 20px 42px rgba(2, 6, 23, 0.45);
}
html[data-theme="dark"] .auth-card__header p {
    color: #94a3b8;
}

.auth-card__header h2 {
    margin: 0;
    color: #0f172a;
    font-size: 1.7rem;
}

html[data-theme="dark"] .auth-card__header h2 {
    color: #e2e8f0;
}

.auth-card__header p {
    margin: 0.55rem 0 0;
    color: #64748b;
}

html[data-theme="dark"] .auth-card__header p,
html[data-theme="dark"] .auth-card__footer {
    color: #94a3b8;
}

.auth-form {
    margin-top: 1.35rem;
    display: grid;
    gap: 1rem;
}

.form-row {
    display: grid;
    gap: 0.45rem;
}

.form-row label {
    font-size: 0.92rem;
    font-weight: 600;
    color: #334155;
}

html[data-theme="dark"] .form-row label,
html[data-theme="dark"] .checkbox {
    color: #cbd5e1;
}

.form-row input,
.form-row select,
.form-row textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--sf-input-border);
    border-radius: 0.78rem;
    background: var(--sf-input-bg);
    font-size: 0.96rem;
    color: var(--sf-input-fg);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

.form-row input {
    height: 48px;
    padding: 0 0.95rem;
}

.form-row select {
    min-height: 48px;
    padding: 0 0.95rem;
    cursor: pointer;
    appearance: auto;
}

.form-row textarea {
    min-height: 120px;
    padding: 0.75rem 0.95rem;
    line-height: 1.55;
    resize: vertical;
}

.form-row input::placeholder,
.form-row textarea::placeholder {
    color: var(--sf-input-placeholder);
}

.input-wrap,
.password-wrap {
    position: relative;
    width: 100%;
}

.input-wrap .input-icon,
.password-wrap .input-icon {
    position: absolute;
    top: 50%;
    left: 0.7rem;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #64748b;
}

.input-wrap .input-icon svg,
.password-wrap .input-icon svg {
    width: 20px;
    height: 20px;
}

.input-wrap input,
.password-wrap input {
    padding-left: 2.5rem;
}

.input-wrap:focus-within .input-icon,
.password-wrap:focus-within .input-icon {
    color: #2563eb;
}

.password-wrap .password-toggle {
    position: absolute;
    top: 6px;
    right: 7px;
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-grid;
    place-items: center;
}

.password-wrap input {
    padding-right: 3.4rem;
}

.password-toggle .eye-icon {
    width: 18px;
    height: 18px;
}

.password-toggle .eye-closed {
    display: none;
}

.password-toggle.is-visible .eye-open {
    display: none;
}

.password-toggle.is-visible .eye-closed {
    display: block;
}

.form-row input.is-invalid,
.form-row select.is-invalid,
.form-row textarea.is-invalid {
    border-color: #dc2626;
}

html[data-theme="dark"] .form-row input.is-invalid,
html[data-theme="dark"] .form-row select.is-invalid,
html[data-theme="dark"] .form-row textarea.is-invalid {
    border-color: #f87171;
}

.field-error {
    color: #dc2626;
    font-size: 0.82rem;
    font-weight: 600;
}

.field-hint {
    color: #475569;
    font-size: 0.82rem;
    font-weight: 500;
}

html[data-theme="dark"] .field-error {
    color: #fca5a5;
}

html[data-theme="dark"] .field-hint {
    color: #94a3b8;
}

.sf-password-policy__match {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.82rem;
    font-weight: 600;
}

.sf-password-policy__match--error {
    color: #dc2626;
}

.sf-password-policy__match--ok {
    color: #166534;
}

html[data-theme="dark"] .sf-password-policy__match--error {
    color: #fca5a5;
}

html[data-theme="dark"] .sf-password-policy__match--ok {
    color: #86efac;
}

.form-row input.is-valid {
    border-color: #16a34a;
}

html[data-theme="dark"] .form-row input.is-valid {
    border-color: #4ade80;
}

.password-meter {
    margin-top: 0.55rem;
    border: 1px solid #dbe5f3;
    background: #f8fafc;
    border-radius: 0.7rem;
    padding: 0.6rem 0.65rem;
}

.password-meter__bar {
    width: 100%;
    height: 7px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}

.password-meter__fill {
    display: block;
    height: 100%;
    width: 6%;
    border-radius: inherit;
    transition: width 0.2s ease, background-color 0.2s ease;
    background: #dc2626;
}

.password-meter__label {
    display: block;
    margin-top: 0.45rem;
    font-size: 0.82rem;
    font-weight: 700;
    color: #334155;
}

.password-meter__rules {
    margin: 0.45rem 0 0;
    padding-left: 1rem;
    display: grid;
    gap: 0.2rem;
    color: #64748b;
    font-size: 0.8rem;
}

.password-meter__rules li.is-ok {
    color: #166534;
    font-weight: 600;
}

.password-meter.is-weak .password-meter__fill {
    background: #dc2626;
}

.password-meter.is-medium .password-meter__fill {
    background: #d97706;
}

.password-meter.is-strong .password-meter__fill {
    background: #16a34a;
}

html[data-theme="dark"] .password-meter {
    border-color: #334155;
    background: rgba(15, 23, 42, 0.7);
}

html[data-theme="dark"] .password-meter__bar {
    background: #1e293b;
}

html[data-theme="dark"] .password-meter__label {
    color: #cbd5e1;
}

html[data-theme="dark"] .password-meter__rules {
    color: #94a3b8;
}

html[data-theme="dark"] .password-meter__rules li.is-ok {
    color: #86efac;
}

.form-alert {
    border-radius: 0.75rem;
    padding: 0.75rem 0.9rem;
    font-size: 0.89rem;
    font-weight: 600;
}

.form-alert--error {
    border: 1px solid #fecaca;
    background: #fef2f2;
    color: #b91c1c;
}

.form-alert--success {
    border: 1px solid #bbf7d0;
    background: #f0fdf4;
    color: #166534;
}

html[data-theme="dark"] .form-alert--error {
    border-color: rgba(248, 113, 113, 0.45);
    background: rgba(127, 29, 29, 0.25);
    color: #fecaca;
}

html[data-theme="dark"] .form-alert--success {
    border-color: rgba(34, 197, 94, 0.45);
    background: rgba(20, 83, 45, 0.35);
    color: #bbf7d0;
}

.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus {
    border-color: var(--sf-input-focus);
    box-shadow: 0 0 0 4px var(--sf-focus-ring);
}

.form-options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.9rem;
}

.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: #334155;
}

.checkbox input {
    width: 16px;
    height: 16px;
    accent-color: #2563eb;
}

.form-options a,
.auth-card__footer a {
    color: #1d4ed8;
    text-decoration: none;
    font-weight: 600;
}

.form-options a:hover,
.auth-card__footer a:hover {
    text-decoration: underline;
}

html[data-theme="dark"] .form-options a,
html[data-theme="dark"] .auth-card__footer a {
    color: #60a5fa;
}
html[data-theme="dark"] .theme-toggle:focus-visible,
html[data-theme="dark"] .password-toggle:focus-visible,
html[data-theme="dark"] .btn-primary:focus-visible,
html[data-theme="dark"] .form-options a:focus-visible,
html[data-theme="dark"] .auth-card__footer a:focus-visible {
    outline-color: rgba(147, 197, 253, 0.45);
}

.btn-primary {
    margin-top: 0.85rem;
    height: var(--sf-btn-height);
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: var(--sf-btn-radius);
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    font-size: var(--sf-btn-font-size);
    font-weight: 700;
    text-align: center;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary .btn-loader {
    display: none;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.btn-primary.is-loading .btn-label {
    display: none;
}

.btn-primary.is-loading .btn-loader {
    display: inline-block;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 20px rgba(37, 99, 235, 0.24);
}

.btn-primary:active {
    transform: translateY(0);
}

.auth-card__footer {
    margin: 1.2rem 0 0;
    color: #64748b;
    text-align: center;
    font-size: 0.93rem;
}

html[data-theme="dark"] .input-wrap .input-icon,
html[data-theme="dark"] .password-wrap .input-icon {
    color: #94a3b8;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes riseIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

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

@media (max-width: 980px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-showcase {
        padding: 2rem 1.2rem 0.6rem;
    }

    .auth-panel {
        padding: 0.6rem 1rem 1.4rem;
    }

    .auth-metrics {
        grid-template-columns: 1fr 1fr;
    }

    .avatar-cluster {
        margin-bottom: 0.4rem;
    }
}

@media (max-width: 580px) {
    .auth-showcase h1 {
        font-size: 1.65rem;
    }

    .auth-showcase p {
        font-size: 0.95rem;
        line-height: 1.55;
    }

    .auth-metrics {
        grid-template-columns: 1fr;
    }

    .auth-card {
        border-radius: 1rem;
        padding: 1.1rem;
    }

    .form-options {
        flex-direction: column;
        align-items: flex-start;
    }

    .auth-card__footer {
        text-align: left;
    }
}

.auth-shell--narrow {
    grid-template-columns: 1fr;
    place-items: center;
    padding: 2rem 1rem;
}

.auth-panel--full {
    width: min(480px, 100%);
    padding: 0;
}

.auth-card__header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

/* ——— Première connexion portail (change-password) ——— */
.auth-shell--portal-change {
    min-height: 100vh;
}

.auth-showcase--portal-change h1 {
    font-size: clamp(1.45rem, 3vw, 2rem);
    margin-bottom: 0.75rem;
}

.auth-portal-kicker {
    display: inline-block;
    margin: 0 0 0.5rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    background: rgba(37, 99, 235, 0.12);
    color: #1d4ed8;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

html[data-theme="dark"] .auth-portal-kicker {
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
}

.auth-steps {
    list-style: none;
    margin: 1.25rem 0 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.auth-steps__item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    color: #64748b;
    font-size: 0.92rem;
}

.auth-steps__item.is-done {
    color: #166534;
}

.auth-steps__item.is-active {
    color: #0f172a;
    font-weight: 600;
}

html[data-theme="dark"] .auth-steps__item.is-active {
    color: #f1f5f9;
}

.auth-steps__num {
    flex: 0 0 1.65rem;
    height: 1.65rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    background: #e2e8f0;
    color: #334155;
}

.auth-steps__item.is-done .auth-steps__num {
    background: #dcfce7;
    color: #166534;
}

.auth-steps__item.is-active .auth-steps__num {
    background: #2563eb;
    color: #fff;
}

.auth-login-recap {
    margin-top: 1.25rem;
    padding: 0.85rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid #dbe5f3;
    background: #f8fafc;
}

.auth-login-recap__label {
    display: block;
    font-size: 0.78rem;
    color: #64748b;
    margin-bottom: 0.35rem;
}

.auth-login-recap__value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #0f172a;
    word-break: break-all;
}

html[data-theme="dark"] .auth-login-recap {
    border-color: #334155;
    background: rgba(15, 23, 42, 0.65);
}

html[data-theme="dark"] .auth-login-recap__value {
    color: #f8fafc;
}

.auth-card--change-password .form-hint--boxed {
    margin: 0 0 1rem;
    padding: 0.75rem 0.9rem;
    border-radius: 0.65rem;
    border: 1px solid #bfdbfe;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 0.88rem;
    line-height: 1.45;
}

html[data-theme="dark"] .auth-card--change-password .form-hint--boxed {
    border-color: #1e40af;
    background: rgba(30, 58, 138, 0.25);
    color: #bfdbfe;
}

.form-alert--info {
    border-color: #93c5fd;
    background: #eff6ff;
    color: #1e40af;
}

html[data-theme="dark"] .form-alert--info {
    border-color: #1d4ed8;
    background: rgba(30, 64, 175, 0.25);
    color: #bfdbfe;
}

.auth-card__footer--stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-card__footer-note {
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.4;
}

@media (max-width: 960px) {
    .auth-shell--portal-change {
        grid-template-columns: 1fr;
    }

    .auth-showcase--portal-change {
        display: none;
    }
}
