/*
 * Instaweb Control — shared product UI for the no-build Blade interface.
 * Light, calm operational surfaces with an aubergine-neutral shell and a
 * restrained iris accent. All primary palette values use OKLCH.
 */

:root {
    --surface: oklch(0.974 0.008 285);
    --surface-dim: oklch(0.925 0.012 285);
    --container-lowest: oklch(0.995 0.004 285);
    --container-low: oklch(0.96 0.012 285);
    --container: oklch(0.925 0.025 285);
    --container-high: oklch(0.895 0.033 285);
    --container-highest: oklch(0.86 0.04 285);

    --on-surface: oklch(0.235 0.03 275);
    --on-surface-variant: oklch(0.48 0.027 275);
    --inverse-surface: oklch(0.245 0.035 285);
    --inverse-on-surface: oklch(0.955 0.012 285);

    --outline: oklch(0.59 0.025 280);
    --outline-variant: oklch(0.805 0.02 285);
    --border: oklch(0.895 0.016 285);
    --border-strong: oklch(0.835 0.022 285);

    --primary: oklch(0.61 0.19 246);
    --primary-strong: oklch(0.51 0.18 250);
    --on-primary: oklch(0.985 0.006 285);
    --primary-container: oklch(0.92 0.055 246);
    --on-primary-container: oklch(0.34 0.12 250);

    --success: oklch(0.47 0.115 158);
    --success-bg: oklch(0.925 0.045 158);
    --warning: oklch(0.51 0.12 73);
    --warning-bg: oklch(0.935 0.055 78);
    --danger: oklch(0.51 0.18 25);
    --danger-bg: oklch(0.925 0.045 25);
    --info: oklch(0.48 0.15 255);
    --info-bg: oklch(0.92 0.045 255);

    --accent-violet: oklch(0.53 0.16 305);
    --accent-violet-bg: oklch(0.925 0.045 305);
    --accent-cyan: oklch(0.48 0.095 205);
    --accent-cyan-bg: oklch(0.925 0.04 205);
    --sidebar: oklch(0.235 0.032 283);
    --sidebar-muted: oklch(0.74 0.022 283);
    --sidebar-hover: oklch(0.3 0.04 283);
    --sidebar-active: oklch(0.36 0.075 283);

    /* Geometry */
    --radius-sm: 0.375rem;
    --radius: 0.625rem;
    --radius-md: 0.875rem;
    --radius-lg: 1.125rem;
    --radius-xl: 1.375rem;
    --radius-full: 9999px;

    --sidebar-w: 248px;
    --shadow-pop: 0 16px 40px -20px oklch(0.22 0.045 278 / 0.28);
    --shadow-xs: 0 1px 2px oklch(0.22 0.045 278 / 0.06);
    --shadow-sm: 0 1px 2px oklch(0.22 0.045 278 / 0.05), 0 10px 28px -24px oklch(0.22 0.045 278 / 0.26);
    --shadow-md: 0 12px 38px -24px oklch(0.22 0.045 278 / 0.32);
    --shadow-lg: 0 24px 56px -24px oklch(0.18 0.045 278 / 0.38);

    --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --mono: "Manrope", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
html { color-scheme: light; }

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.5;
    background: var(--surface);
    color: var(--on-surface);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid color-mix(in oklch, var(--primary) 28%, transparent);
    outline-offset: 2px;
}

.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.text-muted { color: var(--on-surface-variant); }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ *
 *  App shell — fixed sidebar + fluid content
 * ------------------------------------------------------------------ */
.control-body {
    min-height: 100vh;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    padding: 12px;
    background:
        radial-gradient(circle at 1px 1px, oklch(0.96 0.03 230 / 0.22) 1px, transparent 1.4px) 0 0 / 14px 14px,
        oklch(0.56 0.17 232);
}
.app-shell {
    display: flex;
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    min-height: 0;
    position: relative;
    overflow: clip;
    border: 1px solid oklch(0.97 0.02 230 / 0.5);
    border-radius: 30px;
    background: var(--surface);
    box-shadow: 0 28px 80px -36px oklch(0.18 0.08 238 / 0.55);
}
.app-shell::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    z-index: 0;
    width: var(--sidebar-w);
    background: var(--sidebar);
    transition: width 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar);
    color: var(--inverse-on-surface);
    border-right: 1px solid color-mix(in oklch, var(--sidebar) 82%, var(--inverse-on-surface));
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    z-index: 1;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    padding: 24px 18px 22px;
    color: var(--inverse-on-surface);
}
.sidebar-brand:hover { text-decoration: none; }
.sidebar-brand-lockup { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; }
.sidebar-wordmark {
    display: block;
    width: 148px;
    height: auto;
    filter: brightness(0) invert(1);
}
.sidebar-brand .role {
    display: block; font-size: 10px; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase;
    color: var(--sidebar-muted); margin-top: 4px;
}

.nav { display: flex; flex-direction: column; gap: 4px; padding: 12px 10px; flex: 1; overflow-y: auto; }
.nav-section-label {
    padding: 14px 12px 4px;
    color: oklch(0.68 0.025 283);
    font-size: 9px;
    font-weight: 750;
    letter-spacing: 0.13em;
    line-height: 1;
    text-transform: uppercase;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px;
    color: var(--sidebar-muted); font-weight: 500; font-size: 13.5px;
    transition: background-color 180ms cubic-bezier(0.22, 1, 0.36, 1), color 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.nav-item:hover { background: var(--sidebar-hover); color: var(--inverse-on-surface); text-decoration: none; transform: translateX(2px); }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }
.nav-item.active {
    background: var(--sidebar-active); color: var(--inverse-on-surface); font-weight: 650;
    box-shadow: inset 0 0 0 1px oklch(0.78 0.1 285 / 0.12);
}

/* Mobile-only chrome — the top header (brand + hamburger) and the drawer
   backdrop. Desktop keeps the always-open left sidebar, so all three are hidden
   here and only revealed inside the mobile breakpoint. */
.nav-toggle { display: none; }

.auth-trust-device {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: var(--text);
    cursor: pointer;
}

.auth-trust-device input {
    margin-top: 3px;
}

.auth-trust-device span {
    display: grid;
    gap: 2px;
}

.auth-trust-device small {
    color: var(--muted);
}
.mobile-header { display: none; }
.nav-backdrop { display: none; }

.sidebar-collapse {
    position: fixed;
    z-index: 80;
    top: 58px;
    left: calc(12px + var(--sidebar-w) - 18px);
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border: 5px solid var(--container-lowest);
    border-radius: var(--radius-full);
    background: var(--sidebar);
    color: var(--inverse-on-surface);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: left 220ms cubic-bezier(0.22, 1, 0.36, 1), background-color 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.sidebar-collapse:hover { background: var(--primary); }
.sidebar-collapse svg { width: 16px; height: 16px; }
.app-shell.is-compact { --sidebar-w: 84px; }
.app-shell.is-compact .sidebar-brand { justify-content: center; padding-left: 10px; padding-right: 10px; }
.app-shell.is-compact .sidebar-brand .role,
.app-shell.is-compact .nav-item span,
.app-shell.is-compact .nav-section-label,
.app-shell.is-compact .sidebar-foot .userbar-id,
.app-shell.is-compact .sidebar-foot .userbar-actions { display: none; }
.app-shell.is-compact .sidebar-wordmark { width: 58px; }
.app-shell.is-compact .nav { padding-left: 9px; padding-right: 9px; }
.app-shell.is-compact .nav-item { justify-content: center; padding-left: 10px; padding-right: 10px; }
.app-shell.is-compact .nav-item:hover { transform: none; }
.app-shell.is-compact .sidebar-foot .userbar { justify-content: center; }
.app-shell.is-compact .sidebar-collapse { left: calc(12px + 84px - 18px); }
.app-shell.is-compact .sidebar-collapse svg { transform: rotate(180deg); }

.sidebar-foot { border-top: 1px solid oklch(0.8 0.025 283 / 0.12); padding: 14px 14px 16px; }
.sidebar-foot .who { font-size: 13px; font-weight: 600; word-break: break-all; }
.sidebar-foot .wholabel { font-size: 11px; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: 0.06em; }
.sidebar-foot form { margin: 10px 0 0; }

.main {
    position: relative;
    z-index: 1;
    flex: 1;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    background: var(--surface);
}

.topbar {
    display: flex; align-items: center; justify-content: space-between;
    min-height: 66px; padding: 12px 36px; border-bottom: 1px solid var(--border);
    background: var(--container-lowest); position: sticky; top: 0; z-index: 5;
}
.topbar-context { display: flex; flex-direction: column; gap: 1px; }
.context-kicker { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--on-surface-variant); text-transform: uppercase; }
.topbar .crumb { font-size: 14px; color: var(--on-surface); font-weight: 650; }
.topbar .crumb b { color: var(--on-surface); font-weight: 600; }
.topbar .env { display: flex; align-items: center; gap: 12px; font-size: 11px; color: var(--on-surface-variant); font-family: var(--mono); }
.live-state { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border: 1px solid var(--border); border-radius: var(--radius-full); background: var(--surface); font-family: var(--font); font-size: 11px; font-weight: 650; color: var(--success); }
.live-dot { width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--success); box-shadow: 0 0 0 3px color-mix(in oklch, var(--success) 14%, transparent); }

.content { padding: 34px 36px 56px; max-width: 1580px; width: 100%; margin: 0 auto; }

/* Page header */
.page-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 28px; margin-bottom: 30px; flex-wrap: wrap;
}
.page-eyebrow { display: block; margin-bottom: 6px; color: var(--primary); font-size: 11px; font-weight: 750; letter-spacing: 0.1em; line-height: 1.2; text-transform: uppercase; }
.page-title { font-size: 30px; font-weight: 720; letter-spacing: -0.035em; line-height: 1.2; margin: 0; }
.page-subtitle { color: var(--on-surface-variant); margin: 7px 0 0; max-width: 62ch; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-head--compact { margin-bottom: 24px; }

/* ------------------------------------------------------------------ *
 *  Composed dashboard workspace
 * ------------------------------------------------------------------ */
.dashboard-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.42fr) minmax(360px, 0.92fr);
    gap: 22px;
    margin-bottom: 30px;
}

.feature-banner {
    position: relative;
    min-height: 304px;
    overflow: hidden;
    border-radius: 24px;
    color: var(--on-primary);
    background:
        radial-gradient(circle at 35% 120%, oklch(0.77 0.17 208 / 0.72), transparent 38%),
        radial-gradient(circle at 72% 0%, oklch(0.45 0.19 270 / 0.55), transparent 40%),
        oklch(0.59 0.2 245);
    box-shadow: 0 22px 48px -30px oklch(0.36 0.18 246 / 0.76);
}
.feature-orbit {
    position: absolute;
    border: 1px solid oklch(0.97 0.02 230 / 0.22);
    border-radius: var(--radius-full);
    pointer-events: none;
}
.feature-orbit--one { width: 310px; height: 310px; right: -95px; top: -150px; }
.feature-orbit--two { width: 210px; height: 210px; right: 38px; top: -90px; }
.feature-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    min-height: 304px;
    padding: 30px 32px;
}
.feature-kicker {
    color: oklch(0.95 0.025 225);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.feature-content h2 {
    max-width: 520px;
    margin: 12px 0 8px;
    font-size: 27px;
    font-weight: 700;
    line-height: 1.18;
    letter-spacing: -0.035em;
}
.feature-content > p {
    max-width: 52ch;
    margin: 0;
    color: oklch(0.94 0.025 230);
    font-size: 14px;
    line-height: 1.55;
}
.feature-tags {
    display: flex;
    gap: 7px;
    flex-wrap: wrap;
    margin-top: 18px;
}
.feature-tags span {
    padding: 5px 10px;
    border: 1px solid oklch(0.98 0.015 230 / 0.34);
    border-radius: var(--radius-full);
    background: oklch(0.98 0.015 230 / 0.09);
    color: oklch(0.98 0.008 230);
    font-size: 11px;
    line-height: 1.2;
}
.feature-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 22px;
}
.feature-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 8px 13px;
    border: 1px solid oklch(0.98 0.015 230 / 0.36);
    border-radius: 12px;
    background: oklch(0.98 0.015 230 / 0.1);
    color: var(--on-primary);
    font-size: 12px;
    font-weight: 650;
    transition: background-color 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.feature-action:hover { background: oklch(0.98 0.015 230 / 0.2); text-decoration: none; transform: translateY(-1px); }
