/* Taxonomic Design System v5.0 - Jade Forged
   Source: archive/site-iterations/taxonomic/design-system-v5.html */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..800;1,9..40,400..800&family=IBM+Plex+Mono:wght@400;500&family=Inter:wght@400..800&display=swap');

/* Font family variables for consistent usage */
:root {
    /* Taxonomic Design System v5.0 - Jade Forged */

    --font-heading: 'DM Sans', sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;

    /* Primary (teal) */
    --primary: #0D9488;
    --primary-hover: #0F766E;
    --primary-surface: #F0FDFA;
    --primary-text: #115E59;

    /* Accent (bright teal for highlights) */
    --accent: #06D6A0;
    --accent-glow: rgba(6,214,160,0.15);
    --shadow-glow: 0 0 40px var(--accent-glow);

    /* Success (green - for positive status indicators) */
    --success: #16A34A;
    --success-surface: #F0FDF4;
    --success-text: #166534;

    /* Neutrals */
    --dark: #1E293B;
    --body: #334155;
    --muted: #566A7F;
    --placeholder: #94A3B8;
    --border: #CBD5E1;
    --border-subtle: #E2E8F0;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --table-header: #F8FAFC;
    --alt-row: #F1F5F9;

    /* Semantic */
    --warn-surface: #FEF3C7;
    --warn-text: #92400E;
    --error-surface: #FEF2F2;
    --error-text: #991B1B;
    --info-surface: #EFF6FF;
    --info-text: #1E40AF;

    /* Bare semantic (borders, icons, inline badges) */
    --error: #EF4444;
    --warning: #F59E0B;

    /* Elevation */
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);

    /* Category colours (non-semantic, for tagging) */
    --cat-cyan: #0891B2;
    --cat-cyan-surface: #ECFEFF;
    --cat-violet: #7C3AED;
    --cat-violet-surface: #F5F3FF;
    --cat-violet-border: #DDD6FE;
    --cat-amber: #D97706;
    --cat-amber-surface: #FFFBEB;

    /* Radii */
    --radius-sm: 8px;
    --radius-btn: 10px;
    --radius-card: 12px;
    --radius-badge: 100px;

    /* Focus */
    --focus-ring: 0 0 0 3px rgba(13, 148, 136, 0.25);

    /* Brand mark - wordmark with Tax highlight */
    --brand-tax-color: var(--primary);
}

/* Dark theme overrides */
[data-theme="dark"] {
    --dark: #F1F5F9;
    --body: #CBD5E1;
    --muted: #94A3B8;
    --placeholder: #64748B;
    --border: #334155;
    --border-subtle: #1E293B;
    --bg: #0F172A;
    --surface: #1E293B;
    --table-header: #1E293B;
    --alt-row: #263548;

    --primary-surface: rgba(13,148,136,0.15);
    --primary-text: #5EEAD4;

    --success: #4ADE80;
    --success-surface: rgba(22,163,74,0.15);
    --success-text: #86EFAC;

    --warn-surface: rgba(245,158,11,0.15);
    --warn-text: #FCD34D;
    --error-surface: rgba(239,68,68,0.15);
    --error-text: #FCA5A5;
    --error: #FCA5A5;
    --warning: #FCD34D;
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.3), 0 2px 4px -2px rgba(0,0,0,0.2);
    --info-surface: rgba(29,78,216,0.1);
    --info-text: #93B4FD;

    --cat-cyan: #22D3EE;
    --cat-cyan-surface: rgba(8,145,178,0.15);
    --cat-violet: #A78BFA;
    --cat-violet-surface: rgba(124,58,237,0.15);
    --cat-amber: #FBBF24;
    --cat-amber-surface: rgba(217,119,6,0.15);

    --brand-tax-color: #06D6A0;

    color-scheme: dark;
}

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

/* Focus visible */
:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}
button:focus-visible, .btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    box-shadow: none;
}

/* Theme toggle button */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px;
    cursor: pointer;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
}

.theme-toggle:hover {
    color: var(--body);
    border-color: var(--body);
}

.theme-toggle svg {
    width: 16px;
    height: 16px;
}

/* Show/hide sun/moon icons based on theme */
.icon-sun, .icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: block; }
:root:not([data-theme="dark"]) .icon-moon { display: block; }
html:not([data-theme]) .icon-moon { display: block; }

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 15px;
    line-height: 1.6;
    color: var(--dark);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
}

/* Mono font for amounts, codes, technical data */
.mono, code, .source-code, .amount,
.field-value.currency,
.summary-item-amount,
.review-card-amount,
.stat-value {
    font-family: var(--font-mono);
}

/* Header */
.header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0;
}

.header-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.4rem;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 8px;
}

.header-brand {
    color: var(--dark);
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: -0.5px;
    display: inline-flex;
    align-items: baseline;
    gap: 0;
}

/* Brand mark - wordmark with Tax highlight */
.brand-tax {
    color: var(--brand-tax-color);
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header-nav a {
    color: var(--body);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0;
    padding: 8px 16px;
    border-radius: 8px;
    transition: color 0.18s ease, background 0.18s ease;
}

.header-nav a:hover {
    color: var(--primary);
    background: var(--primary-surface);
}

.header-tag {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 12px;
}

/* Breadcrumbs */
.breadcrumbs {
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 16px 24px 0;
    font-size: 0.8125rem;
    color: var(--muted);
    box-sizing: border-box;
}

.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
}

.breadcrumbs a:hover {
    text-decoration: none;
}

.breadcrumbs .sep {
    margin: 0 6px;
}

/* Main content */
.container {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
}

.page-title {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1.3;
    margin-bottom: 8px;
    color: var(--dark);
}

.page-subtitle {
    font-size: 1rem;
    color: var(--muted);
    margin-bottom: 32px;
}

/* Cards */
.card {
    background: var(--surface);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
}

/* Client list (dashboard) */
.client-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--surface);
    margin-bottom: 2px;
    text-decoration: none;
    color: inherit;
    transition: border-left 0.15s;
    border-left: 4px solid transparent;
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
}

.client-row:hover {
    border-left-color: var(--primary);
}

.client-info {
    flex: 1;
}

.client-name {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--dark);
}

.client-meta {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 2px;
}

.client-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.progress-bar {
    width: 120px;
    height: 6px;
    background: var(--border);
    border: none;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.progress-fill.complete {
    background: var(--primary-text);
}

.progress-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
    min-width: 40px;
    text-align: right;
}

/* Document checklist */
.checklist {
    list-style: none;
}

