/* ============================================================
   1DIRECTION GLOBAL — Financial Intelligence & Reconciliation Suite
   Executive FinTech Design System • High-End Aesthetic
   ============================================================ */

/* ==================== THEME VARIABLES (MATCHING 1DIRECTION GLOBAL LOGO) ==================== */
:root, [data-theme="light"] {
    /* 1Direction Global Official Brand Palette */
    --brand-navy: #162E56;
    --brand-blue: #162E56;
    --brand-blue-hover: #0F203D;
    --brand-blue-light: #EEF4FA;
    --brand-blue-border: #BCD1E8;

    --brand-accent: #162E56;
    --brand-accent-light: #EEF4FA;

    --brand-emerald: #5C9E19;
    --brand-emerald-hover: #4C8414;
    --brand-emerald-light: #F0F8E8;
    --brand-emerald-border: #CBE8AC;

    --brand-ruby: #DC2626;
    --brand-ruby-hover: #B91C1C;
    --brand-ruby-light: #FEF2F2;
    --brand-ruby-border: #FECACA;

    --brand-purple: #162E56;
    --brand-purple-hover: #0F203D;
    --brand-purple-light: #EEF4FA;
    --brand-purple-border: #BCD1E8;

    --brand-amber: #D97706;
    --brand-amber-light: #FFFBEB;
    --brand-amber-border: #FDE68A;

    /* Theme Canvas & Surfaces */
    --bg-app: #F8FAFC;
    --bg-sidebar: #FFFFFF;
    --bg-header: #FFFFFF;
    --bg-card: #FFFFFF;
    --bg-subtle: #F1F5F9;
    --bg-subtle-hover: #E2E8F0;
    --bg-input: #FFFFFF;
    --bg-modal-backdrop: rgba(22, 46, 86, 0.45);

    /* Text Colors */
    --text-main: #0F172A;
    --text-muted: #334155;
    --text-light: #64748B;
    --text-faint: #94A3B8;

    /* Borders */
    --border-main: #E2E8F0;
    --border-light: #F1F5F9;
    --border-focus: #162E56;

    /* 4 Bucket Colors */
    --b1-color: #EA580C;
    --b1-bg: #FFF7ED;
    --b1-border: #FED7AA;

    --b2-color: #5C9E19;
    --b2-bg: #F0F8E8;
    --b2-border: #CBE8AC;

    --b3-color: #162E56;
    --b3-bg: #EEF4FA;
    --b3-border: #BCD1E8;

    --b4-color: #DC2626;
    --b4-bg: #FEF2F2;
    --b4-border: #FECACA;

    /* Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(22, 46, 86, 0.04);
    --shadow-sm: 0 1px 3px 0 rgba(22, 46, 86, 0.06), 0 1px 2px -1px rgba(22, 46, 86, 0.04);
    --shadow-md: 0 4px 8px -1px rgba(22, 46, 86, 0.06), 0 2px 4px -2px rgba(22, 46, 86, 0.04);
    --shadow-lg: 0 12px 20px -3px rgba(22, 46, 86, 0.08), 0 4px 6px -2px rgba(22, 46, 86, 0.04);

    /* Typography & Sizing */
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-heading: 'Outfit', 'Plus Jakarta Sans', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-2xl: 24px;
    --radius-pill: 9999px;
    --radius-circle: 50%;
    --header-height: 94px;

    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23162E56' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");

    --transition: all 0.16s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== DARK THEME ==================== */
[data-theme="dark"] {
    --select-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238FD44B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    
    /* 1Direction Global Logo Palette Matching (Emerald Green & Sapphire Blue) */
    --brand-navy: #8FD44B;
    --brand-blue: #38BDF8;
    --brand-blue-hover: #60A5FA;
    --brand-blue-light: rgba(56, 189, 248, 0.16);
    --brand-blue-border: rgba(56, 189, 248, 0.35);

    --brand-accent: #8FD44B;
    --brand-accent-light: rgba(143, 212, 75, 0.16);

    --brand-emerald: #8FD44B;
    --brand-emerald-hover: #A3E635;
    --brand-emerald-light: rgba(143, 212, 75, 0.16);
    --brand-emerald-border: rgba(143, 212, 75, 0.35);

    --brand-ruby: #EF4444;
    --brand-ruby-hover: #DC2626;
    --brand-ruby-light: rgba(239, 68, 68, 0.16);
    --brand-ruby-border: rgba(239, 68, 68, 0.35);

    --brand-purple: #8FD44B;
    --brand-purple-hover: #A3E635;
    --brand-purple-light: rgba(143, 212, 75, 0.16);
    --brand-purple-border: rgba(143, 212, 75, 0.35);

    --brand-amber: #F59E0B;
    --brand-amber-light: rgba(245, 158, 11, 0.16);
    --brand-amber-border: rgba(245, 158, 11, 0.35);

    /* Theme Dark Canvas */
    --bg-app: #080E1A;
    --bg-sidebar: #0B1322;
    --bg-header: #0B1322;
    --bg-card: #101B2E;
    --bg-subtle: #162640;
    --bg-subtle-hover: #1E3456;
    --bg-input: #0B1322;
    --bg-modal-backdrop: rgba(8, 14, 26, 0.85);

    /* Text Colors */
    --text-main: #F8FAFC;
    --text-muted: #CBD5E1;
    --text-light: #94A3B8;
    --text-faint: #64748B;

    /* Borders */
    --border-main: #1D3254;
    --border-light: #14233C;
    --border-focus: #8FD44B;

    /* 4 Bucket Colors */
    --b1-color: #FB923C;
    --b1-bg: rgba(251, 146, 60, 0.15);
    --b1-border: rgba(251, 146, 60, 0.35);

    --b2-color: #8FD44B;
    --b2-bg: rgba(143, 212, 75, 0.15);
    --b2-border: rgba(143, 212, 75, 0.35);

    --b3-color: #38BDF8;
    --b3-bg: rgba(56, 189, 248, 0.15);
    --b3-border: rgba(56, 189, 248, 0.35);

    --b4-color: #F87171;
    --b4-bg: rgba(248, 113, 113, 0.15);
    --b4-border: rgba(248, 113, 113, 0.35);

    /* Dark Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.6), 0 1px 2px -1px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.7), 0 4px 6px -2px rgba(0, 0, 0, 0.6);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    transition: background-color 0.2s ease, color 0.2s ease;
}

h1, h2, h3, h4, .view-title {
    font-family: var(--font-heading);
}

.hidden {
    display: none !important;
}

/* App Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ==================== SIDEBAR ==================== */
.sidebar {
    width: 255px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-main);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

/* Sidebar Header - Centered & Prominent Brand Hub */
.sidebar-header {
    height: var(--header-height);
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-main);
    background: var(--bg-sidebar);
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    position: relative;
}

.sidebar-close-btn {
    display: none;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border-main);
    background: var(--bg-card);
    color: var(--text-light);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.sidebar-close-btn:hover {
    color: var(--text-main);
    background: var(--bg-subtle);
}

[dir="rtl"] .sidebar-close-btn {
    right: auto;
    left: 10px;
}

/* Sidebar Overlay Backdrop for Mobile / Tablet */
.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 990;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.sidebar-backdrop.active {
    opacity: 1;
    pointer-events: auto;
}

.brand-hub-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 100%;
    gap: 6px;
}

.brand-logo-plate {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    transition: var(--transition);
}

[data-theme="dark"] .brand-logo-plate {
    background: #FFFFFF;
    padding: 6px 14px;
    border-radius: 10px;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
}

.brand-logo-img {
    height: 46px;
    max-width: 220px;
    width: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.fallback-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.logo-icon {
    font-size: 22px;
    color: #FFFFFF;
    background: var(--brand-emerald);
    padding: 5px;
    border-radius: var(--radius-sm);
}

.fallback-brand-name {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
}

.brand-product-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-emerald-light);
    border: 1px solid var(--brand-emerald-border);
    border-radius: 6px;
    padding: 3px 12px;
    margin: 0 auto;
}

.brand-product-pill-text {
    font-family: var(--font-heading);
    font-size: 11px;
    font-weight: 800;
    color: #4C8414;
    letter-spacing: 0.15px;
}

[data-theme="dark"] .brand-product-pill {
    background: rgba(143, 212, 75, 0.18);
    border: 1px solid rgba(143, 212, 75, 0.45);
}

[data-theme="dark"] .brand-product-pill-text {
    color: #8FD44B;
    font-weight: 800;
}

/* Sidebar Nav */
.sidebar-nav {
    flex: 1;
    padding: 14px 10px;
    overflow-y: auto;
}

.nav-section-label {
    font-family: var(--font-heading);
    font-size: 10px;
    font-weight: 800;
    color: var(--text-faint);
    letter-spacing: 0.8px;
    padding: 12px 10px 4px 10px;
}

.nav-section-label:first-child {
    padding-top: 2px;
}

.nav-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: var(--text-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    user-select: none;
}

.nav-item:hover {
    background-color: var(--bg-subtle);
    color: var(--text-main);
}

.nav-item.active {
    background-color: var(--brand-blue-light);
    color: var(--brand-navy);
    font-weight: 700;
    border-left: 3.5px solid var(--brand-emerald);
}

[data-theme="dark"] .nav-item.active {
    background-color: rgba(143, 212, 75, 0.14);
    color: #F8FAFC;
    border-left: 3.5px solid #8FD44B;
}

.nav-item .material-symbols-rounded {
    font-size: 19px;
    transition: var(--transition);
}

.nav-item.active .material-symbols-rounded {
    color: var(--brand-emerald);
}

[data-theme="dark"] .nav-item.active .material-symbols-rounded {
    color: #8FD44B;
}

.nav-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-weight: 700;
}

.nav-badge.badge-reconciled {
    background: var(--brand-emerald-light);
    color: var(--brand-emerald);
    border: 1px solid var(--b2-border);
}

.nav-badge-alert {
    background: var(--brand-ruby-light) !important;
    color: var(--brand-ruby) !important;
    border: 1px solid var(--b4-border);
}

.balance-verification-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    cursor: default;
}

.balance-verification-badge.bv-verified {
    background: rgba(16, 185, 129, 0.15) !important;
    color: #059669 !important;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.balance-verification-badge.bv-discrepancy {
    background: rgba(239, 68, 68, 0.15) !important;
    color: #dc2626 !important;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.balance-verification-badge.bv-unverifiable {
    background: var(--bg-subtle) !important;
    color: var(--text-muted) !important;
    border: 1px solid var(--border-main);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--border-main);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-sidebar);
}

.sidebar-security {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-light);
    justify-content: center;
    font-weight: 500;
}

.sidebar-security .material-symbols-rounded {
    font-size: 14px;
    color: var(--brand-emerald);
}

/* ==================== MAIN CONTENT & TOP BAR ==================== */
.main-content {
    flex: 1;
    margin-left: 255px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - 255px);
    max-width: calc(100% - 255px);
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Top Bar - Exact height matching Sidebar Header */
.top-bar {
    height: var(--header-height);
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-main);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-sizing: border-box;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.top-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.mobile-nav-toggle-btn {
    display: none;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border-main);
    background: var(--bg-card);
    color: var(--text-main);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    flex-shrink: 0;
    transition: var(--transition);
}

.mobile-nav-toggle-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--brand-blue-border);
}

.mobile-nav-toggle-btn .material-symbols-rounded {
    font-size: 22px;
}

.top-bar-title-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.top-bar-left .view-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.2px;
    line-height: 1.25;
}

.top-bar-left .view-subtitle {
    font-size: 11.5px;
    color: var(--text-light);
    line-height: 1.25;
}

.mobile-header-brand {
    display: none;
}

.anomalies-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 18px;
    gap: 12px;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brs-topbar-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Compact Modern Pill Badges for Top Bar */
.pill-badge-control {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 8px;
    padding: 0 6px 0 8px;
    height: 32px;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
}

.pill-badge-control:hover, .pill-badge-control:focus-within {
    border-color: var(--brand-navy);
    box-shadow: 0 0 0 2px var(--brand-blue-border);
}

[data-theme="dark"] .pill-badge-control:hover, 
[data-theme="dark"] .pill-badge-control:focus-within {
    border-color: var(--brand-emerald);
    box-shadow: 0 0 0 2px var(--brand-emerald-border);
}

.pill-label {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-light);
    user-select: none;
}

.pill-icon {
    font-size: 15px;
    color: var(--brand-navy);
}

[data-theme="dark"] .pill-icon {
    color: var(--brand-emerald);
}

.pill-select, .select-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: transparent;
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-position: right 2px center;
    background-size: 11px;
    padding-right: 16px !important;
    padding-left: 2px;
    border: none;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    transition: var(--transition);
}

.pill-select option, .select-control option {
    background-color: var(--bg-card);
    color: var(--text-main);
    padding: 6px 10px;
}

/* ==================== CUSTOM FINTECH DROPDOWN SYSTEM ==================== */
.custom-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    user-select: none;
}

.custom-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 8px;
    padding: 0 8px 0 10px;
    height: 32px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: var(--transition);
    white-space: nowrap;
}

.custom-dropdown-trigger:hover,
.custom-dropdown-wrapper.open .custom-dropdown-trigger {
    border-color: var(--brand-emerald);
    background: var(--bg-subtle-hover);
    box-shadow: 0 0 0 2px var(--brand-emerald-border);
}