.feature-action--solid { background: var(--container-lowest); color: var(--primary-strong); border-color: var(--container-lowest); }
.feature-action--solid:hover { background: var(--container-low); }
.feature-action svg { width: 17px; height: 17px; }
.feature-content--cash { justify-content: space-between; }
.feature-cash-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}
.feature-billing-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid oklch(0.98 0.015 230 / 0.34);
    border-radius: 12px;
    background: oklch(0.98 0.015 230 / 0.1);
    color: var(--on-primary);
    font-size: 11.5px;
    font-weight: 650;
    transition: background-color 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.feature-billing-link:hover { background: oklch(0.98 0.015 230 / 0.2); text-decoration: none; transform: translateY(-1px); }
.feature-billing-link svg { width: 16px; height: 16px; }
.feature-cash-value {
    display: flex;
    flex-direction: column;
    margin: 32px 0 auto;
}
.feature-cash-value strong {
    font-family: var(--mono);
    font-size: clamp(38px, 4vw, 48px);
    font-weight: 650;
    letter-spacing: -0.055em;
    line-height: 1;
}
.feature-cash-value span {
    margin-top: 8px;
    color: oklch(0.94 0.025 230);
    font-size: 13px;
}
.feature-cash-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 26px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid oklch(0.98 0.015 230 / 0.26);
}
.feature-cash-stats > div {
    min-width: 0;
    padding-right: 20px;
}
.feature-cash-stats > div + div {
    padding-right: 0;
    padding-left: 20px;
    border-left: 1px solid oklch(0.98 0.015 230 / 0.26);
}
.feature-cash-stats dt {
    color: oklch(0.92 0.026 230);
    font-size: 9.5px;
    font-weight: 650;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.feature-cash-stats dd {
    overflow: hidden;
    margin: 5px 0 0;
    color: var(--on-primary);
    font-family: var(--mono);
    font-size: 14px;
    font-weight: 650;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.analytics-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 304px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.analytics-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 0;
}
.analytics-head .page-eyebrow { margin-bottom: 3px; }
.analytics-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.025em; }
.analytics-total { display: flex; flex-direction: column; align-items: flex-end; padding-top: 5px; font-family: var(--mono); font-size: 15px; font-weight: 650; }
.analytics-total small { color: var(--on-surface-variant); font-family: var(--font); font-size: 8px; font-weight: 650; letter-spacing: 0.055em; text-transform: uppercase; }
.bar-chart {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    gap: 9px;
    flex: 1;
    min-height: 210px;
    padding: 16px 24px 12px;
}
.chart-column {
    display: grid;
    grid-template-rows: 18px 1fr 30px;
    gap: 4px;
    height: 100%;
    text-align: center;
}
.chart-value { overflow: hidden; color: var(--on-surface-variant); font-family: var(--mono); font-size: 8px; white-space: nowrap; text-overflow: ellipsis; }
.chart-track {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 12px 12px 5px 5px;
    background: var(--container-low);
}
.chart-bar {
    position: absolute;
    inset: auto 0 0;
    min-height: 8px;
    border-radius: 12px 12px 5px 5px;
    background: oklch(0.77 0.13 150);
    transition: filter 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1);
    transform-origin: bottom;
}
.chart-column:hover .chart-bar { filter: saturate(1.2); transform: scaleY(1.025); }
.chart-column.is-current .chart-track { background: color-mix(in oklch, var(--success-bg) 75%, var(--container-low)); }
.chart-column.is-current .chart-label { color: var(--success); }
.chart-column.is-forecast .chart-track { background: var(--primary-container); }
.chart-column.is-forecast .chart-bar {
    border: 1px solid color-mix(in oklch, var(--primary) 52%, var(--container-lowest));
    background:
        repeating-linear-gradient(
            135deg,
            color-mix(in oklch, var(--primary) 74%, var(--container-lowest)) 0 6px,
            color-mix(in oklch, var(--primary) 58%, var(--container-lowest)) 6px 12px
        );
}
.chart-label { display: flex; flex-direction: column; color: var(--on-surface-variant); font-size: 10px; font-weight: 600; }
.chart-label small { color: var(--on-surface-variant); font-size: 7.5px; font-weight: 650; letter-spacing: 0.025em; text-transform: uppercase; }
.analytics-foot {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    margin-top: auto;
    border-top: 1px solid var(--border);
}
.analytics-foot span {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 13px 15px;
    color: var(--on-surface-variant);
    font-size: 10.5px;
    border-right: 1px solid var(--border);
}
.analytics-foot span:last-child { border-right: 0; }
.analytics-foot strong { color: var(--on-surface); font-family: var(--mono); font-size: 13px; }

.workspace-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.74fr);
    gap: 22px;
    align-items: start;
}
.workspace-main,
.workspace-aside { min-width: 0; }
.workspace-aside { display: flex; flex-direction: column; gap: 16px; }

.dashboard-invoices {
    border-radius: 22px;
}
.dashboard-invoices-head {
    display: flex;
    align-items: center;
    min-height: 52px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--container-lowest);
}
.dashboard-invoices-head h2 { margin: 0; font-size: 17px; line-height: 1.2; letter-spacing: -0.025em; }
.dashboard-invoices-table { table-layout: fixed; }
.dashboard-invoices-table th:nth-child(1) { width: 27%; }
.dashboard-invoices-table th:nth-child(2) { width: 36%; }
.dashboard-invoices-table th:nth-child(3) { width: 19%; }
.dashboard-invoices-table th:nth-child(4) { width: 18%; }
.dashboard-invoices-table thead th {
    color: color-mix(in oklch, var(--primary-strong) 78%, var(--on-surface-variant));
    background: color-mix(in oklch, var(--primary-container) 20%, var(--container-low));
}
.dashboard-invoices-table tbody td { padding-top: 14px; padding-bottom: 14px; }
.dashboard-invoices-table tbody tr:hover td { background: color-mix(in oklch, var(--primary-container) 28%, var(--container-lowest)); }
.dashboard-invoices-table .avatar {
    background: color-mix(in oklch, var(--primary-container) 82%, var(--container-lowest));
    color: var(--primary-strong);
}
.dashboard-invoice-number { min-width: 0; }
.dashboard-invoice-number > a {
    display: block;
    overflow: hidden;
    color: var(--primary-strong);
    font-size: 12.5px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.dashboard-invoice-number > small {
    display: block;
    margin-top: 3px;
    color: var(--on-surface-variant);
    font-size: 9.5px;
}
.dashboard-invoice-total { color: var(--on-surface); font-size: 12.5px; font-weight: 750; white-space: nowrap; }
.dashboard-invoices-table .badge {
    border: 1px solid currentColor;
    border-color: color-mix(in oklch, currentColor 25%, transparent);
    box-shadow: inset 0 1px 0 oklch(0.99 0.005 285 / 0.52);
}

.cell-stack { display: flex; flex-direction: column; min-width: 0; }
.cell-stack strong { overflow: hidden; max-width: 220px; font-size: 12.5px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.cell-stack small { overflow: hidden; max-width: 220px; color: var(--on-surface-variant); font-size: 10.5px; white-space: nowrap; text-overflow: ellipsis; }

.insight-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 20px;
    background: var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.insight-card--cash {
    background:
        radial-gradient(circle at 100% 0%, var(--primary-container), transparent 42%),
        var(--container-lowest);
}
.insight-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}
.insight-head > a { font-size: 11px; font-weight: 650; }
.insight-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: var(--primary);
    color: var(--on-primary);
}
.insight-icon svg { width: 19px; height: 19px; }
.insight-value { display: block; margin-top: 5px; font-family: var(--mono); font-size: 26px; letter-spacing: -0.045em; }
.insight-label { display: block; margin-top: 3px; color: var(--on-surface-variant); font-size: 11.5px; }
.insight-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 20px;
}
.insight-stats > span {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    padding: 11px;
    border-radius: 12px;
    background: var(--container-low);
}
.insight-stats small { color: var(--on-surface-variant); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.insight-stats strong { overflow: hidden; font-family: var(--mono); font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.insight-title-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.insight-title-row .page-eyebrow { margin-bottom: 3px; }
.insight-title-row h2,
.insight-card > h2 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.count-bubble { display: grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px; border-radius: var(--radius-full); background: var(--primary-container); color: var(--on-primary-container); font-family: var(--mono); font-size: 12px; font-weight: 700; }
.renewal-list { display: flex; flex-direction: column; }
.renewal-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 11px 0;
    border-bottom: 1px solid var(--border);
}
.renewal-row:last-child { border-bottom: 0; }
.renewal-mark { width: 8px; height: 8px; border-radius: var(--radius-full); background: var(--primary); box-shadow: 0 0 0 4px var(--primary-container); }
.renewal-row > span:nth-child(2) { display: flex; flex-direction: column; min-width: 0; }
.renewal-row strong { overflow: hidden; font-size: 12px; white-space: nowrap; text-overflow: ellipsis; }
.renewal-row small,
.renewal-row time { color: var(--on-surface-variant); font-size: 10.5px; }
.calm-state { display: flex; align-items: center; gap: 12px; padding: 12px 0 16px; }
.calm-state svg { width: 34px; height: 34px; padding: 7px; border-radius: var(--radius-full); background: var(--success-bg); color: var(--success); }
.calm-state span { display: flex; flex-direction: column; }
.calm-state strong { font-size: 12.5px; }
.calm-state small { color: var(--on-surface-variant); font-size: 10.5px; }
.annual-revenue-card {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    border-color: oklch(0.75 0.11 225 / 0.34);
    background:
        radial-gradient(circle at 22% 120%, oklch(0.77 0.17 208 / 0.72), transparent 46%),
        radial-gradient(circle at 88% 0%, oklch(0.45 0.19 270 / 0.48), transparent 48%),
        oklch(0.59 0.2 245);
    color: var(--inverse-on-surface);
    box-shadow: 0 22px 48px -30px oklch(0.36 0.18 246 / 0.76);
}
.annual-revenue-card::before,
.annual-revenue-card::after {
    position: absolute;
    z-index: 0;
    content: "";
    pointer-events: none;
}
.annual-revenue-card::before {
    top: -90px;
    right: -72px;
    width: 230px;
    height: 230px;
    border-radius: var(--radius-full);
    background: radial-gradient(circle, oklch(0.78 0.15 196 / 0.5), transparent 68%);
    filter: blur(4px);
    animation: annual-revenue-drift 12s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}
.annual-revenue-card::after {
    inset: -25% auto -25% 0;
    width: 56%;
    background: linear-gradient(108deg, transparent 12%, oklch(0.97 0.025 220 / 0.15) 50%, transparent 88%);
    transform: translate3d(-125%, 0, 0);
    animation: annual-revenue-sheen 9s cubic-bezier(0.22, 1, 0.36, 1) infinite;
}
.annual-revenue-card > * { position: relative; z-index: 1; }
.annual-revenue-card .count-bubble {
    border: 1px solid oklch(0.94 0.035 220 / 0.18);
    background: oklch(0.97 0.025 220 / 0.13);
    color: var(--inverse-on-surface);
}
.annual-revenue-ledger { display: flex; flex-direction: column; }
.annual-revenue-ledger > div:not(.calm-state) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 11px 0;
    border-bottom: 1px solid oklch(0.94 0.025 230 / 0.14);
}
.annual-revenue-ledger > div:last-child { border-bottom: 0; }
.annual-revenue-ledger span { display: flex; flex-direction: column; min-width: 0; }
.annual-revenue-ledger span strong { overflow: hidden; font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.annual-revenue-ledger small { color: oklch(0.86 0.025 240); font-size: 10px; }
.annual-revenue-ledger > div > strong { flex: 0 0 auto; font-family: var(--mono); font-size: 11.5px; }
.annual-revenue-lost > strong { color: oklch(0.91 0.075 25); }
.annual-revenue-card .calm-state small { color: oklch(0.86 0.025 240); }
@keyframes annual-revenue-drift {
    0%, 100% { opacity: 0.68; transform: translate3d(0, 0, 0) scale(1); }
    50% { opacity: 1; transform: translate3d(-18px, 16px, 0) scale(1.08); }
}
@keyframes annual-revenue-sheen {
    0%, 58% { opacity: 0; transform: translate3d(-125%, 0, 0); }
    66% { opacity: 1; }
    86%, 100% { opacity: 0; transform: translate3d(255%, 0, 0); }
}
.insight-footer { display: flex; justify-content: space-between; gap: 12px; margin: 4px -20px -20px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--container-low); font-size: 11px; }
.insight-footer strong { font-family: var(--mono); }
.insight-card--alert { border-color: color-mix(in oklch, var(--danger) 30%, var(--border)); background: var(--danger-bg); }
.insight-card--alert p { color: var(--on-surface-variant); font-size: 12px; }