.checklist-item {
    display: flex;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.checklist-item:last-child {
    border-bottom: none;
}

.checklist-status {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.status-outstanding {
    color: var(--border);
}

.status-received {
    color: var(--primary-text);
}

.checklist-content {
    flex: 1;
}

.checklist-label {
    font-weight: 600;
    font-size: 0.9375rem;
}

.checklist-source {
    font-size: 0.8125rem;
    color: var(--muted);
}

.checklist-action {
    margin-left: 16px;
}

.checklist-action a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.checklist-action a:hover {
    text-decoration: underline;
}

/* Upload form */
.upload-section {
    margin-top: 32px;
}

.upload-area {
    border: 2px dashed var(--border);
    padding: 40px;
    text-align: center;
    transition: border-color 0.2s;
    position: relative;
    border-radius: 12px;
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(13, 148, 136, 0.04);
}

.upload-area p {
    color: var(--muted);
    margin-bottom: 16px;
}

.upload-area input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-btn);
    border: none;
    background: var(--primary);
    color: var(--surface);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.18s ease, border-color 0.18s ease;
    white-space: nowrap;
}

.btn:hover {
    background: var(--primary-hover);
    color: var(--surface);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-outline {
    background: var(--surface);
    color: var(--dark);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--border);
    background: var(--bg);
    color: var(--dark);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.75rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 100px;
}

.badge-outstanding {
    background: var(--border-subtle);
    color: #3E5068;
    border: none;
}
[data-theme="dark"] .badge-outstanding { color: var(--muted); }

.badge-received {
    background: var(--success-surface);
    color: var(--success-text);
    border: none;
}

.badge-type {
    background: var(--primary-surface);
    color: var(--primary-text);
    border: none;
}

/* Document detail - split view */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

@media (max-width: 900px) {
    .split-view {
        grid-template-columns: 1fr;
    }
}

.pdf-embed {
    width: 100%;
    height: 700px;
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* Extracted fields table */
.fields-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.fields-table th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    background: var(--table-header);
}

.fields-table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.fields-table tr:last-child td {
    border-bottom: none;
}

.field-value {
    font-weight: 600;
}

.field-value.currency::before {
    content: "R";
}

.section-heading {
    font-size: 0.9375rem;
    font-weight: 800;
    color: var(--primary);
    margin-top: 24px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--primary);
}

.section-heading:first-child {
    margin-top: 0;
}

/* Workbook */
.workbook-category {
    margin-bottom: 32px;
}

.workbook-category-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--dark);
    padding: 12px 16px;
    background: var(--table-header);
    border-left: 4px solid var(--primary);
    margin-bottom: 0;
}

.workbook-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.workbook-table th {
    text-align: left;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--table-header);
}

.workbook-table th:last-child {
    text-align: right;
}

.workbook-table td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.workbook-table td:last-child {
    text-align: right;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.workbook-table .source-code {
    color: var(--muted);
    font-size: 0.8125rem;
    font-family: var(--font-mono);
}

.workbook-total {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--table-header);
    font-weight: 800;
    font-size: 0.9375rem;
    border-top: 2px solid var(--border);
}

.workbook-empty {
    padding: 48px;
    text-align: center;
    color: var(--muted);
}

/* Upload feedback */
.upload-result {
    margin-top: 24px;
    padding: 20px 24px;
    display: none;
    border-radius: 10px;
}

.upload-result.success {
    background: var(--success-surface);
    border-left: 4px solid var(--success-text);
    display: block;
}

.upload-result.error {
    background: var(--error-surface);
    border-left: 4px solid var(--error-text);
    display: block;
}

.upload-result h4 {
    font-weight: 800;
    font-size: 0.9375rem;
    margin-bottom: 4px;
}

.upload-result p {
    font-size: 0.875rem;
    color: var(--muted);
}

/* Loading spinner */
.loading {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 16px 0;
    color: var(--muted);
    font-size: 0.875rem;
}

