/* ============================================================
   FAST FUND CREDIT LIMITED — DESIGN SYSTEM
   Font: Plus Jakarta Sans + Syne
   Theme: Deep Navy / Emerald / Amber
   ============================================================ */

:root {
    --primary: #0B2447;
    --primary-light: #19376D;
    --primary-dark: #071829;
    --accent: #10B981;
    --accent-light: #34D399;
    --accent-dark: #059669;
    --amber: #F59E0B;
    --amber-light: #FCD34D;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --warning: #F97316;
    --info: #3B82F6;
    --info-light: #EFF6FF;
    --white: #FFFFFF;
    --surface: #F8FAFC;
    --surface-2: #F1F5F9;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 68px;
    --topbar-height: 68px;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 16px rgba(11,36,71,0.08);
    --shadow-lg: 0 10px 40px rgba(11,36,71,0.12);
    --font-body: 'Plus Jakarta Sans', sans-serif;
    --font-display: 'Syne', sans-serif;
    --transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--surface);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
img { max-width: 100%; }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--surface-2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--primary);
    display: flex; flex-direction: column;
    z-index: 1000;
    overflow-y: auto; overflow-x: hidden;
    transition: width 0.25s cubic-bezier(0.4,0,0.2,1);
    will-change: width;
}

.sidebar-brand {
    display: flex; align-items: center; justify-content: space-between;
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    min-height: 72px;
    flex-shrink: 0;
}

.brand-link {
    display: flex; align-items: center; gap: 10px;
    flex: 1; overflow: hidden; min-width: 0;
}

.brand-logo { flex-shrink: 0; }

.logo-img {
    width: 38px; height: 38px;
    border-radius: var(--radius-sm);
    object-fit: contain;
}

.logo-placeholder {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 16px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; overflow: hidden; }
.brand-name {
    font-family: var(--font-display);
    font-size: 15px; font-weight: 800;
    color: white; white-space: nowrap;
}
.brand-sub {
    font-size: 10px; font-weight: 500;
    color: rgba(255,255,255,0.5);
    white-space: nowrap;
    text-transform: uppercase; letter-spacing: 0.5px;
}

.sidebar-toggle-btn {
    width: 32px; height: 32px;
    background: rgba(255,255,255,0.08);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    flex-shrink: 0;
    transition: var(--transition);
}
.sidebar-toggle-btn:hover { background: rgba(255,255,255,0.15); color: white; }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    flex-shrink: 0; overflow: hidden;
}
.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--accent), var(--amber));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 700; color: white;
    flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.badge-role-director {
    display: inline-block;
    background: rgba(245,158,11,0.2); color: var(--amber-light);
    font-size: 10px; font-weight: 600;
    padding: 1px 8px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: 0.5px;
    width: fit-content;
}
.badge-role-staff {
    display: inline-block;
    background: rgba(16,185,129,0.2); color: var(--accent-light);
    font-size: 10px; font-weight: 600;
    padding: 1px 8px; border-radius: 99px;
    text-transform: uppercase; letter-spacing: 0.5px;
    width: fit-content;
}

.sidebar-nav { flex: 1; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }

.nav-section-label {
    font-size: 10px; font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase; letter-spacing: 1px;
    padding: 10px 8px 4px;
}

.nav-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65);
    font-size: 13.5px; font-weight: 500;
    transition: var(--transition);
    position: relative;
    white-space: nowrap; overflow: hidden;
    width: 100%; text-align: left;
}

.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: white;
    box-shadow: 0 4px 12px rgba(16,185,129,0.3);
}

.nav-icon { width: 18px; min-width: 18px; text-align: center; font-size: 14px; flex-shrink: 0; }
.nav-label { flex: 1; }
.nav-badge {
    background: var(--amber); color: var(--primary);
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 99px; min-width: 20px; text-align: center;
    flex-shrink: 0;
}
.nav-badge.danger { background: var(--danger); color: white; }

