/* ================================================================
   PORTAL SCROLL FIX
   style.css sets overflow:hidden on html/body for the admin panel.
   Portal needs normal scrolling — override here.
   ================================================================ */
html, body { overflow: auto !important; height: auto !important; }
.auth-wrapper { overflow-y: auto !important; }
.portal-app   { overflow-x: hidden; overflow-y: auto; min-height: 100vh; }
.portal-main  { overflow-y: visible; padding-bottom: 60px; }

/* ================================================================
   DESIGN TOKENS — Portal-specific overrides
   ================================================================ */
:root {
  --p-sidebar-w:   240px;
  --p-header-h:    60px;
  --p-radius-card: 16px;
  --p-radius-sm:   10px;
  --p-shadow-card: 0 2px 16px rgba(0,0,0,.12);
  --p-shadow-elevated: 0 8px 32px rgba(0,0,0,.18);
  --p-blue:   #3b82f6;
  --p-green:  #10b981;
  --p-orange: #f59e0b;
  --p-purple: #8b5cf6;
  --p-red:    #ef4444;
}

/* ================================================================
   AUTH PAGES
   ================================================================ */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  background: var(--bg-primary);
  background-image:
    radial-gradient(ellipse 900px 600px at 15% 10%, rgba(59,130,246,.1) 0%, transparent 65%),
    radial-gradient(ellipse 700px 500px at 85% 90%, rgba(139,92,246,.08) 0%, transparent 65%);
}

.auth-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg-card);
  border: 1px solid rgba(59,130,246,.15);
  border-radius: 24px;
  padding: 40px 44px;
  box-shadow: 0 24px 80px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.03) inset;
}

.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}
.auth-logo {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--p-blue), var(--p-purple));
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; color: #fff;
  margin: 0 auto 14px;
  box-shadow: 0 8px 28px rgba(59,130,246,.4);
}
.auth-brand h1 { font-size: 28px; font-weight: 800; margin: 0; color: var(--text-primary); }
.auth-brand p  { color: var(--text-muted); font-size: 13px; margin: 6px 0 0; }

.auth-tabs {
  display: flex; gap: 4px;
  background: var(--bg-secondary);
  border-radius: 12px; padding: 4px;
  margin-bottom: 28px;
}
.auth-tab {
  flex: 1; padding: 9px 0;
  border: none; background: transparent;
  color: var(--text-muted); font-size: 14px; font-weight: 600;
  border-radius: 9px; cursor: pointer; transition: all .2s;
}
.auth-tab.active {
  background: linear-gradient(135deg, var(--p-blue), var(--p-purple));
  color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,.35);
}

.auth-form { display: none; }
.auth-form.active { display: block; }
.auth-switch { text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted); }
.auth-switch a { color: var(--p-blue); text-decoration: none; font-weight: 600; }
.forgot-link { color: var(--text-muted); font-size: 12px; text-decoration: none; }
.forgot-link:hover { color: var(--p-blue); }

