/* ============================================================
   Wealth Helper — Main Stylesheet
   Dark Navy + Gold Design System
   ============================================================ */

/* --- Google Font Import (Sarabun) --- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700;800&display=swap');

/* --- CSS Variables --- */
:root {
  --bg-primary:    #0b1120;
  --bg-secondary:  #111827;
  --bg-card:       #1a2235;
  --bg-card-hover: #1e2a42;
  --bg-input:      #0f1a2e;
  --sidebar-bg:    #080e1d;
  --sidebar-width: 260px;

  --gold:          #f5a623;
  --gold-dark:     #d4891a;
  --gold-light:    #ffc04d;
  --gold-glow:     rgba(245,166,35,0.15);

  --accent:        #3b82f6;
  --accent-dark:   #2563eb;
  --accent-light:  #60a5fa;

  --success:       #10b981;
  --warning:       #f59e0b;
  --danger:        #ef4444;
  --danger-dark:   #dc2626;

  --text-primary:  #f1f5f9;
  --text-secondary:#94a3b8;
  --text-muted:    #64748b;

  --border:        rgba(255,255,255,0.06);
  --border-active: rgba(245,166,35,0.4);

  --radius-sm:     6px;
  --radius:        12px;
  --radius-lg:     18px;
  --radius-xl:     24px;

  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow-lg:     0 8px 40px rgba(0,0,0,0.5);
  --shadow-gold:   0 4px 24px rgba(245,166,35,0.2);

  --transition:    0.2s ease;
  --transition-lg: 0.35s cubic-bezier(.4,0,.2,1);

  --topbar-h:      64px;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Sarabun', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 100;
  transition: transform var(--transition-lg);
  overflow-y: auto;
}

.sidebar-header {
  padding: 1.5rem 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.logo-icon {
  width: 40px; height: 40px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(245,166,35,0.4));
}

.logo-icon svg { width: 100%; height: 100%; }

.logo-name {
  display: block;
  font-size: 1.05rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

.logo-sub {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 0.5rem;
  margin: 0.5rem 0 0.25rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.875rem;
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(245,166,35,0.15), rgba(245,166,35,0.05));
  color: var(--gold);
  border: 1px solid rgba(245,166,35,0.2);
}

.nav-item.active .nav-icon { color: var(--gold); }

.nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0;
  transition: color var(--transition);
}

.nav-badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.danger { background: var(--danger); }

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

.version-info {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
}

/* ============================================================
   MAIN CONTENT
   ============================================================ */
.main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin var(--transition-lg);
}

/* Topbar */
.topbar {
  height: var(--topbar-h);
  background: rgba(11,17,32,0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 50;
}

.sidebar-toggle {
  display: none;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: color var(--transition);
}

.sidebar-toggle svg { width: 22px; height: 22px; }
.sidebar-toggle:hover { color: var(--text-primary); }

.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}

.topbar-right { display: flex; align-items: center; gap: 0.75rem; }

.date-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* Content */
.content {
  flex: 1;
  padding: 1.75rem;
  overflow-y: auto;
}

/* ============================================================
   LOADING
   ============================================================ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  gap: 1rem;
  color: var(--text-muted);
}

.loader-ring {
  width: 48px; height: 48px;
  border: 3px solid rgba(245,166,35,0.2);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-sm {
  width: 20px; height: 20px;
  border-width: 2px;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   CARDS
   ============================================================ */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: all var(--transition);
}

