:root {
  --sidebar-w: 264px;
  --sidebar-bg: #0f172a;
  --body-bg: #f1f5f9;
}

body { overflow-x: hidden; background: var(--body-bg); }
.min-w0 { min-width: 0; }

/* ================= AUTENTIKASI ================= */
/* ================================================================
 | AUTENTIKASI — FULL SCREEN TANPA SCROLL
 | Semua aturan ter-scope ke body.auth-body sehingga TIDAK
 | memengaruhi halaman aplikasi (dashboard, dll. tetap scroll).
 * ================================================================ */

 /* Kunci scroll di level <html> HANYA jika halaman saat ini adalah auth */
 html:has(body.auth-body) {
  height: 100%;
  overflow: hidden;
}
/* Fallback untuk browser tanpa dukungan :has() */
body.auth-body {
  height: 100vh;
  overflow: hidden;
  background: #ffffff;
}

.auth-screen {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* ---------------- PANEL KIRI (BRANDING) ---------------- */
.auth-brand {
  flex: 0 0 50%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3rem 3.5rem;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);
  position: relative;
  overflow: hidden;
}
/* Ornamen dekoratif */
.auth-brand::before {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  top: -120px;
  right: -120px;
}
.auth-brand::after {
  content: "";
  position: absolute;
  width: 300px;
  height: 300px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  bottom: -80px;
  left: -80px;
}
.auth-brand > * {
  position: relative;
  z-index: 1;
}

.brand-icon {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: #2563eb;
  background: #ffffff;
  border-radius: 1rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}
.brand-icon-sm {
  width: 52px;
  height: 52px;
  font-size: 1.5rem;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
}

.auth-brand-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.auth-brand-list li {
  color: rgba(255, 255, 255, 0.9);
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.auth-brand-list i {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.6rem;
  font-size: 1rem;
}
.auth-brand-foot {
  color: rgba(255, 255, 255, 0.5);
  font-size: 0.78rem;
}

/* ---------------- PANEL KANAN (FORM) ---------------- */
.auth-form-panel {
  flex: 1 1 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: #ffffff;
}
.auth-form-inner {
  width: 100%;
  max-width: 400px;
}
.auth-card-wrap {
  width: 100%;
}
.auth-form-foot {
  margin-top: 2.5rem;
}
.auth-card-wrap .form-control:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.12);
}

/* ---------------- MOBILE / TABLET (< 992px) ---------------- */
@media (max-width: 991.98px) {
  .auth-screen {
    flex-direction: column;
    justify-content: center;
    padding: 1.5rem;
  }
  .auth-form-panel {
    padding: 0;
  }
  .auth-form-inner {
    max-width: 380px;
  }
}

/* Layar sangat pendek (keyboard HP muncul): buka scroll HANYA halaman auth */
@media (max-width: 991.98px) and (max-height: 600px) {
  html:has(body.auth-body),
  body.auth-body {
    height: 100%;
    overflow: auto;
  }
  .auth-screen {
    height: auto;
    min-height: 100vh;
  }
}

/* ================= SIDEBAR ================= */
.app-sidebar { --bs-offcanvas-width: min(82vw, 290px); background-color: var(--sidebar-bg); }
@media (min-width: 992px) {
  .app-sidebar {
    position: sticky !important; top: 0;
    height: 100vh !important; width: var(--sidebar-w) !important;
    background-color: var(--sidebar-bg) !important;
    visibility: visible !important; transform: none !important;
    border: 0 !important; flex-shrink: 0;
    overflow-y: auto; overflow-x: hidden;
  }
}
.app-sidebar::-webkit-scrollbar { width: 6px; }
.app-sidebar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .15); border-radius: 3px; }

