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

:root {
  --bg:        #0d0f14;
  --surface:   #151820;
  --surface2:  #1c2030;
  --border:    #252a3a;
  --gold:      #d4a843;
  --gold-dim:  #a07828;
  --text:      #e8eaf2;
  --text-muted:#7a8099;
  --green:     #2ecc8a;
  --red:       #e05555;
  --orange:    #e09255;
  --blue:      #4f8ef7;
  --purple:    #9b59b6;
  --radius:    12px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'DM Sans', sans-serif;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  min-height: 100vh;
  line-height: 1.6;
}

/* ═══════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════ */
.login-screen {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 999;
  animation: fadeIn 0.4s ease;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 44px 40px 36px;
  width: 100%; max-width: 370px;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}

.login-logo svg { display: block; }

.logo-circle {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  display: flex; align-items: center; justify-content: center;
}

.logo-initials {
  font-family: var(--font-head);
  font-weight: 800; font-size: 26px; color: #0d0f14; letter-spacing: 1px;
}
.logo-initials.small { font-size: 14px; }

.login-company {
  font-family: var(--font-head);
  font-size: 12px; font-weight: 800;
  letter-spacing: 4px; text-transform: uppercase;
  color: var(--gold); margin-bottom: -4px;
}

.login-title {
  font-family: var(--font-head);
  font-size: 22px; font-weight: 800; color: var(--text);
}

.login-subtitle { font-size: 13px; color: var(--text-muted); margin-top: -6px; }

/* Role Toggle */
.role-toggle {
  display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: 8px; overflow: hidden; width: 100%;
}
.role-btn {
  flex: 1; padding: 10px;
  background: transparent; border: none;
  color: var(--text-muted); font-family: var(--font-body);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s;
}
.role-btn.active { background: var(--gold); color: #0d0f14; }
.role-btn:not(.active):hover { background: var(--surface2); color: var(--text); }

/* PIN Dots */
.pin-dots { display: flex; gap: 14px; margin: 4px 0; }
.pin-dot {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--border); background: transparent;
  transition: all 0.15s;
}
.pin-dot.filled {
  background: var(--gold); border-color: var(--gold);
  transform: scale(1.1);
}
.pin-error {
  font-size: 13px; color: var(--red); font-weight: 500;
  min-height: 18px; text-align: center;
}

/* PIN Pad */
.pin-pad {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; width: 100%; max-width: 260px;
}
.pin-key {
  aspect-ratio: 1; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text); font-family: var(--font-head);
  font-size: 22px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.pin-key:hover  { background: var(--border); border-color: var(--gold-dim); }
.pin-key:active { transform: scale(0.92); background: var(--gold); color: #0d0f14; }
.pin-key-empty  { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.pin-key-del    { font-size: 18px; }
.login-footer   { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }

/* ═══════════════════════════════════════
   APP LAYOUT
═══════════════════════════════════════ */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: 230px; min-height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0 20px;
  position: sticky; top: 0; height: 100vh;
  flex-shrink: 0;
}

.brand {
  display: flex; align-items: center; justify-content: center;
  padding: 16px 18px 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.brand-logo-wrap {
  width: 36px; height: 36px; border-radius: 9px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--font-head); font-weight: 800;
  font-size: 13px; letter-spacing: 2px; color: var(--text);
  text-transform: uppercase; line-height: 1.2;
}
.brand-sub { font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }

.nav { display: flex; flex-direction: column; gap: 3px; padding: 0 10px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 8px;
  color: var(--text-muted); text-decoration: none;
  font-size: 14px; font-weight: 500; transition: all 0.2s;
}
.nav-item:hover  { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--gold); color: #0d0f14; font-weight: 700; }
.nav-icon { font-size: 15px; }

.sidebar-bottom {
  margin-top: auto; padding: 0 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.role-badge {
  text-align: center; font-size: 11px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold); background: rgba(212,168,67,0.1);
  border: 1px solid rgba(212,168,67,0.2);
  border-radius: 20px; padding: 5px;
}
.btn-lock {
  background: var(--surface2); border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 8px;
  padding: 10px; font-size: 13px; cursor: pointer;
  transition: all 0.2s; width: 100%; text-align: center;
}
.btn-lock:hover { border-color: var(--gold-dim); color: var(--text); }
.sidebar-footer { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; text-align: center; }

/* ── MAIN ── */
.main { flex: 1; padding: 36px 40px; overflow-y: auto; }

.view { display: none; }
.view.active { display: block; animation: fadeIn 0.25s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════
   PAGE HEADER
═══════════════════════════════════════ */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; gap: 16px; flex-wrap: wrap;
}
.page-header h1 {
  font-family: var(--font-head); font-size: 28px; font-weight: 800;
}
.date-badge {
  background: var(--surface2); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 20px;
  font-size: 13px; color: var(--text-muted);
}

/* ═══════════════════════════════════════
   STATS GRID
═══════════════════════════════════════ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 16px;
}

.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
  transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-card.accent  { border-color: var(--gold-dim); }
.stat-card.success { border-color: var(--green); }
.stat-card.danger  { border-color: var(--red); }
.stat-card.purple  { border-color: var(--purple); }

.stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.8px;
  margin-bottom: 8px; font-weight: 500;
}
.stat-value {
  font-family: var(--font-head); font-size: 26px; font-weight: 700;
}
.stat-card.accent  .stat-value { color: var(--gold); }
.stat-card.success .stat-value { color: var(--green); }
.stat-card.danger  .stat-value { color: var(--red); }
.stat-card.purple  .stat-value { color: var(--purple); }

/* ═══════════════════════════════════════
   CHARTS
═══════════════════════════════════════ */
.charts-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 16px; margin-bottom: 36px; margin-top: 16px;
}
.chart-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.chart-title {
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.8px; margin-bottom: 16px;
}
.chart-wrap { height: 200px; position: relative; }