.custom-dropdown-trigger .trigger-icon {
    font-size: 15px;
    color: var(--brand-emerald);
    display: inline-flex;
    align-items: center;
}

.custom-dropdown-trigger .trigger-label {
    color: var(--text-light);
    font-size: 11px;
    font-weight: 800;
    margin-right: 2px;
}

.custom-dropdown-trigger .trigger-value {
    color: var(--text-main);
    font-weight: 700;
    font-size: 11.5px;
}

.custom-dropdown-trigger .trigger-chevron {
    font-size: 16px;
    color: var(--text-light);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), color 0.2s ease;
    margin-left: 2px;
    display: inline-flex;
    align-items: center;
}

.custom-dropdown-wrapper.open .custom-dropdown-trigger .trigger-chevron {
    transform: rotate(180deg);
    color: var(--brand-emerald);
}

/* Custom Dropdown Floating Menu */
.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    left: auto;
    min-width: 180px;
    max-width: calc(100vw - 24px);
    box-sizing: border-box;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 12px;
    padding: 6px;
    box-shadow: 0 12px 28px -4px rgba(22, 46, 86, 0.18), 0 8px 12px -6px rgba(22, 46, 86, 0.12);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px) scale(0.98);
    transition: opacity 0.15s cubic-bezier(0.16, 1, 0.3, 1), transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.15s;
    scrollbar-width: thin;
    scrollbar-color: var(--border-main) transparent;
}

[dir="rtl"] .custom-dropdown-menu {
    right: auto;
    left: 0;
}

[data-theme="dark"] .custom-dropdown-menu {
    background: #101B2E;
    border-color: #1D3254;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.65), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.custom-dropdown-wrapper.open .custom-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* Dropdown Menu Items */
.custom-dropdown-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
}

.custom-dropdown-item:hover {
    background: var(--bg-subtle-hover);
    color: var(--text-main);
}

[data-theme="dark"] .custom-dropdown-item:hover {
    background: #162640;
    color: #FFFFFF;
}

.custom-dropdown-item.selected {
    background: var(--brand-emerald-light);
    color: var(--brand-emerald);
    font-weight: 700;
}

[data-theme="dark"] .custom-dropdown-item.selected {
    background: rgba(143, 212, 75, 0.16);
    color: #8FD44B;
    font-weight: 700;
}

.custom-dropdown-item .item-check {
    font-size: 16px;
    color: var(--brand-emerald);
    opacity: 0;
    transition: var(--transition);
}

[data-theme="dark"] .custom-dropdown-item .item-check {
    color: #8FD44B;
}

.custom-dropdown-item.selected .item-check {
    opacity: 1;
}

.custom-dropdown-menu::-webkit-scrollbar {
    width: 5px;
}

.custom-dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.custom-dropdown-menu::-webkit-scrollbar-thumb {
    background: var(--border-main);
    border-radius: 4px;
}

/* Compact Global Action Buttons */
.topbar-actions-cluster {
    display: flex;
    align-items: center;
    gap: 6px;
}

.compact-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 8px;
    height: 32px;
    min-width: 32px;
    padding: 0 8px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    white-space: nowrap;
    box-shadow: var(--shadow-xs);
}

.compact-action-btn:hover {
    background: var(--bg-subtle);
    color: var(--text-main);
    border-color: var(--brand-navy);
}

[data-theme="dark"] .compact-action-btn:hover {
    background: var(--bg-subtle-hover);
    border-color: var(--brand-emerald);
    color: #FFFFFF;
}

.compact-action-btn .action-icon {
    font-size: 16px;
    color: var(--brand-navy);
}

[data-theme="dark"] .compact-action-btn .action-icon {
    color: var(--brand-emerald);
}

[data-theme="dark"] #theme-toggle-btn .action-icon {
    color: #FBBF24;
}

.compact-action-btn .action-tag {
    font-family: var(--font-heading);
    font-size: 10.5px;
    font-weight: 800;
    color: var(--brand-navy);
    letter-spacing: 0.3px;
}

[data-theme="dark"] .compact-action-btn .action-tag {
    color: var(--brand-emerald);
}

.compact-action-btn .action-text {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-muted);
}

.compact-action-btn:hover .action-text {
    color: var(--text-main);
}

/* Polished Reset Button */
#clear-all-btn {
    border-color: rgba(225, 29, 72, 0.25);
    background: rgba(225, 29, 72, 0.04);
}

#clear-all-btn .action-icon {
    color: var(--brand-ruby);
}

#clear-all-btn .action-text {
    color: var(--brand-ruby);
}

#clear-all-btn:hover {
    background: rgba(225, 29, 72, 0.12);
    border-color: var(--brand-ruby);
    color: var(--brand-ruby);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(225, 29, 72, 0.18);
}

[data-theme="dark"] #clear-all-btn {
    border-color: rgba(244, 63, 94, 0.35);
    background: rgba(244, 63, 94, 0.08);
}

[data-theme="dark"] #clear-all-btn .action-icon,
[data-theme="dark"] #clear-all-btn .action-text {
    color: #FB7185;
}

[data-theme="dark"] #clear-all-btn:hover {
    background: rgba(244, 63, 94, 0.2);
    border-color: #FB7185;
}

/* Prevent Drag-and-Drop Child Flickering */
.modern-drop-card * {
    pointer-events: none;
}

.modern-drop-card button,
.modern-drop-card input {
    pointer-events: auto;
}

/* ==================== ARABIC & RTL SUPPORT ==================== */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .sidebar {
    left: auto;
    right: 0;
    border-right: none;
    border-left: 1px solid var(--border-main);
}

[dir="rtl"] .main-content {
    margin-left: 0;
    margin-right: 255px;
}

[dir="rtl"] .nav-item.active {
    border-left: none;
    border-right: 3.5px solid var(--brand-emerald);
}

[dir="rtl"] .nav-badge {
    margin-left: 0;
    margin-right: auto;
}

[dir="rtl"] .pill-select, [dir="rtl"] .select-control {
    background-position: left 4px center;
    padding-right: 4px !important;
    padding-left: 20px !important;
}

[dir="rtl"] #category-filter-select {
    background-position: left 10px center;
    padding: 6px 12px 6px 30px;
}

[dir="rtl"] .cat-select-pill {
    background-position: left 8px center;
    padding: 4px 10px 4px 26px;
}

[dir="rtl"] .clean-table th, [dir="rtl"] .clean-table td {
    text-align: right;
}

/* Workspace Container */
.workspace-container {
    flex: 1;
    padding: 20px 24px 80px 24px;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.view {
    display: none;
}

.view.active {
    display: block;
    padding-bottom: 40px;
    animation: fadeIn 0.15s ease-out;
}

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

/* ==================== BUTTONS ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition);
    font-family: inherit;
    text-decoration: none;
    height: 36px;
}

.btn-primary {
    background-color: var(--brand-emerald);
    color: #FFFFFF;
    border: 1px solid var(--brand-emerald);
}

.btn-primary:hover {
    background-color: var(--brand-emerald-hover);
    box-shadow: 0 4px 14px rgba(92, 158, 25, 0.35);
    border-color: var(--brand-emerald-hover);
}

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

.btn-secondary:hover {
    background-color: var(--bg-subtle);
    border-color: var(--text-muted);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background-color: var(--bg-subtle);
    color: var(--text-main);
}

.btn-purple {
    background-color: var(--brand-navy) !important;
    color: #FFFFFF !important;
    border: 1px solid var(--brand-navy);
}

.btn-purple:hover {
    background-color: #0F203D !important;
}

[data-theme="dark"] .btn-primary,
[data-theme="dark"] .btn-purple {
    background-color: #8FD44B !important;
    color: #080E1A !important;
    border-color: #8FD44B !important;
    font-weight: 800;
}

[data-theme="dark"] .btn-primary:hover,
[data-theme="dark"] .btn-purple:hover {
    background-color: #A3E635 !important;
    border-color: #A3E635 !important;
    color: #080E1A !important;
    box-shadow: 0 4px 20px rgba(143, 212, 75, 0.45);
}

.btn-green {
    background-color: var(--brand-emerald) !important;
    color: #FFFFFF !important;
}

.btn-green:hover {
    background-color: var(--brand-emerald-hover) !important;
}

[data-theme="dark"] .btn-green {
    background-color: #8FD44B !important;
    color: #080E1A !important;
}

.btn-glow {
    box-shadow: 0 4px 14px 0 rgba(92, 158, 25, 0.32);
}

.btn-glow:hover {
    box-shadow: 0 6px 20px 0 rgba(92, 158, 25, 0.45);
    transform: translateY(-1px);
}

[data-theme="dark"] .btn-glow {
    box-shadow: 0 4px 16px rgba(143, 212, 75, 0.35);
}

[data-theme="dark"] .btn-glow:hover {
    box-shadow: 0 6px 24px rgba(143, 212, 75, 0.5);
}

.btn-sm {
    padding: 4px 9px;
    font-size: 11px;
    height: 30px;
}

.btn-lg {
    padding: 8px 16px;
    font-size: 13.5px;
    height: 40px;
}

.btn-xl {
    padding: 11px 26px;
    font-size: 14.5px;
    height: 46px;
    border-radius: var(--radius-md);
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.full-width {
    width: 100%;
}

/* ==================== UPLOAD WORKFLOW MODE SWITCHER ==================== */
.upload-mode-switcher {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 22px;
}

.mode-tab-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--border-main);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
    font-family: inherit;
    min-height: 80px;
}

.mode-tab-btn:hover {
    border-color: var(--text-faint);
    background: var(--bg-subtle);
}

[data-theme="dark"] .mode-tab-btn {
    background: #101B2E;
    border-color: #1D3254;
}

[data-theme="dark"] .mode-tab-btn:hover {
    border-color: #8FD44B;
    background: #162640;
}

.mode-tab-btn.active {
    border-color: var(--brand-navy);
    background: var(--bg-card);
    box-shadow: 0 4px 14px rgba(22, 46, 86, 0.08);
}

[data-theme="dark"] #btn-mode-analyzer.active {
    border-color: #8FD44B;
    background: rgba(143, 212, 75, 0.08);
    box-shadow: 0 0 0 1px #8FD44B, 0 4px 18px rgba(143, 212, 75, 0.25);
}

[data-theme="dark"] #btn-mode-analyzer.active .mode-icon-purple {
    background: #8FD44B;
    color: #080E1A;
}

[data-theme="dark"] #btn-mode-brs.active {
    border-color: #38BDF8;
    background: rgba(56, 189, 248, 0.08);
    box-shadow: 0 0 0 1px #38BDF8, 0 4px 18px rgba(56, 189, 248, 0.25);
}

[data-theme="dark"] #btn-mode-brs.active .mode-icon-blue {
    background: #38BDF8;
    color: #080E1A;
}

#btn-mode-analyzer.active .mode-icon-purple {
    background: var(--brand-emerald-light);
    color: var(--brand-emerald);
}

#btn-mode-brs.active .mode-icon-blue {
    background: var(--brand-blue-light);
    color: var(--brand-navy);
}

.mode-icon-circle {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--transition);
}

.mode-icon-purple { background: var(--brand-emerald-light); color: var(--brand-emerald); }
.mode-icon-blue { background: var(--brand-blue-light); color: var(--brand-navy); }

[data-theme="dark"] .mode-icon-purple {
    background: rgba(143, 212, 75, 0.16);
    color: #8FD44B;
}

[data-theme="dark"] .mode-icon-blue {
    background: rgba(56, 189, 248, 0.16);
    color: #38BDF8;
}

.mode-btn-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mode-title {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
    line-height: 1.3;
}

.mode-sub {
    font-size: 11.5px;
    color: var(--text-light);
    margin-top: 3px;
    line-height: 1.35;
}

.workflow-canvas {
    display: none;
}

.workflow-canvas.active {
    display: block;
    animation: fadeIn 0.15s ease-out;
}

/* Canvas A: Analyzer Hero Card */
.analyzer-upload-hero {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-top: 4px solid var(--brand-purple);
    border-radius: var(--radius-md);
    padding: 26px 28px;
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 28px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-xs);
    align-items: center;
}

.analyzer-intro-text {
    display: flex;
    flex-direction: column;
}

.analyzer-hero-left h2,
.analyzer-intro-text h2 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.02em;
    margin: 8px 0 6px 0;
}

.analyzer-hero-left p,
.analyzer-intro-text p {
    font-size: 12.5px;
    color: var(--text-muted);
    line-height: 1.55;
    margin-bottom: 14px;
}

.supported-banks-container {
    display: flex;
    flex-direction: column;
    gap: 9px;
    background: var(--bg-surface);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 13px 15px;
    margin-top: 2px;
}

.supported-banks-header {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #059669;
}

[data-theme="dark"] .supported-banks-header {
    color: #34D399;
}

.supported-banks-header .header-icon {
    font-size: 15px;
    color: #10B981;
}

.supported-banks-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.bank-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 20px;
    color: var(--text-main);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
    user-select: none;
}

.bank-pill:hover {
    border-color: #10B981;
    background: rgba(16, 185, 129, 0.06);
    color: var(--text-main);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(16, 185, 129, 0.12);
}

