:root {
  --biru: #1a3a5c;
  --biru-2: #24507d;
  --hijau: #1e7d46;
  --merah: #a32638;
  --kuning: #b57e00;
  --abu-bg: #f2f5f8;
  --abu-line: #d7dee6;
  --teks: #22303c;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; font-family: "Segoe UI", system-ui, -apple-system, sans-serif; color: var(--teks); background: var(--abu-bg); font-size: 14px; }
.hidden { display: none !important; }

/* ---------- LOGIN ---------- */
.login-overlay { position: fixed; inset: 0; background: linear-gradient(135deg, #14283f, #1a3a5c 60%, #24507d); display: flex; align-items: center; justify-content: center; z-index: 100; }
.login-box { background: #fff; border-radius: 14px; padding: 36px 40px; width: 400px; max-width: 92vw; box-shadow: 0 24px 60px rgba(0,0,0,.35); text-align: center; }
.login-logo { width: 74px; height: 74px; margin: 0 auto 12px; border-radius: 50%; background: var(--biru); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.login-box h1 { font-size: 17px; margin: 4px 0 2px; }
.login-sub { font-size: 12px; color: #5b6b7a; margin: 0 0 18px; }
.login-box label { display: block; text-align: left; font-weight: 600; font-size: 12px; margin: 10px 0 4px; }
.login-box input { width: 100%; padding: 10px 12px; border: 1px solid var(--abu-line); border-radius: var(--radius); font-size: 14px; }
.login-error { color: var(--merah); font-size: 12px; min-height: 16px; margin-top: 10px; font-weight: 600; }

/* ---------- LAYOUT ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: 258px; background: linear-gradient(180deg, #14283f, #1a3a5c); color: #cdd9e5; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.12); }
.brand-logo { display: inline-block; background: #fff; color: var(--biru); font-weight: 800; border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.brand-name { font-size: 12px; font-weight: 700; color: #fff; margin-top: 8px; letter-spacing: .4px; }
#sideNav { flex: 1; overflow-y: auto; padding: 10px 8px; }
#sideNav a { display: block; color: #cdd9e5; text-decoration: none; padding: 10px 12px; border-radius: var(--radius); font-size: 13px; margin: 2px 0; }
#sideNav a:hover { background: rgba(255,255,255,.09); color: #fff; }
#sideNav a.active { background: #fff; color: var(--biru); font-weight: 700; }
.sidebar-foot { padding: 12px 16px; font-size: 11px; border-top: 1px solid rgba(255,255,255,.12); color: #9fb2c5; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; border-bottom: 1px solid var(--abu-line); padding: 12px 22px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 20; }
.topbar-user { font-size: 13px; font-weight: 600; color: #445566; }
.content { padding: 22px; flex: 1; }
.footer { padding: 10px 22px; font-size: 11px; color: #7b8a99; background: #fff; border-top: 1px solid var(--abu-line); }

/* ---------- KOMPONEN ---------- */
.card { background: #fff; border: 1px solid var(--abu-line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.card h2 { font-size: 16px; margin: 0 0 14px; padding-bottom: 10px; border-bottom: 2px solid var(--biru); color: var(--biru); }
.card h3 { font-size: 14px; margin: 18px 0 10px; color: var(--biru-2); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.btn { border: none; border-radius: var(--radius); padding: 9px 16px; font-size: 13px; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--biru); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--biru-2); }
.btn-success { background: var(--hijau); color: #fff; }
.btn-danger { background: var(--merah); color: #fff; }
.btn-warn { background: var(--kuning); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid var(--abu-line); color: #445566; }
.btn-ghost:hover { background: #f0f4f8; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; margin-top: 14px; }

.form-row { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; min-width: 140px; }
.form-group label { font-size: 12px; font-weight: 600; color: #445566; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea { padding: 8px 10px; border: 1px solid var(--abu-line); border-radius: var(--radius); font-size: 13px; font-family: inherit; }

table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px; }
table.data th { background: #eaf0f6; color: #33455a; text-align: left; padding: 9px 10px; border: 1px solid var(--abu-line); font-size: 12px; white-space: nowrap; }
table.data td { padding: 7px 10px; border: 1px solid var(--abu-line); vertical-align: top; }
table.data tr:nth-child(even) td { background: #f8fafc; }
table.data tr.row-click { cursor: pointer; }
table.data tr.row-click:hover td { background: #eef4fa; }
table.data tr.selected td { background: #dbe8f5; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.ctr { text-align: center; }
.tbl-wrap { overflow-x: auto; }
.positif { color: var(--hijau); font-weight: 700; }
.negatif { color: var(--merah); font-weight: 700; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-lunas, .badge-AKTIF { background: #e0f2e8; color: var(--hijau); }
.badge-bellunas { background: #fdf1d8; color: var(--kuning); }
.badge-NONAKTIF { background: #f9dfe2; color: var(--merah); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }
.kpi { background: #fff; border: 1px solid var(--abu-line); border-radius: var(--radius); padding: 16px; border-top: 4px solid var(--biru); }
.kpi .lbl { font-size: 11px; font-weight: 700; letter-spacing: .5px; color: #6a7b8c; }
.kpi .val { font-size: 20px; font-weight: 800; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi.kas { border-top-color: var(--biru-2); }
.kpi.pendapatan { border-top-color: var(--hijau); }
.kpi.beban { border-top-color: var(--kuning); }
.kpi.laba { border-top-color: #556; }

.top-card { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 18px; }
@media (max-width: 1100px) { .top-card { grid-template-columns: 1fr; } }
.top-box { background: #fff; border: 1px solid var(--abu-line); border-radius: var(--radius); padding: 16px; }
.top-box .lbl { font-size: 12px; font-weight: 700; }
.top-box .nama { font-size: 13px; margin: 8px 0 4px; min-height: 18px; }
.top-box .nilai { font-size: 18px; font-weight: 800; }

.balance-ok { color: var(--hijau); font-weight: 800; }
.balance-no { color: var(--merah); font-weight: 800; }

pre.report { background: #fff; border: 1px solid var(--abu-line); border-radius: var(--radius); padding: 18px; font-family: "Cascadia Mono", "Consolas", monospace; font-size: 12px; line-height: 1.55; overflow-x: auto; white-space: pre; }

/* ---------- MODAL ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(12,22,35,.55); display: flex; align-items: center; justify-content: center; z-index: 90; }
.modal-box { background: #fff; border-radius: 12px; width: 640px; max-width: 94vw; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--abu-line); font-weight: 700; color: var(--biru); }
.modal-close { background: none; border: none; font-size: 22px; cursor: pointer; color: #667; line-height: 1; }
.modal-body { padding: 18px; overflow-y: auto; }

/* ---------- TOAST ---------- */
.toast { position: fixed; bottom: 24px; right: 24px; background: #1f2f3f; color: #fff; padding: 14px 20px; border-radius: var(--radius); max-width: 420px; box-shadow: 0 10px 30px rgba(0,0,0,.3); z-index: 120; white-space: pre-line; font-size: 13px; }
.toast.err { background: var(--merah); }

/* ---------- IMPORT WIZARD ---------- */
.import-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.import-progress { font-weight: 700; color: var(--biru); }

/* ---------- PRINT ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .footer, .no-print { display: none !important; }
  .content { padding: 0; }
  .card { border: none; padding: 0; }
}