.card:hover { border-color: rgba(255,255,255,0.1); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.card-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title svg { width: 16px; height: 16px; color: var(--gold); }

/* Stat Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--stat-color, var(--gold));
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(255,255,255,0.12);
  box-shadow: var(--shadow);
}

.stat-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
  color: var(--stat-color, var(--gold));
}

.stat-icon svg { width: 20px; height: 20px; }

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead tr {
  background: rgba(255,255,255,0.03);
}

th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.875rem 1rem;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255,255,255,0.03);
  vertical-align: middle;
}

tbody tr {
  transition: background var(--transition);
}

tbody tr:hover { background: rgba(255,255,255,0.03); }
tbody tr:last-child td { border-bottom: none; }

.td-name {
  font-weight: 600;
  color: var(--text-primary);
}

.td-phone { color: var(--accent-light); }

.td-amount {
  font-weight: 700;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.td-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

/* ============================================================
   BADGES / STATUS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-active   { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-overdue  { background: rgba(239,68,68,0.12);  color: var(--danger);  }
.badge-pending  { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-paid     { background: rgba(59,130,246,0.12); color: var(--accent);  }
.badge-completed{ background: rgba(100,116,139,0.12);color: var(--text-muted); }
.badge-upcoming { background: rgba(245,166,35,0.12); color: var(--gold);    }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius);
  font-size: 0.83rem;
  font-weight: 600;
  border: none;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.btn svg { width: 15px; height: 15px; }

.btn-primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #0b1120;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  box-shadow: var(--shadow-gold);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255,255,255,0.07);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.1);
  color: var(--text-primary);
}

.btn-accent {
  background: rgba(59,130,246,0.15);
  color: var(--accent-light);
  border: 1px solid rgba(59,130,246,0.2);
}

.btn-accent:hover {
  background: rgba(59,130,246,0.25);
  transform: translateY(-1px);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,0.2);
}

.btn-danger:hover {
  background: var(--danger);
  color: white;
  transform: translateY(-1px);
}

.btn-success {
  background: rgba(16,185,129,0.15);
  color: var(--success);
  border: 1px solid rgba(16,185,129,0.2);
}

.btn-success:hover {
  background: var(--success);
  color: white;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.4rem;
  border-radius: var(--radius-sm);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ============================================================
   FORMS
   ============================================================ */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-grid-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.form-full { grid-column: 1 / -1; }

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.form-label .required { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 0.6rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.875rem;
  transition: all var(--transition);
  outline: none;
  appearance: none;
}

.form-control:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

.form-control::placeholder { color: var(--text-muted); }

select.form-control {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 16px;
  padding-right: 2rem;
}

textarea.form-control { resize: vertical; min-height: 80px; }

.form-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Loan Summary Box */
.loan-summary {
  background: linear-gradient(135deg, rgba(245,166,35,0.08), rgba(245,166,35,0.03));
  border: 1px solid rgba(245,166,35,0.2);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  text-align: center;
}

.loan-summary-item .label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
}

.loan-summary-item .value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--gold);
  margin-top: 0.2rem;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.page-header-left h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text-primary);
}

.page-header-left p {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

/* ============================================================
   SEARCH / FILTER BAR
   ============================================================ */
.filter-bar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.search-box svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-box input {
  width: 100%;
  padding: 0.55rem 0.875rem 0.55rem 2.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.85rem;
  outline: none;
  transition: all var(--transition);
}

.search-box input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2rem;
  max-width: 420px;
  width: 100%;
  text-align: center;
  animation: slideUp 0.25s ease;
  box-shadow: var(--shadow-lg);
}

.modal-large {
  max-width: 560px;
}

.modal-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1rem;
}

.modal-icon svg { width: 28px; height: 28px; }
.modal-icon.danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.modal-icon.success { background: rgba(16,185,129,0.15); color: var(--success); }

.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.modal-desc { font-size: 0.875rem; color: var(--text-muted); margin-bottom: 1.5rem; }

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  margin-top: 1.25rem;
}

