/* Credfinix Enterprise Fintech SaaS Theme & Styling System - v3.0 Smooth Modern Fintech */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400;1,600&display=swap');

:root {
    /* Brand Primary Palette (Sophisticated Modern Cobalt Indigo) */
    --brand-primary: #3b5bfd;
    --brand-primary-hover: #2546eb;
    --brand-primary-light: #f0f4ff;
    --brand-primary-subtle: rgba(59, 91, 253, 0.08);
    --brand-gradient: linear-gradient(135deg, #3b5bfd 0%, #2563eb 100%);
    --brand-gradient-hover: linear-gradient(135deg, #2546eb 0%, #1d4ed8 100%);
    --brand-gradient-glow: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
    
    /* Semantic Fintech Accents */
    --emerald-accent: #059669;
    --emerald-light: #ecfdf5;
    --emerald-subtle: rgba(5, 150, 105, 0.08);

    --amber-accent: #d97706;
    --amber-light: #fffbeb;
    --amber-subtle: rgba(217, 119, 6, 0.08);

    --rose-accent: #e11d48;
    --rose-light: #fff1f2;
    --rose-subtle: rgba(225, 29, 72, 0.08);

    --purple-accent: #7c3aed;
    --purple-light: #f5f3ff;
    --purple-subtle: rgba(124, 58, 237, 0.08);

    --cyan-accent: #0284c7;
    --cyan-light: #f0f9ff;
    --cyan-subtle: rgba(2, 132, 199, 0.08);

    /* Neutral Slate Scale */
    --dark-slate: #0f172a;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-500: #64748b;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --slate-200: #e2e8f0;
    --slate-100: #f1f5f9;
    --slate-50: #f8fafc;

    /* Surfaces & Boundaries */
    --body-bg: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e8edf5;
    --border-color-subtle: rgba(226, 232, 240, 0.7);
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    /* Dimensions & Radii */
    --sidebar-width: 260px;
    --topbar-height: 68px;
    --radius-2xl: 20px;
    --radius-xl: 16px;
    --radius-lg: 12px;
    --radius-md: 10px;
    --radius-sm: 6px;
    
    /* Soft Elevation Shadows (Apple & Linear Style) */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.02);
    --shadow-card: 0 1px 3px 0 rgba(15, 23, 42, 0.02), 0 4px 16px -2px rgba(15, 23, 42, 0.04);
    --shadow-elevated: 0 10px 25px -5px rgba(15, 23, 42, 0.07), 0 4px 10px -2px rgba(15, 23, 42, 0.03);
    --shadow-hover: 0 14px 28px -6px rgba(59, 91, 253, 0.14), 0 4px 12px -2px rgba(15, 23, 42, 0.03);
    --shadow-glow: 0 0 24px rgba(59, 91, 253, 0.2);

    /* Silky Spring Easing */
    --transition-smooth: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark Mode Theme Overrides */
[data-theme="dark"] {
    --body-bg: #090e17;
    --card-bg: #121826;
    --border-color: #1e283d;
    --border-color-subtle: #172033;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --slate-50: #0d1321;
    --slate-100: #151d30;
    --slate-200: #1e283d;
    --brand-primary-light: rgba(59, 91, 253, 0.16);
    --emerald-light: rgba(5, 150, 105, 0.16);
    --amber-light: rgba(217, 119, 6, 0.16);
    --rose-light: rgba(225, 29, 72, 0.16);
    --purple-light: rgba(124, 58, 237, 0.16);
    --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.4);
    --shadow-elevated: 0 12px 30px -4px rgba(0, 0, 0, 0.5);
}

/* Global Reset & Base Styling */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--body-bg);
    color: var(--text-main);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    transition: background-color 0.25s ease, color 0.25s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    letter-spacing: -0.012em;
}

::selection {
    background: rgba(59, 91, 253, 0.2);
    color: var(--brand-primary);
}

/* Base Typography Helpers */
.fs-7 { font-size: 0.88rem !important; }
.fs-8 { font-size: 0.80rem !important; }
.fs-9 { font-size: 0.72rem !important; }
.fw-extrabold { font-weight: 800 !important; }
.tracking-tight { letter-spacing: -0.025em !important; }
.tracking-wide { letter-spacing: 0.05em !important; }

/* Custom Utilities */
.text-indigo { color: var(--brand-primary) !important; }
.bg-indigo:not(.badge) { background-color: var(--brand-primary) !important; }
.bg-indigo-light { background-color: var(--brand-primary-light) !important; }
.bg-indigo-subtle { background-color: var(--brand-primary-light) !important; }
.border-indigo { border-color: var(--brand-primary) !important; }

