/* cozan look for MudBlazor. Colours and type come from Theme/CozanTheme.cs (MudBlazor's palette) and
   css/tokens.css (the cozan tokens, for what the palette has no slot for). This file covers what MudTheme can't:
   flat buttons, card shape, focus rings, the nav and a few cozan-only pieces (eyebrow, service accents, mono).
   Brand rules: cozan.co.za-astro-site/design-system/README.md. */

:root {
    color-scheme: light;
}
[data-theme="dark"] {
    color-scheme: dark;
}

html {
    scroll-padding-top: 80px;
}

body {
    -webkit-text-size-adjust: 100%;
    overflow-wrap: break-word;
}

/* Plain links in copy; MudBlazor's own links and buttons keep their colours. */
a:not([class]) {
    color: var(--action);
    text-underline-offset: 3px;
}
a:not([class]):hover {
    color: var(--action-hover);
}

/* Every focusable element shows a 2px solid focus ring with 2px offset. Never remove it. */
:focus-visible,
.mud-button-root:focus-visible,
.mud-nav-link:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}
/* FocusOnNavigate / skip link moves focus programmatically; suppress ring on non-interactive containers. */
h1:focus,
#main-content:focus {
    outline: none;
}

/* Long unbroken words (domains) wrap instead of overflowing on phones. */
.mud-typography-h1,
.mud-typography-h2,
.mud-typography-h3,
.mud-typography-h4 {
    overflow-wrap: anywhere;
    text-wrap: balance;
}
@media (max-width: 767.98px) {
    .mud-typography-h1 {
        font-size: 2.5rem;
        line-height: 1.1;
    }
    .mud-typography-h2 {
        font-size: 2rem;
        line-height: 1.1875;
    }
}

.mono,
code {
    font-family: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    font-weight: 500;
}
code {
    font-size: 0.9em;
    color: inherit;
}

.cz-measure {
    max-width: 68ch;
}

/* Visually hidden but kept in the accessibility tree (e.g. skip link, polite live-region announcer). */
.visually-hidden:where(:not(:focus-within, :active)) {
    position: absolute !important;
    clip-path: inset(50%) !important;
    overflow: hidden !important;
    width: 1px !important;
    height: 1px !important;
    margin: -1px !important;
    padding: 0 !important;
    border: 0 !important;
    white-space: nowrap !important;
}

.cz-skip-link:focus-visible {
    position: fixed;
    inset-block-start: var(--space-3);
    inset-inline-start: var(--space-3);
    z-index: 2100;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--action);
    color: var(--on-action);
    font-weight: 600;
    text-decoration: none;
}

/* ---------- Buttons: flat, no ripple, cozan sizes ---------- */

.mud-button-root .mud-ripple,
.mud-ripple:after {
    display: none;
}
.mud-button-filled,
.mud-button-filled:hover,
.mud-button-filled:active,
.mud-button-filled:focus-visible {
    box-shadow: none;
}
.mud-button-root {
    transition:
        background-color var(--dur-fast) var(--ease-out),
        border-color var(--dur-fast) var(--ease-out),
        color var(--dur-fast) var(--ease-out);
}
.mud-button-filled { padding: 12px 24px; }
.mud-button-outlined { padding: 11px 23px; }
.mud-button-filled-size-small { padding: 8px 16px; font-size: 0.9375rem; line-height: 1.333; }
.mud-button-outlined-size-small { padding: 7px 15px; font-size: 0.9375rem; line-height: 1.333; }
.mud-button-filled-size-large { padding: 16px 32px; font-size: 1.125rem; }
.mud-button-outlined-size-large { padding: 15px 31px; font-size: 1.125rem; }

/* Secondary button: surface fill, border-strong outline, ink label; the outline turns ink on hover. */
.mud-button-outlined.mud-button-outlined-default {
    background: var(--surface);
    border-color: var(--border-strong);
}
.mud-button-outlined.mud-button-outlined-default:hover {
    background: var(--surface);
    border-color: var(--ink);
}

/* Forward-moving buttons: put CozanIcons.Arrow in EndIcon and it nudges on hover. */
@media (prefers-reduced-motion: no-preference) {
    .mud-button-root .mud-button-icon-end {
        transition: transform var(--dur-move) var(--ease-out);
    }
    .mud-button-root:hover .mud-button-icon-end {
        transform: translateX(3px);
    }
}

