/* ============================================================
   SIKEU BUMDes - Custom Styles
   Tema: Emerald Modern (desktop & mobile friendly)
   ============================================================ */
:root {
  --brand: #059669;
  --brand-dark: #047857;
  --brand-darker: #064e3b;
  --brand-soft: #ecfdf5;
  --sidebar-w: 262px;
  --topbar-h: 62px;
  --bg: #f2f6f4;
  --card-radius: 16px;
  --ink: #0f172a;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.925rem;
}

/* ---------- Sidebar ---------- */
.app-sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0b1f17 0%, #0f2b20 55%, #123a2b 100%);
  color: #e6f4ec;
}
.app-sidebar.offcanvas-lg {
  position: fixed; top: 0; bottom: 0; left: 0;
  z-index: 1040; border-right: 0;
}
/* v1.2.1: sidebar desktop dapat di-scroll saat menu melebihi tinggi layar.
   Pada >=992px Bootstrap menjadikan .offcanvas-lg statis (untuk navbar) TANPA
   display:flex, sedangkan sidebar ini fixed -> nav jadi block dan .offcanvas-body
   meluber tanpa scrollbar. Kembalikan nav menjadi flex kolom + kurung isinya. */
@media (min-width: 992px) {
  .app-sidebar {
    transform: none !important;
    visibility: visible !important;
    display: flex;          /* nav flex kolom */
    flex-direction: column;
  }
  .app-sidebar .offcanvas-body {
    flex-grow: 1;      /* isi mengisi penuh tinggi sidebar */
    min-height: 0;     /* boleh menyusut -> .sidebar-scroll ikut terkurung */
    overflow: hidden;  /* menu tidak bocor keluar panel */
  }
  .app-main { margin-left: var(--sidebar-w); }
}
.sidebar-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;                     /* kunci: item flex boleh menyusut agar scrollbar aktif */
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;             /* scrollbar tipis (Firefox) */
  scrollbar-color: rgba(255,255,255,.18) transparent;
}
.sidebar-scroll::-webkit-scrollbar { width: 5px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }

