:root {
    --portal-navy: var(--color-text);
    --portal-primary: var(--brand-primary, var(--color-primary));
    --portal-primary-text: var(--brand-primary-text, var(--color-primary-text));
    --portal-accent: var(--brand-accent, var(--color-accent));
    --portal-accent-text: var(--brand-accent-text, var(--color-primary-text));
    --portal-green: var(--portal-primary);
    --portal-green-dark: var(--colour-primary-hover);
    --portal-green-soft: var(--colour-primary-soft);
    --portal-page: var(--color-page);
    --portal-panel: var(--color-surface);
    --portal-border: var(--color-border-subtle);
    --portal-text: var(--color-text);
    --portal-muted: var(--color-text-muted);
    --portal-warning: var(--color-warning);
    --portal-shadow: var(--shadow-panel);
}

.customer-portal-body {
    min-height: 100vh;
    margin: 0;
    background: var(--portal-page);
    color: var(--portal-text);
}

.portal-shell {
    min-height: 100vh;
}

.portal-header {
    position: sticky;
    z-index: 50;
    top: 0;
    border-bottom: 1px solid var(--portal-border);
    background: var(--color-header);
}

.portal-header-inner {
    display: flex;
    align-items: center;
    width: min(1180px, calc(100% - 40px));
    min-height: 72px;
    margin: 0 auto;
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--portal-navy);
    text-decoration: none;
}

.portal-brand img {
    width: 132px;
    height: auto;
    object-fit: contain;
}

.portal-brand-label {
    color: var(--portal-muted);
    font-size: 0.66rem;
    font-weight: 750;
}

.portal-business-name { color: var(--portal-text); font-size: 1.05rem; }
.portal-powered-by {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    padding: 1.25rem;
    color: var(--portal-muted);
    font-size: .78rem;
}
.portal-powered-mark { width: 22px; height: auto; object-fit: contain; }

.portal-desktop-nav {
    display: flex;
    align-self: stretch;
    gap: 1.5rem;
    margin-left: 4rem;
}

.portal-desktop-nav a {
    display: flex;
    align-items: center;
    border-bottom: 3px solid transparent;
    color: var(--portal-muted);
    font-size: 0.8rem;
    font-weight: 750;
    text-decoration: none;
}

.portal-desktop-nav a:hover,
.portal-desktop-nav a[aria-current="page"] {
    color: var(--portal-green);
}

.portal-desktop-nav a[aria-current="page"] {
    border-bottom-color: var(--portal-accent);
}

.portal-customer-menu {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-left: auto;
}

.portal-customer-avatar {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 50%;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-weight: 900;
}

