@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=Fraunces:ital,wght@0,400;0,600;0,700;1,400&display=swap');

/* ============================================================
   DESIGN TOKENS
   ============================================================ */
:root {
  --primary:        #1e3a5f;
  --primary-light:  #2d5280;
  --primary-50:     #e8f0f9;
  --accent:         #f97316;
  --accent-light:   #fed7aa;
  --success:        #059669;
  --success-light:  #d1fae5;
  --warning:        #d97706;
  --warning-light:  #fef3c7;
  --danger:         #dc2626;
  --danger-light:   #fee2e2;
  --info:           #0284c7;
  --info-light:     #e0f2fe;

  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --surface-2:      #f8fafc;
  --border:         #e2e8f0;
  --border-2:       #cbd5e1;
  --text:           #0f172a;
  --text-2:         #475569;
  --text-3:         #94a3b8;

  --sidebar-w:      260px;
  --radius:         12px;
  --radius-sm:      8px;
  --radius-lg:      16px;
  --shadow:         0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md:      0 4px 12px rgba(0,0,0,.1);
  --shadow-lg:      0 10px 30px rgba(0,0,0,.12);
  --transition:     0.2s ease;
}

/* ============================================================
   RESET
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
ul { list-style: none; }
input, select, textarea, button { font-family: inherit; }

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

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sidebar-brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-brand .brand-icon {
  width: 40px; height: 40px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 10px;
}
.sidebar-brand h1 {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sidebar-brand p {
  font-size: 11px;
  color: rgba(255,255,255,.45);
  margin-top: 2px;
}

.sidebar-section { padding: 16px 12px 8px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  text-transform: uppercase;
  padding: 0 8px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.65);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  margin-bottom: 1px;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
}
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 600; }
.nav-icon {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 15px;
}
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}
.nav-item.active .nav-badge { background: rgba(255,255,255,.3); }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 12px;
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  transition: background var(--transition);
  cursor: pointer;
}
.sidebar-user:hover { background: rgba(255,255,255,.1); }
.sidebar-avatar {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name {
  font-size: 13px; font-weight: 600; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-user-role { font-size: 11px; color: rgba(255,255,255,.45); text-transform: capitalize; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: var(--shadow);
}
.topbar-title { flex: 1; }
.topbar-title h2 { font-size: 18px; font-weight: 700; color: var(--text); }
.topbar-title p { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.topbar-icon-btn {
  width: 38px; height: 38px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-2);
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
}
.topbar-icon-btn:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary-50); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--surface);
}

/* ── PAGE CONTENT ── */
.page-content { padding: 28px; flex: 1; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* STATS GRID */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
}
.stat-card.green::before  { background: var(--success); }
.stat-card.blue::before   { background: var(--info); }
.stat-card.red::before    { background: var(--danger); }
.stat-card.orange::before { background: var(--accent); }

.stat-card-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 14px;
  background: var(--accent-light);
}
.stat-card.green .stat-card-icon { background: var(--success-light); }
.stat-card.blue .stat-card-icon  { background: var(--info-light); }
.stat-card.red .stat-card-icon   { background: var(--danger-light); }

.stat-card-value {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card-label { font-size: 12px; color: var(--text-2); font-weight: 500; }
.stat-card-change {
  font-size: 11px; margin-top: 8px;
  display: flex; align-items: center; gap: 4px;
}
.stat-card-change.up   { color: var(--success); }
.stat-card-change.down { color: var(--danger); }

/* CARD */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 0;
}
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--surface);
}
.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-body { padding: 20px; }
.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}

/* TABLE */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
thead th {
  padding: 11px 16px;
  background: var(--surface-2);
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
tbody td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
.td-label { font-weight: 600; color: var(--text); }
.td-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label .required, .required { color: var(--danger); margin-left: 2px; }
.form-control {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  appearance: auto;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30,58,95,.1);
}
.form-control::placeholder { color: var(--text-3); }
textarea.form-control { resize: vertical; min-height: 90px; }
.form-hint { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }
.form-row   { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* BUTTONS */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
  text-decoration: none;
}
.btn-sm  { padding: 6px 12px; font-size: 12px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; }
.btn-full{ width: 100%; justify-content: center; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); }
.btn-accent  { background: var(--accent); color: #fff; }
.btn-accent:hover { background: #ea6c0a; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #047857; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border-2);
  color: var(--text-2);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.btn-ghost { background: transparent; color: var(--text-2); border: none; }
.btn-ghost:hover { background: var(--surface-2); }

/* BADGE */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
}

/* ALERT */
.alert {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex; align-items: flex-start; gap: 10px;
  border: 1px solid transparent;
}
.alert-success { background: var(--success-light); color: #065f46; border-color: #a7f3d0; }
.alert-danger  { background: var(--danger-light);  color: #991b1b; border-color: #fca5a5; }
.alert-warning { background: var(--warning-light); color: #92400e; border-color: #fde68a; }
.alert-info    { background: var(--info-light);    color: #075985; border-color: #bae6fd; }

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.95) translateY(10px);
  transition: transform var(--transition);
}
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: var(--surface); z-index: 1;
}
.modal-title { font-size: 15px; font-weight: 700; }
.modal-close {
  width: 30px; height: 30px;
  border-radius: 6px; border: none;
  background: var(--surface-2);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2); transition: all var(--transition);
  font-size: 14px;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface-2);
}