.text-emerald-600 { color: var(--emerald-accent) !important; }
.bg-emerald-50:not(.badge) { background-color: var(--emerald-light) !important; }
.text-amber-600 { color: var(--amber-accent) !important; }
.bg-amber-50:not(.badge) { background-color: var(--amber-light) !important; }
.text-rose-600 { color: var(--rose-accent) !important; }
.bg-rose-50:not(.badge) { background-color: var(--rose-light) !important; }

/* Dedicated Badge System - Clean Modern Pastel Geometry */
.badge {
    font-weight: 600 !important;
    padding: 0.35em 0.82em !important;
    border-radius: 9999px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 5px !important;
    font-size: 0.74rem !important;
    letter-spacing: 0.01em !important;
    line-height: 1.25 !important;
    transition: var(--transition-fast) !important;
}

.badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

/* Primary / Indigo Badges */
.badge.bg-primary,
.badge.bg-indigo,
.badge.bg-primary.bg-opacity-10,
.badge.bg-indigo.bg-opacity-10,
.badge-soft-indigo,
.badge-soft-primary {
    background-color: #eff6ff !important;
    color: #1d4ed8 !important;
    border: 1px solid #bfdbfe !important;
}

/* Secondary Badges */
.badge.bg-secondary,
.badge.bg-secondary.bg-opacity-10,
.badge-soft-secondary {
    background-color: #f1f5f9 !important;
    color: #334155 !important;
    border: 1px solid #cbd5e1 !important;
}

/* Warning Badges */
.badge.bg-warning,
.badge.bg-warning.bg-opacity-10,
.badge-soft-warning {
    background-color: #fffbeb !important;
    color: #b45309 !important;
    border: 1px solid #fde68a !important;
}

/* Info Badges */
.badge.bg-info,
.badge.bg-info.bg-opacity-10,
.badge-soft-info {
    background-color: #f0f9ff !important;
    color: #0369a1 !important;
    border: 1px solid #bae6fd !important;
}

/* Success Badges */
.badge.bg-success,
.badge.bg-success.bg-opacity-10,
.badge.bg-emerald-50,
.badge-soft-success {
    background-color: #ecfdf5 !important;
    color: #047857 !important;
    border: 1px solid #a7f3d0 !important;
}

/* Danger Badges */
.badge.bg-danger,
.badge.bg-danger.bg-opacity-10,
.badge-soft-danger {
    background-color: #fff1f2 !important;
    color: #be123c !important;
    border: 1px solid #fecdd3 !important;
}

/* Purple Badges */
.badge.bg-purple,
.badge.bg-purple.bg-opacity-10,
.badge-soft-purple,
.badge.bg-purple-subtle,
.bg-purple-subtle {
    background-color: #f5f3ff !important;
    color: #6d28d9 !important;
    border: 1px solid #ddd6fe !important;
}
.text-purple {
    color: #6d28d9 !important;
}

/* Neutral Badges */
.badge.bg-light {
    background-color: #f8fafc !important;
    color: #0f172a !important;
    border: 1px solid #cbd5e1 !important;
}

/* Dark Mode Badge Overrides */
[data-theme="dark"] .badge.bg-primary, 
[data-theme="dark"] .badge.bg-indigo,
[data-theme="dark"] .badge.bg-primary.bg-opacity-10,
[data-theme="dark"] .badge-soft-indigo {
    background-color: rgba(59, 91, 253, 0.2) !important;
    color: #93c5fd !important;
    border-color: rgba(59, 91, 253, 0.35) !important;
}
[data-theme="dark"] .badge.bg-secondary, 
[data-theme="dark"] .badge-soft-secondary {
    background-color: rgba(148, 163, 184, 0.16) !important;
    color: #cbd5e1 !important;
    border-color: rgba(148, 163, 184, 0.25) !important;
}
[data-theme="dark"] .badge.bg-warning, 
[data-theme="dark"] .badge-soft-warning {
    background-color: rgba(217, 119, 6, 0.2) !important;
    color: #fde047 !important;
    border-color: rgba(217, 119, 6, 0.35) !important;
}
[data-theme="dark"] .badge.bg-info, 
[data-theme="dark"] .badge-soft-info {
    background-color: rgba(2, 132, 199, 0.2) !important;
    color: #7dd3fc !important;
    border-color: rgba(2, 132, 199, 0.35) !important;
}
[data-theme="dark"] .badge.bg-success, 
[data-theme="dark"] .badge-soft-success {
    background-color: rgba(5, 150, 105, 0.2) !important;
    color: #6ee7b7 !important;
    border-color: rgba(5, 150, 105, 0.35) !important;
}
[data-theme="dark"] .badge.bg-danger, 
[data-theme="dark"] .badge-soft-danger {
    background-color: rgba(225, 29, 72, 0.2) !important;
    color: #fca5a5 !important;
    border-color: rgba(225, 29, 72, 0.35) !important;
}