.sidebar-brand {
  display: flex; gap: .7rem; align-items: center;
  padding: 1.1rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.brand-logo {
  width: 38px; height: 38px; border-radius: .6rem; flex-shrink: 0;
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.15rem; box-shadow: 0 4px 12px rgba(37, 99, 235, .4);
}
.brand-title { color: #fff; font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand-sub { color: rgba(255, 255, 255, .45); font-size: .7rem; }

.sidebar-nav { padding: .75rem .75rem 1.5rem; }
.sidebar-label {
  font-size: .66rem; letter-spacing: .12em; text-transform: uppercase;
  color: rgba(255, 255, 255, .38); font-weight: 700;
  padding: .95rem 1rem .35rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: .65rem;
  color: rgba(255, 255, 255, .72); text-decoration: none;
  padding: .55rem .9rem; margin-bottom: .15rem;
  border-radius: .6rem; font-size: .9rem;
  transition: background .15s ease, color .15s ease;
}
.sidebar-link i { font-size: 1.05rem; width: 1.25rem; text-align: center; flex-shrink: 0; }
.sidebar-link:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.sidebar-link.active {
  color: #fff; font-weight: 600;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  box-shadow: 0 4px 12px rgba(37, 99, 235, .35);
}
.sidebar-link.is-locked { color: rgba(255, 255, 255, .35); cursor: not-allowed; }
.sidebar-badge {
  font-size: .58rem; font-weight: 700; letter-spacing: .04em;
  color: rgba(255, 255, 255, .55);
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 999px; padding: .1rem .5rem; flex-shrink: 0;
}
.sidebar-foot {
  padding: .9rem 1.25rem; font-size: .72rem;
  color: rgba(255, 255, 255, .35);
  border-top: 1px solid rgba(255, 255, 255, .08);
}

/* ================= TOPBAR & KONTEN ================= */
.app-topbar { background: #fff; border-bottom: 1px solid #e8edf3; z-index: 1020; }
.app-topbar .breadcrumb-item + .breadcrumb-item::before { content: "›"; }
.app-content { padding: 1.25rem; }
@media (min-width: 992px) { .app-content { padding: 1.75rem 2rem; } }

/* ================= KARTU ================= */
.card { border: 0; border-radius: .75rem; box-shadow: 0 1px 2px rgba(16, 24, 40, .06); }
.stat-card { transition: transform .15s ease, box-shadow .15s ease; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .08) !important; }
.stat-icon {
  width: 48px; height: 48px; border-radius: .75rem; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem;
}
.stat-icon.text-success   { background: rgba(25, 135, 84, .1); }
.stat-icon.text-danger    { background: rgba(220, 53, 69, .1); }
.stat-icon.text-primary   { background: rgba(13, 110, 253, .1); }
.stat-icon.text-info      { background: rgba(13, 202, 240, .12); }
.stat-icon.text-secondary { background: rgba(108, 117, 125, .1); }
.card-chart .card-header { border-bottom: 1px solid #f1f5f9; }

/* ================= KARTU SOROTAN (BULAN INI) ================= */
.hl-card { border-radius: 1rem; color: #fff; box-shadow: 0 8px 20px rgba(0, 0, 0, .12); }
.hl-in  { background: linear-gradient(135deg, #15803d, #22c55e); }
.hl-out { background: linear-gradient(135deg, #b91c1c, #ef4444); }
.hl-label { font-size: .8rem; opacity: .85; }
.hl-value { font-size: 1.65rem; font-weight: 800; letter-spacing: -.02em; }
.hl-sub   { font-size: .72rem; opacity: .75; margin-top: .15rem; }
.delta-chip {
  background: rgba(255, 255, 255, .22); border-radius: 999px;
  font-size: .74rem; font-weight: 600; padding: .18rem .65rem; white-space: nowrap;
}

/* ================= GRAFIK & EMPTY STATE ================= */
.chart-box { position: relative; height: 300px; }
@media (max-width: 575px) { .chart-box { height: 240px; } }
.empty-state { text-align: center; padding: 1.5rem 0; }
.empty-state i { font-size: 2.2rem; color: #cbd5e1; display: block; margin-bottom: .5rem; }

/* ================= TABEL & LAINNYA ================= */
.table-recent thead th { font-weight: 600; border-bottom: 1px solid #eef2f7 !important; }
.avatar-circle {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem; color: #3b82f6; background: rgba(59, 130, 246, .12);
}

/* ================= MASTER DATA (TAHAP 3) ================= */
.code-cell { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 700; }
.lv-1 { text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.lv-2 { font-weight: 600; }
.lv-3 { font-weight: 400; }
tr.row-header-akun { background: rgba(15, 23, 42, .03); }
.badge-soft-success   { background: rgba(25, 135, 84, .12);  color: #198754; }
.badge-soft-secondary { background: rgba(108, 117, 125, .14); color: #495057; }
.badge-soft-primary   { background: rgba(13, 110, 253, .12);  color: #0d6efd; }
.badge-soft-danger    { background: rgba(220, 53, 69, .12);   color: #dc3545; }
.badge-soft-warning   { background: rgba(255, 193, 7, .18);   color: #a37700; }
.dataTables_wrapper .dataTables_filter input { border: 1px solid #dee2e6; border-radius: .375rem; padding: .25rem .5rem; }
.dataTables_wrapper .dataTables_length select { border: 1px solid #dee2e6; border-radius: .375rem; padding: .2rem .4rem; }
/* ================= TRANSAKSI (TAHAP 4) ================= */
.tx-in  { color: #198754; }
.tx-out { color: #dc3545; }
.badge-soft-info { background: rgba(13, 202, 240, .14); color: #0a91a8; }
.filter-card .form-label { font-size: .74rem; font-weight: 600; margin-bottom: .15rem; color: #475569; }
@media print {
  .app-sidebar, .app-topbar, footer, .btn, .dropdown, .filter-card { display: none !important; }
  .app-content { padding: 0 !important; }
}
/* ================= LAPORAN (TAHAP 5) ================= */
.sum-card { border-left: 4px solid #dee2e6; }
.sum-card.sum-in  { border-left-color: #198754; }
.sum-card.sum-out { border-left-color: #dc3545; }
.sum-label { font-size: .74rem; color: #64748b; font-weight: 600; }
.sum-value { font-size: 1.15rem; font-weight: 800; letter-spacing: -.01em; margin-top: .1rem; }
tr.section-row td {
  background: #0f172a; color: #fff; font-weight: 700; font-size: .78rem;
  letter-spacing: .06em; text-transform: uppercase; padding: .5rem .75rem;
}
tr.group-row td { background: rgba(15, 23, 42, .05); font-weight: 600; }
.table-report td, .table-report th { vertical-align: middle; }
@media print {
  .no-print, .filter-card, .app-sidebar, .app-topbar, footer,
  .dataTables_filter, .dataTables_length, .dataTables_paginate { display: none !important; }
  .app-content { padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc !important; break-inside: avoid; }
  body { background: #fff !important; }
}
/* ================= TAHAP 6 ================= */
.matrix th, .matrix td { white-space: nowrap; }
.matrix td:first-child, .matrix th:first-child {
  position: sticky; left: 0; background: #fff; z-index: 1;
}
.matrix tr.section-row td:first-child { background: #0f172a; z-index: 2; }
.matrix .locked-col { background: rgba(108, 117, 125, .06); }
.perm-toggle { cursor: pointer; }

/* Menghilangkan panah bawaan drop-down Show Entries */
.dataTables_length select {
  -webkit-appearance: none;  /* Chrome, Safari, Opera */
  -moz-appearance: none;     /* Firefox */
  appearance: none;          /* Standar modern */
  padding-right: 10px;       /* Sesuaikan padding jika teks terlalu mepet */
}
div.dataTables_wrapper div.dataTables_length select {
  width:60px;
}

/* ================= PERSETUJUAN (badge menu & banner) ================= */
.sidebar-link .sidebar-count {
  margin-left: auto;
  background: #ef4444; color: #fff;
  font-size: .65rem; font-weight: 700;
  min-width: 18px; height: 18px; padding: 0 .3rem;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(239, 68, 68, .5);
}
.sidebar-link.active .sidebar-count { background: #fff; color: #dc3545; }
.approval-banner { color: #664d03 !important; }
.approval-banner:hover { background: #fffbe6 !important; }