.portal-customer-name {
    max-width: 180px;
    overflow: hidden;
    font-size: 0.78rem;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.portal-customer-menu form {
    margin: 0 0 0 0.4rem;
}

.portal-customer-menu button {
    border: 0;
    background: transparent;
    color: var(--portal-muted);
    font: inherit;
    font-size: 0.75rem;
    font-weight: 750;
    cursor: pointer;
}

.portal-content {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
    padding: 46px 0 90px;
}

.portal-alert {
    margin-bottom: 1rem;
    padding: 0.9rem 1rem;
    border-left: 4px solid var(--portal-accent);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-alert-error {
    border-left-color: #b63a45;
}

.portal-eyebrow {
    margin: 0;
    color: var(--portal-green);
    font-size: 0.67rem;
    font-weight: 850;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.portal-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.portal-hero h1 {
    max-width: 760px;
    margin: 0.4rem 0 0.55rem;
    color: var(--portal-navy);
    font-size: clamp(2.1rem, 5vw, 3.8rem);
    line-height: 1;
}

.portal-hero p:last-child {
    margin: 0;
    color: var(--portal-muted);
}

.portal-hero-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.35rem;
    color: var(--portal-muted);
    font-size: 0.74rem;
    font-weight: 700;
}

.portal-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #2b9b5e;
}

.portal-status-dot.is-warning {
    background: var(--portal-warning);
}

.portal-metrics {
    display: grid;
    grid-template-columns:
        1.35fr repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 2.4rem;
}

.portal-metric {
    display: grid;
    gap: 0.35rem;
    min-height: 128px;
    box-sizing: border-box;
    padding: 1.35rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-metric-primary {
    border-color: var(--portal-green);
    background: var(--portal-green);
    color: var(--portal-primary-text);
}

.portal-metric span {
    color: var(--portal-muted);
    font-size: 0.72rem;
    font-weight: 750;
}

.portal-metric-primary span,
.portal-metric-primary small {
    color: var(--portal-primary-text);
}

.portal-metric strong {
    color: var(--portal-navy);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.portal-metric-primary strong {
    color: var(--portal-primary-text);
}

.portal-metric small {
    margin-top: auto;
    color: var(--portal-muted);
}

.portal-section {
    margin-bottom: 2.4rem;
}

.portal-section-header,
.portal-panel-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.portal-section-header h2,
.portal-panel-header h2 {
    margin: 0.25rem 0 0;
    color: var(--portal-navy);
}

.portal-panel-header a {
    color: var(--portal-green);
    font-size: 0.72rem;
    font-weight: 800;
    text-decoration: none;
}

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

.portal-rental-card,
.portal-panel {
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-rental-card {
    padding: 1.4rem;
    font-size: 1rem;
}

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

.portal-rental-heading span:first-child {
    color: var(--portal-muted);
    font-size: 0.875rem;
    font-weight: 750;
}

.portal-rental-heading h3 {
    margin: 0.3rem 0 0;
    color: var(--portal-navy);
    font-size: 1.4rem;
}

.portal-active-badge {
    padding: 0.3rem 0.55rem;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-size: 0.8rem;
    font-weight: 850;
    text-transform: uppercase;
}

.portal-rental-price {
    display: flex;
    align-items: baseline;
    gap: 0.45rem;
    margin: 1.6rem 0;
}

.portal-rental-price strong {
    color: var(--portal-navy);
    font-size: 1.8rem;
}

.portal-rental-price span {
    color: var(--portal-muted);
    font-size: 0.875rem;
}

.portal-rental-details {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 1rem 0;
    border-top: 1px solid var(--portal-border);
}

.portal-rental-details div {
    display: grid;
    gap: 0.2rem;
}

.portal-rental-details dt {
    color: var(--portal-muted);
    font-size: 0.875rem;
}

.portal-rental-details dd {
    margin: 0;
    font-size: 1rem;
    font-weight: 800;
}

.portal-card-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
}

.portal-card-actions > a:not(.ui-button) {
    color: var(--portal-green);
    font-size: 0.9375rem;
    font-weight: 850;
    text-decoration: none;
}

.portal-card-actions > span {
    flex-basis: 100%;
    color: var(--portal-muted);
}

.portal-card-actions .ui-button {
    min-width: 9rem;
    min-height: 44px;
    flex: 1 1 auto;
}

@media (max-width: 480px) {
    .portal-card-actions .ui-button {
        width: 100%;
    }
}

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

.portal-panel {
    padding: 1.35rem;
}

.portal-activity-list {
    display: grid;
}

.portal-activity-row {
    display: grid;
    grid-template-columns:
        38px minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
    min-height: 58px;
    padding: 0.75rem 0;
    border-top: 1px solid var(--portal-border);
}

.portal-activity-row:first-child {
    border-top: 0;
}

.portal-activity-link {
    color: inherit;
    text-decoration: none;
}

.portal-activity-link:hover strong {
    color: var(--portal-green);
}

.portal-activity-icon {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-size: 0.75rem;
    font-weight: 900;
}

.portal-activity-copy,
.portal-activity-value {
    display: grid;
    gap: 0.15rem;
}

.portal-activity-copy small,
.portal-activity-value small {
    color: var(--portal-muted);
    font-size: 0.65rem;
}

.portal-activity-value {
    text-align: right;
}

.portal-empty {
    padding: 2rem;
    border: 1px dashed #b9cbc7;
    background: var(--colour-panel-raised);
    text-align: center;
}

.portal-empty-compact {
    padding: 1.4rem;
}

.portal-empty p {
    margin-bottom: 0;
    color: var(--portal-muted);
    font-size: 0.8rem;
}

.portal-mobile-nav {
    display: none;
}

@media (max-width: 820px) {
    .portal-desktop-nav,
    .portal-customer-name {
        display: none;
    }

    .portal-content {
        width: min(100% - 24px, 1180px);
        padding-top: 28px;
        padding-bottom: 100px;
    }

    .portal-header-inner {
        width: min(100% - 24px, 1180px);
    }

    .portal-hero {
        display: grid;
        gap: 1rem;
    }

    .portal-hero-status {
        padding: 0;
    }

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

    .portal-metric-primary {
        grid-column: 1 / -1;
    }

    .portal-rental-grid,
    .portal-dashboard-grid {
        grid-template-columns: 1fr;
    }

    .portal-mobile-nav {
        position: fixed;
        z-index: 60;
        right: 0;
        bottom: 0;
        left: 0;
        display: grid;
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
        border-top: 1px solid var(--portal-border);
        background: var(--portal-panel);
        box-shadow: 0 -8px 30px var(--color-shadow);
    }

    .portal-mobile-nav a {
        display: grid;
        gap: 0.18rem;
        min-height: 62px;
        place-content: center;
        color: var(--portal-muted);
        font-size: 0.64rem;
        font-weight: 750;
        text-align: center;
        text-decoration: none;
    }

    .portal-mobile-nav a span {
        font-size: 1rem;
    }

    .portal-mobile-nav a[aria-current="page"] {
        color: var(--portal-accent);
    }
}

@media (max-width: 520px) {
    .portal-brand-label,
    .portal-customer-avatar {
        display: none;
    }

    .portal-hero h1 {
        font-size: 2.35rem;
    }

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

    .portal-metric-primary {
        grid-column: auto;
    }

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

    .portal-activity-row {
        grid-template-columns:
            34px minmax(0, 1fr);
    }

    .portal-activity-value {
        grid-column: 2;
        text-align: left;
    }
}

.portal-account-heading {
    margin-bottom: 2rem;
}

.portal-account-heading h1 {
    margin: 0.35rem 0 0.55rem;
    color: var(--portal-navy);
    font-size: clamp(2.1rem, 5vw, 3.6rem);
    line-height: 1;
}

.portal-account-heading > div > p:last-child {
    margin: 0;
    color: var(--portal-muted);
}

.portal-account-metrics {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.portal-account-metric {
    display: grid;
    gap: 0.35rem;
    min-height: 128px;
    box-sizing: border-box;
    padding: 1.25rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-account-metric.is-primary {
    border-color: var(--portal-green);
    background: var(--portal-green);
    color: var(--portal-primary-text);
}

.portal-account-metric span {
    color: var(--portal-muted);
    font-size: 0.7rem;
    font-weight: 750;
}

.portal-account-metric strong {
    color: var(--portal-navy);
    font-size: clamp(1.65rem, 3vw, 2.25rem);
}

.portal-account-metric small {
    margin-top: auto;
    color: var(--portal-muted);
    font-size: 0.68rem;
}

.portal-account-metric.is-primary span,
.portal-account-metric.is-primary small {
    color: var(--portal-primary-text);
}

.portal-account-metric.is-primary strong {
    color: var(--portal-primary-text);
}

.portal-account-panel {
    padding: 1.35rem;
}

.portal-account-panel-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.portal-account-panel-header h2 {
    margin: 0.25rem 0 0;
    color: var(--portal-navy);
}

.portal-account-filter,
.portal-account-custom-dates {
    display: flex;
    align-items: flex-end;
    gap: 0.65rem;
}

.portal-account-filter label {
    display: grid;
    gap: 0.3rem;
}

.portal-account-filter label > span {
    color: var(--portal-muted);
    font-size: 0.64rem;
    font-weight: 750;
}

.portal-account-filter select,
.portal-account-filter input {
    min-height: 40px;
    box-sizing: border-box;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    color: var(--portal-text);
    font: inherit;
    font-size: 0.74rem;
}

.portal-account-filter button {
    min-height: 40px;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--portal-green);
    background: var(--portal-green);
    color: var(--portal-primary-text);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 800;
    cursor: pointer;
}

.portal-account-custom-dates.is-hidden {
    display: none;
}

.portal-account-error {
    margin-bottom: 1rem;
    padding: 0.8rem;
    border-left: 4px solid #b63a45;
    background: #fff2f3;
    color: #8d2430;
    font-size: 0.76rem;
}

.portal-statement {
    display: grid;
}

.portal-statement-heading,
.portal-statement-row {
    display: grid;
    grid-template-columns:
        110px minmax(210px, 1.4fr)
        minmax(120px, 1fr)
        repeat(3, minmax(90px, 0.65fr));
    gap: 1rem;
    align-items: center;
}

.portal-statement-heading {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--portal-border);
    color: var(--portal-muted);
    font-size: 0.63rem;
    font-weight: 800;
    text-transform: uppercase;
}

.portal-statement-row {
    min-height: 66px;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--portal-border);
    font-size: 0.75rem;
}

.portal-statement-activity {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 0.7rem;
    align-items: center;
}

.portal-statement-activity > span:last-child {
    display: grid;
    gap: 0.15rem;
}

.portal-statement-activity small {
    color: var(--portal-muted);
    font-size: 0.64rem;
}

.portal-statement-icon {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-weight: 900;
}

.portal-statement-icon.is-payment {
    background: #e8f3eb;
    color: #2b7b48;
}

.portal-statement-money {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.portal-statement-money.is-credit {
    color: #277846;
}

.portal-statement-money.is-balance {
    color: var(--portal-navy);
    font-weight: 850;
}

.portal-statement-footer {
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
    padding: 1rem 0 0;
    color: var(--portal-muted);
    font-size: 0.72rem;
}

.portal-statement-footer strong {
    min-width: 90px;
    color: var(--portal-navy);
    text-align: right;
}

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

    .portal-account-panel-header {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-account-filter {
        flex-wrap: wrap;
    }

    .portal-statement-heading {
        display: none;
    }

    .portal-statement-row {
        grid-template-columns:
            minmax(0, 1fr) minmax(100px, auto);
        gap: 0.65rem 1rem;
        padding: 1rem 0;
    }

    .portal-statement-date {
        grid-column: 1;
    }

    .portal-statement-activity {
        grid-column: 1 / -1;
        grid-row: 1 / span 2;
        padding-right: 120px;
    }

    .portal-statement-row > div[data-label] {
        display: flex;
        grid-column: 2;
        justify-content: space-between;
        gap: 1rem;
    }

    .portal-statement-row > div[data-label]::before {
        content: attr(data-label);
        color: var(--portal-muted);
        font-size: 0.62rem;
    }
}

@media (max-width: 820px) {
    .portal-mobile-nav {
        grid-template-columns:
            repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .portal-account-metrics {
        grid-template-columns: 1fr;
    }

    .portal-account-filter,
    .portal-account-custom-dates {
        display: grid;
        grid-template-columns: 1fr;
        width: 100%;
    }

    .portal-account-filter select,
    .portal-account-filter input,
    .portal-account-filter button {
        width: 100%;
    }

    .portal-statement-row {
        display: grid;
        grid-template-columns: 1fr;
    }

    .portal-statement-activity {
        grid-column: 1;
        grid-row: auto;
        padding-right: 0;
    }

    .portal-statement-date {
        grid-column: 1;
    }

    .portal-statement-row > div[data-label] {
        grid-column: 1;
    }

    .portal-statement-footer {
        justify-content: space-between;
    }
}

.portal-page-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.portal-page-heading h1 {
    margin: 0.35rem 0 0.55rem;
    color: var(--portal-navy);
    font-size: clamp(2.1rem, 5vw, 3.6rem);
    line-height: 1;
}

.portal-page-heading > div > p:last-child {
    margin: 0;
    color: var(--portal-muted);
}

.portal-page-actions {
    display: flex;
    gap: 0.65rem;
}

.portal-primary-button,
.portal-secondary-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    box-sizing: border-box;
    padding: 0.65rem 0.95rem;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 850;
    text-decoration: none;
}

.portal-primary-button {
    border: 1px solid var(--portal-green);
    background: var(--portal-green);
    color: var(--portal-primary-text);
}

.portal-primary-button:disabled {
    cursor: not-allowed;
    opacity: 0.52;
}

.portal-secondary-button {
    border: 1px solid var(--portal-accent);
    background: var(--portal-panel);
    color: var(--portal-accent);
}

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

.portal-invoice-card {
    display: grid;
    gap: 1.2rem;
    padding: 1.3rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-invoice-card header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.portal-invoice-card header span:first-child {
    color: var(--portal-muted);
    font-size: 0.66rem;
    font-weight: 750;
}

.portal-invoice-card h2 {
    margin: 0.25rem 0 0;
    color: var(--portal-navy);
    font-size: 1.15rem;
}

.portal-invoice-status {
    padding: 0.3rem 0.5rem;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-size: 0.58rem;
    font-weight: 900;
    text-transform: uppercase;
}

.portal-invoice-status.is-overdue {
    background: #fff0df;
    color: #a75b12;
}

.portal-invoice-status.is-paid {
    background: #e5f5eb;
    color: #267545;
}

.portal-invoice-card dl {
    display: grid;
    gap: 0.55rem;
    margin: 0;
}

.portal-invoice-card dl div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.portal-invoice-card dt {
    color: var(--portal-muted);
    font-size: 0.68rem;
}

.portal-invoice-card dd {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    text-align: right;
}

.portal-invoice-amounts {
    display: grid;
    grid-template-columns:
        repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--portal-border);
    border-bottom: 1px solid var(--portal-border);
}

.portal-invoice-amounts span {
    display: grid;
    gap: 0.25rem;
}

.portal-invoice-amounts span:last-child {
    text-align: right;
}

.portal-invoice-amounts small {
    color: var(--portal-muted);
    font-size: 0.62rem;
}

.portal-invoice-amounts strong {
    color: var(--portal-navy);
    font-size: 1.15rem;
}

.portal-invoice-open,
.portal-statement-invoice-link {
    color: var(--portal-green);
    font-weight: 850;
    text-decoration: none;
}

.portal-invoice-open {
    font-size: 0.74rem;
}

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

.portal-invoice-summary article {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
}

.portal-invoice-summary article.is-balance {
    border-color: var(--portal-green);
    background: var(--portal-green);
    color: var(--portal-primary-text);
}

.portal-invoice-summary span {
    color: var(--portal-muted);
    font-size: 0.65rem;
}

.portal-invoice-summary article.is-balance span {
    color: var(--portal-primary-text);
}

.portal-invoice-summary strong {
    color: var(--portal-navy);
    font-size: 1.1rem;
}

.portal-invoice-summary article.is-balance strong {
    color: var(--portal-primary-text);
}

.portal-invoice-document {
    padding: clamp(1.25rem, 4vw, 3rem);
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-invoice-document-header {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
}

.portal-invoice-document-header > div {
    display: grid;
    gap: 0.2rem;
}

.portal-invoice-document-header > div:last-child {
    color: var(--portal-muted);
    font-size: 0.75rem;
    text-align: right;
}

.portal-invoice-unit {
    margin-bottom: 1.5rem;
    padding: 0.85rem;
    background: var(--portal-green-soft);
    font-size: 0.75rem;
}

.portal-invoice-lines {
    display: grid;
}

.portal-invoice-line-heading,
.portal-invoice-line {
    display: grid;
    grid-template-columns:
        minmax(220px, 1.6fr)
        repeat(4, minmax(90px, 0.6fr));
    gap: 1rem;
    align-items: center;
}

.portal-invoice-line-heading {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--portal-border);
    color: var(--portal-muted);
    font-size: 0.62rem;
    font-weight: 850;
    text-transform: uppercase;
}

.portal-invoice-line {
    min-height: 54px;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--portal-border);
    font-size: 0.73rem;
}

.portal-invoice-line > span:not(:first-child),
.portal-invoice-line-heading > span:not(:first-child) {
    text-align: right;
}

.portal-invoice-line > span:first-child {
    display: grid;
    gap: 0.15rem;
}

.portal-invoice-line small {
    color: var(--portal-muted);
}

.portal-invoice-totals {
    width: min(100%, 390px);
    margin: 1.5rem 0 0 auto;
}

.portal-invoice-totals div {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    padding: 0.45rem 0;
}

.portal-invoice-totals dt,
.portal-invoice-totals dd {
    margin: 0;
}

.portal-invoice-totals dt {
    color: var(--portal-muted);
    font-size: 0.7rem;
}

.portal-invoice-totals dd {
    color: var(--portal-navy);
    font-weight: 800;
}

.portal-invoice-totals .is-balance {
    margin-top: 0.4rem;
    padding-top: 0.8rem;
    border-top: 2px solid var(--portal-navy);
}

.portal-invoice-totals .is-balance dt,
.portal-invoice-totals .is-balance dd {
    color: var(--portal-navy);
    font-size: 0.9rem;
    font-weight: 900;
}

.portal-invoice-payments,
.portal-invoice-notes {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--portal-border);
}

.portal-invoice-payments h2 {
    margin: 0.25rem 0 0.75rem;
}

.portal-invoice-payments > div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--portal-border);
}

