/* Receipt Scanner Design System */
/* Colors: Deep navy background, teal primary, amber accent */

:root {
    --color-primary: #20C997;
    --color-primary-light: #38d9a9;
    --color-primary-dark: #12b886;
    --color-accent: #FFC247;
    --color-accent-light: #ffce6b;
    --color-bg: #0A1633;
    --color-surface: #111D3E;
    --color-surface-alt: #0D1830;
    --color-text: #FFFFFF;
    --color-text-secondary: rgba(255,255,255,0.7);
    --color-text-muted: rgba(255,255,255,0.4);
    --color-border: rgba(255,255,255,0.08);
    --color-success: #20C997;
    --color-error: #EF4444;
    --color-warning: #F59E0B;
    --color-info: #60A5FA;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 2px 8px rgba(0,0,0,0.25);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.3);
    --font-heading: 'Inter', system-ui, sans-serif;
    --font-body: 'Inter', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

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

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.3;
}
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code { font-family: var(--font-mono); font-size: 0.875em; background: var(--color-surface-alt); padding: 2px 6px; border-radius: var(--radius-sm); color: var(--color-primary); }

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    height: 56px;
    background: var(--color-surface);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--color-border);
}
.nav-brand a { color: white; font-family: var(--font-heading); font-weight: 700; font-size: 1.125rem; }
.nav-brand a:hover { text-decoration: none; }
.nav-badge { background: var(--color-accent); color: #0A1633; font-size: 0.625rem; padding: 2px 6px; border-radius: var(--radius-sm); margin-left: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.nav-links { display: flex; gap: 4px; }
.nav-link { color: rgba(255,255,255,0.7); padding: 8px 14px; border-radius: var(--radius-sm); font-size: 0.875rem; font-weight: 500; transition: all 0.15s; }
.nav-link:hover { color: white; background: rgba(255,255,255,0.08); text-decoration: none; }
.nav-link.active { color: white; background: rgba(255,255,255,0.12); }
.nav-user { display: flex; align-items: center; gap: 12px; }
.nav-user-email { color: rgba(255,255,255,0.5); font-size: 0.8rem; }
.nav-user .btn { border-color: rgba(255,255,255,0.2); color: white; }
.nav-user .btn:hover { background: rgba(255,255,255,0.08); }

/* Main Content */
.main-content { max-width: 1200px; margin: 0 auto; padding: 24px; padding-bottom: 72px; }
.main-content:has(.page-fullwidth) { max-width: none; padding: 24px 32px; padding-bottom: 72px; }
.main-content.fullwidth { max-width: none; padding: 24px 32px; padding-bottom: 72px; }

/* Footer */
.main-footer { text-align: center; padding: 24px; color: var(--color-text-muted); font-size: 0.8125rem; border-top: 1px solid var(--color-border); margin-top: 48px; }
.main-footer a { color: var(--color-text-secondary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--color-accent); color: #0A1633; font-weight: 600; }
.btn-primary:hover { background: var(--color-accent-light); }
.btn-secondary { background: transparent; color: var(--color-text); border-color: rgba(255,255,255,0.15); }
.btn-secondary:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.25); }
.btn-danger { background: var(--color-error); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-danger-outline { background: transparent; color: var(--color-error); border-color: var(--color-error); }
.btn-danger-outline:hover { background: var(--color-error); color: white; }
.btn-oauth { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 500; }
.btn-oauth-microsoft { background: var(--color-surface); color: var(--color-text); border: 1px solid rgba(255,255,255,0.15); }
.btn-oauth-microsoft:hover { background: rgba(255,255,255,0.08); color: var(--color-text); border-color: rgba(255,255,255,0.25); }
.btn-oauth-google { background: var(--color-surface); color: var(--color-text); border: 1px solid rgba(255,255,255,0.15); }
.btn-oauth-google:hover { background: rgba(255,255,255,0.08); color: var(--color-text); border-color: rgba(255,255,255,0.25); }
.btn-sm { padding: 4px 10px; font-size: 0.8125rem; }
.btn-lg { padding: 12px 24px; font-size: 1rem; }
.btn-delete-mini { background: transparent; color: var(--color-text-muted); border-color: transparent; padding: 4px 6px; font-size: 0.85rem; line-height: 1; min-width: 28px; justify-content: center; cursor: pointer; transition: all 0.2s; }
.btn-delete-mini:hover { color: var(--color-error); background: rgba(239, 68, 68, 0.12); }
.btn-delete-mini:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-dismiss { background: transparent; color: var(--color-text-muted); border-color: transparent; padding: 4px 6px; font-size: 1rem; line-height: 1; min-width: 28px; justify-content: center; }
.btn-dismiss:hover { color: var(--color-error); background: rgba(239, 68, 68, 0.12); border-color: var(--color-error); }
.btn-rescan-mini { background: linear-gradient(135deg, #6366f1, #8b5cf6); color: #fff; border: none; padding: 3px 8px; border-radius: 4px; cursor: pointer; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.03em; transition: all 0.2s; min-width: 28px; }
.btn-rescan-mini:hover { opacity: 0.85; transform: translateY(-1px); }
.btn-rescan-mini:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.actions-cell { display: flex; gap: 4px; align-items: center; white-space: nowrap; }

/* Pagination */
.pagination { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; margin-top: 8px; border-top: 1px solid var(--color-border); }
.pagination-info { font-size: 0.8rem; color: var(--color-text-muted); }
.pagination-controls { display: flex; gap: 4px; align-items: center; }
.pagination-current { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--color-primary); color: #0A1633; font-size: 0.8125rem; font-weight: 600; }
.pagination-ellipsis { padding: 0 4px; color: var(--color-text-muted); }
.pagination-controls .btn-sm { min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; }

/* Flash Messages */
.flash-message {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}
.flash-success { background: rgba(32, 201, 151, 0.12); color: var(--color-success); border: 1px solid rgba(32, 201, 151, 0.3); }
.flash-error { background: rgba(239, 68, 68, 0.12); color: var(--color-error); border: 1px solid rgba(239, 68, 68, 0.3); }
.flash-info { background: rgba(96, 165, 250, 0.12); color: var(--color-info); border: 1px solid rgba(96, 165, 250, 0.3); }
.flash-close { background: none; border: none; font-size: 1.25rem; cursor: pointer; color: inherit; opacity: 0.7; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255,255,255,0.08);
    color: var(--color-text-secondary);
}
.badge-success { background: rgba(32, 201, 151, 0.15); color: var(--color-success); }
.badge-inactive { background: rgba(255,255,255,0.05); color: var(--color-text-muted); }
.badge-review { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.badge-category { background: rgba(96, 165, 250, 0.15); color: var(--color-info); }
.badge-oauth-provider { background: rgba(96, 165, 250, 0.12); color: #60A5FA; font-size: 0.7rem; }
.badge-openai { background: rgba(32, 201, 151, 0.15); color: var(--color-success); }
.badge-ocr { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.badge-ocr_fallback { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.badge-manual { background: rgba(96, 165, 250, 0.15); color: var(--color-info); }
.badge-regex { background: rgba(167, 139, 250, 0.15); color: #A78BFA; }
.badge-regex_fallback { background: rgba(167, 139, 250, 0.15); color: #A78BFA; }
.badge-ollama { background: rgba(32, 201, 151, 0.15); color: var(--color-success); }
.badge-mistral_cloud { background: rgba(96, 165, 250, 0.15); color: #60A5FA; }
.badge-started { background: rgba(96, 165, 250, 0.15); color: var(--color-info); }
.badge-success { background: rgba(32, 201, 151, 0.15); color: var(--color-success); }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: var(--color-error); }

/* Data Table */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; table-layout: fixed; }
.data-table th { text-align: left; padding: 8px 10px; font-weight: 600; color: var(--color-text-secondary); border-bottom: 2px solid rgba(255,255,255,0.12); font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.03em; white-space: nowrap; }
.data-table td { padding: 8px 10px; border-bottom: 1px solid var(--color-border); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table tr:hover { background: rgba(255,255,255,0.04); }
.data-table .amount { font-family: var(--font-mono); font-weight: 500; }

/* Column widths (col 1 = checkbox) */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 36px; text-align: center; }  /* Checkbox */
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 100px; }  /* Date */
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 180px; max-width: 180px; font-size: 0.8125rem; }  /* Merchant */
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 100px; text-align: right; } /* Amount */
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 130px; } /* Category */
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 85px; }  /* Method */
.data-table th:nth-child(7), .data-table td:nth-child(7) { width: 100px; text-align: center; } /* Confidence */
.data-table th:nth-child(8), .data-table td:nth-child(8) { width: 160px; text-align: center; } /* Actions */

/* Bulk selection */
.col-checkbox input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-primary); cursor: pointer; }
.bulk-action-bar {
    position: fixed; bottom: 0; left: 0; right: 0;
    background: rgba(17, 29, 62, 0.80); border-top: 2px solid var(--color-primary);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.3); z-index: 150;
    padding: 12px 24px; justify-content: center;
    animation: slide-up 0.2s ease;
}
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.bulk-action-content { display: flex; align-items: center; gap: 16px; max-width: 1200px; width: 100%; margin: 0 auto; }
.bulk-count { font-weight: 600; font-size: 0.875rem; color: var(--color-primary); white-space: nowrap; }
.bulk-actions { display: flex; gap: 8px; flex: 1; }

