:root {
    --portal-bg: #f3f4f6;
    --portal-dark: #111827;
    --portal-dark-2: #1f2937;
    --portal-card: #ffffff;
    --portal-soft: #f7f7f9;
    --portal-soft-2: #eeeeef;
    --portal-border: rgba(17, 24, 39, .09);
    --portal-primary: #ed1b34;
    --bs-primary: #ed1b34;
    --bs-primary-rgb: 237, 27, 52;
    --portal-muted: #6b7280;
    --portal-shadow: 0 18px 45px rgba(17, 24, 39, .07);
    --portal-shadow-soft: 0 8px 22px rgba(17, 24, 39, .055);
    --portal-radius: 1.35rem;
}

* {
    box-sizing: border-box;
}

html,
body.portal-page {
    min-height: 100vh;
    background: var(--portal-bg) !important;
    color: var(--portal-dark) !important;
    font-size: 15px;
}

body.portal-page {
    margin: 0;
}

body.portal-page a {
    text-decoration-thickness: from-font;
}

.portal-shell {
    max-width: 1440px;
}

.portal-topbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    background: rgba(15, 23, 42, .98) !important;
    color: #fff !important;
    box-shadow: 0 10px 28px rgba(15, 23, 42, .18);
}

.portal-topbar-inner {
    min-height: 72px;
    width: min(100% - 2rem, 1440px);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.portal-brand,
.portal-brand:hover,
.portal-brand:focus {
    color: #fff !important;
    text-decoration: none;
}

.portal-brand-logo {
    display: block;
    width: auto;
    max-width: 220px;
    max-height: 38px;
}

body.portal-page .portal-app-shell {
    width: min(100% - 2rem, 1440px) !important;
    margin: 1.55rem auto 2rem !important;
    display: grid !important;
    grid-template-columns: 285px minmax(0, 1fr) !important;
    gap: 1.55rem !important;
    align-items: start !important;
    background: transparent !important;
    color: var(--portal-dark) !important;
}

body.portal-page .portal-sidebar {
    min-height: calc(100vh - 72px - 3.1rem);
    position: sticky;
    top: calc(72px + 1.55rem);
    background: var(--portal-card) !important;
    color: var(--portal-dark) !important;
    border: 1px solid var(--portal-border) !important;
    border-radius: var(--portal-radius) !important;
    box-shadow: var(--portal-shadow-soft) !important;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.portal-side-nav {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

body.portal-page .portal-side-link {
    display: flex;
    align-items: center;
    gap: .85rem;
    min-height: 48px;
    padding: .82rem .95rem;
    color: #4b5563 !important;
    text-decoration: none;
    border-radius: .9rem;
    font-weight: 700;
    background: transparent !important;
    transition: background-color .15s ease, color .15s ease, transform .15s ease;
}

.portal-side-link i {
    width: 1.15rem;
    text-align: center;
    color: #8b8f98;
}

body.portal-page .portal-side-link:hover,
body.portal-page .portal-side-link.active {
    color: var(--portal-dark) !important;
    background: #f0f0f2 !important;
    transform: translateX(2px);
}

.portal-side-link.active i,
.portal-side-link:hover i {
    color: var(--portal-primary);
}

.portal-sidebar-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    padding-top: 1rem;
}

.portal-side-link-logout {
    color: #6b7280 !important;
}


body.portal-page .portal-main {
    min-width: 0;
    display: block;
    background: transparent !important;
    color: var(--portal-dark) !important;
}

body.portal-page .portal-main > section + section,
body.portal-page .portal-main > article + section,
body.portal-page .portal-main > .portal-card + .portal-card {
    margin-top: 1.25rem;
}

body.portal-page .portal-card {
    background: var(--portal-card) !important;
    color: var(--portal-dark) !important;
    border: 1px solid var(--portal-border) !important;
    border-radius: var(--portal-radius) !important;
    box-shadow: var(--portal-shadow-soft) !important;
}

body.portal-page .portal-card-soft {
    background: var(--portal-soft) !important;
    color: var(--portal-dark) !important;
    border: 1px solid var(--portal-border) !important;
    border-radius: 1rem !important;
}

.portal-hero {
    padding: 1.35rem;
    background: #fff !important;
}

.portal-hero-identity {
    min-height: 220px;
    position: relative;
    overflow: hidden;
}

.portal-hero-identity::after {
    content: "";
    position: absolute;
    right: -4.5rem;
    bottom: -5rem;
    width: 18rem;
    height: 18rem;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(237, 27, 52, .12), rgba(237, 27, 52, 0) 68%);
    pointer-events: none;
}

.portal-muted {
    color: var(--portal-muted) !important;
}

.portal-brand-mark {
    width: 128px;
    height: 128px;
    border-radius: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
}

.portal-brand-mark img {
    max-width: 128px;
    max-height: 128px;
    display: block;
}

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

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

.portal-info-item-wide {
    grid-column: 1 / -1;
}

body.portal-page .portal-info-item {
    padding: .92rem 1rem;
    background: var(--portal-soft) !important;
    color: var(--portal-dark) !important;
    border: 1px solid var(--portal-border) !important;
    border-radius: 1rem;
}

.portal-info-label {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--portal-muted) !important;
    font-weight: 800;
    margin-bottom: .28rem;
}