.portal-invoice-payments > div > span {
    display: grid;
    gap: 0.15rem;
}

.portal-invoice-payments small {
    color: var(--portal-muted);
}

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

    .portal-invoice-line-heading {
        display: none;
    }

    .portal-invoice-line {
        grid-template-columns: 1fr;
        gap: 0.45rem;
        padding: 1rem 0;
    }

    .portal-invoice-line > span:not(:first-child) {
        display: flex;
        justify-content: space-between;
        text-align: right;
    }

    .portal-invoice-line > span[data-label]::before {
        content: attr(data-label);
        color: var(--portal-muted);
    }
}

@media (max-width: 820px) {
    .portal-mobile-nav {
        grid-template-columns:
            repeat(4, minmax(0, 1fr));
    }

    .portal-page-heading {
        flex-direction: column;
    }

    .portal-page-actions,
    .portal-page-actions > * {
        width: 100%;
    }

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

@media (max-width: 620px) {
    .portal-invoice-grid,
    .portal-invoice-summary {
        grid-template-columns: 1fr;
    }

    .portal-invoice-document-header {
        flex-direction: column;
    }

    .portal-invoice-document-header > div:last-child {
        text-align: left;
    }
}

.portal-profile-grid {
    display: grid;
    grid-template-columns:
        minmax(240px, 0.7fr)
        minmax(0, 2fr);
    gap: 1rem;
    align-items: start;
}

.portal-profile-summary,
.portal-profile-panel {
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-profile-summary {
    display: grid;
    gap: 1.4rem;
    padding: 1.4rem;
}

.portal-profile-avatar {
    display: grid;
    width: 72px;
    height: 72px;
    place-items: center;
    border-radius: 50%;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-size: 2rem;
    font-weight: 900;
}

.portal-profile-summary h2 {
    margin: 0.3rem 0 0.25rem;
    color: var(--portal-navy);
}

.portal-profile-summary > div > p:last-child {
    margin: 0;
    color: var(--portal-muted);
    font-size: 0.75rem;
    overflow-wrap: anywhere;
}

.portal-profile-summary dl {
    display: grid;
    gap: 0.75rem;
    margin: 0;
    padding-top: 1.2rem;
    border-top: 1px solid var(--portal-border);
}

.portal-profile-summary dl div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.portal-profile-summary dt {
    color: var(--portal-muted);
    font-size: 0.67rem;
}

.portal-profile-summary dd {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 850;
    text-align: right;
}

.portal-profile-panel {
    padding: clamp(1.25rem, 3vw, 2rem);
}

.portal-profile-panel > header {
    margin-bottom: 1.5rem;
}

.portal-profile-panel > header h2 {
    margin: 0.3rem 0 0.4rem;
    color: var(--portal-navy);
}

.portal-profile-panel > header p:last-child {
    margin: 0;
    color: var(--portal-muted);
    font-size: 0.76rem;
}

.portal-profile-form {
    display: grid;
    gap: 1.6rem;
}

.portal-profile-form fieldset {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.portal-profile-form legend {
    width: 100%;
    margin-bottom: 0.9rem;
    padding-bottom: 0.55rem;
    border-bottom: 1px solid var(--portal-border);
    color: var(--portal-navy);
    font-size: 0.76rem;
    font-weight: 900;
}

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

.portal-profile-form label {
    display: grid;
    gap: 0.35rem;
}

.portal-profile-form label > span {
    color: var(--portal-text);
    font-size: 0.68rem;
    font-weight: 800;
}

.portal-profile-form label > small {
    color: var(--portal-muted);
    font-size: 0.62rem;
}

.portal-profile-form input {
    width: 100%;
    min-height: 43px;
    box-sizing: border-box;
    padding: 0.6rem 0.7rem;
    border: 1px solid var(--portal-border);
    background: #fff;
    color: var(--portal-text);
    font: inherit;
    font-size: 0.76rem;
}

.portal-profile-form input:focus {
    outline: 2px solid var(--portal-green);
    border-color: var(--portal-green);
}

.portal-profile-wide-field {
    grid-column: 1 / -1;
}

.portal-profile-errors {
    padding: 0.9rem 1rem;
    border-left: 4px solid #b63a45;
    background: #fff1f2;
    color: #812b33;
}

.portal-profile-errors ul {
    margin: 0.5rem 0 0;
    padding-left: 1.2rem;
}

.portal-profile-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--portal-border);
}

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

    .portal-mobile-nav {
        grid-template-columns:
            repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .portal-profile-form-grid {
        grid-template-columns: 1fr;
    }

    .portal-profile-wide-field {
        grid-column: auto;
    }

    .portal-profile-actions,
    .portal-profile-actions .portal-primary-button {
        width: 100%;
    }

    .portal-profile-summary dl div {
        align-items: flex-start;
    }

    .portal-mobile-nav a {
        font-size: 0.56rem;
    }
}

.portal-pay-button {
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 1px solid var(--portal-green);
    background: var(--portal-green);
    color: var(--portal-primary-text);
    font: inherit;
    font-size: 0.72rem;
    font-weight: 850;
}

.portal-pay-button:disabled {
    cursor: not-allowed;
    opacity: 0.72;
}

.portal-pay-button.is-disabled {
    border-color: var(--portal-border);
    background: #fff;
    color: var(--portal-muted);
}

.portal-payment-form {
    display: inline-flex;
    margin: 0;
}

.portal-payment-result {
    width: min(620px, 100%);
    box-sizing: border-box;
    margin: 3rem auto;
    padding: clamp(1.6rem, 5vw, 3rem);
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
    text-align: center;
}

.portal-payment-result-icon {
    display: grid;
    width: 64px;
    height: 64px;
    margin: 0 auto 1.2rem;
    place-items: center;
    border-radius: 50%;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-size: 1.8rem;
    font-weight: 900;
}

.portal-payment-result-icon.is-cancelled {
    background: #f5eeee;
    color: #92545a;
}

.portal-payment-result h1 {
    margin: 0.4rem 0 0.8rem;
    color: var(--portal-navy);
}

.portal-payment-result > p:last-of-type {
    margin-right: auto;
    margin-left: auto;
    color: var(--portal-muted);
    line-height: 1.65;
}

.portal-payment-result-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.7rem;
    margin-top: 1.5rem;
}