.confidence-bar {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.75rem;
    font-family: var(--font-mono);
    background: linear-gradient(90deg, var(--color-success) var(--conf), var(--color-surface-alt) var(--conf));
    color: var(--color-text);
}

/* Page Header */
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.header-actions { display: flex; gap: 8px; align-items: center; }

/* Stats Row */
.stats-row { display: flex; gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--color-surface); padding: 16px 24px; border-radius: var(--radius-lg); border: 1px solid var(--color-border); box-shadow: var(--shadow-sm); }
.stat-value { display: block; font-size: 1.5rem; font-weight: 700; font-family: var(--font-mono); color: var(--color-primary); }
.stat-label { font-size: 0.8125rem; color: var(--color-text-secondary); }

/* Receipt Cards */
.receipts-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.receipt-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm); transition: box-shadow 0.15s; cursor: pointer; }
.receipt-card:hover { box-shadow: var(--shadow-md); }
.receipt-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.receipt-date { font-size: 0.8125rem; color: var(--color-text-secondary); font-family: var(--font-mono); }
.receipt-card-body { margin-bottom: 8px; }
.receipt-merchant { font-size: 1rem; margin-bottom: 4px; }
.receipt-amount { font-family: var(--font-mono); font-weight: 600; font-size: 1.125rem; color: var(--color-primary); }
.receipt-invoice-nr { font-size: 0.8125rem; color: var(--color-text-muted); font-family: var(--font-mono); }
.receipt-card-footer { display: flex; gap: 6px; flex-wrap: wrap; }