.bank-pill .pill-check-icon {
    font-size: 13px;
    color: #10B981;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bank-pill.pill-universal {
    background: rgba(124, 58, 237, 0.05);
    border-color: rgba(124, 58, 237, 0.25);
    color: var(--brand-purple, #7C3AED);
}

.bank-pill.pill-universal:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: var(--brand-purple, #7C3AED);
    box-shadow: 0 3px 8px rgba(124, 58, 237, 0.15);
}

.bank-pill.pill-universal .material-symbols-rounded {
    font-size: 13px;
    color: var(--brand-purple, #7C3AED);
}

.supported-banks-hint {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.45;
    padding-top: 7px;
    border-top: 1px dashed var(--border-subtle);
}

.supported-banks-hint .hint-icon {
    font-size: 15px;
    color: #F59E0B;
    flex-shrink: 0;
}

/* ==================== MODERN DROP CARD UI ==================== */
.modern-drop-card {
    border: 2px dashed var(--border-main);
    border-radius: var(--radius-md);
    padding: 24px 18px;
    text-align: center;
    background: var(--bg-app);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
}

.modern-drop-card:hover, .modern-drop-card.dragover {
    border-color: var(--brand-blue);
    background: var(--brand-blue-light);
    transform: scale(1.008);
}

#drop-target-analyzer-bank:hover, #drop-target-analyzer-bank.dragover {
    border-color: var(--brand-purple);
    background: var(--brand-purple-light);
}

.drop-icon-bubble {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand-blue-light);
    color: var(--brand-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 8px;
    border: 1px solid var(--brand-blue-border);
    transition: var(--transition);
}

.bubble-purple, #drop-target-analyzer-bank .drop-icon-bubble {
    background: var(--brand-purple-light);
    color: var(--brand-purple);
    border-color: var(--brand-purple-border);
}

.modern-drop-card:hover .drop-icon-bubble {
    transform: translateY(-2px);
}

.drop-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.drop-subtitle {
    font-size: 11px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.btn-select-file {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--brand-blue);
    color: #FFFFFF;
    border: none;
    border-radius: var(--radius-sm);
    padding: 7px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.btn-select-purple, #drop-target-analyzer-bank .btn-select-file {
    background: var(--brand-purple);
}

.btn-select-file:hover {
    opacity: 0.92;
    transform: translateY(-1px);
}

.file-loaded-banner {
    display: none;
    font-size: 12px;
    background: var(--brand-emerald-light);
    border: 1px solid var(--b2-border);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    margin-bottom: 12px;
    color: var(--brand-emerald);
    text-align: left;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}

.file-loaded-banner.active {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.file-banner-info {
    width: 100% !important;
    min-width: 100% !important;
    flex: 1 1 100% !important;
    line-height: 1.5 !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
    font-size: 12px !important;
    color: var(--text-main) !important;
}

.file-banner-info strong {
    color: var(--brand-navy) !important;
}

[data-theme="dark"] .file-banner-info strong {
    color: var(--brand-emerald) !important;
}

.file-banner-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    margin-top: 4px !important;
    padding-top: 8px !important;
    border-top: 1px solid rgba(92, 158, 25, 0.2) !important;
}

[data-theme="dark"] .file-banner-actions {
    border-top-color: rgba(143, 212, 75, 0.25) !important;
}

.btn-switch-sheet-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    color: var(--brand-blue);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-pill);
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    font-family: inherit;
    box-shadow: var(--shadow-xs);
}

.btn-switch-sheet-badge:hover {
    background: var(--brand-blue-light);
    border-color: var(--brand-blue);
}

.btn-remove-file-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    background: rgba(220, 38, 38, 0.08);
    color: #DC2626;
    border: 1px solid rgba(220, 38, 38, 0.22);
    border-radius: var(--radius-pill);
    padding: 3px 9px;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--trans-fast);
    white-space: nowrap;
    font-family: inherit;
}

.btn-remove-file-badge:hover {
    background: #DC2626;
    color: #FFF;
    border-color: #DC2626;
}

.btn-verify-file-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(92, 158, 25, 0.12);
    color: #5C9E19;
    border: 1px solid rgba(92, 158, 25, 0.3);
    border-radius: var(--radius-pill);
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--trans-fast);
    white-space: nowrap;
    font-family: inherit;
}

.btn-verify-file-badge:hover {
    background: #5C9E19;
    color: #FFF;
    border-color: #5C9E19;
}

@keyframes dropzonePulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
    50% { transform: scale(1.02); box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.dropzone-highlight-pulse {
    animation: dropzonePulse 1.1s ease-in-out 2 !important;
    border-color: var(--brand-blue) !important;
    background: rgba(37, 99, 235, 0.05) !important;
}

/* Canvas B: BRS Dual Bridge Layout */
.brs-upload-bridge-grid {
    display: grid;
    grid-template-columns: 1fr 110px 1fr;
    gap: 16px;
    margin-bottom: 20px;
    align-items: center;
}

.matching-bridge-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 4px;
}

.bridge-line {
    width: 2px;
    height: 32px;
    background: var(--border-main);
}

.bridge-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--brand-blue);
    color: var(--brand-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xs);
}

.bridge-label {
    font-size: 10.5px;
    font-weight: 800;
    color: var(--brand-blue);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.bridge-sub {
    font-size: 9.5px;
    color: var(--text-light);
}

.upload-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-xs);
}

.card-cb { border-top: 4px solid var(--brand-blue); }
.card-bk { border-top: 4px solid var(--brand-purple); }

.upload-card-header h2 {
    font-size: 15.5px;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 5px;
}

.upload-card-header p {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 14px;
}

.doc-badge {
    display: inline-block;
    font-size: 9.5px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.4px;
}

.badge-cb { background: var(--brand-blue-light); color: var(--brand-blue); border: 1px solid var(--brand-blue-border); }
.badge-bk { background: var(--brand-purple-light); color: var(--brand-purple); border: 1px solid var(--brand-purple-border); }

.action-launch-bar {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 22px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.launch-subtext {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 10px;
}

.settings-drawer {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 12px 16px;
}

.settings-summary {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    user-select: none;
}

.settings-content {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-main);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

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

.form-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
}

.input-control {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    font-size: 12.5px;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-input);
    outline: none;
}

.input-control:focus {
    border-color: var(--brand-blue);
}

/* ==================== VIEW 2: STATEMENT ANALYTICS ==================== */
.workspace-header-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-lg, 14px);
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-xs);
    flex-wrap: nowrap;
}

.header-details {
    flex: 1 1 auto;
    min-width: 0;
}

.tag-label {
    font-size: 10px;
    font-weight: 800;
    color: var(--brand-blue);
    background: var(--brand-blue-light);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--brand-blue-border);
}

.header-details h2 {
    font-size: 16.5px;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 4px;
    line-height: 1.35;
    word-break: break-word;
}

.header-details p {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 3px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    margin-left: auto;
    justify-content: flex-end;
}

.header-actions .btn {
    white-space: nowrap;
}

/* KPI Cards Grid */
.kpi-ribbon-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.kpi-box {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 14px;
    display: flex;
    align-items: center;
    gap: 11px;
    box-shadow: var(--shadow-xs);
}

.kpi-box-green { border-left: 4px solid var(--brand-emerald); }
.kpi-box-green .kpi-icon-wrap { background: var(--brand-emerald-light); color: var(--brand-emerald); }

.kpi-box-red { border-left: 4px solid var(--brand-ruby); }
.kpi-box-red .kpi-icon-wrap { background: var(--brand-ruby-light); color: var(--brand-ruby); }

.kpi-box-blue { border-left: 4px solid var(--brand-blue); }
.kpi-box-blue .kpi-icon-wrap { background: var(--brand-blue-light); color: var(--brand-blue); }

.kpi-box-slate { border-left: 4px solid #64748B; }
.kpi-box-slate .kpi-icon-wrap { background: var(--bg-subtle); color: #64748B; }

.kpi-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.kpi-data {
    display: flex;
    flex-direction: column;
}

.kpi-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
}

.kpi-amount {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-main);
    margin: 2px 0;
}

.kpi-desc {
    font-size: 10.5px;
    color: var(--text-faint);
}

/* Risk Alert Card */
.risk-summary-card {
    margin-bottom: 18px;
}

.risk-alert-box {
    background: var(--brand-ruby-light);
    border: 1px solid var(--b4-border);
    border-left: 4px solid var(--brand-ruby);
    border-radius: var(--radius-sm);
    padding: 11px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

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

.risk-alert-title {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--brand-ruby);
}

.risk-alert-sub {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* Charts Grid */
.dashboard-charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
    margin-bottom: 18px;
}

.chart-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 15px 16px;
    box-shadow: var(--shadow-xs);
}

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

.panel-header h3 {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-main);
}

.panel-header span {
    font-size: 10.5px;
    color: var(--text-light);
}

.chart-canvas-container {
    height: 200px;
    position: relative;
    width: 100%;
}

/* ==================== VIEW 3: CATEGORIES WORKSPACE ==================== */
.categories-workspace {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.category-summary-ribbon {
    display: flex;
    flex-direction: column;
    gap: 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
    width: 100%;
    box-sizing: border-box;
}

.cat-summary-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
    width: 100%;
    box-sizing: border-box;
}

.cat-summary-stat {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.cat-stat-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-stat-inflow .cat-stat-icon-wrap {
    background: rgba(5, 150, 105, 0.12);
    color: var(--brand-emerald);
}

.cat-stat-outflow .cat-stat-icon-wrap {
    background: rgba(220, 38, 38, 0.12);
    color: var(--brand-ruby);
}

.cat-stat-top .cat-stat-icon-wrap {
    background: rgba(124, 58, 237, 0.12);
    color: var(--brand-purple);
}

.cat-stat-data {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.cat-stat-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-stat-amount {
    font-size: 15.5px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-main);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-stat-sub {
    font-size: 11px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-filter-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 12px;
    border-top: 1px dashed var(--border-main);
    width: 100%;
    box-sizing: border-box;
}

.cat-filter-hint {
    display: flex;
    align-items: center;
    gap: 6px;
}

.filter-pill-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.cat-pill-btn {
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.cat-pill-btn:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.cat-pill-btn.active {
    background: var(--brand-purple);
    color: #FFFFFF;
    border-color: var(--brand-purple);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

/* Category Cards Grid */
.category-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.category-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3.5px;
    background: var(--cat-accent-color, #3B82F6);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.category-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--cat-accent-color, var(--border-focus));
}

.category-card.active, .category-card.active-filtered {
    box-shadow: 0 0 0 2px var(--cat-accent-color, #7C3AED), 0 8px 18px rgba(0, 0, 0, 0.08);
    background: var(--bg-subtle);
    transform: translateY(-2px);
}

.category-card.is-zero {
    opacity: 0.62;
}

.category-card.is-zero:hover {
    opacity: 0.95;
}

.category-card-top {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.cat-icon-bubble {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.cat-info-wrap {
    flex: 1;
    min-width: 0;
}

.category-card-name {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.category-card-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 1.5px 6px;
    border-radius: var(--radius-pill);
    display: inline-block;
    margin-top: 1px;
}

.category-card-amount {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-main);
    margin-bottom: 4px;
    letter-spacing: -0.3px;
}

.category-card-sub {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cat-progress-track {
    width: 100%;
    height: 4px;
    background: var(--bg-subtle);
    border-radius: var(--radius-pill);
    margin-top: 8px;
    overflow: hidden;
}

.cat-progress-fill {
    height: 100%;
    border-radius: var(--radius-pill);
    transition: width 0.4s ease;
}

.badge-filter-indicator {
    background: rgba(124, 58, 237, 0.12);
    color: var(--brand-purple);
    border: 1px solid rgba(124, 58, 237, 0.25);
    border-radius: var(--radius-pill);
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 700;
}

/* Category Table Enhancements */
.category-table th {
    white-space: nowrap;
}

.cat-date-pill {
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-radius: 4px;
    padding: 2px 6px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    white-space: nowrap;
    display: inline-block;
}

.cat-party-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-pill);
    padding: 3px 8px;
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.party-avatar-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--brand-purple);
    color: #FFF;
    font-size: 9px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cat-select-pill {
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg-card) url('data:image/svg+xml;utf8,<svg fill="%2364748B" height="18" viewBox="0 0 24 24" width="18" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 8px center;
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 5px 28px 5px 10px;
    font-size: 11.5px;
    font-weight: 700;
    font-family: var(--font-main);
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
    width: 100%;
}

.cat-select-pill:hover, .cat-select-pill:focus {
    border-color: var(--brand-purple);
    outline: none;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

/* Anomaly Cards */
.anomalies-list-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.anomaly-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
}

.severity-high { border-left: 4px solid var(--brand-ruby); }
.severity-medium { border-left: 4px solid var(--brand-amber); }
.severity-low { border-left: 4px solid var(--brand-blue); }

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

.anomaly-title-group {
    display: flex;
    align-items: center;
    gap: 7px;
}

.anomaly-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-main);
}

.severity-badge {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 7px;
    border-radius: 4px;
}

.badge-high { background: var(--brand-ruby-light); color: var(--brand-ruby); }
.badge-medium { background: var(--brand-amber-light); color: var(--brand-amber); }
.badge-low { background: var(--brand-blue-light); color: var(--brand-blue); }

.anomaly-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.anomaly-action-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 11.5px;
    color: var(--text-main);
}

/* Inline Expandable Incident Table Tray */
.anomaly-expand-tray {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    margin: 10px 0;
    overflow: hidden;
}

.anomaly-tray-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: var(--bg-subtle);
    border-bottom: 1px solid var(--border-subtle);
    gap: 8px;
    flex-wrap: wrap;
}

.anomaly-tray-search {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 3px 8px;
    font-size: 11px;
}

.anomaly-tray-search input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 11px;
    color: var(--text-main);
    width: 140px;
}

