:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --success: #16a34a;
  --danger: #dc2626;
  --warning: #d97706;
  --bg: #f4f5fa;
  --sidebar-bg: #171a2e;
  --sidebar-text: #b6b9d4;
  --sidebar-active: #4f46e5;
  --card-radius: 14px;
}

* { box-sizing: border-box; }

/* Override warna default Bootstrap agar konsisten dengan tema indigo
   aplikasi (variable --primary), bukan biru default Bootstrap (#0d6efd).
   Tanpa ini, tombol-tombol utama (Masuk, Tambah Akun, Tambah Transaksi,
   dst di seluruh aplikasi) tampil biru terang yang tidak senada dengan
   sidebar/aksen ungu-indigo di tempat lain. */
.btn-primary {
  --bs-btn-bg: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary-dark);
  --bs-btn-hover-border-color: var(--primary-dark);
  --bs-btn-active-bg: var(--primary-dark);
  --bs-btn-active-border-color: var(--primary-dark);
  --bs-btn-focus-shadow-rgb: 79, 70, 229;
}
.btn-outline-primary {
  --bs-btn-color: var(--primary);
  --bs-btn-border-color: var(--primary);
  --bs-btn-hover-bg: var(--primary);
  --bs-btn-hover-border-color: var(--primary);
  --bs-btn-active-bg: var(--primary);
  --bs-btn-active-border-color: var(--primary);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 .25rem rgba(79, 70, 229, .25);
}
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

body {
  background: var(--bg);
  font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, sans-serif;
  color: #1f2333;
}