.sidebar-brand {
  display: flex; align-items: center; gap: 4px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff;
}
.brand-badge {
  width: 40px; height: 40px; border-radius: 12px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; font-size: 20px;
  box-shadow: 0 6px 16px rgba(16,185,129,.35);
}
.text-sidebar-muted { color: #9dbfae; font-size: .78rem; }

.sidebar-heading {
  padding: 18px 22px 6px;
  font-size: .68rem; letter-spacing: .14em; text-transform: uppercase;
  color: #7ea392; font-weight: 700;
}
.app-sidebar .nav-link {
  display: flex; align-items: center; gap: 12px;
  margin: 2px 12px; padding: 9px 14px;
  border-radius: 10px; color: #cfe5d8;
  font-weight: 500; font-size: .9rem;
  transition: background .15s ease, color .15s ease;
}
.app-sidebar .nav-link i { font-size: 1.05rem; width: 22px; text-align: center; }
.app-sidebar .nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.app-sidebar .nav-link.active {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
  box-shadow: 0 6px 18px rgba(5,150,105,.45);
}
.sidebar-foot {
  padding: 12px 20px; font-size: .72rem; color: #7ea392;
  border-top: 1px solid rgba(255,255,255,.08);
}

/* ---------- Topbar & Konten ---------- */
.app-topbar {
  position: sticky; top: 0; z-index: 1020;
  height: var(--topbar-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid #e2e8e5;
  padding: 0 16px;
}
@media (min-width: 992px) { .app-topbar { padding: 0 26px; } }
.page-title { font-size: 1.15rem; font-weight: 700; }
.page-sub { font-size: .74rem; color: #64748b; }
.user-chip {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid #e2e8e5; border-radius: 999px;
  background: #fff; padding: 4px 10px 4px 4px;
}
.user-chip:hover { background: #f8fafc; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--brand), #34d399);
  color: #fff; font-weight: 700; font-size: .8rem;
}
.btn-icon { border-radius: 10px; }

.app-content { max-width: 1400px; }
.app-footer {
  padding: 18px 26px 26px; color: #94a3b8; font-size: .78rem;
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
}

/* ---------- Kartu ---------- */
.card {
  border: 0; border-radius: var(--card-radius);
  box-shadow: 0 1px 2px rgba(15,23,42,.05), 0 8px 24px -12px rgba(15,23,42,.12);
}
.card-header {
  background: transparent; border-bottom: 1px solid #eef2f0;
  padding: 15px 20px; font-weight: 700; border-radius: var(--card-radius) var(--card-radius) 0 0 !important;
}
.card-body { padding: 20px; }

/* Stat card */
.stat-card { position: relative; overflow: hidden; }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff; flex: 0 0 auto;
}
.stat-card .stat-label { font-size: .74rem; letter-spacing: .06em; text-transform: uppercase; color: #64748b; font-weight: 700; }
.stat-card .stat-value { font-size: 1.32rem; font-weight: 800; letter-spacing: -.01em; }
.stat-card .stat-sub { font-size: .76rem; color: #94a3b8; }
.stat-card::after {
  content: ""; position: absolute; right: -34px; top: -34px;
  width: 110px; height: 110px; border-radius: 50%;
  background: radial-gradient(circle, rgba(5,150,105,.10), transparent 70%);
}
.bg-grad-emerald { background: linear-gradient(135deg, #059669, #34d399); }
.bg-grad-sky     { background: linear-gradient(135deg, #0284c7, #38bdf8); }
.bg-grad-violet  { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.bg-grad-amber   { background: linear-gradient(135deg, #d97706, #fbbf24); }
.bg-grad-rose    { background: linear-gradient(135deg, #e11d48, #fb7185); }
.bg-grad-slate   { background: linear-gradient(135deg, #334155, #64748b); }

/* Persamaan akuntansi */
.eq-strip {
  border-radius: 14px; padding: 14px 18px;
  background: linear-gradient(135deg, #064e3b, #059669 70%, #10b981);
  color: #ecfdf5; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  justify-content: space-between;
}
.eq-strip .eq-item b { font-size: 1.05rem; }
.eq-strip .eq-op { font-size: 1.25rem; opacity: .8; font-weight: 700; }

/* ---------- Tabel ---------- */
.table { --bs-table-hover-bg: #f6faf8; }
.table thead th {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .07em;
  color: #64748b; font-weight: 700; border-bottom-width: 1px !important;
  white-space: nowrap;
}
.table-sm td, .table-sm th { padding: .45rem .6rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-report td, .table-report th { vertical-align: middle; }
.row-strong td { font-weight: 700; }
.row-total td { font-weight: 800; border-top: 2px solid #0f172a !important; }
.row-sub td { font-weight: 600; color: #334155; }
.row-indent-1 td:first-child { padding-left: 34px; }
.row-indent-2 td:first-child { padding-left: 56px; }
.text-neg { color: #dc2626; }
.table-sticky thead th { position: sticky; top: 0; background: #fff; z-index: 5; }

/* ---------- Badge & chip unit ---------- */
.unit-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 10px 2px 6px; border-radius: 999px;
  font-size: .74rem; font-weight: 600; line-height: 1.5;
  background: #f1f5f9; color: #334155;
}
.unit-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- Form ---------- */
.form-label { font-weight: 600; font-size: .82rem; color: #334155; }
.form-control, .form-select { border-radius: 10px; border-color: #dbe4e0; }
.form-control:focus, .form-select:focus {
  border-color: var(--brand); box-shadow: 0 0 0 .2rem rgba(5,150,105,.15);
}
.btn-success { background: var(--brand); border-color: var(--brand); }
.btn-success:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-outline-success { color: var(--brand); border-color: var(--brand); }
.btn-outline-success:hover { background: var(--brand); border-color: var(--brand); }
.btn { border-radius: 10px; }

/* Jurnal baris */
.jline .form-select, .jline .form-control { min-width: 0; }
@media (min-width: 768px) {
  .jline-grid { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(140px, 1fr) 130px 130px 40px; gap: 8px; }
}
@media (max-width: 767.97px) {
  .jline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .jline-grid .col-akun, .jline-grid .col-ket { grid-column: 1 / -1; }
}
.total-bar {
  border-radius: 12px; padding: 10px 16px;
  background: #f8fafc; border: 1px dashed #cbd5e1;
  font-weight: 700; display: flex; gap: 18px; justify-content: flex-end; flex-wrap: wrap;
}
.total-bar .balanced { color: var(--brand); }
.total-bar .unbalanced { color: #dc2626; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 110% -10%, rgba(52,211,153,.35), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(2,132,199,.25), transparent 60%),
    linear-gradient(150deg, #04241a 0%, #064e3b 45%, #059669 100%);
}
.login-card {
  border: 0; border-radius: 22px;
  box-shadow: 0 30px 70px -20px rgba(2, 20, 14, .55);
}
.brand-badge-lg {
  width: 64px; height: 64px; border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #10b981, #059669);
  color: #fff; font-size: 30px; box-shadow: 0 12px 26px rgba(16,185,129,.4);
}
.demo-cred { font-size: .78rem; }

/* ---------- Cetak ---------- */
.print-head { display: none; }
@media print {
  @page { size: A4 portrait; margin: 14mm 12mm; }
  body { background: #fff; font-size: 12px; }
  .app-sidebar, .app-topbar, .app-footer, .no-print { display: none !important; }
  .app-main { margin-left: 0 !important; }
  .app-content { max-width: 100% !important; padding: 0 !important; }
  .card { box-shadow: none !important; border-radius: 0 !important; }
  .card-body { padding: 0 !important; }
  .card-header { display: none; }
  .print-head { display: block !important; }
  .table { --bs-table-color: #000; margin-bottom: 0; }
  .table thead th { color: #000; }
  a { text-decoration: none; color: #000; }
  .row-total td { border-top: 2px solid #000 !important; }
}
.print-head { padding: 4px 2px 14px; }
.print-kop {
  display: flex; align-items: center; gap: 14px;
  border-bottom: 3px double #0f172a; padding-bottom: 10px; margin-bottom: 6px;
}
.print-kop .kop-logo {
  width: 64px; height: 64px; border-radius: 50%; flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #0f172a; font-weight: 800; font-size: 20px;
}
.print-kop .kop-logo-img {
  border: none; border-radius: 12px; overflow: hidden; background: #fff; padding: 2px;
}
.print-kop .kop-logo-img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.print-kop .kop-name { font-size: 17px; font-weight: 800; text-transform: uppercase; }
.print-kop .kop-addr { font-size: 11px; color: #334155; }
.print-title { text-align: center; font-weight: 800; font-size: 14px; text-transform: uppercase; margin-top: 10px; }
.print-sub { text-align: center; font-size: 11.5px; color: #334155; }
.print-note { text-align: center; font-size: 10.5px; font-style: italic; color: #64748b; margin-bottom: 10px; }
.print-sign {
  margin-top: 26px; display: flex; justify-content: space-between; gap: 20px;
  page-break-inside: avoid; font-size: 12px;
}
.print-sign .sig { text-align: center; min-width: 210px; }
.print-sign .sig .sig-name { margin-top: 66px; font-weight: 700; border-top: 1px solid #000; display: inline-block; padding-top: 4px; min-width: 180px; }
.print-foot { margin-top: 16px; font-size: 9.5px; color: #94a3b8; display: flex; justify-content: space-between; }

/* ---------- Lain-lain ---------- */
.chart-box { position: relative; height: 280px; }
.chart-box-sm { position: relative; height: 240px; }
.empty-state { text-align: center; color: #94a3b8; padding: 40px 10px; }
.empty-state i { font-size: 42px; }
.min-w-0 { min-width: 0; }
.w-90px { width: 90px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.description-cell { max-width: 420px; }
@media (max-width: 575.98px) {
  .stat-value { font-size: 1.1rem; }
  .card-body { padding: 16px; }
}

/* ===== Logo terunggah pada badge brand ===== */
.brand-badge-img {
  background: #fff;
  padding: 2px;
  overflow: hidden;
}
.brand-badge-img img {
  width: 100%; height: 100%;
  object-fit: contain;
  border-radius: 10px;
  display: block;
}

/* ===== Judul grup pada halaman Pengaturan ===== */
.setting-group-title {
  font-weight: 700;
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #475569;
  border-bottom: 1px dashed #e2e8f0;
  padding-bottom: 6px;
  margin: 18px 0 12px;
}