.loading.active {
    display: flex;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Flash messages */
.flash {
    padding: 16px 24px;
    margin-bottom: 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 10px;
}

.flash-success {
    background: var(--success-surface);
    color: var(--success-text);
    border-left: 4px solid var(--success-text);
}

.flash-error {
    background: var(--error-surface);
    color: var(--error-text);
    border-left: 4px solid var(--error-text);
}

/* Footer */
.footer {
    background: var(--surface);
    color: var(--muted);
    padding: 20px 0;
    margin-top: 48px;
    font-size: 0.75rem;
    text-align: center;
    border-top: 1px solid var(--border);
}

/* Summary stat boxes */
.stats-row {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.stat-box {
    flex: 1;
    background: var(--surface);
    padding: 20px 24px;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-top: 4px;
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 6px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 10px 36px 10px 14px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    color: var(--dark);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    outline: none;
    transition: border-color 0.2s;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.form-input::placeholder {
    color: var(--placeholder);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.form-grid .form-group.full-width {
    grid-column: 1 / -1;
}

/* Type selector cards */
.type-cards {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

@media (max-width: 700px) {
    .type-cards {
        grid-template-columns: 1fr;
    }
}

.type-card {
    padding: 20px;
    border: 2px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    text-align: left;
    background: var(--surface);
}

.type-card:hover:not(.disabled) {
    border-color: var(--primary);
}

.type-card.selected {
    border-color: var(--primary);
    background: var(--primary-surface);
}

.type-card.disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.type-card-title {
    font-size: 0.9375rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.type-card-desc {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.5;
}

.type-card-note {
    font-size: 0.6875rem;
    color: var(--muted);
    font-style: italic;
    margin-top: 4px;
}

.type-card-badge {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 2px 8px;
    margin-top: 8px;
    border-radius: 100px;
}

/* Income source checkboxes */
.income-sources {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

@media (max-width: 600px) {
    .income-sources {
        grid-template-columns: 1fr;
    }
}

.income-source-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.15s;
}

.income-source-item:hover {
    border-color: var(--primary);
}

.income-source-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.income-source-label {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.3;
}

.income-source-desc {
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Expected document rows (dynamic) */
.doc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.doc-row:last-child {
    border-bottom: none;
}

.doc-row-type {
    font-size: 0.875rem;
    font-weight: 600;
    min-width: 160px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.doc-row .form-input {
    flex: 1;
}

.doc-row .form-select {
    min-width: 160px;
    flex-shrink: 0;
}

.doc-remove-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--muted);
    width: 28px;
    height: 28px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: var(--font-body);
    transition: color 0.15s, border-color 0.15s;
}

.doc-remove-btn:hover {
    color: var(--error-text);
    border-color: var(--error-text);
}

/* Tracking-only badge */
.badge-tracking {
    display: inline-block;
    font-size: 0.5625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 1px 6px;
    border-radius: 100px;
}

/* Add document row */
.add-doc-row {
    padding: 10px 0;
}

.add-doc-btn {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 8px;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 10px 20px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    transition: border-color 0.15s, color 0.15s;
}

.add-doc-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Section reveal animation */
.form-section {
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
}

.form-section.hidden {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
    margin: 0;
    padding: 0;
}

.form-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 12px;
}

.form-select option:disabled {
    color: var(--placeholder);
}

.form-note {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 4px;
}

/* Utility */
.text-muted { color: var(--muted); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success-text); }
.text-right { text-align: right; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.hidden { display: none !important; }

/* Filter bar */
.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.toolbar-left {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 6px;
}

.filter-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 16px;
}

.filter-panel-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.filter-panel-row .form-label {
    font-size: 0.75rem;
    margin-bottom: 4px;
}

.filter-panel-row .form-input {
    font-size: 0.8125rem;
    padding: 7px 10px;
}

@media (max-width: 768px) {
    .filter-panel-row {
        flex-direction: column;
        gap: 12px;
    }
    .filter-panel-row .form-group {
        flex: none !important;
    }
}

/* Client filter bar */
.client-filter-bar {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    gap: 16px;
}
.client-type-tabs {
    display: flex;
    gap: 4px;
    padding-bottom: 0;
}
.client-filter-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
}
.filter-search-input {
    width: 200px;
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
}
.filter-status-select {
    width: 150px;
    padding: 6px 12px !important;
    font-size: 13px !important;
    border-radius: 6px !important;
}
.type-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1px;
}
.type-tab:hover { color: var(--dark); }
.type-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.type-tab svg { opacity: 0.6; }
.type-tab.active svg { opacity: 1; }

/* Client type icon in list rows */
.client-type-icon {
    color: var(--muted);
    flex-shrink: 0;
    margin-right: 2px;
    vertical-align: -3px;
}

/* Client returns layout (dashboard) */
.client-returns {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Return status tags */
.return-tag {
    display: inline-block;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 100px;
    white-space: nowrap;
}

.return-tag-no_data {
    background: var(--bg);
    color: var(--muted);
    border: 1px solid var(--border);
}

.return-tag-in_progress {
    background: var(--warn-surface);
    color: var(--warn-text);
    border: 1px solid transparent;
}

.return-tag-ready {
    background: var(--info-surface);
    color: var(--info-text);
    border: 1px solid transparent;
}

.return-tag-filed {
    background: var(--success-surface);
    color: var(--success-text);
    border: 1px solid transparent;
}

/* Clickable stat boxes */
.stat-box-clickable {
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
    border: 1px solid var(--border);
    background: var(--surface);
    font-family: inherit;
    text-align: center;
}

.stat-box-clickable:hover {
    border-color: var(--primary);
}

.stat-box-clickable.active {
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

/* Stat box colour accents */
.stat-box-muted .stat-value { color: var(--muted); }
.stat-box-warn .stat-value { color: var(--warn-text); }
.stat-box-info .stat-value { color: var(--info-text); }
.stat-box-filed .stat-value { color: var(--success-text); }

/* Comms buttons and timeline (used in per-return flow pages) */

.comms-timeline {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 0.8125rem;
    color: var(--muted);
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.comms-stamp {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.comms-sent {
    color: var(--primary-text);
}

.comms-sent::before {
    content: "\2709";
    font-size: 0.875rem;
}

.comms-reminded {
    color: var(--warn-text);
}

.comms-reminded::before {
    content: "\21BB";
    font-size: 0.875rem;
}

.badge-never-reminded {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
}

.btn-comms {
    display: inline-block;
    padding: 6px 16px;
    min-width: 120px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.btn-initial-comms {
    border: 1px solid var(--primary);
    background: var(--primary);
    color: var(--surface);
}

.btn-initial-comms:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    color: var(--surface);
}

.btn-comms-disabled {
    display: inline-block;
    padding: 6px 16px;
    min-width: 120px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border-radius: 8px;
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.6;
    box-sizing: border-box;
}

.btn-comms-disabled:hover {
    background: var(--bg);
    color: var(--muted);
}

.btn-remind {
    display: inline-block;
    padding: 6px 16px;
    min-width: 120px;
    text-align: center;
    font-family: var(--font-body);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--body);
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
    box-sizing: border-box;
}

.btn-remind:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-surface);
}

.btn-remind-disabled {
    background: var(--bg);
    border-color: var(--border);
    color: var(--placeholder);
    cursor: not-allowed;
}

.btn-remind-disabled:hover {
    background: var(--bg);
    color: var(--placeholder);
}

.badge-outstanding {
    background: var(--border-subtle);
    color: #3E5068;
    border: none;
}

/* Summary page */
.summary-section {
    background: var(--surface);
    padding: 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
}

.summary-section-title {
    font-size: 1.125rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--dark);
}

.summary-docs {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.summary-doc-row {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.summary-doc-row:last-child {
    border-bottom: none;
}

.summary-doc-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.summary-doc-label {
    font-size: 0.875rem;
    font-weight: 600;
}

.summary-doc-value {
    font-size: 0.8125rem;
    color: var(--muted);
    text-align: right;
    flex-shrink: 0;
    padding: 0 16px;
}

.summary-doc-action {
    flex-shrink: 0;
}

.summary-doc-action a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.summary-doc-action a:hover {
    text-decoration: underline;
}

.summary-totals-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.summary-totals-table td {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-subtle);
}

.summary-totals-table td:last-child {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.summary-totals-highlight {
    background: var(--table-header);
}

.summary-totals-highlight td {
    padding: 12px 8px;
    font-weight: 800;
    border-bottom: 2px solid var(--border);
}

.summary-category {
    margin-bottom: 16px;
}

.summary-category:last-child {
    margin-bottom: 0;
}

.summary-category-header {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--table-header);
    border-left: 4px solid var(--primary);
    font-weight: 800;
    font-size: 0.875rem;
}

.summary-category-items {
    padding: 0 12px;
}

.summary-item-row {
    display: flex;
    align-items: center;
    padding: 6px 0;
    font-size: 0.8125rem;
    border-bottom: 1px solid var(--border-subtle);
}

.summary-item-row:last-child {
    border-bottom: none;
}

.summary-item-code {
    color: var(--muted);
    min-width: 60px;
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.summary-item-label {
    flex: 1;
}

.summary-item-amount {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    text-align: right;
    flex-shrink: 0;
}

/* Batch upload results */
.batch-results {
    margin-top: 24px;
}

.batch-results-title {
    font-weight: 800;
    font-size: 0.9375rem;
    margin-bottom: 12px;
}

.batch-result-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.875rem;
}

.batch-result-row:last-child {
    border-bottom: none;
}

.batch-result-ok {
    background: var(--success-surface);
    border-left: 3px solid var(--success-text);
    border-radius: 8px;
}

.batch-result-error {
    background: var(--error-surface);
    border-left: 3px solid var(--error-text);
    border-radius: 8px;
}

.batch-result-file {
    font-weight: 600;
    min-width: 200px;
    flex-shrink: 0;
}

.batch-result-detail {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.batch-result-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
    flex-shrink: 0;
}

.batch-result-link:hover {
    text-decoration: underline;
}

.text-error {
    color: var(--error-text);
}

/* Needs review badge */
.badge-review {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--warn-text);
    background: var(--warn-surface);
    border: none;
    border-radius: 100px;
}

/* Needs review workbook category */
.workbook-category-title.needs-review {
    border-left-color: var(--warn-text);
    background: var(--warn-surface);
}

.summary-category-header.needs-review {
    border-left-color: var(--warn-text);
    background: var(--warn-surface);
}

/* Document processing progress panel */
.progress-panel {
    margin-top: 16px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    font-weight: 800;
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
}

.progress-counter {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted);
}

.progress-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.875rem;
    transition: background 0.2s;
}