/* Registration steps */
.reg-steps { display: flex; align-items: center; margin-bottom: 28px; }
.reg-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px; flex: 0 0 auto;
}
.reg-step span {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--bg-secondary); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--text-muted); transition: all .3s;
}
.reg-step small { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.reg-step.active span { background: var(--p-blue); border-color: var(--p-blue); color: #fff; box-shadow: 0 4px 14px rgba(59,130,246,.45); }
.reg-step.done   span { background: var(--p-green); border-color: var(--p-green); color: #fff; }
.reg-step-line   { flex: 1; height: 2px; background: var(--border); margin: 0 6px; position: relative; top: -10px; }

.step-title {
  font-size: 16px; font-weight: 700; color: var(--text-primary);
  margin: 0 0 20px; display: flex; align-items: center; gap: 9px;
}
.step-title i { color: var(--p-blue); }

.step-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .auth-card { padding: 26px 20px; border-radius: 18px; }
  .auth-wrapper { padding: 12px 8px; }
  .reg-steps small { display: none; }
  .step-actions { flex-wrap: wrap; gap: 8px; }
}
@media (max-width: 400px) { .auth-card { padding: 22px 14px; } }

/* ================================================================
   FORM UTILITIES
   ================================================================ */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid-2 .form-group.full { grid-column: 1 / -1; }
@media (max-width: 520px) { .form-grid-2 { grid-template-columns: 1fr; } }

.req { color: var(--p-red); font-size: 11px; }
.field-hint { color: var(--text-muted); font-size: 11px; margin-top: 4px; display: block; }
.terms-check { margin: 18px 0; }

.info-note {
  background: rgba(59,130,246,.07);
  border: 1px solid rgba(59,130,246,.18);
  border-radius: 12px; padding: 13px 16px;
  font-size: 13px; color: var(--text-secondary);
  display: flex; align-items: flex-start; gap: 10px; margin-bottom: 16px;
}
.info-note i { color: var(--p-blue); margin-top: 2px; flex-shrink: 0; }

.blocked-notice {
  background: rgba(249,115,22,.07);
  border: 1px solid rgba(249,115,22,.22);
  border-radius: 16px; padding: 24px;
  display: flex; align-items: flex-start; gap: 16px; font-size: 14px;
}
.blocked-notice > i { font-size: 28px; color: var(--p-orange); margin-top: 2px; }
.blocked-notice strong { color: var(--text-primary); font-size: 16px; }
.blocked-notice p { color: var(--text-muted); margin: 6px 0 0; }

/* ================================================================
   PORTAL APP SHELL — SIDEBAR LAYOUT
   ================================================================ */
.portal-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-primary);
}

/* ── Top header bar ─────────────────────────────────────────── */
.portal-header {
  position: sticky; top: 0; z-index: 100;
  height: var(--p-header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 20px 0 16px; gap: 16px;
  box-shadow: 0 2px 20px rgba(0,0,0,.18);
}
.portal-header-left  { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.portal-header-right { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; margin-left: auto; position: relative; }

.portal-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--p-blue), var(--p-purple));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; color: #fff;
  box-shadow: 0 4px 14px rgba(59,130,246,.35);
  flex-shrink: 0;
}
.portal-brand     { font-size: 16px; font-weight: 800; color: var(--text-primary); display: block; }
.portal-brand-sub { font-size: 10px; color: var(--text-muted); display: block; }

/* Hamburger — hidden on desktop, shown on mobile */
.portal-hamburger {
  display: none;
  background: transparent; border: none;
  color: var(--text-primary); font-size: 20px;
  cursor: pointer; padding: 6px 10px;
  border-radius: 9px; flex-shrink: 0;
}
.portal-hamburger:hover { background: var(--bg-hover); }

/* User pill */
.portal-user-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: 30px; padding: 4px 12px 4px 4px;
  cursor: pointer; transition: all .2s;
}
.portal-user-pill:hover { border-color: var(--p-blue); }
.portal-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--p-blue), var(--p-purple));
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
#portal-username { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* Notification badge */
.notif-btn { position: relative; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  background: var(--p-red); border-radius: 8px;
  font-size: 9px; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* User dropdown */
.user-dropdown {
  position: absolute; top: 50px; right: 0;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 8px;
  min-width: 190px; box-shadow: var(--p-shadow-elevated);
  z-index: 200;
}
.user-dropdown a {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border-radius: 9px; color: var(--text-secondary); text-decoration: none;
  font-size: 13px; cursor: pointer; transition: all .2s;
}
.user-dropdown a:hover { background: var(--bg-hover); color: var(--text-primary); }
.user-dropdown hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.user-dropdown .logout-link { color: var(--p-red); }
.user-dropdown .logout-link:hover { background: rgba(239,68,68,.08); }

/* ── Sidebar nav ────────────────────────────────────────────── */
/* Desktop: horizontal nav strip BELOW header (portal-nav is a sibling of header, not inside it) */
.portal-nav {
  display: flex; align-items: center; gap: 2px;
  flex: 0 0 auto;           /* Never grow — just as tall as nav items need */
  justify-content: center;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  min-height: 48px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.portal-nav-header { display: none; }
.portal-nav-close  { display: none; }

.pnav-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--text-muted);
  padding: 0 8px; white-space: nowrap;
  display: none; /* hidden in top-bar mode */
}

