/* ========================================
   MedTrack Pro — Medical Expense Tracker
   Professional Stylesheet
   ======================================== */

:root {
    --primary: #0d9488;
    --primary-dark: #0f766e;
    --primary-light: #ccfbf1;
    --primary-subtle: #f0fdfa;

    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-subtle: #fef2f2;

    --warning: #f59e0b;
    --warning-subtle: #fffbeb;

    --success: #10b981;
    --success-subtle: #ecfdf5;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    /* Dark mode colors (default to light) */
    --bg-body: linear-gradient(135deg, #f0fdfa 0%, #f8fafc 50%, #f1f5f9 100%);
    --bg-page: #ffffff;
    --text-primary: var(--gray-900);
    --text-secondary: var(--gray-700);
    --text-muted: var(--gray-500);
    --border-color: var(--gray-200);
    --card-bg: white;
    --card-header-bg: linear-gradient(to right, white, var(--gray-50));
    --input-bg: white;
    --table-row-hover: var(--primary-subtle);
}

/* Dark Mode */
body.dark-mode {
    --bg-body: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    --bg-page: #0f172a;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --card-bg: #1e293b;
    --card-header-bg: linear-gradient(to right, #1e293b, #0f172a);
    --input-bg: #0f172a;
    --table-row-hover: rgba(13, 148, 136, 0.15);
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-body);
    color: var(--text-secondary);
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   Layout
   ======================================== */

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 24px 32px 32px;
}

@media (max-width: 768px) {
    .app-container {
        padding: 16px;
    }
}

/* ========================================
   Header
   ======================================== */

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 16px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    width: 52px;
    height: 52px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    box-shadow: var(--shadow-md);
}

.brand-text h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.brand-text p {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Dark Mode Toggle */
.dark-mode-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-bg);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.dark-mode-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.dark-mode-toggle i {
    font-size: 1rem;
    transition: var(--transition);
}

body.dark-mode .dark-mode-toggle .fa-sun { display: none; }
body:not(.dark-mode) .dark-mode-toggle .fa-moon { display: none; }

body.dark-mode .dark-mode-toggle {
    background: var(--gray-800);
    border-color: var(--gray-600);
    color: var(--gray-300);
}

body.dark-mode .dark-mode-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.tax-year-selector {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tax-year-selector label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.tax-year-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tax-year-row select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--input-bg);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    min-width: 100px;
    transition: var(--transition);
}

.tax-year-row select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

body.dark-mode .tax-year-row select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.custom-year-input {
    display: flex;
    align-items: center;
    gap: 4px;
}

.custom-year-input input {
    width: 70px;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--input-bg);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    transition: var(--transition);
    -moz-appearance: textfield;
}

.custom-year-input input::-webkit-outer-spin-button,
.custom-year-input input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.custom-year-input input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.custom-year-input input::placeholder {
    color: var(--text-muted);
    font-weight: 500;
}

.custom-year-input button {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.custom-year-input button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.custom-year-input button:active {
    transform: translateY(0);
}

/* ========================================
   Cards
   ======================================== */

.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-header-bg);
}

.card-header h2 {
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h2 i {
    color: var(--primary);
    font-size: 1.125rem;
}

/* ========================================
   Summary Cards
   ======================================== */

.summary-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 28px;
}

