/* ─── CSS Variables ─── */
:root {
  --navy: #1a1a2e;
  --navy-mid: #16213e;
  --navy-light: #0f3460;
  --gold: #c9a227;
  --gold-hover: #e0b733;
  --bg: #0e0e1a;
  --surface: #1a1a2e;
  --surface2: #1e2240;
  --border: rgba(255,255,255,0.1);
  --text: #f0f0f0;
  --muted: #8899aa;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --radius: 14px;
  --radius-sm: 8px;
}

/* ─── Base ─── */
html, body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  min-height: 100vh;
}

/* ─── Navbar ─── */
.navbar {
  background: var(--navy) !important;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
}

.brand-icon {
  width: 32px;
  height: 32px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 16px;
}

.text-gold { color: var(--gold) !important; }

.btn-outline-gold {
  color: var(--gold);
  border-color: var(--gold);
  font-weight: 600;
}
.btn-outline-gold:hover {
  background: var(--gold);
  color: var(--navy);
}

/* ─── Layout ─── */
.container-narrow {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

/* ─── Cards ─── */
.card {
  border-radius: var(--radius);
  border: none;
}

.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
}

/* ─── Section Titles ─── */
.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
  margin-bottom: 20px;
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.section-title-sm {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 0;
}

.required { color: var(--gold); }

/* ─── Form Inputs ─── */
.form-control, .form-select {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.95rem;
}
.form-control::placeholder { color: #556; }
.form-control:focus, .form-select:focus {
  background: var(--navy-mid);
  color: var(--text);
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,162,39,0.15);
  outline: none;
}
.form-control.is-invalid { border-color: var(--danger); }
.invalid-feedback { color: var(--danger); }
.form-text { color: var(--muted); font-size: 0.8rem; }
.form-label { font-size: 0.9rem; font-weight: 500; margin-bottom: 6px; color: var(--text); }

.input-group-text {
  background: var(--navy-light);
  border-color: var(--border);
  color: var(--gold);
  font-weight: 600;
}

/* ─── Loan Calc ─── */
.loan-calc-box {
  background: rgba(201,162,39,0.08);
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.calc-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px; }
.calc-val { font-size: 1.15rem; font-weight: 700; color: var(--gold); }

/* ─── Upload Options ─── */
.upload-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.upload-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 110px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: var(--navy-mid);
  padding: 16px 12px;
  text-align: center;
  color: var(--muted);
}
.upload-option:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(201,162,39,0.06);
}

