/* ===================== RESET & BASE ===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  min-height: 100vh;
  font-size: 14px;
}

/* ===================== HEADER ===================== */
.app-header {
  background: linear-gradient(135deg, #0f2244 0%, #1b3d7b 100%);
  color: #fff;
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(79,70,229,.35);
}
.header-inner { max-width: 1300px; margin: 0 auto; padding: 20px 32px 18px; }

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

.app-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.btn-add-loan {
  background: #fff;
  color: #1d4ed8;
  border: none;
  padding: 10px 22px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all .18s;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
}
.btn-add-loan:hover { background: #dbeafe; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,.15); }

/* User bar (username + sign-out) */
/* ===================== SUMMARY STRIP ===================== */
/* Summary strip — two-row layout */
.summary-strip {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 10px 20px;
  backdrop-filter: blur(8px);
}
.sum-row {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 6px 0;
}
.sum-divider {
  height: 1px;
  background: rgba(255,255,255,.2);
  margin: 0 4px;
}
.sum-row-cur {
  width: 72px;
  flex-shrink: 0;
}
.sum-cur-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .4px;
  white-space: nowrap;
}
.sum-cur-badge.inr { background: rgba(255,220,120,.25); color: #fde68a; }
.sum-cur-badge.sgd { background: rgba(110,231,183,.25); color: #6ee7b7; }
.sum-item { flex: 1; text-align: center; }
.sum-val { font-size: 16px; font-weight: 700; line-height: 1.2; }
.sum-val.green { color: #6ee7b7; }
.sum-val.orange { color: #fcd34d; }
.sum-lbl { font-size: 9px; opacity: .75; text-transform: uppercase; letter-spacing: .6px; margin-top: 2px; }
.sum-sep { width: 1px; height: 28px; background: rgba(255,255,255,.2); margin: 0 4px; flex-shrink: 0; }

/* ===================== MAIN ===================== */
.main-content { max-width: 1300px; margin: 0 auto; padding: 28px 32px; }

/* ===================== EMPTY STATE ===================== */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: #94a3b8;
}
.empty-emoji { font-size: 56px; margin-bottom: 14px; }
.empty-title { font-size: 20px; font-weight: 600; color: #64748b; margin-bottom: 8px; }
.empty-desc { font-size: 14px; }

/* ===================== LOANS GRID ===================== */
.loans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(500px, 1fr));
  gap: 22px;
}

/* ===================== LOAN CARD ===================== */
.loan-card {
  background: #fff;
  border-radius: 16px;
  padding: 22px 24px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
  transition: box-shadow .2s, transform .2s;
}
.loan-card:hover { box-shadow: 0 6px 28px rgba(0,0,0,.11); transform: translateY(-1px); }

/* Card header */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}
.card-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.loan-name {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  word-break: break-word;
}
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .6px;
  white-space: nowrap;
}
.badge-emi { background: #dbeafe; color: #1d4ed8; }
.badge-flex { background: #e0f2fe; color: #0369a1; }

.card-hdr-btns { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Buttons inside card */
.btn-edit-loan {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 5px 7px;
  border-radius: 8px;
  color: #cbd5e1;
  transition: all .18s;
  line-height: 1;
}
.btn-edit-loan:hover { background: #eff6ff; color: #2563eb; }

.btn-del-loan {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  padding: 5px 7px;
  border-radius: 8px;
  color: #cbd5e1;
  transition: all .18s;
  line-height: 1;
}
.btn-del-loan:hover { background: #fee2e2; color: #ef4444; }

.btn-add-pay {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .18s;
}
.btn-add-pay:hover { background: #dbeafe; border-color: #93c5fd; }

/* Stats row */
.card-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.cs-item {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
  text-align: center;
}
.cs-val {
  font-size: 15px;
  font-weight: 800;
  color: #1e293b;
  line-height: 1.3;
  word-break: break-all;
}
.cs-val.blue { color: #2563eb; }
.cs-val.green { color: #059669; }
.cs-val.red { color: #dc2626; }
.cs-lbl {
  font-size: 9.5px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 3px;
}

/* Progress */
.progress-wrap { margin-bottom: 16px; }
.prog-bar {
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 5px;
}
.prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #34d399);
  border-radius: 4px;
  transition: width .4s ease;
}
.prog-label { font-size: 11px; color: #64748b; }

/* Section header */
.section-hdr {
  font-size: 10.5px;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 10px;
}

/* ===================== MONTHS GRID (EMI) ===================== */
.months-section { border-top: 1px solid #f1f5f9; padding-top: 14px; }

/* Collapsed state — hide the grid */
.months-section.collapsed .months-grid { display: none; }
.months-section.collapsed { padding-bottom: 2px; }

/* Clickable header row */
.months-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  padding: 4px 8px;
  margin: -4px -8px 10px;
  border-radius: 7px;
  transition: background .15s;
}
.months-toggle:hover { background: #f1f5f9; }
.months-section.collapsed .months-toggle { margin-bottom: 0; }

.toggle-chevron {
  font-size: 10px;
  font-weight: 700;
  color: #94a3b8;
  white-space: nowrap;
  margin-left: 8px;
}

.months-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 230px;
  overflow-y: auto;
  padding-right: 4px;
}
.months-grid::-webkit-scrollbar { width: 4px; }
.months-grid::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.months-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.month-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 54px;
  border-radius: 10px;
  border: 1.5px solid #e2e8f0;
  cursor: pointer;
  position: relative;
  transition: all .18s;
  background: #fff;
  user-select: none;
}
.month-cell:hover { border-color: #93c5fd; background: #eff6ff; }
.month-cell.paid { background: #f0fdf4; border-color: #86efac; }
.month-cell.paid:hover { background: #dcfce7; }

/* Hide actual checkbox visually, cover full cell for click */
.month-cell input[type="checkbox"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  margin: 0;
}

.mc-num {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  line-height: 1;
}
.month-cell.paid .mc-num { color: #16a34a; }

.mc-icon {
  font-size: 16px;
  line-height: 1;
  margin-top: 3px;
  color: #cbd5e1;
}
.month-cell.paid .mc-icon { color: #22c55e; }

/* ===================== PAYMENTS LIST (FLEX) ===================== */
.payments-section { border-top: 1px solid #f1f5f9; padding-top: 14px; }

.payments-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}
.payments-list::-webkit-scrollbar { width: 4px; }
.payments-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.pay-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 12px;
  border-radius: 9px;
  background: #f8fafc;
  transition: background .15s;
}
.pay-row:hover { background: #f1f5f9; }

.pay-left { display: flex; flex-direction: column; gap: 2px; }
.pay-date { font-size: 12px; color: #64748b; font-weight: 600; }
.pay-note { font-size: 11px; color: #94a3b8; }

.pay-right { display: flex; align-items: center; gap: 10px; }
.pay-amt { font-size: 14px; font-weight: 800; color: #dc2626; }

.btn-del-pay {
  background: none;
  border: none;
  cursor: pointer;
  color: #cbd5e1;
  font-size: 11px;
  padding: 3px 6px;
  border-radius: 5px;
  transition: all .15s;
  line-height: 1;
}
.btn-del-pay:hover { background: #fee2e2; color: #ef4444; }

.no-records { font-size: 12px; color: #cbd5e1; text-align: center; padding: 14px; }

/* ===================== MODAL ===================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(3px);
}
.modal-overlay.hidden { display: none; }

.modal-box {
  background: #fff;
  border-radius: 18px;
  padding: 30px 28px 26px;
  width: 440px;
  max-width: 94vw;
  box-shadow: 0 24px 64px rgba(0,0,0,.22);
}

.modal-title {
  font-size: 18px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 6px;
}
.modal-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 18px;
  font-weight: 600;
}
.modal-title + .modal-subtitle { margin-top: 4px; }

/* Loan type tabs */
.type-selector {
  display: flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}
.type-tab {
  flex: 1;
  padding: 9px 8px;
  border: none;
  background: none;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: #64748b;
  transition: all .18s;
}
.type-tab.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* Form */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
}
.optional { font-weight: 400; color: #9ca3af; font-size: 11px; }

.form-input {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 14px;
  color: #1e293b;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
  background: #fff;
}
.form-input:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.18); }

.hint {
  font-size: 11px;
  color: #9ca3af;
  margin-top: 4px;
}

.error-msg {
  font-size: 13px;
  color: #dc2626;
  margin-bottom: 12px;
  padding: 10px 12px;
  background: #fee2e2;
  border-radius: 8px;
  border-left: 3px solid #dc2626;
  display: none;
}
.error-msg.visible { display: block; }

.input-wrap { position: relative; }
.input-pfx {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #64748b;
  font-weight: 700;
  font-size: 14px;
  pointer-events: none;
}
.form-input.pfx { padding-left: 26px; }

/* EMI preview */
.emi-calc-preview {
  font-size: 12.5px;
  color: #1d4ed8;
  font-weight: 700;
  min-height: 18px;
  margin-top: 6px;
  padding: 6px 12px;
  background: #eff6ff;
  border-radius: 7px;
  display: none;
}
.emi-calc-preview.visible { display: block; }

/* Balance hint */
.balance-hint {
  font-size: 11.5px;
  color: #64748b;
  margin-top: 5px;
}

/* Modal footer */
.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}
.btn-cancel {
  padding: 10px 22px;
  border: 1.5px solid #e2e8f0;
  background: #fff;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: #64748b;
  transition: all .18s;
}
.btn-cancel:hover { background: #f8fafc; border-color: #cbd5e1; }
.btn-save {
  padding: 10px 26px;
  border: none;
  background: #1d4ed8;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  transition: all .18s;
}
.btn-save:hover { background: #1e40af; box-shadow: 0 3px 12px rgba(29,78,216,.4); }

/* ===================== UTILITY ===================== */
.hidden { display: none !important; }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .header-inner { padding: 16px 20px 14px; }
  .main-content { padding: 18px 20px; }
  .loans-grid { grid-template-columns: 1fr; }
  .summary-strip { padding: 8px 12px; }
  .sum-row-cur { width: 56px; }
  .sum-sep { display: none; }
  .sum-item { min-width: 60px; }
  .dashboard { grid-template-columns: 1fr; }
  .header-controls { gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
}

/* ===================== HEADER LAYOUT ===================== */
.header-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===================== ACCOUNT MENU ===================== */
.account-menu {
  position: relative;
}

.account-trigger {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: 1px solid rgba(255,255,255,.3);
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s;
  white-space: nowrap;
  display: inline-block;
  text-decoration: none;
}
.account-trigger:hover { background: rgba(255,255,255,.28); }
.account-trigger:focus { outline: none; background: rgba(255,255,255,.28); }

.account-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-top: 8px;
  min-width: 200px;
  box-shadow: 0 10px 25px rgba(0,0,0,.12);
  z-index: 1000;
  overflow: hidden;
}
.account-dropdown.hidden { display: none; }

.menu-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: none;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
  transition: background .12s;
}
.menu-item:hover { background: #f3f4f6; }
.menu-item.logout {
  border-top: 1px solid #e5e7eb;
  color: #dc2626;
}
.menu-item.logout:hover { background: #fee2e2; }

/* ===================== CURRENCY TABS ===================== */
.currency-tabs {
  display: flex;
  background: rgba(255,255,255,.15);
  border-radius: 10px;
  padding: 3px;
  gap: 3px;
  backdrop-filter: blur(6px);
}
.currency-tab {
  padding: 7px 16px;
  border: none;
  background: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  color: rgba(255,255,255,.75);
  transition: all .18s;
  letter-spacing: .2px;
}
.currency-tab:hover { color: #fff; background: rgba(255,255,255,.12); }
.currency-tab.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 6px rgba(0,0,0,.15);
}

/* ===================== CURRENCY BADGE ===================== */
.badge-cur { font-size: 9px; font-weight: 900; letter-spacing: .8px; }
.badge-cur-inr { background: #fef3c7; color: #92400e; }
.badge-cur-sgd { background: #dcfce7; color: #166534; }

/* ===================== CURRENCY HINT (in modal) ===================== */
.currency-hint {
  font-size: 11px;
  font-weight: 500;
  color: #9ca3af;
  margin-left: 4px;
}

/* ===================== DASHBOARD / CHARTS ===================== */
.dashboard {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: #fff;
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.04);
}

.chart-title {
  font-size: 12px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-bottom: 14px;
}

.chart-wrap-donut {
  position: relative;
  width: 100%;
  max-width: 220px;
  margin: 0 auto;
}

.chart-wrap-bar {
  position: relative;
  width: 100%;
  min-height: 200px;
  overflow: hidden;
}

/* ===================== MONTH CELL — month/year labels ===================== */
.mc-month {
  font-size: 10px;
  font-weight: 700;
  color: #64748b;
  line-height: 1;
}
.mc-year {
  font-size: 9px;
  font-weight: 600;
  color: #94a3b8;
  line-height: 1;
  margin-top: 1px;
}
.month-cell.paid .mc-month { color: #16a34a; }
.month-cell.paid .mc-year  { color: #4ade80; }
/* widen cells slightly for month+year text */
.month-cell { width: 60px; height: 60px; }

/* ===================== EXPIRY BADGE (in flex card) ===================== */
.expiry-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-weight: 500;
}
.expiry-badge-ok      { background: #f0fdf4; color: #166534; }
.expiry-badge-warning { background: #fffbeb; color: #92400e; }
.expiry-badge-urgent  { background: #fff1f2; color: #9f1239; }
.expiry-badge-expired { background: #fef2f2; color: #7f1d1d; border: 1px solid #fecaca; }

/* ===================== EXPIRY REPORT ===================== */
.expiry-report {
  background: #fff;
  border-radius: 16px;
  padding: 20px 24px;
  box-shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 16px rgba(0,0,0,.04);
  margin-bottom: 24px;
}
.expiry-report-hdr {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 14px;
  font-weight: 800;
  color: #0f172a;
}
.expiry-report-sub {
  font-size: 11.5px;
  color: #94a3b8;
  font-weight: 400;
}

/* Report table rows */
.er-header, .er-row {
  display: grid;
  grid-template-columns: 1fr 70px 130px 140px 100px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
}
.er-header {
  font-size: 10px;
  font-weight: 800;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: .6px;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 0;
  margin-bottom: 4px;
}
.er-row { transition: background .15s; }
.er-row:hover { background: #f8fafc; }
.er-row-expired { background: #fef2f2; }
.er-row-urgent  { background: #fff7f7; }
.er-row-warning { background: #fffdf0; }
.er-name  { font-size: 13px; font-weight: 700; color: #0f172a; }
.er-cur   { }
.er-balance { font-size: 13px; font-weight: 700; color: #dc2626; }
.er-date  { font-size: 12px; color: #475569; }

/* Urgency pills */
.urgency-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.urgency-expired { background: #fee2e2; color: #991b1b; }
.urgency-urgent  { background: #fee2e2; color: #b91c1c; }
.urgency-warning { background: #fef3c7; color: #92400e; }
.urgency-ok      { background: #dcfce7; color: #166534; }
.urgency-none    { background: #f1f5f9; color: #64748b; }



/* ===================== REPORTS MODAL ===================== */
.reports-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.6);
  z-index: 600;
  display: flex;
  align-items: stretch;
  justify-content: flex-end;
  backdrop-filter: blur(3px);
}
.reports-overlay.hidden { display: none; }

.reports-panel {
  background: #f1f5f9;
  width: min(860px, 100vw);
  height: 100vh;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,.18);
  overflow: hidden;
}

.reports-hdr {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
  background: linear-gradient(135deg, #0f2244, #1b3d7b);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  flex-shrink: 0;
}

.close-reports-btn {
  background: rgba(255,255,255,.15);
  color: #fff;
  border: none;
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.close-reports-btn:hover { background: rgba(255,255,255,.28); }

.reports-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ── Report section card ── */
.rpt-section {
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
}
.rpt-title {
  font-size: 13px;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.rpt-sub { font-size: 11px; color: #94a3b8; font-weight: 400; }
.rpt-empty { font-size: 13px; color: #94a3b8; text-align: center; padding: 16px; }

/* ── Scrollable table wrapper ── */
.rpt-scroll { overflow-x: auto; }
.rpt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  white-space: nowrap;
}
.rpt-table th {
  background: #f8fafc;
  font-size: 10px;
  font-weight: 800;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
}
.rpt-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #1e293b;
  vertical-align: middle;
}
.rpt-table tr:last-child td { border-bottom: none; }
.rpt-table tr:hover td { background: #f8fafc; }
.rpt-overdue-row td { background: #fff5f5; }

/* Mini progress bar in table */
.rpt-bar-wrap {
  height: 5px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  width: 80px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.rpt-bar-fill { height: 100%; background: linear-gradient(90deg,#10b981,#34d399); border-radius: 3px; }
.rpt-pct { font-size: 11px; color: #64748b; font-weight: 700; }

/* ── Monthly commitment ── */
.commit-grid { display: flex; gap: 16px; flex-wrap: wrap; }
.commit-card {
  flex: 1;
  min-width: 200px;
  background: #f8fafc;
  border-radius: 12px;
  padding: 16px 18px;
  border: 1.5px solid #e2e8f0;
}
.commit-cur { margin-bottom: 8px; }
.commit-amount { font-size: 22px; font-weight: 800; color: #0f172a; }
.commit-mo { font-size: 13px; font-weight: 400; color: #64748b; }
.commit-detail { font-size: 11.5px; color: #64748b; margin-top: 4px; }
.commit-loans { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.commit-tag {
  background: #e2e8f0;
  color: #334155;
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  white-space: nowrap;
}

/* ── Schedule status pill ── */
.sched-pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.sched-ahead   { background: #dcfce7; color: #166534; }
.sched-behind  { background: #fee2e2; color: #991b1b; }
.sched-ontrack { background: #dbeafe; color: #1e40af; }

/* ── Insights ── */
.insights-list { display: flex; flex-direction: column; gap: 8px; }
.insight {
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 9px;
  border-left: 4px solid transparent;
}
.insight.ok   { background: #f0fdf4; border-color: #22c55e; color: #166534; }
.insight.warn { background: #fffbeb; border-color: #f59e0b; color: #92400e; }
.insight.red  { background: #fef2f2; border-color: #ef4444; color: #991b1b; }

/* ===================== MOBILE FIXES ===================== */
/* Placed last so these win the cascade over same-specificity rules
   defined further up (the 900px block earlier in this file loses to
   .dashboard/.header-controls/.currency-tabs since those come after it). */
@media (max-width: 900px) {
  .dashboard { grid-template-columns: 1fr; }
  .chart-card-wide { min-width: 0; }
}

@media (max-width: 600px) {
  .sum-row { flex-wrap: wrap; row-gap: 6px; }
  .sum-row-cur { width: auto; margin-right: 8px; }
  .sum-item { flex: 1 1 42%; min-width: 42%; text-align: left; }
  .sum-val { word-break: break-word; }
}
.insight.info { background: #eff6ff; border-color: #3b82f6; color: #1e40af; }