.sidebar-footer-link {
    padding: 10px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.logout-btn {
    width: 100%;
    color: rgba(255,255,255,0.5);
    font-size: 13.5px; font-weight: 500;
}
.logout-btn:hover { background: rgba(239,68,68,0.15); color: #FCA5A5; }
/* ── Nav Group (Accounting submenu) ── */
.nav-group { display: flex; flex-direction: column; }
.nav-group-toggle { justify-content: flex-start; }
.nav-chevron { margin-left: auto; font-size: 10px; flex-shrink: 0; transition: transform 0.25s ease; }
.nav-group.open .nav-chevron { transform: rotate(180deg); }
.nav-group-items { overflow: hidden; max-height: 0; transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1); }
.nav-group.open .nav-group-items { max-height: 300px; }
.nav-sub { padding-left: 24px; font-size: 12.5px; }
.nav-sub .nav-icon { font-size: 12px; }

/* ============================================================
   SIDEBAR COLLAPSED STATE
   ============================================================ */
body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .main-wrapper { margin-left: var(--sidebar-collapsed-width); }

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .sidebar-user .user-info,
body.sidebar-collapsed .nav-label,
body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-badge,
body.sidebar-collapsed .nav-chevron { opacity: 0; width: 0; pointer-events: none; }

body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 20px 8px 16px; }
body.sidebar-collapsed .brand-link { justify-content: center; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 14px 8px; }
body.sidebar-collapsed .nav-item { justify-content: center; padding: 12px; gap: 0; }
body.sidebar-collapsed .nav-sub { padding-left: 12px; }
body.sidebar-collapsed .sidebar-toggle-btn { display: none; }
body.sidebar-collapsed .nav-group-items { max-height: 0 !important; }

body.sidebar-collapsed .nav-item[title]:hover::after {
    content: attr(title);
    position: absolute; left: calc(var(--sidebar-collapsed-width) + 8px);
    background: #0B2447; color: white;
    font-size: 12px; font-weight: 600;
    padding: 6px 12px; border-radius: var(--radius-sm);
    white-space: nowrap; z-index: 9999;
    box-shadow: var(--shadow);
    pointer-events: none;
}

/* ============================================================
   MAIN WRAPPER
   ============================================================ */
.main-wrapper {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex; flex-direction: column;
    transition: margin-left 0.25s cubic-bezier(0.4,0,0.2,1);
}
/* Topbar toggle button — always visible */
.sidebar-toggle-btn-top {
    width: 36px; height: 36px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary);
    font-size: 15px;
    transition: var(--transition);
    flex-shrink: 0;
}
.sidebar-toggle-btn-top:hover { background: var(--border); color: var(--primary); }

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
    height: var(--topbar-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }

.mobile-toggle { display: none; font-size: 18px; color: var(--text-secondary); padding: 8px; }

.page-title { font-family: var(--font-display); font-size: 20px; font-weight: 800; color: var(--primary); line-height: 1; }
.breadcrumb-nav { font-size: 11.5px; color: var(--text-muted); }
.breadcrumb-nav a { color: var(--accent); }
.breadcrumb-nav a::after { content: ' /'; color: var(--text-muted); }

.topbar-date { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-secondary); }
.topbar-divider { width: 1px; height: 24px; background: var(--border); }

.topbar-user-menu {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}
.topbar-user-menu:hover { background: var(--surface-2); }

.topbar-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: white;
}
.topbar-name { font-size: 13px; font-weight: 600; color: var(--text-primary); display: block; line-height: 1.2; }
.topbar-role { font-size: 11px; color: var(--text-muted); display: block; }
.topbar-caret { font-size: 10px; color: var(--text-muted); }

.user-dropdown {
    display: none;
    position: absolute; top: calc(100% + 8px); right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    overflow: hidden; z-index: 200;
}
.user-dropdown.open { display: block; }

.dropdown-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 16px;
    font-size: 13px; color: var(--text-secondary);
    width: 100%;
    transition: var(--transition);
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text-primary); }
.dropdown-item.danger:hover { background: var(--danger-light); color: var(--danger); }
.dropdown-item i { width: 16px; text-align: center; }
.dropdown-divider { height: 1px; background: var(--border); }

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area { flex: 1; padding: 24px; }
.content-inner { max-width: 1400px; margin: 0 auto; }

