body.client-portal-page {
    --portal-ink: #172321;
    --portal-muted: #61716d;
    --portal-line: #d8e1de;
    --portal-soft: #f4f7f6;
    --portal-brand: #0b6f67;
    --portal-brand-dark: #07544f;
    --portal-brand-soft: #e6f3f1;
    --portal-gold: #bd8218;
    --portal-gold-soft: #fff4d8;
    min-height: 100vh;
    margin: 0;
    background: #edf2f0;
    color: var(--portal-ink);
}

body.client-portal-documents-page,
body.client-portal-documents-page::before,
body.client-portal-documents-page::after {
    background-image: none;
}

body.client-portal-documents-page::before,
body.client-portal-documents-page::after {
    display: none;
}

body.client-portal-documents-page .client-portal-shell {
    width: min(1220px, calc(100% - 40px));
    padding: 30px 0 42px;
}

.client-portal-documents-page .client-portal-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(230px, 320px);
    gap: 40px;
    align-items: center;
    overflow: hidden;
    margin: 0;
    padding: 30px 32px 28px;
    border: 1px solid var(--portal-line);
    border-top: 4px solid var(--portal-brand);
    border-radius: 8px 8px 0 0;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(24, 45, 42, 0.08);
    backdrop-filter: none;
}

.client-portal-hero-content {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.client-portal-context-line {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.client-portal-eyebrow,
.client-portal-session-state {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    gap: 7px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-portal-eyebrow {
    border: 1px solid #b8dcd7;
    background: var(--portal-brand-soft);
    color: var(--portal-brand-dark);
}

.client-portal-session-state {
    border: 1px solid #ead39f;
    background: var(--portal-gold-soft);
    color: #80560e;
}

.client-portal-icon {
    display: block;
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.client-portal-heading {
    display: grid;
    min-width: 0;
    gap: 11px;
}

.client-portal-heading h1 {
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--portal-ink);
    font-size: clamp(1.65rem, 3vw, 2.45rem);
    line-height: 1.08;
}

.client-portal-company-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
    color: var(--portal-muted);
    font-size: 0.88rem;
    font-weight: 750;
}

.client-portal-company-meta span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.client-portal-company-meta strong {
    color: #33413e;
}

.client-portal-brand {
    display: grid;
    justify-items: end;
    gap: 18px;
    min-width: 0;
}

.client-portal-documents-page .client-portal-logo-link {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    max-width: 100%;
    padding: 0;
    border: 0;
}

.client-portal-documents-page .client-portal-logo {
    width: min(285px, 100%);
    height: auto;
}

.client-portal-logout {
    display: inline-flex;
    min-height: 38px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 13px;
    border: 1px solid #d8c0bd;
    border-radius: 6px;
    background: #ffffff;
    color: #8d3028;
    font-size: 0.82rem;
    font-weight: 900;
    text-decoration: none;
    box-shadow: none;
}

.client-portal-logout:hover {
    border-color: #c89792;
    background: #fff5f4;
    color: #76271f;
}

.client-portal-overview {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    border: 1px solid var(--portal-line);
    border-top: 0;
    border-radius: 0 0 8px 8px;
    background: #ffffff;
    box-shadow: 0 18px 48px rgba(24, 45, 42, 0.08);
}

.client-portal-overview-heading {
    display: grid;
    align-content: center;
    gap: 5px;
    padding: 18px 22px;
    border-right: 1px solid var(--portal-line);
    background: #f7f9f8;
}

.client-portal-overview-heading span {
    color: var(--portal-brand-dark);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-portal-overview-heading strong {
    color: var(--portal-ink);
    font-size: 1rem;
}

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

.client-portal-summary-card {
    position: relative;
    display: grid;
    align-content: center;
    min-height: 98px;
    gap: 5px;
    padding: 17px 20px;
    border: 0;
    border-right: 1px solid var(--portal-line);
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    backdrop-filter: none;
}

.client-portal-summary-card:last-child {
    border-right: 0;
}

.client-portal-summary-card::before {
    position: absolute;
    top: 0;
    left: 20px;
    width: 34px;
    border-top: 3px solid var(--portal-gold);
    content: '';
}

.client-portal-summary-card span {
    color: var(--portal-muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-portal-summary-card strong {
    color: var(--portal-ink);
    font-size: 1.5rem;
    line-height: 1;
}

.client-portal-summary-card small {
    color: #6b7976;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.25;
}

.client-portal-filter-card {
    position: sticky;
    top: 10px;
    z-index: 5;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: end;
    gap: 24px;
    margin: 18px 0;
    padding: 16px 18px;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.97);
    box-shadow: 0 12px 30px rgba(24, 45, 42, 0.07);
    backdrop-filter: blur(10px);
}

.client-portal-toolbar-heading {
    display: grid;
    gap: 3px;
    min-width: 170px;
}

.client-portal-toolbar-heading span {
    color: var(--portal-brand-dark);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-portal-toolbar-heading strong {
    color: var(--portal-ink);
    font-size: 1rem;
}

.client-document-filters {
    display: grid;
    grid-template-columns: minmax(230px, 1fr) 118px 145px auto auto;
    align-items: end;
    gap: 10px;
    margin: 0;
}

.client-document-filters label {
    display: grid;
    gap: 6px;
    color: var(--portal-muted);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-document-filters input,
.client-document-filters select {
    width: 100%;
    min-height: 42px;
    padding: 0 11px;
    border: 1px solid #ccd7d3;
    border-radius: 6px;
    background: #ffffff;
    color: var(--portal-ink);
    font-size: 0.9rem;
    font-weight: 750;
}

.client-document-filters input:focus,
.client-document-filters select:focus {
    border-color: var(--portal-brand);
    box-shadow: 0 0 0 3px rgba(11, 111, 103, 0.12);
    outline: 0;
}

.client-document-filters button,
.client-filter-clear {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 14px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 900;
    white-space: nowrap;
}

.client-document-filters button {
    border: 1px solid var(--portal-brand);
    background: var(--portal-brand);
    color: #ffffff;
    box-shadow: none;
}

.client-document-filters button:hover {
    border-color: var(--portal-brand-dark);
    background: var(--portal-brand-dark);
}

.client-filter-clear {
    border: 1px solid #ccd7d3;
    background: #ffffff;
    color: #485854;
    text-decoration: none;
}

.client-filter-clear:hover {
    border-color: #aebfba;
    background: #f7f9f8;
}

.client-portal-view-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 18px;
    padding: 6px;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
    background: #e7edeb;
    box-shadow: 0 10px 26px rgba(24, 45, 42, 0.06);
}

.client-portal-view-tab {
    position: relative;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    min-width: 0;
    min-height: 70px;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: transparent;
    color: #52625e;
    text-align: left;
    box-shadow: none;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.client-portal-view-tab:hover {
    border-color: #c5d3cf;
    background: rgba(255, 255, 255, 0.68);
    color: var(--portal-brand-dark);
}

.client-portal-view-tab.is-active {
    border-color: #a9d1cc;
    background: #ffffff;
    color: var(--portal-brand-dark);
    box-shadow: inset 0 -3px var(--portal-brand), 0 6px 16px rgba(24, 45, 42, 0.08);
}

.client-portal-view-tab:focus-visible {
    outline: 3px solid rgba(11, 111, 103, 0.2);
    outline-offset: 2px;
}

.client-portal-view-icon {
    display: inline-flex;
    width: 38px;
    height: 38px;
    align-items: center;
    justify-content: center;
    border: 1px solid #c8d6d2;
    border-radius: 6px;
    background: #f7f9f8;
    color: #536661;
}

.client-portal-view-tab.is-active .client-portal-view-icon {
    border-color: #b5d8d3;
    background: var(--portal-brand-soft);
    color: var(--portal-brand-dark);
}

.client-portal-view-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.client-portal-view-copy strong {
    overflow: hidden;
    font-size: 0.92rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-portal-view-copy small {
    color: var(--portal-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.client-portal-view-count {
    display: inline-flex;
    min-width: 32px;
    min-height: 28px;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid #c5d3cf;
    border-radius: 999px;
    background: #ffffff;
    color: #41524e;
    font-size: 0.76rem;
    font-weight: 900;
}

.client-portal-view-tab.is-active .client-portal-view-count {
    border-color: var(--portal-brand);
    color: var(--portal-brand-dark);
}

.client-portal-view-panel[hidden] {
    display: none;
}

.client-portal-view-panel + .client-portal-view-panel {
    margin-top: 0;
}

.client-portal-card {
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--portal-line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 14px 36px rgba(24, 45, 42, 0.07);
    backdrop-filter: none;
}

.client-portal-card + .client-portal-card {
    margin-top: 18px;
}

.client-portal-section-heading {
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin: 0;
    padding: 14px 20px;
    border-bottom: 1px solid var(--portal-line);
    background: #f8faf9;
}

.client-portal-section-heading p,
.client-portal-section-heading h2 {
    margin: 0;
}

.client-portal-section-heading p {
    color: var(--portal-brand-dark);
    font-size: 0.7rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-portal-section-heading h2 {
    margin-top: 4px;
    color: var(--portal-ink);
    font-size: 1.18rem;
    line-height: 1.15;
}

.client-portal-section-count {
    display: inline-flex;
    min-width: 34px;
    min-height: 30px;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
    border: 1px solid #c7d7d3;
    border-radius: 999px;
    background: #ffffff;
    color: var(--portal-brand-dark);
    font-size: 0.78rem;
    font-weight: 900;
}

.client-document-list,
.client-monthly-expense-list {
    display: grid;
    gap: 0;
}

.client-document-row {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 78px;
    padding: 13px 18px;
    border: 0;
    border-bottom: 1px solid #e3e9e7;
    border-radius: 0;
    background: #ffffff;
    box-shadow: none;
    transition: background-color 150ms ease;
}

.client-document-row:last-child {
    border-bottom: 0;
}

.client-document-row:hover {
    border-color: #e3e9e7;
    background: #f8fbfa;
    box-shadow: none;
    transform: none;
}

.client-document-kind {
    display: grid;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid #c4dcda;
    border-radius: 7px;
    background: var(--portal-brand-soft);
    color: var(--portal-brand-dark);
}

.client-document-title {
    display: grid;
    min-width: 0;
    gap: 5px;
}

.client-document-title strong {
    overflow: hidden;
    color: var(--portal-ink);
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-document-title span {
    overflow: hidden;
    color: var(--portal-muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-document-actions {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 7px;
}

.client-document-action {
    display: inline-grid;
    width: 38px;
    height: 38px;
    min-width: 38px;
    padding: 0;
    place-items: center;
    border: 1px solid #ccd7d3;
    border-radius: 6px;
    background: #ffffff;
    color: #43534f;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
}

.client-document-action:hover {
    border-color: #8ebbb5;
    background: var(--portal-brand-soft);
    color: var(--portal-brand-dark);
    transform: none;
}

.client-empty-state {
    margin: 0;
    padding: 28px 20px;
    color: var(--portal-muted);
    font-weight: 750;
    text-align: center;
}

.client-monthly-expense-row {
    display: grid;
    gap: 0;
    margin: 14px;
    padding: 0;
    overflow: hidden;
    border: 1px solid #d6dfdc;
    border-left: 4px solid var(--portal-brand);
    border-radius: 7px;
    background: #ffffff;
    box-shadow: none;
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.client-monthly-expense-row + .client-monthly-expense-row {
    margin-top: 0;
}

.client-monthly-expense-row:hover {
    border-color: #abcac5;
    box-shadow: 0 10px 24px rgba(24, 45, 42, 0.07);
    transform: none;
}

.client-monthly-expense-summary {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    align-items: center;
    padding: 15px 17px;
    border-bottom: 1px solid #e3e9e7;
    background: #f8faf9;
}

.client-monthly-expense-period {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 10px;
}

.client-monthly-expense-period > strong {
    color: var(--portal-ink);
    font-size: 1.05rem;
}

.client-monthly-expense-status {
    display: inline-flex;
    min-height: 24px;
    align-items: center;
    padding: 0 8px;
    border: 1px solid #b9d9d5;
    border-radius: 999px;
    background: var(--portal-brand-soft);
    color: var(--portal-brand-dark);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-monthly-expense-date {
    flex-basis: 100%;
    color: var(--portal-muted);
    font-size: 0.8rem;
    font-weight: 700;
}

.client-monthly-expense-total {
    display: grid;
    justify-items: end;
    gap: 3px;
}

.client-monthly-expense-total span {
    color: var(--portal-muted);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-monthly-expense-total strong {
    color: var(--portal-ink);
    font-size: 1.15rem;
}

.client-monthly-expense-items {
    display: grid;
    padding: 6px 17px;
}

.client-monthly-expense-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 38px;
    padding: 7px 0;
    border: 0;
    border-bottom: 1px solid #edf1ef;
    border-radius: 0;
    background: transparent;
    color: #354440;
    font-size: 0.86rem;
    font-weight: 750;
}

.client-monthly-expense-item:last-child {
    border-bottom: 0;
}

.client-monthly-expense-item span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.client-monthly-expense-item-copy {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.client-monthly-expense-item strong {
    color: var(--portal-ink);
    white-space: nowrap;
}

.client-monthly-expense-item.is-carried-over {
    margin-block: 3px;
    padding: 9px 10px;
    border-bottom-color: transparent;
    border-radius: 6px;
    background: #fff7f7;
    box-shadow: inset 3px 0 0 #dc2626;
}

.client-monthly-expense-item.is-carried-over > strong {
    color: #b42318;
}

.client-monthly-expense-carryover-note {
    color: #b42318;
    font-size: 0.74rem;
    font-weight: 850;
    line-height: 1.35;
}

.client-monthly-expense-item.is-paid {
    margin-block: 3px;
    padding: 9px 10px;
    border-bottom-color: transparent;
    border-radius: 6px;
    background: #f0fdf4;
    box-shadow: inset 3px 0 0 #16a34a;
}

.client-monthly-expense-item.is-paid > strong {
    color: #15803d;
}

.client-monthly-expense-payment-note {
    color: #15803d;
    font-size: 0.74rem;
    font-weight: 850;
    line-height: 1.35;
}

.client-monthly-expense-observations {
    display: grid;
    gap: 4px;
    margin: 0 17px 12px;
    padding: 10px 12px;
    border: 0;
    border-left: 3px solid var(--portal-gold);
    border-radius: 0;
    background: #fffaf0;
    color: #67583a;
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1.4;
}

.client-monthly-expense-observations strong {
    color: #79540f;
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-monthly-expense-attachments {
    display: grid;
    gap: 0;
    padding: 0 17px 10px;
}

.client-monthly-expense-attachments-title {
    padding: 10px 0 7px;
    border-top: 1px solid #e3e9e7;
    color: var(--portal-muted);
    font-size: 0.68rem;
    font-weight: 900;
    text-transform: uppercase;
}

.client-monthly-expense-attachment {
    display: grid;
    grid-template-columns: 38px 38px minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
    min-height: 46px;
    padding: 4px 0;
    border: 0;
    border-bottom: 1px solid #edf1ef;
    border-radius: 0;
    background: transparent;
}

.client-monthly-expense-attachment:last-child {
    border-bottom: 0;
}

.client-monthly-expense-attachment > span {
    min-width: 0;
    overflow: hidden;
    color: var(--portal-ink);
    font-size: 0.84rem;
    font-weight: 800;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.client-monthly-expense-attachment small {
    color: var(--portal-muted);
    font-size: 0.76rem;
    font-weight: 750;
    white-space: nowrap;
}

.client-document-modal {
    width: min(1120px, calc(100vw - 28px));
    height: min(820px, calc(100vh - 28px));
    border-radius: 8px;
}

.client-document-frame {
    width: 100%;
    height: calc(100% - 78px);
    border: 0;
    background: #ffffff;
}

.client-notice,
.client-error {
    margin: 16px 0 0;
    padding: 12px 14px;
    border-radius: 6px;
    font-weight: 800;
}

.client-notice {
    border: 1px solid #a8d8d1;
    background: #edf8f6;
    color: var(--portal-brand-dark);
}

.client-error {
    border: 1px solid #e1b1ad;
    background: #fff3f2;
    color: #8d3028;
}

body.client-portal-documents-page .site-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid #d2ddda;
    background: #e5ebe9;
    color: #596964;
}

body.client-portal-documents-page .site-footer a {
    color: var(--portal-brand-dark);
}

body.client-portal-login-page {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    place-items: center start;
    padding: clamp(28px, 5vw, 80px);
    padding-left: clamp(64px, 8.5vw, 136px);
    background-color: #183a36;
    background-image: url('../public/assets/client-portal-login-real-sign-v4.jpg');
    background-position: 35% center;
    background-size: cover;
    background-blend-mode: normal;
}

.client-portal-login-page .client-portal-shell {
    width: 100%;
    max-width: 440px;
    min-width: 0;
    margin: 0;
    transform: translateY(16px);
}

.client-portal-login-page .login-card {
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.78);
    border-top: 4px solid var(--portal-gold);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 28px 80px rgba(7, 28, 26, 0.34);
    backdrop-filter: blur(16px);
}

.client-portal-login-page .login-brand-panel {
    margin: 0 0 22px;
    padding: 0 0 20px;
    border-bottom: 1px solid var(--portal-line);
    background: transparent;
}

.client-portal-login-page .login-brand-panel img {
    width: min(300px, 100%);
}

.client-portal-login-page .eyebrow {
    display: inline-flex;
    margin: 0 0 8px;
    color: var(--portal-brand-dark);
}

.client-portal-login-page .login-card h1 {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 20px;
    overflow: visible;
    clip: auto;
    color: var(--portal-ink);
    font-size: 1.7rem;
    line-height: 1.12;
    white-space: normal;
}

.client-portal-login-page .client-access-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.client-portal-login-page .client-access-note {
    margin: 0;
    color: var(--portal-muted);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.4;
    text-align: center;
}

.client-portal-login-page .client-access-form button {
    min-height: 44px;
    border-radius: 6px;
    background: var(--portal-brand);
}

@media (max-width: 960px) {
    .client-portal-documents-page .client-portal-hero {
        grid-template-columns: minmax(0, 1fr) 240px;
        gap: 24px;
    }

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

    .client-portal-overview-heading {
        grid-template-columns: auto 1fr;
        align-items: center;
        border-right: 0;
        border-bottom: 1px solid var(--portal-line);
    }

    .client-portal-overview-heading strong {
        justify-self: end;
    }

    .client-portal-filter-card {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

@media (max-width: 760px) {
    body.client-portal-login-page {
        place-items: end center;
        padding: 22px 0;
        background-position: 66% center;
    }

    .client-portal-login-page .client-portal-shell {
        width: min(440px, calc(100vw - 28px));
        max-width: calc(100vw - 28px);
        transform: none;
    }

    .client-portal-login-page .login-card {
        width: 100%;
        max-width: 100%;
    }

    body.client-portal-documents-page .client-portal-shell {
        width: min(calc(100% - 22px), 1220px);
        padding: 16px 0 28px;
    }

    .client-portal-documents-page .client-portal-hero {
        grid-template-columns: 1fr;
        gap: 22px;
        padding: 22px 20px;
    }

    .client-portal-brand {
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        justify-items: start;
        gap: 16px;
    }

    .client-portal-documents-page .client-portal-logo-link {
        justify-content: flex-start;
    }

    .client-portal-documents-page .client-portal-logo {
        width: min(260px, 100%);
    }

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

    .client-portal-summary-card:nth-child(2) {
        border-right: 0;
    }

    .client-portal-summary-card:nth-child(-n + 2) {
        border-bottom: 1px solid var(--portal-line);
    }

    .client-document-filters {
        grid-template-columns: minmax(0, 1fr) repeat(2, minmax(110px, 0.45fr));
    }

    .client-document-filters button,
    .client-filter-clear {
        grid-row: 2;
    }

    .client-document-filters button {
        grid-column: 1 / 3;
    }

    .client-filter-clear {
        grid-column: 3;
    }

    .client-portal-filter-card {
        position: static;
    }
}

@media (max-width: 520px) {
    .client-portal-login-page .login-card {
        padding: 25px 20px 22px;
    }

    .client-portal-login-page .login-brand-panel img {
        width: min(270px, 100%);
    }

    .client-portal-view-tabs {
        gap: 5px;
        padding: 5px;
    }

    .client-portal-view-tab {
        grid-template-columns: 32px minmax(0, 1fr) auto;
        min-height: 62px;
        gap: 7px;
        padding: 8px;
    }

    .client-portal-view-icon {
        width: 32px;
        height: 32px;
    }

    .client-portal-view-copy strong {
        font-size: 0.78rem;
        white-space: normal;
    }

    .client-portal-view-copy small {
        display: none;
    }

    .client-portal-view-count {
        min-width: 26px;
        min-height: 26px;
        padding: 0 6px;
    }

    .client-portal-overview-heading {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .client-portal-overview-heading strong {
        justify-self: start;
    }

    .client-portal-company-meta {
        display: grid;
        gap: 6px;
    }

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

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

    .client-portal-summary-card,
    .client-portal-summary-card:nth-child(2) {
        min-height: 82px;
        border-right: 0;
        border-bottom: 1px solid var(--portal-line);
    }

    .client-portal-summary-card:last-child {
        border-bottom: 0;
    }

    .client-document-filters {
        grid-template-columns: 1fr;
    }

    .client-document-filters button,
    .client-filter-clear {
        grid-column: 1;
        grid-row: auto;
    }

    .client-portal-section-heading {
        min-height: 66px;
        padding: 12px 14px;
    }

    .client-document-row {
        grid-template-columns: 38px minmax(0, 1fr);
        gap: 11px;
        padding: 12px 13px;
    }

    .client-document-kind {
        width: 38px;
        height: 38px;
    }

    .client-document-actions {
        grid-column: 2;
        justify-content: flex-start;
    }

    .client-monthly-expense-summary {
        grid-template-columns: 1fr;
    }

    .client-monthly-expense-total {
        justify-items: start;
    }

    .client-monthly-expense-item.is-carried-over,
    .client-monthly-expense-item.is-paid {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .client-monthly-expense-item.is-carried-over > strong,
    .client-monthly-expense-item.is-paid > strong {
        justify-self: start;
    }

    .client-monthly-expense-attachment {
        grid-template-columns: 38px 38px minmax(0, 1fr);
    }

    .client-monthly-expense-attachment small {
        grid-column: 3;
    }
}