.anomaly-txns-table-wrap {
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.anomaly-txns-table-wrap::-webkit-scrollbar {
    width: 5px;
}

.anomaly-txns-table-wrap::-webkit-scrollbar-thumb {
    background: var(--border-main);
    border-radius: 4px;
}

.anomaly-txns-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11.5px;
}

.anomaly-txns-table thead th {
    background: var(--bg-subtle);
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 6px 10px;
    text-align: left;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    border-bottom: 1px solid var(--border-main);
}

.anomaly-txns-table tbody tr {
    border-bottom: 1px solid var(--border-subtle);
    transition: background 0.15s ease;
}

.anomaly-txns-table tbody tr:hover {
    background: var(--bg-hover);
}

.anomaly-txns-table tbody td {
    padding: 6px 10px;
    color: var(--text-main);
}

.anomaly-tray-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.anomaly-tray-toggle-btn:hover {
    background: var(--bg-hover);
    border-color: var(--brand-purple);
    color: var(--brand-purple);
}

/* Ledger Card & Clean Tables */
.ledger-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.ledger-header {
    padding: 13px 18px;
    border-bottom: 1px solid var(--border-main);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.ledger-header h3 {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-main);
}

.ledger-header p, .ledger-header .ledger-header-sub {
    font-size: 11.5px;
    color: var(--text-light);
}

.ledger-header .btn-primary,
.ledger-header .btn-primary span,
.ledger-header .btn-primary .material-symbols-rounded {
    color: #FFFFFF !important;
}

.ledger-filters {
    display: flex;
    gap: 8px;
    align-items: center;
}

.search-input {
    width: 210px;
    padding: 6px 10px;
    font-size: 11.5px;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 460px;
}

.clean-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    text-align: left;
}

.clean-table th {
    background: var(--bg-subtle);
    padding: 8px 11px;
    font-size: 10.5px;
    font-weight: 800;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 1px solid var(--border-main);
    position: sticky;
    top: 0;
    z-index: 10;
}

.clean-table td {
    padding: 8px 11px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-main);
    vertical-align: middle;
}

.clean-table tbody tr:hover {
    background: var(--bg-subtle);
}

/* Category Filter & Table Inline Select Dropdowns */
#category-filter-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-card);
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 13px;
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 6px 30px 6px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

#category-filter-select:hover, #category-filter-select:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--brand-blue-light);
}

.cat-select-pill {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: var(--bg-card);
    background-image: var(--select-chevron);
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    font-size: 11.5px;
    font-weight: 700;
    padding: 4px 26px 4px 10px;
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    font-family: inherit;
    max-width: 190px;
    transition: var(--transition);
    box-shadow: var(--shadow-xs);
}

.cat-select-pill:hover, .cat-select-pill:focus {
    border-color: var(--brand-blue);
}

/* ==================== BRS RECONCILIATION ==================== */
.recon-hero-ribbon {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.recon-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
}

.stat-val {
    font-size: 18px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-main);
    margin: 3px 0 5px 0;
}

.stat-tag {
    align-self: flex-start;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.tag-dr { background: var(--brand-blue-light); color: var(--brand-blue); }
.tag-cr { background: var(--brand-purple-light); color: var(--brand-purple); }
.tag-success { background: var(--brand-emerald-light); color: var(--brand-emerald); border: 1px solid var(--b2-border); }

.card-verdict { border-left: 4px solid var(--brand-emerald); }

.section-title-row {
    margin-bottom: 10px;
}

.section-title-row h3 {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-main);
}

.section-title-row span {
    font-size: 11px;
    color: var(--text-light);
}

.buckets-strip-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.bucket-box {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 12px;
    box-shadow: var(--shadow-xs);
}

.b1-box { border-top: 3px solid var(--b1-color); }
.b2-box { border-top: 3px solid var(--b2-color); }
.b3-box { border-top: 3px solid var(--b3-color); }
.b4-box { border-top: 3px solid var(--b4-color); }

.bucket-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.bucket-icon {
    font-size: 19px;
    color: var(--text-muted);
}

.bucket-math-sign {
    font-size: 10px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
}

.b1-box .bucket-math-sign { background: var(--b1-bg); color: var(--b1-color); }
.b2-box .bucket-math-sign { background: var(--b2-bg); color: var(--b2-color); }
.b3-box .bucket-math-sign { background: var(--b3-bg); color: var(--b3-color); }
.b4-box .bucket-math-sign { background: var(--b4-bg); color: var(--b4-color); }

.bucket-box h4 {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.bucket-info-icon {
    font-size: 14px;
    color: var(--text-light);
    cursor: help;
    transition: color 0.15s;
    vertical-align: middle;
}

.bucket-info-icon:hover {
    color: var(--brand-blue);
}

/* Tooltip container */
.has-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.has-tooltip .tooltip-content {
    visibility: hidden;
    opacity: 0;
    width: 240px;
    background-color: var(--brand-navy);
    color: #FFFFFF;
    text-align: left;
    border-radius: 8px;
    padding: 8px 12px;
    position: absolute;
    z-index: 500;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    box-shadow: var(--shadow-lg);
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
}

.has-tooltip .tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--brand-navy) transparent transparent transparent;
}

.has-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

.bucket-box p {
    display: none; /* Hide static text for ultra-compact vertical density */
}

.bucket-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-light);
    padding-top: 6px;
    margin-top: 8px;
}

/* Text & Badge Pending (Accounting Warning State - Not System Failure) */
.text-pending {
    color: var(--brand-amber) !important;
}

.badge-pending {
    background: var(--brand-amber-light) !important;
    color: var(--brand-amber) !important;
    border: 1px solid var(--brand-amber-border) !important;
}

/* Empty Success State */
.empty-success-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    background: var(--bg-card);
    border: 1.5px dashed var(--brand-emerald);
    border-radius: 16px;
    margin: 20px 0;
}

.empty-success-icon-wrap {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--brand-emerald-light);
    color: var(--brand-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.empty-success-icon-wrap span {
    font-size: 32px;
}


.b-count {
    font-size: 10.5px;
    color: var(--text-muted);
    font-weight: 600;
}

.b-amount {
    font-size: 13px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-main);
}

/* Matcher Side-by-Side */
.matcher-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.matcher-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.matcher-panel-header {
    padding: 11px 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    border-bottom: 1px solid var(--border-main);
}

.matcher-panel-header h3 {
    font-size: 12.5px;
    font-weight: 800;
}

.cb-theme { background: var(--brand-blue-light); color: var(--brand-blue); }
.bk-theme { background: var(--brand-purple-light); color: var(--brand-purple); }

.panel-pill {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 700;
    background: var(--bg-card);
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid var(--border-main);
}

/* ==================== EXPORT VIEW ==================== */
.export-header-box {
    margin-bottom: 20px;
}

.export-header-box h2 {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
}

.export-header-box p {
    font-size: 12px;
    color: var(--text-light);
}

.export-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 18px;
    max-width: 940px;
}

.export-tile {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 22px 18px;
    box-shadow: var(--shadow-xs);
    display: flex;
    flex-direction: column;
    position: relative;
}

.tile-gold { border-top: 4px solid #D97706; background: linear-gradient(180deg, rgba(245, 158, 11, 0.03) 0%, var(--bg-card) 100%); }
.tile-purple { border-top: 4px solid var(--brand-purple); }
.tile-blue { border-top: 4px solid var(--brand-blue); }
.tile-green { border-top: 4px solid var(--brand-emerald); }

.featured-tile {
    border: 1.5px solid #F59E0B;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.12);
}

.tile-badge-pill {
    position: absolute;
    top: -11px;
    right: 14px;
    background: #D97706;
    color: #FFFFFF;
    font-size: 9.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 12px;
    letter-spacing: 0.4px;
}

.tile-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 10px;
}

.tile-gold .tile-icon-wrap { background: #FEF3C7; color: #D97706; }
.tile-purple .tile-icon-wrap { background: var(--brand-purple-light); color: var(--brand-purple); }
.tile-blue .tile-icon-wrap { background: var(--brand-blue-light); color: var(--brand-blue); }
.tile-green .tile-icon-wrap { background: var(--brand-emerald-light); color: var(--brand-emerald); }

.btn-gold {
    background: #D97706;
    color: #FFFFFF;
}
.btn-gold:hover {
    background: #B45309;
}

.export-tile h3 {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 5px;
}

.export-tile p {
    font-size: 11.5px;
    color: var(--text-light);
    line-height: 1.45;
    margin-bottom: 16px;
    flex: 1;
}

/* Empty Placeholder Container */
.empty-placeholder {
    padding: 32px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    margin: 16px auto;
    box-sizing: border-box;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal-backdrop);
    backdrop-filter: blur(2px);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    width: 420px;
    max-width: 90vw;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

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

.modal-header h2 {
    font-size: 14.5px;
    font-weight: 800;
}

.modal-close {
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-light);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

/* ============================================================
   PREMIUM UNIFIED TRANSACTION MATCHER & MANUAL TALLY
   ============================================================ */

/* Floating Segmented Mode Switcher (Apple / Linear SaaS Grade) */
.matcher-mode-switcher-bar {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 14px;
    padding: 5px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.matcher-subtab-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-light);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
}

.matcher-subtab-btn .material-symbols-rounded {
    font-size: 18px;
    transition: transform 0.2s ease;
}

.matcher-subtab-btn:hover {
    color: var(--text-main);
    background: var(--bg-subtle);
}

.matcher-subtab-btn.active {
    background: var(--bg-card);
    color: var(--brand-blue);
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.12), 0 1px 3px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] .matcher-subtab-btn.active {
    background: rgba(37, 99, 235, 0.18);
    color: #60A5FA;
    border-color: rgba(96, 165, 250, 0.3);
}

.matcher-subtab-btn .tab-count-pill {
    background: rgba(37, 99, 235, 0.12);
    color: var(--brand-blue);
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 20px;
    font-family: var(--font-mono);
}

.matcher-subtab-btn.active .tab-count-pill {
    background: var(--brand-blue);
    color: #FFFFFF;
}

.matcher-subpanel {
    margin-top: 4px;
}

.matcher-subpanel.hidden {
    display: none !important;
}

.matcher-subpanel .empty-placeholder {
    padding: 8px 0 !important;
    min-height: auto !important;
    margin: 4px auto 16px auto !important;
}

.matcher-subpanel .empty-success-card {
    padding: 24px 28px !important;
    max-width: 480px !important;
    box-shadow: var(--shadow-md) !important;
    border-radius: 16px !important;
}

.matcher-subpanel .empty-hero-icon-ring {
    width: 48px !important;
    height: 48px !important;
    margin-bottom: 10px !important;
}

.matcher-subpanel .empty-hero-icon-ring .material-symbols-rounded {
    font-size: 26px !important;
}

.matcher-subpanel .empty-status-pill {
    margin-bottom: 8px !important;
    font-size: 10px !important;
    padding: 2px 10px !important;
}

.matcher-subpanel .empty-success-title {
    font-size: 15px !important;
    margin-bottom: 6px !important;
}

.matcher-subpanel .empty-success-desc {
    font-size: 12px !important;
    line-height: 1.5 !important;
    margin-bottom: 16px !important;
}

.matcher-subpanel .empty-action-row {
    gap: 8px !important;
}

.matcher-subpanel .empty-action-row .btn {
    padding: 7px 14px !important;
    font-size: 12px !important;
}

/* Dual Side-by-Side Grid */
.matcher-dual-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: stretch;
}

@media (max-width: 1100px) {
    .matcher-dual-grid {
        grid-template-columns: 1fr;
    }
}

.matcher-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px -4px rgba(0, 0, 0, 0.04);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.matcher-panel:hover {
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.07);
}

.matcher-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-main);
    gap: 12px;
}

.matcher-panel-header.cb-theme {
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.03) 0%, rgba(37, 99, 235, 0.05) 100%);
    border-bottom: 2px solid rgba(37, 99, 235, 0.15);
}

.matcher-panel-header.bk-theme {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.03) 0%, rgba(16, 185, 129, 0.06) 100%);
    border-bottom: 2px solid rgba(16, 185, 129, 0.2);
}

.matcher-panel-header .header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.matcher-panel-header .header-left .material-symbols-rounded {
    font-size: 20px;
}

.matcher-panel-header.cb-theme .material-symbols-rounded {
    color: var(--brand-blue);
}

.matcher-panel-header.bk-theme .material-symbols-rounded {
    color: var(--brand-emerald);
}

.matcher-panel-header h3 {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.2px;
}

.matcher-panel .panel-pill {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    color: var(--text-light);
    font-family: var(--font-mono);
}

