/* ═══════════════════════════════════════════════
   FAB Capital — Main Stylesheet
   Font: Montserrat (headings/titles) + DM Sans (body)
   To edit styles: update this file only
═══════════════════════════════════════════════ */

:root {
  --navy: #3B1A5E; --navy2: #4A2070; --navy-light: #522278;
  --blue: #7B2D8B; --sky: #C084FC;
  --gold: #6DBE45; --gold2: #7DD44F;
  --green: #059669; --green-lt: #D1FAE5;
  --red: #DC2626; --red-lt: #FEE2E2;
  --orange: #EA580C; --orange-lt: #FFF7ED;
  --bg: #F8F4FF; --bg2: #F0E6FF;
  --card: #FFFFFF; --card2: #F8FAFF;
  --border: #DDD0F0; --border2: #E2E8F0;
  --text: #0F172A; --text2: #334155; --text3: #64748B; --text4: #94A3B8;
  --shadow: 0 2px 12px rgba(59,26,94,.10);
  --shadow2: 0 8px 32px rgba(59,26,94,.16);
  --radius: 14px; --radius2: 10px; --radius3: 8px;
  /* Montserrat for all headings/titles */
  --font: 'Montserrat', sans-serif;
  --body: 'DM Sans', sans-serif;
  --sidebar: 260px;
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); font-family: var(--body); color: var(--text); font-size: 14px; }
a { text-decoration: none; color: inherit; }
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
#app { min-height: 100vh; }