/* ============================================================
   FOOTER
   ============================================================ */
.app-footer {
    background: white;
    border-top: 1px solid var(--border);
    padding: 14px 24px;
}
.footer-inner { display: flex; align-items: center; justify-content: space-between; max-width: 1400px; margin: 0 auto; }
.footer-left, .footer-right { font-size: 12px; color: var(--text-muted); }
.footer-link { color: var(--accent); font-weight: 600; }
.footer-link:hover { text-decoration: underline; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-light);
    display: flex; align-items: flex-start; gap: 16px;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
}
.stat-card.green::before { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.stat-card.blue::before { background: linear-gradient(90deg, var(--info), #60A5FA); }
.stat-card.amber::before { background: linear-gradient(90deg, var(--amber), var(--amber-light)); }
.stat-card.red::before { background: linear-gradient(90deg, var(--danger), #F87171); }
.stat-card.navy::before { background: linear-gradient(90deg, var(--primary), var(--primary-light)); }

.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; flex-shrink: 0;
}
.stat-icon.green { background: rgba(16,185,129,0.1); color: var(--accent); }
.stat-icon.blue { background: rgba(59,130,246,0.1); color: var(--info); }
.stat-icon.amber { background: rgba(245,158,11,0.1); color: var(--amber); }
.stat-icon.red { background: rgba(239,68,68,0.1); color: var(--danger); }
.stat-icon.navy { background: rgba(11,36,71,0.08); color: var(--primary); }

.stat-info { flex: 1; }
.stat-value { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; font-weight: 500; }
.stat-change { display: flex; align-items: center; gap: 4px; font-size: 11.5px; margin-top: 6px; font-weight: 600; }
.stat-change.up { color: var(--accent); }
.stat-change.down { color: var(--danger); }

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: white;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-light);
}
.card-title {
    font-family: var(--font-display);
    font-size: 15px; font-weight: 700; color: var(--primary);
    display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--accent); }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border-light); background: var(--surface); }

/* ============================================================
   TABLES
   ============================================================ */
.table-responsive { overflow-x: auto; }

.data-table {
    width: 100%; border-collapse: collapse;
    font-size: 13.5px;
}
.data-table th {
    background: var(--surface-2);
    padding: 12px 16px;
    text-align: left;
    font-size: 11px; font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.5px;
    white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
.data-table td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text-primary);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface); }

/* ============================================================
   BADGES
   ============================================================ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px; border-radius: 99px;
    font-size: 11px; font-weight: 600;
    white-space: nowrap;
}
.badge-success { background: rgba(16,185,129,0.1); color: var(--accent-dark); }
.badge-danger { background: rgba(239,68,68,0.1); color: #DC2626; }
.badge-warning { background: rgba(245,158,11,0.1); color: #D97706; }
.badge-info { background: rgba(59,130,246,0.1); color: #2563EB; }
.badge-secondary { background: var(--surface-2); color: var(--text-secondary); }
.badge-primary { background: rgba(11,36,71,0.08); color: var(--primary); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600;
    transition: var(--transition);
    border: 1.5px solid transparent;
    white-space: nowrap;
}
.btn i { font-size: 12px; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent { background: var(--accent); color: white; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text-secondary); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-amber { background: var(--amber); color: white; }
.btn-amber:hover { background: #D97706; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; }

/* ============================================================
   FORMS
   ============================================================ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.form-grid-2 { grid-template-columns: repeat(2, 1fr); }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--text-secondary); }
.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    height: 40px;
    padding: 0 12px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13.5px; font-family: inherit;
    color: var(--text-primary);
    background: white;
    transition: var(--transition);
    width: 100%;
}
.form-control:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(16,185,129,0.1); }
.form-control.error { border-color: var(--danger); }

textarea.form-control { height: auto; padding: 10px 12px; resize: vertical; min-height: 80px; }
select.form-control { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2394A3B8'%3E%3Cpath fill-rule='evenodd' d='M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; }

.form-hint { font-size: 11px; color: var(--text-muted); }
.form-error { font-size: 11px; color: var(--danger); display: flex; align-items: center; gap: 4px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500;
    margin-bottom: 20px;
}
.alert-success { background: rgba(16,185,129,0.08); color: var(--accent-dark); border: 1px solid rgba(16,185,129,0.2); }
.alert-error { background: rgba(239,68,68,0.08); color: #DC2626; border: 1px solid rgba(239,68,68,0.2); }
.alert-close { margin-left: auto; color: inherit; opacity: 0.6; font-size: 12px; }
.alert-close:hover { opacity: 1; }

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 24px; gap: 16px;
}
.page-header-left h2 { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: var(--primary); }
.page-header-left p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.page-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* ============================================================
   CHARTS
   ============================================================ */