.pnav-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 9px;
  color: var(--text-muted); text-decoration: none;
  font-size: 13px; font-weight: 500;
  transition: all .18s; white-space: nowrap; flex-shrink: 0;
}
.pnav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.pnav-item.active {
  background: linear-gradient(135deg, rgba(59,130,246,.15), rgba(139,92,246,.09));
  color: var(--p-blue); font-weight: 700;
  box-shadow: 0 0 0 1px rgba(59,130,246,.18);
}
.pnav-item i { font-size: 15px; width: 18px; text-align: center; flex-shrink: 0; }

/* Hide labels at medium width, keep icons only */
@media (max-width: 980px) and (min-width: 701px) {
  .pnav-item span { display: none; }
  .pnav-item { padding: 7px 11px; }
}

/* Mobile: slide-in drawer */
#portal-sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 149;
  backdrop-filter: blur(3px);
}
#portal-sidebar-overlay.active { display: block; }

@media (max-width: 700px) {
  .portal-hamburger { display: flex; align-items: center; justify-content: center; }

  .portal-nav {
    position: fixed; top: 0; left: 0;
    width: 268px; height: 100dvh;
    flex-direction: column; align-items: flex-start;
    justify-content: flex-start;
    padding: 0 10px 24px;
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 32px rgba(0,0,0,.35);
    z-index: 150; overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    gap: 2px;
  }
  .portal-nav.mobile-open { transform: translateX(0); }

  .portal-nav-header {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 16px 4px 14px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px; flex-shrink: 0;
  }
  .portal-nav-header > div:last-of-type { flex: 1; }
  .portal-nav-close {
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; color: var(--text-muted);
    font-size: 16px; cursor: pointer; padding: 4px 8px;
    border-radius: 7px; margin-left: auto;
  }
  .portal-nav-close:hover { background: var(--bg-hover); color: var(--text-primary); }

  .pnav-section-label {
    display: block;
    width: 100%; padding: 14px 12px 5px;
    margin-top: 4px;
  }
  .pnav-item { width: 100%; padding: 11px 14px; border-radius: 11px; font-size: 14px; }
  .pnav-item span { display: block; }
  .pnav-item i { font-size: 16px; }
}

/* ── Portal main content ────────────────────────────────────── */
.portal-main {
  flex: 1;
  padding: 32px 36px;
  max-width: 1240px;
  margin: 0 auto;
  width: 100%;
}
@media (max-width: 900px) { .portal-main { padding: 24px 20px; } }
@media (max-width: 600px) { .portal-main { padding: 18px 14px 80px; } }

.portal-section { display: none; }
.portal-section.active { display: block; animation: sectionIn .22s ease; }
@keyframes sectionIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ================================================================
   SECTION HERO
   ================================================================ */
.section-hero {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 28px; flex-wrap: wrap; gap: 16px;
}
.section-hero h2 {
  font-size: 26px; font-weight: 800;
  color: var(--text-primary); margin: 0; line-height: 1.15;
}
.section-hero p  { color: var(--text-muted); font-size: 14px; margin: 6px 0 0; }
#hero-greeting   { font-size: 24px; }

.section-sub-title {
  font-size: 14px; font-weight: 700; letter-spacing: .3px;
  color: var(--text-primary);
  margin: 30px 0 14px; padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}

/* ================================================================
   DASHBOARD STATS
   ================================================================ */
.portal-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px; margin-bottom: 6px;
}
@media (max-width: 900px) { .portal-stats { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px)  { .portal-stats { grid-template-columns: 1fr 1fr; } }

.pstat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--p-radius-card);
  padding: 20px 18px;
  display: flex; align-items: center; gap: 14px;
  transition: transform .2s, box-shadow .2s;
  position: relative; overflow: hidden;
}
.pstat-card::before {
  content: ''; position: absolute; top: 0; left: 0;
  right: 0; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,.4), transparent);
  opacity: 0; transition: opacity .2s;
}
.pstat-card:hover::before { opacity: 1; }
.pstat-card:hover { transform: translateY(-3px); box-shadow: var(--p-shadow-elevated); }