.upload-option-title { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.upload-option:hover .upload-option-title { color: var(--gold); }
.upload-option-sub { font-size: 0.75rem; color: var(--muted); }

.upload-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  padding: 12px;
  border: 2px solid rgba(201,162,39,0.4);
  border-radius: var(--radius);
  background: rgba(201,162,39,0.05);
}
.upload-preview img {
  width: 72px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.preview-info { flex: 1; min-width: 0; }
.preview-name { font-size: 0.85rem; }
.preview-filename { font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── NRC Two-Sides ─── */
.nrc-two-sides {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.nrc-side {
  flex: 1;
  min-width: 140px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px 12px;
  background: var(--navy-mid);
  transition: border-color 0.2s, background 0.2s;
}
.nrc-side.captured {
  border-color: rgba(201,162,39,0.45);
  border-style: solid;
  background: rgba(201,162,39,0.04);
}
.nrc-side-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  margin-bottom: 10px;
  text-align: center;
}
.nrc-side .upload-grid { gap: 8px; }
.nrc-side .upload-option { min-height: 72px; padding: 10px 8px; }
.nrc-side .upload-option-title { font-size: 0.8rem; }
.nrc-side .upload-option-sub { font-size: 0.7rem; }
.nrc-side-preview {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.nrc-side-preview img {
  width: 100%;
  max-height: 96px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ─── Signature ─── */
.signature-wrapper {
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: white;
  overflow: hidden;
  height: 180px;
}
.signature-wrapper canvas {
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}
.sig-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #bbb;
  font-size: 0.9rem;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.2s;
}

/* ─── Consent ─── */
.consent-box {
  background: var(--navy-mid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.form-check-input {
  background-color: var(--navy-light);
  border-color: var(--muted);
  width: 18px;
  height: 18px;
  margin-top: 2px;
  flex-shrink: 0;
}
.form-check-input:checked {
  background-color: var(--gold);
  border-color: var(--gold);
}
.form-check-label { padding-left: 4px; line-height: 1.5; color: var(--text); }

/* ─── Buttons ─── */
.btn-gold {
  background: var(--gold);
  color: var(--navy);
  border: none;
  font-weight: 700;
  transition: background 0.2s ease, transform 0.1s ease;
}
.btn-gold:hover { background: var(--gold-hover); color: var(--navy); }
.btn-gold:active { transform: scale(0.98); }

.btn-ghost-muted {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
}
.btn-ghost-muted:hover { color: var(--danger); border-color: var(--danger); }

/* ─── Success Page ─── */
.success-icon {
  width: 96px;
  height: 96px;
  background: rgba(201,162,39,0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

/* ─── Admin Stats ─── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  text-align: center;
}
.stat-card.stat-active { border-left: 3px solid #3b82f6; }
.stat-card.stat-overdue { border-left: 3px solid var(--danger); }
.stat-card.stat-done { border-left: 3px solid var(--success); }
.stat-label { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); }

/* ─── Filter Tabs ─── */
.filter-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.filter-tab {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.15s ease;
}
.filter-tab:hover { border-color: var(--gold); color: var(--gold); }
.filter-tab.active { background: var(--gold); color: var(--navy); border-color: var(--gold); font-weight: 700; }

/* ─── Loan Cards ─── */
.loan-card-link { text-decoration: none; }
.loan-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  transition: border-color 0.15s ease, transform 0.1s ease;
  cursor: pointer;
}
.loan-card:hover {
  border-color: var(--gold);
  transform: translateY(-2px);
}

/* ─── Loan Detail ─── */
.detail-highlight {
  background: rgba(201,162,39,0.08);
  border-left: 4px solid var(--gold);
  border-radius: 4px;
  padding: 12px 16px;
}
.detail-amount { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.border-color { border-color: var(--border) !important; }

/* ─── Alerts ─── */
.alert {
  font-size: 0.88rem;
  border-radius: var(--radius-sm);
}
.alert-info { background: rgba(59,130,246,0.15); color: #93c5fd; border-color: rgba(59,130,246,0.3); }
.alert-success { background: rgba(34,197,94,0.15); color: #86efac; border-color: rgba(34,197,94,0.3); }
.alert-danger { background: rgba(239,68,68,0.15); color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.alert-warning { background: rgba(245,158,11,0.15); color: #fcd34d; border-color: rgba(245,158,11,0.3); }

/* ─── Badges ─── */
.badge { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.05em; }

/* ─── List Group ─── */
.list-group-item { color: var(--text); }

/* ─── Footer ─── */
footer { border-top: 1px solid var(--border); }
footer .text-muted { color: #556 !important; }

/* ─── User Avatars ─── */
.user-avatar {
  width: 36px;
  height: 36px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.user-avatar-sm {
  width: 24px;
  height: 24px;
  background: var(--gold);
  color: var(--navy);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.7rem;
  flex-shrink: 0;
}

/* Dropdown */
.dropdown-menu { border-radius: var(--radius-sm); }
.dropdown-item:hover { background: rgba(255,255,255,0.06); }
.dropdown-item { color: var(--text); transition: background 0.1s; }

/* ─── Responsive ─── */
@media (max-width: 576px) {
  .container-narrow { padding: 0 12px; }
  .upload-option { min-height: 90px; }
  .signature-wrapper { height: 150px; }
}