/* Premium Fintech Buttons */
.btn {
    font-weight: 600 !important;
    border-radius: var(--radius-md) !important;
    transition: var(--transition-fast) !important;
    letter-spacing: -0.01em;
}

.btn-indigo, .btn-primary {
    background: var(--brand-gradient) !important;
    background-color: var(--brand-primary) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 2px 8px -1px rgba(59, 91, 253, 0.28) !important;
}

.btn-indigo:hover, .btn-primary:hover {
    background: var(--brand-gradient-hover) !important;
    color: #ffffff !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 6px 18px -2px rgba(59, 91, 253, 0.38) !important;
}

.btn-secondary {
    background-color: #475569 !important;
    color: #ffffff !important;
    border: 1px solid #334155 !important;
}

.btn-success {
    background-color: var(--emerald-accent) !important;
    color: #ffffff !important;
    border: 1px solid #047857 !important;
    box-shadow: 0 2px 8px -1px rgba(5, 150, 105, 0.25) !important;
}
.btn-success:hover {
    background-color: #047857 !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 6px 16px -2px rgba(5, 150, 105, 0.35) !important;
}

.btn-danger {
    background-color: var(--rose-accent) !important;
    color: #ffffff !important;
    border: 1px solid #be123c !important;
    box-shadow: 0 2px 8px -1px rgba(225, 29, 72, 0.25) !important;
}
.btn-danger:hover {
    background-color: #be123c !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 6px 16px -2px rgba(225, 29, 72, 0.35) !important;
}

.btn-warning {
    background-color: var(--amber-accent) !important;
    color: #ffffff !important;
    border: 1px solid #b45309 !important;
    box-shadow: 0 2px 8px -1px rgba(217, 119, 6, 0.25) !important;
}

.btn-info {
    background-color: var(--cyan-accent) !important;
    color: #ffffff !important;
    border: 1px solid #0369a1 !important;
}

.btn-light {
    background-color: #ffffff !important;
    color: #334155 !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-xs) !important;
}
.btn-light:hover {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    transform: translateY(-1px) !important;
}

.btn-outline-indigo, .btn-outline-primary {
    background: transparent !important;
    border: 1.5px solid var(--brand-primary) !important;
    color: var(--brand-primary) !important;
}

.btn-outline-indigo:hover, .btn-outline-primary:hover {
    background: var(--brand-primary) !important;
    color: #ffffff !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 4px 12px rgba(59, 91, 253, 0.25) !important;
}

.btn-soft-indigo {
    background: var(--brand-primary-light) !important;
    color: var(--brand-primary) !important;
    border: 1px solid rgba(59, 91, 253, 0.2) !important;
}

.btn-soft-indigo:hover {
    background: var(--brand-primary) !important;
    color: #ffffff !important;
    transform: translateY(-1px) !important;
}

.btn-link {
    color: var(--brand-primary) !important;
    text-decoration: none !important;
}
.btn-link:hover {
    color: var(--brand-primary-hover) !important;
}

/* User Avatar Initial Bubbles */
.user-avatar-bubble {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--brand-gradient);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.92rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(59, 91, 253, 0.25);
    border: 2px solid rgba(255, 255, 255, 0.9);
}

.user-avatar-bubble.emerald { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.user-avatar-bubble.amber { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); }
.user-avatar-bubble.purple { background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }

/* Layout Shell */
#app-wrapper {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Premium Sleek Sidebar Navigation */
#sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    box-shadow: 1px 0 0 0 rgba(0, 0, 0, 0.02);
}

#sidebar .brand-logo {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

#sidebar .brand-title {
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.4px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
}

#sidebar .nav-menu-wrapper {
    padding: 0.85rem 0.85rem;
    overflow-y: auto;
    flex: 1;
}

/* Custom scrollbar for sidebar */
#sidebar .nav-menu-wrapper::-webkit-scrollbar {
    width: 4px;
}
#sidebar .nav-menu-wrapper::-webkit-scrollbar-thumb {
    background: var(--slate-200);
    border-radius: 4px;
}

#sidebar .nav-section-header {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--slate-400);
    padding: 0.85rem 0.95rem 0.35rem 0.95rem;
}