/* Landing */
.landing-hero { text-align: center; padding: 48px 0; }
.hero-subtitle { font-size: 1.125rem; color: var(--color-text-secondary); margin: 8px 0 32px; }
.hero-features { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; margin-bottom: 32px; text-align: left; }
.feature-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: 20px; }
.feature-card h3 { margin-bottom: 8px; font-size: 1rem; }
.feature-card p { font-size: 0.875rem; color: var(--color-text-secondary); }
.hero-actions { display: flex; gap: 12px; justify-content: center; }

/* Settings */
.settings-page { max-width: none; }
.settings-tabs { display: flex; gap: 0; margin-bottom: 24px; border-bottom: 2px solid var(--color-border); padding-bottom: 4px; justify-content: space-between; }
.tab-btn { background: none; border: none; padding: 8px 12px; font-family: var(--font-body); font-size: 0.875rem; font-weight: 500; color: var(--color-text-secondary); cursor: pointer; border-radius: var(--radius-sm) var(--radius-sm) 0 0; transition: all 0.15s; white-space: nowrap; }
.tab-btn:hover { color: var(--color-text); background: rgba(255,255,255,0.05); }
.tab-btn.active { color: var(--color-primary); border-bottom: 2px solid var(--color-primary); margin-bottom: -6px; }
.tab-content { display: none; }
.tab-content.active { display: block; }

.settings-form { margin: 16px 0; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.settings-form label { display: block; margin-bottom: 12px; font-size: 0.875rem; }
.settings-form input[type="text"],
.settings-form input[type="email"],
.settings-form input[type="password"],
.settings-form input[type="number"],
.settings-form select,
.form-select { width: 100%; padding: 8px 12px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-family: var(--font-body); font-size: 0.875rem; margin-top: 4px; background: var(--color-surface-alt); color: var(--color-text); }
.settings-form input:focus,
.settings-form select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.3); }

.setting-item { margin-bottom: 20px; padding: 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.toggle-label { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.toggle-label input[type="checkbox"] { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--color-primary); }
.help-text { font-size: 0.8125rem; color: var(--color-text-secondary); margin-top: 4px; }
.consent-info { font-size: 0.8125rem; color: var(--color-success); margin-top: 8px; margin-left: 30px; }

.account-card { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); margin-bottom: 8px; }
.account-info { display: flex; align-items: center; gap: 8px; }
.oauth-section { margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--color-border); }

.gdpr-rights { margin-top: 24px; padding: 20px; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); }
.gdpr-rights h3 { margin-bottom: 12px; }
.gdpr-rights ul { list-style: none; padding: 0; }
.gdpr-rights li { padding: 6px 0; font-size: 0.875rem; }
.gdpr-rights li strong { color: var(--color-text); }

/* Delete Account */
.delete-account-page { max-width: 600px; }
.warning-box { background: rgba(245, 158, 11, 0.12); border: 1px solid rgba(245, 158, 11, 0.3); border-radius: var(--radius-lg); padding: 20px; margin: 16px 0; }
.warning-box h2 { color: var(--color-warning); margin-bottom: 8px; }
.warning-box ul { margin-left: 20px; font-size: 0.875rem; }
.export-reminder { padding: 12px 16px; background: rgba(96, 165, 250, 0.12); border-radius: var(--radius-md); margin-bottom: 16px; font-size: 0.875rem; color: var(--color-info); }
.delete-form { margin-top: 24px; }
.delete-confirm-input { width: 200px; padding: 8px 12px; border: 2px solid var(--color-error); border-radius: var(--radius-md); font-family: var(--font-mono); margin: 8px 0 16px; display: block; background: var(--color-surface-alt); color: var(--color-text); }