.portal-onboarding-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.5rem;
}

.portal-onboarding-hero h1 {
    margin: 0.35rem 0 0.6rem;
    color: var(--portal-navy);
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.05;
}

.portal-onboarding-hero > div:first-child > p:last-child {
    max-width: 720px;
    margin: 0;
    color: var(--portal-muted);
    line-height: 1.6;
}

.portal-onboarding-progress-summary {
    display: grid;
    min-width: 110px;
    text-align: right;
}

.portal-onboarding-progress-summary strong {
    color: var(--portal-green);
    font-size: 2.2rem;
    line-height: 1;
}

.portal-onboarding-progress-summary span {
    color: var(--portal-muted);
    font-size: 0.72rem;
    font-weight: 750;
}

.portal-onboarding-progress {
    margin-bottom: 1.5rem;
    padding: 1.35rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-onboarding-progress-track {
    height: 7px;
    margin-bottom: 1.4rem;
    overflow: hidden;
    background: var(--portal-green-soft);
}

.portal-onboarding-progress-track span {
    display: block;
    height: 100%;
    background: var(--portal-green);
    transition: width 200ms ease;
}

.portal-onboarding-progress ol {
    display: grid;
    grid-template-columns:
        repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.portal-onboarding-progress li {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 0.65rem;
    align-items: center;
    color: var(--portal-muted);
}

.portal-onboarding-progress li > span {
    display: grid;
    width: 32px;
    height: 32px;
    place-items: center;
    border: 1px solid var(--portal-border);
    border-radius: 50%;
    background: var(--portal-page);
    font-size: 0.7rem;
    font-weight: 900;
}

.portal-onboarding-progress li div {
    display: grid;
    gap: 0.12rem;
}

.portal-onboarding-progress li strong {
    color: var(--portal-text);
    font-size: 0.75rem;
}

.portal-onboarding-progress li small {
    font-size: 0.63rem;
}

.portal-onboarding-progress li.is-current > span {
    border-color: var(--portal-green);
    background: var(--portal-green-soft);
    color: var(--portal-green);
}

.portal-onboarding-progress li.is-complete > span {
    border-color: var(--portal-green);
    background: var(--portal-green);
    color: var(--portal-primary-text);
}

.portal-onboarding-progress li.is-blocked {
    opacity: 0.62;
}

.portal-onboarding-action-card {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 1.25rem;
    padding: clamp(1.4rem, 4vw, 2.3rem);
    border: 1px solid var(--portal-border);
    background: var(--portal-panel);
    box-shadow: var(--portal-shadow);
}

.portal-onboarding-action-card.is-success {
    border-top: 4px solid var(--portal-green);
}

.portal-onboarding-action-icon {
    display: grid;
    width: 54px;
    height: 54px;
    place-items: center;
    border-radius: 50%;
    background: var(--portal-green-soft);
    color: var(--portal-green);
    font-size: 1.35rem;
    font-weight: 900;
}

.portal-onboarding-action-card h2 {
    margin: 0.3rem 0 0.65rem;
    color: var(--portal-navy);
}

.portal-onboarding-action-card p {
    max-width: 720px;
    color: var(--portal-muted);
    line-height: 1.6;
}

.portal-onboarding-actions {
    grid-column: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem;
    margin-top: 0.4rem;
}

.portal-onboarding-actions form {
    margin: 0;
}

.portal-text-button {
    padding: 0.65rem;
    color: var(--portal-muted);
    font-size: 0.75rem;
    font-weight: 750;
    text-decoration: none;
}

.portal-onboarding-invoice-summary {
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr))
        minmax(150px, 1.2fr);
    gap: 0.75rem;
    margin: 1.2rem 0;
}