/* ============ LOGIN PAGE ============ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 25% 20%, #7c3aed 0%, transparent 45%),
    radial-gradient(circle at 80% 75%, #4338ca 0%, transparent 50%),
    linear-gradient(135deg, #312e81 0%, #1e1b4b 100%);
}
.auth-wrapper { width: 100%; max-width: 420px; padding: 20px; }
.auth-card { border-radius: 18px; }
.auth-icon {
  width: 64px; height: 64px; margin: 0 auto;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  color: #fff; border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
}

/* ---- Login split-panel (branding kiri + form kanan) ---- */
.auth-wrapper-split { width: 100%; max-width: 960px; padding: 20px; }
.auth-card-split {
  display: flex;
  border-radius: 22px;
  overflow: hidden;
  background: #fff;
  min-height: 580px;
}
.auth-left {
  flex: 0 0 42%;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  padding: 48px 42px;
  flex-direction: column;
  justify-content: center;
}
.auth-icon-box {
  width: 56px; height: 56px; border-radius: 14px;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; margin-bottom: 24px;
}
.auth-left h2 { font-weight: 700; font-size: 1.7rem; margin-bottom: 14px; }
.auth-left .auth-desc {
  color: rgba(255,255,255,.85); font-size: .92rem; line-height: 1.65; margin-bottom: 30px;
}
.auth-feature-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 15px; }
.auth-feature-list li {
  display: flex; align-items: center; gap: 12px;
  font-size: .88rem; font-weight: 500; color: rgba(255,255,255,.95);
}
.auth-feature-list i { font-size: 1.15rem; color: #fbbf24; width: 22px; text-align: center; flex-shrink: 0; }

.auth-right {
  flex: 1 1 auto;
  padding: 48px 44px;
  display: flex; flex-direction: column; justify-content: center;
}

/* Kotak ikon input abu-abu terpisah dari field (sesuai referensi desain) */
.auth-right .input-group-text {
  background: #f3f4f6 !important;
  border-right: none;
  color: #6b7280;
}
.auth-right .input-group .form-control {
  border-left: none;
}
.auth-right .input-group .form-control:focus {
  box-shadow: none;
  border-color: #ced4da;
}
.auth-right .input-group:focus-within .input-group-text {
  border-color: #86b7fe;
}

/* Kotak info bawah (link daftar/lupa password), gaya "soft card" seperti referensi */
.auth-info-box {
  background: #f3f4f6;
  border-radius: 12px;
  padding: 14px 16px;
  margin-top: 28px;
}
.auth-info-box .auth-info-title {
  font-weight: 600; font-size: .85rem; color: #374151;
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.auth-info-box a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-info-box a:hover { text-decoration: underline; }

@media (max-width: 767.98px) {
  .auth-wrapper-split { max-width: 460px; }
  .auth-card-split { min-height: auto; box-shadow: 0 10px 30px rgba(0,0,0,.15); }
  .auth-right { padding: 36px 28px; }
}

/* ============ APP SHELL ============ */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  z-index: 1030;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 20px; font-size: 1.15rem; color: #fff; font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-brand i { font-size: 1.4rem; color: #818cf8; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 12px; }
.sidebar-section-title {
  text-transform: uppercase; font-size: .7rem; letter-spacing: .06em;
  color: #6b7099; margin: 18px 12px 6px;
}
.sidebar .nav-link {
  display: flex; align-items: center; gap: 12px;
  color: var(--sidebar-text); padding: 10px 14px; border-radius: 10px;
  font-size: .92rem; margin-bottom: 2px; transition: all .15s ease;
}
.sidebar .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar .nav-link:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar .nav-link.active {
  background: var(--sidebar-active); color: #fff;
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
}
.sidebar-footer { padding: 14px 12px; border-top: 1px solid rgba(255,255,255,.08); }

.app-main { flex: 1; margin-left: 250px; display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px; background: #fff; display: flex; align-items: center;
  justify-content: space-between; padding: 0 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  position: sticky; top: 0; z-index: 1020;
}
.topbar-title { font-weight: 600; }
.btn-icon { border: none; background: none; }

.app-content { padding: 22px; flex: 1; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .app-main { margin-left: 0; }
}

/* ============ CARDS / WIDGETS ============ */
.card { border: none; border-radius: var(--card-radius); }
.stat-card {
  border-radius: var(--card-radius);
  padding: 20px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,.08);
}
.stat-card i.stat-bg-icon {
  position: absolute; right: -10px; bottom: -10px; font-size: 5rem; opacity: .18;
}
.stat-card .stat-label { font-size: .8rem; opacity: .85; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; margin-top: 2px; }

.bg-grad-indigo { background: linear-gradient(135deg,#4f46e5,#7c3aed); }
.bg-grad-green  { background: linear-gradient(135deg,#16a34a,#22c55e); }
.bg-grad-red    { background: linear-gradient(135deg,#dc2626,#f87171); }
.bg-grad-amber  { background: linear-gradient(135deg,#d97706,#fbbf24); }

.account-card {
  border-radius: var(--card-radius);
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,.05);
}
.account-card:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(0,0,0,.08); }

.progress { border-radius: 20px; background: #edeef5; }
.progress-bar { border-radius: 20px; }

.table thead.table-dark th { background: #1f2333; border: none; }
.table-responsive { border-radius: var(--card-radius); overflow: hidden; }

.badge-soft-success { background: #dcfce7; color: #15803d; }
.badge-soft-danger  { background: #fee2e2; color: #b91c1c; }

.empty-state { text-align: center; padding: 40px 20px; color: #8a8ea6; }
.empty-state i { font-size: 2.6rem; margin-bottom: 10px; display: block; }

.fab {
  position: fixed; right: 26px; bottom: 26px; z-index: 1040;
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg,#4f46e5,#7c3aed);
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; box-shadow: 0 10px 24px rgba(79,70,229,.4);
  border: none;
}

/* ============ GLOBAL LOADING OVERLAY ============ */
#globalLoadingOverlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity .15s ease;
}
#globalLoadingOverlay.show {
  opacity: 1;
  visibility: visible;
}
#globalLoadingOverlay .loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 28px 36px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(31, 35, 51, .18);
}
#globalLoadingOverlay .spinner-border {
  width: 2.6rem;
  height: 2.6rem;
  color: #4f46e5;
  border-width: 3px;
}
#globalLoadingOverlay .loading-text {
  font-size: .88rem;
  font-weight: 600;
  color: #4b4f6b;
  letter-spacing: .02em;
}

/* ==========================================================
   PANDUAN PENGGUNAAN (help box per-menu)
========================================================== */
.help-toggle-btn {
  border-radius: 8px;
  font-size: .82rem;
  font-weight: 600;
}
.help-box-panel {
  margin-top: 10px;
  background: #f5f7ff;
  border: 1px solid #dfe3fb;
  border-radius: 12px;
  padding: 16px 18px;
}
.help-box-panel .help-box-title {
  color: #4f46e5;
  font-weight: 700;
  font-size: .92rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.help-box-panel ul {
  padding-left: 1.1rem;
  margin-bottom: 0;
}
.help-box-panel li {
  margin-bottom: 6px;
  font-size: .86rem;
  color: #464a63;
}
.help-box-panel li:last-child {
  margin-bottom: 0;
}
.help-box-panel p {
  font-size: .86rem;
  color: #464a63;
  margin-bottom: 8px;
}
.help-box-panel p:last-child {
  margin-bottom: 0;
}
.help-box-panel .help-box-note {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #c7cdf7;
  font-size: .82rem;
  color: #6b7099;
}