.portal-info-value {
    font-weight: 500;
    min-width: 0;
    overflow-wrap: break-word;
}

.portal-nowrap-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.min-w-0 { min-width: 0; }

.portal-address {
    display: grid;
    gap: .18rem;
    color: var(--portal-dark);
    font-weight: 500;
    line-height: 1.45;
}

.portal-mini-action {
    width: 2.25rem;
    height: 2.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.portal-section-title {
    font-weight: 850;
    letter-spacing: -.02em;
}

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

body.portal-page .portal-quick-link {
    min-height: 54px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .9rem;
    padding: .9rem 1.05rem;
    background: #fff !important;
    border: 1px solid var(--portal-border) !important;
    border-radius: 1rem;
    color: var(--portal-dark) !important;
    text-decoration: none;
    font-weight: 750;
    box-shadow: var(--portal-shadow-soft);
}

.portal-quick-link:hover {
    color: var(--portal-primary) !important;
    background: #fafafa !important;
}

.portal-quick-link i:first-child {
    color: #8b8f98;
}

.portal-invoice-list {
    display: flex;
    flex-direction: column;
    gap: .55rem;
}

body.portal-page .portal-invoice-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 1rem;
    align-items: center;
    min-height: 48px;
    padding: .72rem .95rem;
    background: var(--portal-soft-2) !important;
    color: var(--portal-dark) !important;
    border-radius: .92rem;
}

.portal-invoice-row strong,
.portal-nowrap {
    white-space: nowrap;
}

.portal-table {
    margin-bottom: 0;
}