#sidebar .nav-link {
    display: flex;
    align-items: center;
    padding: 0.62rem 0.9rem;
    margin-bottom: 0.18rem;
    color: var(--slate-600);
    font-weight: 500;
    font-size: 0.86rem;
    border-radius: 10px;
    text-decoration: none;
    transition: var(--transition-fast);
    position: relative;
}

#sidebar .nav-link i {
    width: 22px;
    font-size: 1rem;
    margin-right: 10px;
    color: var(--slate-400);
    transition: var(--transition-fast);
}

#sidebar .nav-link:hover {
    color: var(--brand-primary);
    background: var(--brand-primary-light);
    transform: translateX(3px);
}

#sidebar .nav-link:hover i {
    color: var(--brand-primary);
}

#sidebar .nav-link.active {
    color: #ffffff !important;
    background: var(--brand-gradient) !important;
    box-shadow: 0 4px 14px rgba(59, 91, 253, 0.32) !important;
    font-weight: 600;
}

#sidebar .nav-link.active i {
    color: #ffffff !important;
}

/* Collapsible Dropdown Sub-menus in Sidebar */
.nav-group-toggle {
    justify-content: space-between !important;
    cursor: pointer;
}
.nav-group-toggle .nav-chevron {
    font-size: 0.72rem !important;
    width: auto !important;
    margin-right: 0 !important;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.nav-group-toggle:not(.collapsed) .nav-chevron {
    transform: rotate(180deg);
}
.nav-group-toggle.active {
    background: rgba(59, 91, 253, 0.08) !important;
    color: var(--brand-primary) !important;
    box-shadow: none !important;
}
.nav-group-toggle.active i {
    color: var(--brand-primary) !important;
}
.sub-nav-wrapper {
    padding-left: 1.1rem;
    margin: 0.15rem 0 0.35rem 0.85rem;
    border-left: 2px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.sub-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.42rem 0.65rem;
    font-size: 0.81rem;
    font-weight: 500;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}
.sub-nav-link:hover {
    color: var(--brand-primary);
    background: var(--brand-primary-light);
    transform: translateX(2px);
}
.sub-nav-link.active {
    color: var(--brand-primary) !important;
    font-weight: 700 !important;
    background: var(--brand-primary-light) !important;
}
.sub-nav-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--slate-300);
    transition: var(--transition-fast);
}
.sub-nav-link:hover .sub-nav-dot,
.sub-nav-link.active .sub-nav-dot {
    background: var(--brand-primary);
    transform: scale(1.3);
}

/* Sidebar Footer User Widget */
.sidebar-user-widget {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--slate-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Mobile Overlay */
.sidebar-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 1040;
    display: none;
}
.sidebar-backdrop.show { display: block; }

/* Main Content Area */
#main-content, .content-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-width: 0 !important;
    max-width: 100% !important;
    width: calc(100% - var(--sidebar-width));
    overflow-x: hidden;
    transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.container-fluid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
}

/* Frosted Glass Topbar Header */
#topbar {
    height: var(--topbar-height);
    background: rgba(255, 255, 255, 0.84);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.75rem;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    transition: background-color 0.25s ease, border-color 0.25s ease;
}

[data-theme="dark"] #topbar {
    background: rgba(18, 24, 38, 0.88);
}

.mega-search-input {
    background: #f1f5f9;
    border: 1px solid transparent;
    border-radius: 9999px;
    padding: 0.52rem 1.25rem 0.52rem 2.5rem;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-main);
    width: 320px;
    transition: var(--transition-fast);
}

.mega-search-input:focus {
    background: #ffffff;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 91, 253, 0.12);
    outline: none;
    width: 350px;
}

[data-theme="dark"] .mega-search-input {
    background: #151d30;
    color: #f8fafc;
}
[data-theme="dark"] .mega-search-input:focus {
    background: #1a233a;
    border-color: var(--brand-primary);
}

/* Stat Metric Cards */
.stat-card {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-xl) !important;
    padding: 1.25rem 1.4rem !important;
    box-shadow: var(--shadow-card) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    transition: var(--transition-smooth) !important;
    min-height: 102px;
    position: relative;
    overflow: hidden;
    min-width: 0 !important;
    max-width: 100% !important;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-3px) !important;
    box-shadow: var(--shadow-elevated) !important;
    border-color: rgba(59, 91, 253, 0.2) !important;
}

.stat-card:hover::before {
    background: var(--brand-gradient);
}

.stat-icon {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 13px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1.25rem !important;
    flex-shrink: 0 !important;
    transition: var(--transition-fast);
}

.stat-card:hover .stat-icon {
    transform: scale(1.05);
}

