:root {
  --em-900: #064e3b;
  --em-800: #065f46;
  --em-700: #047857;
  --em-600: #059669;
  --em-100: #d1fae5;
  --em-50:  #ecfdf5;
  --gold:   #c9a227;
  --gold-soft: #f6e9b8;
  --ink: #17332a;
  --line: #e3ece8;
  --bg: #f5f8f6;
  --sidebar-w: 264px;
}
html { scroll-padding-top: 72px; }
body { font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--ink); }
a { color: var(--em-700); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

.btn-emerald { background: var(--em-700); border-color: var(--em-700); color: #fff; }
.btn-emerald:hover, .btn-emerald:focus { background: var(--em-800); border-color: var(--em-800); color: #fff; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #2b2200; font-weight: 600; }
.btn-gold:hover { background: #b38f1d; border-color: #b38f1d; color: #2b2200; }
.btn-icon { border: 0; font-size: 1.2rem; color: var(--em-900); }

/* ---------- Layout ---------- */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 1040;
  background: linear-gradient(180deg, var(--em-900), var(--em-800));
  color: #d7efe5; display: flex; flex-direction: column; overflow-y: auto;
  transition: transform .2s ease;
}
.sidebar-brand { display: flex; gap: .75rem; align-items: center; padding: 1.25rem 1.25rem 1rem; border-bottom: 3px solid var(--gold); color: #fff; }
.sidebar-brand small { color: var(--gold-soft); }
.brand-logo { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 10px; padding: 3px; flex: none; }
.brand-logo-fallback { display: grid; place-items: center; color: var(--em-800); font-size: 1.25rem; }
.sidebar-nav { padding: .75rem; display: flex; flex-direction: column; gap: 2px; }
.nav-link-app { display: flex; align-items: center; gap: .75rem; padding: .65rem .85rem; border-radius: 8px; color: #d7efe5; text-decoration: none; font-weight: 500; }
.nav-link-app i { width: 1.25rem; text-align: center; }
.nav-link-app:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-link-app.active { background: #fff; color: var(--em-800); box-shadow: inset 4px 0 0 var(--gold); }
.nav-link-app.disabled { opacity: .5; cursor: not-allowed; }
.nav-link-app.disabled:hover { background: none; color: #d7efe5; }
.nav-link-app em { margin-left: auto; font-size: .7rem; font-style: normal; background: rgba(255,255,255,.14); padding: 1px 8px; border-radius: 99px; }
.sidebar-backdrop { display: none; }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; gap: .75rem; padding: .6rem 1.5rem; background: #fff; border-bottom: 1px solid var(--line); }
.topbar-title { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-title strong { font-size: 1.05rem; color: var(--em-900); }
.btn-user { display: flex; align-items: center; gap: .6rem; border: 0; background: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--gold); color: #2b2200; display: grid; place-items: center; font-weight: 700; }
.content { padding: 1.5rem; flex: 1; }
.app-footer { padding: 1rem 1.5rem; font-size: .85rem; color: #6b8379; border-top: 1px solid var(--line); background: #fff; }

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
  .sidebar-backdrop.show { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1030; }
  .app-main { margin-left: 0; }
  .topbar { padding: .6rem 1rem; }
  .content { padding: 1rem; }
}
@media (prefers-reduced-motion: reduce) { .sidebar { transition: none; } }

/* ---------- Kartu & tabel ---------- */
.card-app { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.card-app .card-head { padding: .9rem 1.1rem; border-bottom: 1px solid var(--line); font-weight: 600; color: var(--em-900); display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-app .card-body-pad { padding: 1.1rem; }

.stat-card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 1.1rem 1.2rem; display: flex; gap: 1rem; align-items: center; height: 100%; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; background: var(--em-50); color: var(--em-700); flex: none; }
.stat-card.is-gold .stat-icon { background: var(--gold-soft); color: #7a5f00; }
.stat-card.is-warn .stat-icon { background: #fde8e8; color: #b42318; }
.stat-label { color: #5d786c; font-size: .85rem; }
.stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.15; color: var(--em-900); word-break: break-word; }

.table-app thead th { background: var(--em-50); color: var(--em-900); font-weight: 600; border-bottom: 2px solid var(--em-100); white-space: nowrap; }
.table-app td, .table-app th { vertical-align: middle; }
.badge-lunas { background: var(--em-100); color: var(--em-800); }
.badge-cicilan { background: var(--gold-soft); color: #7a5f00; }
.badge-belum { background: #fde8e8; color: #b42318; }
.chart-box { position: relative; height: 280px; }

/* ---------- Login ---------- */
.login-body { background: linear-gradient(135deg, var(--em-900) 0%, var(--em-700) 100%); min-height: 100vh; }
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 2rem; border-top: 5px solid var(--gold); box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-brand { text-align: center; margin-bottom: 1.5rem; }
.login-brand h1 { font-size: 1.25rem; font-weight: 700; color: var(--em-900); margin: .75rem 0 .15rem; }
.login-brand p { color: #5d786c; margin: 0; font-size: .9rem; }
.login-logo { width: 72px; height: 72px; object-fit: contain; }
.login-logo-fallback { display: inline-grid; place-items: center; border-radius: 18px; background: var(--em-50); color: var(--em-700); font-size: 2rem; }

@media print { .sidebar, .topbar, .app-footer, .no-print { display: none !important; } .app-main { margin: 0; } }