/* Matcher Table & Cells */
.matcher-table-wrap {
    max-height: 65vh;
    min-height: 260px;
    overflow-y: auto;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
    padding-bottom: 12px;
}

.matcher-table-wrap::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.matcher-table-wrap::-webkit-scrollbar-track {
    background: transparent;
}

.matcher-table-wrap::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 4px;
}

.matcher-table-wrap::-webkit-scrollbar-thumb:hover {
    background: rgba(100, 116, 139, 0.75);
}

.matcher-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
}

.matcher-table thead th {
    position: sticky;
    top: 0;
    background: var(--bg-subtle);
    color: var(--text-light);
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--border-main);
    z-index: 10;
    white-space: nowrap;
}

.matcher-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-subtle);
    color: var(--text-main);
    vertical-align: middle;
    transition: background 0.15s ease;
}

.matcher-table tbody tr:last-child td {
    border-bottom: none;
    padding-bottom: 16px;
}

.matcher-table tbody tr:hover td {
    background: rgba(241, 245, 249, 0.7) !important;
}

[data-theme="dark"] .matcher-table tbody tr:hover td {
    background: rgba(255, 255, 255, 0.04) !important;
}

.matcher-date-cell {
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 12px;
    color: var(--text-light);
    white-space: nowrap;
    width: 105px;
    min-width: 105px;
}

.matcher-desc-cell {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text-main);
    line-height: 1.45;
}

.matcher-amount-cell {
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 700;
    text-align: right;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
    width: 130px;
    min-width: 130px;
}

.matcher-status-cell {
    text-align: center;
    width: 155px;
    min-width: 155px;
    white-space: nowrap;
}

.btn-unmatch-action {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2.5px 7px;
    font-size: 11px;
    font-weight: 700;
    color: #DC2626;
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-unmatch-action:hover {
    background: #DC2626;
    color: #ffffff;
    border-color: #DC2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.25);
}

.matcher-table tbody tr.row-active-highlight td {
    background: rgba(37, 99, 235, 0.12) !important;
    border-top: 1.5px solid #2563EB !important;
    border-bottom: 1.5px solid #2563EB !important;
}

/* ==================== PARSE QUALITY INLINE DASHBOARD BANNER ==================== */
.parse-warning-alert {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-left: 4px solid var(--brand-amber);
    border-radius: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.02);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.parse-warning-alert.pwa-error {
    border-left-color: var(--brand-ruby);
}

.pwa-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
}

.pwa-main-info {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 280px;
}

.pwa-icon-ring {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--brand-amber-light);
    color: var(--brand-amber);
    border: 1px solid var(--brand-amber-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
}

.pwa-error .pwa-icon-ring {
    background: var(--brand-ruby-light);
    color: var(--brand-ruby);
    border-color: var(--brand-ruby-border);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.pwa-title-group {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.pwa-headline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pwa-headline {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

.pwa-conf-tag {
    font-size: 10px;
    font-weight: 800;
    padding: 1.5px 8px;
    border-radius: 12px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    background: var(--brand-amber-light);
    color: var(--brand-amber);
    border: 1px solid var(--brand-amber-border);
}

.pwa-error .pwa-conf-tag {
    background: var(--brand-ruby-light);
    color: var(--brand-ruby);
    border-color: var(--brand-ruby-border);
}

.pwa-subtext {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

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

/* 3-Column Clean Mini-Cards for Actionable Tips */
.pwa-steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 10px;
    margin-top: 2px;
}

.pwa-step-card {
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-radius: 10px;
    padding: 10px 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transition: all 0.2s ease;
}

.pwa-step-card:hover {
    border-color: var(--brand-blue-border);
    background: var(--bg-card);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.pwa-step-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    background: var(--brand-blue-light);
    color: var(--brand-blue);
    border: 1px solid var(--brand-blue-border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 1px;
}

.pwa-step-content {
    flex: 1;
    min-width: 0;
}

.pwa-step-title {
    font-size: 11.5px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 2px;
}

.pwa-step-desc {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

/* ==================== PARSE QUALITY TOAST (MODERN DESIGN SYSTEM) ==================== */
#parse-warning-banner {
    position: fixed;
    top: 84px;
    right: 28px;
    z-index: 9999;
    max-width: 440px;
    width: calc(100vw - 48px);
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: 0 16px 40px -6px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.04);
    animation: toastSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(16px);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#parse-warning-banner.pwa-warning {
    border-color: rgba(217, 119, 6, 0.45);
    box-shadow: 0 16px 40px -6px rgba(217, 119, 6, 0.15), 0 0 0 1px rgba(217, 119, 6, 0.15);
}

#parse-warning-banner.pwa-error {
    border-color: rgba(220, 38, 38, 0.45);
    box-shadow: 0 16px 40px -6px rgba(220, 38, 38, 0.15), 0 0 0 1px rgba(220, 38, 38, 0.15);
}

@keyframes toastSlideDown {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.toast-header-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.toast-icon-wrap {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.pwa-warning .toast-icon-wrap {
    background: var(--brand-amber-light);
    color: var(--brand-amber);
    border: 1px solid var(--brand-amber-border);
}

.pwa-error .toast-icon-wrap {
    background: var(--brand-ruby-light);
    color: var(--brand-ruby);
    border: 1px solid var(--brand-ruby-border);
}

.toast-title-area {
    flex: 1;
    min-width: 0;
}

.toast-badge-pill {
    display: inline-flex;
    align-items: center;
    font-size: 10px;
    font-weight: 800;
    padding: 1px 7px;
    border-radius: 10px;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.pwa-warning .toast-badge-pill {
    background: var(--brand-amber-light);
    color: var(--brand-amber);
    border: 1px solid var(--brand-amber-border);
}

.pwa-error .toast-badge-pill {
    background: var(--brand-ruby-light);
    color: var(--brand-ruby);
    border: 1px solid var(--brand-ruby-border);
}

.toast-heading {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.3;
    margin: 0;
}

.toast-body-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
    margin: 4px 0 0 0;
}

.toast-rec-box {
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-left: 3px solid var(--brand-amber);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 11.5px;
    color: var(--text-main);
    line-height: 1.45;
}

.pwa-error .toast-rec-box {
    border-left-color: var(--brand-ruby);
}

.toast-action-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 2px;
}

.toast-close-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.toast-close-btn:hover {
    background: var(--bg-subtle-hover);
    color: var(--text-main);
}

/* Status Pill Tags (Crisp, High-contrast, Modern) */
.conf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 700;
    padding: 3.5px 10px;
    border-radius: 20px;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.conf-green {
    background: #ECFDF5;
    color: #059669;
    border: 1px solid #A7F3D0;
}

.conf-blue {
    background: #EFF6FF;
    color: #2563EB;
    border: 1px solid #BFDBFE;
}

.conf-purple {
    background: #F5F3FF;
    color: #7C3AED;
    border: 1px solid #DDD6FE;
}

.conf-amber {
    background: #FFFBEB;
    color: #D97706;
    border: 1px solid #FDE68A;
}

.conf-ruby {
    background: #FFF1F2;
    color: #E11D48;
    border: 1px solid #FECDD3;
}

[data-theme="dark"] .conf-green {
    background: rgba(5, 150, 105, 0.18);
    color: #34D399;
    border-color: rgba(52, 211, 153, 0.3);
}

[data-theme="dark"] .conf-blue {
    background: rgba(37, 99, 235, 0.18);
    color: #60A5FA;
    border-color: rgba(96, 165, 250, 0.3);
}

[data-theme="dark"] .conf-ruby {
    background: rgba(225, 29, 72, 0.18);
    color: #FB7185;
    border-color: rgba(251, 113, 133, 0.3);
}

/* BRS Month Navigation Tabs */
.brs-month-tabs-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 6px 2px 14px 2px;
    margin-bottom: 8px;
    scrollbar-width: thin;
}

.brs-month-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    color: var(--text-main);
    border-radius: var(--radius-pill);
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
    user-select: none;
}

.brs-month-pill:hover {
    border-color: var(--brand-blue);
    background: var(--bg-subtle);
}

.brs-month-pill.active {
    background: var(--brand-blue);
    border-color: var(--brand-blue);
    color: #FFFFFF;
    box-shadow: var(--shadow-sm);
}

.brs-detail-btn {
    background: transparent;
    border: 1px solid var(--border-main);
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--brand-blue);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-top: 4px;
    transition: var(--transition);
}

.brs-detail-btn:hover {
    background: var(--bg-subtle);
    border-color: var(--brand-blue);
}

.brs-details-tray {
    margin-top: 6px;
    padding: 8px 12px;
    background: var(--bg-subtle);
    border-radius: 6px;
    border: 1px dashed var(--border-main);
    font-size: 11px;
    color: var(--text-main);
    max-height: 220px;
    overflow-y: auto;
}

.brs-proof-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.proof-equation {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12.5px;
    font-weight: 700;
    flex-wrap: wrap;
}

.proof-item {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
}

.proof-item span {
    font-size: 10px;
    color: var(--text-light);
    text-transform: uppercase;
}

.proof-item strong {
    font-family: var(--font-mono);
    font-size: 13px;
}

.print-letterhead-header, .print-sign-off-block {
    display: none;
}

/* ============================================================
   RESPONSIVE DESIGN SYSTEM — TABLETS & MOBILE PHONES
   Supports both LTR (English) and RTL (Arabic)
   ============================================================ */