/* ---------- Cards: border plus shadow-sm, radius-lg ---------- */

.mud-card,
.mud-paper.cz-card {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.mud-card.mud-paper-outlined,
.mud-paper-outlined.cz-card {
    border-color: var(--border);
    box-shadow: var(--shadow-sm);
}
.mud-card-content.mud-card-content-padding {
    padding: var(--space-6);
}
.mud-card-header.mud-card-header-padding {
    padding: var(--space-6) var(--space-6) 0;
}
.mud-card-actions.mud-card-actions-padding {
    padding: 0 var(--space-6) var(--space-6);
    gap: var(--space-3);
}

/* Only cards you can act on lift, to shadow-md plus a 2px rise. */
.cz-card-action {
    transition:
        box-shadow var(--dur-fast) var(--ease-out),
        transform var(--dur-move) var(--ease-out);
}
.cz-card-action:hover {
    box-shadow: var(--shadow-md) !important;
    transform: translateY(-2px);
}
@media (hover: none), (prefers-reduced-motion: reduce) {
    .cz-card-action:hover {
        transform: none;
    }
}

/* Service accent: a 4px top rule. Never a coloured left border. */
.cz-accent::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: var(--cz-accent, var(--brand-rose));
}
.cz-accent-rose { --cz-accent: var(--brand-rose); }
.cz-accent-workspace { --cz-accent: var(--workspace-blue); }
.cz-accent-web { --cz-accent: var(--web-amber); }
.cz-accent-security { --cz-accent: var(--security-green); }
.cz-accent-insight { --cz-accent: var(--insight-violet); }

/* ---------- Badges: MudChip with Class="cz-badge" is the small mono tag ---------- */