.summary-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Summary card distinct colors */
.summary-card-total {
    border-left: 4px solid var(--primary);
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.summary-card-total:hover {
    background: rgba(13, 148, 136, 0.06);
    transform: translateY(-2px);
}

body.dark-mode .summary-card-total:hover {
    background: rgba(94, 234, 212, 0.08);
}

.summary-card-net {
    border-left: 4px solid #10b981;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.summary-card-net:hover {
    background: rgba(16, 163, 74, 0.06);
    transform: translateY(-2px);
}

body.dark-mode .summary-card-net:hover {
    background: rgba(74, 222, 128, 0.08);
}

.summary-card-insurance {
    border-left: 4px solid #0284c7;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.summary-card-insurance:hover {
    background: rgba(2, 132, 199, 0.06);
    transform: translateY(-2px);
}

body.dark-mode .summary-card-insurance:hover {
    background: rgba(56, 189, 248, 0.08);
}

.summary-card-count {
    border-left: 4px solid #8b5cf6;
    transition: background 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.summary-card-count:hover {
    background: rgba(139, 92, 246, 0.06);
    transform: translateY(-2px);
}

body.dark-mode .summary-card-count:hover {
    background: rgba(167, 139, 250, 0.08);
}

.summary-icon.total {
    background: var(--primary-subtle);
    color: var(--primary);
}

.summary-icon.count {
    background: #f5f3ff;
    color: #8b5cf6;
}

body.dark-mode .summary-icon.count {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.summary-icon.max {
    background: var(--warning-subtle);
    color: var(--warning);
}

body.dark-mode .summary-icon.max {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.summary-icon.avg {
    background: #f5f3ff;
    color: #8b5cf6;
}

body.dark-mode .summary-icon.avg {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

.summary-icon.net {
    background: #dcfce7;
    color: #16a34a;
}

body.dark-mode .summary-icon.net {
    background: rgba(22, 163, 74, 0.15);
    color: #4ade80;
}

.summary-icon.insurance {
    background: #e0f2fe;
    color: #0284c7;
}

body.dark-mode .summary-icon.insurance {
    background: rgba(2, 132, 199, 0.15);
    color: #38bdf8;
}

/* Insurance and Net columns in table */
.insurance-col {
    color: var(--primary) !important;
}

body.dark-mode .insurance-col {
    color: #5eead4 !important;
}

.net-col {
    color: var(--success) !important;
    font-weight: 700;
}

body.dark-mode .net-col {
    color: #4ade80 !important;
}

.summary-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.summary-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 2px;
}

.summary-value {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (max-width: 1024px) {
    .summary-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

/* ========================================
   Main Content Grid
   ======================================== */

.main-content {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 24px;
    align-items: start;
}

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

/* ========================================
   Form Section
   ======================================== */

.form-section {
    position: sticky;
    top: 24px;
}

@media (max-width: 1024px) {
    .form-section {
        position: static;
    }
}

.expense-form {
    padding: 20px 24px 24px;
}

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

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

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.required {
    color: var(--danger);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--input-bg);
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

body.dark-mode .form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* File Upload */
.file-upload {
    position: relative;
}

.file-upload input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

.file-upload-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.875rem;
    transition: var(--transition);
    background: var(--gray-50);
}

body.dark-mode .file-upload-label {
    background: var(--gray-800);
}

.file-upload-label:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-subtle);
}

.file-upload-label i {
    font-size: 1.125rem;
}

.file-upload.has-file .file-upload-label {
    border-color: var(--success);
    border-style: solid;
    color: var(--success);
    background: var(--success-subtle);
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(13, 148, 136, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

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

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--gray-100);
    border-color: var(--gray-400);
}

body.dark-mode .btn-secondary:hover {
    background: var(--gray-700);
}

.btn-outline {
    background: var(--card-bg);
    color: var(--primary);
    border: 1px solid var(--primary);
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-outline:hover {
    background: var(--primary-subtle);
}

body.dark-mode .btn-outline {
    background: var(--gray-800);
}

body.dark-mode .btn-outline:hover {
    background: rgba(13, 148, 136, 0.15);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.35);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

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

body.dark-mode .btn-text:hover {
    background: rgba(13, 148, 136, 0.2);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    background: var(--gray-100);
    color: var(--text-secondary);
}

body.dark-mode .btn-icon:hover {
    background: var(--gray-700);
}

.btn-icon.btn-delete:hover {
    background: var(--danger-subtle);
    color: var(--danger);
}

/* ========================================
   List Section
   ======================================== */

.list-section {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* ========================================
   Breakdown Card
   ======================================== */

.breakdown-card {
    padding: 0;
}

.breakdown-list {
    padding: 16px 24px 20px;
}

.empty-breakdown {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
    padding: 20px 0;
}

body.dark-mode .empty-breakdown {
    color: #94a3b8;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.breakdown-bar-track {
    flex: 1;
    height: 8px;
    background: var(--gray-200);
    border-radius: 4px;
    overflow: hidden;
    min-width: 60px;
}

body.dark-mode .breakdown-bar-track {
    background: var(--gray-700);
}

.breakdown-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.breakdown-category {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    min-width: 140px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body.dark-mode .breakdown-category {
    color: #e2e8f0;
}

.breakdown-amount {
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    min-width: 90px;
    text-align: right;
}

body.dark-mode .breakdown-amount {
    color: #e2e8f0;
}

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

/* ========================================
   Table Card
   ======================================== */

.table-card {
    padding: 0;
}

.table-counter {
    padding: 12px 24px 0;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

body.dark-mode .table-counter {
    color: #94a3b8;
}

.table-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.load-more-btn {
    flex: 1;
    min-width: 220px;
    max-width: 400px;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--card-bg);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.load-more-btn:hover {
    background: var(--primary-subtle);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
}

body.dark-mode .load-more-btn {
    background: var(--gray-800);
    border-color: var(--primary);
    color: #5eead4;
}

body.dark-mode .load-more-btn:hover {
    background: rgba(13, 148, 136, 0.15);
}

.show-all-btn {
    flex: 0 0 auto;
    padding: 12px 20px;
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--card-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.show-all-btn:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--primary-subtle);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.15);
}

body.dark-mode .show-all-btn {
    background: var(--gray-800);
    border-color: var(--gray-600);
    color: #94a3b8;
}

body.dark-mode .show-all-btn:hover {
    background: rgba(13, 148, 136, 0.15);
    border-color: var(--primary);
    color: #5eead4;
}

.table-controls {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.date-range-inputs {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range-inputs input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--input-bg);
    transition: var(--transition);
}

.date-range-inputs input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

body.dark-mode .date-range-inputs input {
    background-color: var(--input-bg);
    color: var(--text-primary);
}

.date-range-separator {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.search-box {
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 0.875rem;
    pointer-events: none;
}

.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    width: 220px;
    color: var(--text-primary);
    background: var(--input-bg);
    transition: var(--transition);
}

.search-box input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
    width: 260px;
}

.table-controls select {
    padding: 8px 32px 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--input-bg);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    cursor: pointer;
    transition: var(--transition);
}

body.dark-mode .table-controls select {
    background-color: var(--input-bg);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
}

body.dark-mode .search-box input {
    background-color: var(--input-bg);
}

.table-controls select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.table-wrapper {
    overflow-x: auto;
}

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

.expense-table thead th {
    padding: 14px 20px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    background: var(--gray-100);
    white-space: nowrap;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

body.dark-mode .expense-table thead th {
    background: var(--gray-800);
    color: #e2e8f0;
}

.expense-table thead th.sortable {
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

.expense-table thead th.sortable:hover {
    color: var(--primary);
    background: var(--primary-subtle);
}

body.dark-mode .expense-table thead th.sortable:hover {
    background: rgba(13, 148, 136, 0.2);
}

.expense-table thead th.sortable i {
    margin-left: 6px;
    font-size: 0.625rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.expense-table thead th.sortable:hover i {
    color: var(--primary);
}

.expense-table thead th.sorted {
    color: var(--primary);
}

.expense-table thead th.sorted i {
    color: var(--primary);
}

.expense-table tbody tr {
    transition: var(--transition);
}

.expense-table tbody tr:hover {
    background: var(--table-row-hover);
}

.expense-table tbody td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    vertical-align: middle;
}

.expense-table tbody td.amount {
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.expense-table tbody td .category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.category-badge i {
    font-size: 0.625rem;
}

.text-right {
    text-align: right !important;
}

.text-center {
    text-align: center !important;
}

.receipt-icon {
    color: var(--primary);
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
}

.receipt-icon:hover {
    color: var(--primary-dark);
    transform: scale(1.15);
}

.receipt-missing {
    color: var(--text-muted);
    font-size: 1rem;
}

.empty-row td {
    padding: 48px 20px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    color: var(--text-muted);
}

.empty-state p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

body.dark-mode .empty-state p {
    color: #cbd5e1;
}

.empty-state span {
    font-size: 0.875rem;
}

/* ========================================
   Modal
   ======================================== */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-slow);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-overlay.hidden {
    display: none;
}

.modal {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 420px;
    width: 90%;
    transform: scale(0.95) translateY(10px);
    transition: var(--transition-slow);
    border: 1px solid var(--border-color);
}

.modal-wide {
    max-width: 560px;
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 20px 24px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--warning);
    font-size: 1.25rem;
}

.modal-body {
    padding: 16px 24px;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.import-summary {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.import-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
}

.import-stat.success {
    background: var(--success-subtle);
    color: var(--success);
}

.import-stat.warning {
    background: var(--warning-subtle);
    color: #b45309;
}

body.dark-mode .import-stat.warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.import-stat.info {
    background: var(--primary-subtle);
    color: var(--primary-dark);
}

body.dark-mode .import-stat.info {
    background: rgba(13, 148, 136, 0.15);
    color: #5eead4;
}

.import-preview {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-top: 8px;
}

.import-preview table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.import-preview thead th {
    background: var(--gray-100);
    padding: 8px 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
}

body.dark-mode .import-preview thead th {
    background: var(--gray-700);
}

.import-preview tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

body.dark-mode .import-preview tbody td {
    background: var(--gray-800);
}

.import-preview tbody tr:last-child td {
    border-bottom: none;
}

.import-preview .skip-row td {
    color: var(--text-muted);
    text-decoration: line-through;
    background: var(--gray-100);
}

body.dark-mode .import-preview .skip-row td {
    background: var(--gray-700);
}

/* ========================================
   Toast
   ======================================== */

.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    min-width: 280px;
}

.toast.show {
    transform: translateX(0);
}

.toast.toast-success {
    border-left-color: var(--success);
}

.toast.toast-error {
    border-left-color: var(--danger);
}

.toast i {
    font-size: 1.125rem;
    flex-shrink: 0;
}

.toast.toast-success i {
    color: var(--success);
}

.toast.toast-error i {
    color: var(--danger);
}

.toast.toast-warning {
    border-left-color: var(--warning);
}

.toast.toast-warning i {
    color: var(--warning);
}

/* ========================================
   Footer
   ======================================== */

.app-footer {
    margin-top: 32px;
    padding: 16px 24px;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: var(--danger-subtle);
    text-align: center;
}

.app-footer p {
    font-size: 0.875rem;
    color: var(--danger);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.app-footer p i {
    font-size: 1rem;
}

body.dark-mode .app-footer {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.4);
}

body.dark-mode .app-footer p {
    color: #f87171;
}

/* ========================================
   Auth Overlay
   ======================================== */

.auth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 20px;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.auth-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    max-width: 420px;
    width: 100%;
    padding: 32px;
    animation: authSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes authSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.auth-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
}

.auth-logo i {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.auth-logo span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.025em;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

.auth-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
}

.auth-tab:hover {
    color: var(--text-secondary);
    background: var(--gray-100);
}

body.dark-mode .auth-tab:hover {
    background: var(--gray-800);
}

.auth-tab.active {
    color: var(--primary);
    background: var(--primary-subtle);
}

body.dark-mode .auth-tab.active {
    background: rgba(13, 148, 136, 0.15);
    color: #5eead4;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-form-group label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.auth-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--input-bg);
    transition: var(--transition);
}

.auth-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.1);
}

.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input-wrap .auth-input {
    padding-right: 44px;
}

.auth-toggle-pass {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 0.875rem;
}

.auth-toggle-pass:hover {
    background: var(--gray-100);
    color: var(--text-secondary);
}

body.dark-mode .auth-toggle-pass:hover {
    background: var(--gray-700);
}

.auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.auth-btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(13, 148, 136, 0.3);
}