/* Legal */
.legal-page { max-width: 800px; }
.legal-page section { margin-bottom: 24px; }
.legal-page h2 { margin-bottom: 8px; padding-top: 16px; border-top: 1px solid var(--color-border); }
.legal-page ul { margin-left: 20px; margin-top: 8px; }
.legal-page li { margin-bottom: 4px; font-size: 0.875rem; }
.legal-updated { font-size: 0.875rem; color: var(--color-text-muted); margin-bottom: 24px; }

/* Support / FAQ Accordion */
.support-page { max-width: 860px; }
.support-page > h1 { margin-bottom: 4px; }
.support-page .faq-intro {
    font-size: 0.9375rem;
    color: var(--color-text-secondary);
    margin-bottom: 36px;
    line-height: 1.6;
}
.faq-category { margin-bottom: 36px; }
.faq-category h2 {
    font-size: 1.125rem;
    color: var(--color-primary);
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(32, 201, 151, 0.2);
    border-top: none;
    display: flex;
    align-items: center;
    gap: 10px;
}
.faq-category h2 .cat-icon {
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    flex-shrink: 0;
}
.faq-category:nth-child(2) h2 .cat-icon { background: rgba(96, 165, 250, 0.12); }
.faq-category:nth-child(3) h2 .cat-icon { background: rgba(245, 158, 11, 0.12); }
.faq-category:nth-child(4) h2 .cat-icon { background: rgba(32, 201, 151, 0.12); }
.faq-category:nth-child(5) h2 .cat-icon { background: rgba(167, 139, 250, 0.12); }
.faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    margin-bottom: 8px;
    overflow: hidden;
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.faq-item:hover { border-color: rgba(255, 255, 255, 0.12); }
.faq-item[open] {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 1px rgba(32, 201, 151, 0.1), 0 4px 20px rgba(0, 0, 0, 0.15);
}
.faq-item summary {
    padding: 15px 18px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--color-text);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
    transition: background 0.15s ease;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::marker { display: none; content: ''; }
.faq-item summary::after {
    content: '';
    width: 7px;
    height: 7px;
    border-right: 2px solid var(--color-text-muted);
    border-bottom: 2px solid var(--color-text-muted);
    transform: rotate(-45deg);
    transition: transform 0.25s ease, border-color 0.25s ease;
    flex-shrink: 0;
    margin-left: 16px;
}
.faq-item[open] summary::after {
    transform: rotate(45deg);
    border-color: var(--color-primary);
}
.faq-item summary:hover { background: rgba(255, 255, 255, 0.025); }
.faq-answer {
    padding: 0 18px 18px;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
    line-height: 1.75;
    border-top: 1px solid var(--color-border);
    padding-top: 16px;
    margin: 0 12px;
}
.faq-answer p { margin-bottom: 10px; }
.faq-answer p:last-child { margin-bottom: 0; }
.faq-answer ul { margin-left: 20px; margin-top: 6px; margin-bottom: 10px; }
.faq-answer li { margin-bottom: 4px; }
.faq-answer a { color: var(--color-primary); text-decoration: none; font-weight: 500; }
.faq-answer a:hover { text-decoration: underline; }
.faq-answer code {
    background: rgba(255, 255, 255, 0.06);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8125rem;
}

/* Audit Log */
.audit-log-page .data-table td { font-size: 0.8125rem; }

/* Settings inline tables (exclusions etc.) */
.settings-page .data-table { table-layout: auto; }
.settings-page .data-table th, .settings-page .data-table td { width: auto; text-align: left; }

/* Search */
.search-input { padding: 8px 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-family: var(--font-body); font-size: 0.875rem; width: 260px; background: var(--color-surface-alt); color: var(--color-text); }
.search-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.3); }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--color-text-secondary); }

/* Table wrapper */
.receipts-table-wrapper { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow-x: auto; overflow-y: hidden; }

/* Receipt Detail Page */
.receipt-detail-page { max-width: 1100px; }
.back-link { font-size: 0.8125rem; color: var(--color-text-secondary); display: inline-block; margin-bottom: 4px; }
.back-link:hover { color: var(--color-primary); }

.detail-grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}
.detail-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
.detail-card h2 { font-size: 1rem; margin-bottom: 16px; color: var(--color-primary); }
.detail-card h3 { font-size: 0.875rem; margin: 16px 0 8px; color: var(--color-text-secondary); }

/* Extraction Card */
.extraction-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.extract-field { }
.extract-label { display: block; font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-text-muted); margin-bottom: 2px; }
.extract-value { display: block; font-size: 0.9375rem; color: var(--color-text); }
.extract-value.mono { font-family: var(--font-mono); font-size: 0.875rem; }
.extract-amount { font-size: 1.25rem; font-weight: 700; color: var(--color-primary); font-family: var(--font-mono); }
.extraction-meta { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--color-border); display: flex; align-items: center; gap: 8px; }