.portal-onboarding-invoice-summary span {
    display: grid;
    gap: 0.25rem;
    padding: 0.9rem;
    border: 1px solid var(--portal-border);
    background: var(--portal-page);
}

.portal-onboarding-invoice-summary small {
    color: var(--portal-muted);
    font-size: 0.64rem;
}

.portal-onboarding-invoice-summary strong {
    color: var(--portal-navy);
    font-size: 0.8rem;
}

.portal-onboarding-invoice-summary .is-total {
    border-color: var(--portal-green);
    background: var(--portal-green-soft);
}

.portal-onboarding-invoice-summary .is-total strong {
    color: var(--portal-green);
    font-size: 1.25rem;
}

.portal-onboarding-waiting {
    color: var(--portal-muted);
    font-size: 0.8rem;
}

.portal-waiting-ellipsis::after {
    content: ".";
    animation: portal-waiting-ellipsis 1.2s steps(1, end) infinite;
}

@keyframes portal-waiting-ellipsis {
    0% { content: "."; }
    33% { content: ".."; }
    66%, 100% { content: "..."; }
}

@media (max-width: 760px) {
    .portal-onboarding-hero {
        display: grid;
        gap: 1rem;
    }

    .portal-onboarding-progress-summary {
        text-align: left;
    }

    .portal-onboarding-progress ol {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 520px) {
    .portal-onboarding-action-card {
        grid-template-columns: 1fr;
    }

    .portal-onboarding-actions {
        grid-column: 1;
        display: grid;
    }

    .portal-onboarding-actions a,
    .portal-onboarding-actions button {
        width: 100%;
        box-sizing: border-box;
        text-align: center;
    }

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

/* =========================================================
   Customer portal login and form visibility corrections
   ========================================================= */

.customer-portal-body input[type="email"],
.customer-portal-body input[type="text"],
.customer-portal-body input[type="tel"],
.customer-portal-body input[type="date"],
.customer-portal-body input[type="password"],
.customer-portal-body textarea,
.customer-portal-body select {
    width: 100%;
    box-sizing: border-box;
    min-height: 46px;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--portal-border);
    border-radius: 4px;
    background: var(--color-surface);
    color: var(--color-text);
    font: inherit;
}

.customer-portal-body textarea {
    min-height: 110px;
    resize: vertical;
}

.customer-portal-body input::placeholder,
.customer-portal-body textarea::placeholder {
    color: var(--color-text-muted);
    opacity: 1;
}

.customer-portal-body input:focus,
.customer-portal-body textarea:focus,
.customer-portal-body select:focus {
    border-color: var(--portal-green);
    outline: 3px solid var(--portal-green);
    outline-offset: 1px;
}

.customer-portal-body label {
    color: var(--portal-text);
}

.customer-portal-body label > span,
.customer-portal-body .form-label {
    display: block;
    margin-bottom: 0.35rem;
    color: var(--portal-text);
    font-size: 0.76rem;
    font-weight: 750;
}

.customer-portal-body input:-webkit-autofill,
.customer-portal-body input:-webkit-autofill:hover,
.customer-portal-body input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--color-text);
    background: var(--color-surface);
}