/* ═══════════════════════════════════════
   SECTION TITLE
═══════════════════════════════════════ */
.section-title {
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--text-muted); margin-bottom: 14px;
}

/* ═══════════════════════════════════════
   LOAN CARDS
═══════════════════════════════════════ */
.loan-list { display: flex; flex-direction: column; gap: 10px; }

.loan-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; flex-wrap: wrap; transition: border-color 0.2s;
}
.loan-card:hover { border-color: var(--gold-dim); }

.loan-card-left  { display: flex; flex-direction: column; gap: 3px; }
.loan-card-name  { font-family: var(--font-head); font-size: 15px; font-weight: 700; }
.loan-card-meta  { font-size: 12px; color: var(--text-muted); }
.loan-card-id    { font-size: 11px; color: var(--gold-dim); font-family: monospace; }
.loan-card-right { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.loan-card-amount { font-family: var(--font-head); font-size: 17px; font-weight: 700; color: var(--gold); }
.loan-card-due   { font-size: 12px; color: var(--text-muted); }

/* Overdue escalation */
.loan-card.grace    { border-left: 3px solid var(--orange); }
.loan-card.overdue-mild     { border-left: 3px solid var(--red); }
.loan-card.overdue-critical { border-left: 3px solid var(--red); background: rgba(224,85,85,0.05); }
.loan-card.restructured-card { border-left: 3px solid var(--purple); }

/* ═══════════════════════════════════════
   STATUS BADGES
═══════════════════════════════════════ */
.badge {
  padding: 3px 11px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
.badge-active        { background: rgba(79,142,247,.15);  color: var(--blue); }
.badge-due-soon      { background: rgba(224,146,85,.15);  color: var(--orange); }
.badge-grace         { background: rgba(224,146,85,.25);  color: var(--orange); font-weight: 800; }
.badge-overdue       { background: rgba(224,85,85,.15);   color: var(--red); }
.badge-critical      { background: rgba(224,85,85,.28);   color: #ff6b6b; font-weight: 800; }
.badge-paid          { background: rgba(46,204,138,.15);  color: var(--green); }
.badge-restructured  { background: rgba(155,89,182,.15);  color: var(--purple); }
.badge-collateral    { background: rgba(127,140,141,.15); color: #95a5a6; }

/* ═══════════════════════════════════════
   FORMS
═══════════════════════════════════════ */
.form-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 32px;
  max-width: 820px;
}
.form-section-title {
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--gold); margin-bottom: 18px;
}
.form-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 18px; margin-bottom: 20px;
}
.form-group { display: flex; flex-direction: column; gap: 7px; }
.form-group.full-width { grid-column: 1 / -1; }

label {
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.6px;
}

input, textarea, select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text);
  font-family: var(--font-body); font-size: 14px;
  padding: 11px 14px; transition: border-color 0.2s;
  outline: none; width: 100%;
}
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
textarea { resize: vertical; min-height: 72px; }
input[type="date"]::-webkit-calendar-picker-indicator { filter: invert(0.5); cursor: pointer; }
select option { background: var(--surface2); }

/* Inline input+select */
.input-inline { display: flex; gap: 8px; }
.input-inline input { flex: 1; }
.input-inline select { width: 160px; flex-shrink: 0; }