/* Meta Card */
.meta-list { }
.meta-item { display: flex; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--color-border); font-size: 0.8125rem; }
.meta-item:last-child { border-bottom: none; }
.meta-key { font-weight: 600; color: var(--color-text-secondary); min-width: 70px; flex-shrink: 0; }
.meta-val { color: var(--color-text); word-break: break-word; }

/* Attachments */
.attachments-section { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--color-border); }
.attachment-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    background: var(--color-surface-alt);
    border-radius: var(--radius-md);
    margin-bottom: 6px;
}
.att-icon { font-size: 1.25rem; }
.att-info { flex: 1; min-width: 0; }
.att-name { display: block; font-size: 0.8125rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-size { font-size: 0.75rem; color: var(--color-text-muted); font-family: var(--font-mono); }

/* Email Body */
.email-body-card { margin-bottom: 16px; }
.email-body-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.email-body-header h2 { margin-bottom: 0; }
.email-body-tabs { display: flex; gap: 4px; }
.email-tab {
    padding: 5px 14px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    background: var(--color-surface);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.email-tab:hover { border-color: var(--color-primary); color: var(--color-primary); }
.email-tab.active { background: var(--color-primary); color: #0A1633; border-color: var(--color-primary); }
.email-tab-content { display: none; }
.email-tab-content.active { display: block; }

.email-html-frame-wrapper {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: white;
}
.email-html-frame {
    width: 100%;
    min-height: 400px;
    border: none;
    display: block;
}
.email-text-content {
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 600px;
    overflow-y: auto;
    color: var(--color-text);
}
.email-no-content {
    padding: 32px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* PDF Preview */
.pdf-preview-card { margin-bottom: 16px; }
.pdf-preview-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pdf-preview-header h2 { margin: 0; }
.pdf-embed-wrapper {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.pdf-embed {
    width: 100%;
    height: 700px;
    border: none;
    display: block;
}

/* Print styles */
@media print {
    .main-nav, .main-footer, .header-actions, .back-link,
    .email-body-tabs, #toast-container { display: none !important; }
    .detail-grid { grid-template-columns: 1fr; }
    .detail-card { box-shadow: none; border: 1px solid #333; break-inside: avoid; }
    .email-html-frame { height: auto !important; min-height: 200px; }
}

/* Toast */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-md); font-size: 0.875rem; color: white; box-shadow: var(--shadow-lg); animation: toast-in 0.3s ease; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.toast-success { background: rgba(32, 201, 151, 0.85); }
.toast-error { background: rgba(239, 68, 68, 0.85); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
    backdrop-filter: blur(4px);
}
.modal-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-content { display: flex; flex-direction: column; max-height: 90vh; }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--color-border);
}
.modal-header h2 { font-size: 1.25rem; margin: 0; }
.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.modal-close:hover { color: var(--color-text); }
.modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--color-border);
    background: var(--color-surface-alt);
}

/* Scan Config */
.scan-section {
    margin-bottom: 20px;
}
.scan-label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 8px;
    color: var(--color-text);
}
.scan-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.scan-select:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.3); }
.scan-hint { font-size: 0.8125rem; color: var(--color-text-muted); margin-top: 6px; }
.scan-input {
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    width: 100%;
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.scan-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.3); }

/* Timeframe Presets */
.scan-timeframe-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.preset-btn {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 100px;
    background: var(--color-surface);
    font-family: var(--font-body);
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.preset-btn:hover { border-color: var(--color-primary); color: var(--color-primary); }
.preset-btn.active {
    background: var(--color-primary);
    color: #0A1633;
    border-color: var(--color-primary);
}

.scan-custom-dates { margin-top: 12px; }
.date-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.date-field label { display: block; font-size: 0.8125rem; color: var(--color-text-secondary); margin-bottom: 4px; }

/* Folder List */
.scan-folder-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface-alt);
}
.scan-folder-loading {
    padding: 16px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}
.folder-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
    transition: background 0.1s;
}
.folder-item:last-child { border-bottom: none; }
.folder-item:hover { background: rgba(255,255,255,0.04); }
.folder-item input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--color-primary); flex-shrink: 0; }
.folder-icon { font-size: 1rem; flex-shrink: 0; }
.folder-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tag {
    font-size: 0.6875rem;
    padding: 1px 6px;
    border-radius: 100px;
    background: var(--color-primary);
    color: #0A1633;
    font-weight: 500;
}
.folder-recommended { background: rgba(32, 201, 151, 0.06); }
.folder-actions { display: flex; gap: 6px; margin-top: 8px; }

/* Progress */
.progress-container { text-align: center; }
.progress-status {
    font-size: 0.9375rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--color-text);
    min-height: 1.4em;
    word-break: break-word;
}
.status-success { color: var(--color-success); }
.status-error { color: var(--color-error); }
.status-extracting { color: var(--color-info); }