.progress-file:last-child {
    border-bottom: none;
}

.progress-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1rem;
    color: var(--border);
}

.progress-file[data-state="triage"] .progress-icon,
.progress-file[data-state="extracting"] .progress-icon,
.progress-file[data-state="ocr"] .progress-icon,
.progress-file[data-state="llm-text"] .progress-icon,
.progress-file[data-state="analysing"] .progress-icon {
    color: var(--primary);
}

.progress-file[data-state="complete"] .progress-icon {
    color: var(--primary-text);
    font-weight: 800;
}

.progress-file[data-state="error"] .progress-icon {
    color: var(--error-text);
}

.progress-filename {
    font-weight: 600;
    min-width: 220px;
    flex-shrink: 0;
}

.progress-status {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.progress-file[data-state="triage"] .progress-status,
.progress-file[data-state="extracting"] .progress-status,
.progress-file[data-state="ocr"] .progress-status,
.progress-file[data-state="llm-text"] .progress-status,
.progress-file[data-state="analysing"] .progress-status {
    color: var(--primary);
    font-weight: 600;
}

.progress-file[data-state="error"] .progress-status {
    color: var(--error-text);
}

.progress-action {
    flex-shrink: 0;
}

.progress-view-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.4px;
}

.progress-view-link:hover {
    text-decoration: underline;
}

/* Duplicate file states */
.progress-file[data-state="duplicate"] .progress-icon,
.progress-file[data-state="duplicate-done"] .progress-icon {
    color: var(--warn-text);
    font-weight: 800;
}

.progress-file[data-state="duplicate"] .progress-status,
.progress-file[data-state="duplicate-done"] .progress-status {
    color: var(--warn-text);
}

/* Triage badges */
.badge-duplicate {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--warn-text);
    background: var(--warn-surface);
    border: none;
    border-radius: 100px;
}

.badge-unexpected {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--cat-violet);
    background: var(--cat-violet-surface);
    border: 1px solid var(--cat-violet-border);
    border-radius: 100px;
}

.badge-info {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--info-text);
    background: var(--info-surface);
    border: none;
    border-radius: 100px;
}

.badge-method {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 100px;
}

/* Small inline spinner */
.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Per-file verbose log panel */
.progress-log {
    padding: 0 0 0 36px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.progress-file[data-state="triage"] + .progress-log,
.progress-file[data-state="extracting"] + .progress-log,
.progress-file[data-state="ocr"] + .progress-log,
.progress-file[data-state="llm-text"] + .progress-log,
.progress-file[data-state="analysing"] + .progress-log,
.progress-file[data-state="complete"] + .progress-log,
.progress-file[data-state="duplicate-done"] + .progress-log,
.progress-file[data-state="error"] + .progress-log {
    max-height: 600px;
    overflow-y: auto;
}

.log-line {
    font-size: 0.75rem;
    line-height: 1.6;
    color: var(--body);
    padding: 1px 0;
    font-family: var(--font-mono);
    font-weight: 400;
}

.log-line.log-dim {
    color: var(--muted);
}

.log-line.log-warn {
    color: var(--warn-text);
    font-weight: 600;
}

.log-line.log-success {
    color: var(--primary-text);
}

.log-line.log-error {
    color: var(--error-text);
    font-weight: 600;
}

.log-line.log-free {
    color: var(--primary-text);
    font-weight: 600;
}

.log-line.log-cost {
    color: var(--cat-violet);
}

.log-line.log-fields {
    padding: 4px 0 4px 12px;
    border-left: 2px solid var(--border);
    margin: 2px 0;
    line-height: 1.7;
}

.log-field-code {
    display: inline-block;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0 5px;
    margin-right: 4px;
    vertical-align: baseline;
    border-radius: 4px;
    font-family: var(--font-mono);
}

/* Cost / free badges in status line */
.badge-cost {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--cat-violet);
    background: var(--cat-violet-surface);
    border: 1px solid var(--cat-violet-border);
    border-radius: 100px;
}

.badge-free {
    display: inline-block;
    padding: 2px 8px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--primary-text);
    background: var(--primary-surface);
    border: none;
    border-radius: 100px;
}

/* Batch summary */
.progress-batch-summary {
    margin-top: 12px;
    padding: 12px 16px;
    background: var(--table-header);
    border-left: 4px solid var(--primary);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--body);
    display: none;
    border-radius: 0 8px 8px 0;
}

.progress-batch-summary:not(:empty) {
    display: block;
}

/* Editable field inputs on document detail page */
.field-edit-input {
    width: 100%;
    padding: 4px 8px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dark);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    outline: none;
    transition: border-color 0.2s;
}

.field-edit-input:focus {
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

/* Review link in workbook table */
.review-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.8125rem;
    padding: 2px 0;
}

.review-link svg {
    opacity: 0;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.review-link:hover svg {
    opacity: 1;
}

.review-link:hover {
    color: var(--primary);
}

/* Loading text with spinner */
.loading-text {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.875rem;
    color: var(--muted);
}

/* Tax position section */
.tax-position-caveat {
    padding: 10px 16px;
    font-size: 0.8125rem;
    color: var(--warn-text);
    background: var(--warn-surface);
    border-left: 4px solid var(--warn-text);
    margin-bottom: 16px;
    border-radius: 0 8px 8px 0;
}

.tax-position-result {
    font-weight: 800;
}

.tax-position-result.tax-refund {
    background: var(--primary-surface);
    border-top-color: var(--primary-text);
    color: var(--primary-text);
}

.tax-position-result.tax-refund td {
    color: var(--primary-text);
    font-weight: 800;
}

.tax-position-result.tax-owing {
    background: var(--error-surface);
    border-top-color: var(--error-text);
    color: var(--error-text);
}

.tax-position-result.tax-owing td {
    color: var(--error-text);
    font-weight: 800;
}

/* Workbook total variant for refund/owing */
.workbook-total.tax-refund {
    background: var(--primary-surface);
    color: var(--primary-text);
    border-top-color: var(--primary-text);
}

.workbook-total.tax-owing {
    background: var(--error-surface);
    color: var(--error-text);
    border-top-color: var(--error-text);
}

.tax-position-section .summary-totals-table td {
    padding: 8px 0;
}

/* ===== Bank Statement Wizard ===== */

/* Step indicator */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 32px;
    padding: 20px 0;
}