/* Loan Summary Box */
.loan-summary-box {
  background: var(--surface2); border: 1px solid var(--gold-dim);
  border-radius: 10px; padding: 18px 22px; margin-bottom: 20px;
}
.loan-summary-title {
  font-family: var(--font-head); font-size: 13px; font-weight: 700;
  color: var(--gold); text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 12px;
}
.loan-summary-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.summary-lbl { display: block; font-size: 11px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 4px; }
.summary-val { font-family: var(--font-head); font-size: 18px; font-weight: 700; }
.summary-val.gold { color: var(--gold); }

.form-actions { display: flex; gap: 12px; justify-content: flex-end; }
.form-msg { margin-top: 14px; font-size: 13px; font-weight: 500; min-height: 18px; }
.form-msg.success { color: var(--green); }
.form-msg.error   { color: var(--red); }

/* ═══════════════════════════════════════
   BUTTONS
═══════════════════════════════════════ */
.btn-primary {
  background: var(--gold); color: #0d0f14; border: none;
  border-radius: 8px; padding: 11px 26px;
  font-family: var(--font-head); font-size: 14px; font-weight: 700;
  cursor: pointer; transition: background 0.2s, transform 0.1s;
}
.btn-primary:hover  { background: #e8b84e; }
.btn-primary:active { transform: scale(0.97); }

.btn-secondary {
  background: var(--surface2); color: var(--text-muted);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 22px; font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all 0.2s;
}
.btn-secondary:hover { border-color: var(--text-muted); color: var(--text); }

.btn-danger {
  background: var(--red); color: #fff; border: none;
  border-radius: 8px; padding: 11px 22px;
  font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background 0.2s;
}
.btn-danger:hover { background: #c44; }

.btn-icon {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-muted); border-radius: 6px;
  padding: 5px 10px; font-size: 12px;
  cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-icon:hover { border-color: var(--gold-dim); color: var(--text); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); }

.btn-whatsapp {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(37,211,102,.12);
  border: 1px solid rgba(37,211,102,.3);
  color: #25d366; border-radius: 6px;
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none; transition: all 0.2s;
  white-space: nowrap;
}
.btn-whatsapp:hover { background: rgba(37,211,102,.22); }

/* ═══════════════════════════════════════
   TABLE
═══════════════════════════════════════ */
.table-wrapper {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: auto;
}
.loan-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.loan-table th {
  background: var(--surface2); padding: 13px 15px;
  text-align: left; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-muted); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.loan-table td {
  padding: 13px 15px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.loan-table tr:last-child td { border-bottom: none; }
.loan-table tr:hover td { background: rgba(255,255,255,0.02); }
.loan-table tr.row-grace td:first-child    { border-left: 3px solid var(--orange); }
.loan-table tr.row-overdue td:first-child  { border-left: 3px solid var(--red); }
.loan-table tr.row-critical td { background: rgba(224,85,85,.04); }
.loan-table tr.row-critical td:first-child { border-left: 3px solid var(--red); }
.loan-table tr.row-restructured td:first-child { border-left: 3px solid var(--purple); }

.td-id     { font-family: monospace; font-size: 11px; color: var(--gold-dim); }
.td-name   { font-weight: 600; font-size: 14px; }
.td-amount { font-family: var(--font-head); font-weight: 700; color: var(--gold); }
.td-balance { font-family: var(--font-head); font-weight: 700; }
.td-balance.zero { color: var(--green); }
.td-balance.low  { color: var(--orange); }
.td-balance.high { color: var(--red); }

.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.search-box {
  width: 300px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 14px;
  padding: 9px 14px; outline: none; transition: border-color 0.2s;
}
.search-box:focus { border-color: var(--gold); }

/* ═══════════════════════════════════════
   LOAN COLLECTION
═══════════════════════════════════════ */
.collection-section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
}
.collection-section-header {
  font-family: var(--font-head); font-size: 15px; font-weight: 700;
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
}
.collection-note { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }

.grace-header       { color: var(--orange); }
.overdue-header     { color: var(--red); }
.restructured-header{ color: var(--purple); }

.collection-count {
  font-size: 12px; padding: 2px 9px; border-radius: 20px;
  background: rgba(224,146,85,.15); color: var(--orange);
}
.danger-count { background: rgba(224,85,85,.15); color: var(--red); }
.purple-count { background: rgba(155,89,182,.15); color: var(--purple); }

.grace-days {
  font-size: 12px; color: var(--orange); font-weight: 600;
  background: rgba(224,146,85,.1); border-radius: 6px;
  padding: 3px 10px; white-space: nowrap;
}
.overdue-days {
  font-size: 12px; color: var(--red); font-weight: 600;
  background: rgba(224,85,85,.1); border-radius: 6px;
  padding: 3px 10px; white-space: nowrap;
}
.collateral-info {
  font-size: 12px; color: var(--text-muted);
  background: var(--surface2); border-radius: 6px;
  padding: 6px 12px; margin-top: 6px; font-style: italic;
}

/* ═══════════════════════════════════════
   CUSTOMERS
═══════════════════════════════════════ */
.customer-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 18px 22px;
  margin-bottom: 12px;
}
.customer-header {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 14px;
}
.customer-name  { font-family: var(--font-head); font-size: 17px; font-weight: 700; }
.customer-meta  { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.customer-score {
  font-weight: 700; font-size: 13px;
  padding: 4px 12px; border-radius: 20px;
}
.score-reliable { background: rgba(46,204,138,.15); color: var(--green); }
.score-active   { background: rgba(79,142,247,.15);  color: var(--blue); }
.score-risk     { background: rgba(224,85,85,.15);   color: var(--red); }
.customer-stats {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
}
.customer-stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.customer-stat-value { font-family: var(--font-head); font-size: 17px; font-weight: 700; margin-top: 3px; }

/* ═══════════════════════════════════════
   SETTINGS
═══════════════════════════════════════ */
.settings-card { max-width: 480px; margin-bottom: 20px; }
.settings-card-title {
  font-family: var(--font-head); font-size: 16px; font-weight: 700;
  margin-bottom: 6px;
}
.settings-desc { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.settings-card .form-group { margin-bottom: 14px; }

/* ═══════════════════════════════════════
   MODALS
═══════════════════════════════════════ */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  z-index: 100; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 30px;
  max-width: 440px; width: 100%;
}
.modal-wide { max-width: 560px; }
.modal-title { font-family: var(--font-head); font-size: 19px; font-weight: 700; margin-bottom: 10px; }
.modal-body  { color: var(--text-muted); font-size: 14px; margin-bottom: 22px; }
.modal-loan-info { background: var(--surface2); border-radius: 8px; padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 22px; }

/* Daily Summary */
.summary-content { display: flex; flex-direction: column; gap: 10px; }
.summary-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface2);
  border-radius: 8px; border: 1px solid var(--border);
}
.summary-row-label { font-size: 13px; color: var(--text-muted); }
.summary-row-value { font-family: var(--font-head); font-size: 15px; font-weight: 700; }
.summary-row-value.warn   { color: var(--orange); }
.summary-row-value.danger { color: var(--red); }
.summary-row-value.good   { color: var(--green); }
.summary-names { font-size: 12px; color: var(--text-muted); padding: 6px 16px 10px; line-height: 1.9; }