.pstat-icon {
  width: 48px; height: 48px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.pstat-icon.blue   { background: rgba(59,130,246,.12); color: var(--p-blue); }
.pstat-icon.orange { background: rgba(249,115,22,.12);  color: var(--p-orange); }
.pstat-icon.green  { background: rgba(16,185,129,.12);  color: var(--p-green); }
.pstat-icon.purple { background: rgba(139,92,246,.12);  color: var(--p-purple); }

.pstat-val   { font-size: 22px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.pstat-label { font-size: 11px; color: var(--text-muted); margin-top: 3px; font-weight: 500; }

/* ================================================================
   ACTIVE LOAN CARD
   ================================================================ */
.active-loan-card {
  background: linear-gradient(135deg, rgba(59,130,246,.09), rgba(139,92,246,.06));
  border: 1px solid rgba(59,130,246,.2);
  border-radius: var(--p-radius-card);
  padding: 24px 28px;
  box-shadow: 0 4px 20px rgba(59,130,246,.08);
}
.loan-ref-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.loan-ref-row strong { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.loan-amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 500px) { .loan-amounts { grid-template-columns: 1fr 1fr; } }
.loan-amount-item span   { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.loan-amount-item strong { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.loan-progress-bar-wrap  { margin-top: 18px; }
.loan-progress-label     { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); margin-bottom: 7px; }
.loan-progress-bar       { height: 7px; background: var(--bg-secondary); border-radius: 4px; overflow: hidden; }
.loan-progress-fill      { height: 100%; background: linear-gradient(90deg, var(--p-blue), var(--p-purple)); border-radius: 4px; transition: width .6s; }

/* ================================================================
   NEXT PAYMENT CARD
   ================================================================ */
.next-payment-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--p-radius-card);
  padding: 18px 24px;
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap; gap: 14px;
}
.next-payment-info { display: flex; align-items: center; gap: 16px; }
.next-payment-icon {
  width: 48px; height: 48px;
  background: rgba(249,115,22,.12); color: var(--p-orange);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.next-payment-info .amount   { font-size: 24px; font-weight: 800; color: var(--text-primary); }
.next-payment-info .due-date { font-size: 13px; color: var(--text-muted); }
@media (max-width: 600px) { .next-payment-card { flex-direction: column; align-items: flex-start; } }

/* ================================================================
   LOAN PRODUCTS GRID
   ================================================================ */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.product-card {
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: var(--p-radius-card); padding: 22px;
  cursor: pointer; transition: all .22s;
}
.product-card:hover {
  border-color: var(--p-blue);
  transform: translateY(-4px);
  box-shadow: 0 10px 28px rgba(59,130,246,.15);
}
.product-card.selected {
  border-color: var(--p-blue);
  background: rgba(59,130,246,.06);
  box-shadow: 0 0 0 3px rgba(59,130,246,.12);
}
.product-card-icon {
  width: 44px; height: 44px; border-radius: 12px;
  background: rgba(59,130,246,.1); color: var(--p-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 14px;
}
.product-card h4    { font-size: 16px; font-weight: 700; color: var(--text-primary); margin: 0 0 7px; }
.product-card .product-rate { font-size: 26px; font-weight: 800; color: var(--p-blue); }
.product-card .product-rate small { font-size: 13px; font-weight: 500; color: var(--text-muted); }
.product-card .product-range { font-size: 12px; color: var(--text-muted); margin-top: 7px; }
.product-card .product-desc  { font-size: 12px; color: var(--text-muted); margin-top: 9px; line-height: 1.55; }

/* ================================================================
   APPLY CARD + CALC SUMMARY
   ================================================================ */
.apply-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--p-radius-card); padding: 28px;
}
@media (max-width: 600px) { .apply-card { padding: 18px 16px; } }

.calc-summary {
  background: rgba(16,185,129,.06); border: 1px solid rgba(16,185,129,.18);
  border-radius: 13px; padding: 20px; margin-top: 22px;
}
.calc-summary h4 { font-size: 14px; font-weight: 700; color: var(--p-green); margin: 0 0 16px; display: flex; align-items: center; gap: 8px; }
.calc-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 700px) { .calc-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .calc-grid { grid-template-columns: 1fr; } }
.calc-item span   { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.calc-item strong { font-size: 18px; font-weight: 800; color: var(--text-primary); }

.apply-disclaimer {
  background: rgba(249,115,22,.06); border: 1px solid rgba(249,115,22,.15);
  border-radius: 11px; padding: 13px 16px; font-size: 12px; color: var(--text-muted);
  margin-top: 22px; display: flex; gap: 10px; align-items: flex-start; line-height: 1.6;
}
.apply-disclaimer i { color: var(--p-orange); margin-top: 1px; flex-shrink: 0; }

/* ================================================================
   MY LOANS LIST
   ================================================================ */
.loans-list { display: flex; flex-direction: column; gap: 14px; }
.loan-list-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--p-radius-card); padding: 20px 24px;
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; cursor: pointer; transition: all .2s;
}
.loan-list-card:hover {
  border-color: rgba(59,130,246,.35);
  box-shadow: 0 6px 22px rgba(59,130,246,.1);
  transform: translateY(-1px);
}
.loan-list-left  { display: flex; align-items: center; gap: 16px; }
.loan-list-icon  {
  width: 46px; height: 46px; border-radius: 13px;
  background: rgba(59,130,246,.1); color: var(--p-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.loan-list-ref  { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.loan-list-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.loan-list-right { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.loan-list-amount { text-align: right; }
.loan-list-amount .amount { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.loan-list-amount .label  { font-size: 11px; color: var(--text-muted); }
@media (max-width: 600px) {
  .loan-list-card { flex-direction: column; align-items: flex-start; }
  .loan-list-right { width: 100%; justify-content: flex-start; }
}

/* ================================================================
   REPAYMENTS / TABLES
   ================================================================ */
.portal-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--p-radius-card); }
.portal-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  min-width: 480px;
}
.portal-table th {
  padding: 11px 14px; text-align: left;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}
.portal-table th:first-child { border-radius: 10px 0 0 0; }
.portal-table th:last-child  { border-radius: 0 10px 0 0; }
.portal-table td {
  padding: 13px 14px; color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,.035);
}
.portal-table tr:last-child td { border-bottom: none; }
.portal-table tr:hover td { background: var(--bg-hover); }

/* ================================================================
   DOCUMENTS
   ================================================================ */
.docs-grid { display: flex; flex-direction: column; gap: 12px; }
.doc-upload-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px 22px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  transition: border-color .2s;
}
.doc-upload-card:hover { border-color: rgba(59,130,246,.25); }
.doc-icon {
  width: 44px; height: 44px; background: rgba(59,130,246,.1); color: var(--p-blue);
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.doc-info { flex: 1; min-width: 140px; }
.doc-info strong { display: block; font-size: 14px; color: var(--text-primary); }
.doc-info small  { font-size: 12px; color: var(--text-muted); }
.doc-status  { margin-left: auto; }
.upload-btn  { cursor: pointer; }
.doc-view-btn { margin-left: 6px; padding: 3px 10px; font-size: 11px; vertical-align: middle; }
@media (max-width: 700px) {
  .doc-upload-card { gap: 10px; }
  .doc-status  { margin-left: 0; }
}

/* ================================================================
   NOTIFICATIONS
   ================================================================ */
.notif-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 13px; padding: 16px 20px; margin-bottom: 10px;
  display: flex; gap: 14px; align-items: flex-start;
  transition: border-color .2s;
}
.notif-item.unread {
  border-left: 3px solid var(--p-blue);
  background: rgba(59,130,246,.04);
}
.notif-icon {
  width: 38px; height: 38px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; flex-shrink: 0;
}
.notif-icon.blue   { background: rgba(59,130,246,.12); color: var(--p-blue); }
.notif-icon.green  { background: rgba(16,185,129,.12);  color: var(--p-green); }
.notif-icon.orange { background: rgba(249,115,22,.12);  color: var(--p-orange); }
.notif-icon.purple { background: rgba(139,92,246,.12);  color: var(--p-purple); }
.notif-body strong { font-size: 14px; color: var(--text-primary); display: block; }
.notif-body p      { font-size: 13px; color: var(--text-muted); margin: 5px 0 0; }
.notif-time        { font-size: 11px; color: var(--text-muted); margin-top: 5px; display: block; }