.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
}

.wizard-step-num {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 800;
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--border);
    flex-shrink: 0;
}

.wizard-step-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--border);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.wizard-step.active .wizard-step-num {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--surface);
}

.wizard-step.active .wizard-step-label {
    color: var(--primary);
}

.wizard-step.completed .wizard-step-num {
    border-color: var(--primary-text);
    background: var(--primary-text);
    color: var(--surface);
}

.wizard-step.completed .wizard-step-label {
    color: var(--primary-text);
}

.wizard-step-line {
    width: 40px;
    height: 2px;
    background: var(--border);
    margin: 0 8px;
    flex-shrink: 0;
}

/* Wizard navigation */
.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* ── Estimate summary ── */
.estimate-lines {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.estimate-line {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}
.estimate-line-source {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 8px;
}
.estimate-subtotal {
    display: flex;
    justify-content: space-between;
    padding: 8px 0 0;
    font-weight: 600;
    font-size: 0.875rem;
    border-top: 2px solid var(--border);
    margin-top: 4px;
}
.estimate-calc-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.estimate-calc-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    padding: 4px 0;
}
.estimate-calc-row--bold {
    font-weight: 600;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}
.estimate-calc-row--total {
    font-weight: 700;
    font-size: 1rem;
    border-top: 2px solid var(--primary);
    padding-top: 8px;
    margin-top: 4px;
}
.estimate-result-card {
    border-left: 3px solid var(--primary);
}
.estimate-accuracy-warning {
    background: var(--bg-secondary, var(--bg));
    border: 1px solid var(--border);
    border-radius: var(--radius-card, 8px);
    padding: 12px 16px;
    font-size: 0.8125rem;
    margin-top: 12px;
}
.estimate-confirm-summary {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}
.estimate-confirm-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.9375rem;
}
.estimate-confirm-row--total {
    font-weight: 700;
    font-size: 1.125rem;
    border-top: 2px solid var(--primary);
    padding-top: 8px;
}

/* Manual line input row */
.manual-line-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}
.manual-line-row input {
    font-size: 0.8125rem;
}
.manual-line-row .form-input {
    flex: 1;
}
.manual-line-row .manual-amount {
    width: 120px;
    text-align: right;
    font-family: var(--font-mono);
    background: #fefce8;
}
.manual-line-remove {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.25rem;
    padding: 0 4px;
}

/* Review card */
.review-card {
    padding: 20px 24px;
    margin-bottom: 8px;
    transition: opacity 0.3s ease;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
}

.review-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.review-card-desc {
    font-size: 0.9375rem;
    font-weight: 800;
}

.review-card-amount {
    text-align: right;
    font-size: 0.875rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    margin-left: 16px;
}

.amount-credit {
    color: var(--primary-text);
}

.amount-debit {
    color: var(--dark);
}

.review-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

/* Quick-pick pills */
.pill {
    display: inline-block;
    padding: 6px 14px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: var(--surface);
    color: var(--body);
    cursor: pointer;
    transition: all 0.15s;
}

.pill:hover:not(:disabled) {
    border-color: var(--primary);
    color: var(--primary);
}

.pill:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pill-outline {
    border-style: dashed;
    color: var(--muted);
}

.pill-outline:hover:not(:disabled) {
    border-style: solid;
}

.pill-confirm {
    border-color: var(--primary-text);
    color: var(--primary-text);
    background: var(--primary-surface);
}

.pill-confirm:hover:not(:disabled) {
    background: var(--primary-text);
    color: var(--surface);
}

.pill-skip {
    border-color: var(--muted);
    color: var(--muted);
    background: transparent;
    margin-left: auto;
}

.pill-skip:hover:not(:disabled) {
    background: var(--muted);
    color: var(--surface);
}

/* Low confidence section */
.review-low-confidence {
    border-left: 4px solid var(--warn-text);
}

/* Sticky action bar */
.wizard-action-bar {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 16px 0;
    z-index: 100;
    margin-top: 24px;
}

.wizard-action-bar-inner {
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wizard-action-remaining {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted);
}

/* Review card form */
.review-card-form {
    border-top: 1px solid var(--border-subtle);
    padding-top: 12px;
    margin-top: 12px;
}

/* Business/personal toggle */
.biz-toggle {
    display: inline-flex;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
}
.biz-btn {
    padding: 6px 14px;
    font-size: 0.8125rem;
    border: none;
    background: var(--surface);
    color: var(--text-secondary);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.biz-btn:not(:last-child) {
    border-right: 1px solid var(--border);
}
.biz-btn:hover {
    background: var(--surface-hover, #f5f5f5);
}
.biz-btn.active[data-biz="yes"] {
    background: #dcfce7;
    color: #166534;
    font-weight: 600;
}
.biz-btn.active[data-biz="no"] {
    background: #fee2e2;
    color: #991b1b;
    font-weight: 600;
}
.biz-btn.active[data-biz="unknown"] {
    background: var(--surface-alt, #f0f0f0);
    color: var(--text-primary);
    font-weight: 600;
}

/* Export bar */
.export-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

/* Checklist item just-received animation */
.checklist-item.just-received .checklist-status {
    animation: checkTick 0.4s ease;
}

@keyframes checkTick {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.checklist-item.just-received {
    background: rgba(13, 148, 136, 0.06);
    transition: background 1.5s ease;
}

/* Working paper CTA */
.workbook-cta {
    background: var(--surface);
    border-left: 4px solid var(--primary);
    padding: 20px 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
}

.workbook-cta-content {
    flex: 1;
    min-width: 0;
}

.workbook-cta-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 2px;
}

.workbook-cta-summary {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    line-height: 1.5;
}

.workbook-cta-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

/* ===== Obligation cards ===== */

.obligation-stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 0;
}

.obligation-card {
    margin-bottom: 0;
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    padding: 24px;
}

.obligation-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--primary);
}

.obligation-card--vat::before {
    background: var(--info-text);
}

.obligation-card--emp::before {
    background: var(--border);
}

.obligation-card-disabled {
    opacity: 0.4;
    pointer-events: none;
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 8px,
        rgba(0,0,0,0.012) 8px,
        rgba(0,0,0,0.012) 9px
    );
}

.obligation-card-type {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--primary);
    margin-bottom: 2px;
}

.obligation-card--vat .obligation-card-type {
    color: var(--info-text);
}

.obligation-card--emp .obligation-card-type {
    color: var(--border);
}

.obligation-card-name {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 12px;
}

/* Optional obligation row (P3) */
.obligation-optional {
    border-style: dashed;
    opacity: 0.6;
}