.auth-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(13, 148, 136, 0.35);
}

.auth-welcome {
    text-align: center;
    margin-bottom: 20px;
}

.auth-welcome h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-welcome-user {
    font-size: 1rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-welcome-user i {
    color: var(--primary);
}

.auth-switch {
    text-align: center;
    margin-top: 12px;
}

.auth-note {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
    margin-top: 20px;
}

.auth-error {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--danger-subtle);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    color: var(--danger);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 16px;
}

.auth-error.hidden {
    display: none;
}

.auth-error i {
    flex-shrink: 0;
}

/* User Badge */
.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 14px;
    background: var(--primary-subtle);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary-dark);
}

.user-badge i {
    font-size: 0.875rem;
}

body.dark-mode .user-badge {
    background: rgba(13, 148, 136, 0.15);
    border-color: var(--primary);
    color: #5eead4;
}

@media (max-width: 768px) {
    .user-badge {
        padding: 6px 10px;
        font-size: 0.8125rem;
    }
}

/* ========================================
   Utilities
   ======================================== */

.hidden {
    display: none !important;
}

.hidden-input {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
}

/* Visually hidden but available to screen readers */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.auth-error.visible {
    display: flex;
}

.auth-overlay.fade-out {
    opacity: 0;
}

.receipt-remove {
    margin-left: 8px;
}