.mud-chip.cz-badge {
    height: auto;
    margin: 0;
    padding: 3px var(--space-2);
    border-radius: var(--radius-sm);
    font-family: "IBM Plex Mono", ui-monospace, monospace;
    font-size: 0.75rem;
    line-height: 1.333;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.mud-chip.cz-badge.mud-chip-color-default {
    background: var(--surface-muted);
    color: var(--ink-muted);
    border: 1px solid var(--border);
}

/* ---------- Alerts: tint, no border ---------- */

.mud-alert {
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.5;
}
.mud-alert-text-normal {
    background: var(--surface-muted);
    border: 1px solid var(--border);
}
.mud-alert-text-success { background: var(--security-green-soft); }
.mud-alert-text-warning { background: var(--web-amber-soft); }
.mud-alert-text-error { background: var(--danger-soft); }
.mud-alert-text-info { background: var(--workspace-blue-soft); }

/* ---------- Tables ---------- */

.mud-table {
    container: cz-table / inline-size;
}
.mud-table.mud-paper-outlined {
    border-radius: var(--radius-lg);
    border-color: var(--border);
    overflow: hidden;
}
.mud-table-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    height: auto;
    min-height: 64px;
    padding: var(--space-4);
}
.cz-table-search {
    flex: 1 1 240px;
    max-inline-size: 360px;
    min-inline-size: 0;
}
@container cz-table (inline-size < 40rem) {
    .cz-table-search {
        flex: 1 1 100%;
        max-inline-size: 100%;
    }
    .mud-table-toolbar > .mud-spacer {
        display: none;
    }
}
.mud-table-root .mud-table-head .mud-table-cell,
.mud-simple-table table thead th {
    font-size: 0.875rem;
    line-height: 1.429;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-wrap: balance;
    color: var(--ink-muted);
    background: var(--surface-muted);
}
.mud-table-root .mud-table-body .mud-table-cell,
.mud-simple-table table tbody td {
    font-size: 1rem;
    line-height: 1.5;
}
.mud-table-cell.num {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}
/* Subscriptions: friendly service names wrap at word boundaries in title case; fallback codes keep exact casing. */
.cz-service-name {
    min-inline-size: 0;
    overflow-wrap: break-word;
    text-transform: capitalize;
}
.cz-service-name.mono {
    overflow-wrap: anywhere;
    text-transform: none;
}
/* Mobile stacked-card layout for MudTable Breakpoint.Sm (< 960px). */
@media (max-width: 960px) {
    .mud-sm-table .mud-table-smalldevices-sortselect {
        padding: var(--space-2) var(--space-4) var(--space-3);
        border-top: 1px solid var(--border);
        background: var(--surface);
    }
    .mud-sm-table .mud-table-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-3);
        padding: var(--space-3);
        background: var(--surface-muted);
        border-top: 1px solid var(--border);
    }
    .mud-sm-table .mud-table-body .mud-table-row {
        display: block;
        background: var(--surface);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        overflow: hidden;
    }
    .mud-sm-table .mud-table-body .mud-table-cell {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: var(--space-3);
        padding: var(--space-2) var(--space-4);
        border-bottom: 1px solid var(--border);
        font-size: 0.9375rem;
        line-height: 1.45;
        text-align: end !important;
    }
    .mud-sm-table .mud-table-body .mud-table-row .mud-table-cell:last-child {
        border-bottom: none;
    }
    .mud-sm-table .mud-table-body .mud-table-cell::before {
        content: attr(data-label);
        flex: 0 0 auto;
        font-size: 0.8125rem;
        font-weight: 600;
        color: var(--ink-muted);
        text-align: start;
        padding-inline-end: var(--space-2);
    }
    /* Primary identifying cell becomes the card header band (no redundant ::before label). */
    .mud-sm-table .mud-table-body .mud-table-cell.cz-cell-primary {
        justify-content: flex-start;
        padding: var(--space-3) var(--space-4);
        background: var(--surface-muted);
        border-bottom: 1px solid var(--border);
        font-weight: 600;
        text-align: start !important;
    }
    .mud-sm-table .mud-table-body .mud-table-cell.cz-cell-primary::before {
        content: none;
    }
    /* Trailing action cells without a DataLabel stay cleanly right-aligned with no empty label gutter. */
    .mud-sm-table .mud-table-body .mud-table-cell.cz-cell-action {
        justify-content: flex-end;
        padding-block: var(--space-1);
    }
    .mud-sm-table .mud-table-body .mud-table-cell.cz-cell-action::before {
        content: none;
    }
    .mud-sm-table .mud-table-body .mud-table-cell.cz-cell-empty {
        display: none;
    }
    /* Expanded detail row (Subscriptions invoices) attaches seamlessly to the card above it. */
    .mud-sm-table .mud-table-body .mud-table-row:has(> .cz-expanded-row) {
        margin-block-start: calc(var(--space-3) * -1 - 1px);
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        border-top: 0;
    }
    .mud-sm-table .mud-table-body .mud-table-row:has(+ .mud-table-row > .cz-expanded-row) {
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
    }
    .mud-sm-table .mud-table-body td.cz-expanded-row {
        display: block;
        padding: var(--space-3) var(--space-4) !important;
        text-align: start !important;
    }
    .mud-sm-table .mud-table-body td.cz-expanded-row::before {
        content: none;
    }
    /* NoRecords / loading colspan rows should not look like data cards. */
    .mud-sm-table .mud-table-body tr:has(> td[colspan]:not(.cz-expanded-row)) {
        background: transparent;
        border: 0;
        box-shadow: none;
    }
    .mud-sm-table .mud-table-body tr:has(> td[colspan]:not(.cz-expanded-row)) > td {
        display: block;
        text-align: start !important;
        border-bottom: 0;
    }
    .mud-sm-table .mud-table-body tr:has(> td[colspan]:not(.cz-expanded-row)) > td::before {
        content: none;
    }
}
@media (pointer: coarse) {
    .mud-table-body .mud-icon-button,
    .mud-table-toolbar .mud-icon-button,
    .mud-table-pagination .mud-icon-button {
        min-block-size: 44px;
        min-inline-size: 44px;
    }
}

/* ---------- Forms ---------- */