/* Client account visualization */
.status-label { padding: 6px 9px; border-radius: var(--radius-full); background: var(--warning-bg); color: var(--warning); font-size: 10px; font-weight: 700; white-space: nowrap; }
.status-label.is-healthy { background: var(--success-bg); color: var(--success); }
.health-visual { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 24px; padding: 20px 24px; }
.health-ring {
    --health: 0%;
    width: 116px;
    height: 116px;
    display: grid;
    place-items: center;
    position: relative;
    border-radius: var(--radius-full);
    background: conic-gradient(var(--primary) var(--health), var(--container) 0);
}
.health-ring::after { content: ""; position: absolute; inset: 12px; border-radius: inherit; background: var(--container-lowest); }
.health-ring > span { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.health-ring strong { font-family: var(--mono); font-size: 25px; letter-spacing: -0.04em; }
.health-ring small { color: var(--on-surface-variant); font-size: 9.5px; }
.health-legend { display: flex; flex-direction: column; gap: 10px; }
.health-legend > span { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 7px; color: var(--on-surface-variant); font-size: 10.5px; }
.health-legend strong { color: var(--on-surface); font-family: var(--mono); }
.legend-dot { width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--container-highest); }
.legend-dot--active { background: var(--primary); }
.legend-dot--billing { background: var(--warning); }
.domain-cell { display: flex; align-items: center; gap: 11px; }
.domain-cell > span:last-child { display: flex; flex-direction: column; }
.domain-cell strong { font-size: 12.5px; }
.domain-cell small { color: var(--on-surface-variant); font-size: 10.5px; }
.domain-icon { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: var(--primary-container); color: var(--primary); }
.domain-icon svg { width: 16px; height: 16px; }
/* Client profile editor */
.client-profile-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(360px, 0.72fr);
    gap: 24px;
    align-items: center;
    margin-bottom: 22px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 22px;
    background:
        radial-gradient(circle at 100% 0%, var(--primary-container), transparent 38%),
        var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.client-profile-main { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-back {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-full);
    color: var(--on-surface-variant);
}
.profile-back:hover { background: var(--container-low); color: var(--on-surface); text-decoration: none; }
.profile-back svg { width: 16px; height: 16px; }
.client-avatar-large {
    width: 66px;
    height: 66px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 20px;
    background: var(--primary);
    color: var(--on-primary);
    font-family: var(--mono);
    font-size: 20px;
    font-weight: 700;
    box-shadow: 0 18px 30px -22px var(--primary);
}
.client-profile-copy { min-width: 0; }
.client-profile-copy .page-eyebrow { margin-bottom: 4px; }
.client-profile-copy h1 { overflow: hidden; margin: 0; font-size: 25px; line-height: 1.2; letter-spacing: -0.035em; white-space: nowrap; text-overflow: ellipsis; }
.client-profile-copy > span:not(.page-eyebrow) { color: var(--on-surface-variant); font-size: 12px; }
.profile-chips { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.profile-chips > span:not(.badge) { padding: 4px 9px; border-radius: var(--radius-full); background: var(--container-low); color: var(--on-surface-variant); font-size: 10.5px; font-weight: 650; }
.client-profile-facts {
    display: grid;
    grid-template-columns: 0.65fr 0.9fr 1.25fr;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--container-lowest);
}
.client-profile-facts > span { display: flex; flex-direction: column; gap: 3px; min-width: 0; padding: 14px; border-right: 1px solid var(--border); }
.client-profile-facts > span:last-child { border-right: 0; }
.client-profile-facts small { color: var(--on-surface-variant); font-size: 9.5px; font-weight: 650; letter-spacing: 0.055em; text-transform: uppercase; }
.client-profile-facts strong { overflow: hidden; font-family: var(--mono); font-size: 13px; white-space: nowrap; text-overflow: ellipsis; }
.profile-settings-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.62fr); gap: 20px; align-items: start; }
.profile-form-panel .panel-head { padding: 22px 24px; }
.profile-form-panel .panel-head .page-eyebrow { margin-bottom: 3px; }
.profile-form-panel .panel-body { padding: 0; }
.profile-form-panel form { margin: 0; }
.form-section { padding: 24px; border-bottom: 1px solid var(--border); }
.form-section-title { margin: 0 0 18px; font-size: 14px; letter-spacing: -0.01em; }
.form-section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.form-section-head .form-section-title { margin-bottom: 0; }
.form-warning { margin: 10px 0 18px; color: var(--warning); font-size: 11.5px; font-weight: 600; }
.sync-target { display: inline-flex; align-items: center; gap: 6px; color: var(--success); font-size: 10.5px; font-weight: 650; }
.sync-target > span { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.sync-target--offline { color: var(--danger); }
.form-submit-row { display: flex; justify-content: flex-end; padding: 16px 24px; background: var(--container-low); }
.form-actions-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; background: var(--container-low); }
.form-actions-bar > span { color: var(--on-surface-variant); font-size: 11px; }
.profile-side { display: flex; flex-direction: column; gap: 16px; }
.profile-access-card h2 { margin: 0; font-size: 17px; }
.profile-status-list { display: flex; flex-direction: column; margin-top: 16px; }
.profile-status-list > span { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.profile-status-list > span:last-child { border-bottom: 0; }
.profile-status-list > span > span { display: flex; flex-direction: column; }
.profile-status-list strong { font-size: 12px; }
.profile-status-list small { color: var(--on-surface-variant); font-size: 10.5px; }
.status-symbol { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--container-low); color: var(--outline); }
.status-symbol.is-good { background: var(--success-bg); color: var(--success); }
.status-symbol svg { width: 18px; height: 18px; }
.danger-zone { padding: 20px; border: 1px solid color-mix(in oklch, var(--danger) 22%, var(--border)); border-radius: 18px; background: color-mix(in oklch, var(--danger-bg) 55%, var(--container-lowest)); }
.danger-zone .page-eyebrow { color: var(--danger); }
.danger-zone h2 { margin: 0; font-size: 16px; }
.danger-zone p { margin: 12px 0 16px; color: var(--on-surface-variant); font-size: 11px; }
.client-register-tabs { margin-bottom: 14px; }
.client-register-panel { border-radius: 20px; }
.client-list-row { position: relative; cursor: pointer; }
.client-row-link::after {
    content: "";
    position: absolute;
    inset: 0;
}
.client-list-row:hover td,
.client-list-row:focus-within td {
    background: color-mix(in oklch, var(--primary-container) 30%, var(--container-lowest));
}
.client-row-actions {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 3px;
}

.delete-user-shell {
    width: min(100%, 580px);
    overflow: hidden;
    padding: 24px;
    border: 1px solid color-mix(in oklch, var(--danger) 26%, var(--border));
    border-radius: var(--radius-xl);
    background: var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.delete-user-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.delete-user-head h2 { margin: 0 0 2px; font-size: 17px; letter-spacing: -0.02em; }
.delete-user-head .mono { color: var(--on-surface-variant); font-size: 12px; }
.delete-user-mark {
    display: grid;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 13px;
    background: var(--danger-bg);
    color: var(--danger);
}
.delete-user-mark svg { width: 20px; height: 20px; }
.delete-user-warning {
    margin: 0 0 22px;
    padding: 14px 16px;
    border: 1px solid color-mix(in oklch, var(--danger) 18%, var(--border));
    border-radius: var(--radius);
    background: color-mix(in oklch, var(--danger-bg) 58%, var(--container-lowest));
    color: var(--on-surface-variant);
    font-size: 12.5px;
}
.delete-user-blocked {
    margin-bottom: 18px;
    padding: 16px;
    border: 1px solid color-mix(in oklch, var(--warning) 22%, var(--border));
    border-radius: var(--radius);
    background: var(--warning-bg);
}
.delete-user-blocked strong { color: var(--warning); }
.delete-user-blocked p { margin: 4px 0 0; color: var(--on-surface-variant); font-size: 12.5px; }
.delete-user-actions { display: flex; gap: 10px; padding-top: 4px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

/* Invoice management */
.invoice-overview {
    display: grid;
    grid-template-columns: minmax(250px, 0.85fr) minmax(340px, 1.25fr) minmax(250px, 0.78fr);
    overflow: hidden;
    margin-bottom: 30px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.invoice-overview-primary,
.invoice-overview-flow,
.invoice-overview-secondary { padding: 22px; }
.invoice-overview-primary { display: flex; align-items: center; gap: 15px; background: var(--container-low); }
.invoice-overview-icon { width: 48px; height: 48px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 14px; background: var(--primary); color: var(--on-primary); }
.invoice-overview-icon svg { width: 23px; height: 23px; }
.invoice-overview-primary > div { display: flex; flex-direction: column; }
.invoice-overview-primary .page-eyebrow { margin-bottom: 2px; }
.invoice-overview-primary strong { font-family: var(--mono); font-size: 24px; letter-spacing: -0.035em; }
.invoice-overview-primary small { color: var(--on-surface-variant); font-size: 10.5px; }
.invoice-overview-flow { border-right: 1px solid var(--border); border-left: 1px solid var(--border); }
.invoice-flow-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 11px; }
.invoice-flow-head span { color: var(--on-surface-variant); font-weight: 650; }
.invoice-flow-head strong { font-family: var(--mono); font-size: 11px; }
.invoice-status-track { display: flex; gap: 3px; height: 9px; overflow: hidden; margin: 16px 0 12px; border-radius: var(--radius-full); background: var(--container); }
.invoice-status-track > span { min-width: 0; border-radius: var(--radius-full); }
.invoice-status-track .is-paid,
.invoice-status-legend .is-paid { background: var(--success); }
.invoice-status-track .is-open,
.invoice-status-legend .is-open { background: var(--primary); }
.invoice-status-track .is-refunded,
.invoice-status-legend .is-refunded { background: var(--warning); }
.invoice-status-legend { display: flex; gap: 14px; flex-wrap: wrap; color: var(--on-surface-variant); font-size: 9.5px; }
.invoice-status-legend span { display: inline-flex; align-items: center; gap: 5px; }
.invoice-status-legend i { width: 6px; height: 6px; border-radius: var(--radius-full); }
.invoice-overview-secondary { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 12px; }
.invoice-overview-secondary > span { display: flex; flex-direction: column; gap: 4px; }
.invoice-overview-secondary small { color: var(--on-surface-variant); font-size: 9.5px; letter-spacing: 0.05em; text-transform: uppercase; }
.invoice-overview-secondary strong { font-family: var(--mono); font-size: 13px; }
.invoice-register { overflow: visible; }
.invoice-table tbody td { height: 72px; }
.invoice-select-column,
.invoice-select-cell { width: 42px; padding-right: 8px !important; padding-left: 16px !important; text-align: center !important; }
.invoice-select-column input,
.invoice-select-cell input { width: 17px; height: 17px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.invoice-table tbody tr.is-selected td { background: color-mix(in oklch, var(--primary-container) 42%, var(--container-lowest)); }
.invoice-number { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.invoice-number svg { width: 17px; height: 17px; color: var(--primary); }
.service-cell { display: flex; flex-direction: column; max-width: 190px; }
.service-cell strong { overflow: hidden; font-size: 11.5px; white-space: nowrap; text-overflow: ellipsis; }
.service-cell small { color: var(--on-surface-variant); font-size: 10px; }
.amount-cell { font-family: var(--mono); font-weight: 650; white-space: nowrap; }
.amount-cell small { display: block; margin-top: 2px; color: var(--on-surface-variant); font-family: var(--font); font-size: 9.5px; font-weight: 500; }
.invoice-row-action { position: relative; display: inline-block; }
.invoice-row-action > summary { list-style: none; white-space: nowrap; }
.invoice-row-action > summary::-webkit-details-marker { display: none; }
.invoice-row-action[open] > summary { background: var(--container); }
.invoice-action-menu {
    position: absolute;
    z-index: 20;
    top: calc(100% + 8px);
    right: 0;
    width: 290px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--container-lowest);
    box-shadow: var(--shadow-pop);
    text-align: left;
}
.invoice-action-choices { display: grid; gap: 3px; padding: 8px; }
.invoice-action-choices[hidden],
.invoice-action-form[hidden],
.invoice-bulk-bar[hidden],
.invoice-bulk-panel[hidden] { display: none !important; }
.invoice-action-choices > .action-menu-title { padding: 7px 8px 5px; }
.invoice-action-choice {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    padding: 10px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--on-surface);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.invoice-action-choice:hover { background: var(--container-low); }
.invoice-action-choice span { font-size: 11.5px; font-weight: 700; }
.invoice-action-choice small { color: var(--on-surface-variant); font-size: 9.5px; }
.invoice-action-choice--danger span { color: var(--danger); }
.invoice-action-delete { margin: 0; }
.invoice-action-form { display: grid; gap: 10px; padding: 14px; }
.action-menu-back { width: max-content; padding: 0; border: 0; background: transparent; color: var(--primary); font: inherit; font-size: 10px; font-weight: 650; cursor: pointer; }
.action-menu-title { font-size: 11.5px; }
.invoice-row-action label { display: flex; flex-direction: column; gap: 6px; color: var(--on-surface); font-size: 10.5px; font-weight: 650; }
.invoice-row-action input { width: 100%; min-height: 38px; padding: 8px 10px; border: 1px solid var(--outline-variant); border-radius: var(--radius); background: var(--container-lowest); color: var(--on-surface); font-family: var(--font); font-size: 12px; }
.invoice-row-action input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent); }
.invoice-action-menu .btn { width: 100%; }

.invoice-bulk-bar {
    position: fixed;
    z-index: 70;
    right: 24px;
    bottom: 24px;
    left: calc(var(--sidebar-w) + 24px);
    max-width: 920px;
    margin: 0 auto;
    border: 1px solid color-mix(in oklch, var(--primary) 22%, var(--border));
    border-radius: 18px;
    background: var(--inverse-surface);
    color: var(--inverse-on-surface);
    box-shadow: 0 24px 70px -24px oklch(0.18 0.035 280 / 0.72);
}
.invoice-bulk-summary { display: flex; align-items: center; gap: 14px; min-height: 64px; padding: 10px 12px 10px 18px; }
.invoice-bulk-summary > strong { min-width: 78px; font-family: var(--mono); font-size: 11px; white-space: nowrap; }
.invoice-bulk-actions { display: flex; align-items: center; justify-content: center; gap: 5px; min-width: 0; flex: 1; }
.invoice-bulk-actions button,
.invoice-bulk-clear,
.invoice-bulk-panel-head button {
    min-height: 36px;
    padding: 8px 11px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--inverse-on-surface);
    font: inherit;
    font-size: 10.5px;
    font-weight: 650;
    white-space: nowrap;
    cursor: pointer;
}
.invoice-bulk-actions button:hover,
.invoice-bulk-clear:hover { background: color-mix(in oklch, var(--inverse-on-surface) 10%, transparent); }
.invoice-bulk-actions button:disabled { opacity: 0.34; cursor: not-allowed; }
.invoice-bulk-actions button.is-danger { color: oklch(0.79 0.12 25); }
.invoice-bulk-clear { color: oklch(0.82 0.015 280); }
.invoice-bulk-panel {
    position: absolute;
    right: 0;
    bottom: calc(100% + 10px);
    left: 0;
    max-height: min(520px, calc(100dvh - 130px));
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--container-lowest);
    color: var(--on-surface);
    box-shadow: var(--shadow-pop);
}
.invoice-bulk-panel form { display: grid; gap: 14px; padding: 18px; }
.invoice-bulk-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.invoice-bulk-panel-head strong { font-size: 13px; }
.invoice-bulk-panel-head button { min-height: auto; padding: 4px 0; color: var(--primary); }
.invoice-bulk-panel label,
.bulk-partial-amounts label { display: grid; gap: 6px; font-size: 10.5px; font-weight: 650; }
.invoice-bulk-panel input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    background: var(--container-lowest);
    color: var(--on-surface);
    font: inherit;
}
.invoice-bulk-panel input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent); }
.invoice-bulk-panel p { margin: 0; color: var(--on-surface-variant); font-size: 11px; }
.invoice-bulk-panel .btn { justify-self: end; }
.bulk-partial-amounts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

