:root {
    color-scheme: light;
    --brand-primary: #ff4fa3;
    --brand-primary-hover: #e1368b;
    --brand-accent: #c01870;
    --nav-background: #070509;
    --nav-surface: #211a24;
    --app-background: #f7f3f6;
    --surface: #ffffff;
    --surface-elevated: #ffffff;
    --text-primary: #161018;
    --text-secondary: #6f6470;
    --border: #e6dfe4;
    --success: #16784b;
    --warning: #966000;
    --danger: #b42318;
    --info: #175cd3;
    --success-soft: #eaf8f0;
    --warning-soft: #fff7df;
    --danger-soft: #fff0ef;
    --info-soft: #edf4ff;
    --accent-soft: #ffe5f1;
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 18px;
    --radius-xl: 22px;
    --shadow-sm: 0 1px 2px rgba(7, 5, 9, .05);
    --shadow-card: 0 8px 30px rgba(7, 5, 9, .07);
    --shadow-elevated: 0 22px 60px rgba(7, 5, 9, .14);
    --control-height: 44px;
    --table-cell-y: 14px;
    --table-cell-x: 16px;
    --content-max: 1280px;
    --ink: var(--text-primary);
    --muted: var(--text-secondary);
    --line: var(--border);
    --canvas: var(--app-background);
    --navy: var(--nav-background);
    --navy-soft: var(--nav-surface);
    --accent: var(--brand-primary);
    --accent-dark: var(--brand-accent);
    font-family: Montserrat, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* First-billing readiness: intentionally scoped to keep the operational view compact. */
.readiness-filter { align-items: end; }
.readiness-filter label { min-width: min(100%, 250px); }
.readiness-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin: 18px 0;
    padding: 24px 28px;
    border: 1px solid var(--border);
    border-left: 5px solid var(--brand-primary);
    border-radius: var(--radius-lg);
    background: linear-gradient(115deg, #28141e, #4c1d34);
    color: #fff;
}
.readiness-hero h2 { margin: 3px 0 6px; color: #fff; font-size: clamp(1.55rem, 3vw, 2.25rem); }
.readiness-hero p { margin: 0; color: #f5dde8; }
.readiness-hero.is-blocked { border-left-color: #ef6b6b; }
.readiness-hero.is-ready_with_warnings { border-left-color: #efb55d; }
.readiness-hero.is-ready { border-left-color: #59bd8a; }
.readiness-counts { display: grid; grid-template-columns: repeat(3, minmax(78px, 1fr)); gap: 9px; margin: 0; }
.readiness-counts div { min-width: 86px; padding: 11px; border: 1px solid rgb(255 255 255 / 18%); border-radius: var(--radius-md); background: rgb(255 255 255 / 7%); text-align: center; }
.readiness-counts dt { color: #e7cbd8; font-size: .72rem; font-weight: 700; text-transform: uppercase; }
.readiness-counts dd { margin: 2px 0 0; font-size: 1.45rem; font-weight: 800; }
.readiness-readonly { margin-bottom: 24px; }
.readiness-metrics { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 12px; }
.readiness-metrics article { padding: 15px 17px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.readiness-metrics span { display: block; color: var(--muted); font-size: .78rem; font-weight: 700; }
.readiness-metrics strong { display: block; margin-top: 4px; font-size: 1.55rem; }
.readiness-exclusions { margin: 12px 0 24px; color: var(--muted); font-size: .9rem; }
.readiness-dry-run { margin-bottom: 24px; }
.readiness-breakdowns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; }
.readiness-breakdowns h3 { margin: 0 0 8px; font-size: 1rem; }
.readiness-breakdowns p { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; margin: 0; padding: 9px 0; border-top: 1px solid var(--border); }
.readiness-breakdowns p small { grid-column: 1 / -1; color: var(--muted); }
.readiness-categories { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.readiness-category { margin: 0; }
.readiness-category .panel-heading { margin-bottom: 8px; }
.readiness-category .panel-heading h2 { font-size: 1.05rem; }
.readiness-check { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 10px; padding: 13px 0; border-top: 1px solid var(--border); }
.readiness-check:first-child { border-top: 0; }
.readiness-check h3 { margin: 1px 0 4px; font-size: .94rem; }
.readiness-check p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.45; }
.readiness-check .button { min-height: 34px; padding: 7px 10px; font-size: .78rem; }
.status-badge { display: inline-flex; white-space: nowrap; border: 1px solid transparent; border-radius: 999px; padding: 4px 8px; font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.status-pass { border-color: #b9dec9; background: #e9f7ef; color: #17623c; }
.status-warning { border-color: #efd19e; background: #fff6e5; color: #76510f; }
.status-blocked { border-color: #edbbbb; background: #fff0f0; color: #922d2d; }
.readiness-operations { margin-top: 20px; }
.readiness-sequence { columns: 2; column-gap: 36px; margin: 0; padding-left: 24px; }
.readiness-sequence li { break-inside: avoid; margin: 0 0 10px; padding-left: 4px; color: var(--muted); }

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

@media (max-width: 620px) {
    .readiness-hero { align-items: stretch; flex-direction: column; padding: 20px; }
    .readiness-counts div { min-width: 0; padding: 9px 5px; }
    .readiness-counts dt { font-size: .61rem; }
    .readiness-metrics, .readiness-breakdowns { grid-template-columns: 1fr 1fr; }
    .readiness-check { grid-template-columns: 1fr; }
    .readiness-check .status-badge { justify-self: start; }
    .readiness-check .button { justify-self: start; }
    .readiness-sequence { columns: 1; }
}

@media (max-width: 420px) {
    .readiness-metrics, .readiness-breakdowns { grid-template-columns: 1fr; }
}

/* Phase 08E production UX refinements */
.brand-identity {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
}

.brand-logo {
    display: block;
    width: auto;
    height: auto;
    object-fit: contain;
}

.brand-identity-sidebar .brand-logo {
    max-width: 168px;
    max-height: 54px;
}

.brand-wordmark {
    color: inherit;
    font-size: 19px;
    font-weight: 850;
    letter-spacing: .01em;
}

.brand-identity small {
    display: block;
    color: #b9aeb9;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.brand-identity-auth {
    flex-direction: column;
    justify-content: center;
    width: 100%;
    color: #fff;
}

.brand-identity-auth .brand-logo {
    width: min(220px, 100%);
    max-width: 100%;
    max-height: 110px;
}

.brand-identity-auth small {
    color: #d6cbd5;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid rgba(255, 79, 163, .42);
    outline-offset: 3px;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

.button:disabled,
.button[aria-disabled='true'],
input:disabled,
select:disabled,
textarea:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.button-danger {
    color: #fff;
    background: var(--danger);
}

.button-danger:hover:not(:disabled) {
    background: #8f1c13;
}

.status-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    max-width: 330px;
}

.status-overview,
.settings-status-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.status-overview article,
.readiness-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    min-height: 104px;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.status-overview small,
.readiness-card small {
    display: block;
    margin-bottom: 3px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.settings-status-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-form {
    margin-bottom: var(--space-5);
}

.protected-settings {
    max-width: 1040px;
    border-left: 4px solid var(--nav-surface);
}

.attention-grid-operational {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.attention-card.is-danger {
    border-color: #f4b4b0;
    background: var(--danger-soft);
}

.attention-card.is-danger > strong {
    color: var(--danger);
}

.filter-bar-invoices {
    grid-template-columns: repeat(4, minmax(135px, 1fr));
}

.filter-bar-invoices .field-grow {
    grid-column: span 2;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--canvas);
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 28px 20px;
    color: #fff;
    background: var(--navy);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    color: #fff;
    background: var(--accent);
    font-size: 14px;
    font-weight: 800;
    letter-spacing: .05em;
}

.brand strong,
.brand small {
    display: block;
}

.brand strong {
    font-size: 18px;
    line-height: 1.1;
}

.brand small {
    margin-top: 2px;
    color: #aab5c7;
    font-size: 12px;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.nav-list {
    display: grid;
    gap: 7px;
    margin-top: 48px;
}

.nav-item {
    display: grid;
    grid-template-columns: 24px 1fr auto;
    align-items: center;
    gap: 10px;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 11px;
    color: #cbd3df;
    text-decoration: none;
}

.nav-item.is-active {
    color: #fff;
    background: var(--navy-soft);
}

.nav-item.is-disabled {
    opacity: .58;
}

.nav-item small {
    font-size: 10px;
    text-transform: uppercase;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px;
    color: #aab5c7;
    font-size: 13px;
}

.environment-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 7px;
    border-radius: 50%;
    background: #4ade80;
}

.main-area {
    min-width: 0;
}

.topbar {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px clamp(24px, 4vw, 56px);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--accent-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

.topbar h1 {
    margin-bottom: 0;
    font-size: 24px;
}

.account {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--navy);
    background: #e8edf5;
    font-weight: 800;
}

.account-name {
    max-width: 180px;
    overflow: hidden;
    font-size: 14px;
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.content {
    width: min(1180px, 100%);
    padding: clamp(24px, 4vw, 56px);
}

.welcome-panel {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    padding: clamp(24px, 4vw, 42px);
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(130deg, var(--navy), #2c4162);
    box-shadow: 0 18px 45px rgba(21, 36, 62, .14);
}

.welcome-panel h2 {
    margin-bottom: 8px;
    font-size: clamp(24px, 4vw, 36px);
}

.welcome-panel p:last-child {
    max-width: 660px;
    margin-bottom: 0;
    color: #d8dfeb;
}

.status-badge {
    align-self: flex-start;
    flex: 0 0 auto;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    background: rgba(255, 255, 255, .1);
    font-size: 12px;
    font-weight: 750;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
}

.stat-icon {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    color: var(--accent-dark);
    background: #fff0f4;
    font-size: 13px;
    font-weight: 800;
}

.stat-card small,
.stat-card strong {
    display: block;
}

.stat-card small {
    color: var(--muted);
    font-size: 12px;
}

.stat-card strong {
    margin-top: 2px;
}

.empty-state {
    margin-top: 20px;
    padding: 48px 24px;
    border: 1px dashed #cbd2de;
    border-radius: 18px;
    background: rgba(255, 255, 255, .55);
    text-align: center;
}

.empty-state h2 {
    margin-bottom: 8px;
    font-size: 20px;
}

.empty-state p {
    max-width: 580px;
    margin: 0 auto;
    color: var(--muted);
}

.empty-icon {
    width: 50px;
    height: 50px;
    display: grid;
    place-items: center;
    margin: 0 auto 16px;
    border-radius: 50%;
    color: var(--accent-dark);
    background: #fff0f4;
    font-size: 25px;
}

.button {
    border: 0;
    border-radius: 9px;
    padding: 10px 14px;
    cursor: pointer;
    font-weight: 700;
}

.button-quiet {
    color: var(--muted);
    background: #eef1f5;
}

.button-primary {
    color: #fff;
    background: var(--accent);
}

.button-primary:hover {
    background: var(--accent-dark);
}

.button-full {
    width: 100%;
}

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(circle at 15% 20%, rgba(239, 71, 111, .14), transparent 28rem),
        linear-gradient(145deg, #f7f9fc, #edf1f6);
}

.auth-shell {
    display: flex;
    justify-content: center;
    width: 100%;
    min-width: 0;
}

.login-card {
    width: 100%;
    max-width: 456px;
    min-width: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: var(--surface);
    box-shadow: 0 25px 70px rgba(21, 36, 62, .12);
}

.login-card-wide {
    max-width: 560px;
}

.auth-brand-panel {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 132px;
    padding: 20px 32px;
    background:
        radial-gradient(circle at 82% 10%, rgba(255, 79, 163, .22), transparent 13rem),
        var(--nav-background);
}

.auth-card-body {
    min-width: 0;
    padding: 32px 36px 36px;
}

.auth-card-body > img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto 20px;
}

.login-card code {
    overflow-wrap: anywhere;
}

.recovery-code-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 20px;
    padding-left: 22px;
}

.login-brand {
    color: var(--navy);
}

.login-heading {
    margin: 0 0 28px;
}

.login-heading h1 {
    margin-bottom: 8px;
    font-size: 30px;
}

.login-heading > p:last-child,
.login-note {
    color: var(--muted);
}

.login-card label {
    display: block;
    margin: 18px 0 7px;
    font-size: 13px;
    font-weight: 700;
}

.login-card input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #cbd2de;
    border-radius: 9px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

.login-card input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(239, 71, 111, .13);
}

.login-card .button {
    margin-top: 24px;
}

.field-error {
    margin: 6px 0 0;
    color: #b42318;
    font-size: 12px;
}

.login-note {
    margin: 24px 0 0;
    font-size: 12px;
    text-align: center;
}

@media (max-width: 760px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        padding: 16px 20px;
    }

    .nav-list {
        grid-template-columns: 1fr 1fr 1fr;
        margin-top: 16px;
    }

    .nav-item {
        display: flex;
        justify-content: center;
        min-height: 40px;
        padding: 8px;
        font-size: 13px;
    }

    .nav-item span,
    .nav-item small,
    .sidebar-footer {
        display: none;
    }

    .topbar {
        min-height: auto;
        padding: 18px 20px;
    }

    .account-name {
        display: none;
    }

    .content {
        padding: 20px;
    }

    .welcome-panel {
        display: block;
    }

    .status-badge {
        display: inline-block;
        margin-top: 20px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .topbar .eyebrow,
    .topbar h1,
    .avatar {
        display: none;
    }

    .topbar {
        justify-content: flex-end;
    }

    .nav-item {
        font-size: 12px;
    }
}

a {
    color: inherit;
}

.sidebar {
    overflow-y: auto;
}

.nav-list {
    margin-bottom: 24px;
}

.nav-item > span:first-child {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: rgba(255, 255, 255, .08);
    font-size: 10px;
    font-weight: 800;
}

.page-actions,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.page-actions {
    margin-bottom: 20px;
}

.page-intro {
    max-width: 720px;
    margin: 0;
    color: var(--muted);
}

.alert {
    margin-bottom: 20px;
    padding: 14px 18px;
    border: 1px solid;
    border-radius: 12px;
}

.alert ul {
    margin: 8px 0 0;
    padding-left: 22px;
}

.alert-success {
    border-color: #a6e1c5;
    color: #11653f;
    background: #ecfdf3;
}

.alert-error {
    border-color: #f4b4b0;
    color: #9d1c16;
    background: #fff1f0;
}

.alert-warning {
    border-color: #f1d18a;
    color: #7a4c00;
    background: #fff8e7;
}

.panel,
.form-card,
.table-card {
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(21, 36, 62, .05);
}

.panel {
    margin-bottom: 20px;
    padding: clamp(20px, 3vw, 30px);
}

.panel h2,
.form-section h2 {
    margin-bottom: 0;
    font-size: 20px;
}

.panel-heading {
    margin-bottom: 20px;
}

.panel-heading p,
.form-section p {
    margin-bottom: 0;
}

.table-card {
    max-width: 100%;
    overflow-x: auto;
}

.table-card-flat {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    padding: 15px 17px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    background: #fafbfc;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
    white-space: nowrap;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.table-link {
    color: var(--navy);
    font-weight: 750;
    text-decoration-color: #cbd2de;
    text-underline-offset: 3px;
}

.empty-cell,
.empty-note {
    color: var(--muted);
    text-align: center;
}

.empty-cell {
    padding: 36px 20px;
}

.actions-cell,
.detail-meta,
.choice-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.actions-cell form {
    display: inline-flex;
}

.actions-cell .mini-form,
td[data-label='Darbības'] .mini-form {
    flex: 1 1 160px;
    width: auto;
    min-width: 0;
    max-width: 100%;
}

.actions-cell .mini-form input,
.actions-cell .mini-form select,
.actions-cell .mini-form button,
td[data-label='Darbības'] .mini-form input,
td[data-label='Darbības'] .mini-form select,
td[data-label='Darbības'] .mini-form button {
    width: 100%;
    min-width: 0;
}

.badge,
.code-pill,
.source-label {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 750;
    white-space: nowrap;
}

.badge {
    padding: 5px 9px;
}

.badge-success {
    color: var(--success);
    background: #e9f8f0;
}

.badge-muted {
    color: #687386;
    background: #eef1f5;
}

.badge-accent {
    color: var(--accent-dark);
    background: #fff0f4;
}

.code-pill {
    padding: 4px 8px;
    color: #48566d;
    background: #eef1f5;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.source-label {
    margin-left: 4px;
    color: #875b00;
    background: #fff4d6;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    text-decoration: none;
}

.button-secondary {
    color: var(--navy);
    background: #e8edf5;
}

.button-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
}

.filter-bar {
    display: grid;
    grid-template-columns: minmax(180px, 2fr) repeat(2, minmax(140px, 1fr)) auto auto;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
}

.filter-bar-wide {
    grid-template-columns: minmax(190px, 2fr) repeat(4, minmax(125px, 1fr)) auto auto;
}

.filter-bar input,
.filter-bar select,
.field input,
.field select,
.field textarea,
.mini-form input,
.mini-form select,
.inline-end-form input {
    width: 100%;
    min-height: 42px;
    border: 1px solid #cbd2de;
    border-radius: 9px;
    padding: 9px 11px;
    color: var(--ink);
    background: #fff;
    outline: none;
}

.field textarea {
    min-height: 110px;
    resize: vertical;
}

.filter-bar input:focus,
.filter-bar select:focus,
.field input:focus,
.field select:focus,
.field textarea:focus,
.mini-form input:focus,
.mini-form select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(239, 71, 111, .11);
}

.choice-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

.choice-card input {
    flex: 0 0 auto;
    margin-top: 3px;
}

.choice-card span,
.choice-card small {
    display: block;
    min-width: 0;
}

.choice-card small {
    margin-top: 3px;
    color: var(--muted);
}

.form-card {
    width: min(850px, 100%);
    padding: clamp(22px, 4vw, 38px);
}

.form-card-wide {
    width: min(1040px, 100%);
}

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

.field {
    min-width: 0;
}

.field-span-2 {
    grid-column: 1 / -1;
}

.form-subgrid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-5);
}

[hidden] {
    display: none !important;
}

.field label {
    display: block;
    margin-bottom: 7px;
    font-size: 13px;
    font-weight: 750;
}

.field label small,
.form-section h2 small {
    color: var(--muted);
    font-weight: 500;
}

.field > small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 11px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 28px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
}

.form-note {
    margin: 20px 0 0;
    padding: 12px 14px;
    border-radius: 10px;
    color: #5e6878;
    background: #f4f6f9;
    font-size: 13px;
}

.form-section {
    grid-column: 1 / -1;
    display: flex;
    align-items: flex-start;
    gap: 13px;
    margin: 30px 0 18px;
    padding-top: 26px;
    border-top: 1px solid var(--line);
}

.form-card > .form-section:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.step-number {
    display: grid;
    place-items: center;
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: #fff;
    background: var(--navy);
    font-weight: 800;
}

.choice-row {
    margin-bottom: 18px;
}

.choice-row label {
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 13px;
}

.detail-grid,
.management-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.definition-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.definition-list-horizontal {
    grid-template-columns: repeat(3, 1fr);
}

.definition-list > div {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.definition-list > div:last-child {
    border-bottom: 0;
}

.definition-list dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

.definition-list dd {
    margin: 3px 0 0;
    font-weight: 700;
}

.history-list {
    margin-top: 24px;
}

.history-list h3 {
    margin: 24px 0 10px;
    font-size: 14px;
}

.history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.history-row strong,
.history-row small {
    display: block;
}

.history-row small,
.muted {
    color: var(--muted);
}

.inline-form {
    display: flex;
    align-items: end;
    gap: 10px;
    margin-top: 18px;
}

.inline-form-stacked {
    align-items: end;
}

.inline-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
}

.mini-form {
    display: grid;
    gap: 8px;
    min-width: min(330px, 80vw);
    padding: 10px 0;
}

.inline-end-form {
    display: flex;
    gap: 6px;
}

.inline-end-form input {
    min-height: 34px;
    max-width: 150px;
}

.action-menu,
.add-panel {
    position: relative;
}

.action-menu > .mini-form {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 20;
    width: min(330px, calc(100vw - (2 * var(--space-4))));
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-elevated);
    box-shadow: var(--shadow-elevated);
}

.action-menu summary,
.add-panel summary {
    cursor: pointer;
    color: var(--navy);
    font-size: 13px;
    font-weight: 750;
}

.add-panel {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px dashed #cbd2de;
    border-radius: 12px;
    background: #fafbfc;
}

.contact-card {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 15px;
}

.contact-card p,
.contact-card small {
    margin: 2px 0 0;
    color: var(--muted);
}

.avatar-large {
    width: 48px;
    height: 48px;
}

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 15px;
}

.pricing-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fafbfc;
}

.pricing-context {
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 800;
}

.pricing-card dl {
    margin: 0;
}

.pricing-card dl > div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
}

.pricing-card dt {
    color: var(--muted);
}

.pricing-card dd {
    margin: 0;
    font-weight: 750;
    text-align: right;
}

.pricing-card .override-row {
    color: #875b00;
}

.pricing-card .pricing-total {
    margin-top: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--line);
    color: var(--navy);
}

.warning-note {
    color: #875b00;
    font-size: 12px;
}

.future-panel {
    margin-top: 20px;
}

.compact-empty {
    padding: 30px 20px;
}

.stats-grid-wide {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.stat-card {
    color: inherit;
    text-decoration: none;
}

nav[role='navigation'] {
    margin-top: 18px;
}

@media (max-width: 1100px) {
    .filter-bar,
    .filter-bar-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    .sidebar {
        overflow: visible;
    }

    .nav-list {
        display: flex;
        margin: 14px -4px 0;
        padding: 0 4px 4px;
        overflow-x: auto;
    }

    .nav-item {
        flex: 0 0 auto;
        padding-inline: 12px;
    }

    .nav-item small {
        display: none;
    }

    .page-actions,
    .panel-heading {
        align-items: flex-start;
    }

    .form-grid,
    .form-subgrid,
    .detail-grid,
    .management-grid,
    .definition-list-horizontal,
    .inline-form-grid {
        grid-template-columns: 1fr;
    }

    .field-span-2 {
        grid-column: auto;
    }

    .filter-bar,
    .filter-bar-wide {
        grid-template-columns: 1fr;
    }

    .table-card {
        overflow: visible;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
        width: 100%;
    }

    thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    tbody tr {
        padding: 10px 15px;
        border-bottom: 1px solid var(--line);
    }

    tbody tr:last-child {
        border-bottom: 0;
    }

    td {
        display: grid;
        grid-template-columns: minmax(105px, 38%) 1fr;
        gap: 10px;
        padding: 8px 0;
        border-bottom: 0;
        word-break: break-word;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 750;
        text-transform: uppercase;
    }

    td.empty-cell {
        display: block;
        text-align: center;
    }

    .actions-cell {
        display: grid;
        grid-template-columns: minmax(105px, 38%) minmax(0, 1fr);
    }

    .contact-card {
        grid-template-columns: auto 1fr;
    }

    .contact-card .action-menu {
        grid-column: 1 / -1;
    }

    .inline-form {
        display: grid;
        grid-template-columns: 1fr;
        align-items: stretch;
    }

    .history-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .inline-end-form {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .page-actions,
    .panel-heading {
        flex-direction: column;
    }

    .page-actions .button,
    .form-actions .button {
        flex: 1;
    }

    .content {
        padding: 16px;
    }

    .panel,
    .form-card {
        padding: 18px;
    }
}

/* Phase 06B flexible import ---------------------------------------------- */

.mapping-form {
    display: grid;
    gap: var(--space-5);
}

.mapping-list {
    display: grid;
    gap: var(--space-3);
}

.mapping-row {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(230px, 1fr);
    gap: var(--space-4);
    align-items: end;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fbf8fa;
}

.mapping-source {
    min-width: 0;
}

.mapping-source small,
.mapping-source strong {
    display: block;
}

.mapping-source small {
    margin-bottom: var(--space-1);
    color: var(--text-secondary);
    font-size: 11px;
}

.mapping-source strong {
    overflow-wrap: anywhere;
}

.mapping-defaults {
    margin-top: 0;
}

.row-correction-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3);
}

@media (min-width: 821px) {
    .workflow-steps.import-workflow-five {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .mapping-row,
    .row-correction-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .mapping-row select,
    .mapping-row input {
        width: 100%;
        min-width: 0;
    }
}

/* Phase 10A finance reporting ---------------------------------------- */
.finance-filter {
    display: grid;
    grid-template-columns: repeat(6, minmax(130px, 1fr));
    gap: var(--space-3);
    align-items: end;
    margin-bottom: var(--space-3);
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.finance-filter-wide {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.finance-filter .field label {
    margin-bottom: 5px;
    font-size: 12px;
}

.finance-filter input,
.finance-filter select {
    min-height: 40px;
}

.finance-filter .filter-actions {
    display: flex;
    gap: var(--space-2);
}

.finance-period-note {
    margin-bottom: var(--space-5);
    padding: 10px 13px;
    border-left: 3px solid var(--accent);
    color: var(--muted);
    background: #fff8fa;
    font-size: 13px;
}

.finance-period-note strong {
    color: var(--text-primary);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    margin: var(--space-5) 0 var(--space-3);
}

.section-heading h2 {
    margin: 0;
    font-size: 19px;
}

.finance-kpis {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--space-3);
}

.finance-kpi {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-top: 3px solid var(--navy);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: 0 6px 20px rgba(21, 36, 62, .04);
}

.finance-kpi.is-positive { border-top-color: #16845a; }
.finance-kpi.is-warning { border-top-color: #b57800; }
.finance-kpi.is-danger { border-top-color: #b42318; }

.finance-kpi span,
.finance-kpi small,
.finance-kpi strong {
    display: block;
}

.finance-kpi span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .045em;
    text-transform: uppercase;
}

.finance-kpi small {
    margin-top: 3px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
}

.finance-kpi strong {
    margin-top: var(--space-3);
    color: var(--text-primary);
    font-size: clamp(22px, 2.3vw, 31px);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.report-actions,
.report-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin: var(--space-4) 0;
}

.report-tabs {
    border-bottom: 1px solid var(--border);
}

.report-tabs a {
    padding: 10px 12px;
    border-bottom: 2px solid transparent;
    color: var(--muted);
    font-weight: 700;
    text-decoration: none;
}

.report-tabs a.is-active {
    border-color: var(--accent);
    color: var(--text-primary);
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
}

.finance-trend {
    display: grid;
    gap: var(--space-3);
}

.trend-row {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: var(--space-3);
    align-items: center;
}

.trend-row > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.trend-bars {
    display: grid;
    gap: 4px;
}

.trend-bar {
    display: grid;
    grid-template-columns: minmax(2px, var(--bar-width)) 1fr;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.trend-bar i {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: var(--navy);
}

.trend-bar.is-received i { background: var(--accent); }

.trend-bar small {
    color: var(--muted);
    font-size: 11px;
    white-space: nowrap;
}

.finance-fallback-table {
    margin-top: var(--space-4);
}

.report-table-panel {
    padding: 0;
}

.report-table .table-secondary {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
}

.report-table td {
    vertical-align: top;
}

.finance-exceptions h2 {
    margin: 0 0 5px;
    font-size: 17px;
}

.finance-exceptions p {
    margin: 0 0 5px;
}

.discount-summary .payment-summary {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.discount-summary dt {
    color: var(--muted);
    font-size: 11px;
}

.discount-summary dd {
    margin: 4px 0 0;
    font-size: 18px;
    font-weight: 750;
    font-variant-numeric: tabular-nums;
}

.discount-summary .page-intro {
    margin-top: var(--space-3);
    font-size: 12px;
}

@media (max-width: 1180px) {
    .finance-filter,
    .finance-filter-wide {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }

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

@media (max-width: 820px) {
    .finance-filter,
    .finance-filter-wide {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .finance-filter .filter-actions,
    .finance-filter .field-grow {
        grid-column: 1 / -1;
    }

    .report-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 620px) {
    .finance-filter,
    .finance-filter-wide,
    .finance-kpis {
        grid-template-columns: 1fr;
    }

    .finance-filter .filter-actions,
    .finance-filter .field-grow {
        grid-column: auto;
    }

    .finance-filter .filter-actions .button,
    .report-actions .button {
        width: 100%;
        min-height: var(--control-height);
        text-align: center;
    }

    .trend-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .trend-bar {
        grid-template-columns: minmax(2px, var(--bar-width)) minmax(100px, 1fr);
    }

    .discount-summary .payment-summary {
        grid-template-columns: 1fr;
    }
}

/* Phase 05 product system ------------------------------------------------- */

html {
    min-width: 320px;
}

body {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

.skip-link {
    position: fixed;
    top: var(--space-3);
    left: var(--space-3);
    z-index: 100;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    background: var(--surface);
    box-shadow: var(--shadow-elevated);
    transform: translateY(-160%);
}

.skip-link:focus {
    transform: translateY(0);
}

:where(a, button, input, select, textarea, summary):focus-visible {
    outline: 3px solid var(--brand-primary);
    outline-offset: 3px;
}

.app-shell {
    grid-template-columns: 272px minmax(0, 1fr);
}

.sidebar {
    padding: var(--space-6) var(--space-4);
    background:
        radial-gradient(circle at 20% 0, rgba(255, 79, 163, .15), transparent 18rem),
        var(--nav-background);
}

.brand {
    padding: 0 var(--space-2);
}

.brand-mark {
    border-radius: 50%;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-accent));
    box-shadow: 0 0 0 1px rgba(255,255,255,.2), 0 9px 24px rgba(255,79,163,.25);
}

.nav-list {
    display: grid;
    gap: var(--space-5);
    margin-top: var(--space-8);
}

.nav-group {
    display: grid;
    gap: var(--space-1);
}

.nav-heading {
    margin: 0 0 var(--space-1);
    padding: 0 var(--space-3);
    color: rgba(255,255,255,.43);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.nav-item {
    min-height: 42px;
    border-radius: var(--radius-md);
    color: rgba(255,255,255,.72);
}

.nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,.06);
}

.nav-item.is-active {
    position: relative;
    background: rgba(255,255,255,.11);
    box-shadow: inset 3px 0 var(--brand-primary);
}

.nav-item.is-disabled {
    cursor: not-allowed;
    opacity: .46;
}

.topbar {
    min-height: 88px;
    padding-inline: clamp(var(--space-5), 4vw, 52px);
    box-shadow: var(--shadow-sm);
}

.topbar h1 {
    font-size: clamp(21px, 2vw, 27px);
    letter-spacing: -.025em;
}

.content {
    width: min(var(--content-max), 100%);
    padding: clamp(var(--space-5), 4vw, 52px);
}

.mobile-nav-toggle,
.nav-scrim {
    display: none;
}

.eyebrow {
    color: var(--brand-accent);
}

.welcome-panel {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,.08);
    border-radius: var(--radius-xl);
    background:
        radial-gradient(circle at 90% 20%, rgba(255,79,163,.26), transparent 22rem),
        linear-gradient(135deg, var(--nav-background), var(--nav-surface));
    box-shadow: var(--shadow-card);
}

.panel,
.form-card,
.table-card,
.filter-bar {
    border-color: var(--border);
    box-shadow: var(--shadow-card);
}

.panel,
.form-card,
.table-card {
    border-radius: var(--radius-lg);
}

.button {
    min-height: var(--control-height);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button-primary {
    color: var(--text-primary);
    background: var(--brand-primary);
    box-shadow: 0 8px 20px rgba(255,79,163,.22);
}

.button-primary:hover {
    background: #ff72b5;
}

.button-secondary {
    border-color: #d9cfd6;
    color: var(--text-primary);
    background: var(--surface);
}

.button-secondary:hover,
.button-quiet:hover {
    border-color: #c8bbc4;
    background: #f2edf0;
}

.button-danger {
    border-color: #f3b4ae;
    color: var(--danger);
    background: var(--danger-soft);
}

.button-danger:hover {
    border-color: var(--danger);
    background: #ffe3e0;
}

.button[disabled],
.button[aria-disabled='true'] {
    cursor: not-allowed;
    opacity: .55;
    transform: none;
}

.filter-bar {
    align-items: end;
    padding: var(--space-4);
}

.filter-field {
    min-width: 0;
}

.filter-field label {
    display: block;
    margin: 0 0 6px;
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 750;
}

.filter-bar input,
.filter-bar select,
.field input,
.field select,
.field textarea,
.mini-form input,
.mini-form select,
.inline-end-form input {
    min-height: var(--control-height);
    border-color: #cfc4cb;
    border-radius: var(--radius-sm);
}

.field input[aria-invalid='true'],
.field select[aria-invalid='true'],
.field textarea[aria-invalid='true'] {
    border-color: var(--danger);
    background: #fffafa;
}

.field-hint {
    margin: 6px 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

th,
td {
    padding: var(--table-cell-y) var(--table-cell-x);
}

th {
    background: #fbf8fa;
}

tbody tr {
    transition: background-color .12s ease;
}

tbody tr:hover {
    background: #fffafd;
}

.money {
    font-variant-numeric: tabular-nums;
    text-align: right;
    white-space: nowrap;
}

.badge {
    gap: 6px;
}

.badge-dot {
    width: 6px;
    height: 6px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: currentColor;
}

.badge-warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.badge-danger {
    color: var(--danger);
    background: var(--danger-soft);
}

.badge-info {
    color: var(--info);
    background: var(--info-soft);
}

.alert {
    border-radius: var(--radius-md);
}

.alert-info {
    border-color: #b7d1ff;
    color: #174b9f;
    background: var(--info-soft);
}

.empty-state {
    border-color: #d8cbd4;
    background: rgba(255,255,255,.7);
}

.empty-copy > :last-child {
    margin-bottom: 0;
}

.workflow-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
    margin: 0 0 var(--space-6);
    padding: 0;
    list-style: none;
}

.workflow-steps li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: rgba(255,255,255,.7);
    font-size: 12px;
    font-weight: 750;
}

.workflow-steps li > span {
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--text-secondary);
    background: #eee8ec;
}

.workflow-steps .is-current {
    border-color: var(--brand-primary);
    color: var(--text-primary);
    background: var(--accent-soft);
}

.workflow-steps .is-current > span,
.workflow-steps .is-complete > span {
    color: var(--text-primary);
    background: var(--brand-primary);
}

.attention-grid,
.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
}

.attention-card {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: var(--space-3);
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: inherit;
    background: var(--surface);
    box-shadow: var(--shadow-card);
    text-decoration: none;
}

.attention-card:hover {
    border-color: #d4a4be;
}

.attention-card strong {
    font-size: 25px;
    font-variant-numeric: tabular-nums;
}

.attention-card h3 {
    margin: 0 0 var(--space-1);
    font-size: 15px;
}

.attention-card p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.attention-card.is-clear strong {
    color: var(--success);
}

.attention-card.is-warning strong {
    color: var(--warning);
}

.quick-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.quick-action {
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    background: #fbf8fa;
    font-weight: 750;
    text-decoration: none;
}

.quick-action small {
    display: block;
    margin-top: var(--space-1);
    color: var(--text-secondary);
    font-weight: 500;
}

.future-action {
    position: relative;
}

.future-action .button {
    cursor: not-allowed;
}

.pricing-current {
    padding: var(--space-5);
    border: 1px solid #f4b6d4;
    border-radius: var(--radius-md);
    background: var(--accent-soft);
}

.pricing-current strong {
    font-size: 24px;
}

.sensitive-data {
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fbf8fa;
}

@media (max-width: 1024px) {
    .app-shell {
        grid-template-columns: 232px minmax(0, 1fr);
    }

    .attention-grid,
    .quick-actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 820px) {
    body.nav-open {
        overflow: hidden;
    }

    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 60;
        width: min(304px, calc(100vw - 48px));
        height: 100dvh;
        padding: var(--space-5) var(--space-4);
        overflow-y: auto;
        box-shadow: var(--shadow-elevated);
        transform: translateX(-105%);
        transition: transform .2s ease;
    }

    body.nav-open .sidebar {
        transform: translateX(0);
    }

    .nav-list {
        display: grid;
        margin: var(--space-8) 0 var(--space-6);
        padding: 0;
        overflow: visible;
    }

    .nav-item {
        display: grid;
        justify-content: initial;
        font-size: 14px;
    }

    .nav-item span,
    .nav-item small,
    .sidebar-footer {
        display: grid;
    }

    .nav-item small {
        display: inline;
    }

    .sidebar-footer {
        display: block;
    }

    .mobile-nav-toggle {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2);
        min-height: var(--control-height);
        padding: var(--space-2) var(--space-3);
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        color: var(--text-primary);
        background: var(--surface);
        font: inherit;
        font-size: 13px;
        font-weight: 750;
    }

    .nav-scrim {
        position: fixed;
        inset: 0;
        z-index: 50;
        display: block;
        width: 100%;
        height: 100%;
        border: 0;
        background: rgba(7,5,9,.54);
    }

    .nav-scrim[hidden] {
        display: none;
    }

    .topbar {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        min-height: 78px;
        padding: var(--space-3) var(--space-4);
    }

    .content {
        padding: var(--space-4);
    }

    .attention-grid,
    .quick-actions {
        grid-template-columns: 1fr;
    }

    .workflow-steps {
        grid-template-columns: 1fr;
    }

    .workflow-steps li {
        min-height: 46px;
    }

    .action-menu > .mini-form {
        position: static;
        width: auto;
        margin-top: var(--space-2);
        box-shadow: var(--shadow-card);
    }

    td.money {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .topbar .eyebrow {
        display: block;
    }

    .topbar h1 {
        display: block;
        font-size: 18px;
    }

    .topbar .avatar {
        display: none;
    }

    .account {
        gap: var(--space-1);
    }

    .welcome-panel {
        padding: var(--space-5);
    }

    td {
        grid-template-columns: minmax(92px, 35%) minmax(0, 1fr);
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: .01ms !important;
    }
}

/* Phase 06 dancer import -------------------------------------------------- */

.content-grid {
    display: grid;
    gap: var(--space-5);
}

.content-grid-sidebar {
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    align-items: start;
}

.guidance-card,
.bulk-resolution,
.financial-confirmation {
    padding: var(--space-5);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.guidance-card h2,
.financial-confirmation h2 {
    margin-top: 0;
}

.check-list {
    display: grid;
    gap: var(--space-3);
    margin: var(--space-4) 0;
    padding-left: 20px;
}

.privacy-note {
    margin: var(--space-4) 0 0;
    padding: var(--space-3);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    background: var(--info-soft);
    font-size: 13px;
}

.import-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-5);
}

.metric-card {
    min-width: 0;
    padding: var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.metric-card span,
.metric-card strong {
    display: block;
}

.metric-card span {
    color: var(--text-secondary);
    font-size: 12px;
}

.metric-card strong {
    margin-top: 4px;
    font-size: 26px;
    font-variant-numeric: tabular-nums;
}

.bulk-resolution {
    margin-bottom: var(--space-6);
}

.bulk-resolution summary,
.row-resolution summary {
    cursor: pointer;
    font-weight: 750;
}

.bulk-resolution[open] summary,
.row-resolution[open] summary {
    margin-bottom: var(--space-4);
}

.import-table table {
    min-width: 1060px;
}

.import-table td {
    vertical-align: top;
}

.import-table td strong,
.import-table td small {
    display: block;
}

.sensitive-value {
    margin-top: 4px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.issue-list {
    margin: var(--space-2) 0 0;
    padding-left: 18px;
    color: var(--text-secondary);
    font-size: 12px;
}

.row-resolution {
    margin-top: var(--space-3);
    min-width: min(340px, 100%);
    padding: var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--app-background);
}

.row-resolution form {
    display: grid;
    gap: var(--space-3);
}

.row-resolution .field label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
}

.financial-confirmation {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-6);
    margin-top: var(--space-6);
    border-color: #f3b4ae;
}

.financial-confirmation > div {
    max-width: 720px;
}

.financial-confirmation form {
    display: grid;
    flex: 0 1 430px;
    gap: var(--space-3);
}

.confirmation-check {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-2);
    align-items: start;
    font-size: 13px;
}

.confirmation-check input {
    width: 18px;
    height: 18px;
    margin-top: 1px;
}

@media (min-width: 821px) {
    .workflow-steps {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1100px) {
    .import-table {
        overflow: visible;
    }

    .import-table table,
    .import-table thead,
    .import-table tbody,
    .import-table tr,
    .import-table th,
    .import-table td {
        display: block;
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .import-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
    }

    .import-table tbody tr {
        padding: 10px 15px;
        border-bottom: 1px solid var(--border);
    }

    .import-table td {
        display: grid;
        grid-template-columns: minmax(110px, 28%) minmax(0, 1fr);
        gap: 10px;
        padding: 8px 0;
        border-bottom: 0;
        overflow-wrap: anywhere;
    }

    .import-table td::before {
        content: attr(data-label);
        color: var(--text-secondary);
        font-size: 11px;
        font-weight: 750;
        text-transform: uppercase;
    }

    .import-table td > *,
    .row-resolution,
    .row-resolution form,
    .row-resolution .field,
    .row-resolution input,
    .row-resolution select,
    .row-resolution button {
        min-width: 0;
        max-width: 100%;
    }

    .row-resolution input,
    .row-resolution select,
    .row-resolution button {
        width: 100%;
    }
}

@media (max-width: 1024px) {
    .content-grid-sidebar {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    html,
    body,
    .app-shell,
    .main-area {
        max-width: 100%;
        overflow-x: clip;
    }

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

    .import-table table {
        min-width: 0;
    }

    .import-table,
    .import-table table,
    .import-table tbody,
    .import-table tr,
    .import-table td {
        min-width: 0;
        max-width: 100%;
    }

    .import-table td {
        grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    }

    .import-table td > *,
    .row-resolution form,
    .row-resolution .field,
    .row-resolution input,
    .row-resolution select,
    .row-resolution button {
        min-width: 0;
        max-width: 100%;
    }

    .row-resolution input,
    .row-resolution select,
    .row-resolution button {
        width: 100%;
    }

    .issue-list {
        overflow-wrap: anywhere;
    }

    .financial-confirmation {
        align-items: stretch;
        flex-direction: column;
    }

    .financial-confirmation form {
        flex-basis: auto;
    }
}

@media (max-width: 480px) {
    .login-page {
        width: 100%;
        max-width: 100vw;
        padding: 16px;
        overflow-x: hidden;
    }

    .login-card {
        width: 100%;
        max-width: calc(100vw - 32px);
        min-width: 0;
        padding: 0;
        border-radius: 18px;
    }

    .auth-brand-panel {
        min-height: 108px;
        padding: 16px 24px;
    }

    .brand-identity-auth .brand-logo {
        width: min(190px, 100%);
        max-height: 95px;
    }

    .auth-card-body {
        padding: 24px 20px 28px;
    }

    .login-card form,
    .login-card input,
    .login-card button {
        min-width: 0;
        max-width: 100%;
    }

    .login-heading p,
    .login-note {
        overflow-wrap: anywhere;
    }

    .recovery-code-list {
        grid-template-columns: minmax(0, 1fr);
    }

    .workflow-steps {
        grid-template-columns: 1fr;
    }

    .metric-card strong {
        font-size: 22px;
    }

    .row-resolution {
        min-width: 0;
    }

    .page-actions > *,
    .page-actions .page-intro,
    .page-actions .source-label,
    .section-heading .source-label {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: anywhere;
    }
}

/* Keep Phase 08E layout overrides after legacy responsive rules. */
@media (min-width: 821px) {
    .workflow-steps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

.attention-grid-operational { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.filter-bar.filter-bar-invoices { grid-template-columns: repeat(4, minmax(135px, 1fr)); }
.filter-bar-invoices .field-grow { grid-column: span 2; }

@media (max-width: 1100px) {
    .attention-grid-operational,
    .status-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-bar.filter-bar-invoices { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}

@media (max-width: 820px) {
    .settings-status-grid,
    .filter-bar.filter-bar-invoices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .filter-bar-invoices .field-grow { grid-column: 1 / -1; }
}

@media (max-width: 620px) {
    .attention-grid-operational,
    .status-overview,
    .settings-status-grid,
    .filter-bar.filter-bar-invoices { grid-template-columns: 1fr; }
    .filter-bar-invoices .field-grow { grid-column: auto; }
    .status-overview article,
    .readiness-card { min-height: 0; }
    .page-actions,
    .panel-heading,
    .form-actions {
        align-items: stretch;
        flex-direction: column;
    }
    .form-actions .button,
    .page-actions .button { width: 100%; }
}

/* Phase 08E.3 invoice administration density -------------------------- */
.semantic-value,
.invoice-number {
    display: inline-block;
    max-width: 100%;
    font-variant-numeric: tabular-nums;
    overflow-wrap: normal;
    word-break: normal;
    white-space: nowrap;
}

.invoice-number {
    letter-spacing: .01em;
}

.welcome-panel-compact {
    align-items: flex-start;
    padding: var(--space-6) var(--space-8);
}

.welcome-panel-compact h2 {
    font-size: clamp(25px, 3vw, 32px);
}

.welcome-panel-compact .season-status {
    align-self: flex-start;
    padding: 5px 9px;
    border: 1px solid rgba(255, 255, 255, .18);
    color: #d9f8e8;
    background: rgba(22, 120, 75, .26);
}

.welcome-panel-compact + .future-panel {
    margin-top: var(--space-4);
}

.dashboard-metrics {
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.dashboard-metrics .stat-card {
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
}

.dashboard-metrics .stat-card strong {
    color: var(--text-primary);
    font-size: 24px;
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.preview-page-actions {
    margin-bottom: var(--space-3);
}

.preview-page-actions .button {
    flex: 0 0 auto;
}

.alert-compact {
    margin-bottom: var(--space-3);
    padding: 9px 12px;
    font-size: 13px;
}

.table-card-dense th,
.table-card-dense td {
    padding: 10px 12px;
}

.billing-preview-table td:nth-child(1),
.billing-preview-table td:nth-child(4),
.billing-preview-table td:nth-child(5),
.billing-preview-table td:nth-child(6) {
    white-space: nowrap;
}

.billing-preview-table td:nth-child(3),
.billing-preview-table td:nth-child(7) {
    min-width: 150px;
}

.filter-bar.filter-bar-invoices {
    grid-template-columns: repeat(5, minmax(120px, 1fr));
    gap: var(--space-2);
    margin-bottom: var(--space-3);
    padding: var(--space-3);
}

.filter-bar-invoices .field label {
    margin-bottom: 4px;
    font-size: 11px;
}

.filter-bar-invoices input,
.filter-bar-invoices select {
    min-height: 38px;
    padding: 7px 9px;
    font-size: 13px;
}

.filter-bar-invoices .field-grow {
    grid-column: span 2;
}

.filter-actions {
    display: flex;
    align-items: end;
    gap: var(--space-2);
}

.filter-actions .button {
    flex: 1 1 auto;
    min-height: 38px;
    padding: 7px 10px;
}

.issued-invoice-table td {
    vertical-align: top;
}

.issued-invoice-table td:first-child {
    min-width: 150px;
}

.issued-invoice-table td:nth-child(2) {
    min-width: 210px;
}

.issued-invoice-table td:nth-child(3) {
    min-width: 145px;
}

.issued-invoice-table .status-stack {
    gap: 4px;
    max-width: 285px;
}

.issued-invoice-table .badge {
    padding: 3px 7px;
    font-size: 10px;
}

.workflow-steps {
    margin-bottom: var(--space-4);
}

@media (min-width: 821px) {
    .workflow-steps li {
        padding: var(--space-2);
    }
}

.invoice-summary {
    margin-bottom: var(--space-4);
    overflow: hidden;
    border: 1px solid #ddcfd8;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.invoice-summary-main,
.invoice-summary-footer,
.invoice-summary-identity,
.invoice-summary-states,
.compact-section-heading {
    display: flex;
    align-items: center;
}

.invoice-summary-main {
    justify-content: space-between;
    gap: var(--space-6);
    padding: var(--space-5) var(--space-6) var(--space-4);
}

.invoice-summary-main .eyebrow {
    margin-bottom: var(--space-1);
}

.invoice-summary-identity {
    flex-wrap: wrap;
    gap: var(--space-3);
}

.invoice-summary-identity > .invoice-number {
    color: var(--text-primary);
    font-size: clamp(22px, 3vw, 30px);
    line-height: 1.15;
}

.invoice-summary-total {
    flex: 0 0 auto;
    text-align: right;
}

.invoice-summary-total .money {
    display: block;
    color: var(--text-primary);
    font-size: clamp(24px, 3vw, 32px);
    line-height: 1.15;
}

.invoice-summary-total span {
    color: var(--text-secondary);
    font-size: 13px;
}

.invoice-summary-states {
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: 0 var(--space-6) var(--space-4);
}

.invoice-summary-footer {
    justify-content: space-between;
    gap: var(--space-4);
    padding: 10px var(--space-6);
    border-top: 1px solid var(--border);
    background: #fbf8fa;
}

.invoice-summary-footer p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.invoice-summary-footer .button {
    flex: 0 0 auto;
}

.invoice-operation-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.invoice-operation-panel,
.invoice-payment-panel,
.invoice-information-card,
.invoice-line-items-panel,
.invoice-history-panel {
    padding: var(--space-5);
}

.invoice-operation-panel {
    min-width: 0;
    margin: 0;
}

.compact-section-heading {
    justify-content: space-between;
    gap: var(--space-3);
    margin-bottom: var(--space-3);
}

.compact-section-heading h2 {
    margin: 0;
}

.invoice-operation-panel > p,
.invoice-operation-panel .checkbox-row {
    font-size: 13px;
}

.invoice-operation-panel > p {
    margin: 0 0 var(--space-3);
}

.invoice-operation-panel .form-actions {
    margin-top: var(--space-3);
}

.invoice-payment-panel .panel-heading,
.invoice-information-card .panel-heading,
.invoice-line-items-panel .panel-heading,
.invoice-history-panel .panel-heading {
    margin-bottom: var(--space-3);
}

.payment-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fbf8fa;
}

.payment-summary > div {
    min-width: 0;
    padding: var(--space-3) var(--space-4);
    border-right: 1px solid var(--border);
}

.payment-summary > div:last-child {
    border-right: 0;
}

.payment-summary small,
.payment-summary strong {
    display: block;
}

.payment-summary small,
.invoice-information-card dt {
    color: var(--text-secondary);
    font-size: 10px;
    font-weight: 750;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.payment-summary strong {
    margin-top: 2px;
    font-size: 17px;
}

.payment-summary .money {
    text-align: left;
}

.section-note {
    margin: var(--space-2) 0 0;
    color: var(--text-secondary);
    font-size: 12px;
}

.invoice-information-grid {
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.invoice-information-card {
    margin: 0;
}

.invoice-information-card .detail-list {
    display: grid;
    gap: 0;
    margin: 0;
}

.invoice-information-card .detail-list > div {
    display: grid;
    grid-template-columns: minmax(125px, .72fr) minmax(0, 1.28fr);
    gap: var(--space-3);
    padding: 7px 0;
    border-bottom: 1px solid var(--border);
}

.invoice-information-card .detail-list > div:last-child {
    border-bottom: 0;
}

.invoice-information-card dt {
    align-self: start;
}

.invoice-information-card dd {
    min-width: 0;
    margin: 0;
    font-weight: 650;
    overflow-wrap: anywhere;
    text-align: left;
}

.invoice-line-items td:nth-child(1),
.invoice-line-items td:nth-child(6) {
    min-width: 190px;
}

.invoice-line-items td.money {
    min-width: 100px;
}

@media (max-width: 1100px) {
    .filter-bar.filter-bar-invoices {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }

    .invoice-operation-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .filter-bar.filter-bar-invoices {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-bar-invoices .field-grow {
        grid-column: 1 / -1;
    }

    .filter-actions {
        grid-column: 1 / -1;
    }

    .billing-preview-table td,
    .issued-invoice-table td {
        min-width: 0;
        white-space: normal;
    }

    .issued-invoice-table .status-stack {
        max-width: 100%;
    }

    .invoice-summary-main,
    .invoice-summary-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .invoice-summary-total {
        text-align: left;
    }
}

@media (max-width: 620px) {
    .welcome-panel-compact {
        padding: var(--space-5);
    }

    .welcome-panel-compact .season-status {
        margin-top: var(--space-3);
    }

    .preview-page-actions .button,
    .filter-actions .button {
        min-height: var(--control-height);
    }

    .filter-bar.filter-bar-invoices {
        grid-template-columns: 1fr;
    }

    .filter-bar-invoices .field-grow,
    .filter-actions {
        grid-column: auto;
    }

    .invoice-summary-main,
    .invoice-summary-states,
    .invoice-summary-footer {
        padding-right: var(--space-4);
        padding-left: var(--space-4);
    }

    .invoice-summary-main {
        gap: var(--space-3);
    }

    .invoice-summary-footer .button {
        width: 100%;
    }

    .compact-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .payment-summary > div {
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .payment-summary > div:last-child {
        border-bottom: 0;
    }

    .invoice-information-card .detail-list > div {
        grid-template-columns: 1fr;
        gap: 2px;
    }
}
.payment-card {
    width: min(100%, 460px);
}

.payment-public-summary {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.payment-public-summary div {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--app-background);
}

.payment-public-summary dt {
    color: var(--text-muted);
    font-size: .78rem;
}

.payment-public-summary dd {
    margin: 4px 0 0;
    font-weight: 700;
}

.payment-consent {
    display: grid;
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin: 20px 0;
    color: var(--ink);
    font-size: .88rem;
    line-height: 1.5;
}

.login-card .payment-consent input[type='checkbox'] {
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    padding: 0;
    accent-color: var(--accent);
}

.login-card .payment-consent label {
    display: inline;
    margin: 0;
    font-size: inherit;
    font-weight: 500;
}

.payment-consent a {
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.payment-consent a:focus-visible,
.login-card .payment-consent input[type='checkbox']:focus-visible {
    outline: 3px solid rgba(239, 71, 111, .28);
    outline-offset: 2px;
}

.payment-consent-error {
    margin: -12px 0 18px;
}

@media (max-width: 420px) {
    .payment-public-summary {
        grid-template-columns: 1fr;
    }
}