/* ================================================================
   PROFILE
   ================================================================ */
.profile-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 700px) { .profile-grid { grid-template-columns: 1fr; } }

.profile-section-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--p-radius-card); padding: 22px;
}
.profile-section-card h4 {
  font-size: 13px; font-weight: 700; color: var(--p-blue);
  margin: 0 0 16px; display: flex; align-items: center; gap: 8px;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
  text-transform: uppercase; letter-spacing: .4px;
}
.profile-row {
  display: flex; justify-content: space-between;
  padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.04);
  font-size: 13px;
}
.profile-row:last-child { border-bottom: none; }
.profile-row span:first-child { color: var(--text-muted); }
.profile-row span:last-child  { color: var(--text-primary); font-weight: 500; text-align: right; }

/* ================================================================
   LOAN DETAIL MODAL BODY
   ================================================================ */
.detail-section { margin-bottom: 26px; }
.detail-section h4 { font-size: 13px; font-weight: 700; color: var(--p-blue); margin: 0 0 14px; text-transform: uppercase; letter-spacing: .4px; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 520px) { .detail-grid { grid-template-columns: repeat(2, 1fr); } }
.detail-item span   { font-size: 11px; color: var(--text-muted); display: block; margin-bottom: 3px; }
.detail-item strong { font-size: 15px; font-weight: 700; color: var(--text-primary); }