.portal-table thead th {
    color: var(--portal-muted) !important;
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.portal-table td,
.portal-table th {
    vertical-align: middle;
}

.portal-tabs .nav-link {
    border-radius: 999px;
    color: #4b5563;
    font-weight: 800;
    padding: .62rem 1rem;
}

.portal-tabs .nav-link.active {
    background: var(--portal-dark) !important;
    color: #fff !important;
}

body.portal-page .portal-empty {
    border: 1px dashed rgba(100, 116, 139, .35) !important;
    border-radius: 1.2rem;
    background: rgba(248, 250, 252, .75) !important;
    color: var(--portal-muted) !important;
}

.form-control,
.form-select,
.btn {
    border-radius: .95rem;
}

.form-label {
    font-weight: 600;
}

.btn-primary {
    font-weight: 700;
    box-shadow: 0 10px 22px rgba(237, 27, 52, .20);
}


/* R13E.11 — couleur primaire officielle Maxima Design. */
body.portal-page .text-primary {
    color: var(--portal-primary) !important;
}
body.portal-page .btn-primary {
    background-color: var(--portal-primary) !important;
    border-color: var(--portal-primary) !important;
    color: #fff !important;
}
body.portal-page .btn-primary:hover,
body.portal-page .btn-primary:focus {
    background-color: #d9162d !important;
    border-color: #d9162d !important;
    color: #fff !important;
}
body.portal-page .btn-outline-primary {
    color: var(--portal-primary) !important;
    border-color: var(--portal-primary) !important;
}
body.portal-page .btn-outline-primary:hover,
body.portal-page .btn-outline-primary:focus {
    background-color: var(--portal-primary) !important;
    border-color: var(--portal-primary) !important;
    color: #fff !important;
}
body.portal-page .portal-greeting {
    color: var(--portal-text) !important;
}
body.portal-page .portal-client-name {
    color: var(--portal-primary) !important;
}

body.portal-page .bg-primary {
    background-color: var(--portal-primary) !important;
}
body.portal-page .border-primary {
    border-color: var(--portal-primary) !important;
}
body.portal-page .text-bg-primary {
    background-color: var(--portal-primary) !important;
    color: #fff !important;
}

.portal-login-card {
    max-width: 460px;
    margin: 0 auto;
}

.portal-pill {
    border-radius: 999px;
}

@media (max-width: 991.98px) {
    .portal-topbar-inner {
        min-height: 68px;
        width: min(100% - 1.4rem, 1440px);
    }

    .portal-brand-logo {
        max-width: 145px;
        max-height: 38px;
    }

    body.portal-page .portal-app-shell {
        display: block !important;
        width: min(100% - 1.4rem, 1440px) !important;
        margin-top: 1rem !important;
    }

    body.portal-page .portal-sidebar {
        position: static;
        min-height: auto;
        margin-bottom: 1rem;
        overflow-x: auto;
    }

    .portal-side-nav {
        flex-direction: row;
        min-width: max-content;
    }

    .portal-side-link {
        white-space: nowrap;
        padding: .72rem .9rem;
    }

    .portal-sidebar-footer {
        display: none;
    }

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

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

@media (max-width: 575.98px) {
    .portal-topbar-inner {
        width: min(100% - 1rem, 1440px);
    }

    .portal-brand-logo {
        max-width: 128px;
        max-height: 34px;
    }

    body.portal-page .portal-app-shell {
        width: min(100% - .9rem, 1440px) !important;
    }

    .portal-info-grid,
    .portal-info-grid-comfort {
        grid-template-columns: 1fr;
    }

    .portal-invoice-row {
        grid-template-columns: 1fr auto;
        gap: .35rem .75rem;
    }

    .portal-invoice-row .portal-invoice-status {
        grid-column: 1 / -1;
    }

    .portal-table-responsive-stack thead {
        display: none;
    }

    .portal-table-responsive-stack tbody,
    .portal-table-responsive-stack tr,
    .portal-table-responsive-stack td {
        display: block;
        width: 100%;
    }

    .portal-table-responsive-stack tr {
        border: 1px solid var(--portal-border);
        border-radius: 1rem;
        padding: .75rem;
        margin-bottom: .75rem;
        background: #fff;
    }

    .portal-table-responsive-stack td {
        border: 0;
        padding: .3rem 0;
    }

    .portal-table-responsive-stack td::before {
        content: attr(data-label);
        display: block;
        color: var(--portal-muted);
        font-size: .72rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: .04em;
        margin-bottom: .1rem;
    }
}

.portal-action-group,
.portal-row-actions {
    display: inline-flex;
    align-items: center;
    gap: .45rem;
    flex-wrap: wrap;
}

.portal-invoice-row-actions {
    grid-template-columns: minmax(0, 1fr) auto auto auto !important;
}

.portal-document-link {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1rem;
    margin-bottom: .65rem;
    border-radius: 1rem;
    background: #fff;
    color: var(--portal-dark) !important;
    border: 1px solid var(--portal-border);
    font-weight: 800;
    text-decoration: none;
}

.portal-document-link:hover {
    color: var(--portal-primary) !important;
    border-color: rgba(237, 27, 52, .28);
}

@media (max-width: 575.98px) {
    .portal-invoice-row-actions {
        grid-template-columns: 1fr !important;
    }

    .portal-row-actions,
    .portal-action-group {
        width: 100%;
        justify-content: stretch !important;
    }

    .portal-row-actions .btn,
    .portal-action-group .btn {
        flex: 1 1 auto;
    }
}

body.portal-page .portal-preview-banner {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: .85rem 1.1rem;
    border-radius: 1rem;
    background: #fff7ed !important;
    border: 1px solid rgba(234, 88, 12, .22) !important;
    color: #9a3412 !important;
    font-weight: 800;
    box-shadow: var(--portal-shadow-soft);
    margin-bottom: 1rem;
}

body.portal-page .portal-preview-banner i {
    color: #ea580c;
}


body.portal-page .portal-info-value strong,
body.portal-page .portal-info-value b {
    font-weight: 650;
}
body.portal-page .portal-info-item {
    min-width: 0;
}
.portal-address span {
    display: block;
}
.portal-topbar .portal-main-site-link {
    font-weight: 650;
    box-shadow: none;
}
.portal-contact-list {
    display: grid;
    gap: .75rem;
}
.portal-contact-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .9rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: var(--portal-soft);
    color: var(--portal-dark);
}
.portal-contact-item i {
    width: 1.2rem;
    color: var(--portal-primary);
    text-align: center;
}
.portal-contact-item a {
    color: var(--portal-dark);
    font-weight: 650;
    text-decoration: none;
}
.portal-contact-item a:hover {
    color: var(--portal-primary);
}
.portal-assistance-actions {
    display: grid;
    gap: .75rem;
}
.portal-assistance-action {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    width: 100%;
    padding: .9rem 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 1rem;
    background: #fff;
    color: var(--portal-dark);
    text-align: left;
    transition: background-color .15s ease, border-color .15s ease, transform .15s ease;
}
.portal-assistance-action:hover {
    background: #f8fafc;
    border-color: rgba(237, 27, 52, .22);
    transform: translateY(-1px);
}
.portal-assistance-action i {
    margin-top: .15rem;
    color: var(--portal-primary);
}
.portal-assistance-action strong {
    display: block;
    font-weight: 700;
}
.portal-assistance-action span {
    display: block;
    color: var(--portal-muted);
    font-size: .88rem;
    margin-top: .12rem;
}
.portal-validation-list {
    display: grid;
    gap: .8rem;
}
.portal-validation-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .9rem;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--portal-border);
    border-radius: 1.05rem;
    background: #fff;
}
.portal-validation-card .portal-validation-title {
    font-weight: 700;
    margin-bottom: .2rem;
}
.portal-validation-card .portal-validation-meta {
    color: var(--portal-muted);
    font-size: .9rem;
}
.portal-highlight-card {
    border: 1px solid rgba(237, 27, 52, .18) !important;
    background: linear-gradient(180deg, rgba(239,246,255,.92), #fff) !important;
}
@media (max-width: 991.98px) {
    .portal-brand-logo {
        max-width: 200px;
        max-height: 35px;
    }
}
@media (max-width: 575.98px) {
    .portal-brand-logo {
        max-width: 172px;
        max-height: 32px;
    }
    .portal-validation-card {
        grid-template-columns: 1fr;
    }
    .portal-validation-card .btn {
        width: 100%;
    }
}


.portal-nav-count,
.portal-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.45rem;
    height: 1.45rem;
    padding: 0 .42rem;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: .72rem;
    line-height: 1;
    font-weight: 800;
    margin-left: auto;
}
.portal-tab-count {
    margin-left: .45rem;
    min-width: 1.35rem;
    height: 1.35rem;
    font-size: .7rem;
    background: #ef4444;
}
.portal-tabs .nav-link.active .portal-tab-count {
    background: rgba(255,255,255,.95);
    color: #dc3545;
}
body.portal-page .form-label {
    color: #334155;
}
body.portal-page .form-text {
    color: var(--portal-muted);
}