.portal-login-card,
.customer-portal-login-card,
.customer-portal-auth-card {
    color: var(--portal-text);
}

.portal-login-card form,
.customer-portal-login-card form,
.customer-portal-auth-card form {
    display: grid;
    gap: 1rem;
}


/* Customer AutoPay */
.portal-autopay-method {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--portal-border);
    margin-bottom: 1rem;
}

.portal-autopay-method > div {
    display: grid;
    gap: 0.25rem;
}

.portal-autopay-method span {
    color: var(--portal-muted);
    font-size: 0.9rem;
}

.portal-autopay-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2rem;
    padding: 0 0.75rem;
    border: 1px solid currentColor;
    font-weight: 700;
    white-space: nowrap;
}


/* Operator customer-portal preview */
.portal-preview-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-bottom: 2px solid currentColor;
    background: var(--portal-panel);
}

.portal-preview-banner > div {
    display: grid;
    gap: 0.2rem;
}

.portal-preview-banner strong {
    font-weight: 800;
}

.portal-preview-banner span {
    font-size: 0.9rem;
}

.portal-preview-banner form {
    margin: 0;
}

.portal-preview-return {
    min-height: 2.5rem;
    padding: 0 1rem;
    border: 1px solid currentColor;
    background: transparent;
    color: inherit;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 720px) {
    .portal-preview-banner {
        align-items: stretch;
        flex-direction: column;
    }

    .portal-preview-return {
        width: 100%;
    }
}
.portal-move-out-warning {
    border: 1px solid var(--color-danger);
    border-left: 5px solid var(--color-danger);
    border-radius: 14px;
    background: var(--color-surface-secondary);
    color: var(--color-text);
    margin-top: 1.5rem;
}