/* TABS */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 20px; gap: 2px; }
.tab-btn {
  padding: 10px 18px; font-size: 13.5px; font-weight: 600;
  color: var(--text-2); cursor: pointer; border: none;
  background: none; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all var(--transition);
  text-decoration: none; display: inline-block;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* PROGRESS BAR */
.progress-bar {
  background: var(--border); border-radius: 999px;
  height: 8px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--primary);
  border-radius: 999px; transition: width .4s ease;
}
.progress-fill.green  { background: var(--success); }
.progress-fill.orange { background: var(--accent); }
.progress-fill.red    { background: var(--danger); }

/* SALDO CARD */
.saldo-card {
  background: linear-gradient(135deg, var(--primary) 0%, #2d5280 60%, #1a4a7a 100%);
  border-radius: var(--radius-lg);
  padding: 24px 28px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.saldo-card::before {
  content: ''; position: absolute;
  width: 220px; height: 220px;
  background: rgba(255,255,255,.05);
  border-radius: 50%; top: -70px; right: -50px;
}
.saldo-card::after {
  content: ''; position: absolute;
  width: 150px; height: 150px;
  background: rgba(255,255,255,.04);
  border-radius: 50%; bottom: -50px; right: 80px;
}
.saldo-label { font-size: 11px; color: rgba(255,255,255,.55); margin-bottom: 6px; text-transform: uppercase; letter-spacing: .08em; }
.saldo-amount { font-family: 'Fraunces', serif; font-size: 34px; font-weight: 700; line-height: 1; }
.saldo-period { font-size: 12px; color: rgba(255,255,255,.45); margin-top: 4px; }
.saldo-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; position: relative; z-index: 1; }
.saldo-stat-item { background: rgba(255,255,255,.1); border-radius: 8px; padding: 12px; }
.saldo-stat-label { font-size: 11px; color: rgba(255,255,255,.5); }
.saldo-stat-value { font-size: 16px; font-weight: 700; margin-top: 3px; }
.saldo-stat-value.green { color: #6ee7b7; }
.saldo-stat-value.red   { color: #fca5a5; }

/* UPLOAD AREA */
.upload-area {
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--surface-2);
}
.upload-area:hover, .upload-area.drag {
  border-color: var(--primary); background: var(--primary-50);
}
.upload-area-icon { font-size: 32px; margin-bottom: 8px; }
.upload-area h4 { font-size: 14px; font-weight: 600; color: var(--text); }
.upload-area p  { font-size: 12px; color: var(--text-3); margin-top: 4px; }

/* QRIS BOX */
.qris-box {
  background: var(--surface);
  border: 2px dashed var(--border-2);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.qris-box img { width: 180px; height: 180px; object-fit: contain; margin: 0 auto 12px; }
.qris-note { font-size: 12px; color: var(--text-3); line-height: 1.5; }

/* EMPTY STATE */
.empty-state { text-align: center; padding: 48px 20px; }
.empty-state-icon { font-size: 44px; margin-bottom: 14px; opacity: .35; }
.empty-state h3 { font-size: 15px; font-weight: 700; color: var(--text-2); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; color: var(--text-3); }

/* PAGINATION */
.pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); color: var(--text-2);
  transition: all var(--transition); text-decoration: none;
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.pagination .active, .pagination span[aria-current="page"] { background: var(--primary); color: #fff; border-color: var(--primary); }

/* AUTH PAGE */
.auth-page { min-height: 100vh; display: flex; background: var(--bg); }
.auth-left {
  flex: 1;
  background: linear-gradient(135deg, var(--primary), #2d5280);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; padding: 40px; color: #fff; text-align: center;
}
.auth-left h1 { font-family: 'Fraunces', serif; font-size: 38px; font-weight: 700; margin-bottom: 14px; line-height: 1.2; }
.auth-left p  { font-size: 15px; color: rgba(255,255,255,.65); max-width: 300px; line-height: 1.6; }
.auth-right {
  width: 460px;
  display: flex; align-items: center; justify-content: center;
  padding: 40px; background: var(--surface);
}
.auth-box { width: 100%; max-width: 380px; }
.auth-box h2 { font-size: 24px; font-weight: 800; color: var(--text); margin-bottom: 6px; }
.auth-box .subtitle { font-size: 14px; color: var(--text-2); margin-bottom: 28px; }
.auth-logo { margin-bottom: 28px; }
.auth-logo .logo-mark {
  width: 48px; height: 48px;
  background: var(--primary); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin-bottom: 12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main-content { margin-left: 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .page-content { padding: 16px; }
  .topbar { padding: 0 16px; }
  .auth-left { display: none; }
  .auth-right { width: 100%; }
  #sidebar-toggle { display: flex !important; }
}
@media (min-width: 769px) {
  #sidebar-toggle { display: none; }
}

/* ============================================================
   UTILITIES
   ============================================================ */
.flex           { display: flex; }
.items-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }
.mt-2   { margin-top: 8px; }
.mt-3   { margin-top: 12px; }
.mt-4   { margin-top: 16px; }
.mt-5   { margin-top: 20px; }
.mb-4   { margin-bottom: 16px; }
.mb-5   { margin-bottom: 20px; }
.text-sm      { font-size: 12px; }
.text-muted   { color: var(--text-3); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.font-bold    { font-weight: 700; }
.font-semibold{ font-weight: 600; }
.w-full       { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
