.account-page {
    display: grid;
    place-items: start center;
    width: 100%;
    padding-block: clamp(0.5rem, 2vw, 1.5rem);
}

.account-card {
    width: min(100%, 34rem);
    padding: clamp(1.5rem, 4vw, 2.5rem);
    border: 1px solid #dfe3e8;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 1rem 2.5rem rgba(31, 41, 55, 0.08);
}

.account-card__header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.account-card__header h1 {
    margin: 0.25rem 0 0.65rem;
    color: #172033;
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    line-height: 1.15;
}

.account-card__header p {
    margin: 0;
    color: #667085;
    line-height: 1.55;
}

.account-eyebrow {
    color: var(--theme-primary, #337ab7) !important;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.account-form {
    display: grid;
    gap: 1rem;
}

.account-field {
    display: grid;
    gap: 0.45rem;
}

.account-field label,
.account-field__label-row {
    color: #344054;
    font-size: 0.92rem;
    font-weight: 700;
}

.account-field__label-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
}

.account-field__label-row a {
    font-size: 0.84rem;
    font-weight: 600;
}

.account-input {
    width: 100%;
    min-height: 3.1rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #cfd5dd;
    border-radius: 0.65rem;
    background: #ffffff;
    color: #172033;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

.account-input:focus {
    border-color: var(--theme-primary, #337ab7);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary, #337ab7) 18%, transparent);
}

.account-check {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: fit-content;
    color: #475467;
    cursor: pointer;
}

.account-check input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--theme-primary, #337ab7);
}

.account-button,
.external-login-button {
    display: inline-flex;
    width: 100%;
    min-height: 3.1rem;
    align-items: center;
    justify-content: center;
    gap: 0.7rem;
    padding: 0.7rem 1rem;
    border-radius: 0.65rem;
    font-weight: 750;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
}

.account-button--primary {
    border: 1px solid var(--theme-primary, #337ab7);
    background: var(--theme-primary, #337ab7);
    color: var(--theme-primary-contrast, #ffffff);
}

.account-button--primary:hover:not(:disabled) {
    filter: brightness(0.94);
}

.account-button:disabled,
.account-button--busy {
    cursor: wait;
    opacity: 0.68;
}

.account-button--busy::before {
    content: "";
    width: 1rem;
    height: 1rem;
    flex: 0 0 auto;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: account-button-spin 700ms linear infinite;
}

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

.account-button--secondary {
    border: 1px solid #cfd5dd;
    background: #ffffff;
    color: #344054;
}

.account-button--secondary:hover {
    border-color: #98a2b3;
    background: #f8fafc;
    color: #172033;
}

.account-passkey {
    margin-top: -0.15rem;
}

.account-separator {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-block: 1.35rem;
    color: #98a2b3;
    font-size: 0.8rem;
    white-space: nowrap;
}

.account-separator::before,
.account-separator::after {
    content: "";
    height: 1px;
    flex: 1 1 auto;
    background: #e4e7ec;
}

.account-card__footer {
    display: grid;
    justify-items: center;
    gap: 0.45rem;
    margin-top: 1.6rem;
    padding-top: 1.35rem;
    border-top: 1px solid #e4e7ec;
    text-align: center;
}

.account-card__footer p {
    margin: 0;
    color: #667085;
}

.account-create-link {
    font-weight: 750;
}

.account-subtle-link {
    margin-top: 0.3rem;
    color: #667085;
    font-size: 0.84rem;
}

.account-validation,
.account-validation-summary {
    color: #b42318;
    font-size: 0.86rem;
}

.account-validation-summary ul {
    margin: 0 0 0.8rem;
    padding-left: 1.2rem;
}

.external-login-form,
.external-login-placeholder {
    display: grid;
    gap: 0.65rem;
}

.external-login-button {
    border: 1px solid #cfd5dd;
    background: #ffffff;
    color: #172033;
}

.external-login-button:hover:not(:disabled) {
    border-color: #98a2b3;
    background: #f8fafc;
}

.external-login-button:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.external-login-button__icon {
    display: grid;
    width: 1.65rem;
    height: 1.65rem;
    place-items: center;
    border: 1px solid #d0d5dd;
    border-radius: 50%;
    background: #ffffff;
    color: #344054;
    font-weight: 850;
}

.external-login-placeholder p {
    margin: 0;
    color: #667085;
    font-size: 0.82rem;
    line-height: 1.45;
    text-align: center;
}

@media (max-width: 640px) {
    .account-page {
        padding-block: 0;
    }

    .account-card {
        padding: 1.35rem 1rem;
        border-radius: 0.8rem;
        box-shadow: 0 0.5rem 1.5rem rgba(31, 41, 55, 0.06);
    }

    .account-field__label-row {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.25rem;
    }

    .account-separator {
        font-size: 0.75rem;
    }
}

/* --------------------------------------------------------------------------
   Espace utilisateur personnalise
   -------------------------------------------------------------------------- */

.municipal-account {
    display: grid;
    gap: 1.25rem;
    padding-block: clamp(1rem, 3vw, 2.5rem);
}

.municipal-account__hero {
    padding: clamp(1.5rem, 3vw, 2.2rem);
    border: 1px solid #e1e7ef;
    border-radius: 1rem;
    background: linear-gradient(135deg, #ffffff 0%, #f7f9fc 100%);
    box-shadow: 0 0.9rem 2.2rem rgba(15, 23, 42, 0.05);
}

.municipal-account__eyebrow {
    color: var(--theme-primary, #337ab7);
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.municipal-account__hero h1 {
    margin: 0.35rem 0 0.45rem;
    color: #172033;
    font-size: clamp(1.9rem, 4vw, 2.55rem);
    line-height: 1.1;
}

.municipal-account__hero p {
    max-width: 48rem;
    margin: 0;
    color: #64748b;
    line-height: 1.6;
}

.municipal-account__navigation {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 0.55rem;
    padding: 0.6rem;
    border: 1px solid #e1e7ef;
    border-radius: 0.95rem;
    background: #ffffff;
    box-shadow: 0 0.8rem 1.8rem rgba(15, 23, 42, 0.05);
}

.municipal-account__navigation-title {
    flex: 0 0 auto;
    padding: 0 0.55rem;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.municipal-account__nav-item {
    display: inline-grid;
    grid-template-columns: 2.2rem minmax(0, auto);
    min-width: 0;
    align-items: center;
    gap: 0.65rem;
    padding: 0.62rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 0.75rem;
    color: #475569 !important;
    text-decoration: none !important;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.municipal-account__nav-item:hover {
    border-color: #e2e8f0;
    background: #f8fafc;
    color: #172033 !important;
    text-decoration: none !important;
}

.municipal-account__nav-item.active {
    border-color: color-mix(in srgb, var(--theme-primary, #337ab7) 28%, #dce4ec);
    background: color-mix(in srgb, var(--theme-primary, #337ab7) 10%, #ffffff);
    color: var(--theme-primary, #337ab7) !important;
    box-shadow: inset 0 -3px 0 var(--theme-primary, #337ab7);
}

.municipal-account__nav-icon {
    display: grid;
    width: 2.2rem;
    height: 2.2rem;
    place-items: center;
    border-radius: 0.65rem;
    background: #f1f5f9;
    color: #64748b;
}

.municipal-account__nav-item.active .municipal-account__nav-icon {
    background: color-mix(in srgb, var(--theme-primary, #337ab7) 14%, #ffffff);
    color: var(--theme-primary, #337ab7);
}

.municipal-account__nav-icon svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.municipal-account__nav-item > span:last-child {
    display: grid;
    min-width: 0;
    gap: 0.08rem;
}

.municipal-account__nav-item strong {
    color: inherit;
    font-size: 0.91rem;
    font-weight: 800;
    line-height: 1.2;
}

.municipal-account__nav-item small {
    color: #8491a3;
    font-size: 0.7rem;
    line-height: 1.25;
}

.municipal-account__back {
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.45rem;
    margin-left: auto;
    padding: 0.7rem 0.8rem;
    border-radius: 0.65rem;
    color: #64748b !important;
    font-size: 0.8rem;
    font-weight: 750;
    text-decoration: none !important;
}

.municipal-account__back:hover {
    background: #f8fafc;
    color: var(--theme-primary, #337ab7) !important;
}

.municipal-account__content {
    min-width: 0;
}

.municipal-profile {
    display: grid;
    grid-template-columns: minmax(18rem, 21rem) minmax(0, 1fr);
    align-items: start;
    gap: 1rem;
}

.municipal-profile__validation {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.8rem 0.95rem;
    border: 1px solid #f1b7b7;
    border-radius: 0.7rem;
    background: #fff1f1;
    color: #991b1b;
    font-size: 0.82rem;
}

.municipal-profile__validation:empty {
    display: none;
}

.municipal-profile__identity,
.municipal-profile__details {
    min-width: 0;
    border: 1px solid #e1e7ef;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 0.8rem 2rem rgba(15, 23, 42, 0.045);
}

.municipal-profile__identity {
    display: grid;
    gap: 1rem;
    padding: 1rem;
}

.municipal-profile__identity-current {
    display: grid;
    justify-items: center;
    padding: 0.25rem 0.25rem 0.95rem;
    border-bottom: 1px solid #edf1f5;
    text-align: center;
}

.municipal-profile__identity-current > img {
    display: block;
    width: 7rem;
    height: 7rem;
    border: 3px solid color-mix(in srgb, var(--theme-primary, #337ab7) 32%, #ffffff);
    border-radius: 1rem;
    background: #f8fafc;
    object-fit: cover;
    box-shadow: 0 0.55rem 1.4rem rgba(15, 23, 42, 0.11);
}

.municipal-profile__identity-current > span {
    margin-top: 0.65rem;
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 750;
}

.municipal-profile__identity-current > strong {
    margin-top: 0.16rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #172033;
    font-size: 1.08rem;
    line-height: 1.2;
}

.municipal-profile__identity-current > small {
    margin-top: 0.15rem;
    max-width: 100%;
    overflow-wrap: anywhere;
    color: #64748b;
    font-size: 0.73rem;
}

.municipal-profile__avatar-section {
    display: grid;
    gap: 0.75rem;
}

.municipal-profile__section-heading h2 {
    margin: 0 0 0.18rem;
    color: #172033;
    font-size: 0.95rem;
}

.municipal-profile__section-heading p {
    margin: 0;
    color: #718096;
    font-size: 0.72rem;
    line-height: 1.4;
}

.municipal-profile__avatar-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.45rem;
}

.municipal-profile__avatar-choice {
    position: relative;
    display: block;
    min-width: 0;
    padding: 0.12rem;
    border: 2px solid transparent;
    border-radius: 0.65rem;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}

.municipal-profile__avatar-choice:hover {
    border-color: color-mix(in srgb, var(--theme-primary, #337ab7) 32%, #dbe3ec);
    transform: translateY(-1px);
}

.municipal-profile__avatar-choice:has(input:checked) {
    border-color: var(--theme-primary, #337ab7);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--theme-primary, #337ab7) 14%, transparent);
}

.municipal-profile__avatar-choice > input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.municipal-profile__avatar-choice > img {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 0.5rem;
    background: #ffffff;
    object-fit: cover;
}

.municipal-profile__avatar-check {
    position: absolute;
    right: 0.2rem;
    bottom: 0.2rem;
    display: none;
    width: 1.1rem;
    height: 1.1rem;
    place-items: center;
    border: 2px solid #ffffff;
    border-radius: 50%;
    background: var(--theme-primary, #337ab7);
    color: var(--theme-primary-contrast, #ffffff);
    font-size: 0.65rem;
    font-weight: 900;
}

.municipal-profile__avatar-choice:has(input:checked) .municipal-profile__avatar-check {
    display: grid;
}

.municipal-profile__details {
    display: grid;
    gap: 1.25rem;
    padding: clamp(1.2rem, 3vw, 1.65rem);
}

.municipal-profile__details-header {
    display: grid;
    gap: 0.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #edf1f5;
}

.municipal-profile__details-header > span {
    color: var(--theme-primary, #337ab7);
    font-size: 0.71rem;
    font-weight: 850;
    letter-spacing: 0.08em;
}

.municipal-profile__details-header h2 {
    margin: 0;
    color: #172033;
    font-size: 1.4rem;
}

.municipal-profile__details-header p {
    max-width: 44rem;
    margin: 0;
    color: #64748b;
    font-size: 0.84rem;
    line-height: 1.55;
}

.municipal-profile__fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.municipal-profile__field {
    display: grid;
    min-width: 0;
    gap: 0.4rem;
}

.municipal-profile__field:first-child {
    grid-column: 1 / -1;
}

.municipal-profile__field label {
    color: #334155;
    font-size: 0.84rem;
    font-weight: 800;
}

.municipal-profile__field label > span {
    margin-left: 0.25rem;
    color: #94a3b8;
    font-size: 0.72rem;
    font-weight: 650;
}

.municipal-profile__field input {
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    background: #ffffff;
    color: #172033;
    box-sizing: border-box;
    font: inherit;
    outline: none;
}

.municipal-profile__field input:focus {
    border-color: var(--theme-primary, #337ab7);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--theme-primary, #337ab7) 16%, transparent);
}

.municipal-profile__field input[readonly] {
    background: #f8fafc;
    color: #64748b;
}

.municipal-profile__field small {
    color: #718096;
    font-size: 0.73rem;
    line-height: 1.4;
}

.municipal-profile__field .validation-message {
    color: #b42318;
    font-size: 0.78rem;
}

.municipal-profile__actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid #edf1f5;
}

.municipal-profile__actions button {
    min-height: 3rem;
    padding: 0.72rem 1.15rem;
    border: 1px solid var(--theme-primary, #337ab7);
    border-radius: 0.7rem;
    background: var(--theme-primary, #337ab7);
    color: var(--theme-primary-contrast, #ffffff);
    box-shadow: 0 0.45rem 1.1rem rgba(15, 23, 42, 0.11);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.municipal-profile__actions button:hover {
    filter: brightness(0.95);
}

.municipal-account .alert {
    margin: 0 0 1rem;
    padding: 0.8rem 0.95rem;
    border: 1px solid #b7dfc5;
    border-radius: 0.7rem;
    background: #effaf2;
    color: #166534;
}

.municipal-account .alert-danger {
    border-color: #f1b7b7;
    background: #fff1f1;
    color: #991b1b;
}

.municipal-account .password-page {
    display: grid;
    width: min(100%, 50rem);
    margin-inline: auto;
    gap: 1.25rem;
    padding: clamp(1.2rem, 3vw, 1.75rem);
    border: 1px solid #e1e7ef;
    border-radius: 1rem;
    background: #ffffff;
    box-shadow: 0 0.8rem 2rem rgba(15, 23, 42, 0.045);
    box-sizing: border-box;
}

.municipal-account .password-intro {
    display: grid;
    gap: 0.3rem;
}

.municipal-account .password-intro h2 {
    margin: 0;
    color: #172033;
    font-size: 1.4rem;
}

.municipal-account .password-intro p {
    max-width: 42rem;
    margin: 0;
    color: #64748b;
    line-height: 1.55;
}

.municipal-account .password-form {
    display: grid;
    gap: 1rem;
}

.municipal-account .password-field {
    display: grid;
    gap: 0.4rem;
}

.municipal-account .password-field label {
    color: #334155;
    font-size: 0.84rem;
    font-weight: 800;
}

.municipal-account .password-input {
    width: 100%;
    min-height: 3rem;
    padding: 0.7rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.65rem;
    background: #ffffff;
    color: #172033;
    box-sizing: border-box;
    font: inherit;
}

.municipal-account .password-input:focus {
    border-color: var(--theme-primary, #337ab7);
    outline: 3px solid color-mix(in srgb, var(--theme-primary, #337ab7) 16%, transparent);
    outline-offset: 1px;
}

.municipal-account .password-submit {
    width: fit-content;
    min-height: 3rem;
    padding: 0.7rem 1rem;
    border: 1px solid var(--theme-primary, #337ab7);
    border-radius: 0.7rem;
    background: var(--theme-primary, #337ab7);
    color: var(--theme-primary-contrast, #ffffff);
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

@media (max-width: 880px) {
    .municipal-account__navigation {
        flex-wrap: wrap;
    }

    .municipal-account__navigation-title {
        width: 100%;
        padding-block: 0.2rem;
    }

    .municipal-account__back {
        margin-left: 0;
    }

    .municipal-profile {
        grid-template-columns: minmax(16rem, 18rem) minmax(0, 1fr);
    }
}

@media (max-width: 760px) {
    .municipal-profile {
        grid-template-columns: 1fr;
    }

    .municipal-profile__avatar-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .municipal-account__navigation {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .municipal-account__navigation-title,
    .municipal-account__back {
        grid-column: 1 / -1;
    }

    .municipal-account__nav-item {
        width: 100%;
        box-sizing: border-box;
    }

    .municipal-profile__fields {
        grid-template-columns: 1fr;
    }

    .municipal-profile__field:first-child {
        grid-column: auto;
    }

    .municipal-profile__avatar-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .municipal-profile__actions button,
    .municipal-account .password-submit {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .municipal-account__navigation {
        grid-template-columns: 1fr;
    }

    .municipal-account__navigation-title,
    .municipal-account__back {
        grid-column: auto;
    }
}
