/* Parcours documents, paiements, profil et pages publiques. */
.portal-eyebrow {
    color: var(--portal-primary);
    font-size: .76rem;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.portal-page-heading-simple {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.portal-client-action {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: center;
    padding: 1.15rem;
    border: 1px solid rgba(237, 27, 52, .16);
    border-radius: 1.15rem;
    background: linear-gradient(135deg, rgba(237, 27, 52, .055), rgba(255, 255, 255, .92));
}

.portal-client-action-icon,
.portal-state-summary-icon {
    width: 3rem;
    height: 3rem;
    border-radius: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(237, 27, 52, .09);
    color: var(--portal-primary);
    font-size: 1.15rem;
    flex: 0 0 auto;
}

.portal-simple-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .55rem;
    padding: .45rem;
    border-radius: 1rem;
    background: var(--portal-soft);
    border: 1px solid var(--portal-border);
}

.portal-simple-tab {
    position: relative;
    min-height: 48px;
    padding: .7rem .75rem;
    border-radius: .78rem;
    color: var(--portal-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    font-weight: 750;
    text-decoration: none !important;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.portal-simple-tab:hover {
    color: var(--portal-dark);
    background: rgba(255, 255, 255, .72);
}

.portal-simple-tab.active {
    color: var(--portal-primary);
    background: #fff;
    box-shadow: 0 6px 18px rgba(17, 24, 39, .06);
}

.portal-document-grid,
.portal-payment-list,
.portal-signature-list,
.portal-line-list {
    display: grid;
    gap: .8rem;
}

.portal-resource-card,
.portal-line-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 1.1rem;
    box-shadow: 0 5px 16px rgba(17, 24, 39, .035);
}

.portal-resource-card-muted {
    background: var(--portal-soft);
}

.portal-resource-card-icon {
    width: 2.8rem;
    height: 2.8rem;
    border-radius: .9rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(237, 27, 52, .075);
    color: var(--portal-primary);
    font-size: 1rem;
    flex: 0 0 auto;
}

.portal-resource-card-body {
    min-width: 0;
}

.portal-resource-card-kicker {
    margin-bottom: .15rem;
    color: var(--portal-muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.portal-resource-card-title {
    margin: 0;
    color: var(--portal-dark);
    font-size: 1rem;
    font-weight: 820;
    line-height: 1.3;
}

.portal-resource-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem .85rem;
    margin-top: .3rem;
    color: var(--portal-muted);
    font-size: .82rem;
}

.portal-resource-card-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: .45rem;
}

.portal-resource-card-actions form {
    margin: 0;
}

.portal-status-badge {
    min-height: 1.65rem;
    display: inline-flex;
    align-items: center;
    padding-inline: .7rem;
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .02em;
}

.portal-resource-card.is-problem,
.portal-state-summary.is-problem {
    border-color: #efc8cf;
    background: var(--portal-danger-soft);
}

.portal-resource-card.is-problem .portal-resource-card-icon,
.portal-state-summary.is-problem .portal-state-summary-icon {
    color: var(--portal-danger);
    background: rgba(185, 28, 28, .09);
}

.portal-resource-card.is-processing,
.portal-state-summary.is-processing {
    background: #f4f9ff;
    border-color: #bdd7f5;
}

.portal-resource-card.is-processing .portal-resource-card-icon,
.portal-state-summary.is-processing .portal-state-summary-icon,
.portal-resource-card.is-processing .portal-alert-text {
    color: #1d5f9e;
}

.portal-client-payment-amount,
.portal-state-summary-amount {
    margin-top: .25rem;
    font-size: 1.35rem;
    font-weight: 850;
    letter-spacing: -.025em;
}

.portal-alert-text {
    color: var(--portal-danger);
    font-size: .88rem;
}

.portal-empty,
.portal-empty-state {
    min-height: 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    padding: 1.5rem !important;
    text-align: center;
    color: var(--portal-muted);
    background: #fafafa !important;
    border: 1px dashed rgba(17, 24, 39, .15);
    border-radius: 1rem;
}

.portal-empty::before {
    content: "\f07b";
    margin-bottom: .2rem;
    color: #a1a1aa;
    font-family: "Font Awesome 6 Free";
    font-size: 1.35rem;
    font-weight: 400;
}

.portal-empty-state > i {
    margin-bottom: .25rem;
    color: #9ca3af;
    font-size: 1.45rem;
}

.portal-empty-state-success > i {
    color: var(--portal-success);
}

.portal-document-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: .7rem;
}

.portal-document-summary > div {
    min-width: 0;
    padding: .9rem 1rem;
    background: var(--portal-soft);
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
}

.portal-document-summary span {
    display: block;
    margin-bottom: .25rem;
    color: var(--portal-muted);
    font-size: .72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.portal-document-summary strong {
    display: block;
    overflow-wrap: anywhere;
}

.portal-document-summary-total {
    background: rgba(237, 27, 52, .055) !important;
    border-color: rgba(237, 27, 52, .14) !important;
}

.portal-note-box,
.portal-state-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: center;
    padding: 1rem;
    border-radius: 1rem;
    background: var(--portal-soft);
    border: 1px solid var(--portal-border);
}

.portal-note-box {
    grid-template-columns: auto minmax(0, 1fr);
}

.portal-note-box > i {
    color: var(--portal-primary);
}

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

.portal-download-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: .8rem;
    align-items: center;
    min-height: 74px;
    padding: .9rem 1rem;
    color: var(--portal-dark);
    text-decoration: none !important;
    background: #fff;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.portal-download-card:hover {
    color: var(--portal-dark);
    transform: translateY(-1px);
    border-color: rgba(237, 27, 52, .25);
    box-shadow: var(--portal-shadow-soft);
}