.stat-icon-indigo { background: rgba(59, 91, 253, 0.08) !important; color: var(--brand-primary) !important; border: 1px solid rgba(59, 91, 253, 0.12) !important; }
.stat-icon-success { background: rgba(5, 150, 105, 0.08) !important; color: var(--emerald-accent) !important; border: 1px solid rgba(5, 150, 105, 0.12) !important; }
.stat-icon-warning { background: rgba(217, 119, 6, 0.08) !important; color: var(--amber-accent) !important; border: 1px solid rgba(217, 119, 6, 0.12) !important; }
.stat-icon-danger { background: rgba(225, 29, 72, 0.08) !important; color: var(--rose-accent) !important; border: 1px solid rgba(225, 29, 72, 0.12) !important; }
.stat-icon-purple { background: rgba(124, 58, 237, 0.08) !important; color: var(--purple-accent) !important; border: 1px solid rgba(124, 58, 237, 0.12) !important; }
.stat-icon-cyan { background: rgba(2, 132, 199, 0.08) !important; color: var(--cyan-accent) !important; border: 1px solid rgba(2, 132, 199, 0.12) !important; }

/* Modern Uniform Stat Card (for 3-3 spacious grid) */
.stat-card-modern {
    background: var(--card-bg) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: var(--radius-xl) !important;
    padding: 1.35rem 1.5rem !important;
    box-shadow: var(--shadow-card) !important;
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    transition: var(--transition-smooth) !important;
    min-height: 132px !important;
    position: relative;
    overflow: hidden;
    min-width: 0 !important;
}

.stat-card-modern::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: transparent;
    transition: background 0.25s ease;
}

.stat-card-modern:hover {
    transform: translateY(-3px) !important;
    box-shadow: var(--shadow-elevated) !important;
    border-color: rgba(59, 91, 253, 0.25) !important;
}

.stat-card-modern:hover::before {
    background: var(--brand-gradient);
}

.stat-card-modern .stat-icon {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    border-radius: 12px !important;
    font-size: 1.15rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Fintech Cards & Section Wrappers */
.card, .fintech-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.4rem;
    box-shadow: var(--shadow-card);
    transition: var(--transition-smooth);
    min-width: 0 !important;
    max-width: 100% !important;
}

.fintech-card:hover {
    box-shadow: var(--shadow-elevated);
    border-color: rgba(59, 91, 253, 0.2);
}

/* Form Controls & Inputs */
.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 0.88rem;
    padding: 0.58rem 0.95rem;
    color: var(--text-main);
    transition: var(--transition-fast);
    background-color: #ffffff;
}

.form-control:focus, .form-select:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(59, 91, 253, 0.12);
    outline: none;
}

[data-theme="dark"] .form-control,
[data-theme="dark"] .form-select {
    background-color: #151d30;
    border-color: #232f4a;
    color: #f8fafc;
}
[data-theme="dark"] .form-control:focus,
[data-theme="dark"] .form-select:focus {
    background-color: #1a233a;
    border-color: var(--brand-primary);
}

/* Enhanced Modern Data Tables & Scrollbars */
.table-responsive {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
    margin-bottom: 0;
}

.table-responsive::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}
.table-responsive::-webkit-scrollbar-track {
    background: var(--slate-100);
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: 4px;
}
.table-responsive::-webkit-scrollbar-thumb:hover {
    background: var(--brand-primary);
}

.table th, .table td,
.table-custom th, .table-custom td {
    white-space: nowrap;
    vertical-align: middle;
}

.table-custom {
    color: var(--text-main);
    vertical-align: middle;
    margin-bottom: 0;
}

.table-custom th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    font-size: 0.73rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding: 0.85rem 1.15rem;
}

.table-custom td {
    border-bottom: 1px solid var(--border-color);
    padding: 0.95rem 1.15rem;
    font-size: 0.86rem;
    color: #1e293b;
}

.table-custom tbody tr {
    transition: background-color 0.15s ease;
}

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

[data-theme="dark"] .table-custom th {
    background: #111827;
    color: #94a3b8;
    border-color: #1e283d;
}
[data-theme="dark"] .table-custom td {
    border-color: #1e283d;
    color: #e2e8f0;
}
[data-theme="dark"] .table-custom tbody tr:hover {
    background-color: rgba(30, 41, 59, 0.5) !important;
}

/* Kanban Drag & Drop Pipeline */
.fintech-kanban-board {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: 1.5rem;
    align-items: flex-start;
}

.fintech-kanban-col {
    flex: 0 0 310px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.15rem;
    min-height: 550px;
    box-shadow: var(--shadow-sm);
}

.fintech-kanban-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 2px dashed var(--border-color);
}

.fintech-kanban-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    margin-bottom: 0.95rem;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: var(--transition-fast);
    cursor: grab;
}