/* Field layout: one column on phones, two from 640px, space-5 between fields. */
.cz-form-grid {
    display: grid;
    gap: var(--space-5);
    align-items: start;
}
@media (min-width: 640px) {
    .cz-form-grid.two {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
/* The contact form: a readable line length, not the full container. */
.cz-contact {
    max-width: 640px;
}
/* Hints at the site's size: 14px, ink-muted. */
.mud-input-helper-text {
    font-size: 0.875rem;
    line-height: 1.429;
    font-weight: 500;
    letter-spacing: normal;
}

/* ---------- App shell ---------- */

.cz-appbar {
    border-bottom: 1px solid var(--border);
}
.cz-appbar .mud-toolbar {
    gap: var(--space-2);
}
.cz-brand {
    display: inline-flex;
    padding-block: var(--space-2);
    margin-inline: var(--space-2) var(--space-4);
}

.cz-drawer {
    border-inline-end: 1px solid var(--border);
}
/* Account menu: the avatar in the app bar opens it. */
.cz-avatar-btn {
    display: inline-flex;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    cursor: pointer;
}
.cz-account-menu {
    width: 260px;
}
.cz-account-menu__who {
    padding: var(--space-4);
    min-width: 0;
}

/* Drawer: the nav on top, the signed-in user and Sign out pinned to the bottom. */
.cz-drawer__body {
    display: flex;
    flex-direction: column;
    min-height: 100%;
}
.cz-drawer__body .cz-nav {
    flex: 1;
}
.cz-drawer__account {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-3);
    border-top: 1px solid var(--border);
}
.cz-drawer__user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding-inline: var(--space-3);
    min-width: 0;
}
.cz-drawer__who {
    min-width: 0;
}
.cz-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
/* Sign out in the drawer and the account menu: styled like a nav link. */
.mud-button-root.cz-signout-item {
    justify-content: flex-start;
    padding: var(--space-2) var(--space-3);
    font-size: 1rem;
    color: var(--ink-muted);
}
.mud-button-root.cz-signout-item:hover {
    color: var(--ink);
    background: var(--surface-muted);
}
.cz-drawer__version {
    padding: var(--space-2) var(--space-6) var(--space-4);
    font-size: 0.75rem;
    color: var(--ink-muted);
}

.cz-nav {
    padding: var(--space-4) var(--space-3);
}
.cz-nav .mud-nav-link {
    margin-block-end: var(--space-1);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 600;
    color: var(--ink-muted);
}
.cz-nav .mud-nav-link:hover:not(.mud-nav-link-disabled) {
    color: var(--ink);
    background: var(--surface-muted);
}
.cz-nav .mud-nav-link.active:not(.mud-nav-link-disabled) {
    color: var(--action);
    background: var(--brand-rose-soft);
    border-inline-end: 0;
}
.cz-nav .mud-nav-link .mud-nav-link-icon {
    color: inherit;
}

.mud-main-content {
    background: var(--surface-muted);
    min-height: 100vh;
    min-height: 100dvh;
}

.cz-main {
    padding-block: var(--space-6) var(--space-8);
}
@media (max-width: 767.98px) {
    .cz-main {
        padding-block: var(--space-5) var(--space-7);
    }
}

/* ---------- Dashboard ---------- */

.cz-dash-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}
.cz-dash-header__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}
.cz-dash-title {
    margin: 0;
    letter-spacing: -0.02em;
}
.cz-dash-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    color: var(--ink-muted);
    font-size: 0.9375rem;
}
.cz-dash-meta__sep {
    color: var(--border-strong);
}
.cz-code-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-block-size: 28px;
    min-inline-size: 28px;
    padding: 3px 9px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-raised);
    color: var(--ink);
    font-size: 0.875rem;
    cursor: pointer;
    transition:
        border-color var(--dur-fast) var(--ease-out),
        background-color var(--dur-fast) var(--ease-out);
}
@media (pointer: coarse) {
    .cz-code-copy,
    .cz-period-toggle {
        min-block-size: 44px;
    }
}
.cz-code-copy:hover {
    border-color: var(--border-strong);
    background: var(--surface);
}
.cz-code-copy .mud-svg-icon {
    font-size: 0.95rem;
    color: var(--ink-muted);
}
.cz-dash-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr);
    gap: var(--space-5);
    align-items: start;
}
.cz-dash-primary,
.cz-dash-rail {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    min-width: 0;
}
@media (max-width: 1024px) {
    .cz-dash-grid {
        grid-template-columns: 1fr;
    }
}

/* Balance hero card: crisp raised surface with rose top rule, matching light and dark themes cleanly. */
.cz-balance-panel {
    position: relative;
    background: var(--surface-raised);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.cz-balance-panel__body {
    padding: var(--space-6);
}
.cz-balance-panel__heading {
    margin: 0 0 var(--space-2);
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 600;
    color: var(--ink-muted);
}
.cz-balance-panel__amount {
    margin: 0;
    font-size: clamp(2.25rem, 1.5rem + 2.5vw, 3.25rem);
    line-height: 1.05;
    font-weight: 800;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}
.cz-balance-panel__status {
    margin: var(--space-2) 0 0;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink-muted);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}
