@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #F6F7F9; }
body { font-family: 'Inter', system-ui, sans-serif; color: #1C2333; }
.num { font-family: 'IBM Plex Mono', monospace; font-variant-numeric: tabular-nums; }
input, select, button { font-family: inherit; }
input:focus, select:focus, button:focus { outline: 2px solid #245C4E; outline-offset: 1px; }
a { color: inherit; }

#root { min-height: 100vh; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; border: 1px solid #E3E6EB; border-radius: 14px; padding: 36px 34px; width: 340px; box-shadow: 0 12px 32px rgba(20,26,38,0.06); }
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; }
.login-mark { width: 38px; height: 38px; border-radius: 9px; background: #245C4E; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-family: 'IBM Plex Mono', monospace; }
.login-title { font-weight: 700; font-size: 17px; }
.login-sub { font-size: 12px; color: #8891A5; }
.error-box { background: #FBE9EA; color: #B3404A; font-size: 12.5px; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; }
.hint-box { background: #FBF0E1; color: #A9762F; font-size: 12px; padding: 9px 12px; border-radius: 8px; margin-bottom: 14px; }

/* ---------- app shell (menu modul 2 tingkat + tree-nav khusus Laporan) ---------- */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.topbar { display: flex; align-items: center; gap: 14px; padding: 9px 20px; background: #fff; border-bottom: 1px solid #E3E6EB; flex-wrap: wrap; flex-shrink: 0; }
.topbar .brand { display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: #245C4E; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11.5px; font-family: 'IBM Plex Mono', monospace; flex-shrink: 0; }
.brand-name { font-weight: 700; font-size: 14.5px; }
.company-select { background: #F3F4F6; border: 1px solid #E3E6EB; border-radius: 7px; padding: 6px 9px; font-size: 12px; color: #1C2333; max-width: 220px; }
.topbar-link { font-size: 11.5px; color: #6B7280; cursor: pointer; white-space: nowrap; }
.topbar-link:hover { color: #1C2333; text-decoration: underline; }
.topbar-spacer { flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 12px; font-size: 12px; color: #6B7280; white-space: nowrap; }
.topbar-user b { color: #1C2333; }

.modtabs { display: flex; background: #12181F; padding: 0 12px; overflow-x: auto; flex-shrink: 0; }
.modtab { padding: 10px 15px; font-size: 12.5px; color: #97A0AF; cursor: pointer; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.modtab:hover { color: #fff; }
.modtab.active { color: #fff; background: #1C2530; font-weight: 600; }

.subtabs { display: flex; background: #1C2530; padding: 0 12px; overflow-x: auto; flex-shrink: 0; }
.subtab { padding: 8px 14px; font-size: 12px; color: #A6AEBC; cursor: pointer; white-space: nowrap; border-bottom: 2px solid transparent; }
.subtab:hover { color: #fff; }
.subtab.active { color: #fff; font-weight: 600; border-bottom-color: #4C8CFF; }

.modtab .badge, .subtab .badge, .tree-item .badge { background: #B3404A; color: #fff; font-size: 10px; font-weight: 700; border-radius: 10px; padding: 1px 6px; line-height: 1.4; }

.body-wrap { flex: 1; display: flex; min-height: 0; }
.treenav { width: 196px; background: #fff; border-right: 1px solid #E3E6EB; padding: 10px 0; flex-shrink: 0; overflow-y: auto; }
.tree-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.4px; color: #A2AAB8; font-weight: 700; padding: 14px 18px 6px; }
.tree-item { padding: 8px 18px; font-size: 12.5px; color: #4B5566; cursor: pointer; border-right: 2px solid transparent; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tree-item:hover { background: #F7F8FA; }
.tree-item.active { background: #EEF2EE; color: #245C4E; font-weight: 600; border-right-color: #245C4E; }

.main { flex: 1; padding: 20px 28px; overflow-y: auto; min-width: 0; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin: -20px -28px 18px; padding: 13px 28px; border-bottom: 1px solid #E3E6EB; background: #FAFBFC; flex-wrap: wrap; gap: 10px; }
.h1 { font-size: 15.5px; font-weight: 700; margin: 0; }
.subtitle { font-size: 11.5px; color: #8891A5; margin-top: 2px; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-bottom: 16px; }
.stat-card { background: #fff; border: 1px solid #E3E6EB; border-radius: 8px; padding: 13px 16px; }
.stat-label { font-size: 11.5px; color: #6B7280; margin-bottom: 6px; }
.stat-value { font-size: 19px; font-weight: 700; }
.pos { color: #245C4E; } .neg { color: #B3404A; } .warn { color: #A9762F; } .neu { color: #1C2333; }

.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; margin-bottom: 16px; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

.card { background: #fff; border: 1px solid #E3E6EB; border-radius: 8px; padding: 16px 18px; margin-bottom: 14px; }
.card-title { font-size: 13px; font-weight: 700; margin-bottom: 10px; }
.list-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px solid #EEF0F3; font-size: 13px; }
.list-row:last-child { border-bottom: none; }
.empty-state { padding: 20px 4px; color: #8891A5; font-size: 13px; }

.form-row { display: flex; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.field { flex: 1; min-width: 140px; display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11.5px; color: #8891A5; font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; }
.field input, .field select { border: 1px solid #DDE1E7; border-radius: 8px; padding: 9px 11px; font-size: 13.5px; background: #FBFCFD; }

.btn-primary { background: #245C4E; color: #fff; border: none; border-radius: 8px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: #1D4C40; }
.btn-ghost { background: transparent; color: #245C4E; border: 1px solid #245C4E; border-radius: 8px; padding: 7px 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.btn-ghost-small { background: transparent; color: #245C4E; border: 1px solid #C9DAD5; border-radius: 6px; padding: 5px 10px; font-size: 12px; font-weight: 600; cursor: pointer; }
.btn-ghost:disabled, .btn-ghost-small:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-danger-text { color: #B3404A; font-size: 12px; cursor: pointer; }
.btn-danger { background: #B3404A; color: #fff; border: none; border-radius: 8px; padding: 10px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.btn-danger:hover { background: #98333C; }

.pill { font-size: 11px; font-weight: 600; padding: 4px 9px; border-radius: 20px; background: #EEF0F3; color: #4B5566; display: inline-block; }
.pill-paid { background: #E7F0ED; color: #245C4E; }
.pill-unpaid { background: #FBF0E1; color: #A9762F; }

.ledger-input { border: 1px solid #DDE1E7; border-radius: 7px; padding: 8px 10px; font-size: 13px; background: #FBFCFD; }
.ledger-head-row { display: flex; gap: 8px; font-size: 10.5px; color: #8891A5; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px; padding: 5px 4px; }
.ledger-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.ledger-mini-row { display: flex; gap: 8px; font-size: 12px; padding: 2px 0; }
.ledger-divider { width: 1px; background: #E3E6EB; }
.ledger-divider-thin { width: 1px; background: #EEF0F3; }
.ledger-total-row { display: flex; gap: 8px; padding: 8px 0; border-top: 2px solid #1C2333; margin-top: 4px; }
.remove-x { width: 28px; text-align: center; cursor: pointer; color: #B3404A; }

.report-row { display: flex; justify-content: space-between; font-size: 12.5px; padding: 3px 0; }
.report-subtotal { display: flex; justify-content: space-between; font-weight: 700; background: #F7F8FA; padding: 6px 8px; margin: 4px -8px; font-size: 12.5px; border-radius: 4px; }
.report-total-row { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 700; color: #fff; background: #12181F; padding: 9px 12px; margin-top: 8px; border-radius: 6px; }
.section-label { font-size: 11.5px; color: #8891A5; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 6px; }
.skontro-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.skontro-col { padding: 0 18px; }
.skontro-col:first-child { padding-left: 0; }
.skontro-col:last-child { padding-right: 0; border-left: 1px solid #E3E6EB; }

/* ---------- modal ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(18,24,31,0.55); display: flex; align-items: center; justify-content: center; z-index: 200; padding: 20px; }
.modal-card { background: #fff; border-radius: 10px; width: 480px; max-width: 100%; max-height: 88vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(18,24,31,0.35); }
/* Varian lebih lebar, dipakai untuk konten yang butuh ruang horizontal lebih (mis. tabel Neraca
   dua kolom/skontro di pop-up Laporan Keuangan) -- lihat openModal({wide:true}). */
.modal-card.modal-card-wide { width: 820px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid #E3E6EB; display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 15px; font-weight: 700; margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #E3E6EB; display: flex; justify-content: flex-end; gap: 8px; }

.bars-wrap { display: flex; align-items: flex-end; gap: 18px; height: 220px; padding-top: 10px; }
.bar-group { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; justify-content: flex-end; }
.bar-pair { display: flex; align-items: flex-end; gap: 4px; height: 100%; }
.bar { width: 16px; border-radius: 3px 3px 0 0; }
.bar-rev { background: #245C4E; }
.bar-exp { background: #A9762F; }
.bar-label { font-size: 11px; color: #6B7280; margin-top: 6px; }
.legend-row { display: flex; gap: 16px; font-size: 12px; color: #6B7280; margin-bottom: 6px; }
.legend-dot { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #1C2333; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 13px; z-index: 50; }
.notice-box { font-size: 12px; color: #8891A5; margin-top: 10px; }
.banner { font-size: 12.5px; color: #A9762F; background: #FBF0E1; padding: 8px 12px; border-radius: 8px; margin-bottom: 14px; }