/* ================================================================
   LOADING / EMPTY STATES
   ================================================================ */
.loading-spinner {
  text-align: center; padding: 48px;
  color: var(--text-muted); font-size: 14px;
}
.loading-spinner i { margin-right: 8px; }
.empty-state {
  text-align: center; padding: 52px;
  color: var(--text-muted); font-size: 14px; line-height: 2;
}
.empty-state i { font-size: 36px; display: block; margin-bottom: 10px; opacity: .35; }

/* ================================================================
   PAGINATION
   ================================================================ */
.portal-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 22px 0 8px; flex-wrap: wrap;
}
.portal-pagination .page-btn {
  min-width: 36px; height: 36px; padding: 0 10px;
  border-radius: 9px; border: 1px solid var(--border);
  background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .2s;
}
.portal-pagination .page-btn:hover  { background: var(--bg-hover); color: var(--text-primary); }
.portal-pagination .page-btn.active { background: var(--p-blue); color: #fff; border-color: var(--p-blue); }

/* ================================================================
   PASSWORD TOGGLE
   ================================================================ */
.pw-toggle {
  position: absolute; right: 10px;
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 4px; font-size: .85rem; z-index: 2; line-height: 1;
}
.pw-toggle:hover { color: var(--text-primary); }

/* ================================================================
   REPAYMENT SCHEDULE
   ================================================================ */
.schedule-loan-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.schedule-tab {
  padding: 7px 18px; border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text-muted);
  font-size: 13px; font-weight: 500; cursor: pointer; transition: all .18s;
  display: flex; align-items: center; gap: 6px;
}
.schedule-tab.active, .schedule-tab:hover {
  background: var(--p-blue); color: #fff; border-color: var(--p-blue);
}
.schedule-table tbody tr.sched-paid td {
  color: var(--text-muted); text-decoration: line-through;
  text-decoration-color: rgba(16,185,129,.4);
  background: rgba(16,185,129,.04);
}
.schedule-table tbody tr.sched-overdue td {
  background: rgba(239,68,68,.07); color: var(--p-red);
}
.schedule-table tbody tr.sched-next td {
  background: rgba(245,158,11,.07);
  border-top: 2px solid var(--p-orange);
  border-bottom: 2px solid var(--p-orange);
}
.next-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 4px; background: var(--p-orange); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .5px; vertical-align: middle;
}
.badge.sm { font-size: 10px; padding: 2px 7px; }
@media (max-width: 600px) {
  .schedule-table th:nth-child(3), .schedule-table td:nth-child(3),
  .schedule-table th:nth-child(4), .schedule-table td:nth-child(4) { display: none; }
}

/* ================================================================
   BADGE EXTRAS
   ================================================================ */