/* Filed estimate inline amount */
.obligation-filed-amount {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

/* VAT period list */
.vat-period-list {
    margin-top: 4px;
}

.vat-period-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    margin: 0 -14px;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    color: var(--dark);
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
    border-radius: 6px;
}

.vat-period-row:last-child {
    border-bottom: none;
}

.vat-period-row:hover {
    background: var(--primary-surface);
    border-left-color: var(--primary);
}

.vat-period-row-label {
    font-weight: 600;
    font-size: 0.875rem;
    min-width: 120px;
    font-variant-numeric: tabular-nums;
    font-family: var(--font-mono);
}

.vat-period-row-due {
    font-size: 0.8125rem;
    color: var(--muted);
    flex: 1;
    font-variant-numeric: tabular-nums;
}

.vat-period-row-action {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--primary);
    flex-shrink: 0;
    opacity: 0;
    transition: opacity 0.15s;
}

.vat-period-row:hover .vat-period-row-action {
    opacity: 1;
}

.badge-in_progress {
    background: var(--warn-surface);
    color: var(--warn-text);
    border: none;
}

.badge-complete {
    background: var(--info-surface);
    color: var(--info-text);
    border: none;
}

/* ===== Back link + page header ===== */

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: 8px;
    background: transparent;
    text-decoration: none;
    transition: all 0.15s;
}

.back-link:hover {
    background: var(--primary);
    color: var(--surface);
    text-decoration: none;
}

.page-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 0;
}

.page-header-row .page-title {
    margin-bottom: 0;
}

.page-header-row .page-subtitle {
    margin-top: 4px;
}

/* ===== Checklist Inline Edit ===== */

.checklist-remove-btn {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 4px;
    flex-shrink: 0;
    transition: color 0.15s, background 0.15s;
}

.checklist-remove-btn:hover {
    color: var(--error-text);
    background: var(--error-surface);
}

.checklist-add-row {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px 16px;
    border-top: 1px solid var(--border);
}

.checklist-add-row .form-input {
    font-size: 0.8125rem !important;
    padding: 7px 10px !important;
}

/* ===== Document Setup Wizard ===== */

.setup-method-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 8px;
}

.setup-method-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 32px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.15s;
}

.setup-method-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.setup-method-card-skip {
    border-style: dashed;
}

.setup-method-card-skip:hover {
    border-color: var(--muted);
}

.setup-method-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.setup-method-title {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 8px 0;
}

.setup-method-desc {
    font-size: 0.8125rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.5;
}

/* Document picker - two column layout */
.doc-picker {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 8px;
}

.doc-picker-heading {
    font-family: var(--font-body);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--dark);
    margin: 0 0 16px 0;
}

.doc-picker-count {
    font-weight: 400;
    color: var(--muted);
}

.doc-picker-available {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.doc-picker-selected {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
}

.doc-type-group-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin: 16px 0 8px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}

.doc-type-group-header:first-of-type {
    margin-top: 0;
}

.doc-type-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 4px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.15s;
}

.doc-type-row:hover {
    background: var(--bg);
}

.doc-type-row input[type="checkbox"] {
    margin-top: 3px;
    accent-color: var(--primary);
    flex-shrink: 0;
}

.doc-type-info {
    flex: 1;
    min-width: 0;
}

.doc-type-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
}

.doc-type-desc {
    font-size: 0.75rem;
    color: var(--muted);
    margin-top: 2px;
    line-height: 1.4;
}

/* Selected docs list */
.selected-doc-row {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
}

.selected-doc-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.selected-doc-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
}

.selected-doc-remove {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.selected-doc-remove:hover {
    color: var(--error-text);
}

.selected-doc-source {
    font-size: 0.8125rem !important;
    padding: 6px 10px !important;
}

/* Responsive: stack on narrow screens */
@media (max-width: 768px) {
    .setup-method-cards {
        grid-template-columns: 1fr;
    }
    .doc-picker {
        grid-template-columns: 1fr;
    }
}

/* ===== VAT wizard ===== */

/* Status badges */
.badge-calculated { background: var(--info-surface); color: var(--info-text); border: none; border-radius: 100px; }
.badge-filed { background: var(--success-surface); color: var(--success-text); border: none; border-radius: 100px; }
.badge-no-data, .badge-no_data, .badge-not_started { background: var(--bg); color: var(--muted); border: 1px solid var(--border); border-radius: 100px; }
.badge-draft { background: var(--warn-surface); color: var(--warn-text); border: none; border-radius: 100px; }

/* Shared utility */
.text-debit { color: var(--dark); }
.text-credit { color: var(--success-text); }
.form-input-sm { padding: 5px 10px; font-size: 0.8125rem; }
.breadcrumb-sep { color: var(--muted); margin: 0 4px; font-size: 0.75rem; }
.breadcrumb-current { font-size: 0.75rem; color: var(--muted); }

/* Step indicator */
.vat-wizard-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    margin: 8px 0 36px;
    padding: 20px 0;
}

.vat-wizard-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.vat-wizard-step-num {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 800;
    border: 2px solid var(--border);
    border-radius: 50%;
    color: var(--border);
    background: var(--surface);
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.vat-wizard-step-label {
    font-size: 0.625rem;
    font-weight: 700;
    color: var(--border);
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
    white-space: nowrap;
}

.vat-wizard-step.active .vat-wizard-step-num {
    border-color: var(--primary);
    background: var(--primary);
    color: var(--surface);
}

.vat-wizard-step.active .vat-wizard-step-label {
    color: var(--primary);
    font-weight: 800;
}

.vat-wizard-step.completed .vat-wizard-step-num {
    border-color: var(--primary-text);
    background: var(--primary-text);
    color: var(--surface);
}

.vat-wizard-step.completed .vat-wizard-step-label {
    color: var(--primary-text);
}

.vat-wizard-line {
    width: 56px;
    height: 2px;
    background: var(--border);
    margin: 20px 12px 0;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.vat-wizard-line.done {
    background: var(--primary-text);
}

/* Wizard panels */
.vat-wizard-panel {
    background: var(--surface);
    padding: 28px 28px;
    margin-bottom: 0;
    animation: vatPanelIn 0.35s ease;
}

@keyframes vatPanelIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.vat-wizard-panel-step {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: 6px;
}

.vat-wizard-panel-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 6px;
}

.vat-wizard-panel-desc {
    font-size: 0.8125rem;
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 20px;
}

/* Upload zone */
.vat-upload-zone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--bg);
}

.vat-upload-zone:hover {
    border-color: var(--primary);
    border-style: solid;
    background: var(--primary-surface);
}

.vat-upload-zone.drag-over {
    border-color: var(--primary);
    border-style: solid;
    background: var(--primary-surface);
}