/* Progress bar */
.progress-bar-wrap {
  height: 3px; background: var(--border);
  border-radius: 4px; margin-top: 5px; overflow: hidden;
}
.progress-bar-fill { height: 100%; background: var(--green); border-radius: 4px; transition: width 0.4s ease; }

/* Empty state */
.empty-state { text-align: center; color: var(--text-muted); font-size: 14px; padding: 36px; }

/* ═══════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════ */
@media (max-width: 900px) {
  .stats-grid      { grid-template-columns: 1fr 1fr; }
  .charts-grid     { grid-template-columns: 1fr; }
  .customer-stats  { grid-template-columns: 1fr 1fr; }
  .loan-summary-grid { grid-template-columns: 1fr; gap: 10px; }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main    { padding: 20px 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .search-box { width: 100%; }
  .input-inline { flex-direction: column; }
  .input-inline select { width: 100%; }
}

/* ═══════════════════════════════════════
   STATISTICS VIEW
═══════════════════════════════════════ */
.stats-section-title {
  font-family: var(--font-head);
  font-size: 13px; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 14px; margin-top: 8px;
}

.stats-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
  font-weight: 400;
}

/* Aging Buckets */
.aging-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 8px;
}

.aging-title {
  font-family: var(--font-head);
  font-size: 13px; font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 1px; text-transform: uppercase;
  margin-bottom: 16px;
}

.aging-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aging-bucket {
  display: grid;
  grid-template-columns: 110px 1fr 220px;
  align-items: center;
  gap: 14px;
}

.aging-bucket-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.aging-bucket-bar-wrap {
  background: var(--surface2);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
}

.aging-bucket-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
  min-width: 2px;
}

.aging-bucket-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.aging-count {
  font-size: 12px;
  color: var(--text-muted);
}

.aging-amount {
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 900px) {
  .stats-grid-4 { grid-template-columns: 1fr 1fr; }
  .aging-bucket { grid-template-columns: 90px 1fr; }
  .aging-bucket-stats { grid-column: 1 / -1; }
}