/* ============================================================
   TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.toast {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.875rem 1.25rem;
  font-size: 0.85rem;
  color: var(--text-primary);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 280px;
  animation: slideUp 0.25s ease;
  border-left: 3px solid var(--border);
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.success svg { color: var(--success); }
.toast.error   svg { color: var(--danger);  }
.toast.warning svg { color: var(--warning); }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-top: 1.5rem;
}

.dashboard-full { grid-column: 1 / -1; }

.overdue-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.875rem;
  border-radius: var(--radius);
  background: rgba(239,68,68,0.05);
  border: 1px solid rgba(239,68,68,0.1);
  transition: all var(--transition);
}

.overdue-item:hover {
  background: rgba(239,68,68,0.08);
  border-color: rgba(239,68,68,0.2);
}

.overdue-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(239,68,68,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--danger);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.overdue-info { flex: 1; min-width: 0; }
.overdue-name { font-weight: 600; font-size: 0.85rem; color: var(--text-primary); }
.overdue-sub  { font-size: 0.75rem; color: var(--text-muted); }

.overdue-penalty {
  text-align: right;
  flex-shrink: 0;
}

.overdue-penalty .amount { font-weight: 700; color: var(--danger); font-size: 0.9rem; }
.overdue-penalty .days   { font-size: 0.7rem; color: var(--text-muted); }

/* ============================================================
   CUSTOMER DETAIL
   ============================================================ */
.detail-header {
  background: linear-gradient(135deg, var(--bg-card), rgba(245,166,35,0.05));
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 1.75rem;
  margin-bottom: 1.25rem;
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

.detail-avatar {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0b1120;
  flex-shrink: 0;
}

.detail-meta { flex: 1; }
.detail-name  { font-size: 1.35rem; font-weight: 800; color: var(--text-primary); }
.detail-phone { font-size: 0.875rem; color: var(--accent-light); margin-top: 0.25rem; }
.detail-address { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.25rem; }

.detail-badges { display: flex; gap: 0.5rem; margin-top: 0.75rem; flex-wrap: wrap; }

.detail-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-self: flex-start; }

/* Info Grid */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
}

.info-item .label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.info-item .value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 0.2rem;
}

.info-item .value.gold { color: var(--gold); }

/* Payment Table Progress */
.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.08);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
  border-radius: 2px;
  transition: width 0.6s ease;
}

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  text-align: center;
  color: var(--text-muted);
  gap: 0.75rem;
}

.empty-state svg { width: 48px; height: 48px; opacity: 0.3; }
.empty-state h3  { font-size: 1rem; font-weight: 600; color: var(--text-secondary); }
.empty-state p   { font-size: 0.83rem; }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  body { background: white; color: black; }
  .sidebar, .topbar, .btn, .modal-overlay { display: none !important; }
  .main { margin-left: 0; }
  .content { padding: 0; }
  .card { border: 1px solid #ddd; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    transform: translateX(-260px);
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.6);
  }

  .main { margin-left: 0; }

  .sidebar-toggle { display: flex; }

  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid      { grid-template-columns: 1fr; }
  .form-grid-3    { grid-template-columns: 1fr; }
  .stat-grid      { grid-template-columns: repeat(2, 1fr); }
  .loan-summary   { grid-template-columns: 1fr; }
  .detail-header  { flex-direction: column; }
}

@media (max-width: 540px) {
  .stat-grid  { grid-template-columns: 1fr; }
  .content    { padding: 1rem; }
  .topbar     { padding: 0 1rem; }
}

/* ============================================================
   UTILITY
   ============================================================ */
.text-gold     { color: var(--gold); }
.text-danger   { color: var(--danger); }
.text-success  { color: var(--success); }
.text-muted    { color: var(--text-muted); }
.text-right    { text-align: right; }
.font-bold     { font-weight: 700; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.gap-2 { gap: 0.5rem; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

.section-tabs {
  display: flex;
  gap: 0.25rem;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius);
  padding: 3px;
  width: fit-content;
  margin-bottom: 1rem;
}

.tab-btn {
  padding: 0.45rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.8rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--text-primary);
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

/* Tooltip */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.85);
  color: white;
  font-size: 0.72rem;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 100;
}