.cz-balance-panel__status--settled {
    color: var(--security-green-text);
}
.cz-balance-panel__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}
.cz-period-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-block-size: 32px;
    margin-inline-start: auto;
    padding: var(--space-2) var(--space-1);
    border: 0;
    background: transparent;
    color: var(--ink-muted);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--dur-fast) var(--ease-out);
}
.cz-period-toggle:hover {
    color: var(--ink);
}
@media (prefers-reduced-motion: no-preference) {
    .cz-period-toggle .mud-svg-icon {
        transition: transform var(--dur-move) var(--ease-out);
    }
}
.cz-period-toggle .cz-chevron-open {
    transform: rotate(180deg);
}
@media (max-width: 639.98px) {
    .cz-period-toggle {
        margin-inline-start: 0;
    }
}
.cz-statement-drawer {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
}

/* Dashboard section headers & lists */
.cz-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.cz-section-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9375rem;
    font-weight: 600;
    white-space: nowrap;
}
.cz-section-link .mud-svg-icon {
    font-size: 1rem;
}
@media (prefers-reduced-motion: no-preference) {
    .cz-section-link .mud-svg-icon {
        transition: transform var(--dur-move) var(--ease-out);
    }
    .cz-section-link:hover .mud-svg-icon {
        transform: translateX(3px);
    }
}

.cz-activity-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cz-activity-row {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) auto 36px;
    align-items: center;
    gap: var(--space-3);
    padding-block: 12px;
    border-top: 1px solid var(--border);
}
.cz-activity-row:first-child {
    border-top: 0;
    padding-top: 2px;
}
.cz-activity-row:last-child {
    padding-bottom: 0;
}
.cz-activity-date {
    font-size: 0.875rem;
    color: var(--ink-muted);
    font-variant-numeric: tabular-nums;
}
.cz-activity-desc {
    min-width: 0;
}
.cz-activity-name {
    display: block;
    font-weight: 600;
    color: var(--ink);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cz-activity-sub {
    font-size: 0.875rem;
    color: var(--ink-muted);
}
.cz-activity-amount {
    font-size: 1rem;
    font-weight: 600;
    text-align: right;
}
.cz-amount-credit {
    color: var(--security-green-text);
}
.cz-activity-action {
    display: inline-flex;
    justify-content: flex-end;
}
@media (max-width: 639.98px) {
    .cz-activity-row {
        grid-template-columns: 78px minmax(0, 1fr) auto 32px;
        gap: var(--space-2);
    }
}

.cz-subs-metric {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}
.cz-subs-count {
    font-size: 2rem;
    line-height: 1.1;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}
.cz-subs-next {
    font-size: 0.875rem;
    color: var(--ink-muted);
}
.cz-subs-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cz-subs-list li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-block: 10px;
    border-top: 1px solid var(--border);
}
.cz-subs-list li:first-child {
    border-top: 0;
}
.cz-subs-list li:last-child {
    padding-bottom: 0;
}
.cz-subs-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
}
.cz-subs-ref {
    font-size: 0.875rem;
    color: var(--ink-muted);
    overflow-wrap: anywhere;
}

.cz-ref-block {
    padding-block: var(--space-4);
    border-top: 1px solid var(--border);
}
.cz-ref-block:first-child {
    border-top: 0;
    padding-top: 0;
}
.cz-kv-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--ink-muted);
    margin-bottom: 3px;
}
.cz-kv-value {
    font-size: 0.9375rem;
    color: var(--ink);
}
.cz-kv-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}
.cz-contacts-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}
.cz-contact-row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.cz-contact-info {
    min-width: 0;
}
.cz-contact-name {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink);
}
.cz-contact-role {
    font-weight: 500;
    color: var(--ink-muted);
    font-size: 0.875rem;
}
.cz-contact-email {
    font-size: 0.875rem;
    color: var(--ink-muted);
    overflow-wrap: anywhere;
}
.cz-ref-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-4);
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--border);
    font-size: 0.9375rem;
    font-weight: 600;
}

/* ---------- Shared portal page polish ---------- */

.cz-account-context {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--ink-muted);
}

.cz-amount-display {
    margin: 0;
    font-size: clamp(2rem, 1.25rem + 2.25vw, 2.75rem);
    line-height: 1.08;
    font-weight: 800;
    letter-spacing: -0.025em;
    font-variant-numeric: tabular-nums;
    color: var(--ink);
}