.chart-container { position: relative; }
.chart-wrapper { padding: 8px 0; }

/* ============================================================
   GRID LAYOUTS
   ============================================================ */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.grid-lg-2 { display: grid; grid-template-columns: 1fr 380px; gap: 20px; }

/* ============================================================
   SEARCH & FILTERS
   ============================================================ */
.table-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    gap: 12px; flex-wrap: wrap;
}
.search-box {
    position: relative; flex: 1; max-width: 320px; min-width: 200px;
}
.search-box i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.search-input {
    width: 100%; height: 38px;
    padding: 0 12px 0 36px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px; font-family: inherit;
    transition: var(--transition);
}
.search-input:focus { outline: none; border-color: var(--accent); }

.filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
    text-align: center; padding: 60px 20px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.empty-icon { font-size: 48px; color: var(--text-muted); opacity: 0.4; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-text { font-size: 13px; color: var(--text-muted); max-width: 300px; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%; max-width: 560px;
    max-height: 90vh;
    display: flex; flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.2s ease;
}
.modal-lg { max-width: 760px; }
.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-light);
}
.modal-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; color: var(--primary); }
.modal-close { color: var(--text-muted); font-size: 16px; padding: 4px; transition: var(--transition); }
.modal-close:hover { color: var(--danger); }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border-light); display: flex; align-items: center; justify-content: flex-end; gap: 10px; }

@keyframes modalIn { from { opacity: 0; transform: scale(0.96) translateY(10px); } to { opacity: 1; transform: none; } }

/* ============================================================
   AVATAR
   ============================================================ */
.borrower-avatar {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 700; color: white;
    flex-shrink: 0;
}

/* ============================================================
   TIMELINE
   ============================================================ */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item:not(:last-child)::before {
    content: ''; position: absolute; left: 15px; top: 28px; bottom: 0;
    width: 2px; background: var(--border-light);
}
.timeline-dot {
    width: 30px; height: 30px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; flex-shrink: 0; z-index: 1;
}
.timeline-dot.green { background: rgba(16,185,129,0.1); color: var(--accent); }
.timeline-dot.blue { background: rgba(59,130,246,0.1); color: var(--info); }
.timeline-dot.amber { background: rgba(245,158,11,0.1); color: var(--amber); }
.timeline-dot.red { background: rgba(239,68,68,0.1); color: var(--danger); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.timeline-date { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination { display: flex; align-items: center; gap: 4px; padding: 14px 20px; border-top: 1px solid var(--border-light); }
.page-link {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 12.5px; font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    border: 1.5px solid transparent;
}
.page-link:hover { background: var(--surface-2); }
.page-link.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ============================================================
   AUTH PAGES
   ============================================================ */
.auth-body { background: var(--surface); }

.auth-wrapper { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }

.auth-left {
    background: var(--primary);
    padding: 48px;
    display: flex; flex-direction: column; gap: 32px;
    position: relative; overflow: hidden;
}
.auth-left::before {
    content: '';
    position: absolute; width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(16,185,129,0.15) 0%, transparent 70%);
    top: -100px; right: -200px;
    pointer-events: none;
}

.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-logo-wrap { flex-shrink: 0; }
.auth-logo-img { width: 48px; height: 48px; border-radius: var(--radius); object-fit: contain; }
.auth-logo-icon {
    width: 48px; height: 48px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: white;
}
.auth-brand-name { font-family: var(--font-display); font-size: 22px; font-weight: 800; color: white; display: block; }
.auth-brand-sub { font-size: 12px; color: rgba(255,255,255,0.5); text-transform: uppercase; letter-spacing: 0.5px; display: block; }

.auth-tagline { flex: 1; }
.auth-tagline h2 { font-family: var(--font-display); font-size: 36px; font-weight: 800; color: white; line-height: 1.2; margin-bottom: 16px; }
.auth-tagline p { font-size: 15px; color: rgba(255,255,255,0.55); line-height: 1.7; }

.auth-stats { display: flex; flex-direction: column; gap: 12px; }
.auth-stat { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,0.7); font-size: 14px; }
.auth-stat i { color: var(--accent); width: 16px; }