/* ---------- TABLET & BELOW (<= 1024px) ---------- */
@media (max-width: 1024px) {
    /* App Layout & Off-Canvas Drawer */
    .app-layout {
        position: relative;
        overflow-x: hidden;
    }

    .sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 280px;
        max-width: 85vw;
        height: 100vh;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s ease;
        box-shadow: none;
    }

    .sidebar.mobile-open {
        transform: translateX(0) !important;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
    }

    .sidebar-close-btn {
        display: flex !important;
    }

    [dir="rtl"] .sidebar {
        left: auto;
        right: 0;
        transform: translateX(100%);
    }

    [dir="rtl"] .sidebar.mobile-open {
        transform: translateX(0) !important;
    }

    .main-content {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-height: 100vh;
    }

    .mobile-nav-toggle-btn {
        display: inline-flex !important;
    }

    body.mobile-drawer-open {
        overflow: hidden;
        touch-action: none;
    }

    /* Top Bar Header */
    .top-bar {
        height: auto;
        min-height: 56px;
        padding: 8px 14px;
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px 10px;
    }

    .top-bar-left {
        flex: 1 1 auto;
        min-width: 0;
        display: flex;
        align-items: center;
        gap: 8px;
        order: 1;
    }

    .mobile-header-brand {
        display: flex !important;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        order: 2;
        margin-left: auto;
        padding: 3px 8px;
        border-radius: 8px;
        background: #FFFFFF;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
        border: 1px solid rgba(0, 0, 0, 0.08);
    }

    [dir="rtl"] .mobile-header-brand {
        margin-left: 0;
        margin-right: auto;
    }

    .mobile-brand-logo-img {
        height: 38px;
        max-width: 150px;
        width: auto;
        object-fit: contain;
        display: block;
    }

    [data-theme="dark"] .mobile-header-brand {
        background: #FFFFFF !important;
        padding: 3px 8px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.45) !important;
    }

    .top-bar-right {
        order: 3;
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-end !important;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 6px;
        border-top: 1px solid var(--border-light);
    }

    [dir="rtl"] .top-bar-right {
        justify-content: flex-start !important;
    }

    .topbar-actions-cluster {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        order: 1;
        flex-shrink: 0;
    }

    #ctrl-month-select {
        order: 2;
        max-width: 130px;
        flex-shrink: 0;
    }

    .workspace-container {
        padding: 14px 12px 60px 12px;
        box-sizing: border-box !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* View 1: Upload Documents */
    .upload-mode-switcher {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .mode-tab-btn {
        width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        min-height: 52px;
        padding: 12px 14px;
        text-align: left;
    }

    [dir="rtl"] .mode-tab-btn {
        text-align: right;
    }

    .analyzer-upload-hero {
        display: flex !important;
        flex-direction: column !important;
        padding: 20px 16px !important;
        gap: 16px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin: 0 0 20px 0 !important;
    }

    .analyzer-hero-left {
        display: contents !important;
    }

    .analyzer-intro-text {
        order: 1 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .analyzer-hero-right {
        order: 2 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .supported-banks-container {
        order: 3 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 12px 14px !important;
        margin-top: 2px !important;
    }

    .modern-drop-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 24px 16px !important;
    }

    .statement-crosscheck-card {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 16px 14px !important;
    }

    .brs-upload-bridge-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .matching-bridge-indicator {
        flex-direction: row;
        height: 44px;
        margin: 4px 0;
    }

    .bridge-line {
        width: 50px;
        height: 2px;
    }

    .settings-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .action-launch-bar .btn {
        width: 100%;
        max-width: 440px;
    }

    .supported-banks-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    /* View 2: Statement Overview */
    .workspace-header-card {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 16px 18px;
    }

    .header-details {
        width: 100%;
    }

    .header-actions {
        display: flex;
        flex-wrap: wrap;
        width: 100%;
        margin-left: 0;
        gap: 8px;
        border-top: 1px solid var(--border-light);
        padding-top: 12px;
        justify-content: flex-start;
    }

    .header-actions .btn {
        flex: 1 1 calc(50% - 6px);
        min-width: 130px;
        justify-content: center;
    }

    .kpi-ribbon-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .dashboard-charts-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .chart-panel {
        padding: 14px 14px;
    }

    .chart-canvas-container {
        height: 250px;
        min-height: 220px;
        position: relative;
        width: 100%;
    }

    .analyzer-dispute-alert-banner {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        text-align: left;
    }

    [dir="rtl"] .analyzer-dispute-alert-banner {
        text-align: right;
    }

    /* View 3: Categories */
    .cat-summary-stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .cat-summary-stat:last-child {
        grid-column: span 2;
    }

    .cat-filter-controls-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .filter-pill-buttons {
        flex-wrap: wrap;
        gap: 6px;
    }

    .category-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 12px;
    }

    .ledger-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .ledger-filters {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

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

    .ledger-filters .custom-dropdown-wrapper {
        flex: 1 1 calc(50% - 4px);
        min-width: 140px;
    }

    .clean-table.category-table {
        min-width: 760px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
        position: relative;
    }

    .table-pagination-bar {
        flex-wrap: wrap;
        gap: 10px;
        justify-content: center;
        text-align: center;
    }

    /* View 4: Issues & Warnings */
    .risk-kpi-ribbon {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    /* View 5: Charge Disputes */
    .dispute-studio-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .kpi-ribbon-grid[style*="grid-template-columns:repeat(3, 1fr)"] {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .dispute-letter-tabs-bar {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        gap: 6px;
        padding-bottom: 4px;
    }

    .dispute-actions-toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }

    .dispute-actions-toolbar .btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 130px;
    }

    /* View 6: BRS Reconciliation */
    .brs-month-tabs-bar {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding: 4px 2px 8px;
    }

    .recon-hero-ribbon {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .recon-stat-card.card-verdict {
        grid-column: span 2;
    }

    .buckets-strip-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .clean-table.brs-master-table {
        min-width: 650px;
    }

    .brs-proof-card {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        text-align: center;
    }

    .proof-equation {
        justify-content: center;
        gap: 8px;
        font-size: 11.5px;
    }

    /* View 7: Compare Files */
    .matcher-mode-switcher-bar {
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .matcher-mode-switcher-bar {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: 8px !important;
        padding: 6px !important;
        border-radius: 12px !important;
        margin-bottom: 14px !important;
    }

    .matcher-subtab-btn {
        flex: 1 1 auto !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 9px 14px !important;
        font-size: 12.5px !important;
        border-radius: 8px !important;
    }

    .matcher-dual-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .matcher-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .matcher-table {
        min-width: 500px;
    }

    #tally-floating-bar {
        left: 14px;
        right: 14px;
        transform: none;
        width: auto;
        max-width: calc(100% - 28px);
        bottom: 14px;
        justify-content: space-between;
        padding: 10px 14px;
        gap: 8px;
        flex-wrap: wrap;
    }

    /* View 8: Download Reports */
    .export-cards-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 14px;
        max-width: 100%;
    }

    .export-tile .btn {
        width: 100%;
    }

    /* Modals */
    .modal-content {
        width: calc(100% - 24px) !important;
        max-width: 540px !important;
        margin: 16px auto;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ---------- MOBILE PHONES (<= 767px) ---------- */
@media (max-width: 767px) {
    /* Top Bar Header Mobile Compacting */
    .top-bar {
        padding: 8px 12px;
        min-height: 56px;
        gap: 8px 10px;
    }

    .top-bar-left .view-title {
        font-size: 13.5px;
        max-width: 155px;
    }

    .mobile-brand-logo-img {
        height: 36px;
        max-width: 145px;
    }

    .top-bar-left .view-subtitle {
        display: none !important;
    }

    .compact-action-btn .action-text {
        display: none;
    }

    .compact-action-btn {
        padding: 0 7px;
        height: 32px;
        min-width: 32px;
    }

    .pill-select {
        font-size: 11.5px;
        height: 30px;
        padding: 0 18px 0 6px;
    }

    .top-bar-right {
        justify-content: flex-end !important;
        gap: 6px;
    }

    [dir="rtl"] .top-bar-right {
        justify-content: flex-start !important;
    }

    .topbar-actions-cluster {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        order: 1 !important;
        flex-shrink: 0 !important;
    }

    #ctrl-month-select {
        order: 2 !important;
        max-width: 125px !important;
        flex-shrink: 0 !important;
    }

    .custom-dropdown-menu {
        right: 0 !important;
        left: auto !important;
        min-width: 160px !important;
        max-width: calc(100vw - 20px) !important;
    }

    [dir="rtl"] .custom-dropdown-menu {
        right: auto !important;
        left: 0 !important;
    }

    #brs-topbar-controls {
        width: 100%;
        display: flex;
        gap: 6px;
        order: 3 !important;
        margin-top: 2px;
    }

    #brs-topbar-controls .custom-dropdown-wrapper {
        flex: 1 1 50%;
        min-width: 0;
    }

    #brs-topbar-controls select {
        width: 100%;
        text-overflow: ellipsis;
    }

    .workspace-container {
        padding: 10px 8px 50px 8px;
        box-sizing: border-box !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow-x: hidden !important;
    }

    /* View 1: Upload Mobile Adjustments */
    .upload-mode-switcher {
        display: flex !important;
        flex-direction: column !important;
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .mode-tab-btn {
        padding: 10px 12px;
        gap: 10px;
        width: 100% !important;
    }

    .mode-title {
        font-size: 13px;
    }

    .mode-sub {
        font-size: 10.5px;
    }

    .analyzer-upload-hero {
        display: flex !important;
        flex-direction: column !important;
        padding: 16px 12px !important;
        gap: 14px !important;
        margin: 0 0 16px 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .analyzer-hero-left {
        display: contents !important;
    }

    .analyzer-intro-text {
        order: 1 !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .analyzer-hero-right {
        order: 2 !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .supported-banks-container {
        order: 3 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-top: 2px !important;
    }

    .modern-drop-card {
        padding: 20px 12px !important;
        border-width: 1.5px;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
    }

    .file-loaded-banner.active {
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
        padding: 10px 8px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    .file-banner-info {
        min-width: 0 !important;
        width: 100% !important;
        text-align: center !important;
    }

    .file-banner-actions {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 6px !important;
        width: 100% !important;
    }

    .btn-verify-file-badge, .btn-switch-sheet-badge, .btn-remove-file-badge {
        font-size: 10.5px !important;
        padding: 4px 8px !important;
        white-space: normal !important;
        text-align: center !important;
    }

    .drop-icon-bubble {
        width: 42px;
        height: 42px;
        font-size: 20px;
    }

    .drop-title {
        font-size: 13px;
    }

    .drop-subtitle {
        font-size: 11px;
    }

    .settings-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .statement-crosscheck-card {
        padding: 14px 12px !important;
        margin: 0 0 16px 0 !important;
        width: 100% !important;
    }

    .btn-select-file {
        font-size: 12px;
        padding: 7px 12px;
    }

    .supported-banks-row {
        gap: 5px;
    }

    .bank-pill {
        font-size: 10.5px;
        padding: 4px 8px;
    }

    /* View 2: Analyzer Overview Mobile */
    .kpi-ribbon-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .kpi-box {
        padding: 12px 14px;
    }

    .kpi-amount {
        font-size: 18px;
    }

    .header-actions .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .chart-canvas-container {
        height: 220px;
    }

    .panel-header h3 {
        font-size: 12px;
    }

    /* View 3: Categories Mobile */
    .cat-summary-stats-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .cat-summary-stat:last-child {
        grid-column: span 1;
    }

    .category-cards-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ledger-filters .custom-dropdown-wrapper {
        flex: 1 1 100%;
    }

    .ledger-filters .btn {
        flex: 1 1 calc(50% - 4px);
    }

    .table-pagination-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        text-align: center;
    }

    .pagination-size-selector {
        justify-content: center;
    }

    /* View 4: Issues Mobile */
    .anomalies-header-row {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }

    .anomalies-header-row .section-title-row {
        width: 100% !important;
    }

    .anomalies-header-row .anomalies-print-btn {
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    .risk-kpi-ribbon {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    /* View 5: Disputes Mobile */
    .kpi-ribbon-grid[style*="grid-template-columns:repeat(3, 1fr)"] {
        grid-template-columns: 1fr !important;
    }

    .form-row-compact {
        flex-direction: column;
        gap: 8px;
    }

    .dispute-actions-toolbar .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .dispute-panel-header {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .dispute-items-scroll {
        max-height: 400px;
    }

    .dispute-tab {
        font-size: 11.5px;
        padding: 8px 10px;
        white-space: nowrap;
    }

    /* View 6: BRS Mobile */
    .recon-hero-ribbon {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .recon-stat-card.card-verdict {
        grid-column: span 1;
    }

    .buckets-strip-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .ledger-actions {
        flex-wrap: wrap;
        width: 100%;
        gap: 6px;
    }

    .ledger-actions .btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .recon-workspace .table-container {
        overflow-x: visible !important;
        width: 100% !important;
        padding: 0 !important;
    }

    .clean-table.brs-master-table {
        display: block !important;
        width: 100% !important;
        min-width: 0 !important;
        border: none !important;
    }

    .clean-table.brs-master-table thead {
        display: none !important;
    }

    .clean-table.brs-master-table tbody {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
        width: 100% !important;
    }

    .clean-table.brs-master-table tr.brs-row {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: flex-start !important;
        justify-content: space-between !important;
        padding: 10px 12px !important;
        border-radius: 10px !important;
        border: 1px solid var(--border-main) !important;
        background: var(--bg-card) !important;
        box-shadow: var(--shadow-xs) !important;
        box-sizing: border-box !important;
        width: 100% !important;
    }

    .clean-table.brs-master-table tr.brs-row-section {
        display: block !important;
        padding: 8px 12px !important;
        font-size: 11px !important;
        font-weight: 800 !important;
        border-radius: 8px !important;
        margin-top: 4px !important;
        border: 1px solid var(--border-main) !important;
    }

    .clean-table.brs-master-table tr.brs-row-section td {
        display: block !important;
        padding: 0 !important;
        border: none !important;
    }

    .clean-table.brs-master-table tr.brs-row-subtotal {
        background: var(--bg-surface) !important;
        border: 1.5px dashed var(--border-main) !important;
    }

    .clean-table.brs-master-table tr.brs-row-result {
        background: var(--bg-surface) !important;
        border: 2px solid var(--brand-emerald) !important;
    }

    .clean-table.brs-master-table .brs-cell-idx {
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: 22px !important;
        height: 22px !important;
        border-radius: 6px !important;
        background: var(--bg-surface) !important;
        border: 1px solid var(--border-main) !important;
        font-size: 10.5px !important;
        flex-shrink: 0 !important;
        margin-right: 8px !important;
        padding: 0 !important;
    }

    [dir="rtl"] .clean-table.brs-master-table .brs-cell-idx {
        margin-right: 0 !important;
        margin-left: 8px !important;
    }

    .clean-table.brs-master-table tr.brs-row-subtotal .brs-cell-idx,
    .clean-table.brs-master-table tr.brs-row-empty .brs-cell-idx {
        display: none !important;
    }

    .clean-table.brs-master-table .brs-cell-desc {
        flex: 1 1 auto !important;
        min-width: 130px !important;
        max-width: calc(100% - 130px) !important;
        padding: 0 !important;
        border: none !important;
    }

    .clean-table.brs-master-table tr.brs-row-subtotal .brs-cell-desc {
        max-width: 55% !important;
        text-align: left !important;
    }

    [dir="rtl"] .clean-table.brs-master-table tr.brs-row-subtotal .brs-cell-desc {
        text-align: right !important;
    }

    /* In item rows, final amount is empty, so hide it */
    .clean-table.brs-master-table tr.brs-row-item .brs-cell-final {
        display: none !important;
    }

    /* In start, subtotal, and result rows, subtotal is empty, so hide it */
    .clean-table.brs-master-table tr.brs-row-start .brs-cell-subtotal,
    .clean-table.brs-master-table tr.brs-row-subtotal .brs-cell-subtotal,
    .clean-table.brs-master-table tr.brs-row-result .brs-cell-subtotal {
        display: none !important;
    }

    .clean-table.brs-master-table .brs-cell-subtotal,
    .clean-table.brs-master-table .brs-cell-final {
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        flex-shrink: 0 !important;
        margin-left: auto !important;
        padding: 0 !important;
        border: none !important;
        text-align: right !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }

    [dir="rtl"] .clean-table.brs-master-table .brs-cell-subtotal,
    [dir="rtl"] .clean-table.brs-master-table .brs-cell-final {
        margin-left: 0 !important;
        margin-right: auto !important;
    }

    .clean-table.brs-master-table .brs-details-tray {
        width: 100% !important;
        margin-top: 8px !important;
        flex: 1 1 100% !important;
    }

    /* View 7: Compare Files Mobile */
    .matcher-mode-switcher-bar {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: 6px !important;
        padding: 5px !important;
        border-radius: 10px !important;
        margin-bottom: 14px !important;
    }

    .matcher-subtab-btn {
        flex: 1 1 calc(50% - 6px) !important;
        min-width: 0 !important;
        justify-content: center !important;
        text-align: center !important;
        padding: 8px 6px !important;
        font-size: 11.5px !important;
        border-radius: 8px !important;
        gap: 5px !important;
        box-sizing: border-box !important;
        white-space: nowrap !important;
    }

    .matcher-subtab-btn .material-symbols-rounded {
        font-size: 16px !important;
    }

    .matcher-subtab-btn:nth-child(3) {
        flex: 1 1 100% !important;
    }

    #tally-floating-bar {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 8px;
        padding: 12px;
    }

    #tally-floating-bar button {
        width: 100%;
    }

    /* View 8: Reports Mobile */
    .export-cards-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .export-tile {
        padding: 16px 14px;
    }

    /* Modals Mobile */
    .modal-footer {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ---------- SMALL MOBILE (<= 480px) ---------- */
@media (max-width: 480px) {
    .top-bar-left .view-title {
        font-size: 12.5px;
        max-width: 140px;
    }

    .brand-logo-img {
        height: 38px;
    }

    .empty-placeholder {
        padding: 24px 12px;
    }

    .empty-hero-icon-ring {
        width: 52px;
        height: 52px;
    }

    .empty-success-title {
        font-size: 15px;
    }

    .empty-success-desc {
        font-size: 12px;
    }
}

.recon-workspace .table-container {
    max-height: none;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    width: 100% !important;
}

/* ============================================================
   EXECUTIVE A4 LETTERHEAD PRINT STYLESHEET
   ============================================================ */
@media print {
    @page {
        size: A4 portrait;
        margin: 8mm 10mm;
    }

    *, *::before, *::after {
        background: transparent !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    html, body {
        background: #FFFFFF !important;
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
        font-size: 8.5pt !important;
        line-height: 1.25 !important;
        color: #0F172A !important;
        height: auto !important;
        min-height: auto !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 1. HIDE ALL NAVIGATION, CHROME, AND INACTIVE TABS */
    .sidebar, .top-bar, .action-launch-bar, .btn, .upload-mode-switcher, 
    .nav-item, .ledger-filters, .brs-month-tabs-bar, .ledger-actions,
    .btn-remove-file-badge, .btn-switch-sheet-badge, .modal-overlay, 
    .recon-hero-ribbon, .buckets-strip-grid, #category-active-filter-badge, 
    .brs-detail-btn, .section-title-row, .brs-details-tray, .settings-drawer,
    .empty-placeholder, #brs-empty-state, .ledger-header,
    .has-tooltip, .bucket-info-icon,
    #view-upload, #view-analyzer, #view-categories, #view-anomalies, 
    #view-matching, #view-suggested, #view-manualtally, #view-export,
    .view:not(#view-reconciliation), .view:not(.active) {
        display: none !important;
    }

    /* 2. SHOW MAIN APP CONTENT & RECONCILIATION WORKSPACE ONLY */
    .app-layout, .main-content, .workspace-container {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border: none !important;
        box-shadow: none !important;
    }

    /* 3. EXECUTIVE DOCUMENT BORDER FRAME */
    #view-reconciliation, #view-reconciliation.active {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    #recon-content, #recon-content:not(.hidden) {
        display: block !important;
        margin: 0 auto !important;
        padding: 6mm 8mm 8mm 8mm !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        border: 1.5px solid #0F172A !important;
        border-radius: 4px !important;
        background: #FFFFFF !important;
    }

    /* 4. PRINT LETTERHEAD */
    .print-letterhead-header {
        display: block !important;
        border-bottom: 1.5px solid #CBD5E1 !important;
        padding-bottom: 6px !important;
        margin-bottom: 8px !important;
    }

    .print-letterhead-header img {
        height: 32px !important;
        object-fit: contain !important;
    }

    /* 5. MASTER BRS TABLE */
    .ledger-card {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }

    .table-container {
        display: block !important;
        overflow: visible !important;
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .clean-table, .brs-master-table {
        width: 100% !important;
        border: 1px solid #CBD5E1 !important;
        border-collapse: collapse !important;
        margin-top: 4px !important;
        height: auto !important;
        overflow: visible !important;
    }

    .clean-table thead, .brs-master-table thead {
        display: table-header-group !important;
    }

    .clean-table th, .clean-table td {
        border: 1px solid #CBD5E1 !important;
        padding: 4px 6px !important;
        font-size: 8pt !important;
        color: #0F172A !important;
    }

    .clean-table th {
        background: #F1F5F9 !important;
        font-weight: 800 !important;
        text-transform: uppercase !important;
        font-size: 7.5pt !important;
    }

    /* 6. BALANCING PROOF BOX */
    .brs-proof-card, #brs-math-proof-box {
        background: #F8FAFC !important;
        border: 1px solid #CBD5E1 !important;
        border-radius: 4px !important;
        margin: 8px 0 !important;
        padding: 5px 8px !important;
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        page-break-inside: avoid !important;
        font-size: 7.8pt !important;
    }

    /* 7. SIGN-OFF AUTHORIZATION BLOCK */
    .print-sign-off-block {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 16px !important;
        margin-top: 18px !important;
        page-break-inside: avoid !important;
    }

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

    .sign-line {
        border-top: 1.5px solid #0F172A !important;
        margin-bottom: 4px !important;
        width: 80% !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    .sign-title {
        font-size: 8pt !important;
        font-weight: 800 !important;
        color: #0F172A !important;
    }

    .sign-sub {
        font-size: 7pt !important;
        color: #475569 !important;
    }
}

/* ==================== CONFIDENCE BADGES ====================  */
.conf-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 10.5px;
    font-weight: 800;
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.conf-badge.conf-green {
    background: var(--brand-emerald-light);
    color: var(--brand-emerald);
    border: 1px solid var(--brand-emerald);
}

.conf-badge.conf-amber {
    background: var(--brand-amber-light);
    color: var(--brand-amber);
    border: 1px solid var(--brand-amber-border);
}

.conf-badge.conf-blue {
    background: var(--brand-blue-light);
    color: var(--brand-blue);
    border: 1px solid var(--brand-blue);
}

/* ==================== SUGGESTED MATCHES VIEW ==================== */
.suggested-row {
    cursor: default;
    transition: background 0.15s;
}
.suggested-row:hover {
    background: var(--brand-amber-light) !important;
}
.suggested-row td {
    vertical-align: middle;
    padding: 9px 10px;
}

/* ==================== MANUAL TALLY VIEW ==================== */
.tally-row {
    cursor: pointer;
    transition: background 0.12s, box-shadow 0.12s;
    user-select: none;
}
.tally-row:hover {
    background: rgba(99, 102, 241, 0.06) !important;
}
.tally-row.tally-selected {
    background: rgba(99, 102, 241, 0.14) !important;
    box-shadow: inset 3px 0 0 var(--brand-blue);
}
.tally-row td {
    vertical-align: middle;
    padding: 8px 10px;
}

.tally-check {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--brand-blue);
}

/* ==================== EMPTY STATES & SUCCESS HERO CARDS ==================== */
.empty-placeholder {
    padding: 36px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 100%;
    margin: 16px auto;
    box-sizing: border-box;
}

.empty-success-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    box-shadow: var(--shadow-lg);
    border-radius: 20px;
    padding: 36px 32px;
    max-width: 540px;
    width: 100%;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeInScale 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.empty-hero-icon-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(5, 150, 105, 0.22));
    border: 2px solid rgba(16, 185, 129, 0.3);
    color: var(--brand-emerald);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: 0 8px 20px -4px rgba(16, 185, 129, 0.25);
}

.empty-hero-icon-ring .material-symbols-rounded {
    font-size: 34px;
    font-variation-settings: 'FILL' 1;
}

.empty-status-pill {
    display: inline-block;
    background: var(--brand-emerald-light);
    color: var(--brand-emerald);
    border: 1px solid rgba(16, 185, 129, 0.3);
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    padding: 3px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
    text-transform: uppercase;
}

.empty-success-title {
    font-size: 17px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 8px 0;
    letter-spacing: -0.2px;
}

.empty-success-desc {
    font-size: 12.5px;
    color: var(--text-light);
    line-height: 1.55;
    margin: 0 0 24px 0;
    max-width: 440px;
}

.empty-action-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Hidden utility */
.hidden { display: none !important; }

/* Table Pagination Bar */
.table-pagination-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-main);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    flex-wrap: wrap;
    gap: 12px;
}

.pagination-info {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.pagination-btn {
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--brand-purple);
    color: var(--brand-purple);
}

.pagination-btn.active {
    background: var(--brand-purple);
    color: #FFFFFF;
    border-color: var(--brand-purple);
    box-shadow: 0 2px 6px rgba(124, 58, 237, 0.3);
}

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

.pagination-size-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.pagination-size-selector select {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    border: 1px solid var(--border-main);
    color: var(--text-main);
}

/* Risk & Audit KPI Overview Ribbon */
.risk-kpi-ribbon {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}

.risk-kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-xs);
    position: relative;
    overflow: hidden;
}

.risk-kpi-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.risk-kpi-card.kpi-ruby::before { background: var(--brand-ruby); }
.risk-kpi-card.kpi-amber::before { background: var(--brand-amber); }
.risk-kpi-card.kpi-blue::before { background: var(--brand-blue); }
.risk-kpi-card.kpi-emerald::before { background: var(--brand-emerald); }

.risk-kpi-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-circle);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.risk-kpi-icon.icon-ruby { background: var(--brand-ruby-light); color: var(--brand-ruby); }
.risk-kpi-icon.icon-amber { background: var(--brand-amber-light); color: var(--brand-amber); }
.risk-kpi-icon.icon-blue { background: var(--brand-blue-light); color: var(--brand-blue); }
.risk-kpi-icon.icon-emerald { background: var(--brand-emerald-light); color: var(--brand-emerald); }

.risk-kpi-data {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.risk-kpi-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.risk-kpi-val {
    font-size: 16px;
    font-weight: 800;
    font-family: var(--font-mono);
    color: var(--text-main);
    margin-top: 2px;
}

.risk-kpi-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* ==================== PARSING & UPLOAD LOADING OVERLAY ==================== */
.parsing-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(8, 14, 26, 0.78);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay 0.2s ease-out forwards;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.parsing-loading-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.5), 0 0 35px rgba(22, 46, 86, 0.15);
    border-radius: 20px;
    padding: 36px 36px 30px;
    width: 90%;
    max-width: 460px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    overflow: hidden;
    animation: scaleInCard 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

[data-theme="dark"] .parsing-loading-card {
    background: #13223A;
    border: 1px solid rgba(123, 176, 242, 0.25);
    box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 40px rgba(123, 176, 242, 0.15);
}

.parsing-loading-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #162E56, #5C9E19, #7BB0F2, #162E56);
    animation: shimmerBar 2.2s linear infinite;
    background-size: 200% 100%;
}

@keyframes shimmerBar {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

@keyframes scaleInCard {
    from { transform: scale(0.93); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.parsing-spinner-wrap {
    position: relative;
    width: 76px;
    height: 76px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.parsing-spinner-outer-ring {
    position: absolute;
    width: 76px;
    height: 76px;
    border: 3.5px solid transparent;
    border-top-color: #5C9E19;
    border-right-color: #7BB0F2;
    border-radius: 50%;
    animation: spinRing 1.1s cubic-bezier(0.5, 0.1, 0.5, 0.9) infinite;
}

.parsing-spinner-inner-ring {
    position: absolute;
    width: 58px;
    height: 58px;
    border: 3px solid transparent;
    border-bottom-color: #162E56;
    border-left-color: #5C9E19;
    border-radius: 50%;
    animation: spinRingRev 0.85s linear infinite;
}

[data-theme="dark"] .parsing-spinner-inner-ring {
    border-bottom-color: #7BB0F2;
    border-left-color: #8FD44B;
}

@keyframes spinRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes spinRingRev {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

.parsing-spinner-icon {
    position: relative;
    font-size: 24px;
    color: #162E56;
    animation: pulseIcon 1.6s ease-in-out infinite;
}

[data-theme="dark"] .parsing-spinner-icon {
    color: #7BB0F2;
}

@keyframes pulseIcon {
    0%, 100% { transform: scale(1); opacity: 0.9; }
    50% { transform: scale(1.15); opacity: 1; }
}

.parsing-loading-title {
    font-size: 19px;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
    font-family: var(--font-heading);
    letter-spacing: -0.2px;
}

.loading-file-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-subtle);
    border: 1px solid var(--border-main);
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 12px;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading-file-pill span {
    font-size: 15px;
    color: #5C9E19;
    flex-shrink: 0;
}

[data-theme="dark"] .loading-file-pill {
    background: rgba(123, 176, 242, 0.1);
    border-color: rgba(123, 176, 242, 0.25);
    color: #F8FAFC;
}

[data-theme="dark"] .loading-file-pill span {
    color: #8FD44B;
}

.parsing-loading-sub {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.5;
    margin-bottom: 18px;
    font-weight: 500;
}

[data-theme="dark"] .parsing-loading-sub {
    color: #CBD5E1;
}

/* Glowing Progress Bar Track */
.parsing-progress-track {
    width: 100%;
    height: 4px;
    background: var(--bg-subtle);
    border-radius: 9999px;
    overflow: hidden;
    position: relative;
    margin-bottom: 20px;
}

.parsing-progress-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 45%;
    background: linear-gradient(90deg, #5C9E19, #7BB0F2);
    border-radius: 9999px;
    animation: indeterminateProgress 1.4s ease-in-out infinite;
}

@keyframes indeterminateProgress {
    0% { left: -45%; width: 30%; }
    50% { width: 60%; }
    100% { left: 100%; width: 30%; }
}

.parsing-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--brand-emerald-light);
    color: #5C9E19;
    border: 1px solid var(--brand-emerald-border);
    border-radius: 9999px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

[data-theme="dark"] .parsing-progress-pill {
    background: rgba(143, 212, 75, 0.14);
    color: #8FD44B;
    border-color: rgba(143, 212, 75, 0.3);
}

/* ==================== UNIFIED FINTECH MODAL & NOTIFICATION DIALOG ==================== */
.app-dialog-overlay,
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInOverlay 0.18s ease-out forwards;
}

.modal.hidden {
    display: none !important;
}

.app-dialog-card,
.notification-modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    box-shadow: var(--shadow-xl);
    border-radius: var(--radius-lg, 14px);
    width: 480px;
    max-width: 92vw;
    padding: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    animation: scaleInCard 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.notification-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-surface);
}

.notification-header-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.notification-header-title h2 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    font-family: var(--font-heading);
}