.fintech-kanban-card:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-elevated);
    transform: translateY(-3px);
}

/* Borrower Stepper Progress Timeline */
.borrower-stepper {
    display: flex;
    justify-content: space-between;
    position: relative;
    padding: 1.5rem 0;
}

.borrower-stepper::before {
    content: '';
    position: absolute;
    top: 42px;
    left: 50px;
    right: 50px;
    height: 3px;
    background: var(--border-color);
    z-index: 1;
}

.stepper-node {
    position: relative;
    z-index: 2;
    text-align: center;
    background: var(--card-bg);
    padding: 0 0.75rem;
    flex: 1;
}

.stepper-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--body-bg);
    color: var(--slate-400);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.75rem auto;
    font-weight: 800;
    font-size: 1.1rem;
    border: 3px solid var(--card-bg);
    box-shadow: 0 0 0 2px var(--border-color);
    transition: all 0.3s ease;
}

.stepper-node.active .stepper-circle {
    background: var(--brand-primary);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(59, 91, 253, 0.25);
}

.stepper-node.completed .stepper-circle {
    background: var(--emerald-accent);
    color: #ffffff;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.25);
}

/* Toast Notifications Container */
#toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1090;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.custom-toast {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--brand-primary);
    padding: 0.95rem 1.35rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Multi-Device Media Query Breakpoints & Responsiveness */
@media (max-width: 991.98px) {
    #sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 35px rgba(0, 0, 0, 0.25);
    }
    #sidebar.show {
        transform: translateX(0);
    }
    #main-content, .content-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .mega-search-input {
        width: 100% !important;
        max-width: 240px;
    }
}

@media (max-width: 767.98px) {
    #topbar {
        padding: 0 1rem !important;
    }
    .container-fluid {
        padding: 1rem !important;
    }
    .mega-search-input {
        display: none !important;
    }
    .stat-card {
        padding: 1rem !important;
        min-height: 85px;
    }
    .stat-icon {
        width: 44px !important;
        height: 44px !important;
        min-width: 44px !important;
        font-size: 1.15rem !important;
    }
}

@media (max-width: 575.98px) {
    #topbar {
        padding: 0 0.75rem !important;
    }
    .container-fluid {
        padding: 0.75rem !important;
    }
    .card, .fintech-card {
        padding: 1rem !important;
    }
    .table th, .table td,
    .table-custom th, .table-custom td {
        padding: 0.75rem 0.85rem !important;
        font-size: 0.82rem !important;
    }
}

/* ==========================================================================
   Modern SaaS Split-Screen Auth Layout & Developer Toolbar Styles
   ========================================================================== */
.auth-hero-wrapper {
    min-height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #090d16;
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 91, 253, 0.25) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(124, 58, 237, 0.2) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(15, 23, 42, 0.9) 0px, transparent 100%);
    padding: 1.5rem;
    box-sizing: border-box;
}

.auth-card-modern {
    width: 100%;
    max-width: 1120px;
    min-height: 660px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

[data-theme="dark"] .auth-card-modern {
    background: #111827;
}

.auth-hero-banner {
    background: linear-gradient(135deg, #0b1329 0%, #1e1b4b 60%, #0f172a 100%) !important;
    position: relative;
    overflow: hidden;
}

.auth-hero-banner::before {
    content: '';
    position: absolute;
    top: -50px;
    left: -50px;
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, rgba(59, 91, 253, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.auth-hero-badge {
    background: rgba(255, 255, 255, 0.07) !important;
    border: 1px solid rgba(255, 255, 255, 0.14) !important;
    backdrop-filter: blur(12px);
    transition: transform 0.25s ease, border-color 0.25s ease;
}

.auth-hero-badge:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.25) !important;
}

.auth-input-group .input-group-text {
    background-color: var(--slate-50);
    border-color: var(--border-color);
    color: var(--slate-500);
}

.auth-input-group .form-control {
    border-color: var(--border-color);
    font-weight: 500;
}

.auth-input-group .form-control:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 4px rgba(59, 91, 253, 0.15);
}

.dev-toolbar-container {
    background: var(--slate-50);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1rem 1.25rem;
}

.dev-pill-btn {
    border-radius: 20px !important;
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    padding: 0.4rem 0.85rem !important;
}

/* ==========================================================================
   Authentic Physical Paper Legal Agreement Standard (Lawyer / Bond Paper)
   ========================================================================== */
.real-paper-contract,
.clean-contract-container {
    background: #ffffff;
    border: 1px solid #d4d4d8;
    border-radius: 0px !important;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.09), 0 1px 4px rgba(0, 0, 0, 0.05);
    color: #111111;
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    padding: 60px 70px;
    font-family: "Merriweather", "Times New Roman", Times, "Georgia", serif;
    font-size: 10.5pt;
    line-height: 1.85;
}