body.portal-page .form-control,
body.portal-page .form-select,
body.portal-page textarea.form-control {
    font-size: .95rem;
    line-height: 1.45;
    font-weight: 500;
}
body.portal-page .form-select-lg,
body.portal-page .form-control-lg {
    font-size: .98rem;
}
body.portal-page .portal-card-soft strong,
body.portal-page .portal-table strong,
body.portal-page .portal-invoice-row strong {
    font-weight: 650;
}

.portal-brand-logo {
    max-width: 260px;
    max-height: 44px;
}
body.portal-page .portal-info-label {
    font-weight: 700;
}
body.portal-page .portal-info-value,
body.portal-page .portal-address {
    font-weight: 400;
}
body.portal-page textarea#message.form-control {
    min-height: 20rem;
    resize: vertical;
}
body.portal-page .portal-card-soft strong,
body.portal-page .portal-table strong,
body.portal-page .portal-invoice-row strong,
body.portal-page .portal-validation-title {
    font-weight: 600;
}
@media (max-width: 991.98px) {
    .portal-brand-logo {
        max-width: 230px;
        max-height: 40px;
    }
}
@media (max-width: 575.98px) {
    .portal-brand-logo {
        max-width: 190px;
        max-height: 34px;
    }
}


/* R13D.7 — homogénéisation visuelle du portail client. */
body.portal-page {
    --portal-radius-card: 1.2rem;
    --portal-radius-soft: 1rem;
    --portal-card-padding: 1.15rem;
}