/* Category color classes for CSP-compliant styling */
.cat-icon-doctor-visit { color: #0d9488; }
.cat-icon-prescription { color: #3b82f6; }
.cat-icon-hospital { color: #ef4444; }
.cat-icon-dental { color: #8b5cf6; }
.cat-icon-vision { color: #06b6d4; }
.cat-icon-mental-health { color: #ec4899; }
.cat-icon-physical-therapy { color: #f59e0b; }
.cat-icon-lab-imaging { color: #6366f1; }
.cat-icon-insurance-premium { color: #10b981; }
.cat-icon-medical-supplies { color: #84cc16; }
.cat-icon-transportation { color: #f97316; }
.cat-icon-other { color: #64748b; }

body.dark-mode .cat-icon-doctor-visit { color: #5eead4; }
body.dark-mode .cat-icon-prescription { color: #60a5fa; }
body.dark-mode .cat-icon-hospital { color: #f87171; }
body.dark-mode .cat-icon-dental { color: #a78bfa; }
body.dark-mode .cat-icon-vision { color: #22d3ee; }
body.dark-mode .cat-icon-mental-health { color: #f472b6; }
body.dark-mode .cat-icon-physical-therapy { color: #fbbf24; }
body.dark-mode .cat-icon-lab-imaging { color: #818cf8; }
body.dark-mode .cat-icon-insurance-premium { color: #34d399; }
body.dark-mode .cat-icon-medical-supplies { color: #a3e635; }
body.dark-mode .cat-icon-transportation { color: #fb923c; }
body.dark-mode .cat-icon-other { color: #94a3b8; }

.cat-bar-doctor-visit { background: #0d9488; }
.cat-bar-prescription { background: #3b82f6; }
.cat-bar-hospital { background: #ef4444; }
.cat-bar-dental { background: #8b5cf6; }
.cat-bar-vision { background: #06b6d4; }
.cat-bar-mental-health { background: #ec4899; }
.cat-bar-physical-therapy { background: #f59e0b; }
.cat-bar-lab-imaging { background: #6366f1; }
.cat-bar-insurance-premium { background: #10b981; }
.cat-bar-medical-supplies { background: #84cc16; }
.cat-bar-transportation { background: #f97316; }
.cat-bar-other { background: #64748b; }

.cat-badge-doctor-visit { background: #0d948815; color: #0d9488; }
.cat-badge-prescription { background: #3b82f615; color: #3b82f6; }
.cat-badge-hospital { background: #ef444415; color: #ef4444; }
.cat-badge-dental { background: #8b5cf615; color: #8b5cf6; }
.cat-badge-vision { background: #06b6d415; color: #06b6d4; }
.cat-badge-mental-health { background: #ec489915; color: #ec4899; }
.cat-badge-physical-therapy { background: #f59e0b15; color: #f59e0b; }
.cat-badge-lab-imaging { background: #6366f115; color: #6366f1; }
.cat-badge-insurance-premium { background: #10b98115; color: #10b981; }
.cat-badge-medical-supplies { background: #84cc1615; color: #84cc16; }
.cat-badge-transportation { background: #f9731615; color: #f97316; }
.cat-badge-other { background: #64748b15; color: #64748b; }

body.dark-mode .cat-badge-doctor-visit { background: #0d948820; color: #5eead4; }
body.dark-mode .cat-badge-prescription { background: #3b82f620; color: #60a5fa; }
body.dark-mode .cat-badge-hospital { background: #ef444420; color: #f87171; }
body.dark-mode .cat-badge-dental { background: #8b5cf620; color: #a78bfa; }
body.dark-mode .cat-badge-vision { background: #06b6d420; color: #22d3ee; }
body.dark-mode .cat-badge-mental-health { background: #ec489920; color: #f472b6; }
body.dark-mode .cat-badge-physical-therapy { background: #f59e0b20; color: #fbbf24; }
body.dark-mode .cat-badge-lab-imaging { background: #6366f120; color: #818cf8; }
body.dark-mode .cat-badge-insurance-premium { background: #10b98120; color: #34d399; }
body.dark-mode .cat-badge-medical-supplies { background: #84cc1620; color: #a3e635; }
body.dark-mode .cat-badge-transportation { background: #f9731620; color: #fb923c; }
body.dark-mode .cat-badge-other { background: #64748b20; color: #94a3b8; }

/* ========================================
   Bulk Selection — checkbox column + action bar
   ======================================== */

.checkbox-cell {
    width: 36px;
    padding: 0 8px !important;
    text-align: center !important;
    vertical-align: middle !important;
}

.expense-table thead th.checkbox-cell {
    background: var(--gray-100);
}

body.dark-mode .expense-table thead th.checkbox-cell {
    background: var(--gray-800);
}

.checkbox-cell input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
    margin: 0;
    vertical-align: middle;
}

.checkbox-cell input[type="checkbox"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 3px;
}

.row-selected {
    background: var(--primary-subtle);
}

.expense-table tbody tr.row-selected:hover {
    background: var(--primary-subtle);
}

body.dark-mode .row-selected {
    background: rgba(13, 148, 136, 0.18);
}

body.dark-mode .expense-table tbody tr.row-selected:hover {
    background: rgba(13, 148, 136, 0.18);
}

.bulk-action-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    background: linear-gradient(135deg, rgba(2, 132, 199, 0.10) 0%, rgba(13, 148, 136, 0.10) 100%);
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    animation: bulkBarSlide 0.25s ease-out;
}

body.dark-mode .bulk-action-bar {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.12) 0%, rgba(13, 148, 136, 0.16) 100%);
    border-color: rgba(148, 163, 184, 0.2);
}

@keyframes bulkBarSlide {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bulk-action-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.bulk-action-info i {
    color: var(--primary);
    font-size: 1rem;
}

.bulk-action-info strong {
    color: var(--text-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 1ch;
}

.bulk-action-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-action-btn {
    padding: 8px 14px;
    font-size: 0.8125rem;
}

.bulk-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

@media print {
    .checkbox-cell,
    .bulk-action-bar,
    .row-selected {
        background: none !important;
    }

    .row-checkbox {
        display: none !important;
    }
}

@media (max-width: 600px) {
    .bulk-action-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .bulk-action-buttons {
        justify-content: stretch;
    }

    .bulk-action-btn {
        flex: 1;
    }
}

/* ========================================
   Insurance Status Overview Card
   ======================================== */

.status-overview-card {
    margin-bottom: 24px;
}

.status-overview-header {
    gap: 12px;
}

.status-overview-header h2 i {
    color: #6366f1;
}

.status-overview-subtitle {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.status-overview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
}

.status-overview-tile {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-right: 1px solid var(--border-color);
    transition: background 0.2s ease;
    position: relative;
}

.status-overview-tile:last-child {
    border-right: none;
}

.status-overview-tile:hover {
    background: var(--gray-50);
}

body.dark-mode .status-overview-tile:hover {
    background: rgba(148, 163, 184, 0.06);
}

.status-overview-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.status-overview-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 2px;
}

.status-overview-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.status-overview-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tile tooltips — subtitle text shown on hover/focus instead of inline */
.status-overview-tile[data-tooltip] {
    cursor: pointer;
}

.status-overview-tile[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: 0.01em;
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
    z-index: 30;
}

.status-overview-tile[data-tooltip]::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 9px);
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 9px;
    height: 9px;
    background: #0f172a;
    border-radius: 2px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.18s ease, visibility 0.18s;
    z-index: 30;
}

.status-overview-tile[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.status-overview-tile[data-tooltip]:hover::before {
    opacity: 1;
    visibility: visible;
}

body.dark-mode .status-overview-tile[data-tooltip]::after {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .status-overview-tile[data-tooltip]::before {
    background: #334155;
}

/* Clickable tiles — quick-filter active state */
.status-overview-tile[role="button"]:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: -2px;
}

.status-overview-tile.is-active {
    background: var(--primary-subtle);
    box-shadow: inset 0 0 0 1px var(--primary);
}

.status-overview-tile.is-active .status-overview-label {
    color: var(--primary);
}

body.dark-mode .status-overview-tile.is-active {
    background: rgba(13, 148, 136, 0.15);
    box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.6);
}

body.dark-mode .status-overview-tile.is-active .status-overview-label {
    color: #5eead4;
}

/* Submitted — amber (in-flight) */
.status-overview-submitted {
    border-top: 3px solid #f59e0b;
}

.status-overview-submitted .status-overview-icon-wrap {
    background: var(--warning-subtle);
    color: var(--warning);
}

.status-overview-submitted .status-overview-value {
    color: var(--warning);
}

body.dark-mode .status-overview-submitted .status-overview-icon-wrap {
    background: rgba(245, 158, 11, 0.18);
    color: #fbbf24;
}

body.dark-mode .status-overview-submitted .status-overview-value {
    color: #fbbf24;
}

/* Pending — violet (in review) */
.status-overview-pending {
    border-top: 3px solid #8b5cf6;
}

.status-overview-pending .status-overview-icon-wrap {
    background: #f5f3ff;
    color: #7c3aed;
}

.status-overview-pending .status-overview-value {
    color: #7c3aed;
}

body.dark-mode .status-overview-pending .status-overview-icon-wrap {
    background: rgba(139, 92, 246, 0.18);
    color: #a78bfa;
}

body.dark-mode .status-overview-pending .status-overview-value {
    color: #a78bfa;
}

/* Approved — emerald (success) */
.status-overview-approved {
    border-top: 3px solid #10b981;
}

.status-overview-approved .status-overview-icon-wrap {
    background: #ecfdf5;
    color: #047857;
}

.status-overview-approved .status-overview-value {
    color: #047857;
}

body.dark-mode .status-overview-approved .status-overview-icon-wrap {
    background: rgba(16, 185, 129, 0.18);
    color: #34d399;
}

body.dark-mode .status-overview-approved .status-overview-value {
    color: #34d399;
}

/* Denied — red (danger) */
.status-overview-denied {
    border-top: 3px solid #ef4444;
}

.status-overview-denied .status-overview-icon-wrap {
    background: var(--danger-subtle);
    color: #b91c1c;
}

.status-overview-denied .status-overview-value {
    color: #b91c1c;
}

body.dark-mode .status-overview-denied .status-overview-icon-wrap {
    background: rgba(239, 68, 68, 0.18);
    color: #f87171;
}

body.dark-mode .status-overview-denied .status-overview-value {
    color: #f87171;
}

@media (max-width: 1024px) {
    .status-overview-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .status-overview-tile {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 768px) {
    .status-overview-grid {
        grid-template-columns: 1fr;
    }

    .status-overview-tile {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .status-overview-tile:last-child {
        border-bottom: none;
    }

    .status-overview-value {
        font-size: 1.25rem;
    }
}

/* ========================================
   Insurance Status Badges
   ======================================== */

.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    white-space: nowrap;
}

.status-badge.status-submitted { background: rgba(2, 132, 199, 0.12); color: #0284c7; }
.status-badge.status-pending   { background: rgba(245, 158, 11, 0.14); color: #b45309; }
.status-badge.status-approved  { background: rgba(16, 185, 129, 0.14); color: #047857; }
.status-badge.status-denied    { background: rgba(239, 68, 68, 0.12);  color: #b91c1c; }
.status-badge.status-na        { background: rgba(100, 116, 139, 0.14); color: #475569; }

body.dark-mode .status-badge.status-submitted { background: rgba(56, 189, 248, 0.16); color: #38bdf8; }
body.dark-mode .status-badge.status-pending   { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
body.dark-mode .status-badge.status-approved  { background: rgba(16, 185, 129, 0.20); color: #34d399; }
body.dark-mode .status-badge.status-denied    { background: rgba(248, 113, 113, 0.18); color: #f87171; }
body.dark-mode .status-badge.status-na        { background: rgba(148, 163, 184, 0.20); color: #94a3b8; }

.status-missing {
    color: var(--text-muted);
    font-size: 0.9375rem;
}

body.dark-mode .status-missing {
    color: #94a3b8;
}

/* Row animation delay handled via JS-injected stylesheet to avoid inline styles */
/* Base animation delay classes */
.row-delay-0 { animation-delay: 0s; }
.row-delay-1 { animation-delay: 0.03s; }
.row-delay-2 { animation-delay: 0.06s; }
.row-delay-3 { animation-delay: 0.09s; }
.row-delay-4 { animation-delay: 0.12s; }
.row-delay-5 { animation-delay: 0.15s; }
.row-delay-6 { animation-delay: 0.18s; }
.row-delay-7 { animation-delay: 0.21s; }
.row-delay-8 { animation-delay: 0.24s; }
.row-delay-9 { animation-delay: 0.27s; }
.row-delay-10 { animation-delay: 0.30s; }
.row-delay-11 { animation-delay: 0.33s; }
.row-delay-12 { animation-delay: 0.36s; }
.row-delay-13 { animation-delay: 0.39s; }
.row-delay-14 { animation-delay: 0.40s; }
.row-delay-15 { animation-delay: 0.40s; }
.row-delay-16 { animation-delay: 0.40s; }
.row-delay-17 { animation-delay: 0.40s; }
.row-delay-18 { animation-delay: 0.40s; }
.row-delay-19 { animation-delay: 0.40s; }
.row-delay-20 { animation-delay: 0.40s; }

/* Import modal utility classes */
.import-muted { color: var(--gray-500); }
.import-center { text-align: center; color: var(--gray-400); }
.import-mt { margin-top: 12px; }
.import-label { font-size: 0.8125rem; font-weight: 600; color: var(--gray-600); }

body.dark-mode .import-muted { color: #94a3b8; }
body.dark-mode .import-center { color: #94a3b8; }
body.dark-mode .import-label { color: #94a3b8; }

/* Margin utility */
.mr-6 { margin-right: 6px; }

/* Breakdown bar width handled via dynamic stylesheet */
.breakdown-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Animation for table rows */
@keyframes fadeInRow {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.expense-table tbody tr {
    animation: fadeInRow 0.3s ease forwards;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

body.dark-mode ::-webkit-scrollbar-track {
    background: var(--gray-800);
}

body.dark-mode ::-webkit-scrollbar-thumb {
    background: var(--gray-600);
}

body.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: var(--gray-500);
}

/* Print styles */
@media print {
    .app-header,
    .form-section,
    .breakdown-card,
    .status-overview-card,
    .app-footer,
    .table-controls,
    .date-range-inputs,
    .btn-icon,
    .load-more-btn,
    .show-all-btn,
    .table-counter {
        display: none !important;
    }

    .main-content {
        grid-template-columns: 1fr;
    }

    .table-card {
        box-shadow: none;
        border: 1px solid var(--gray-300);
    }

    .expense-table thead th[data-sort="insuranceStatus"],
    .expense-table tbody td:nth-child(7) {
        display: none;
    }

    .expense-table tbody tr:hover {
        background: none;
    }
}

/* ========================================
   v1.0 — server auth overlay additions
   ======================================== */

.auth-section-title {
    margin: 0 0 8px;
    font-size: 1.25rem;
    font-weight: 600;
}

.auth-sub {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0 0 18px;
}

.recovery-codes-header h2 {
    margin: 0 0 10px;
    font-size: 1.2rem;
    font-weight: 600;
}

.recovery-codes-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0 0 16px;
}

.recovery-codes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}

.recovery-code-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 14px;
}

.recovery-code-index {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    min-width: 20px;
}

.recovery-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 1rem;
    letter-spacing: 0.05em;
    user-select: all;
    word-break: break-all;
}

.auth-actions {
    margin-top: 4px;
}

.app-version {
    margin-left: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.report-version {
    font-size: 0.8rem;
    color: var(--text-muted);
    opacity: 0.8;
}
