/**
 * Admin Statements Dashboard - Accordion View
 * Design: Modern accordion with colorful revenue/expense display
 * Version: 3.0 (2026-02-09) - Added loading state for instant UI updates
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
    /* Base Colors */
    --stmt-bg-page: #0f0f1a;
    --stmt-bg-card: #1a1a2e;
    --stmt-bg-row: rgba(255, 255, 255, 0.02);
    --stmt-bg-row-hover: rgba(139, 92, 246, 0.1);
    --stmt-bg-expanded: rgba(139, 92, 246, 0.08);
    --stmt-bg-lines: rgba(0, 0, 0, 0.3);
    --stmt-bg-header: rgba(59, 130, 246, 0.1);

    /* Borders */
    --stmt-border: rgba(255, 255, 255, 0.1);
    --stmt-border-accent: #8b5cf6;
    --stmt-border-left: #8b5cf6;

    /* Text */
    --stmt-text-primary: #ffffff;
    --stmt-text-secondary: #a0a0b0;
    --stmt-text-muted: #6b6b7e;

    /* Financial Colors */
    --stmt-color-revenue: #10b981;
    --stmt-color-expense: #ef4444;
    --stmt-color-positive: #10b981;
    --stmt-color-negative: #ef4444;

    /* Accent */
    --stmt-accent: #8b5cf6;
    --stmt-accent-hover: #7c3aed;
    --stmt-accent-blue: #3b82f6;

    /* Badges */
    --stmt-badge-cat: #3b82f6;
    --stmt-badge-statement: #8b5cf6;
    --stmt-badge-main: #a855f7;

    /* Fonts */
    --stmt-font-mono: 'IBM Plex Mono', monospace;
    --stmt-font-body: 'Familjen Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* ============================================
   PAGE LAYOUT
   ============================================ */
.admin-statements-page {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

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

.admin-statements-header h1 {
    font-family: var(--stmt-font-mono);
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--stmt-text-primary);
    margin: 0 0 8px 0;
}

.admin-statements-header p {
    font-size: 0.9rem;
    color: var(--stmt-text-secondary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--stmt-bg-card);
    border: 1px solid var(--stmt-border);
    border-radius: 12px;
    padding: 20px;
    transition: border-color 0.2s;
}

.stat-card:hover {
    border-color: var(--stmt-accent);
}

.stat-card .stat-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--stmt-text-muted);
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-family: var(--stmt-font-mono);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--stmt-text-primary);
}

.stat-card .stat-value.positive {
    color: var(--stmt-color-positive);
}

.stat-card .stat-value.negative {
    color: var(--stmt-color-negative);
}

/* ============================================
   FILTERS BAR
   ============================================ */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--stmt-bg-card);
    border: 1px solid var(--stmt-border);
    border-radius: 10px;
}

.filters-bar .search-input {
    flex: 1;
    max-width: 300px;
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--stmt-border);
    border-radius: 8px;
    color: var(--stmt-text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.filters-bar .search-input:focus {
    outline: none;
    border-color: var(--stmt-accent);
}

.filters-bar .search-input::placeholder {
    color: var(--stmt-text-muted);
}

.filters-bar .filter-select {
    padding: 10px 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--stmt-border);
    border-radius: 8px;
    color: var(--stmt-text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 140px;
}

.filters-bar .filter-select:focus {
    outline: none;
    border-color: var(--stmt-accent);
}

.filters-bar .labels-count {
    font-size: 0.85rem;
    color: var(--stmt-text-secondary);
    margin-left: auto;
}

/* ============================================
   ACCORDION TABLE
   ============================================ */
.accordion-container {
    background: var(--stmt-bg-card);
    border: 1px solid var(--stmt-border);
    border-radius: 12px;
    overflow: hidden;
}

/* Column Headers */
.accordion-header-row {
    display: grid;
    grid-template-columns: 1fr 120px 120px 140px 80px;
    padding: 14px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid var(--stmt-border);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--stmt-text-muted);
}

.accordion-header-row .col-revenue,
.accordion-header-row .col-expenses,
.accordion-header-row .col-balance,
.accordion-header-row .col-items {
    text-align: right;
}

/* ============================================
   LABEL ROW (Level 1)
   ============================================ */
.label-row {
    display: grid;
    grid-template-columns: 1fr 120px 120px 140px 80px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--stmt-border);
    cursor: pointer;
    transition: all 0.2s ease;
    align-items: center;
}