/* Owner invoice viewer */
.invoice-detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.34fr);
    gap: 22px;
    align-items: start;
}
.invoice-paper {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 22px;
    background: var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.invoice-paper-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 28px;
    padding: 28px;
}
.invoice-business { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.invoice-wordmark { width: 128px; height: auto; flex: 0 0 auto; margin-top: 3px; }
.invoice-business > span:last-child { display: flex; flex-direction: column; min-width: 0; }
.invoice-business strong { font-size: 14px; }
.invoice-business small { max-width: 48ch; margin-top: 3px; color: var(--on-surface-variant); font-size: 10.5px; }
.invoice-total { display: flex; flex-direction: column; align-items: flex-end; flex: 0 0 auto; }
.invoice-total span { color: var(--on-surface-variant); font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.invoice-total strong { margin-top: 4px; font-family: var(--mono); font-size: 25px; letter-spacing: -0.035em; }
.invoice-parties {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(250px, 0.8fr);
    gap: 28px;
    padding: 24px 28px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    background: var(--container-low);
}
.invoice-parties > section { display: flex; flex-direction: column; align-items: flex-start; }
.invoice-parties > section > strong { margin: 5px 0 2px; font-size: 13px; }
.invoice-parties > section > small { color: var(--on-surface-variant); font-size: 10.5px; }
.invoice-label { color: var(--on-surface-variant); font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.invoice-parties dl { display: grid; gap: 10px; margin: 0; }
.invoice-parties dl > div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; }
.invoice-parties dt { color: var(--on-surface-variant); font-size: 10.5px; }
.invoice-parties dd { overflow: hidden; margin: 0; font-size: 11px; font-weight: 650; white-space: nowrap; text-overflow: ellipsis; }
.invoice-lines { overflow-x: auto; padding: 12px 18px 0; }
.invoice-lines .table th,
.invoice-lines .table td { padding-right: 10px; padding-left: 10px; }
.invoice-totals {
    width: min(330px, calc(100% - 56px));
    margin: 8px 28px 28px auto;
}
.invoice-totals > div { display: flex; justify-content: space-between; gap: 20px; padding: 8px 0; }
.invoice-totals dt { color: var(--on-surface-variant); font-size: 11px; }
.invoice-totals dd { margin: 0; font-family: var(--mono); font-size: 11.5px; font-weight: 650; }
.invoice-totals .invoice-grand-total { margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--border-strong); }
.invoice-grand-total dt { color: var(--on-surface); font-size: 13px; font-weight: 700; }
.invoice-grand-total dd { font-size: 16px; }
.invoice-totals .invoice-balance { margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.invoice-balance dt,
.invoice-balance dd { color: var(--primary); font-weight: 750; }
.invoice-delete-section { border-color: color-mix(in oklch, var(--danger) 30%, var(--border)); }
.invoice-detail-aside {
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: sticky;
    top: 88px;
}
.invoice-side-section {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.invoice-status-line { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 11px; margin-top: 14px; }
.invoice-status-line > span:last-child { display: flex; flex-direction: column; }
.invoice-status-line strong { font-size: 12.5px; }
.invoice-status-line small { margin-top: 2px; color: var(--on-surface-variant); font-size: 10.5px; }
.invoice-payment-facts { display: grid; gap: 10px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--border); }
.invoice-payment-facts > div { display: flex; justify-content: space-between; gap: 14px; }
.invoice-payment-facts dt { color: var(--on-surface-variant); font-size: 10.5px; }
.invoice-payment-facts dd { overflow: hidden; margin: 0; font-family: var(--mono); font-size: 10.5px; font-weight: 650; text-align: right; text-overflow: ellipsis; }
.invoice-status-control { display: grid; gap: 7px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 11px; font-weight: 650; }
.invoice-status-control select {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    background: var(--container-lowest);
    color: var(--on-surface);
    font: inherit;
}
.invoice-status-control select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent); }
.invoice-side-section form { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.invoice-side-section form label { display: flex; flex-direction: column; gap: 6px; margin: 0; font-size: 11px; font-weight: 650; }
.invoice-side-section form input {
    width: 100%;
    min-height: 40px;
    padding: 9px 11px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    background: var(--container-lowest);
    color: var(--on-surface);
    font: inherit;
}
.invoice-side-section form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent); }

/* ------------------------------------------------------------------ *
 *  KPI tiles — elevated bento, one color-filled focal card
 * ------------------------------------------------------------------ */
.kpis { margin-bottom: 26px; }
.kpis-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.kpis-head .lead { font-size: 13px; font-weight: 700; color: var(--on-surface); letter-spacing: -0.01em; }
.kpis-head .when { font-size: 12px; color: var(--on-surface-variant); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

.kpi {
    background: var(--container-lowest); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 22px; box-shadow: var(--shadow-sm);
    display: flex; flex-direction: column; min-height: 148px;
}
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: auto; }
.kpi-ico {
    width: 42px; height: 42px; border-radius: 13px; flex-shrink: 0;
    display: grid; place-items: center; background: var(--container); color: var(--primary);
}
.kpi-ico svg { width: 22px; height: 22px; }
.kpi-ico.ico-blue { background: var(--primary-container); color: var(--primary); }
.kpi-ico.ico-green { background: var(--success-bg); color: var(--success); }
.kpi-ico.ico-violet { background: var(--accent-violet-bg); color: var(--accent-violet); }
.kpi-ico.ico-amber { background: var(--warning-bg); color: var(--warning); }
.kpi-label { font-size: 12px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--on-surface-variant); margin: 16px 0 0; }
.kpi-value { font-family: var(--mono); font-size: 28px; font-weight: 700; letter-spacing: -0.02em; margin: 5px 0 0; color: var(--on-surface); line-height: 1.1; }
.kpi-value.is-zero { color: var(--on-surface-variant); }
.kpi-value.is-warn { color: var(--warning); }
.kpi-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--on-surface-variant); margin: 10px 0 0; }
.kpi-meta b { color: var(--on-surface); font-weight: 600; }

/* Focal card — the money that matters, color-filled like the reference hero */
.kpi-featured {
    position: relative; overflow: hidden; border-color: var(--primary); color: var(--on-surface);
    background: var(--primary-container); box-shadow: var(--shadow-md);
}
.kpi-featured .kpi-ico { background: var(--container-lowest); color: var(--primary); }
.kpi-featured .kpi-label,
.kpi-featured .kpi-meta { color: var(--on-surface-variant); }
.kpi-featured .kpi-value,
.kpi-featured .kpi-meta b { color: var(--on-surface); }

.dot { width: 7px; height: 7px; border-radius: var(--radius-full); flex-shrink: 0; background: var(--outline-variant); }
.dot-warn { background: var(--warning); }
.dot-danger { background: var(--danger); }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 8px; border-radius: var(--radius-full); font-size: 11px; font-weight: 700; font-family: var(--mono); }
.delta svg { width: 11px; height: 11px; }
.delta-up { background: var(--success-bg); color: var(--success); }
.delta-down { background: var(--danger-bg); color: var(--danger); }
.delta-flat { background: var(--container); color: var(--on-surface-variant); }
.kpi-featured .delta-up, .kpi-featured .delta-down, .kpi-featured .delta-flat { background: var(--container-lowest); color: var(--on-surface); }