.progress-bar-wrapper {
    width: 100%;
    height: 8px;
    background: var(--color-surface-alt);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 8px;
}
.progress-bar {
    height: 100%;
    background: var(--color-primary);
    border-radius: 100px;
    transition: width 0.5s ease;
}
.progress-bar-success { background: var(--color-success); }
.progress-bar-error { background: var(--color-error); }
.progress-bar-extracting { background: var(--color-info); }

.progress-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    margin-bottom: 20px;
}

.progress-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 20px;
}
.progress-stat { text-align: center; }
.progress-stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-primary);
}
.progress-stat-label {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}

.progress-log {
    text-align: left;
    max-height: 160px;
    overflow-y: auto;
    background: #1a1a1a;
    border-radius: var(--radius-md);
    padding: 12px;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    line-height: 1.6;
    color: #ccc;
}
.log-entry { padding: 1px 0; }
.log-entry .log-time { color: rgba(255,255,255,0.35); margin-right: 8px; }
.log-error { color: #EF4444; }

/* Ollama badge */
.badge-ollama { background: rgba(32, 201, 151, 0.15); color: var(--color-success); }

/* ==================== Statements Page ==================== */

/* Upload Zone */
.upload-section { margin-bottom: 16px; }
.upload-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    border: 2px dashed var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    cursor: pointer;
    transition: all 0.2s;
}
.upload-zone:hover { border-color: var(--color-primary); background: rgba(32, 201, 151, 0.04); }
.upload-zone.drag-over { border-color: var(--color-primary); background: rgba(32, 201, 151, 0.08); border-style: solid; }
.upload-zone-content { text-align: center; padding: 24px; }
.upload-icon { font-size: 2.5rem; margin-bottom: 8px; }
.upload-title { font-family: var(--font-heading); font-weight: 600; font-size: 1.125rem; margin-bottom: 4px; }
.upload-hint { font-size: 0.875rem; color: var(--color-text-secondary); margin-bottom: 4px; }
.upload-formats { font-size: 0.75rem; color: var(--color-text-muted); }

.upload-options {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.upload-file-info { display: flex; align-items: center; gap: 8px; }
.upload-filename { font-family: var(--font-mono); font-size: 0.875rem; color: var(--color-primary); font-weight: 500; }
.upload-form-row {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex: 1;
}
.upload-form-row label {
    flex: 1;
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
}
.upload-form-row input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    margin-top: 4px;
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.upload-form-row input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.3); }

.upload-progress {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
}
.upload-progress-bar { flex: 1; height: 6px; background: var(--color-surface-alt); border-radius: 100px; overflow: hidden; }
.upload-progress-fill { height: 100%; width: 100%; background: var(--color-primary); border-radius: 100px; animation: progress-pulse 1.5s ease-in-out infinite; }
@keyframes progress-pulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 1; } }
.upload-progress-text { font-size: 0.8125rem; color: var(--color-text-secondary); white-space: nowrap; }

/* Statement Table (auto layout, different from dashboard) */
.stmt-table { table-layout: auto; }
.stmt-table th, .stmt-table td { width: auto; text-align: left; }
.stmt-table td.date-range { font-family: var(--font-mono); font-size: 0.8125rem; white-space: nowrap; }

/* Match Progress Mini (in table) */
.match-progress-mini {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 100px;
}
.match-progress-bar-mini {
    display: inline-block;
    width: 50px;
    height: 6px;
    background: var(--color-surface-alt);
    border-radius: 100px;
    position: relative;
    overflow: hidden;
}
.match-progress-bar-mini::after {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: var(--pct, 0%);
    background: var(--color-success);
    border-radius: 100px;
    transition: width 0.3s;
}
.match-progress-text-mini { font-family: var(--font-mono); font-size: 0.75rem; color: var(--color-text-secondary); }

/* Statement Detail */
.stmt-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.stmt-date-range { font-family: var(--font-mono); font-size: 0.8125rem; color: var(--color-text-secondary); }

/* Match Progress Bar Large */
.match-progress-bar-large {
    width: 100%;
    height: 10px;
    background: var(--color-surface-alt);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: 6px;
}
.match-progress-fill-large {
    height: 100%;
    background: linear-gradient(90deg, var(--color-success), #38d9a9);
    border-radius: 100px;
    transition: width 0.5s ease;
    min-width: 2px;
}

/* Transaction Filter Tabs */
.txn-filter-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 12px;
}
.txn-filter-tab {
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text-muted);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    text-decoration: none;
    transition: all 0.15s;
}
.txn-filter-tab:hover { background: rgba(255,255,255,0.05); color: var(--color-text); }
.txn-filter-tab.active {
    background: var(--color-primary);
    color: #0A1633;
    border-color: var(--color-primary);
}

/* Transaction Table — full width, horizontally scrollable */
.txn-table { table-layout: auto; width: max-content; min-width: 100%; }
.txn-table th, .txn-table td { width: auto; text-align: left; white-space: nowrap; padding: 8px 12px; }
.txn-table .txn-merchant { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }

/* Match Badges */
.badge-matched { background: rgba(32, 201, 151, 0.15); color: var(--color-success); }
.badge-unmatched { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.badge-ai-suggested { background: rgba(96, 165, 250, 0.12); color: #60A5FA; border: 1px solid rgba(96, 165, 250, 0.3); }

/* Button Variants */
.btn-accent {
    background: var(--color-accent);
    color: #0A1633;
    border: none;
}
.btn-accent:hover { background: var(--color-accent-light); }
.btn-success {
    background: var(--color-success);
    color: #0A1633;
    border: none;
}
.btn-success:hover { background: #38d9a9; }

/* Confidence Indicator */
.confidence-col { min-width: 90px; }
.confidence-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}
.confidence-indicator .confidence-bar {
    display: block;
    padding: 0;
    border-radius: 4px;
    width: 48px;
    height: 6px;
    background: var(--color-surface-alt);
    overflow: hidden;
}
.confidence-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}
.conf-high { background: var(--color-success); }
.conf-medium { background: var(--color-warning); }
.conf-low { background: var(--color-error); }
.confidence-label {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    color: var(--color-text-secondary);
    white-space: nowrap;
}

/* AI Bulk Action Bar */
#ai-bulk-bar.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(17, 29, 62, 0.80);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(96, 165, 250, 0.5);
    border-radius: var(--radius-md);
    padding: 12px 20px;
    margin-bottom: 16px;
    animation: slide-down 0.3s ease;
}
@keyframes slide-down { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }
.bulk-action-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: #60A5FA;
    font-size: 0.875rem;
}
.bulk-action-icon { font-size: 1.25rem; }
.bulk-action-buttons { display: flex; gap: 8px; }

/* AI Match Progress Bar */
.ai-progress-bar {
    background: rgba(96, 165, 250, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.3);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
    animation: slide-down 0.3s ease;
}
.ai-progress-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}
.ai-progress-icon { font-size: 1.25rem; }
.ai-progress-text {
    font-weight: 500;
    color: #60A5FA;
    font-size: 0.875rem;
    flex: 1;
}
.ai-progress-provider {
    font-size: 0.75rem;
    color: #60A5FA;
    background: rgba(96, 165, 250, 0.15);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.ai-progress-track {
    width: 100%;
    height: 10px;
    background: rgba(96, 165, 250, 0.15);
    border-radius: 5px;
    overflow: hidden;
}
.ai-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6, #60A5FA);
    border-radius: 5px;
    transition: width 0.4s ease;
}
.ai-progress-details {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.75rem;
    color: #60A5FA;
    font-weight: 500;
}

/* Scanning Button State */
.btn-scanning {
    position: relative;
    pointer-events: none;
    opacity: 0.95;
    animation: btn-pulse 2s ease-in-out infinite;
}
.btn-scanning::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(10, 22, 51, 0.3);
    border-top-color: #0A1633;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    animation: btn-spin 0.8s linear infinite;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}
@keyframes btn-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(245, 190, 50, 0.4); }
    50% { box-shadow: 0 0 12px 4px rgba(245, 190, 50, 0.25); }
}

/* AI Email Search Progress Panel */
.ai-email-progress {
    background: rgba(245, 190, 50, 0.08);
    border: 1px solid rgba(245, 190, 50, 0.3);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    margin-bottom: 16px;
    animation: slide-down 0.3s ease;
}
.ai-email-progress-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}
.ai-email-progress-spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(245, 190, 50, 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: btn-spin 0.8s linear infinite;
    flex-shrink: 0;
}
.ai-email-progress-title {
    font-weight: 600;
    color: var(--color-accent);
    font-size: 0.9rem;
}
.ai-email-progress-step {
    font-size: 0.825rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    min-height: 1.2em;
}
.ai-email-progress-track {
    width: 100%;
    height: 6px;
    background: rgba(245, 190, 50, 0.12);
    border-radius: 3px;
    overflow: hidden;
}
.ai-email-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
    border-radius: 3px;
    animation: indeterminate-bar 1.8s ease-in-out infinite;
    width: 40%;
}
@keyframes indeterminate-bar {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(150%); }
    100% { transform: translateX(350%); }
}

/* Matched Receipt Info */
.matched-receipt-info {
    font-size: 0.8125rem;
    color: var(--color-primary);
    max-width: 300px;
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.matched-receipt-info:hover { text-decoration: underline; }
.text-muted { color: var(--color-text-muted); }

/* Receipt Picker Modal */
.receipt-picker-box {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.picker-search { padding: 0 0 16px; }
.picker-search input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: 0.875rem;
    background: var(--color-surface-alt);
    color: var(--color-text);
}
.picker-search input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.3); }