/* ── AUTH ── */
.auth-shell { display: flex; min-height: 100vh; }
.auth-left { flex: 0 0 440px; background: var(--navy); display: flex; flex-direction: column; justify-content: center; padding: 60px 48px; position: relative; overflow: hidden; }
.auth-left::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 30% 20%, rgba(192,132,252,.15) 0%, transparent 60%), radial-gradient(ellipse at 80% 80%, rgba(109,190,69,.12) 0%, transparent 55%); }
.auth-left-content { position: relative; z-index: 1; }
.auth-logo { margin-bottom: 40px; }
.auth-logo img { height: 52px; width: auto; }
.auth-headline { font-family: var(--font); font-size: 32px; font-weight: 800; color: #fff; line-height: 1.2; margin-bottom: 14px; }
.auth-headline span { color: var(--gold); }
.auth-tagline { color: rgba(255,255,255,.6); font-size: 14px; line-height: 1.7; }
.auth-features { margin-top: 36px; display: flex; flex-direction: column; gap: 14px; }
.auth-feat { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.75); font-size: 13px; }
.auth-feat-dot { width: 30px; height: 30px; border-radius: 8px; background: rgba(192,132,252,.2); border: 1px solid rgba(192,132,252,.3); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--sky); }
.auth-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { background: var(--card); border-radius: 20px; padding: 44px 40px; width: 100%; max-width: 420px; box-shadow: var(--shadow2); }
.auth-card-title { font-family: var(--font); font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.auth-card-sub { color: var(--text3); font-size: 13px; margin-bottom: 28px; }

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 11px; font-weight: 700; color: var(--text2); text-transform: uppercase; letter-spacing: .6px; margin-bottom: 6px; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--radius3); font-family: var(--body); font-size: 14px; color: var(--text); background: var(--card2); transition: border-color .2s, box-shadow .2s; outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(123,45,139,.1); background: #fff; }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ── BUTTONS ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 10px 20px; border-radius: var(--radius3); border: none; cursor: pointer; font-family: var(--body); font-size: 13px; font-weight: 600; transition: all .18s; text-decoration: none; white-space: nowrap; }
.btn i { font-size: 13px; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #5a1f69; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(123,45,139,.35); }
.btn-gold { background: var(--gold); color: #fff; }
.btn-gold:hover { background: #55a030; }
.btn-ghost { background: transparent; color: var(--text2); border: 1.5px solid var(--border); }
.btn-ghost:hover { background: var(--bg2); border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-warning:hover { background: #c2410c; }
.btn-info { background: #0ea5e9; color: #fff; }
.btn-info:hover { background: #0284c7; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ── AUTH SWITCH ── */
.auth-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--text3); }
.auth-switch a { color: var(--blue); font-weight: 600; cursor: pointer; }

/* ── TOASTS ── */
#toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 13px 18px; border-radius: 12px; font-size: 13px; font-weight: 500; box-shadow: 0 4px 16px rgba(0,0,0,.15); min-width: 260px; max-width: 340px; animation: slideIn .25s ease; display: flex; align-items: center; gap: 10px; }
.toast i { font-size: 15px; }
.toast-success { background: #fff; border-left: 4px solid var(--green); }
.toast-success i { color: var(--green); }
.toast-error { background: #fff; border-left: 4px solid var(--red); }
.toast-error i { color: var(--red); }
.toast-info { background: #fff; border-left: 4px solid var(--blue); }
.toast-info i { color: var(--blue); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ── SIDEBAR ── */
.dashboard-shell { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar); background: var(--navy); position: fixed; top: 0; left: 0; height: 100vh; display: flex; flex-direction: column; z-index: 100; overflow-y: auto; }
.sidebar-logo { padding: 22px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-logo img { height: 36px; width: auto; }
.sidebar-logo-sub { font-size: 10px; color: var(--sky); letter-spacing: 1.5px; text-transform: uppercase; margin-top: 4px; }
.sidebar-role-badge { margin: 12px 16px 0; padding: 5px 12px; border-radius: 20px; font-size: 10px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; text-align: center; }
.badge-admin { background: rgba(109,190,69,.2); color: var(--gold2); }
.badge-customer { background: rgba(192,132,252,.2); color: var(--sky); }
.badge-subadmin { background: rgba(5,150,105,.2); color: #34D399; }
.sidebar-nav { padding: 14px 10px; flex: 1; }
.sidebar-section-label { font-size: 10px; font-weight: 700; color: rgba(255,255,255,.25); letter-spacing: 1.5px; text-transform: uppercase; padding: 0 10px; margin: 14px 0 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius3); color: rgba(255,255,255,.55); font-size: 13px; font-weight: 500; cursor: pointer; transition: all .18s; margin-bottom: 2px; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: rgba(123,45,139,.5); color: #fff; font-weight: 600; }
.nav-item i { width: 16px; text-align: center; font-size: 14px; }
.sidebar-footer { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--navy-light); border: 2px solid rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; font-family: var(--font); font-size: 12px; font-weight: 700; color: #fff; flex-shrink: 0; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-email { font-size: 10px; color: rgba(255,255,255,.35); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout-btn { width: 28px; height: 28px; border-radius: 6px; border: none; background: rgba(255,255,255,.08); cursor: pointer; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.4); transition: all .18s; flex-shrink: 0; font-size: 13px; }
.logout-btn:hover { background: rgba(220,38,38,.25); color: #fca5a5; }

/* ── MAIN CONTENT ── */
.main-content { margin-left: var(--sidebar); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { background: var(--card); border-bottom: 1px solid var(--border); padding: 0 28px; height: 62px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 50; gap: 12px; }
.topbar-left { display: flex; flex-direction: column; }
.topbar-title { font-family: var(--font); font-size: 17px; font-weight: 700; color: var(--text); }
.topbar-sub { font-size: 11px; color: var(--text3); }
.content-area { padding: 24px; flex: 1; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--card); border-radius: var(--radius); padding: 20px; border: 1px solid var(--border); position: relative; overflow: hidden; }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; }
.stat-card.blue::before { background: linear-gradient(90deg, var(--blue), var(--sky)); }
.stat-card.gold::before { background: linear-gradient(90deg, var(--gold), var(--gold2)); }
.stat-card.green::before { background: linear-gradient(90deg, var(--green), #34D399); }
.stat-card.red::before { background: linear-gradient(90deg, var(--red), #F87171); }
.stat-icon { width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; font-size: 16px; }
.stat-icon.blue { background: rgba(123,45,139,.1); color: var(--blue); }
.stat-icon.gold { background: rgba(109,190,69,.12); color: var(--gold); }
.stat-icon.green { background: rgba(5,150,105,.1); color: var(--green); }
.stat-icon.red { background: var(--red-lt); color: var(--red); }
.stat-label { font-size: 11px; color: var(--text3); font-weight: 600; margin-bottom: 4px; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-family: var(--font); font-size: 28px; font-weight: 800; color: var(--text); line-height: 1; }
.stat-sub { font-size: 11px; color: var(--text4); margin-top: 5px; }

/* ── TABLE CARD ── */
.table-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; margin-bottom: 22px; }
.table-header { padding: 16px 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); gap: 12px; flex-wrap: wrap; }
.table-title { font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--text); }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--card2); }
th { padding: 10px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text3); text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--border); }
td { padding: 11px 16px; font-size: 13px; color: var(--text2); border-bottom: 1px solid var(--border2); }
tbody tr:hover { background: var(--card2); }
tbody tr:last-child td { border-bottom: none; }
.td-name { font-weight: 600; color: var(--text); }
.badge { padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.badge-active { background: var(--green-lt); color: var(--green); }
.badge-pending { background: var(--orange-lt); color: var(--orange); }
.badge-rejected { background: var(--red-lt); color: var(--red); }
.search-box { padding: 8px 14px; border: 1.5px solid var(--border); border-radius: var(--radius3); font-family: var(--body); font-size: 13px; color: var(--text); background: var(--card2); outline: none; width: 210px; }
.search-box:focus { border-color: var(--blue); }
/* Block browser autofill highlight on search boxes */
.search-box:-webkit-autofill,
.search-box:-webkit-autofill:hover,
.search-box:-webkit-autofill:focus { -webkit-box-shadow: 0 0 0 1000px var(--card2) inset; }
.action-btns { display: flex; gap: 4px; flex-wrap: wrap; }

/* ── MODAL ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: none; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.open { display: flex; }
.modal { background: var(--card); border-radius: var(--radius); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-header { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: var(--font); font-size: 15px; font-weight: 700; }
.modal-close { width: 28px; height: 28px; border: none; background: var(--bg2); border-radius: 6px; cursor: pointer; font-size: 14px; color: var(--text3); transition: all .15s; }
.modal-close:hover { background: var(--red-lt); color: var(--red); }
.modal-body { padding: 22px; }

/* ── INFO GRID ── */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-item { background: var(--card2); border-radius: var(--radius2); padding: 12px 14px; border: 1px solid var(--border2); }
.info-item-label { font-size: 10px; color: var(--text3); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; margin-bottom: 4px; }
.info-item-value { font-size: 13px; font-weight: 600; color: var(--text); }

/* ── TABS ── */
.tab-bar { display: flex; gap: 4px; background: var(--bg2); padding: 4px; border-radius: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text3); border: none; background: transparent; transition: all .15s; display: flex; align-items: center; gap: 6px; }
.tab.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.section-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 22px; margin-bottom: 18px; }
.section-title { font-family: var(--font); font-size: 14px; font-weight: 700; margin-bottom: 16px; color: var(--text); }

/* ── FINANCIALS ── */
.fin-year-block { margin-bottom: 16px; padding: 16px; background: var(--card2); border-radius: var(--radius2); border: 1px solid var(--border2); }
.fin-year-label { font-family: var(--font); font-weight: 700; font-size: 13px; margin-bottom: 12px; color: var(--navy); display: flex; align-items: center; gap: 8px; }

/* ── DEBT TABLE ── */
.debt-table-wrap { overflow-x: auto; }
.debt-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.debt-table th { background: var(--bg2); padding: 8px 12px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text3); border-bottom: 1px solid var(--border); }
.debt-table td { padding: 7px 10px; border-bottom: 1px solid var(--border2); }
.debt-table input { border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; width: 100%; font-size: 13px; font-family: var(--body); outline: none; }
.debt-table input:focus { border-color: var(--blue); }

/* ── UPLOAD ── */
.upload-zone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 36px; text-align: center; cursor: pointer; transition: all .2s; background: var(--card2); }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--blue); background: var(--bg2); }
.upload-zone i { font-size: 36px; color: var(--text4); margin-bottom: 12px; display: block; }
.upload-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.upload-sub { font-size: 12px; color: var(--text3); }
.file-list { margin-top: 14px; display: flex; flex-direction: column; gap: 7px; }
.file-item { display: flex; align-items: center; gap: 10px; background: var(--card2); border-radius: 8px; padding: 9px 13px; border: 1px solid var(--border2); }
.file-name { flex: 1; font-size: 13px; font-weight: 500; }
.file-size { font-size: 11px; color: var(--text4); }
.file-remove { background: none; border: none; color: var(--red); cursor: pointer; padding: 2px 6px; font-size: 14px; }
.upload-action { margin-top: 12px; display: none; }

/* ── ALERTS ── */
.alert { padding: 11px 16px; border-radius: var(--radius3); font-size: 13px; margin-bottom: 14px; display: flex; align-items: flex-start; gap: 8px; }
.alert i { margin-top: 1px; flex-shrink: 0; }
.alert-info { background: var(--bg2); border-left: 3px solid var(--blue); color: var(--text2); }
.alert-info i { color: var(--blue); }
.alert-success { background: var(--green-lt); border-left: 3px solid var(--green); color: #065f46; }
.alert-warning { background: var(--orange-lt); border-left: 3px solid var(--orange); color: #9a3412; }
.alert-danger { background: var(--red-lt); border-left: 3px solid var(--red); color: #991b1b; }

/* ── LENDER SELECT ── */
.lender-select-list { display: flex; flex-direction: column; gap: 7px; max-height: 260px; overflow-y: auto; }
.lender-select-item { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1.5px solid var(--border); border-radius: var(--radius3); cursor: pointer; transition: all .15s; }
.lender-select-item:hover, .lender-select-item.selected { border-color: var(--blue); background: var(--bg2); }
.lender-select-item input[type=checkbox] { accent-color: var(--blue); width: 15px; height: 15px; }
.lender-select-name { font-weight: 600; font-size: 13px; }
.lender-select-sub { font-size: 11px; color: var(--text3); }

/* ── AUDIT LOG ── */
.audit-list { padding: 4px 0; }
.audit-item { display: flex; align-items: flex-start; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--border2); }
.audit-item:last-child { border-bottom: none; }
.audit-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.audit-dot-blue { background: var(--blue); }
.audit-dot-green { background: var(--green); }
.audit-dot-red { background: var(--red); }
.audit-dot-gold { background: var(--gold); }
.audit-text { font-size: 13px; line-height: 1.5; flex: 1; }
.audit-time { font-size: 11px; color: var(--text4); white-space: nowrap; flex-shrink: 0; }

/* ── MISC ── */
.empty-state { padding: 44px 24px; text-align: center; }
.empty-state i { font-size: 36px; color: var(--text4); margin-bottom: 10px; display: block; }
.empty-state-text { color: var(--text3); font-size: 14px; }
.status-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.chip-pending { background: var(--orange-lt); color: var(--orange); }
.chip-active { background: var(--green-lt); color: var(--green); }
.chip-rejected { background: var(--red-lt); color: var(--red); }

/* ── APP STATUS TRACKER ── */
.app-status-tracker { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 22px; margin-bottom: 18px; }
.tracker-title { font-family: var(--font); font-size: 14px; font-weight: 700; margin-bottom: 20px; color: var(--text); }
.tracker-steps { display: flex; align-items: flex-start; position: relative; }
.tracker-steps::before { content: ''; position: absolute; top: 18px; left: 18px; right: 18px; height: 2px; background: var(--border); z-index: 0; }
.tracker-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; position: relative; z-index: 1; }
.step-dot { width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border); background: var(--card); display: flex; align-items: center; justify-content: center; font-size: 13px; color: var(--text4); transition: all .3s; }
.step-dot.done { background: var(--green); border-color: var(--green); color: #fff; }
.step-dot.active { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 4px rgba(123,45,139,.15); }
.step-dot.rejected { background: var(--red); border-color: var(--red); color: #fff; }
.step-label { font-size: 11px; font-weight: 600; color: var(--text3); text-align: center; line-height: 1.3; max-width: 80px; }
.step-label.active { color: var(--blue); }
.step-label.done { color: var(--green); }
.step-label.rejected { color: var(--red); }

/* ── LIVE TRACKER ── */
.tracker-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); padding: 18px; margin-bottom: 12px; }
.tracker-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.tracker-company { font-family: var(--font); font-size: 14px; font-weight: 700; color: var(--text); }
.tracker-meta { font-size: 12px; color: var(--text3); margin-top: 3px; }
.tracker-note { font-size: 12px; color: var(--text2); background: var(--bg2); border-radius: 6px; padding: 6px 10px; margin-top: 10px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; }
.tag-submitted { background: #dbeafe; color: #1d4ed8; }
.tag-docs { background: #ede9fe; color: #6d28d9; }
.tag-processing { background: var(--orange-lt); color: var(--orange); }
.tag-sanctioned { background: var(--green-lt); color: var(--green); }
.tag-rejected { background: var(--red-lt); color: var(--red); }

/* ── LOADER ── */
.loader { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; border-radius: 50%; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .auth-left { display: none; }
  .sidebar { transform: translateX(-100%); transition: transform .3s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .info-grid, .form-row { grid-template-columns: 1fr; }
  .tracker-steps { flex-direction: column; align-items: flex-start; }
  .tracker-steps::before { display: none; }
}