.badge-rejected  { background: rgba(239,68,68,.12);  color: #ef4444; }
.badge-defaulted { background: rgba(239,68,68,.15);  color: #dc2626; }
.badge-overdue   { background: rgba(239,68,68,.12);  color: #ef4444; }
.badge-completed { background: rgba(59,130,246,.12); color: #3b82f6; }
.badge-suspended { background: rgba(107,114,128,.12);color: #9ca3af; }

/* ================================================================
   CHAT NOTIFY POPUP
   ================================================================ */
.chat-notify-popup {
  display: none; position: fixed;
  bottom: 88px; right: 20px; z-index: 9999;
  max-width: 320px; min-width: 260px;
  cursor: pointer;
  animation: slideUpIn .3s cubic-bezier(.34,1.56,.64,1);
}
.chat-notify-inner {
  display: flex; align-items: flex-start; gap: 12px;
  background: linear-gradient(135deg, #1e293b, #162032);
  border: 1px solid rgba(59,130,246,.35); border-radius: 18px;
  padding: 14px 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.55), 0 0 0 1px rgba(59,130,246,.1), inset 0 1px 0 rgba(255,255,255,.06);
}
.chat-notify-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(59,130,246,.25), rgba(139,92,246,.2));
  border: 1.5px solid rgba(59,130,246,.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; color: #60a5fa; flex-shrink: 0;
  box-shadow: 0 0 14px rgba(59,130,246,.3);
}
.chat-notify-body   { flex: 1; min-width: 0; }
.chat-notify-title  { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 4px; }
.chat-notify-text   { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.chat-notify-action { font-size: 11px; color: #60a5fa; margin-top: 5px; font-weight: 600; }
.chat-notify-close  {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px; color: var(--text-muted); cursor: pointer;
  font-size: 12px; padding: 4px 7px; flex-shrink: 0; transition: all .15s; line-height: 1;
}
.chat-notify-close:hover { background: rgba(239,68,68,.12); color: #ef4444; border-color: rgba(239,68,68,.2); }

@keyframes slideUpIn {
  from { opacity: 0; transform: translateY(18px) scale(.94); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* ================================================================
   DOCUMENT VIEWER MODAL
   ================================================================ */
#modal-doc-viewer {
  display: flex; align-items: center; justify-content: center;
  position: fixed; inset: 0; background: rgba(0,0,0,.78);
  z-index: 9999; opacity: 0; pointer-events: none; transition: opacity .2s;
}
#modal-doc-viewer.active { opacity: 1; pointer-events: all; }
.doc-viewer-modal {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 16px; display: flex; flex-direction: column;
  width: min(92vw, 900px); max-height: 90vh; overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  transform: translateY(12px); transition: transform .2s;
}
#modal-doc-viewer.active .doc-viewer-modal { transform: translateY(0); }
.doc-viewer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border); gap: 12px; flex-shrink: 0;
}
.doc-viewer-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 600; color: var(--text-primary); min-width: 0;
}
.doc-viewer-title i { color: var(--p-blue); font-size: 16px; }
.doc-viewer-title span:first-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 280px; }
.doc-viewer-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.doc-viewer-body {
  flex: 1; overflow: auto; min-height: 200px;
  background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center;
}
.doc-viewer-loading, .doc-viewer-error {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  color: var(--text-muted); font-size: 14px; padding: 40px;
}
.doc-viewer-loading i { font-size: 28px; color: var(--p-blue); }
.doc-viewer-error   i { font-size: 32px; color: var(--p-red); }
.doc-viewer-iframe  { width: 100%; height: 70vh; border: none; display: block; }
.doc-viewer-img-wrap { width: 100%; height: 70vh; display: flex; align-items: center; justify-content: center; padding: 16px; box-sizing: border-box; }
.doc-viewer-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 4px 24px rgba(0,0,0,.4); }
@media (max-width: 600px) {
  .doc-viewer-modal { width: 100vw; max-height: 100vh; border-radius: 0; }
  .doc-viewer-iframe, .doc-viewer-img-wrap { height: 60vh; }
  .doc-viewer-title span:first-of-type { max-width: 160px; }
}

/* ================================================================
   KYC BLOCK (red variant)
   ================================================================ */
#apply-kyc-block {
  background: rgba(239,68,68,.06) !important;
  border-color: rgba(239,68,68,.2) !important;
}
#apply-kyc-block > i { color: var(--p-red) !important; }

/* ================================================================
   RESPONSIVE GLOBAL
   ================================================================ */
@media (max-width: 768px) {
  .section-hero h2 { font-size: 22px; }
  .section-sub-title { font-size: 13px; }
  .form-grid-2 { grid-template-columns: 1fr !important; }
  .profile-grid { grid-template-columns: 1fr !important; }
}
@media (max-width: 480px) {
  .portal-header { padding: 0 12px; }
  .loan-amount-item strong { font-size: 16px; }
}