/* Owner overview: one operational ledger, not a grid of interchangeable cards. */
.metrics-panel {
    margin-bottom: 32px;
    background: var(--container-lowest);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.metrics-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.metrics-heading .page-eyebrow { margin-bottom: 3px; }
.metrics-heading h2 { margin: 0; font-size: 17px; line-height: 1.3; letter-spacing: -0.02em; }
.metrics-period { padding: 6px 10px; border-radius: var(--radius-full); background: var(--container-low); color: var(--on-surface-variant); font-size: 11px; }
.metrics-list { display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); }
.metric-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
    padding: 22px;
    border-right: 1px solid var(--border);
}
.metric-item:last-child { border-right: 0; }
.metric-item--primary { background: var(--container-low); }
.metric-icon {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: var(--primary-container);
    color: var(--primary);
}
.metric-icon--warning { background: var(--warning-bg); color: var(--warning); }
.metric-icon svg { width: 19px; height: 19px; }
.metric-copy { display: flex; flex-direction: column; min-width: 0; }
.metric-label { color: var(--on-surface-variant); font-size: 11px; font-weight: 700; letter-spacing: 0.075em; text-transform: uppercase; }
.metric-value { margin-top: 3px; color: var(--on-surface); font-family: var(--mono); font-size: 21px; line-height: 1.25; letter-spacing: -0.035em; white-space: nowrap; }
.metric-value.is-zero { color: var(--on-surface-variant); }
.metric-value.is-warn { color: var(--warning); }
.metric-note { margin-top: 3px; color: var(--on-surface-variant); font-size: 11.5px; white-space: nowrap; }
.metric-item .delta { position: absolute; top: 18px; right: 18px; }

/* Dashboard two-column working area */
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 22px; align-items: start; }
.dash-col { display: flex; flex-direction: column; gap: 22px; min-width: 0; }
.dash-col .section { margin-bottom: 0; }

/* Attention panel (termination review) — full border + tinted header, no side-stripe */
.panel-alert { border-color: var(--warning); }
.panel-alert .panel-head { background: var(--warning-bg); border-bottom-color: var(--warning); }
.panel-alert .panel-title { color: var(--warning); }

/* Revenue-by-plan bars — colored palette, one hue per plan */
.bars { padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; }
.bar-row { display: grid; grid-template-columns: 1fr auto; gap: 9px 12px; align-items: baseline; }
.bar-row .name { font-size: 13px; font-weight: 600; }
.bar-row .amt { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.bar-track { grid-column: 1 / -1; height: 8px; border-radius: var(--radius-full); background: var(--container); overflow: hidden; }
.bar-fill { height: 100%; border-radius: var(--radius-full); background: var(--primary); }
.bar-row:nth-child(5n+1) .bar-fill { background: var(--primary); }
.bar-row:nth-child(5n+2) .bar-fill { background: var(--success); }
.bar-row:nth-child(5n+3) .bar-fill { background: var(--accent-violet); }
.bar-row:nth-child(5n+4) .bar-fill { background: var(--warning); }
.bar-row:nth-child(5n+5) .bar-fill { background: var(--accent-cyan); }

/* Initials avatar */
.avatar {
    width: 30px; height: 30px; border-radius: var(--radius-full); flex-shrink: 0;
    display: inline-grid; place-items: center; font-size: 11px; font-weight: 700;
    background: var(--primary-container); color: var(--on-primary-container);
    letter-spacing: 0.02em; text-transform: uppercase;
}
.cell-id { display: flex; align-items: center; gap: 10px; }

/* Richer empty states inside panels */
.emptier { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--on-surface-variant); }
.emptier svg { width: 26px; height: 26px; opacity: 0.5; margin-bottom: 2px; }
.emptier .lead { font-weight: 600; color: var(--on-surface); font-size: 13px; }
.emptier .sub { font-size: 12px; }

/* Clickable name in list rows */
.row-link { font-weight: 600; color: var(--on-surface); }
.row-link:hover { color: var(--primary); }
.invoice-dashboard-row { position: relative; cursor: pointer; }
.invoice-dashboard-link::after {
    content: "";
    position: absolute;
    inset: 0;
}
.invoice-dashboard-row:focus-within td {
    background: color-mix(in oklch, var(--primary-container) 42%, var(--container-lowest));
}

/* ------------------------------------------------------------------ *
 *  Tabs (client profile)
 * ------------------------------------------------------------------ */
.tabs { display: flex; gap: 5px; width: max-content; max-width: 100%; padding: 5px; border: 1px solid var(--border); border-radius: 14px; background: var(--container-low); margin-bottom: 22px; }
.tab-btn {
    appearance: none; background: none; border: none; cursor: pointer;
    font-family: inherit; font-size: 14px; font-weight: 600; color: var(--on-surface-variant);
    padding: 9px 14px; border-radius: 10px;
    display: inline-flex; align-items: center; gap: 8px;
    transition: color 180ms cubic-bezier(0.22, 1, 0.36, 1), background-color 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.tab-btn:hover { color: var(--on-surface); }
.tab-btn.active { color: var(--on-surface); background: var(--container-lowest); box-shadow: var(--shadow-xs); }
.tab-count {
    font-family: var(--mono); font-size: 11px; font-weight: 600; line-height: 1;
    padding: 3px 6px; border-radius: var(--radius-full); background: var(--container); color: var(--on-surface-variant);
}
.tab-btn.active .tab-count { background: var(--primary-container); color: var(--on-primary-container); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }
.tab-panel .section:last-child { margin-bottom: 0; }

/* Per-account renewal/billing editors */
.billing-editors { display: flex; flex-direction: column; gap: 18px; }
.billing-editor { border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.billing-editor + .billing-editor { margin-top: 0; }
.billing-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.billing-editor-head .mono { font-size: 14px; font-weight: 600; }
.billing-editor .form-grid { grid-template-columns: repeat(3, 1fr); }
.billing-actions { display: flex; gap: 10px; }
.billing-issue { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.billing-issue .form-hint { margin-top: 0; }
@media (max-width: 640px) { .billing-editor .form-grid { grid-template-columns: 1fr; } }

/* Profile summary card */
.summary {
    background: var(--container-lowest); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 22px 26px; margin-bottom: 28px;
    box-shadow: var(--shadow-sm);
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 20px 32px;
}
.summary dt { font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--on-surface-variant); margin: 0 0 4px; }
.summary dd { margin: 0; font-size: 15px; font-weight: 500; }

.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--on-surface-variant); margin-bottom: 12px; }
.back-link:hover { color: var(--primary); text-decoration: none; }
.back-link svg { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ *
 *  Panels + tables
 * ------------------------------------------------------------------ */
.section { margin-bottom: 28px; scroll-margin-top: 88px; }

.panel {
    background: var(--container-lowest); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px; border-bottom: 1px solid var(--border);
}
.panel-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.panel-title .hint { font-weight: 400; font-size: 12px; color: var(--on-surface-variant); margin-left: 8px; }
.panel-note { font-size: 12px; color: var(--on-surface-variant); padding: 12px 20px 0; margin: 0; }

/* Section header — sits ABOVE the card, not inside it. Title left, meta right. */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 12px; padding: 0 2px; }
.section-title { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; margin: 0; color: var(--on-surface); }
.section-title--alert { color: var(--danger); }
.section-description { margin: 3px 0 0; color: var(--on-surface-variant); font-size: 12.5px; }
.section-meta { font-size: 12.5px; color: var(--on-surface-variant); font-weight: 500; white-space: nowrap; }
.section-meta b { color: var(--on-surface); font-weight: 700; }

table.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 13px 20px; }
.table thead th {
    font-size: 10.5px; font-weight: 750; letter-spacing: 0.085em; text-transform: uppercase;
    color: var(--on-surface-variant); background: var(--container-low);
    border-bottom: 1px solid var(--border);
}
.table tbody td { border-bottom: 1px solid var(--border); font-size: 13.5px; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: color-mix(in oklch, var(--container-low) 64%, var(--container-lowest)); }
.table .mono { font-size: 13px; }
.table-empty { padding: 32px 20px; text-align: center; color: var(--on-surface-variant); }
.table tfoot td { border-top: 1px solid var(--border); font-size: 13px; color: var(--on-surface-variant); }
.table tfoot tr:last-child td { color: var(--on-surface); border-top: 2px solid var(--outline-variant); }

/* ------------------------------------------------------------------ *
 *  Status badges — subtle fill
 * ------------------------------------------------------------------ */
.badge {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px; border-radius: var(--radius-full);
    font-size: 11px; font-weight: 700; text-transform: capitalize; white-space: nowrap; line-height: 16px;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: var(--radius-full); background: currentColor; }
.badge-active, .badge-paid, .badge-succeeded { background: var(--success-bg); color: var(--success); }
.badge-suspended, .badge-provisioning, .badge-import_review, .badge-failed, .badge-partially_paid, .badge-partially_refunded { background: var(--warning-bg); color: var(--warning); }
.badge-overdue, .badge-terminated, .badge-void, .badge-refunded { background: var(--danger-bg); color: var(--danger); }
.badge-issued, .badge-pending { background: var(--info-bg); color: var(--info); }
.badge-missing, .badge-unavailable { background: var(--danger-bg); color: var(--danger); }

/* Owner hosting register: operational density without hiding the billing context. */
.fleet-summary {
    display: grid;
    grid-template-columns: 1.2fr repeat(3, minmax(150px, 1fr));
    margin-bottom: 30px;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--container-lowest);
    box-shadow: var(--shadow-sm);
}
.fleet-summary > div {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 22px;
    border-right: 1px solid var(--border);
}
.fleet-summary > div:last-child { border-right: 0; }
.fleet-summary span {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--on-surface-variant);
    font-size: 12px;
    font-weight: 600;
}
.fleet-summary strong {
    color: var(--on-surface);
    font-family: var(--mono);
    font-size: 21px;
    font-variant-numeric: tabular-nums;
}
.fleet-dot {
    width: 7px;
    height: 7px;
    flex: 0 0 auto;
    border-radius: var(--radius-full);
    background: var(--outline);
}
.fleet-dot.is-active { background: var(--success); }
.fleet-dot.is-suspended { background: var(--warning); }
.fleet-dot.is-attention { background: var(--danger); }
.hosting-table { min-width: 1040px; }
.host-identity { display: flex; min-width: 0; align-items: center; gap: 10px; }
.host-mark {
    display: grid;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 9px;
    background: var(--primary-container);
    color: var(--on-primary-container);
}
.host-mark svg { width: 17px; height: 17px; stroke-width: 1.7; }
.status-control { display: flex; align-items: center; gap: 7px; margin: 0; }
.status-control select {
    min-height: 32px;
    padding: 5px 28px 5px 9px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    background: var(--container-lowest);
    color: var(--on-surface);
    font: 600 12px/1 var(--font);
}
.status-control select:hover { border-color: var(--border-strong); }

/* ------------------------------------------------------------------ *
 *  Buttons
 * ------------------------------------------------------------------ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 40px; padding: 9px 16px; border-radius: var(--radius); border: 1px solid transparent;
    font-family: inherit; font-size: 13px; font-weight: 650; cursor: pointer; text-align: center;
    transition: background-color 180ms cubic-bezier(0.22, 1, 0.36, 1), border-color 180ms cubic-bezier(0.22, 1, 0.36, 1), transform 180ms cubic-bezier(0.22, 1, 0.36, 1), box-shadow 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.btn:hover { text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn-primary { background: var(--primary); color: var(--on-primary); box-shadow: 0 6px 16px -10px var(--primary); }
.btn-primary:hover { background: var(--primary-strong); transform: translateY(-1px); box-shadow: 0 9px 20px -11px var(--primary); }
.btn-secondary { background: var(--container-lowest); border-color: var(--outline-variant); color: var(--on-surface); }
.btn-secondary:hover { background: var(--container-low); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--primary); padding-left: 8px; padding-right: 8px; }
.btn-ghost:hover { background: var(--container-low); }
.btn-danger { background: var(--danger); color: var(--on-primary); }
.btn-danger:hover { background: #93000a; }
.btn-danger-ghost { background: transparent; color: var(--danger); padding: 6px 10px; font-size: 13px; }
.btn-danger-ghost:hover { background: var(--danger-bg); text-decoration: none; }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 12px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ *
 *  Forms
 * ------------------------------------------------------------------ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field input, .field select {
    width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid var(--outline-variant);
    border-radius: var(--radius); font-size: 14px; font-family: inherit; background: var(--container-lowest);
    color: var(--on-surface); transition: border-color 160ms, box-shadow 160ms;
}
.field input::placeholder { color: var(--outline); }
.field input:focus, .field select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent);
}
.form-hint { font-size: 12px; color: var(--on-surface-variant); margin-top: 6px; }
.field-error { display: block; margin-top: 6px; color: var(--danger); font-size: 12px; font-weight: 600; }
.form-subhead { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--on-surface-variant); margin: 8px 0 14px; padding-top: 20px; border-top: 1px solid var(--border); }
.form-subhead:first-child { padding-top: 0; border-top: none; }

/* ------------------------------------------------------------------ *
 *  Portal — user footer bar, stat cards, support channels
 * ------------------------------------------------------------------ */