.portal-move-out-warning-heading {
    display: flex;
    align-items: flex-start;
    gap: .8rem;
    padding: 1rem 1rem 0;
}

.portal-move-out-warning-heading h3 { margin: 0 0 .25rem; color: var(--color-text); }
.portal-move-out-warning-heading p { margin: 0; color: var(--color-text-muted); }
.portal-warning-icon {
    display: grid;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: var(--color-danger);
    color: #fff;
    font-weight: 900;
    place-items: center;
}

.portal-move-out-toolbar {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
}

.portal-move-out-toolbar label,
.portal-unit-contents label { display: grid; gap: .35rem; }
.portal-checkbox-control,
.portal-unit-select { align-items: center; display: flex !important; gap: .65rem; }
.portal-selection-control {
    min-height: 48px;
    padding: .45rem .65rem;
    border: 2px solid var(--color-border-subtle);
    border-radius: 10px;
    background: var(--color-surface);
    color: var(--portal-text);
    cursor: pointer;
    font-size: 1rem;
    font-weight: 800;
}
.portal-selection-control:hover { border-color: var(--color-danger); }
.portal-selection-control:has(input:checked) {
    border-color: var(--color-danger);
    background: var(--color-surface-secondary);
    color: var(--color-text);
    border-width: 3px;
}
.portal-selection-control input[type="checkbox"] {
    width: 1.6rem;
    height: 1.6rem;
    flex: 0 0 1.6rem;
    margin: 0;
    accent-color: var(--color-danger);
    cursor: pointer;
}
.portal-selection-control:has(input:focus-visible) {
    outline: 3px solid var(--portal-green);
    outline-offset: 3px;
}
.portal-date-input {
    min-height: 44px;
    padding: .6rem .75rem;
    border: 1px solid var(--portal-border);
    border-radius: 8px;
    background: var(--color-surface);
    color: var(--portal-text);
    font: inherit;
}
.portal-date-input:focus-visible {
    outline: 3px solid var(--portal-green);
    outline-offset: 2px;
}
.portal-unit-contents > p { color: var(--portal-text); font-size: 1rem; }
.portal-unit-contents > small { color: var(--portal-muted); font-size: 0.875rem; }
.portal-move-out-warning .ui-button-danger {
    border-color: #a8242e;
    background: #a8242e;
    color: #fff;
}
.portal-move-out-warning .ui-button-danger:hover:not(:disabled) { background: #811821; color: #fff; }
.portal-move-out-warning .ui-button-danger:disabled {
    border-color: #927579;
    background: #80696c;
    color: #fff;
}
.portal-unit-contents { border-top: 1px solid var(--color-border-subtle); margin-top: 1rem; padding-top: 1rem; }
.portal-unit-contents p { margin: .4rem 0; }
.portal-unit-contents details { margin-top: .75rem; }
.portal-unit-contents textarea { box-sizing: border-box; margin-top: .5rem; width: 100%; }
.portal-move-out-review { padding: 1.5rem; }
.portal-move-out-review ul { margin-bottom: 1.5rem; }
.portal-move-out-review form { display: flex; flex-wrap: wrap; gap: .75rem; }
.portal-notice-unit-list { display: grid; gap: .5rem; padding-left: 1.25rem; }
.portal-move-out-document { margin-bottom: 1rem; }
.portal-withdraw-notice { padding: 1.5rem; }
.portal-withdraw-notice form { display: flex; flex-wrap: wrap; gap: .75rem; }
.portal-unit-empty-confirmation { max-width: 720px; margin: 0 auto; }
.portal-unit-empty-confirmation form { display: grid; gap: 1rem; }
.portal-unit-empty-confirmation label { display: grid; gap: .4rem; }
.portal-unit-empty-confirmation textarea { min-height: 7rem; padding: .75rem; font: inherit; }
.portal-unit-empty-actions { display: flex; flex-wrap: wrap; gap: .75rem; }

@media (max-width: 620px) {
    .portal-move-out-toolbar { align-items: stretch; flex-direction: column; }
    .portal-selection-control,
    .portal-move-out-date,
    .portal-move-out-toolbar .ui-button { width: 100%; box-sizing: border-box; }
}