.vat-upload-zone-icon {
    font-size: 2rem;
    font-weight: 300;
    color: var(--border);
    margin-bottom: 10px;
    line-height: 1;
    transition: color 0.2s, transform 0.2s;
}

.vat-upload-zone:hover .vat-upload-zone-icon {
    color: var(--primary);
    transform: translateY(-2px);
}

.vat-upload-zone-text {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--body);
    margin-bottom: 4px;
}

.vat-upload-zone-hint {
    font-size: 0.75rem;
    color: var(--muted);
}

.vat-upload-zone input[type="file"] {
    display: none;
}

/* Transaction preview */
.vat-txn-preview {
    margin-top: 24px;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.vat-txn-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--dark);
    color: var(--surface);
}

.vat-txn-preview-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.vat-txn-preview-count {
    font-size: 0.6875rem;
    font-weight: 600;
    opacity: 0.6;
}

.vat-txn-preview-body {
    max-height: 400px;
    overflow-y: auto;
}

.vat-txn-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
}

.vat-txn-table thead th {
    padding: 9px 14px;
    text-align: left;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--table-header);
    position: sticky;
    top: 0;
    z-index: 1;
}

.vat-txn-table thead th.num {
    text-align: right;
}

.vat-txn-table tbody td {
    padding: 7px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--body);
}

.vat-txn-table tbody td.num {
    text-align: right;
    font-weight: 500;
    font-family: var(--font-mono);
}

.vat-txn-table tbody td.desc {
    max-width: 240px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vat-txn-table tbody tr:hover {
    background: var(--alt-row);
}

.vat-txn-table tfoot td {
    padding: 11px 14px;
    font-weight: 700;
    border-top: 2px solid var(--border);
    color: var(--dark);
}

.vat-txn-table tfoot td.num {
    text-align: right;
    font-family: var(--font-mono);
}

.vat-txn-sources {
    padding: 10px 16px;
    font-size: 0.75rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
    background: var(--bg);
}

/* VAT position card (review step) */
.vat-position {
    border-left: 4px solid var(--primary);
    padding: 28px;
    background: var(--surface);
    margin-bottom: 24px;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 0 12px 12px 0;
}

.vat-position-table {
    width: 100%;
    max-width: 560px;
    border-collapse: collapse;
    font-variant-numeric: tabular-nums;
}

.vat-position-table td {
    padding: 5px 10px;
    font-size: 0.875rem;
}

.vat-position-table .vat-field-num {
    width: 70px;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    font-family: var(--font-mono);
}

.vat-position-table .vat-field-label {
    color: var(--body);
}

.vat-position-table .vat-field-amount {
    text-align: right;
    font-weight: 600;
    font-family: var(--font-mono);
}

.vat-position-section td {
    padding-top: 18px;
    font-weight: 700;
    font-size: 0.5625rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
}

.vat-position-total td {
    font-weight: 700;
    border-top: 1px solid var(--border);
    padding-top: 8px;
}

.vat-position-net {
    font-size: 1.125rem;
    font-weight: 800;
}

.vat-position-meta {
    margin-top: 16px;
    font-size: 0.75rem;
    color: var(--muted);
    line-height: 1.7;
}

/* Wizard navigation */
.vat-wizard-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

/* Action buttons row */
.vat-actions {
    display: flex;
    gap: 10px;
    margin-top: 28px;
    flex-wrap: wrap;
}

/* Filed form */
.vat-filed-form {
    background: var(--bg);
    padding: 24px;
    margin-top: 24px;
    border: 1px solid var(--border);
    border-radius: 10px;
}

.vat-filed-form-title {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 16px;
    color: var(--body);
}

/* Variance table */
.vat-variance-table {
    width: 100%;
    max-width: 520px;
    border-collapse: collapse;
    font-size: 0.8125rem;
    font-variant-numeric: tabular-nums;
    margin-top: 20px;
}

.vat-variance-table th {
    padding: 8px 12px;
    text-align: right;
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.vat-variance-table th:first-child {
    text-align: left;
}

.vat-variance-table td {
    padding: 8px 12px;
    text-align: right;
    border-bottom: 1px solid var(--border-subtle);
    font-family: var(--font-mono);
}

.vat-variance-table td:first-child {
    text-align: left;
    font-weight: 600;
    font-family: var(--font-body);
}

/* Alerts */
.vat-alert {
    padding: 12px 16px;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-top: 10px;
    border-radius: 8px;
}

.vat-alert--success {
    background: var(--success-surface);
    border-left: 3px solid var(--success-text);
    color: var(--success-text);
}

.vat-alert--error {
    background: var(--error-surface);
    border-left: 3px solid var(--error-text);
    color: var(--error-text);
}

/* Period confirmation (step 1) */
.vat-period-confirm {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 8px;
}

.vat-period-confirm-item {
    padding: 0;
}

.vat-period-confirm-label {
    font-size: 0.5625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: var(--muted);
    margin-bottom: 4px;
}

.vat-period-confirm-value {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    font-family: var(--font-mono);
}

/* Responsive */
@media (max-width: 768px) {
    .vat-wizard-steps { gap: 0; padding: 12px 0; }
    .vat-wizard-line { width: 20px; margin: 20px 4px 0; }
    .vat-wizard-step-label { font-size: 0.5rem; letter-spacing: 0.4px; }
    .vat-wizard-step-num { width: 34px; height: 34px; font-size: 0.75rem; }
    .vat-wizard-panel { padding: 20px 16px; }
    .vat-period-confirm { grid-template-columns: 1fr; gap: 12px; }
    .vat-txn-table thead th, .vat-txn-table tbody td, .vat-txn-table tfoot td { padding: 6px 8px; }
}

/* ===== Filing detail (expanded return within obligation card) ===== */

.filing-row-active {
    padding: 0;
}

.filing-row-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.filing-detail {
    padding: 20px 16px;
}

.filing-stats {
    display: flex;
    gap: 24px;
    font-size: 14px;
    color: var(--muted);
}

.filing-stat {
    font-variant-numeric: tabular-nums;
}

.filing-section {
    padding: 16px 0;
    border-top: 1px solid var(--border-subtle);
}

.filing-section:first-child {
    border-top: none;
}

.filing-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.filing-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--dark);
}

.filing-workbook-cta {
    background: var(--primary-surface);
    margin: 0 -16px;
    padding: 16px;
    border-radius: 0;
}

.filing-start-cta {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
}

.filing-start-cta .btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

/* ===== Dashboard header ===== */

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 24px;
}

.dashboard-header .page-title {
    margin-bottom: 4px;
}

.dashboard-header .page-subtitle {
    margin-bottom: 0;
}

/* ===== Add client button (prominent) ===== */