.userbar { display: flex; align-items: center; gap: 10px; }
.userbar .avatar { width: 34px; height: 34px; font-size: 11px; flex-shrink: 0; background: var(--sidebar-active); color: var(--inverse-on-surface); }
.userbar-id { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.userbar-name { color: var(--inverse-on-surface); font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbar-email { font-size: 10.5px; color: var(--sidebar-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.userbar-actions { display: flex; align-items: center; gap: 2px; }
.userbar-actions form { margin: 0; }
.icon-btn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: var(--radius); border: none; background: transparent; color: var(--sidebar-muted); cursor: pointer; }
.icon-btn:hover { background: var(--sidebar-hover); color: var(--inverse-on-surface); text-decoration: none; }
.icon-btn.is-active { background: var(--sidebar-hover); color: var(--inverse-on-surface); }
.icon-btn svg { width: 18px; height: 18px; }

.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 18px; margin-bottom: 26px; }

/* Client home: a guided service summary followed by a compact account ledger. */
.service-overview {
    margin-bottom: 32px;
    background: var(--container-lowest);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.service-summary {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 18px;
    padding: 24px;
    background: var(--container-low);
    border-bottom: 1px solid var(--border);
}
.service-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 10px 24px -18px var(--primary);
}
.service-icon svg { width: 24px; height: 24px; }
.service-summary .page-eyebrow { margin-bottom: 3px; }
.service-summary h2 { margin: 0; font-size: 18px; line-height: 1.35; letter-spacing: -0.025em; }
.service-summary p { margin: 4px 0 0; color: var(--on-surface-variant); font-size: 13px; }
.portal-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 0.72fr)) minmax(220px, 1.45fr); }
.portal-metric {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 14px;
    min-width: 0;
    padding: 19px 22px;
    color: var(--on-surface);
    border-right: 1px solid var(--border);
    transition: background-color 180ms cubic-bezier(0.22, 1, 0.36, 1);
}
.portal-metric:last-child { border-right: 0; }
.portal-metric:hover { background: var(--container-low); text-decoration: none; }
.portal-metric > span { align-self: center; color: var(--on-surface-variant); font-size: 11px; font-weight: 700; letter-spacing: 0.065em; text-transform: uppercase; }
.portal-metric strong { grid-row: 1 / span 2; grid-column: 2; align-self: center; font-family: var(--mono); font-size: 21px; letter-spacing: -0.035em; white-space: nowrap; }
.portal-metric strong.is-warn { color: var(--warning); }
.portal-metric small { color: var(--on-surface-variant); font-size: 11.5px; }
.portal-metric--renewal strong { font-size: 17px; }

.support-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; }
.support-card { display: flex; gap: 16px; align-items: flex-start; background: var(--container-lowest); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 22px; box-shadow: var(--shadow-sm); }
.support-card .s-ico { width: 44px; height: 44px; border-radius: var(--radius); background: var(--primary-container); color: var(--primary); display: grid; place-items: center; flex-shrink: 0; }
.support-card .s-ico svg { width: 24px; height: 24px; }
.support-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; }
.support-card p { margin: 0 0 8px; font-size: 13px; color: var(--on-surface-variant); }
.support-card .s-value { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.support-card.is-soon { opacity: 0.7; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0 20px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
.panel-body { padding: 20px; }

/* Selectable plan cards on the in-portal order page */
.order-plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; border: 0; padding: 0; margin: 0; }
.order-plan {
    position: relative; display: block; cursor: pointer;
    background: var(--container-lowest); border: 1.5px solid var(--border-strong);
    border-radius: var(--radius-xl); padding: 18px 18px 20px; box-shadow: var(--shadow-sm);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.order-plan:hover { border-color: var(--outline-variant); }
.order-plan input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.order-plan:has(input:checked) { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 14%, transparent); }
.order-plan:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }
.order-plan-body { display: flex; flex-direction: column; gap: 6px; }
.order-plan-name { font-size: 12px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--on-surface-variant); }
.order-plan-price { font-family: var(--mono); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; color: var(--on-surface); line-height: 1.1; }
.order-plan-price small { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); font-family: var(--font); }
.order-plan-desc { font-size: 13px; color: var(--on-surface-variant); margin-top: 2px; }
.order-plan-tick {
    position: absolute; top: 14px; right: 14px; width: 24px; height: 24px; border-radius: var(--radius-full);
    display: grid; place-items: center; background: var(--primary); color: var(--on-primary);
    opacity: 0; transform: scale(0.7); transition: opacity 0.15s ease, transform 0.15s ease;
}
.order-plan-tick svg { width: 15px; height: 15px; }
.order-plan:has(input:checked) .order-plan-tick { opacity: 1; transform: scale(1); }

.inline-form { display: flex; gap: 8px; align-items: center; justify-content: flex-end; }
.inline-form input {
    padding: 7px 11px; border: 1px solid var(--outline-variant); border-radius: var(--radius);
    font-size: 13px; font-family: inherit; width: 150px; background: var(--container-lowest);
}
.inline-form input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent); }

/* Inline reassign control on a hosting-account row */
.inline-reassign { display: inline-flex; gap: 6px; align-items: center; vertical-align: middle; margin-right: 6px; }
.inline-reassign select {
    padding: 6px 9px; border: 1px solid var(--outline-variant); border-radius: var(--radius);
    font-size: 13px; font-family: inherit; background: var(--container-lowest); max-width: 180px;
}
.inline-reassign select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent); }
.btn-small { padding: 6px 10px; font-size: 13px; }
.renewal-date-value { display: block; white-space: nowrap; }
.renewal-panel { position: relative; z-index: 2; overflow: visible; }
.renewal-date-control { position: relative; margin-top: 3px; }
.renewal-date-control > summary {
    width: max-content;
    list-style: none;
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 650;
    cursor: pointer;
}
.renewal-date-control > summary::-webkit-details-marker { display: none; }
.renewal-date-control > form {
    position: absolute;
    z-index: 15;
    top: calc(100% + 7px);
    left: 0;
    width: 230px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 13px;
    background: var(--container-lowest);
    box-shadow: var(--shadow-pop);
}
.renewal-date-control label { display: grid; gap: 6px; color: var(--on-surface); font-size: 10.5px; font-weight: 650; }
.renewal-date-control input[type="date"] {
    min-height: 38px;
    padding: 8px 9px;
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    background: var(--container-lowest);
    color: var(--on-surface);
    font: inherit;
}
.renewal-date-control .btn { width: 100%; margin-top: 10px; }

/* Alerts */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 20px; font-weight: 500; }
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error { background: var(--danger-bg); color: var(--danger); }

.code-block {
    background: var(--container-low); border: 1px solid var(--border);
    padding: 12px 14px; border-radius: var(--radius); font-family: var(--mono);
    font-size: 13px; word-break: break-all; white-space: pre-wrap; margin: 0;
}

/* ------------------------------------------------------------------ *
 *  Auth layout — split-screen customer and owner access
 * ------------------------------------------------------------------ */
.auth-body {
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    padding: 12px;
    background:
        radial-gradient(circle at 8% 12%, oklch(0.82 0.095 228 / 0.8), transparent 26%),
        oklch(0.58 0.16 235);
}
.auth-shell {
    width: min(1500px, 100%);
    height: calc(100vh - 24px);
    height: calc(100dvh - 24px);
    min-height: 620px;
    display: grid;
    grid-template-columns: minmax(420px, 0.82fr) minmax(560px, 1.45fr);
    margin: 0 auto;
    overflow: hidden;
    border: 1px solid oklch(0.97 0.02 230 / 0.62);
    border-radius: 28px;
    background: var(--container-lowest);
    box-shadow: 0 28px 80px -34px oklch(0.2 0.085 240 / 0.55);
}
.auth-visual {
    position: relative;
    isolation: isolate;
    min-width: 0;
    overflow: hidden;
    background: var(--primary-strong);
}
.auth-visual > img {
    position: absolute;
    inset: 0;
    z-index: -2;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.015);
}
.auth-visual-shade {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(180deg, oklch(0.2 0.045 248 / 0.12) 25%, oklch(0.18 0.055 248 / 0.84) 100%),
        linear-gradient(120deg, oklch(0.5 0.12 235 / 0.14), transparent 52%);
}
.auth-body--owner .auth-visual-shade {
    background: linear-gradient(180deg, oklch(0.18 0.045 248 / 0.22), oklch(0.15 0.045 250 / 0.9));
}
.auth-brand {
    display: inline-flex;
    align-items: center;
    color: inherit;
    font-weight: 700;
}
.auth-brand:hover { text-decoration: none; }
.auth-brand--visual {
    position: absolute;
    top: 32px;
    left: 34px;
    color: oklch(0.98 0.008 235);
}
.auth-wordmark { display: block; width: 164px; height: auto; filter: brightness(0) invert(1); }
.auth-visual-copy {
    position: absolute;
    right: 36px;
    bottom: 38px;
    left: 36px;
    color: oklch(0.98 0.008 235);
}
.auth-visual-kicker {
    display: block;
    margin-bottom: 10px;
    color: oklch(0.9 0.055 225);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}
.auth-visual-copy > p {
    max-width: 18ch;
    margin: 0;
    font-family: var(--mono);
    font-size: clamp(25px, 2.15vw, 38px);
    font-weight: 650;
    line-height: 1.14;
    letter-spacing: -0.045em;
}
.auth-trust-row { display: flex; flex-wrap: wrap; gap: 15px; margin-top: 24px; font-size: 11px; color: oklch(0.91 0.024 235); }
.auth-trust-row span { display: inline-flex; align-items: center; gap: 6px; }
.auth-trust-row i { width: 6px; height: 6px; border-radius: var(--radius-full); background: oklch(0.78 0.15 190); }
.auth-main {
    position: relative;
    min-width: 0;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 74px 64px 58px;
    background:
        radial-gradient(circle at 100% 0%, var(--primary-container), transparent 28%),
        var(--container-lowest);
}
.auth-back {
    position: absolute;
    top: 27px;
    right: 32px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--on-surface-variant);
    font-size: 12px;
    font-weight: 600;
}
.auth-back svg { width: 15px; height: 15px; }
.auth-panel { width: min(100%, 500px); }
.auth-body--register .auth-panel { width: min(100%, 590px); }
.auth-eyebrow {
    display: block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 10.5px;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}
.auth-panel h1 {
    margin: 0 0 7px;
    color: var(--on-surface);
    font-family: var(--mono);
    font-size: 32px;
    font-weight: 650;
    line-height: 1.18;
    letter-spacing: -0.04em;
}
.auth-panel .sub { max-width: 48ch; margin: 0 0 26px; color: var(--on-surface-variant); font-size: 13.5px; }
.auth-form { display: flex; flex-direction: column; gap: 15px; }
.auth-form .field { margin: 0; }
.auth-field label { margin-bottom: 7px; color: var(--on-surface); font-size: 11.5px; font-weight: 650; }
.auth-field .field-hint { margin: 7px 0 0; color: var(--on-surface-variant); font-size: 11px; }
.auth-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.auth-label-row label { margin: 0; }
.auth-label-row a { font-size: 11.5px; font-weight: 650; }
.auth-field input {
    min-height: 50px;
    padding: 12px 14px;
    border-color: var(--border-strong);
    border-radius: 11px;
    background: var(--container-lowest);
    font-size: 13.5px;
}
.auth-field input::placeholder { color: var(--outline); }
.auth-field input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in oklch, var(--primary) 15%, transparent);
}
.auth-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.auth-submit { min-height: 50px; margin-top: 3px; border-radius: 11px; font-size: 13px; }
.auth-alt { margin: 21px 0 0; text-align: center; color: var(--on-surface-variant); font-size: 12.5px; }
.auth-alt a { font-weight: 700; }
.auth-legal {
    position: absolute;
    right: 24px;
    bottom: 18px;
    left: 24px;
    margin: 0;
    text-align: center;
    color: var(--outline);
    font-size: 10.5px;
}
.auth-code-input { text-align: center; font-size: 20px !important; letter-spacing: 0.22em; }
.auth-panel .alert { margin-bottom: 18px; }