.notification-icon-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    font-size: 18px;
    flex-shrink: 0;
}

.dialog-type-error .notification-icon-indicator,
.notification-icon-error {
    background: var(--brand-ruby-light);
    color: var(--brand-ruby);
    border: 1px solid rgba(225, 29, 72, 0.25);
}

.dialog-type-warning .notification-icon-indicator,
.notification-icon-warning {
    background: var(--brand-amber-light);
    color: var(--brand-amber);
    border: 1px solid rgba(217, 119, 6, 0.25);
}

.dialog-type-info .notification-icon-indicator,
.notification-icon-info {
    background: var(--brand-blue-light);
    color: var(--brand-blue);
    border: 1px solid rgba(2, 132, 199, 0.25);
}

.dialog-type-success .notification-icon-indicator,
.notification-icon-success {
    background: var(--brand-emerald-light);
    color: var(--brand-emerald);
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.notification-modal-body {
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.notification-body-text {
    font-size: 13.5px;
    color: var(--text-main);
    line-height: 1.55;
    margin: 0;
}

.notification-detail-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.45;
    max-height: 150px;
    overflow-y: auto;
    word-break: break-word;
    font-family: var(--font-mono);
}

.notification-modal-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-card);
}

/* ==================== SLEEK NON-BLOCKING TOASTS ==================== */
.bankrecon-toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

