@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf9f6;
  --line: #e7e3da;
  --line-2: #efece5;
  --ink: #1d2622;
  --ink-2: #4b5651;
  --muted: #7d8681;
  --brand: #154a42;
  --brand-2: #1e6157;
  --brand-ink: #e9f2ef;
  --accent: #d9972f;
  --accent-soft: #fbf1df;
  --pos: #18794e;
  --pos-soft: #e5f4ec;
  --neg: #c2413a;
  --neg-soft: #fbeceb;
  --warn: #b7791f;
  --warn-soft: #fdf3e0;
  --info: #2d6cb5;
  --info-soft: #e7f0fa;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(23, 33, 29, .04), 0 4px 16px rgba(23, 33, 29, .05);
  --shadow-lg: 0 12px 48px rgba(23, 33, 29, .18);
  --sidebar-w: 248px;
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.no-scroll { overflow: hidden; }
a { color: var(--brand-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--muted); }
.muted-sm { color: var(--muted); font-size: 12px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }
.sidebar { background: var(--brand); color: var(--brand-ink); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 18px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: #2b1d05; display: grid; place-items: center; font-weight: 800; font-size: 17px; }
.brand-name { font-weight: 800; font-size: 15px; line-height: 1.15; color: #fff; }
.brand-sub { font-size: 11px; opacity: .65; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-sec { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; opacity: .5; padding: 14px 12px 6px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: rgba(233, 242, 239, .82); font-weight: 500; transition: background .15s, color .15s; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .13); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.nav .count { margin-left: auto; background: var(--accent); color: #2b1d05; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 20px; }
.side-user { margin-top: auto; padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .06); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand-2); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; border: 2px solid rgba(255,255,255,.18); }
.side-user .who { min-width: 0; flex: 1; }
.side-user .nm { font-weight: 600; font-size: 13px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .rl { font-size: 11px; opacity: .65; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .icon-btn { color: var(--brand-ink); }
.side-user .icon-btn:hover { background: rgba(255,255,255,.1); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 18px 28px 0; }
.topbar h1 { font-size: 22px; font-weight: 800; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.topbar .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.menu-btn { display: none; }
.view { padding: 18px 28px 40px; }
.fab { display: none; }

/* ---------- Komponen ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px 0; }
.card-head h3 { font-size: 15px; font-weight: 700; }
.card-head .sub { color: var(--muted); font-size: 12px; }
.card-head .tools { margin-left: auto; display: flex; gap: 6px; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 15px; border-radius: 10px; border: 1px solid transparent; font-weight: 600; font-size: 13.5px; cursor: pointer; transition: background .15s, border-color .15s, transform .05s; white-space: nowrap; line-height: 1.2; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.accent { background: var(--accent); color: #2b1d05; }
.btn.accent:hover { filter: brightness(1.05); }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-2); border-color: #d9d4c8; }
.btn.danger { background: var(--neg); color: #fff; }
.btn.success { background: var(--pos); color: #fff; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; border-radius: 8px; }
.btn .ic { width: 16px; height: 16px; }
.icon-btn { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }
.icon-btn.danger:hover { background: var(--neg-soft); color: var(--neg); }
.icon-btn .ic { width: 17px; height: 17px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge .ic { width: 13px; height: 13px; }
.b-income { background: var(--pos-soft); color: var(--pos); }
.b-expense { background: var(--neg-soft); color: var(--neg); }
.b-paid { background: var(--pos-soft); color: var(--pos); }
.b-unpaid { background: var(--warn-soft); color: var(--warn); }
.b-overdue { background: var(--neg-soft); color: var(--neg); }
.b-muted { background: var(--line-2); color: var(--muted); }
.b-info { background: var(--info-soft); color: var(--info); }
.chip-sm { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.chip-sm .ic { width: 14px; height: 14px; color: var(--muted); }
.verified { color: var(--pos); display: inline-flex; vertical-align: -3px; margin-left: 4px; }
.verified .ic { width: 15px; height: 15px; }
.amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.amt.pos { color: var(--pos); }
.amt.neg { color: var(--neg); }
.age { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.age-1 { background: var(--pos-soft); color: var(--pos); }
.age-2 { background: var(--warn-soft); color: var(--warn); }
.age-3 { background: #fde6d8; color: #b4501b; }
.age-4 { background: var(--neg-soft); color: var(--neg); }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi .lbl { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.kpi .lbl .dot { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; }
.kpi .lbl .dot .ic { width: 16px; height: 16px; }
.kpi .val { font-size: 22px; font-weight: 800; margin-top: 10px; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.k-pos .dot { background: var(--pos-soft); color: var(--pos); }
.kpi.k-neg .dot { background: var(--neg-soft); color: var(--neg); }
.kpi.k-net .dot { background: var(--info-soft); color: var(--info); }
.kpi.k-warn .dot { background: var(--warn-soft); color: var(--warn); }
.kpi.k-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.kpi.k-brand .lbl, .kpi.k-brand .foot { color: rgba(255,255,255,.7); }
.kpi.k-brand .dot { background: rgba(255,255,255,.14); color: #fff; }
.val.pos { color: var(--pos); }
.val.neg { color: var(--neg); }
.kpi-group-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 -4px; }

/* ---------- Filter bar ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 14px; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.inp, .filters select, .filters input { height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 0 10px; font-size: 13.5px; min-width: 0; }
.filters .search { position: relative; flex: 1 1 200px; }
.filters .search input { width: 100%; padding-left: 34px; }
.filters .search .ic { position: absolute; left: 10px; top: 9px; color: var(--muted); }
.filters .spacer { flex: 1; }
.date-range { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Tabel ---------- */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 11px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:hover td { background: #fcfbf8; }
.tbl tbody tr.clickable { cursor: pointer; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl tfoot td { font-weight: 800; background: var(--surface-2); border-top: 1px solid var(--line); }
.tbl .detail-cell { max-width: 280px; }
.tbl .detail-cell .d1 { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .detail-cell .d2 { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .acts { white-space: nowrap; text-align: right; }
.tbl tr.inactive td { opacity: .55; }
.thumb { width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); padding: 0; overflow: hidden; cursor: zoom-in; position: relative; display: grid; place-items: center; color: var(--neg); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.pdf { grid-template-rows: auto auto; gap: 0; }
.thumb.pdf small { font-size: 9px; font-weight: 700; margin-top: -2px; }
.thumb-more { position: absolute; right: 1px; bottom: 1px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; padding: 0 4px; border-radius: 4px; }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; gap: 10px; flex-wrap: wrap; }
.pager-btns { display: flex; align-items: center; gap: 6px; }
.pg { font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 54px; text-align: center; }
.summary-strip { display: flex; gap: 22px; padding: 12px 18px; border-bottom: 1px solid var(--line-2); flex-wrap: wrap; }
.summary-strip div { display: flex; flex-direction: column; }
.summary-strip small { color: var(--muted); font-size: 11.5px; font-weight: 600; }
.summary-strip b { font-size: 15px; font-variant-numeric: tabular-nums; }

/* tabel → kartu di mobile */
@media (max-width: 760px) {
  .tbl.responsive thead { display: none; }
  .tbl.responsive, .tbl.responsive tbody, .tbl.responsive tr, .tbl.responsive td { display: block; width: 100%; }
  .tbl.responsive tr { border-bottom: 1px solid var(--line); padding: 10px 14px; display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  .tbl.responsive td { border: 0; padding: 2px 0; }
  .tbl.responsive td[data-m="hide"] { display: none; }
  .tbl.responsive td[data-m="right"] { text-align: right; grid-column: 2; }
  .tbl.responsive td[data-m="full"] { grid-column: 1 / -1; }
  .tbl.responsive .detail-cell { max-width: none; }
  .tbl.responsive tfoot tr { display: flex; justify-content: space-between; }
}

/* ---------- Form ---------- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--neg); }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--surface); width: 100%; transition: border-color .15s, box-shadow .15s; }
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus, .filters select:focus, .filters input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(30, 97, 87, .14); }
.field .invalid, .invalid { border-color: var(--neg) !important; box-shadow: 0 0 0 3px rgba(194, 65, 58, .1) !important; }
.field .hint { font-size: 12px; color: var(--muted); }
.err { color: var(--neg); font-size: 12px; min-height: 0; }
.err:empty { display: none; }
.money { position: relative; }
.money::before { content: 'Rp'; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.money input { padding-left: 38px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.type-switch label { position: relative; cursor: pointer; }
.type-switch input { position: absolute; opacity: 0; pointer-events: none; }
.type-switch .opt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 12px; font-weight: 700; background: var(--surface); transition: all .15s; }
.type-switch .opt .ic { width: 20px; height: 20px; padding: 3px; border-radius: 7px; box-sizing: content-box; }
.type-switch .opt small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.type-switch .t-in .opt .ic { background: var(--pos-soft); color: var(--pos); }
.type-switch .t-ex .opt .ic { background: var(--neg-soft); color: var(--neg); }
.type-switch .t-in input:checked + .opt { border-color: var(--pos); background: var(--pos-soft); }
.type-switch .t-ex input:checked + .opt { border-color: var(--neg); background: var(--neg-soft); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pills label { cursor: pointer; }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills .pill { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 10px; font-weight: 600; background: var(--surface); }
.pills input:checked + .pill { border-color: var(--brand-2); background: #e8f2ef; color: var(--brand); }
.pills input:focus-visible + .pill { box-shadow: 0 0 0 3px rgba(30, 97, 87, .2); }
.paid-box { border: 1.5px dashed var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.paid-box.on { border-color: var(--pos); border-style: solid; background: #f6fbf8; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--pos); }
.status-note { font-size: 12.5px; color: var(--muted); }
.drop { border: 1.5px dashed #cfc9bc; border-radius: 12px; padding: 16px; text-align: center; color: var(--muted); cursor: pointer; background: var(--surface-2); transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand-2); background: #eef5f3; }
.drop .ic { width: 26px; height: 26px; color: var(--brand-2); }
.drop b { color: var(--ink); display: block; margin-top: 4px; }
.files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.file-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-size: 12.5px; max-width: 100%; }
.file-chip img, .file-chip .fi { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: var(--neg-soft); color: var(--neg); display: grid; place-items: center; flex: none; }
.file-chip .nm { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.file-chip .icon-btn { width: 24px; height: 24px; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; background: rgba(17, 28, 24, .45); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 16px; z-index: 50; opacity: 0; transition: opacity .18s; overflow-y: auto; }
.modal-wrap.show { opacity: 1; }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; display: flex; flex-direction: column; transform: translateY(10px); transition: transform .18s; max-height: none; }
.modal-wrap.show .modal { transform: none; }
.m-sm { max-width: 440px; } .m-md { max-width: 640px; } .m-lg { max-width: 860px; } .m-xl { max-width: 1040px; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; }
.modal-head h3 { font-size: 17px; font-weight: 800; flex: 1; }
.modal-body { padding: 18px 22px; }
.modal-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; border-top: 1px solid var(--line-2); flex-wrap: wrap; }
.lightbox { display: grid; place-items: center; background: #1b1f1d; border-radius: 12px; min-height: 300px; }
.lightbox img { max-width: 100%; max-height: 75vh; display: block; }
.pdf-frame { width: 100%; height: 75vh; border: 0; border-radius: 12px; background: #f0f0f0; }

/* detail */
.detail-top { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--line-2); margin-bottom: 16px; flex-wrap: wrap; }
.detail-top .big { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; }
.dl div small { display: block; color: var(--muted); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.dl div b { font-weight: 600; word-break: break-word; }
.dl .full { grid-column: 1 / -1; }
.sec-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 0 10px; display: flex; align-items: center; gap: 8px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.gal-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface-2); position: relative; }
.gal-item button.view { display: block; width: 100%; height: 100px; padding: 0; border: 0; background: #eee; cursor: zoom-in; }
.gal-item img { width: 100%; height: 100%; object-fit: cover; }
.gal-item .pdfph { width: 100%; height: 100%; display: grid; place-items: center; color: var(--neg); font-weight: 700; background: var(--neg-soft); }
.gal-item .cap { padding: 6px 8px; font-size: 11.5px; }
.gal-item .cap b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gal-item .rm { position: absolute; top: 4px; right: 4px; background: rgba(255,255,255,.92); width: 26px; height: 26px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding-bottom: 12px; position: relative; }
.timeline li::before { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--brand-2); margin-top: 5px; }
.timeline li::after { content: ''; position: absolute; left: 4.5px; top: 17px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .t1 { font-weight: 600; }
.timeline .t2 { font-size: 12px; color: var(--muted); }
.timeline .chg { font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.timeline .chg code { background: var(--line-2); border-radius: 4px; padding: 0 4px; font-family: inherit; }

/* ---------- Toast ---------- */
#toasts { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); font-weight: 600; transform: translateX(20px); opacity: 0; transition: all .25s; max-width: 380px; }
.toast.show { transform: none; opacity: 1; }
.t-success .ic { color: #6ee7a8; }
.t-error { background: var(--neg); }
.t-info .ic { color: #93c5fd; }

/* ---------- Misc ---------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .empty-ic { width: 40px; height: 40px; color: #c9c2b2; }
.empty p { margin: 8px 0 2px; font-weight: 700; color: var(--ink-2); }
.loading { display: grid; place-items: center; padding: 60px; }
.spin { width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: sp .7s linear infinite; }
.spin.lg { width: 30px; height: 30px; border-width: 3px; color: var(--brand-2); }
@keyframes sp { to { transform: rotate(360deg); } }
.chart-box { position: relative; height: 280px; padding: 10px 16px 14px; }
.chart-box.sm { height: 240px; }
.legend-list { list-style: none; margin: 0; padding: 0 20px 16px; display: flex; flex-direction: column; gap: 7px; }
.legend-list li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 10px; align-items: center; font-size: 13px; }
.legend-list .sw { width: 10px; height: 10px; border-radius: 3px; }
.legend-list .pc { color: var(--muted); font-size: 12px; min-width: 42px; text-align: right; }
.bar-inline { height: 6px; border-radius: 3px; background: var(--line-2); overflow: hidden; min-width: 60px; }
.bar-inline i { display: block; height: 100%; border-radius: 3px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--info-soft); color: #1d4f86; font-size: 13px; }
.notice.warn { background: var(--warn-soft); color: #7a4f0e; }
.notice .ic { margin-top: 1px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; padding: 4px; background: var(--line-2); border-radius: 12px; scrollbar-width: none; }
.tabs button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs button.on { background: var(--surface); color: var(--brand); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.recon-card h3 { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.recon-card h3 .dot { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.recon-lines { margin-top: 14px; }
.recon-lines .ln { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; gap: 10px; }
.recon-lines .ln span { color: var(--ink-2); }
.recon-lines .ln.total { border-bottom: 0; border-top: 2px solid var(--ink); margin-top: 4px; padding-top: 12px; font-size: 17px; font-weight: 800; }
.recon-lines .ln.total span { color: var(--ink); }
.recon-check { margin-top: 14px; padding: 12px; background: var(--surface-2); border-radius: 12px; border: 1px solid var(--line-2); }
.diff-ok { color: var(--pos); font-weight: 700; }
.diff-bad { color: var(--neg); font-weight: 700; }
.aging { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.aging .ag { padding: 12px 14px; border-radius: 12px; }
.aging .ag small { display: block; font-weight: 700; font-size: 12px; }
.aging .ag b { font-size: 16px; font-variant-numeric: tabular-nums; }
.switch { position: relative; display: inline-block; width: 42px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cfcabd; border-radius: 24px; transition: .2s; cursor: pointer; }
.switch span::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--pos); }
.switch input:checked + span::before { transform: translateX(18px); }
.print-head { display: none; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: var(--brand); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ''; position: absolute; width: 520px; height: 520px; border-radius: 50%; border: 70px solid rgba(217, 151, 47, .16); right: -180px; bottom: -200px; }
.login-art h2 { font-size: 34px; line-height: 1.15; font-weight: 800; max-width: 420px; }
.login-art p { opacity: .75; max-width: 400px; }
.login-art .pts { display: flex; flex-direction: column; gap: 10px; margin-top: 26px; position: relative; z-index: 1; }
.login-art .pts div { display: flex; gap: 10px; align-items: center; font-weight: 500; }
.login-art .pts .ic { color: var(--accent); }
.login-form { display: grid; place-items: center; padding: 32px 20px; }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.login-box form { display: flex; flex-direction: column; gap: 14px; margin-top: 24px; }
.login-box .btn { padding: 12px; font-size: 15px; }
.login-err { background: var(--neg-soft); color: var(--neg); padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 13px; }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-main { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .22s; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; display: none; }
  .app.nav-open .scrim { display: block; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 14px 16px 0; }
  .view { padding: 14px 16px 90px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .fab { display: inline-flex; position: fixed; right: 18px; bottom: 18px; z-index: 30; width: 56px; height: 56px; border-radius: 50%; padding: 0; box-shadow: 0 8px 24px rgba(21, 74, 66, .4); }
  .fab .ic { width: 24px; height: 24px; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 600px) {
  .topbar h1 { font-size: 19px; }
  .topbar .actions .btn span.lbl { display: none; }
  .kpi .val { font-size: 18px; }
  .kpi { padding: 13px 14px; }
  .kpis { gap: 10px; }
  .form-grid, .dl { grid-template-columns: 1fr; }
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; }
  .aging { grid-template-columns: 1fr 1fr; }
  .filters > * { flex: 1 1 auto; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 6px 6px; }
  .detail-top .big { font-size: 23px; }
}

/* ---------- Print ---------- */
@media print {
  @page { size: A4 landscape; margin: 12mm; }
  body { background: #fff; font-size: 11px; }
  .sidebar, .topbar .actions, .filters, .fab, .no-print, .pager, .menu-btn, .tabs, #toasts { display: none !important; }
  .app { display: block; }
  .view, .topbar { padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .print-head { display: block; margin-bottom: 10px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .tbl th { position: static; }
  .chart-box { height: 220px; }
}
.mob-only { display: none; }
@media (max-width: 760px) { .mob-only { display: inline; } }
.kpis.k6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.kpis.k6 .val { font-size: 18px; }
.kpis.k-os { grid-template-columns: minmax(0, 1.3fr) minmax(0, 2fr); }
@media (max-width: 1280px) { .kpis.k6 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 960px) { .kpis.k-os { grid-template-columns: 1fr; } }
@media (max-width: 600px) { .kpis.k6 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .kpis.k6 .val { font-size: 15px; } }
/* elemen overlay tidak ikut grid layout */
.scrim { display: none; }
.btn.fab { display: none; position: fixed; }
@media (max-width: 960px) {
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 39; }
  .btn.fab:not(.hidden) { display: inline-flex; }
}
.icon-btn.menu-btn { display: none; }
@media (max-width: 960px) { .icon-btn.menu-btn { display: inline-grid; } }
.g-main > .card, .g-2 > .card { display: flex; flex-direction: column; }
.g-main > .card > .chart-box { flex: 1 1 auto; min-height: 280px; }
.tbl td.acts { padding-left: 4px; }
.tbl .detail-cell { max-width: 300px; min-width: 180px; }
.tbl td { padding: 10px 9px; font-size: 13.5px; }
.tbl th { padding: 10px 9px; }
.tbl .detail-cell { max-width: 240px; min-width: 160px; }
.aging .ag b { font-size: 15px; white-space: nowrap; }
.tbl .sub-date { display: block; font-size: 11.5px; color: var(--muted); }
@media (max-width: 600px) {
  .topbar { flex-wrap: wrap; }
  .topbar > div:nth-child(2) { flex: 1; min-width: 0; }
  .topbar .actions { width: 100%; margin-left: 0; }
  .topbar .actions .btn { flex: 1; padding: 8px 6px; }
  .tbl.responsive td.acts { text-align: left; }
}