.label-row:hover {
    background: var(--stmt-bg-row-hover);
}

.label-row.expanded {
    background: var(--stmt-bg-expanded);
    border-color: var(--stmt-accent);
}

.label-row .col-label {
    display: flex;
    align-items: center;
    gap: 12px;
}

.label-row .chevron {
    width: 20px;
    height: 20px;
    color: var(--stmt-text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.label-row.expanded .chevron {
    transform: rotate(180deg);
    color: var(--stmt-accent);
}

.label-row .label-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--stmt-text-primary);
}

.label-row .col-revenue {
    text-align: right;
    font-family: var(--stmt-font-mono);
    font-size: 0.9rem;
    color: var(--stmt-color-revenue);
}

.label-row .col-expenses {
    text-align: right;
    font-family: var(--stmt-font-mono);
    font-size: 0.9rem;
    color: var(--stmt-color-expense);
}

.label-row .col-balance {
    text-align: right;
    font-family: var(--stmt-font-mono);
    font-size: 0.95rem;
    font-weight: 600;
}

.label-row .col-balance.positive {
    color: var(--stmt-color-positive);
}

.label-row .col-balance.negative {
    color: var(--stmt-color-negative);
}

.label-row .col-items {
    text-align: right;
    font-size: 0.9rem;
    color: var(--stmt-text-secondary);
}

/* ============================================
   LABEL CONTENT (Expanded)
   ============================================ */
.label-content {
    display: none;
    padding: 0 20px 16px 52px;
    border-bottom: 1px solid var(--stmt-border);
    border-left: 3px solid var(--stmt-border-left);
    margin-left: 20px;
    background: rgba(0, 0, 0, 0.15);
}

.label-content.visible {
    display: block;
}

/* ============================================
   CAT ROW (Level 2)
   ============================================ */
.cat-row {
    display: grid;
    grid-template-columns: 1fr 100px 100px 120px 60px;
    padding: 12px 16px;
    margin: 8px 0;
    background: var(--stmt-bg-row);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    align-items: center;
}

.cat-row:hover {
    background: var(--stmt-bg-row-hover);
}

.cat-row.expanded {
    background: var(--stmt-bg-expanded);
    border-radius: 8px 8px 0 0;
}

.cat-row .col-cat {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cat-row .chevron-small {
    width: 14px;
    height: 14px;
    color: var(--stmt-text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.cat-row.expanded .chevron-small {
    transform: rotate(180deg);
    color: var(--stmt-accent);
}

.cat-row .cat-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--stmt-text-primary);
}

.cat-row .col-revenue,
.cat-row .col-expenses,
.cat-row .col-balance,
.cat-row .col-items {
    text-align: right;
    font-family: var(--stmt-font-mono);
    font-size: 0.85rem;
}

.cat-row .col-revenue {
    color: var(--stmt-color-revenue);
}

.cat-row .col-expenses {
    color: var(--stmt-color-expense);
}

.cat-row .col-balance.positive {
    color: var(--stmt-color-positive);
}

.cat-row .col-balance.negative {
    color: var(--stmt-color-negative);
}

.cat-row .col-items {
    color: var(--stmt-text-muted);
    font-size: 0.8rem;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-cat {
    background: var(--stmt-badge-cat);
    color: white;
}

.badge-statement {
    background: var(--stmt-badge-statement);
    color: white;
}

.badge-main {
    background: var(--stmt-badge-main);
    color: white;
}

/* ============================================
   LINES CONTENT (Level 3)
   ============================================ */
.lines-content {
    display: none;
    margin: 0 0 8px 0;
    padding: 16px;
    background: var(--stmt-bg-lines);
    border-radius: 0 0 8px 8px;
}

.lines-content.visible {
    display: block;
}

/* Lines Header */
.lines-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: var(--stmt-bg-header);
    border-radius: 8px;
}

.lines-header .lines-meta {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
}

.lines-header .lines-meta span {
    color: var(--stmt-text-secondary);
}

.lines-header .lines-meta .value {
    font-family: var(--stmt-font-mono);
    font-weight: 500;
}

.lines-header .lines-meta .value.positive {
    color: var(--stmt-color-positive);
}

.lines-header .lines-meta .value.negative {
    color: var(--stmt-color-negative);
}

/* Lines Table */
.lines-table {
    width: 100%;
    border-collapse: collapse;
}

.lines-table th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--stmt-text-muted);
    border-bottom: 1px solid var(--stmt-border);
}

