*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f1f5f9;
  color: #1e293b;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────────────────────────── */

.header {
  background: #0f172a;
  color: white;
  padding: 0 24px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  box-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.header-logo-icon {
  width: 32px;
  height: 32px;
  background: #3b82f6;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-subtitle {
  font-size: 13px;
  color: #64748b;
  padding-left: 14px;
  border-left: 1px solid #1e293b;
}

.header-spacer { flex: 1; }

.header-pill {
  background: #1e293b;
  color: #94a3b8;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  border: 1px solid #334155;
  transition: all 0.15s;
}
.header-pill:hover { background: #334155; color: white; }

/* ── Layout ───────────────────────────────────────────────────────────────── */

.layout {
  display: flex;
  height: calc(100vh - 58px);
  margin-top: 58px;
}

/* ── Left panel ───────────────────────────────────────────────────────────── */

.left-panel {
  width: 300px;
  background: white;
  border-right: 1px solid #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.panel-header {
  padding: 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
}

.panel-count {
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 10px;
}

.search-wrap { position: relative; }
.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 8px 10px 8px 32px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  background: #f8fafc;
  color: #1e293b;
}
.search-input:focus { border-color: #3b82f6; background: white; box-shadow: 0 0 0 3px rgba(59,130,246,0.08); }

.add-student-btn {
  width: 100%;
  padding: 8px;
  background: #eff6ff;
  color: #2563eb;
  border: 1px dashed #bfdbfe;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.add-student-btn:hover { background: #dbeafe; border-color: #93c5fd; }

.student-list { flex: 1; overflow-y: auto; padding: 8px; }

.student-card {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 2px;
  transition: background 0.12s;
  border: 1px solid transparent;
}
.student-card:hover { background: #f8fafc; }
.student-card.active { background: #eff6ff; border-color: #bfdbfe; }

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.card-info { flex: 1; min-width: 0; }
.card-name { font-weight: 600; font-size: 13px; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-id { font-size: 11px; color: #94a3b8; margin-top: 1px; font-family: monospace; }

.balance-chip {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 20px;
  white-space: nowrap;
}
.chip-pos { background: #dcfce7; color: #15803d; }
.chip-low { background: #fef9c3; color: #92400e; }
.chip-neg { background: #fee2e2; color: #b91c1c; }

/* ── Right panel ──────────────────────────────────────────────────────────── */

.right-panel { flex: 1; overflow-y: auto; padding: 28px; }

.empty-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: #94a3b8;
}
.empty-state-icon { opacity: 0.35; }
.empty-title { font-size: 16px; font-weight: 600; color: #64748b; }
.empty-sub { font-size: 13px; }

/* ── Detail ───────────────────────────────────────────────────────────────── */

.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.detail-avatar {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 20px;
  flex-shrink: 0;
}

.detail-name { font-size: 21px; font-weight: 700; line-height: 1.2; }
.detail-meta { font-size: 12px; color: #64748b; margin-top: 4px; display: flex; gap: 12px; }
.detail-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #f1f5f9;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 12px;
  color: #475569;
  font-family: monospace;
}

.detail-actions { margin-left: auto; display: flex; gap: 8px; }

/* ── Wallet card ──────────────────────────────────────────────────────────── */

.wallet-card {
  background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
  color: white;
  border-radius: 16px;
  padding: 24px 28px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.wallet-card::before {
  content: '';
  position: absolute;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  right: -50px;
  top: -80px;
}

.wallet-label { font-size: 12px; opacity: 0.7; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.wallet-balance { font-size: 38px; font-weight: 800; letter-spacing: -1px; }
.wallet-txn-count { font-size: 12px; opacity: 0.6; margin-top: 6px; }

.wallet-actions { margin-left: auto; display: flex; flex-direction: column; gap: 8px; position: relative; }

/* ── Sections ─────────────────────────────────────────────────────────────── */

.section-header {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Transaction table ────────────────────────────────────────────────────── */

.txn-card {
  background: white;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.txn-card table { width: 100%; border-collapse: collapse; }

.txn-card th {
  background: #f8fafc;
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.txn-card td {
  padding: 11px 16px;
  font-size: 13px;
  border-top: 1px solid #f8fafc;
  color: #374151;
}

.txn-card tr:hover td { background: #f9fafb; }

.cat-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  background: #f1f5f9;
  color: #475569;
}

.amt-credit { color: #16a34a; font-weight: 700; font-family: monospace; }
.amt-debit  { color: #dc2626; font-weight: 700; font-family: monospace; }

.no-txns { padding: 48px 16px; text-align: center; color: #94a3b8; font-size: 14px; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: filter 0.12s, box-shadow 0.12s;
  white-space: nowrap;
}
.btn:hover { filter: brightness(0.93); }
.btn:active { filter: brightness(0.85); }

.btn-primary { background: #3b82f6; color: white; }
.btn-success { background: #16a34a; color: white; }
.btn-danger  { background: #ef4444; color: white; }
.btn-outline {
  background: white;
  color: #374151;
  border: 1px solid #e2e8f0;
}
.btn-ghost {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 1px solid rgba(255,255,255,0.25);
  font-size: 12px;
  padding: 6px 12px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.22); filter: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; filter: none; }

/* ── Modal ────────────────────────────────────────────────────────────────── */

.backdrop {
  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(2px);
}

.modal {
  background: white;
  border-radius: 16px;
  padding: 28px;
  width: 440px;
  max-width: 95vw;
  box-shadow: 0 24px 64px rgba(0,0,0,0.2);
}

.modal-title { font-size: 17px; font-weight: 700; margin-bottom: 20px; color: #0f172a; }
.modal-subtitle { font-size: 13px; color: #64748b; margin-top: -16px; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-label { font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; display: block; text-transform: uppercase; letter-spacing: 0.4px; }

.form-input, .form-select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  color: #1e293b;
  background: white;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.1);
}

.type-toggle { display: flex; gap: 8px; }
.type-btn {
  flex: 1;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  background: white;
  color: #64748b;
}
.type-btn.active-credit { background: #dcfce7; border-color: #86efac; color: #15803d; }
.type-btn.active-debit  { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }

.quick-amounts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.quick-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  background: #f8fafc;
  color: #475569;
  transition: all 0.12s;
}
.quick-btn:hover { background: #eff6ff; border-color: #bfdbfe; color: #2563eb; }

.modal-footer { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* ── API Modal ────────────────────────────────────────────────────────────── */

.api-modal { width: 560px; }

.endpoint-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}
.endpoint-row:last-child { border-bottom: none; }

.method-badge {
  font-size: 10px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  min-width: 52px;
  text-align: center;
  font-family: monospace;
  flex-shrink: 0;
}
.m-get    { background: #dcfce7; color: #15803d; }
.m-post   { background: #dbeafe; color: #1d4ed8; }
.m-put    { background: #fef9c3; color: #92400e; }
.m-delete { background: #fee2e2; color: #b91c1c; }

.endpoint-path { font-size: 13px; font-family: monospace; color: #1e293b; }
.endpoint-desc { font-size: 12px; color: #64748b; margin-top: 2px; }

.base-url-box {
  background: #f1f5f9;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 13px;
  color: #475569;
}
.base-url-box code { font-family: monospace; color: #1e293b; font-size: 13px; }

/* ── Toast ────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #0f172a;
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13px;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  animation: slideup 0.2s ease;
  max-width: 320px;
}

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

/* ── Misc ─────────────────────────────────────────────────────────────────── */

.spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 160px;
  color: #94a3b8;
  font-size: 14px;
  gap: 8px;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #cbd5e1; }