body.portal-page .portal-card,
body.portal-page .portal-card-soft,
body.portal-page .portal-validation-card,
body.portal-page .portal-contact-item,
body.portal-page .portal-document-link,
body.portal-page .portal-invoice-row,
body.portal-page .portal-info-item {
    border: 1px solid var(--portal-border) !important;
    box-shadow: var(--portal-shadow-soft) !important;
}
body.portal-page .portal-card {
    border-radius: var(--portal-radius-card) !important;
}
body.portal-page .portal-card-soft,
body.portal-page .portal-validation-card,
body.portal-page .portal-contact-item,
body.portal-page .portal-document-link,
body.portal-page .portal-invoice-row,
body.portal-page .portal-info-item {
    border-radius: var(--portal-radius-soft) !important;
    background: #fff !important;
}
body.portal-page .portal-card-soft,
body.portal-page .portal-info-item {
    background: linear-gradient(180deg, #fff, #f8fafc) !important;
}
body.portal-page .portal-card.p-4 {
    padding: var(--portal-card-padding) !important;
}
body.portal-page .portal-section-title,
body.portal-page h1,
body.portal-page h2,
body.portal-page h3 {
    letter-spacing: -.02em;
}
body.portal-page .portal-info-label,
body.portal-page .portal-table thead th,
body.portal-page .portal-validation-meta {
    color: var(--portal-muted) !important;
}
body.portal-page .portal-info-value,
body.portal-page .portal-address,
body.portal-page .portal-table,
body.portal-page .portal-card-soft,
body.portal-page .portal-contact-item,
body.portal-page .portal-validation-card {
    font-size: .94rem;
    line-height: 1.45;
}
body.portal-page .portal-table > :not(caption) > * > * {
    padding-top: .72rem;
    padding-bottom: .72rem;
}
body.portal-page .portal-table strong,
body.portal-page .portal-invoice-row strong,
body.portal-page .portal-validation-title,
body.portal-page .portal-document-link {
    font-weight: 600;
}
body.portal-page .form-label {
    font-size: .9rem;
    font-weight: 650;
}
body.portal-page .form-control,
body.portal-page .form-select,
body.portal-page textarea.form-control {
    border-color: rgba(17,24,39,.13);
    box-shadow: none;
}
body.portal-page .form-control:focus,
body.portal-page .form-select:focus {
    border-color: rgba(237,27,52,.42);
    box-shadow: 0 0 0 .2rem rgba(237,27,52,.10);
}
body.portal-page .portal-side-link {
    font-weight: 650;
}
@media (max-width: 767.98px) {
    body.portal-page { --portal-card-padding: .95rem; }
}