.paper-contract-desk {
    background-color: #f1f3f5;
    padding: 2.5rem 1rem;
    border-radius: 12px;
}

.clean-contract-header {
    border-bottom: 3px double #111111;
    padding-bottom: 1.25rem;
    margin-bottom: 2rem;
}

.clean-contract-brand {
    font-family: "Cinzel", "Times New Roman", Times, serif;
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: #000000;
    text-transform: uppercase;
    line-height: 1.2;
}

.clean-contract-ref {
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 8.5pt;
    color: #222222;
    line-height: 1.6;
}

.clean-contract-ref strong {
    color: #000000;
    font-weight: 700;
}

.clean-contract-title {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 0.75rem;
}

.clean-contract-title h3 {
    font-family: "Cinzel", "Times New Roman", Times, serif;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 1px;
    color: #000000;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    text-decoration: underline;
    text-underline-offset: 4px;
}

.clean-contract-title p {
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 9.5pt;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #333333;
    text-transform: uppercase;
    margin: 0;
}

.clean-contract-parties {
    background: #fafafa;
    border: 1px solid #111111;
    border-radius: 0px !important;
    padding: 1.25rem 1.5rem;
    margin-bottom: 2rem;
    font-size: 9.5pt;
    line-height: 1.7;
}

.clean-contract-parties .party-label {
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 8.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000000;
    margin-bottom: 2px;
}

.clean-contract-parties .party-name {
    font-family: "Cinzel", "Times New Roman", Times, serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #000000;
    letter-spacing: 0.5px;
}

.clean-contract-body {
    font-family: "Merriweather", "Times New Roman", Times, "Georgia", serif;
    font-size: 10pt;
    line-height: 1.85;
    color: #111111;
    text-align: justify;
    text-justify: inter-word;
}

.clean-contract-body h2 {
    font-family: "Cinzel", "Times New Roman", Times, serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: #000000;
    text-align: center;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.clean-contract-body h4 {
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 10pt;
    font-weight: 700;
    color: #000000;
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.clean-contract-body p {
    margin-bottom: 1.1rem;
}

.clean-contract-body ul, .clean-contract-body ol {
    padding-left: 2rem;
    margin-bottom: 1.25rem;
}

.clean-contract-body li {
    margin-bottom: 0.5rem;
}

.legal-schedule-box {
    border: 1px solid #111111;
    border-radius: 0px !important;
    padding: 1.25rem 1.5rem;
    margin: 2rem 0;
    background: #fafafa;
}

.legal-schedule-title {
    font-family: "Cinzel", "Times New Roman", serif;
    font-size: 9.5pt;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #000000;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #111111;
    padding-bottom: 0.35rem;
}

.legal-schedule-table {
    width: 100%;
    font-size: 9pt;
    line-height: 1.6;
}

.legal-schedule-table td {
    padding: 5px 8px;
    vertical-align: top;
    color: #111111;
}

.clean-signature-block {
    margin-top: 3.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #111111;
    page-break-inside: avoid;
}

.clean-signature-notice {
    font-family: "Merriweather", "Times New Roman", serif;
    text-align: center;
    font-size: 9pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #111111;
    margin-bottom: 2.25rem;
}

.clean-sign-col {
    background: #ffffff;
    border: 1px solid #777777;
    border-radius: 0px !important;
    padding: 1.5rem;
}

.clean-sign-party-label {
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 8.5pt;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #222222;
    margin-bottom: 0.25rem;
}

.clean-sign-party-name {
    font-family: "Cinzel", "Times New Roman", Times, serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #000000;
    letter-spacing: 0.5px;
    margin-bottom: 1.75rem;
}

.clean-sign-line {
    border-bottom: 1.5px solid #000000;
    margin-bottom: 0.75rem;
    height: 40px;
    display: flex;
    align-items: flex-end;
    padding-bottom: 4px;
}

.clean-sign-meta {
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 8.5pt;
    color: #222222;
    line-height: 1.6;
}

.clean-sign-meta strong {
    color: #000000;
}

.clean-legal-footer-note {
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 8pt;
    color: #555555;
    text-align: center;
    margin-top: 2.5rem;
    padding-top: 1rem;
    border-top: 1px solid #d4d4d8;
}

.legal-running-footer {
    display: flex;
    justify-content: space-between;
    font-family: "Merriweather", "Times New Roman", serif;
    font-size: 7.5pt;
    color: #777777;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2rem;
    padding-top: 0.5rem;
    border-top: 1px dotted #cccccc;
}

/* Print Optimization for Certified Agreement */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
        font-size: 10pt !important;
    }
    #sidebar, .sidebar-backdrop, #topbar, .no-print, header, footer, .btn, .modal-header, .modal-footer {
        display: none !important;
    }
    #main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }
    .container-fluid, .paper-contract-desk {
        padding: 0 !important;
        margin: 0 !important;
        background: transparent !important;
    }
    .clean-contract-container, .real-paper-contract, .corporate-agreement-card {
        border: none !important;
        box-shadow: none !important;
        margin: 0 !important;
        padding: 0.5in !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .page-break {
        page-break-before: always;
    }
}
/* ==========================================================================
   Smooth Component Enhancements & Micro-Interactions (All CRM Panels)
   ========================================================================== */