[dir="rtl"] .bankrecon-toast-container {
    right: auto;
    left: 24px;
}

.bankrecon-toast {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: rgba(15, 23, 42, 0.94);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-pill);
    box-shadow: 0 10px 28px -4px rgba(0, 0, 0, 0.35), 0 4px 10px -2px rgba(0, 0, 0, 0.2);
    font-size: 13.5px;
    font-weight: 600;
    font-family: var(--font-sans);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    opacity: 0;
    transform: translateY(14px) scale(0.96);
    transition: all 0.24s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: auto;
}

.bankrecon-toast.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.bankrecon-toast-icon {
    font-size: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.toast-success .bankrecon-toast-icon {
    color: #10B981;
}

.toast-info .bankrecon-toast-icon {
    color: #38BDF8;
}

.toast-warning .bankrecon-toast-icon {
    color: #F59E0B;
}

.toast-error .bankrecon-toast-icon {
    color: #EF4444;
}

/* ==================== BANK CHARGE DISPUTE & REVERSAL ENGINE ==================== */
.dispute-studio-grid {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    gap: 18px;
    align-items: start;
}

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

.dispute-list-card, .dispute-letter-card {
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.dispute-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-main);
    background: var(--bg-subtle);
}

.dispute-items-scroll {
    max-height: 560px;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dispute-item-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
}

.dispute-item-card:hover {
    border-color: var(--brand-amber);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.08);
}

.dispute-item-card.selected {
    border-color: rgba(217, 119, 6, 0.6);
    background: rgba(217, 119, 6, 0.03);
}

.dispute-item-card.severity-high {
    border-left: 4px solid #DC2626;
}

.dispute-item-card.severity-medium {
    border-left: 4px solid #D97706;
}

.dispute-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 6px;
}

.dispute-item-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.dispute-item-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--brand-blue);
    cursor: pointer;
}

.dispute-item-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    font-family: var(--font-mono);
}

.dispute-item-amount {
    font-size: 13.5px;
    font-weight: 800;
    color: #DC2626;
    font-family: var(--font-mono);
}

.dispute-item-desc {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
    line-height: 1.4;
}

.dispute-citation-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 700;
    background: #FEF3C7;
    color: #92400E;
    border: 1px solid #FDE68A;
    margin-bottom: 6px;
}

[data-theme="dark"] .dispute-citation-badge {
    background: rgba(217, 119, 6, 0.2);
    color: #FCD34D;
    border-color: rgba(217, 119, 6, 0.4);
}

.dispute-legal-ground {
    font-size: 11px;
    color: var(--text-light);
    line-height: 1.4;
    background: var(--bg-subtle);
    padding: 6px 10px;
    border-radius: 4px;
    border-left: 2px solid var(--brand-amber);
}

/* Right Column: Letter Generator */
.dispute-letter-tabs-bar {
    display: flex;
    border-bottom: 1px solid var(--border-main);
    background: var(--bg-subtle);
}

.dispute-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-light);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    border-bottom: 2px solid transparent;
}

.dispute-tab:hover {
    color: var(--text-main);
    background: rgba(0, 0, 0, 0.02);
}

.dispute-tab.active {
    color: var(--brand-blue);
    background: var(--bg-card);
    border-bottom-color: var(--brand-blue);
}

.dispute-meta-form {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-card);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

.form-group-compact label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-light);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.input-sm {
    height: 32px;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--radius-sm);
}

.dispute-letter-preview-box {
    padding: 14px 18px;
    background: var(--bg-subtle);
}

.letter-subject-line {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--text-main);
    margin-bottom: 10px;
    line-height: 1.4;
}

.letter-body-editor {
    width: 100%;
    min-height: 290px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-main);
    border-radius: var(--radius-md);
    font-family: var(--font-mono, monospace);
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--text-main);
    resize: vertical;
    outline: none;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.04);
}

.letter-body-editor:focus {
    border-color: var(--brand-blue);
    box-shadow: 0 0 0 3px var(--brand-blue-light);
}

.dispute-actions-toolbar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-main);
    background: var(--bg-card);
}

.dispute-empty-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 28px;
    background: var(--bg-card);
    height: 100%;
    min-height: 480px;
}

.dispute-empty-icon-bubble {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(16, 185, 129, 0.1);
    color: #10B981;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    border: 1px solid rgba(16, 185, 129, 0.25);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.12);
}

.dispute-empty-icon-bubble .material-symbols-rounded {
    font-size: 34px;
}

.dispute-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 8px 0;
}

.dispute-empty-desc {
    font-size: 12.5px;
    color: var(--text-muted);
    max-width: 400px;
    line-height: 1.55;
    margin: 0 0 20px 0;
}

.dispute-empty-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11.5px;
    font-weight: 600;
    color: #059669;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
}

[data-theme="dark"] .dispute-empty-badge {
    color: #34D399;
}

.dispute-empty-badge .material-symbols-rounded {
    font-size: 15px;
}

/* Banner in Overview & Summary */
.analyzer-dispute-alert-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 18px;
    background: linear-gradient(135deg, rgba(217, 119, 6, 0.08), rgba(245, 158, 11, 0.12));
    border: 1px solid rgba(217, 119, 6, 0.35);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.08);
}

.analyzer-dispute-alert-content {
    display: flex;
    align-items: center;
    gap: 14px;
}

.analyzer-dispute-icon-ring {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: #FEF3C7;
    color: #B45309;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

[data-theme="dark"] .analyzer-dispute-icon-ring {
    background: rgba(217, 119, 6, 0.25);
    color: #FCD34D;
}

.analyzer-dispute-text h4 {
    margin: 0 0 2px 0;
    font-size: 13.5px;
    font-weight: 800;
    color: var(--text-main);
}

.analyzer-dispute-text p {
    margin: 0;
    font-size: 12px;
    color: var(--text-light);
}

/* ==================== ARABIC & RTL FINTECH STYLING ==================== */
[dir="rtl"] {
    font-family: 'Tajawal', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    text-align: right;
}

[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, [dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6 {
    font-family: 'Tajawal', 'Outfit', sans-serif;
}

[dir="rtl"] .nav-item {
    text-align: right;
    justify-content: flex-start;
}

[dir="rtl"] .nav-item .material-symbols-rounded {
    margin-left: 10px;
    margin-right: 0;
}

[dir="rtl"] .workspace-header-card,
[dir="rtl"] .dispute-panel-header,
[dir="rtl"] .dispute-meta-form,
[dir="rtl"] .modal-header,
[dir="rtl"] .section-title-row {
    text-align: right;
}

[dir="rtl"] .kpi-box {
    border-left: 1px solid var(--border-main);
    border-right: 4px solid var(--border-main);
}
[dir="rtl"] .kpi-box.kpi-box-green, [dir="rtl"] .kpi-box[style*="border-left-color:#059669"] { 
    border-right: 4px solid #059669 !important; 
    border-left: 1px solid var(--border-main) !important; 
}
[dir="rtl"] .kpi-box.kpi-box-red, [dir="rtl"] .kpi-box[style*="border-left-color:#DC2626"] { 
    border-right: 4px solid #DC2626 !important; 
    border-left: 1px solid var(--border-main) !important; 
}
[dir="rtl"] .kpi-box.kpi-box-blue, [dir="rtl"] .kpi-box[style*="border-left-color:#2563EB"] { 
    border-right: 4px solid #2563EB !important; 
    border-left: 1px solid var(--border-main) !important; 
}
[dir="rtl"] .kpi-box.kpi-box-purple { 
    border-right: 4px solid var(--brand-purple) !important; 
    border-left: 1px solid var(--border-main) !important; 
}
[dir="rtl"] .kpi-box.kpi-box-amber { 
    border-right: 4px solid var(--brand-amber) !important; 
    border-left: 1px solid var(--border-main) !important; 
}

/* Dispute reminder modal milestone cards */
[dir="rtl"] #dispute-reminder-modal div[style*="border-left:4px solid #F59E0B"] {
    border-left: 1px solid var(--border-light) !important;
    border-right: 4px solid #F59E0B !important;
}
[dir="rtl"] #dispute-reminder-modal div[style*="border-left:4px solid #2563EB"] {
    border-left: 1px solid var(--border-light) !important;
    border-right: 4px solid #2563EB !important;
}

/* Form inputs & letter preview in RTL */
[dir="rtl"] .input-control {
    text-align: right;
}
[dir="rtl"] #dispute-letter-body-textarea {
    text-align: left;
    direction: ltr;
}
[dir="rtl"] .letter-subject-line strong {
    margin-left: 6px;
    margin-right: 0;
}

/* ========================================================
   2-WAY RECONCILIATION REDIRECTION & STATUS BANNERS
   ======================================================== */
.recon-redirect-banner,
.recon-ready-banner {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.09), rgba(37, 99, 235, 0.07));
    border: 1.5px solid rgba(5, 150, 105, 0.35);
    border-radius: var(--radius-lg, 16px);
    padding: 18px 22px;
    box-shadow: 0 4px 20px rgba(5, 150, 105, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.recon-redirect-banner:hover,
.recon-ready-banner:hover {
    border-color: rgba(5, 150, 105, 0.6);
    box-shadow: 0 8px 28px rgba(5, 150, 105, 0.18);
}

.recon-banner-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1 1 340px;
}

.recon-banner-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #059669, #047857);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.35);
    flex-shrink: 0;
}

.recon-banner-icon span {
    font-size: 24px;
}

.recon-banner-content {
    flex: 1;
    min-width: 0;
}

.recon-banner-tag-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    flex-wrap: wrap;
}

.recon-banner-tag {
    font-size: 10.5px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
    border: 1px solid rgba(5, 150, 105, 0.25);
}

.recon-banner-status-tag {
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
}

.recon-banner-status-tag.is-reconciled {
    background: rgba(16, 185, 129, 0.18);
    color: #059669;
}

.recon-banner-status-tag.has-variance {
    background: rgba(217, 119, 6, 0.15);
    color: #D97706;
}

.recon-banner-title {
    font-size: 14.5px;
    font-weight: 800;
    color: var(--text-main);
    margin: 0 0 4px;
}

.recon-banner-desc {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.45;
}

.recon-banner-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-left: auto;
    flex-shrink: 0;
}

@media (max-width: 767px) {
    .recon-redirect-banner,
    .recon-ready-banner {
        padding: 14px 16px;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }

    .recon-banner-actions {
        flex-direction: column;
        width: 100%;
    }

    .recon-banner-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

[dir="rtl"] .recon-banner-left {
    text-align: right;
}

[data-theme="dark"] .recon-redirect-banner,
[data-theme="dark"] .recon-ready-banner {
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.16), rgba(30, 58, 138, 0.2));
    border-color: rgba(5, 150, 105, 0.45);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}