.auth-right {
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    padding: 48px 40px;
    background: white;
}

.auth-card { width: 100%; max-width: 400px; }
.auth-card-title { font-family: var(--font-display); font-size: 26px; font-weight: 800; color: var(--primary); margin-bottom: 6px; }
.auth-card-sub { font-size: 13.5px; color: var(--text-muted); margin-bottom: 28px; }

.auth-footer-text { margin-top: 24px; font-size: 12px; color: var(--text-muted); }
.auth-footer-text a { color: var(--accent); font-weight: 600; }

/* ============================================================
   DETAIL PAGE
   ============================================================ */
.detail-section { margin-bottom: 24px; }
.detail-row { display: flex; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border-light); gap: 16px; }
.detail-row:last-child { border-bottom: none; }
.detail-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; width: 160px; flex-shrink: 0; padding-top: 1px; }
.detail-value { font-size: 13.5px; color: var(--text-primary); flex: 1; }

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.progress-bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 0.6s ease; }
.progress-fill.green { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.progress-fill.amber { background: linear-gradient(90deg, var(--amber), var(--amber-light)); }
.progress-fill.red { background: linear-gradient(90deg, var(--danger), #F87171); }

/* ============================================================
   UTILITIES
   ============================================================ */
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent); }
.text-danger { color: var(--danger); }
.text-amber { color: var(--amber); }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .grid-lg-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; }
    .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main-wrapper { margin-left: 0 !important; }
    .mobile-toggle { display: flex; }
    .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; backdrop-filter: blur(2px); }
    .sidebar-overlay.active { display: block; }

    /* Show full text when mobile sidebar is open */
    .sidebar.mobile-open .brand-text,
    .sidebar.mobile-open .user-info,
    .sidebar.mobile-open .nav-label,
    .sidebar.mobile-open .nav-section-label,
    .sidebar.mobile-open .nav-badge,
    .sidebar.mobile-open .nav-chevron { opacity: 1 !important; width: auto !important; pointer-events: auto !important; }
    .sidebar.mobile-open .sidebar-brand { justify-content: space-between !important; padding: 20px 16px 16px !important; }
    .sidebar.mobile-open .brand-link { justify-content: flex-start !important; }
    .sidebar.mobile-open .sidebar-user { justify-content: flex-start !important; padding: 14px 16px !important; }
    .sidebar.mobile-open .nav-item { justify-content: flex-start !important; padding: 10px 12px !important; gap: 10px !important; }
    .sidebar.mobile-open .nav-sub { padding-left: 24px !important; }
    .sidebar.mobile-open .sidebar-toggle-btn { display: flex !important; }

    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .auth-wrapper { grid-template-columns: 1fr; }
    .auth-left { display: none; }
    .page-header { flex-direction: column; }
    .topbar-date { display: none; }
    .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
    .table-toolbar { flex-direction: column; align-items: stretch; }
    .search-box { max-width: 100%; }
}

@media (max-width: 480px) {
    .content-area { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr; }
}