/* Modern Rounded Modals with Soft Backdrop */
.modal-content {
    border-radius: var(--radius-2xl) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.18) !important;
    background-color: var(--card-bg) !important;
    overflow: hidden;
}
.modal-header {
    border-bottom: 1px solid var(--border-color) !important;
    padding: 1.25rem 1.5rem !important;
}
.modal-footer {
    border-top: 1px solid var(--border-color) !important;
    padding: 1rem 1.5rem !important;
}
.modal-backdrop.show {
    opacity: 0.45 !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Polished Floating Dropdown Menus */
.dropdown-menu {
    border-radius: var(--radius-lg) !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-elevated) !important;
    background-color: var(--card-bg) !important;
    padding: 0.45rem !important;
    animation: fadeInMenu 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes fadeInMenu {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}
.dropdown-item {
    border-radius: var(--radius-md) !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: var(--text-main) !important;
    transition: var(--transition-fast) !important;
}
.dropdown-item:hover, .dropdown-item:focus {
    background-color: var(--brand-primary-light) !important;
    color: var(--brand-primary) !important;
    transform: translateX(2px);
}
.dropdown-item.text-danger:hover {
    background-color: var(--rose-light) !important;
    color: var(--rose-accent) !important;
}

/* Nav Tabs & Pills Smoothness */
.nav-pills .nav-link {
    border-radius: var(--radius-md) !important;
    font-weight: 600 !important;
    font-size: 0.86rem !important;
    color: var(--text-muted) !important;
    padding: 0.55rem 1rem !important;
    transition: var(--transition-fast) !important;
}
.nav-pills .nav-link:hover {
    color: var(--brand-primary) !important;
    background: var(--brand-primary-light) !important;
}
.nav-pills .nav-link.active {
    background: var(--brand-gradient) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(59, 91, 253, 0.3) !important;
}

/* Border Consistency on .border-0 Cards */
.card.border-0:not(.text-white):not([style*="background: linear-gradient"]):not([style*="background:linear-gradient"]) {
    border: 1px solid var(--border-color) !important;
}
.card.border-0:not(.text-white):not([style*="background: linear-gradient"]):not([style*="background:linear-gradient"]):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated) !important;
    border-color: rgba(59, 91, 253, 0.2) !important;
}

/* Dark gradient card fine border */
.card[style*="background: linear-gradient"],
.card[style*="background:linear-gradient"],
.card.text-white[style*="background"] {
    border: 1px solid rgba(255, 255, 255, 0.12) !important;
}

/* Pagination Smoothness */
.pagination .page-link {
    border: 1px solid var(--border-color) !important;
    color: var(--text-muted) !important;
    border-radius: var(--radius-md) !important;
    margin: 0 3px !important;
    padding: 0.45rem 0.85rem !important;
    font-weight: 600 !important;
    font-size: 0.84rem !important;
    transition: var(--transition-fast) !important;
}
.pagination .page-link:hover {
    background-color: var(--brand-primary-light) !important;
    color: var(--brand-primary) !important;
    border-color: rgba(59, 91, 253, 0.25) !important;
}
.pagination .page-item.active .page-link {
    background: var(--brand-gradient) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    box-shadow: 0 3px 10px rgba(59, 91, 253, 0.3) !important;
}

/* Smooth Input Focus & Fieldsets */
.input-group-text {
    border-color: var(--border-color) !important;
    background-color: var(--slate-50) !important;
    color: var(--text-muted) !important;
    font-size: 0.88rem !important;
}
.form-check-input {
    border-color: var(--slate-300) !important;
    cursor: pointer;
    transition: var(--transition-fast) !important;
}
.form-check-input:checked {
    background-color: var(--brand-primary) !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 0 0 3px rgba(59, 91, 253, 0.18) !important;
}
