/* =====================================================================
   Fusion Finance — Design System
   Navy #0F172A · Secondary #172B46 · Cyan #22D3EE · Background #F8FAFC
   Hijau/kuning/merah HANYA untuk status.
   ===================================================================== */
@import url('../vendor/inter.css');

:root {
  --navy: #0F172A;
  --navy-2: #172B46;
  --cyan: #22D3EE;
  --cyan-strong: #0891B2;

  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --surface-2: #F1F5F9;
  --surface-hover: #F8FAFC;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;
  --text: #0F172A;
  --text-2: #334155;
  --muted: #64748B;
  --faint: #94A3B8;

  --primary: var(--navy);
  --primary-text: #FFFFFF;
  --primary-hover: #1E293B;
  --accent: var(--cyan);
  --accent-text: var(--cyan-strong);
  --focus: rgba(34, 211, 238, .55);

  --success: #15803D; --success-bg: #ECFDF3; --success-border: #BBF7D0;
  --warning: #B45309; --warning-bg: #FFFBEB; --warning-border: #FDE68A;
  --danger: #B91C1C;  --danger-bg: #FEF2F2;  --danger-border: #FECACA;
  --info-bg: #ECFEFF;

  --sidebar-bg: var(--navy);
  --sidebar-text: #CBD5E1;
  --sidebar-muted: #64748B;
  --sidebar-active: rgba(34, 211, 238, .12);

  --radius: 12px;
  --radius-sm: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, .25);
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --sidebar-w: 252px;
  --topbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1120; --surface: #101A2E; --surface-2: #15223A; --surface-hover: #132036;
    --border: #1F2E48; --border-strong: #2B3D5C; --text: #E2E8F0; --text-2: #CBD5E1; --muted: #8B9BB4; --faint: #5B6B85;
    --primary: var(--cyan); --primary-text: #0F172A; --primary-hover: #67E8F9; --accent-text: var(--cyan);
    --success: #4ADE80; --success-bg: rgba(34,197,94,.1); --success-border: rgba(34,197,94,.25);
    --warning: #FBBF24; --warning-bg: rgba(245,158,11,.1); --warning-border: rgba(245,158,11,.25);
    --danger: #F87171; --danger-bg: rgba(239,68,68,.1); --danger-border: rgba(239,68,68,.25);
    --info-bg: rgba(34,211,238,.08);
    --sidebar-bg: #0B1324; --sidebar-active: rgba(34,211,238,.14);
    --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0A1120; --surface: #101A2E; --surface-2: #15223A; --surface-hover: #132036;
  --border: #1F2E48; --border-strong: #2B3D5C; --text: #E2E8F0; --text-2: #CBD5E1; --muted: #8B9BB4; --faint: #5B6B85;
  --primary: var(--cyan); --primary-text: #0F172A; --primary-hover: #67E8F9; --accent-text: var(--cyan);
  --success: #4ADE80; --success-bg: rgba(34,197,94,.1); --success-border: rgba(34,197,94,.25);
  --warning: #FBBF24; --warning-bg: rgba(245,158,11,.1); --warning-border: rgba(245,158,11,.25);
  --danger: #F87171; --danger-bg: rgba(239,68,68,.1); --danger-border: rgba(239,68,68,.25);
  --info-bg: rgba(34,211,238,.08);
  --sidebar-bg: #0B1324; --sidebar-active: rgba(34,211,238,.14);
  --shadow: 0 1px 2px rgba(0,0,0,.3); --shadow-lg: 0 24px 48px -12px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* ------------------------------------------------------------------ base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--text);
  background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: 'cv11', 'ss01';
}
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
h1 { font-size: 22px; } h2 { font-size: 17px; } h3 { font-size: 15px; } h4 { font-size: 13px; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.icon { width: 18px; height: 18px; flex-shrink: 0; stroke-width: 1.9; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.xs { font-size: 11.5px; }
.strong { font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.text-in { color: var(--success); }
.text-out { color: var(--danger); }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-sm { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ------------------------------------------------------------------ layout */
.app { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar-bg);
  display: flex; flex-direction: column; z-index: 40; border-right: 1px solid rgba(255,255,255,.04);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; color: #fff; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--navy-2); display: grid; place-items: center;
  border: 1px solid rgba(34,211,238,.35); color: var(--cyan);
}
.brand-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11.5px; color: var(--sidebar-muted); }
.nav { padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; flex: 1; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 14px 10px 6px; font-weight: 600; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--sidebar-text); font-weight: 500; font-size: 13.5px; text-decoration: none; position: relative;
}
.nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; }
.nav a.active::before { content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--cyan); }
.nav a.active .icon { color: var(--cyan); }
.nav .badge-count { margin-left: auto; background: rgba(239,68,68,.18); color: #FCA5A5; font-size: 11px; padding: 1px 7px; border-radius: 999px; font-weight: 600; }
.sidebar-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.06); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-sm); color: var(--sidebar-text); }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--navy-2); color: var(--cyan); display: grid; place-items: center;
  font-weight: 600; font-size: 12.5px; flex-shrink: 0; border: 1px solid rgba(34,211,238,.25);
}
.user-chip .name { color: #fff; font-weight: 500; font-size: 13px; }
.user-chip .role { font-size: 11.5px; color: var(--sidebar-muted); }
.icon-btn-dark { margin-left: auto; background: none; border: 0; color: var(--sidebar-muted); padding: 6px; border-radius: 8px; cursor: pointer; display: grid; place-items: center; }
.icon-btn-dark:hover { color: #fff; background: rgba(255,255,255,.06); }

.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 32px; position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .page-title { font-size: 16px; font-weight: 600; }
.topbar .crumb { color: var(--muted); font-size: 12.5px; }
.content { padding: 28px 32px 48px; max-width: 1320px; width: 100%; margin: 0 auto; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 4px; }
.mobile-only { display: none !important; }

/* ------------------------------------------------------------------ surfaces */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 14.5px; }
.card-head .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-foot { padding: 12px 20px; border-top: 1px solid var(--border); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.divider { height: 1px; background: var(--border); margin: 4px 0; }

.stat { padding: 18px 20px; }
.stat .label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.stat .value { font-size: 22px; font-weight: 650; margin-top: 8px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-2); }
.stat-icon.in { background: var(--success-bg); color: var(--success); }
.stat-icon.out { background: var(--danger-bg); color: var(--danger); }
.stat-icon.warn { background: var(--warning-bg); color: var(--warning); }

.hero {
  background: var(--navy); color: #fff; border-radius: var(--radius-lg); padding: 22px 24px; position: relative; overflow: hidden;
  border: 1px solid #1E293B;
}
.hero::after { content: ''; position: absolute; left: 24px; right: 24px; bottom: 0; height: 2px; background: var(--cyan); opacity: .9; border-radius: 2px 2px 0 0; }
.hero .label { color: #94A3B8; font-size: 12.5px; font-weight: 500; display: flex; align-items: center; gap: 8px; }
.hero .value { font-size: 32px; font-weight: 700; letter-spacing: -0.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.hero .meta { display: flex; gap: 18px; margin-top: 14px; font-size: 12.5px; color: #CBD5E1; flex-wrap: wrap; }
.hero .meta b { color: #fff; font-weight: 600; }
.hero .meta .up { color: #4ADE80; } .hero .meta .down { color: #FCA5A5; }
:root[data-theme="dark"] .hero { background: var(--navy-2); border-color: #23395C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero { background: var(--navy-2); border-color: #23395C; } }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 550; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none !important;
  transition: background .12s, border-color .12s, color .12s; user-select: none;
}
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-danger-ghost { background: transparent; color: var(--danger); border-color: var(--danger-border); }
.btn-danger-ghost:hover { background: var(--danger-bg); }
.btn-success { background: #15803D; color: #fff; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 18px; font-size: 14.5px; }
.btn-block { width: 100%; }
.btn-icon { width: 36px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn[disabled], .btn.loading { opacity: .6; pointer-events: none; }
.btn.loading::after {
  content: ''; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label-text { font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error-text { font-size: 12px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); outline: none; transition: border-color .12s, box-shadow .12s;
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--cyan-strong); box-shadow: 0 0 0 3px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.select { appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 17px) 17px, calc(100% - 12px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
.input-sm, .select-sm { height: 34px; font-size: 13px; }
.input-money { font-size: 20px; font-weight: 650; height: 50px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.input-group { position: relative; }
.input-group .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.input-group .input { padding-left: 36px; }
.input-prefix { position: relative; }
.input-prefix span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; }
.input-prefix .input { padding-left: 44px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .span-2 { grid-column: span 2; }
.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--navy); }
:root[data-theme="dark"] .checkbox input { accent-color: var(--cyan); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar .input-group { flex: 1; min-width: 200px; max-width: 340px; }
.toolbar > .select { width: auto; min-width: 150px; flex: 0 1 auto; }
.toolbar .row-sm > .input, .toolbar .row-sm > .select { width: auto; }
.toolbar > .row-sm.grow > .select { flex: 1; width: auto; min-width: 0; }
.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; border: 1px solid var(--border); }
.segmented button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; white-space: nowrap; }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; font-weight: 550;
  cursor: pointer; color: var(--text-2);
}
.chip:hover { border-color: var(--cyan-strong); }
.chip.active { border-color: var(--navy); background: var(--navy); color: #fff; }
:root[data-theme="dark"] .chip.active { background: var(--cyan); border-color: var(--cyan); color: var(--navy); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs button {
  border: 0; background: none; padding: 10px 12px; font-weight: 550; font-size: 13.5px; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: flex; align-items: center; gap: 8px;
}
.tabs button.active { color: var(--text); border-bottom-color: var(--cyan); }

/* ------------------------------------------------------------------ table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; font-weight: 550; font-size: 12px; color: var(--muted); padding: 10px 16px; background: var(--surface-2);
  border-bottom: 1px solid var(--border); white-space: nowrap; text-transform: none;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-hover); }
.table tr.void td { color: var(--faint); }
.table tr.void .amount { text-decoration: line-through; }
.table .amount { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.table th.right { text-align: right; }
.table tfoot td { font-weight: 650; background: var(--surface-2); }
.cell-main { font-weight: 550; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

/* ------------------------------------------------------------------ badges */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.plain::before { display: none; }
.badge-success { background: var(--success-bg); color: var(--success); border-color: var(--success-border); }
.badge-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-border); }
.badge-danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-border); }
.badge-neutral { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.badge-info { background: var(--info-bg); color: var(--accent-text); border-color: rgba(34,211,238,.3); }

/* ------------------------------------------------------------------ lists */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .grow .title { font-weight: 550; font-size: 13.5px; }
.list-item .grow .sub { font-size: 12px; color: var(--muted); }
.tx-dot { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex-shrink: 0; }
.tx-dot.in { background: var(--success-bg); color: var(--success); }
.tx-dot.out { background: var(--danger-bg); color: var(--danger); }
.tx-dot.adj { background: var(--surface-2); color: var(--muted); }

.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; display: flex; }
.progress > span { display: block; height: 100%; }
.progress .p-paid { background: #22C55E; }
.progress .p-partial { background: #F59E0B; }
.progress .p-cyan { background: var(--cyan); }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }

.kv { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }

.callout { display: flex; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--info-bg); border: 1px solid rgba(34,211,238,.25); font-size: 13px; color: var(--text-2); }
.callout .icon { color: var(--accent-text); margin-top: 1px; }
.callout.warn { background: var(--warning-bg); border-color: var(--warning-border); }
.callout.warn .icon { color: var(--warning); }
.callout.danger { background: var(--danger-bg); border-color: var(--danger-border); }
.callout.danger .icon { color: var(--danger); }

/* ------------------------------------------------------------------ empty / loading */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-icon { width: 44px; height: 44px; border-radius: 12px; margin: 0 auto 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--muted); }
.empty h3 { color: var(--text); font-size: 14.5px; margin-bottom: 4px; }
.empty p { font-size: 13px; max-width: 360px; margin: 0 auto; }
.empty .btn { margin-top: 14px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 0%, var(--border) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sk-line { height: 12px; margin: 8px 0; }
.sk-block { height: 96px; }
.page-loading { display: grid; gap: 16px; }
@media (prefers-reduced-motion: reduce) { .skeleton, .btn.loading::after { animation: none; } }

/* ------------------------------------------------------------------ modal */
dialog.modal {
  border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden;
}
dialog.modal:not([open]) { display: none; }
dialog.modal.wide { width: min(820px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(2, 6, 23, .55); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 16px; }
.modal-head p { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }

/* ------------------------------------------------------------------ toast */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--navy); color: #fff;
  box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .18s ease-out; border-left: 3px solid var(--cyan);
}
.toast.success { border-left-color: #22C55E; } .toast.error { border-left-color: #EF4444; } .toast.warning { border-left-color: #F59E0B; }
.toast .icon { margin-top: 1px; }
.toast.success .icon { color: #4ADE80; } .toast.error .icon { color: #F87171; } .toast.warning .icon { color: #FBBF24; } .toast.info .icon { color: var(--cyan); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ bills picker */
.bill-list { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; padding-right: 2px; }
.bill-option { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; }
.bill-option:hover { border-color: var(--border-strong); }
.bill-option.selected { border-color: var(--cyan-strong); background: var(--info-bg); }
.bill-group-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 8px 0 2px; }

/* Quick collection */
.qc-card { padding: 24px; }
.qc-name { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.qc-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.qc-actions .btn { height: 54px; flex-direction: column; gap: 2px; font-size: 13px; }
.qc-actions .btn small { font-weight: 500; opacity: .8; font-size: 11.5px; }
.qc-queue .list-item { padding: 10px 16px; cursor: pointer; }
.qc-queue .list-item.current { background: var(--info-bg); }
.qc-queue .list-item.done .title { color: var(--muted); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal .dow { font-size: 11.5px; color: var(--muted); text-align: center; padding: 4px 0; font-weight: 600; }
.cal .day { min-height: 64px; border: 1px solid var(--border); border-radius: 9px; padding: 6px; font-size: 12px; background: var(--surface); display: flex; flex-direction: column; gap: 3px; }
.cal .day.out { opacity: .4; }
.cal .day.in-week { background: var(--surface-2); }
.cal .day.today { border-color: var(--cyan-strong); box-shadow: inset 0 0 0 1px var(--cyan-strong); }
.cal .day .d { font-weight: 600; color: var(--text-2); }
.cal .day .due { font-size: 10.5px; padding: 2px 5px; border-radius: 6px; background: var(--navy); color: #fff; font-weight: 600; }
:root[data-theme="dark"] .cal .day .due { background: var(--cyan); color: var(--navy); }
.cal .day .due.past { background: var(--surface-2); color: var(--muted); }

/* Report preview (kertas) */
.paper { background: #fff; color: #0F172A; border: 1px solid var(--border); border-radius: var(--radius); padding: 32px; }
.paper h1 { color: #0F172A; font-size: 20px; }
.paper .paper-head { border-bottom: 3px solid var(--cyan); padding-bottom: 14px; margin-bottom: 18px; }
.paper .table th { background: #172B46; color: #fff; }
.paper .table td { color: #0F172A; border-color: #E2E8F0; }
.paper .table tfoot td { background: #E6FAFD; }
.paper .sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.paper .sum-box { border-radius: 10px; padding: 12px 14px; background: #F1F5F9; }
.paper .sum-box .l { font-size: 12px; color: #64748B; }
.paper .sum-box .v { font-size: 17px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.paper .sum-box.in { background: #EAF7EF; } .paper .sum-box.in .v { color: #166534; }
.paper .sum-box.out { background: #FDEEEE; } .paper .sum-box.out .v { color: #991B1B; }
.paper .sum-box.strong { background: #E6FAFD; }
.paper .sum-box.warn { background: #FEF6E7; } .paper .sum-box.warn .v { color: #92400E; }
.paper h3 { color: #0F172A; margin: 22px 0 8px; padding-bottom: 6px; border-bottom: 1px solid #E2E8F0; }
.paper .muted { color: #64748B; }
.paper tr.t-in td { background: #F3FBF6; } .paper tr.t-out td { background: #FEF6F6; } .paper tr.t-void td { color: #94A3B8; font-style: italic; }
.sign { display: flex; justify-content: flex-end; margin-top: 36px; }
.sign div { text-align: center; min-width: 200px; }
.sign .space { height: 64px; }

/* Login */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-aside { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-aside::after { content: ''; position: absolute; left: 48px; bottom: 48px; width: 64px; height: 3px; background: var(--cyan); border-radius: 3px; }
.auth-aside h1 { color: #fff; font-size: 30px; line-height: 1.2; letter-spacing: -0.03em; max-width: 420px; }
.auth-aside p { color: #94A3B8; max-width: 400px; margin-top: 12px; font-size: 14.5px; }
.auth-points { display: grid; gap: 14px; margin-top: 36px; }
.auth-points div { display: flex; gap: 12px; align-items: flex-start; color: #CBD5E1; font-size: 13.5px; }
.auth-points .icon { color: var(--cyan); margin-top: 1px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-size: 22px; letter-spacing: -0.02em; }
.auth-card .sub { color: var(--muted); margin: 6px 0 24px; }
.brand.flush { padding: 0; }
.big-amount { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat-inline { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.legend .lg-paid { background: #22C55E; } .legend .lg-partial { background: #F59E0B; } .legend .lg-unpaid { background: var(--border-strong); }
.grid-kpi { display: grid; gap: 16px; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
.grid-kpi > .span-hero .hero { height: 100%; }
@media (max-width: 1180px) {
  .grid-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-kpi > .span-hero { grid-column: span 3; }
}
@media (max-width: 767px) {
  .grid-kpi { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .grid-kpi > .span-hero { grid-column: span 2; }
  .grid-kpi > :last-child { grid-column: span 2; }
}
.center-icon { margin: 0 auto 10px; }
.link-btn { background: none; border: 0; padding: 0; cursor: pointer; text-align: left; color: var(--text); font-weight: 550; }
.link-btn:hover { color: var(--accent-text); text-decoration: underline; }
.qc-custom-btn { align-self: flex-end; }
.legend .lg-week { background: var(--surface-2); border: 1px solid var(--border-strong); }
.legend .lg-due { background: var(--primary); }
.code-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 11.5px; overflow: auto; max-height: 280px; margin: 6px 0 0; white-space: pre-wrap; word-break: break-word; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; background: var(--surface-2); padding: 1px 5px; border-radius: 5px; }
.qr { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--border); }
.mt-16 { margin-top: 16px; }
.mt-8 { margin-top: 8px; }
.mt-4 { margin-top: 4px; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 42px; }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); background: none; border: 0; color: var(--muted); padding: 6px; cursor: pointer; border-radius: 8px; }

/* Mobile navigation */
.mobile-bar { display: none; }
.bottom-nav { display: none; }
.sheet-backdrop { display: none; }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1023px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .sheet-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(2,6,23,.5); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .content { padding: 20px 16px 96px; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; color: var(--muted); padding: 6px 2px;
    background: none; border: 0; text-decoration: none; font-weight: 550; cursor: pointer; border-radius: 10px;
  }
  .bottom-nav .active { color: var(--text); }
  .bottom-nav .active .icon { color: var(--accent-text); }
  .bottom-nav .fab .icon-wrap { width: 40px; height: 40px; margin-top: -18px; border-radius: 12px; background: var(--primary); color: var(--primary-text); display: grid; place-items: center; box-shadow: var(--shadow-lg); }
  .toasts { bottom: 84px; right: 16px; left: 16px; max-width: none; }
}
@media (max-width: 767px) {
  body { font-size: 14.5px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat .value { font-size: 18px; }
  .hero .value { font-size: 28px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2 { grid-column: auto; }
  .page-head h1 { font-size: 20px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .toolbar .input-group { max-width: none; min-width: 100%; }
  .toolbar > .select, .toolbar > .segmented { flex: 1; }
  .card-head, .card-body, .list-item { padding-left: 16px; padding-right: 16px; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  /* Tabel -> kartu di layar kecil */
  .table.responsive thead { display: none; }
  .table.responsive, .table.responsive tbody, .table.responsive tr, .table.responsive td { display: block; width: 100%; }
  .table.responsive tr { padding: 12px 16px; border-bottom: 1px solid var(--border); }
  .table.responsive td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .table.responsive td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-align: left; font-weight: 500; flex-shrink: 0; }
  .table.responsive td.td-main { display: block; text-align: left; padding-bottom: 6px; }
  .table.responsive td.td-main::before { display: none; }
  .table.responsive td.amount { text-align: right; }
  .table.responsive tfoot { display: block; }
  .table.responsive tfoot tr { display: flex; justify-content: space-between; }
  dialog.modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 16px 16px 0 0; }
  .auth-page { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .qc-actions .btn { height: 58px; }
  .paper { padding: 18px; }
  .paper .sum-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ------------------------------------------------------------------ print */
@media print {
  @page { size: A4; margin: 14mm; }
  body { background: #fff; color: #000; font-size: 11px; }
  .sidebar, .topbar, .bottom-nav, .toasts, .no-print, .page-head .actions, .report-controls { display: none !important; }
  .main { margin: 0; }
  .content { padding: 0; max-width: none; }
  .paper { border: 0; padding: 0; }
  .card { box-shadow: none; }
  .table th { background: #172B46 !important; color: #fff !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper .sum-box, .paper tr td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .table tr { break-inside: avoid; }
}