.cz-result-card {
    max-width: 640px;
}

.cz-status-card {
    max-width: 560px;
}

.cz-role-primary {
    font-weight: 600;
    color: var(--ink);
}

.cz-expanded-row {
    padding: var(--space-4) var(--space-6) !important;
    background: var(--surface-muted);
    box-shadow: inset 3px 0 0 var(--workspace-blue);
}
@media (forced-colors: active) {
    .cz-expanded-row {
        border-inline-start: 3px solid Highlight;
    }
}
.cz-expanded-invoices {
    list-style: none;
    margin: 0;
    padding: 0;
}
.cz-expanded-invoices li {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding-block: 4px;
}

.cz-avatar {
    background: var(--brand-rose-soft) !important;
    color: var(--action) !important;
    font-weight: 700;
}

.cz-page-header {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    margin-bottom: var(--space-6);
}
.cz-page-header__text {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    min-width: 0;
}

/* ---------- Blazor error UI ---------- */

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0;
    z-index: 2000;
    padding: var(--space-3) var(--space-8) var(--space-3) var(--space-5);
    background: var(--danger-soft);
    color: var(--danger);
    font-weight: 600;
    border-top: 1px solid var(--danger);
    box-shadow: var(--shadow-md);
}
#blazor-error-ui .reload {
    margin-inline-start: var(--space-3);
    color: inherit;
}
#blazor-error-ui .dismiss {
    position: absolute;
    inset-inline-end: var(--space-4);
    inset-block-start: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    line-height: 1;
    cursor: pointer;
}

.blazor-error-boundary {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    background: var(--danger-soft);
    color: var(--danger);
    font-weight: 600;
}
.blazor-error-boundary::after {
    content: "Something went wrong on this part of the page.";
}

/* Account switcher at the top of the nav, aligned with the nav links' inset. */
.cz-account-select {
    padding: 8px 16px 4px;
}

/* Invoice HTML preview: legacy billing HTML is authored for white paper, so the iframe keeps an
   explicit light rendering context and dark mode tones it down into a dark surface without altering
   the downloaded PDF. */
.cz-invoice-sheet {
    background: var(--surface-raised);
    color: var(--ink);
}
.cz-invoice-frame {
    display: block;
    width: 100%;
    height: min(82vh, 1120px);
    min-height: 520px;
    border: 0;
    color-scheme: only light;
    background: #ffffff;
    color: #1c1c1e;
}
[data-theme="dark"] .cz-invoice-frame {
    filter: invert(0.88) hue-rotate(180deg) brightness(1.04) contrast(1.04);
}
@media (forced-colors: active) {
    [data-theme="dark"] .cz-invoice-frame {
        filter: none;
    }
}
@media (max-width: 639.98px) {
    .cz-invoice-frame {
        height: 75vh;
        min-height: 420px;
    }
}

/* ---------- Admin dashboard & impersonation banner ---------- */

.cz-impersonation-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-5);
    border-radius: var(--radius-md);
    background: var(--web-amber-soft);
    border: 1px solid var(--web-amber);
    color: var(--ink);
}
.cz-impersonation-banner__text {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.9375rem;
    line-height: 1.4;
}
.cz-impersonation-banner__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
}

.cz-admin-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}
@media (max-width: 959.98px) {
    .cz-admin-kpis {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
@media (max-width: 599.98px) {
    .cz-admin-kpis {
        grid-template-columns: 1fr;
    }
}
.cz-admin-kpi__label {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin-bottom: var(--space-1);
}
.cz-admin-kpi__value {
    font-size: 2rem;
    line-height: 1.15;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.cz-admin-kpi__sub {
    font-size: 0.875rem;
    color: var(--ink-muted);
    margin-top: var(--space-1);
}

.cz-admin-lookup-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}
@media (max-width: 959.98px) {
    .cz-admin-lookup-grid {
        grid-template-columns: 1fr;
    }
}

.cz-admin-inline-form {
    display: inline-flex;
    align-items: center;
}

.cz-admin-input-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
}
.cz-admin-input-row__field {
    flex: 1 1 220px;
    min-width: 0;
}
.cz-admin-input-row__field--narrow {
    flex: 1 1 280px;
    max-width: 420px;
    min-width: 0;
}
.cz-admin-input-row__btn {
    flex: 0 0 auto;
    white-space: nowrap;
}