/* ------------------------------------------------------------------ *
 *  Marketing (storefront)
 * ------------------------------------------------------------------ */
.market-top {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 32px; border-bottom: 1px solid var(--border); background: var(--container-lowest);
}
.market-top .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; color: var(--on-surface); }
.market-top .brand .mark { width: 30px; height: 30px; border-radius: var(--radius); background: var(--primary); color: var(--on-primary); display: grid; place-items: center; }
.market-top .links { display: flex; gap: 22px; align-items: center; font-size: 14px; }

.market-body { max-width: 1080px; margin: 0 auto; padding: 56px 32px 72px; }
.hero { max-width: 640px; margin-bottom: 44px; }
.hero h1 { font-size: 34px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; margin: 0 0 12px; }
.hero p { font-size: 16px; color: var(--on-surface-variant); margin: 0; }

.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.plan-card {
    background: var(--container-lowest); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 24px; display: flex; flex-direction: column; gap: 8px;
    transition: border-color 160ms, box-shadow 160ms;
}
.plan-card:hover { border-color: var(--primary); box-shadow: var(--shadow-pop); }
.plan-name { font-size: 16px; font-weight: 700; }
.plan-price { font-family: var(--mono); font-size: 26px; font-weight: 700; color: var(--on-surface); letter-spacing: -0.01em; }
.plan-cycle { font-size: 12px; color: var(--on-surface-variant); text-transform: uppercase; letter-spacing: 0.05em; }
.plan-desc { font-size: 14px; color: var(--on-surface-variant); flex: 1; margin: 8px 0 4px; }
.empty-state { text-align: center; padding: 56px 24px; color: var(--on-surface-variant); grid-column: 1 / -1; }

/* Client email workspace */
.email-page-head { margin-bottom: 22px; }
.email-overview {
    display: grid;
    grid-template-columns: auto repeat(3, minmax(0, 1fr));
    align-items: center;
    margin-bottom: 26px;
    overflow: hidden;
    background: var(--container-lowest);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}
.email-overview-icon {
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    margin: 18px 6px 18px 20px;
    border-radius: 15px;
    background: var(--primary);
    color: var(--on-primary);
}
.email-overview-icon svg { width: 25px; height: 25px; }
.email-overview > div:not(.email-overview-icon) {
    min-width: 0;
    padding: 18px 22px;
    border-right: 1px solid var(--border);
}
.email-overview > div:last-child { border-right: 0; }
.email-overview span {
    display: block;
    color: var(--on-surface-variant);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.065em;
    text-transform: uppercase;
}
.email-overview strong {
    display: block;
    margin-top: 3px;
    font-family: var(--mono);
    font-size: 20px;
    line-height: 1.3;
    letter-spacing: -0.025em;
}
.email-overview small { display: block; margin-top: 2px; color: var(--on-surface-variant); font-size: 11px; }
.email-account-list { display: flex; flex-direction: column; gap: 22px; }
.email-account {
    scroll-margin-top: 24px;
    overflow: hidden;
    background: var(--container-lowest);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}
.email-account:target { border-color: color-mix(in oklch, var(--primary) 50%, var(--border)); }
.email-account-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 22px;
    background: var(--container-low);
    border-bottom: 1px solid var(--border);
}
.email-account-head > div { display: flex; align-items: center; gap: 12px; min-width: 0; }
.email-domain-icon {
    width: 38px;
    height: 38px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 11px;
    background: var(--primary-container);
    color: var(--on-primary-container);
    font-family: var(--mono);
    font-size: 17px;
    font-weight: 700;
}
.email-account-head h2 { margin: 0; font-size: 15px; line-height: 1.3; }
.email-account-head small { display: block; margin-top: 2px; color: var(--on-surface-variant); font-size: 11px; }
.email-account-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, 0.75fr); }
.email-mailboxes { min-width: 0; padding: 4px 22px 12px; }
.email-section-label {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.55fr);
    gap: 24px;
    padding: 13px 0 9px;
    color: var(--on-surface-variant);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}
.email-mailbox-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(180px, 0.55fr);
    align-items: center;
    gap: 24px;
    min-height: 68px;
    border-top: 1px solid var(--border);
}
.email-address { display: flex; align-items: center; gap: 11px; min-width: 0; }
.email-avatar {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: var(--radius-full);
    background: var(--accent-cyan-bg);
    color: var(--accent-cyan);
    font-size: 11px;
    font-weight: 750;
}
.email-address > span:last-child { min-width: 0; }
.email-address strong { display: block; overflow: hidden; font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.email-address small { display: block; margin-top: 2px; color: var(--on-surface-variant); font-size: 10.5px; }
.email-usage > span:first-child { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.email-usage strong { font-family: var(--mono); font-size: 11.5px; }
.email-usage small { color: var(--on-surface-variant); font-size: 10px; }
.email-usage-track {
    display: block;
    height: 6px;
    margin-top: 7px;
    overflow: hidden;
    border-radius: var(--radius-full);
    background: var(--container);
}
.email-usage-track i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }
.email-usage-track.is-unlimited i { width: 18%; background: var(--success); opacity: 0.72; }
.email-empty { min-height: 138px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-top: 1px solid var(--border); }
.email-section-label + .email-mailbox-row,
.email-section-label + .email-empty { border-top: 0; }
.email-empty strong { font-size: 13px; }
.email-empty span { margin-top: 4px; color: var(--on-surface-variant); font-size: 11.5px; }
.email-sync-note { margin: 10px 0 2px; color: var(--warning); font-size: 11px; }
.email-create {
    padding: 24px;
    background: var(--container-low);
    border-left: 1px solid var(--border);
}
.email-create h3 { margin: 1px 0 5px; font-size: 17px; letter-spacing: -0.02em; }
.email-create > p { max-width: 36ch; margin: 0 0 18px; color: var(--on-surface-variant); font-size: 12px; }
.email-address-input {
    display: grid;
    grid-template-columns: minmax(90px, 0.75fr) minmax(130px, 1.25fr);
    align-items: center;
    overflow: hidden;
    background: var(--container-lowest);
    border: 1px solid var(--outline-variant);
    border-radius: var(--radius);
    transition: border-color 160ms, box-shadow 160ms;
}
.email-address-input:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--primary) 16%, transparent);
}
.email-address-input input {
    min-width: 0;
    min-height: 42px;
    padding: 10px 8px 10px 12px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--on-surface);
    font: inherit;
}
.email-address-input span {
    min-width: 0;
    overflow: hidden;
    padding-right: 12px;
    color: var(--on-surface-variant);
    font-family: var(--mono);
    font-size: 11.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ------------------------------------------------------------------ *
 *  Responsive — sidebar collapses to a top strip, tables scroll
 * ------------------------------------------------------------------ */
@media (max-width: 1180px) {
    .dashboard-stage,
    .workspace-grid { grid-template-columns: 1fr; }
    .client-profile-hero { grid-template-columns: 1fr; }
    .profile-settings-grid { grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr); }
    .invoice-overview { grid-template-columns: 1fr 1.25fr; }
    .invoice-overview-secondary { grid-column: 1 / -1; border-top: 1px solid var(--border); }
    .invoice-detail-layout { grid-template-columns: minmax(0, 1fr) 260px; }
    .workspace-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .workspace-aside > :only-child { grid-column: 1 / -1; }
    .metrics-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .metric-item:nth-child(2) { border-right: 0; }
    .metric-item:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
    .portal-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .portal-metric:nth-child(2) { border-right: 0; }
    .portal-metric:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
    .email-account-grid { grid-template-columns: minmax(0, 1.3fr) minmax(270px, 0.7fr); }
    .fleet-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fleet-summary > div:nth-child(2) { border-right: 0; }
    .fleet-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
}