.lines-table th.align-right {
    text-align: right;
}

.lines-table td {
    padding: 10px 12px;
    font-size: 0.85rem;
    color: var(--stmt-text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.lines-table td.align-right {
    text-align: right;
    font-family: var(--stmt-font-mono);
}

.lines-table td.type-cell {
    text-transform: capitalize;
    font-size: 0.8rem;
    color: var(--stmt-text-secondary);
}

.lines-table td.amount-cell {
    font-family: var(--stmt-font-mono);
    font-weight: 500;
}

.lines-table td.amount-cell.positive {
    color: var(--stmt-color-positive);
}

.lines-table td.amount-cell.negative {
    color: var(--stmt-color-negative);
}

/* Lines Footer */
.lines-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    margin-top: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.footer-left,
.footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: var(--stmt-accent);
    color: white;
}

.btn-primary:hover {
    background: var(--stmt-accent-hover);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--stmt-text-primary);
    border: 1px solid var(--stmt-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--stmt-accent);
}

.btn-csv {
    padding: 6px 12px;
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.4);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-csv:hover {
    background: rgba(59, 130, 246, 0.3);
    border-color: rgba(59, 130, 246, 0.6);
}

.btn-small {
    padding: 4px 10px;
    font-size: 0.75rem;
    border-radius: 4px;
}

.btn-expense {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border: 1px solid rgba(139, 92, 246, 0.3);
}

.btn-expense:hover {
    background: rgba(139, 92, 246, 0.25);
}

/* Tab action buttons */
.btn-validate-tab {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #10b981 !important;
    border: 1px solid rgba(16, 185, 129, 0.3) !important;
}

.btn-validate-tab:hover {
    background: rgba(16, 185, 129, 0.25) !important;
    border-color: rgba(16, 185, 129, 0.5) !important;
}

.btn-validate-tab svg {
    stroke: #10b981;
}

.btn-delete-tab {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
}

.btn-delete-tab:hover {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

.btn-delete-tab svg {
    stroke: #ef4444;
}

/* Modal variants */
.modal-warning .modal-header {
    background: rgba(251, 191, 36, 0.15);
    border-bottom: 1px solid rgba(251, 191, 36, 0.3);
}

.modal-warning .modal-header h3 {
    color: #fbbf24;
}

.modal-error .modal-header {
    background: rgba(239, 68, 68, 0.15);
    border-bottom: 1px solid rgba(239, 68, 68, 0.3);
}

.modal-error .modal-header h3 {
    color: #ef4444;
}

.modal-success .modal-header {
    background: rgba(16, 185, 129, 0.15);
    border-bottom: 1px solid rgba(16, 185, 129, 0.3);
}

.modal-success .modal-header h3 {
    color: #10b981;
}

/* ============================================
   QUICK ADD EXPENSE FORM
   ============================================ */
.quick-expense-form {
    display: none;
    padding: 16px;
    margin-top: 12px;
    background: rgba(139, 92, 246, 0.1);
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
}

.quick-expense-form.visible {
    display: block;
}

.quick-expense-form .form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.quick-expense-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.quick-expense-form input,
.quick-expense-form select {
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--stmt-border);
    border-radius: 6px;
    color: var(--stmt-text-primary);
    font-size: 0.85rem;
}

.quick-expense-form input:focus,
.quick-expense-form select:focus {
    outline: none;
    border-color: var(--stmt-accent);
}

.quick-expense-form .form-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ============================================
   GRAND TOTAL ROW
   ============================================ */
.grand-total-row {
    display: grid;
    grid-template-columns: 1fr 120px 120px 140px 80px;
    padding: 18px 20px;
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    border-radius: 0 0 12px 12px;
    color: white;
    align-items: center;
}

.grand-total-row .col-label {
    font-weight: 700;
    font-size: 1rem;
}

.grand-total-row .col-revenue,
.grand-total-row .col-expenses,
.grand-total-row .col-balance,
.grand-total-row .col-cats {
    text-align: right;
    font-family: var(--stmt-font-mono);
}

.grand-total-row .col-balance {
    font-size: 1.2rem;
    font-weight: 700;
}

/* ============================================
   LOADING STATES
   ============================================ */
.loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--stmt-border);
    border-top-color: var(--stmt-accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

.loading-message {
    text-align: center;
    padding: 24px;
    color: var(--stmt-text-muted);
}

.loading-message .loading-spinner {
    margin-bottom: 12px;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    color: var(--stmt-text-muted);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--stmt-text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--stmt-text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .accordion-header-row,
    .label-row,
    .grand-total-row {
        grid-template-columns: 1fr 100px 100px 120px 60px;
    }
}

@media (max-width: 768px) {
    .admin-statements-page {
        padding: 16px;
    }

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

    .filters-bar {
        flex-wrap: wrap;
    }

    .filters-bar .search-input {
        max-width: 100%;
        flex: 1 1 100%;
    }

    .accordion-header-row,
    .label-row,
    .grand-total-row {
        grid-template-columns: 1fr 120px;
    }

    .accordion-header-row .col-expenses,
    .accordion-header-row .col-items,
    .label-row .col-expenses,
    .label-row .col-items,
    .grand-total-row .col-expenses,
    .grand-total-row .col-items {
        display: none;
    }
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 24px;
    margin-top: 16px;
}

.btn-page {
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-page:hover:not(.disabled) {
    background: rgba(139, 92, 246, 0.1);
    border-color: #8b5cf6;
}

.btn-page.disabled,
.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-info {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ============================================
   V5 FEATURES - TRUST LEVEL & SYNTHETIC LINES
   ============================================ */

/* Trust Badge (icon only with tooltip) */
.trust-badge {
    display: inline-block;
    font-size: 0.9rem;
    margin-right: 6px;
    cursor: help;
    position: relative;
}

/* Trust Badge Tooltip */
.trust-badge[data-tooltip]::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 6px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    font-size: 0.75rem;
    font-family: var(--stmt-font-body);
    white-space: nowrap;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.trust-badge[data-tooltip]::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 1000;
}

.trust-badge[data-tooltip]:hover::before,
.trust-badge[data-tooltip]:hover::after {
    opacity: 1;
}

/* Orphan Tab Badge */
.badge-orphan-tab {
    background: #ef4444;
    color: white;
    margin-right: 6px;
}

/* Orphan Line Badge */
.badge-orphan-line {
    background: #ef4444;
    color: white;
    margin-right: 6px;
}

/* Synthetic Badge */
.badge-synthetic {
    background: rgba(139, 92, 246, 0.8);
    color: white;
    margin-right: 6px;
}

/* WooCommerce Sync Badge */
.badge-woo-sync {
    background: #8b5cf6;
    color: white;
    margin-right: 6px;
}

/* WooCommerce Synced Line Highlighting */
.lines-table tr.woo-synced-line {
    background: rgba(139, 92, 246, 0.06);
    border-left: 3px solid #8b5cf6;
}

/* WooCommerce sync toggle in edit form */
.woo-sync-toggle {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    min-width: 70px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--border-color, #ccc);
    border-radius: 20px;
    transition: background 0.2s;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.toggle-switch input:checked + .toggle-slider {
    background: #8b5cf6;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(16px);
}

/* Orphan Line Row Highlighting */
.lines-table tr.orphan-line {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

/* Synthetic Total Report Section */
.synthetic-total-report-section {
    margin-top: 16px;
    border: 1px solid rgba(139, 92, 246, 0.3);
    border-radius: 8px;
    padding: 12px;
    background: rgba(139, 92, 246, 0.05);
}

.synthetic-total-report-section h4 {
    margin: 0 0 12px 0;
    font-size: 0.9rem;
    color: var(--stmt-text-secondary);
    font-family: var(--stmt-font-mono);
}

/* TOTAL REPORTS Toggle Row */
.total-reports-toggle-row {
    transition: background 0.2s ease;
}

.total-reports-toggle-row:hover {
    background: rgba(139, 92, 246, 0.15) !important;
}

/* TOTAL REPORTS Lines */
.total-reports-line {
    transition: background 0.2s ease;
}

.total-reports-line:hover {
    background: rgba(139, 92, 246, 0.12) !important;
}

.total-reports-line.orphan-tab-ref {
    background: rgba(239, 68, 68, 0.08) !important;
}

.total-reports-line.orphan-tab-ref:hover {
    background: rgba(239, 68, 68, 0.15) !important;
}

/* Matched badge */
.badge-matched {
    background: #10b981;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: 6px;
}

/* ============================================
   VALIDATION MODAL
   ============================================ */
.validation-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.validation-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.validation-modal-content {
    position: relative;
    background: var(--stmt-bg-card);
    border: 1px solid var(--stmt-border-accent);
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.validation-modal-content h3 {
    margin: 0 0 12px 0;
    font-family: var(--stmt-font-mono);
    font-size: 1.25rem;
    color: var(--stmt-text-primary);
}

.validation-modal-content ul {
    list-style: disc;
    padding-left: 24px;
    margin: 12px 0;
}

.validation-modal-content ul ul {
    list-style: circle;
    font-size: 0.9rem;
    color: var(--stmt-text-secondary);
}

.validation-modal-content li {
    margin: 6px 0;
}

.label-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--stmt-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
}

.btn-danger {
    background: var(--stmt-color-negative) !important;
    border-color: var(--stmt-color-negative) !important;
}

.btn-danger:hover {
    background: #dc2626 !important;
    border-color: #dc2626 !important;
}

/* ============================================
   MODAL OVERLAY STYLES
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-content {
    background: var(--stmt-bg-card);
    border: 1px solid var(--stmt-border-accent);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--stmt-border);
}

.modal-header h3 {
    margin: 0;
    font-family: var(--stmt-font-mono);
    font-size: 1.25rem;
    color: var(--stmt-text-primary);
}

.modal-body {
    padding: 20px;
    color: var(--stmt-text-secondary);
}

.modal-body p {
    margin: 0 0 12px 0;
    line-height: 1.6;
}

.modal-body strong {
    color: var(--stmt-text-primary);
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--stmt-border);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: rgba(0, 0, 0, 0.2);
}

/* Line Selection and Bulk Delete */
.line-select-checkbox {
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--color-primary);
}

.col-select {
    padding: 4px 8px !important;
    vertical-align: middle;
}

#bulk-delete-btn {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #ef4444 !important;
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    transition: all 0.2s ease;
}

#bulk-delete-btn:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.25) !important;
    border-color: rgba(239, 68, 68, 0.5) !important;
}

#bulk-delete-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   LOADING STATE (v3.0 - 2026-02-09)
   Visual feedback during data refresh
   ============================================ */
.label-row.updating {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.label-row.updating::after {
    content: '';
    position: absolute;
    top: 50%;
    right: 20px;
    width: 16px;
    height: 16px;
    margin-top: -8px;
    border: 2px solid var(--stmt-accent);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ============================================
   LINE ACTION BUTTONS
   ============================================ */

/* Line action buttons */
.col-actions {
    white-space: nowrap;
}

.btn-icon {
    background: none;
    border: none;
    padding: 4px 6px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.1s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon:hover {
    opacity: 1;
    transform: scale(1.1);
}

.btn-icon:active {
    transform: scale(0.95);
}

.btn-icon.btn-edit svg {
    stroke: var(--stmt-color-primary, #3b82f6);
}

.btn-icon.btn-delete svg {
    stroke: var(--stmt-color-negative, #ef4444);
}

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

/* ============================================
   CREATE TAB MODAL
   ============================================ */
.create-tab-modal {
    max-width: 700px !important;
}

.create-tab-modal .form-group label {
    display: block;
    font-size: 0.75rem;
    color: var(--stmt-text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.create-tab-modal .form-group select,
.create-tab-modal .form-group input[type="number"],
.create-tab-modal .form-group input[type="text"] {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid var(--stmt-border);
    background: var(--stmt-bg-card);
    color: var(--stmt-text-primary);
    font-family: var(--stmt-font-mono);
    font-size: 0.85rem;
}

.create-tab-error {
    color: #ef4444;
    font-size: 0.85rem;
    margin-top: 4px;
    min-height: 1.2em;
}

/* Remove checkbox column styles (no longer needed) */
.col-select,
.line-select-checkbox {
    display: none;
}

/* ============================================
   SALES UNIT PRICE DISPLAY
   ============================================ */
.sales-unit-price-display {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s ease;
    user-select: none;
}

.sales-unit-price-display:hover {
    background: rgba(139, 92, 246, 0.12);
}

.sales-unit-price-label {
    color: var(--stmt-text-secondary);
}

.sales-unit-price-value {
    color: var(--stmt-text-primary);
    font-family: var(--stmt-font-mono);
    font-weight: 500;
}

.sales-unit-price-value.not-set {
    color: #f59e0b;
    font-style: italic;
    font-weight: 400;
}

.sales-unit-price-edit-icon {
    opacity: 0;
    transition: opacity 0.15s ease;
    color: var(--stmt-text-secondary);
}

.sales-unit-price-display:hover .sales-unit-price-edit-icon {
    opacity: 1;
}