.portal-download-card > i:first-child {
    color: var(--portal-primary);
    font-size: 1.2rem;
}

.portal-download-card small {
    display: block;
    color: var(--portal-muted);
    margin-top: .15rem;
}

.portal-line-card {
    grid-template-columns: minmax(0, 1fr) auto;
    box-shadow: none;
    background: var(--portal-soft);
}

.portal-line-total {
    white-space: nowrap;
}

.portal-state-summary-action {
    align-self: center;
}

@media (max-width: 991.98px) {
    .portal-simple-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .portal-document-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    .portal-dossier-page,
    body.portal-page .portal-card {
        border-radius: 1rem !important;
    }

    .portal-page-heading-simple {
        align-items: stretch;
    }

    .portal-page-heading-simple > .portal-action-group,
    .portal-page-heading-simple > a {
        width: 100%;
    }

    .portal-page-heading-simple > a,
    .portal-page-heading-simple .portal-action-group .btn {
        flex: 1 1 auto;
    }

    .portal-client-action,
    .portal-resource-card,
    .portal-state-summary {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .portal-resource-card-actions,
    .portal-state-summary-action {
        grid-column: 1 / -1;
        width: 100%;
        justify-content: stretch;
    }

    .portal-resource-card-actions .btn,
    .portal-resource-card-actions form,
    .portal-resource-card-actions form .btn,
    .portal-state-summary-action .btn {
        width: 100%;
    }

    .portal-simple-tabs {
        display: flex;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        scrollbar-width: none;
    }

    .portal-simple-tabs::-webkit-scrollbar { display: none; }

    .portal-simple-tab {
        flex: 0 0 auto;
        min-width: 120px;
        scroll-snap-align: start;
    }

    .portal-document-summary,
    .portal-download-grid {
        grid-template-columns: 1fr;
    }

    .portal-line-card {
        grid-template-columns: 1fr;
    }

    .portal-line-total {
        justify-self: end;
        font-size: 1.05rem;
    }
}


/* Simplicité, profils et pages publiques */
.portal-simple-hero {
    display: flex;
    align-items: center;
    gap: 1.2rem;
}
.portal-simple-icon {
    width: 3.4rem;
    height: 3.4rem;
    flex: 0 0 3.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 1.1rem;
    background: rgba(237, 27, 52, .09);
    color: var(--portal-primary);
    font-size: 1.25rem;
}
.portal-profile-summary {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.portal-profile-avatar {
    width: 3.8rem;
    height: 3.8rem;
    border-radius: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--portal-primary);
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
}
.portal-public-payment {
    max-width: 680px;
}
.portal-public-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.portal-payment-amount {
    background: var(--portal-soft);
    border: 1px solid var(--portal-border);
    border-radius: 1.25rem;
}
.portal-payment-amount-value {
    font-size: clamp(2.1rem, 8vw, 3.4rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -.04em;
}
.portal-status-panel {
    display: flex;
    gap: .9rem;
    align-items: flex-start;
    padding: 1rem 1.1rem;
    border-radius: 1rem;
    border: 1px solid transparent;
}
.portal-status-panel > i {
    margin-top: .15rem;
    font-size: 1.15rem;
}
.portal-status-panel p { color: #4b5563; }
.portal-status-success { background: var(--portal-success-soft); border-color: #cce8d8; color: var(--portal-success); }
.portal-status-warning { background: var(--portal-warning-soft); border-color: #efdca3; color: var(--portal-warning); }
.portal-status-neutral { background: #f4f6f8; border-color: #e1e5ea; color: #4b5563; }
.portal-status-danger { background: var(--portal-danger-soft); border-color: #efc8cf; color: var(--portal-danger); }
.portal-payment-button { min-height: 56px; font-weight: 800; }
.portal-secure-note {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: .55rem;
    color: var(--portal-muted);
    font-size: .86rem;
    text-align: center;
}
.portal-page-auth .portal-shell {
    max-width: 720px;
}
.portal-auth-card { max-width: 520px; margin-inline: auto; }
.portal-auth-intro .portal-brand-mark {
    width: 88px;
    height: 88px;
    border-radius: 24px;
}
.portal-auth-intro .portal-brand-mark img {
    max-width: 88px;
    max-height: 88px;
}
.portal-auth-context {
    display: grid;
    gap: .15rem;
    padding: 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: var(--portal-soft);
}
.portal-auth-context span {
    color: var(--portal-muted);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.portal-auth-context small { color: var(--portal-muted); }
.portal-auth-help {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    padding: 1rem;
    border-radius: 1rem;
    background: var(--portal-soft);
    color: #4b5563;
    font-size: .9rem;
}
.portal-auth-help i { color: var(--portal-primary); margin-top: .15rem; }
.portal-result-card {
    max-width: 680px;
    margin-inline: auto;
    text-align: center;
}
.portal-result-icon {
    width: 3.5rem;
    height: 3.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    border-radius: 1.15rem;
    background: var(--portal-info-soft);
    color: var(--portal-info);
    font-size: 1.35rem;
}
.portal-result-card-success .portal-result-icon { color: var(--portal-success); background: var(--portal-success-soft); }
.portal-result-card-warning .portal-result-icon { color: var(--portal-warning); background: var(--portal-warning-soft); }
.portal-result-card-danger .portal-result-icon { color: var(--portal-danger); background: var(--portal-danger-soft); }
.portal-result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .65rem;
}
#stripeSepaElement:empty {
    min-height: 118px;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: linear-gradient(100deg, var(--portal-soft) 20%, #fff 40%, var(--portal-soft) 60%);
    background-size: 220% 100%;
    animation: portal-external-loading 1.6s ease-in-out infinite;
}
@keyframes portal-external-loading {
    to { background-position: -220% 0; }
}
@media (max-width: 575.98px) {
    .portal-simple-hero,
    .portal-public-brand { align-items: flex-start; gap: .85rem; }
    .portal-simple-icon { width: 3rem; height: 3rem; flex-basis: 3rem; border-radius: .95rem; }
    .portal-public-payment .portal-card { padding: 1.25rem !important; }
    .portal-profile-summary { align-items: flex-start; }
    .portal-result-actions { display: grid; }
    .portal-result-actions .btn { width: 100%; }
}

/* Échéances futures repliables. */
.portal-future-payments {
    overflow: hidden;
    border: 1px solid rgba(15, 23, 42, .09);
    border-radius: 18px;
    background: rgba(248, 250, 252, .92);
}

.portal-future-payments-toggle {
    position: absolute;
    inline-size: 1px;
    block-size: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.portal-future-payments-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    min-height: 58px;
    margin: 0;
    padding: 14px 18px;
    color: var(--portal-text);
    font-weight: 700;
    cursor: pointer;
    transition: background-color .18s ease, color .18s ease;
}

.portal-future-payments-label > span:first-child {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.portal-future-payments-label:hover,
.portal-future-payments-toggle:focus-visible + .portal-future-payments-label {
    background: rgba(237, 27, 52, .055);
}

.portal-future-payments-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    height: 30px;
    padding: 0 9px;
    border: 1px solid rgba(15, 23, 42, .09);
    border-radius: 999px;
    background: #fff;
    color: var(--portal-muted);
    font-size: .82rem;
    line-height: 1;
}

.portal-future-payments-content {
    display: none;
    padding: 0 18px 18px;
    border-top: 1px solid rgba(15, 23, 42, .07);
}

.portal-future-payments-toggle:checked ~ .portal-future-payments-content {
    display: block;
    padding-top: 18px;
}

.portal-future-payments-toggle:checked + .portal-future-payments-label {
    background: rgba(237, 27, 52, .04);
}

/* Règlement groupé des échéances. */
.portal-payment-group-card {
    padding: 1.15rem;
    border: 1px solid rgba(237, 27, 52, .18);
    border-radius: 1.15rem;
    background: linear-gradient(180deg, rgba(237, 27, 52, .035), #fff 56%);
}

.portal-payment-group-heading,
.portal-payment-group-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.portal-payment-group-options { display: grid; gap: .65rem; margin: 1rem 0; }

.portal-payment-group-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .8rem;
    padding: .8rem .9rem;
    border: 1px solid var(--portal-border);
    border-radius: .85rem;
    background: #fff;
    cursor: pointer;
}

.portal-payment-group-option:hover { border-color: rgba(207, 21, 43, .45); }
.portal-payment-group-option:has(.form-check-input:checked) {
    border-color: rgba(207, 21, 43, .55);
    box-shadow: 0 0 0 3px rgba(207, 21, 43, .09);
}

.portal-payment-group-option-main { display: flex; min-width: 0; flex-direction: column; }
.portal-payment-group-option-main small { color: var(--portal-muted); }
.portal-payment-group-option-amount,
.portal-payment-group-total { font-weight: 750; white-space: nowrap; }
.portal-payment-group-total { font-size: 1.2rem; }
.portal-payment-group-feedback { border-radius: .9rem; }

.portal-client-payment-group {
    border-color: rgba(13, 110, 253, .2);
    background: linear-gradient(110deg, rgba(13, 110, 253, .045), #fff 42%);
}

.portal-client-payment-group .portal-resource-card-icon { color: #0d6efd; background: rgba(13, 110, 253, .09); }

.portal-automatic-payment-group-details > summary,
.portal-custom-payment-group > summary {
    color: var(--portal-dark);
    font-weight: 750;
    cursor: pointer;
}

.portal-automatic-payment-group-details > summary {
    width: fit-content;
    color: var(--portal-primary);
    font-size: .84rem;
}

.portal-automatic-payment-group-list {
    display: grid;
    gap: .45rem;
    margin-top: .65rem;
    padding-top: .65rem;
    border-top: 1px solid var(--portal-border);
}

.portal-automatic-payment-group-line {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: .75rem;
    font-size: .84rem;
}

.portal-automatic-payment-group-line > span { display: flex; min-width: 0; flex-direction: column; }
.portal-automatic-payment-group-line small { color: var(--portal-muted); }
.portal-automatic-payment-group-line a { color: var(--portal-primary); font-weight: 700; }

.portal-custom-payment-group {
    padding: .75rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: #fff;
}

.portal-custom-payment-group > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    list-style: none;
}

.portal-custom-payment-group > summary::-webkit-details-marker { display: none; }
.portal-custom-payment-group > summary small { color: var(--portal-muted); font-weight: 500; }
.portal-custom-payment-group[open] { padding-bottom: 1rem; }

.portal-dossier-payments .portal-payment-list { gap: .55rem; }
.portal-dossier-payments .portal-resource-card-payment {
    gap: .8rem;
    padding: .85rem 1rem;
    border-radius: .9rem;
    box-shadow: none;
}

.portal-dossier-payments .portal-resource-card-payment.is-problem {
    border-color: var(--portal-border) !important;
    background: #fff !important;
    box-shadow: inset 3px 0 0 var(--portal-danger);
}

.portal-dossier-payments .portal-resource-card-icon { width: 2.35rem; height: 2.35rem; border-radius: .72rem; }
.portal-dossier-payments .portal-client-payment-amount { margin-top: .15rem; font-size: 1.2rem; }
.portal-dossier-payments .portal-resource-card-meta { margin-top: .15rem; }
.portal-dossier-payments .portal-resource-card-actions { flex-wrap: nowrap; }

.portal-payment-detail-link {
    padding: .45rem .2rem;
    color: var(--portal-muted);
    font-size: .86rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.portal-payment-detail-link:hover { color: var(--portal-dark); text-decoration: underline; }
.portal-payment-tools { padding: .85rem 1rem; background: var(--portal-soft); }
.portal-payment-tools[open] { background: #fff; }
.portal-payment-tools > summary small { display: inline-flex; align-items: center; }
.portal-payment-tools > summary .fa-chevron-down { transition: transform .16s ease; }
.portal-payment-tools[open] > summary .fa-chevron-down { transform: rotate(180deg); }
.portal-payment-tools .portal-payment-group-card {
    padding: 1rem;
    border-color: var(--portal-border);
    border-radius: .85rem;
    background: #fff;
}

.portal-profile-password-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.portal-profile-password-form .password-visibility-field { width: 100%; }