@media (max-width: 960px) {
    .control-body { height: auto; min-height: 100vh; overflow: auto; padding: 0; background: var(--surface); }
    .app-shell { height: auto; min-height: 100vh; overflow: visible; border: 0; border-radius: 0; box-shadow: none; }
    .app-shell::before { display: none; }
    .app-shell { flex-direction: column; }
    .main { height: auto; overflow: visible; scrollbar-gutter: auto; }
    .invoice-detail-layout { grid-template-columns: 1fr; }
    .invoice-detail-aside { position: static; }
    .invoice-bulk-bar { left: 20px; }
    .email-overview { grid-template-columns: auto repeat(3, minmax(0, 1fr)); }
    .email-overview > div:not(.email-overview-icon) { padding: 16px; }
    .email-account-grid { grid-template-columns: 1fr; }
    .email-create { border-top: 1px solid var(--border); border-left: 0; }
    .sidebar-collapse { display: none; }
    .app-shell.is-compact { --sidebar-w: 248px; }

    /* Persistent top bar: brand left, hamburger right. Sits above the drawer and
       backdrop so the hamburger (↔ X) is always crisp and tappable. */
    .mobile-header {
        display: flex; align-items: center; justify-content: space-between;
        position: sticky; top: 0; z-index: 70; height: 56px;
        padding: 0 12px 0 16px;
        background: var(--container-lowest); border-bottom: 1px solid var(--border);
    }
    .mobile-header .sidebar-brand { padding: 0; }
    .mobile-header .sidebar-brand { color: var(--on-surface); }
    .mobile-header .sidebar-brand .role { color: var(--on-surface-variant); }
    .mobile-header .sidebar-wordmark { width: 122px; filter: none; }

    .nav-toggle {
        display: grid; place-items: center;
        width: 42px; height: 42px;
        border: 1px solid var(--border-strong); border-radius: var(--radius);
        background: var(--container-lowest); color: var(--on-surface); cursor: pointer;
    }
    .nav-toggle svg { width: 22px; height: 22px; }
    .nav-toggle .i-close { display: none; }
    .app-shell.is-open .nav-toggle .i-open { display: none; }
    .app-shell.is-open .nav-toggle .i-close { display: block; }

    /* Sidebar → full-height off-canvas drawer, a side strip (not full width) that
       slides in beneath the header over a dimmed, tap-to-close backdrop, leaving
       the page visible alongside. Its own brand is hidden (the header shows it). */
    .sidebar {
        position: fixed; top: 0; left: 0; z-index: 60;
        width: min(76vw, 300px); height: 100vh; height: 100dvh; padding-top: 56px;
        flex-direction: column; border-right: 1px solid var(--border);
        box-shadow: var(--shadow-lg); overflow-y: auto;
        transform: translateX(-100%); transition: transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
    }
    .app-shell.is-open .sidebar { transform: translateX(0); }
    .sidebar .sidebar-brand { display: none; }

    .nav-backdrop {
        display: block; position: fixed; inset: 0; z-index: 50;
        background: oklch(0.18 0.035 283 / 0.45);
        opacity: 0; visibility: hidden; transition: opacity 180ms cubic-bezier(0.22, 1, 0.36, 1);
    }
    .app-shell.is-open .nav-backdrop { opacity: 1; visibility: visible; }

    .nav-item {
        border-left: none; border-radius: var(--radius);
        padding: 12px 14px; font-size: 15px; white-space: normal;
    }
    .nav-item svg { width: 20px; height: 20px; }
    .nav-item.active { border-left: none; }

    .sidebar-foot > form { margin-top: 10px; }
    .icon-btn { width: 40px; height: 40px; }

    .content, .topbar { padding-left: 20px; padding-right: 20px; }
    .content { padding-top: 28px; }
    .topbar { padding-top: 12px; padding-bottom: 12px; }
    .portal-dashboard .topbar { display: none; }
    .dash-grid { grid-template-columns: 1fr; }
    .profile-settings-grid { grid-template-columns: 1fr; }
    .invoice-overview { grid-template-columns: 1fr; }
    .invoice-overview-flow { border: 0; border-top: 1px solid var(--border); }
    .invoice-overview-secondary { grid-column: auto; }
    .dashboard-stage,
    .workspace-grid { grid-template-columns: 1fr; }
    .workspace-aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .plans { grid-template-columns: 1fr; }
    .page-title { font-size: 24px; line-height: 32px; }
    .panel { overflow-x: auto; }
    /* Tighter cells + one-line identifiers so more columns fit before the table
       needs to scroll, and mono ids never break into ragged stacks. */
    .table th, .table td { padding: 12px 14px; }
    .table td.mono, .table thead th { white-space: nowrap; }
    .tabs { overflow-x: auto; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab-btn { white-space: nowrap; }
}
@media (max-width: 560px) {
    /* Owner money cards stay full-width (long AED figures need the room);
       the portal's short count cards go 2-up so they're not a long scroll. */
    .kpi-grid { grid-template-columns: 1fr; }
    .fleet-summary { grid-template-columns: 1fr; }
    .fleet-summary > div,
    .fleet-summary > div:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }
    .fleet-summary > div:last-child { border-bottom: 0; }
    .hosting-register {
        overflow: visible;
        border: 0;
        background: transparent;
        box-shadow: none;
    }
    .hosting-table,
    .hosting-table tbody,
    .hosting-table tr,
    .hosting-table td {
        display: block;
        width: 100%;
        min-width: 0;
    }
    .hosting-table { min-width: 0; }
    .hosting-table thead { display: none; }
    .hosting-table tbody { display: grid; gap: 12px; }
    .hosting-table tr {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 18px 14px;
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: var(--radius-lg);
        background: var(--container-lowest);
        box-shadow: var(--shadow-xs);
    }
    .hosting-table td,
    .hosting-table tbody tr:last-child td {
        padding: 0;
        border: 0;
        background: transparent;
    }
    .hosting-table td::before {
        display: block;
        margin-bottom: 6px;
        color: var(--on-surface-variant);
        content: attr(data-label);
        font-size: 9.5px;
        font-weight: 750;
        letter-spacing: 0.075em;
        text-transform: uppercase;
    }
    .hosting-table td:first-child {
        grid-column: 1 / -1;
        padding-bottom: 14px;
        border-bottom: 1px solid var(--border);
    }
    .hosting-table td:last-child { align-self: end; }
    .hosting-table .status-control { align-items: stretch; flex-direction: column; }
    .hosting-table .status-control select,
    .hosting-table .status-control .btn { width: 100%; }
    .page-head { align-items: stretch; }
    .page-actions { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
    .page-actions .btn { width: 100%; }
    .client-profile-hero { padding: 18px; }
    .client-profile-main { align-items: flex-start; flex-wrap: wrap; }
    .profile-back { order: -1; }
    .client-avatar-large { width: 56px; height: 56px; border-radius: 16px; }
    .client-profile-copy { flex: 1; min-width: 180px; }
    .client-profile-facts { grid-template-columns: 1fr 1fr; width: 100%; }
    .client-profile-facts > span:nth-child(2) { border-right: 0; }
    .client-profile-facts > span:last-child { grid-column: 1 / -1; border-top: 1px solid var(--border); }
    .tabs { width: 100%; overflow-x: auto; }
    .tab-btn { flex: 0 0 auto; font-size: 12px; }
    .form-actions-bar { align-items: stretch; flex-direction: column; }
    .form-actions-bar .btn { width: 100%; }
    .invoice-overview-primary,
    .invoice-overview-flow,
    .invoice-overview-secondary { padding: 18px; }
    .invoice-overview-secondary { grid-template-columns: 1fr 1fr; }
    .invoice-paper-head,
    .invoice-parties { padding: 20px; }
    .invoice-parties { grid-template-columns: 1fr; gap: 20px; }
    .invoice-lines .table { min-width: 600px; }
    .invoice-total strong { font-size: 20px; }
    .invoice-totals { width: calc(100% - 40px); margin-right: 20px; margin-bottom: 20px; }
    .invoice-action-menu { position: fixed; right: 16px; bottom: 16px; top: auto; left: 16px; width: auto; max-height: calc(100dvh - 32px); overflow-y: auto; }
    .invoice-bulk-bar { right: 12px; bottom: 12px; left: 12px; border-radius: 15px; }
    .invoice-bulk-summary { flex-wrap: wrap; gap: 6px 10px; padding: 10px 12px; }
    .invoice-bulk-summary > strong { flex: 1; }
    .invoice-bulk-actions { order: 3; justify-content: flex-start; width: 100%; overflow-x: auto; }
    .invoice-bulk-actions button { background: color-mix(in oklch, var(--inverse-on-surface) 7%, transparent); }
    .bulk-partial-amounts { grid-template-columns: 1fr; }
    .renewal-date-control > form { position: fixed; z-index: 60; right: 16px; bottom: 16px; top: auto; left: 16px; width: auto; }
    .invoice-register { overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .invoice-table,
    .invoice-table tbody,
    .invoice-table tr,
    .invoice-table td { display: block; width: 100%; }
    .invoice-table thead { display: none; }
    .invoice-table tbody { display: grid; gap: 12px; }
    .invoice-table tr {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        gap: 14px 12px;
        padding: 16px;
        border: 1px solid var(--border);
        border-radius: 18px;
        background: var(--surface);
        box-shadow: var(--shadow-1);
    }
    .invoice-table td {
        padding: 0;
        border: 0;
        white-space: normal;
    }
    .invoice-table td.invoice-select-cell {
        position: absolute;
        z-index: 1;
        top: 16px;
        right: 16px;
        width: auto;
        padding: 0 !important;
    }
    .invoice-table td.invoice-id-cell { padding-right: 34px; }
    .invoice-table td.invoice-id-cell { grid-column: 1 / -1; padding-bottom: 13px; border-bottom: 1px solid var(--border); }
    .invoice-table td.invoice-customer-cell { grid-column: 1; }
    .invoice-table td.invoice-status-cell { grid-column: 2; align-self: center; }
    .invoice-table td.invoice-service-cell { grid-column: 1 / -1; }
    .invoice-table td.invoice-issued-cell,
    .invoice-table td.amount-cell {
        display: flex;
        flex-direction: column;
        gap: 3px;
        text-align: left;
    }
    .invoice-table td.invoice-issued-cell { grid-column: 1; }
    .invoice-table td.amount-cell { grid-column: 2; text-align: right; }
    .invoice-table td[data-label]::before {
        content: attr(data-label);
        color: var(--on-surface-variant);
        font-family: var(--body);
        font-size: 9px;
        font-weight: 700;
        letter-spacing: 0.07em;
        text-transform: uppercase;
    }
    .invoice-table td.invoice-actions-cell { grid-column: 1 / -1; }
    .invoice-actions-cell .invoice-row-action,
    .invoice-actions-cell .btn { width: 100%; }
    .invoice-actions-cell .btn { justify-content: center; }
    .dashboard-stage { gap: 16px; margin-bottom: 24px; }
    .feature-banner,
    .analytics-card { min-height: 0; border-radius: 20px; }
    .feature-content { min-height: 338px; padding: 24px 20px; }
    .feature-content h2 { font-size: 24px; }
    .feature-actions { display: grid; grid-template-columns: 1fr; }
    .feature-action { justify-content: center; }
    .analytics-head { padding: 20px 18px 0; }
    .bar-chart { min-height: 150px; padding-left: 18px; padding-right: 18px; gap: 6px; }
    .chart-value { display: none; }
    .chart-column { grid-template-rows: 1fr 18px; }
    .analytics-foot span { padding: 12px 10px; }
    .workspace-aside { display: flex; }
    .health-visual { grid-template-columns: 1fr; justify-items: center; }
    .health-legend { width: 100%; }
    .workspace-grid { gap: 18px; }
    .metrics-heading { padding: 16px; }
    .metrics-list { grid-template-columns: 1fr; }
    .metric-item,
    .metric-item:nth-child(2) { border-right: 0; border-bottom: 1px solid var(--border); padding: 17px 16px; }
    .metric-item:last-child { border-bottom: 0; }
    .service-summary { grid-template-columns: auto minmax(0, 1fr); padding: 18px 16px; }
    .service-summary .btn { grid-column: 1 / -1; width: 100%; }
    .portal-metrics { grid-template-columns: 1fr 1fr; }
    .portal-metric { padding: 16px; grid-template-columns: 1fr; }
    .portal-metric strong { grid-row: auto; grid-column: auto; margin-top: 4px; }
    .portal-metric:nth-child(odd) { border-right: 1px solid var(--border); }
    .portal-metric:nth-child(even) { border-right: 0; }
    .portal-metric:nth-child(-n+2) { border-bottom: 1px solid var(--border); }
    .stat-cards { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
    .kpi { min-height: 0; padding: 16px; }
    .stat-cards .kpi-ico { width: 36px; height: 36px; border-radius: 10px; }
    .stat-cards .kpi-ico svg { width: 19px; height: 19px; }
    .stat-cards .kpi-label { margin-top: 12px; }
    .stat-cards .kpi-value { font-size: 21px; }
    .page-head { margin-bottom: 24px; }
    .topbar { min-height: 58px; }
    .context-kicker { display: none; }
    .content { padding-bottom: 40px; }
    .section-head { align-items: flex-start; }
    .market-body { padding: 32px 20px 56px; }
    .market-top { padding: 14px 18px; }
    .market-top .links { gap: 14px; font-size: 13px; }
    .hero h1 { font-size: 28px; }
}

@media (max-width: 640px) {
    .email-overview { grid-template-columns: 1fr 1fr; }
    .email-overview-icon { display: none; }
    .email-overview > div:not(.email-overview-icon) { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
    .email-overview > div:nth-child(3) { border-right: 0; }
    .email-overview > div:nth-child(4) { grid-column: 1 / -1; border-right: 0; border-bottom: 0; }
    .email-account {
        border-color: var(--border-strong);
        border-radius: 18px;
        box-shadow: 0 10px 28px -24px var(--on-surface);
    }
    .email-account-head { align-items: flex-start; padding: 16px; }
    .email-mailboxes { padding: 0 16px 10px; }
    .email-section-label { display: none; }
    .email-mailbox-row { grid-template-columns: 1fr; gap: 10px; padding: 14px 0; }
    .email-mailbox-row:first-of-type { border-top: 0; }
    .email-empty { min-height: 112px; border-top: 0; }
    .email-empty span { max-width: 24ch; }
    .email-create { padding: 20px 16px; }
}

@media (max-width: 900px) {
    .auth-body { overflow: auto; padding: 0; background: var(--container-lowest); }
    .auth-shell {
        width: 100%;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        grid-template-columns: 1fr;
        grid-template-rows: 260px minmax(0, 1fr);
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }
    .auth-visual > img { object-position: center 38%; }
    .auth-body--owner .auth-visual > img { object-position: center; }
    .auth-brand--visual { top: 22px; left: 24px; }
    .auth-visual-copy { right: 24px; bottom: 22px; left: 24px; }
    .auth-visual-copy > p { max-width: 28ch; font-size: 24px; }
    .auth-trust-row { margin-top: 13px; }
    .auth-main { min-height: 540px; overflow: visible; padding: 72px 28px 56px; }
    .auth-body--register .auth-main { min-height: 610px; }
    .auth-back { top: 25px; right: 24px; }
}

@media (max-width: 560px) {
    .auth-shell { grid-template-rows: 72px minmax(0, 1fr); }
    .auth-visual {
        border-bottom: 1px solid var(--border);
        background: var(--container-lowest);
    }
    .auth-visual > img,
    .auth-visual-shade,
    .auth-visual-copy { display: none; }
    .auth-brand--visual {
        top: 50%;
        left: 20px;
        transform: translateY(-50%);
    }
    .auth-wordmark {
        width: 142px;
        filter: none;
    }
    .auth-main { min-height: 530px; padding: 64px 20px 48px; place-items: start stretch; }
    .auth-body--register .auth-main { min-height: 720px; }
    .auth-panel { width: 100%; }
    .auth-panel h1 { font-size: 27px; }
    .auth-form-row { grid-template-columns: 1fr; gap: 15px; }
    .auth-back { top: 22px; right: 20px; }
    .auth-legal { bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