.picker-list {
    max-height: 50vh;
    overflow-y: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
}
.picker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--color-border);
    cursor: pointer;
    transition: background 0.1s;
}
.picker-item:last-child { border-bottom: none; }
.picker-item:hover { background: rgba(32, 201, 151, 0.06); }
.picker-item-info { flex: 1; min-width: 0; }
.picker-item-info strong { display: block; font-size: 0.875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item-details { display: block; font-size: 0.75rem; color: var(--color-text-muted); margin-top: 2px; }
.picker-item-amount { font-family: var(--font-mono); font-weight: 600; font-size: 0.875rem; color: var(--color-primary); white-space: nowrap; margin-left: 12px; }

.picker-loading, .picker-empty {
    padding: 24px;
    text-align: center;
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

/* ==================== Email Accounts Page ==================== */

/* Accounts Grid */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

/* Account Card */
.email-account-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.15s;
}
.email-account-card:hover {
    box-shadow: var(--shadow-md);
}

/* Account Header */
.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.account-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}
.account-email {
    font-weight: 600;
    font-size: 0.9375rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Status Dot */
.account-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--color-text-muted);
}
.account-status-dot.active {
    background: var(--color-success);
}
.account-status-dot.inactive {
    background: var(--color-text-muted);
}

/* Account Meta */
.account-meta {
    margin-bottom: 16px;
}
.account-meta-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.8125rem;
}
.account-meta-label {
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.account-meta-value {
    color: var(--color-text-secondary);
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-left: 8px;
}

/* Account Actions */
.account-actions {
    display: flex;
    gap: 6px;
    padding-top: 12px;
    border-top: 1px solid var(--color-border);
}

/* Multi-progress in Scan All Modal */
.multi-progress-overall {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border);
}

.multi-progress-list {
    max-height: 300px;
    overflow-y: auto;
}

.account-progress-row {
    display: grid;
    grid-template-columns: 140px 1fr 180px;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--color-border);
}
.account-progress-row:last-child {
    border-bottom: none;
}

.account-progress-email {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--color-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-progress-bar-wrapper {
    min-width: 0;
}
.account-progress-bar-wrapper .progress-bar-wrapper {
    height: 6px;
    margin-bottom: 0;
}

.account-progress-status {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: right;
}

/* Add Account Form */
.add-account-form .form-group {
    margin-bottom: 16px;
}
.add-account-form .form-group:last-child {
    margin-bottom: 0;
}
.add-account-form label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
}

/* Responsive */
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .hero-features { grid-template-columns: 1fr; }
    .stats-row { flex-direction: column; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .nav-links { display: none; }
    .modal-overlay { padding: 8px; }
    .modal-container { max-height: 95vh; }
    .scan-timeframe-presets { gap: 4px; }
    .preset-btn { padding: 5px 10px; font-size: 0.75rem; }
    .date-row { grid-template-columns: 1fr; }
    .progress-stats { gap: 16px; }
    .accounts-grid { grid-template-columns: 1fr; }
    .account-progress-row { grid-template-columns: 1fr; gap: 4px; }
    .account-progress-status { text-align: left; }
}

/* ==================== Filter Bar ==================== */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    padding: 16px;
    background: var(--color-surface-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.filter-bar .filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-bar .filter-group.filter-search {
    flex: 1;
    min-width: 200px;
}

.filter-bar .filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.filter-bar input[type="text"],
.filter-bar input[type="number"],
.filter-bar input[type="date"],
.filter-bar select {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.85rem;
    background: var(--color-surface);
    color: var(--color-text);
    min-width: 0;
}

.filter-bar input[type="number"] {
    width: 90px;
}

.filter-bar input[type="date"] {
    width: 140px;
}

.filter-bar select {
    width: 130px;
}

.filter-bar input:focus,
.filter-bar select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px rgba(32, 201, 151, 0.3);
}

.filter-bar .filter-actions {
    display: flex;
    gap: 6px;
    align-items: flex-end;
}

.filter-bar .btn-filter {
    padding: 6px 14px;
    font-size: 0.85rem;
    background: var(--color-primary);
    color: #0A1633;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
    font-weight: 500;
}

.filter-bar .btn-filter:hover {
    background: var(--color-primary-light);
}

.filter-bar .btn-clear {
    padding: 6px 12px;
    font-size: 0.85rem;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-body);
}

.filter-bar .btn-clear:hover {
    background: rgba(255,255,255,0.05);
    color: var(--color-text);
}

.filter-active-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-accent);
    color: #0A1633;
    font-size: 0.7rem;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    margin-left: 4px;
}

.filter-no-results {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-muted);
}

.filter-no-results p {
    margin-bottom: 12px;
    font-size: 1rem;
}

/* Range group: two inputs side by side */
.filter-range {
    display: flex;
    gap: 4px;
    align-items: center;
}

.filter-range .range-sep {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column;
    }
    .filter-bar .filter-group {
        width: 100%;
    }
    .filter-bar input[type="date"],
    .filter-bar input[type="number"],
    .filter-bar select {
        width: 100%;
    }
}