.btn-add-client {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    border-radius: 10px;
    border: none;
    background: var(--primary);
    color: var(--surface);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-add-client:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-add-client:active {
    transform: translateY(0);
}

/* ===== Add client backdrop + card ===== */

.add-client-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 90;
    transition: opacity 0.2s;
}

.add-client-backdrop.hidden {
    display: none;
}

.add-client-card {
    position: relative;
    z-index: 100;
    border: 2px solid var(--primary);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ===== Client type selector (card-style radio buttons) ===== */

.client-type-selector {
    display: flex;
    gap: 12px;
}

.client-type-option {
    flex: 1;
    cursor: pointer;
}

.client-type-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.client-type-option-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    transition: all 0.15s;
    text-align: center;
}

.client-type-option-content svg {
    color: var(--muted);
    transition: color 0.15s;
}

.client-type-option input[type="radio"]:checked + .client-type-option-content {
    border-color: var(--primary);
    background: var(--primary-surface);
}

.client-type-option input[type="radio"]:checked + .client-type-option-content svg {
    color: var(--primary);
}

.client-type-option-content:hover {
    border-color: var(--primary);
}

.client-type-option-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--dark);
}

.client-type-option-desc {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.3;
}

/* ===== Compact stats row ===== */

.stats-row-compact {
    gap: 8px;
    margin-bottom: 16px;
}

.stat-box-compact {
    padding: 12px 16px;
}

.stat-box-compact .stat-value {
    font-size: 1.5rem;
}

.stat-box-compact .stat-label {
    font-size: 0.6875rem;
}

/* ===== Empty state ===== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
    background: var(--surface);
    border: 2px dashed var(--border);
    border-radius: 12px;
}

.empty-state-icon {
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 4px;
}

.empty-state-desc {
    font-size: 0.9375rem;
    color: var(--muted);
    margin-bottom: 24px;
}

/* ===== Provisional obligation card ===== */

.obligation-card--prov::before {
    background: var(--cat-cyan);
}

.obligation-card--prov .obligation-card-type {
    color: var(--cat-cyan);
}

/* Static period row (no link) */
.vat-period-row-static {
    cursor: default;
}

.vat-period-row-static:hover {
    background: transparent;
    border-left-color: transparent;
}

/* ===== Bank statement triage ===== */

.triage-section {
    border: 1px solid var(--border);
}

.triage-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.triage-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
}

.triage-stat-business {
    background: var(--primary-surface);
}

.triage-stat-personal {
    background: var(--bg);
}

.triage-stat-unreviewed {
    background: var(--border-subtle);
}

.triage-stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
    color: var(--dark);
}

.triage-stat-business .triage-stat-value {
    color: var(--primary-text);
}

.triage-stat-unreviewed .triage-stat-value {
    color: var(--muted);
}

.triage-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-top: 2px;
}

.triage-stat-amount {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-top: 2px;
}

.triage-groups {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 480px;
    overflow-y: auto;
}

.triage-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    transition: opacity 0.2s, max-height 0.3s;
}

.triage-group-info {
    flex: 1;
    min-width: 0;
}

.triage-group-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.triage-group-desc {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--dark);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.triage-group-meta {
    font-size: 0.8125rem;
    color: var(--muted);
    white-space: nowrap;
}

.triage-group-dates {
    font-size: 0.75rem;
    margin-top: 2px;
}

.triage-group-actions {
    display: flex;
    gap: 6px;
    margin-left: 12px;
    flex-shrink: 0;
}

.triage-btn-business {
    background: var(--primary-surface) !important;
    color: var(--primary-text) !important;
    border: 1px solid var(--primary) !important;
}

.triage-btn-business:hover {
    background: var(--primary) !important;
    color: var(--surface) !important;
}

.triage-btn-personal {
    background: var(--bg) !important;
    color: var(--muted) !important;
    border: 1px solid var(--border) !important;
}

.triage-btn-personal:hover {
    background: var(--border) !important;
    color: var(--dark) !important;
}

.triage-bulk {
    margin-top: 12px;
    text-align: right;
}

.triage-bulk-btn {
    background: var(--bg) !important;
    color: var(--muted) !important;
    border: 1px solid var(--border) !important;
}

.triage-bulk-btn:hover {
    background: var(--border) !important;
    color: var(--dark) !important;
}

/* Header credit badge */
.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-credits {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--primary-surface);
    border: 1px solid var(--primary, #3b8574);
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--primary-text);
    white-space: nowrap;
    text-decoration: none;
    transition: background 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.header-credits:hover {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}

.credits-icon {
    width: 18px;
    height: 18px;
    vertical-align: middle;
    flex-shrink: 0;
}

.credits-count {
    font-family: var(--font-mono);
}

.credits-label {
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: lowercase;
}

/* Header profile dropdown */
.header-profile {
    position: relative;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    font-family: var(--font-body);
    font-size: 0.875rem;
}

.profile-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .profile-btn:hover {
    background: rgba(255, 255, 255, 0.08);
}

.profile-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.8125rem;
    font-family: var(--font-heading);
    flex-shrink: 0;
}

.profile-name {
    font-weight: 600;
    color: var(--dark);
}

.profile-caret {
    font-size: 0.625rem;
    color: var(--muted);
    margin-left: -2px;
}

.profile-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    min-width: 200px;
    z-index: 1000;
    overflow: hidden;
}

.header-profile.open .profile-dropdown {
    display: block;
}

.profile-dropdown-tenant {
    padding: 10px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-subtle);
}

.profile-dropdown-item {
    display: block;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--dark);
    text-decoration: none;
    transition: background 0.12s;
}

.profile-dropdown-item:hover {
    background: var(--bg);
}

.profile-dropdown-divider {
    border-top: 1px solid var(--border-subtle);
    margin: 4px 0;
}

.profile-dropdown-logout {
    color: var(--error-text);
}

.profile-dropdown-logout:hover {
    background: var(--error-surface);
}

/* Header responsive — show hamburger, collapse nav on mobile */
@media (max-width: 768px) {
    .mobile-menu-btn { display: block; }
    .header-nav {
        display: none;
        flex-direction: column;
        position: absolute;
        top: 56px;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border-subtle);
        padding: 8px 0;
        z-index: 99;
    }
    .header-nav.open { display: flex; }
    .header-nav a { padding: 10px 24px; }
}

/* Insufficient credits notification */
.credit-error {
    text-align: center;
    padding: 2rem;
    background: #fff3e0;
    border: 1px solid #ff9800;
    border-radius: 8px;
    margin: 1rem 0;
}
.credit-error h3 {
    color: #e65100;
    margin: 0 0 0.5rem 0;
}
.credit-error p {
    margin: 0 0 1rem 0;
    color: #555;
}
.credit-error a {
    display: inline-block;
    padding: 0.5rem 1.5rem;
    background: #ff9800;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-weight: 600;
}
.credit-error a:hover {
    background: #f57c00;
}
