/* SIPS - Sistem Informasi Pembayaran Sekolah. Identitas visual mengikuti prototipe: sidebar slate gelap, aksen biru, kartu membulat. */
:root {
  --bg: #f8fafc; --card: #fff; --ink: #0f172a; --ink2: #475569; --mute: #94a3b8; --line: #e2e8f0; --line2: #f1f5f9;
  --nav: #0f172a; --nav2: #1e293b; --primary: #2563eb; --primary-d: #1d4ed8; --primary-soft: #eff6ff; --navy: #1e3a8a;
  --ok: #059669; --ok-soft: #ecfdf5; --warn: #d97706; --warn-soft: #fffbeb; --bad: #e11d48; --bad-soft: #fff1f2; --info: #0284c7; --info-soft: #f0f9ff;
  --radius: 16px; --shadow: 0 1px 2px rgba(15, 23, 42, .06); --c1: #2563eb; --c2: #f59e0b; --c3: #10b981; --c4: #8b5cf6;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--primary); }
.hidden { display: none !important; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.mute { color: var(--ink2); } .xs { font-size: 12px; } .sm { font-size: 13px; } .b { font-weight: 700; } .right { text-align: right; } .center { text-align: center; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
::-webkit-scrollbar { width: 8px; height: 8px; } ::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 9px; }

/* ---------- Layout */
#app { display: none; min-height: 100vh; }
#app.on { display: flex; }
.sidebar { width: 272px; background: var(--nav); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; z-index: 30; transition: transform .25s; }
.brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--nav2); }
.logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, #3b82f6, #1d4ed8); display: grid; place-items: center; overflow: hidden; flex-shrink: 0; font-size: 18px; }
.logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.brand h1 { font-size: 14px; font-weight: 700; line-height: 1.25; }
.brand p { font-size: 11px; color: #93c5fd; }
.userbox { margin: 12px; padding: 10px 12px; background: var(--nav2); border-radius: 12px; font-size: 12px; }
.userbox .role { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: rgba(37, 99, 235, .3); color: #93c5fd; margin-bottom: 4px; }
nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; }
nav .sec { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: #64748b; padding: 14px 10px 4px; font-weight: 700; }
nav a { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: #cbd5e1; text-decoration: none; font-size: 13px; font-weight: 500; margin: 1px 0; }
nav a i { width: 18px; text-align: center; color: #94a3b8; }
nav a:hover { background: var(--nav2); color: #fff; }
nav a.on { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(37, 99, 235, .35); } nav a.on i { color: #fff; }
.side-foot { padding: 12px 18px; border-top: 1px solid var(--nav2); font-size: 11px; color: #94a3b8; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(255, 255, 255, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); padding: 10px 24px; display: flex; align-items: center; gap: 12px; }
.topbar h2 { font-size: 17px; font-weight: 700; } .topbar .sub { font-size: 12px; color: var(--ink2); }
.topbar .grow { flex: 1; min-width: 0; }
.content { padding: 24px; max-width: 1600px; width: 100%; margin: 0 auto; flex: 1; }
.foot { padding: 14px 24px; font-size: 12px; color: var(--mute); text-align: center; border-top: 1px solid var(--line); }
.burger { display: none; }
.overlay { display: none; position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 25; }
.avatar { width: 34px; height: 34px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.user-menu { position: relative; }
.dropdown { position: absolute; right: 0; top: 44px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(15, 23, 42, .15); min-width: 200px; padding: 6px; z-index: 40; }
.dropdown button { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.dropdown button:hover { background: var(--line2); }

/* ---------- Komponen */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card + .card, .stack > * + * { margin-top: 18px; }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-h h3 { font-size: 15px; font-weight: 700; } .card-h p { font-size: 12px; color: var(--ink2); }
.grid { display: grid; gap: 16px; } .g2 { grid-template-columns: repeat(2, 1fr); } .g3 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(4, 1fr); } .g6 { grid-template-columns: repeat(6, 1fr); }
.g-main { grid-template-columns: 2fr 1fr; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; } .row.between { justify-content: space-between; } .grow { flex: 1; }
.kpi { padding: 14px 16px; } .kpi .l { font-size: 12px; font-weight: 600; color: var(--ink2); display: flex; justify-content: space-between; align-items: center; }
.kpi .ic { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; font-size: 12px; background: var(--primary-soft); color: var(--primary); }
.kpi .v { font-size: 20px; font-weight: 800; margin-top: 6px; overflow-wrap: anywhere; } .kpi .s { font-size: 11px; color: var(--ink2); margin-top: 2px; }
.kpi.ok .ic { background: var(--ok-soft); color: var(--ok); } .kpi.warn .ic { background: var(--warn-soft); color: var(--warn); } .kpi.bad .ic { background: var(--bad-soft); color: var(--bad); }
.hero { background: linear-gradient(120deg, #0f172a, #172554 55%, #1e40af); color: #fff; border-radius: var(--radius); padding: 20px 22px; display: flex; justify-content: space-between; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero h3 { font-size: 19px; } .hero p { color: #bfdbfe; font-size: 13px; margin-top: 4px; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 8px 14px; border-radius: 10px; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; line-height: 1.2; min-height: 36px; }
.btn:hover { background: var(--line2); } .btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; } .btn.primary:hover { background: var(--primary-d); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; } .btn.danger { background: #fff; color: var(--bad); border-color: #fecdd3; } .btn.danger:hover { background: var(--bad-soft); }
.btn.dark { background: rgba(255, 255, 255, .12); border-color: rgba(255, 255, 255, .25); color: #fff; } .btn.dark:hover { background: rgba(255, 255, 255, .2); }
.btn.sm { padding: 5px 10px; font-size: 12px; min-height: 30px; border-radius: 8px; } .btn.icon { padding: 6px 9px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; background: var(--line2); color: var(--ink2); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: #047857; } .badge.warn { background: var(--warn-soft); color: #b45309; } .badge.bad { background: var(--bad-soft); color: #be123c; } .badge.info { background: var(--info-soft); color: #0369a1; }
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-size: 13px; font-weight: 600; color: var(--ink2); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-color: var(--primary); }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; } .field > label { font-size: 12px; font-weight: 700; color: #334155; }
.field .hint { font-size: 11px; color: var(--ink2); } .field.err input, .field.err select, .field.err textarea { border-color: var(--bad); } .field .emsg { font-size: 11px; color: var(--bad); font-weight: 600; }
input, select, textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 10px; padding: 8px 11px; background: #fff; font-size: 13px; min-height: 36px; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 99, 235, .35); border-color: var(--primary); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; accent-color: var(--primary); }
textarea { min-height: 80px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; } .form-grid .full { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; } .filters .field { min-width: 140px; flex: 1 1 140px; max-width: 240px; }
.filters .field.search { flex: 2 1 220px; max-width: 360px; }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { background: #f8fafc; text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line2); vertical-align: top; } .tbl tr:last-child td { border-bottom: 0; } .tbl tbody tr:hover { background: #f8fafc; }
.tbl tfoot td { background: var(--primary-soft); font-weight: 700; border-top: 1px solid var(--line); }
.tbl td.right, .tbl th.right { text-align: right; } .tbl td.act { white-space: nowrap; text-align: right; }
.tbl tr.void td { color: var(--mute); text-decoration: line-through; } .tbl tr.void td.act, .tbl tr.void td .badge { text-decoration: none; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; color: var(--ink2); }
.empty { text-align: center; padding: 36px 16px; color: var(--ink2); } .empty i { font-size: 30px; color: #cbd5e1; margin-bottom: 8px; display: block; }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; display: inline-block; }
.loading { display: flex; justify-content: center; padding: 40px; } @keyframes spin { to { transform: rotate(360deg); } }
#topbar-loader { position: fixed; top: 0; left: 0; height: 3px; background: var(--primary); width: 0; z-index: 99; transition: width .3s; }
.alert { padding: 12px 14px; border-radius: 12px; font-size: 13px; border: 1px solid; display: flex; gap: 10px; } .alert.info { background: var(--info-soft); border-color: #bae6fd; color: #075985; }
.alert.warn { background: var(--warn-soft); border-color: #fde68a; color: #92400e; } .alert.bad { background: var(--bad-soft); border-color: #fecdd3; color: #9f1239; } .alert.ok { background: var(--ok-soft); border-color: #a7f3d0; color: #065f46; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; } .progress > div { height: 100%; background: var(--ok); }
.list-plain { list-style: none; margin: 0; padding: 0; } .list-plain li { padding: 10px 0; border-bottom: 1px solid var(--line2); display: flex; justify-content: space-between; gap: 10px; } .list-plain li:last-child { border: 0; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; font-size: 13px; } .kv dt { color: var(--ink2); } .kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
pre.json { background: #0f172a; color: #e2e8f0; border-radius: 10px; padding: 10px; font-size: 11px; overflow: auto; max-height: 240px; white-space: pre-wrap; word-break: break-word; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink2); margin-top: 8px; } .legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; }
svg.chart text { font-size: 10px; fill: #64748b; } svg.chart .grid-l { stroke: #e2e8f0; stroke-width: 1; }
.qris { max-width: 220px; border: 1px solid var(--line); border-radius: 12px; padding: 8px; background: #fff; } .qris img { width: 100%; display: block; }

/* ---------- Modal & toast */
#modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .6); z-index: 60; display: none; align-items: flex-start; justify-content: center; padding: 24px 12px; overflow-y: auto; }
#modal-bg.on { display: flex; }
#modal { background: #fff; border-radius: 18px; width: 100%; max-width: 680px; box-shadow: 0 24px 60px rgba(0, 0, 0, .35); overflow: hidden; margin: auto; }
#modal.lg { max-width: 920px; } #modal.sm { max-width: 460px; }
.m-h { background: var(--nav); color: #fff; padding: 14px 18px; display: flex; justify-content: space-between; align-items: center; gap: 10px; } .m-h h3 { font-size: 15px; }
.m-h button { background: none; border: 0; color: #cbd5e1; font-size: 18px; cursor: pointer; padding: 4px 8px; }
.m-b { padding: 18px; max-height: 74vh; overflow-y: auto; } .m-f { padding: 12px 18px; background: #f8fafc; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
#toasts { position: fixed; top: 14px; right: 14px; z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100vw - 28px)); }
.toast { background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok); border-radius: 12px; padding: 11px 14px; box-shadow: 0 10px 30px rgba(15, 23, 42, .18); font-size: 13px; display: flex; gap: 10px; animation: fade .25s; }
.toast.bad { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); } .toast.info { border-left-color: var(--info); }
@keyframes fade { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Login */
#login { min-height: 100vh; display: none; place-items: center; padding: 18px; background: linear-gradient(135deg, #020617, #172554 55%, #1e3a8a); }
#login.on { display: grid; }
.login-box { width: 100%; max-width: 900px; display: grid; grid-template-columns: 5fr 7fr; background: #fff; border-radius: 24px; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .4); }
.login-l { background: var(--nav); color: #fff; padding: 32px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.login-l h2 { font-size: 22px; line-height: 1.3; margin: 18px 0 10px; } .login-l p { color: #cbd5e1; font-size: 13px; }
.login-l li { font-size: 12px; color: #cbd5e1; list-style: none; display: flex; gap: 10px; margin-top: 10px; } .login-l li i { color: #60a5fa; width: 16px; }
.login-r { padding: 36px; display: flex; flex-direction: column; justify-content: center; gap: 16px; } .login-r h3 { font-size: 22px; }
.pw { position: relative; } .pw button { position: absolute; right: 6px; top: 4px; background: none; border: 0; padding: 7px; cursor: pointer; color: var(--ink2); }

/* ---------- Kuitansi & cetak */
.receipt { border: 2px solid #0f172a; border-radius: 12px; padding: 20px; background: #fff; color: #0f172a; font-size: 12px; }
.receipt .kop { display: flex; justify-content: space-between; gap: 14px; border-bottom: 2px solid #0f172a; padding-bottom: 12px; margin-bottom: 12px; align-items: center; }
.receipt .kop .id { display: flex; gap: 12px; align-items: center; } .receipt .kop img { width: 54px; height: 54px; object-fit: contain; }
.receipt h4 { font-size: 14px; text-transform: uppercase; } .receipt .ttl { background: #0f172a; color: #fff; padding: 3px 10px; border-radius: 6px; font-weight: 700; display: inline-block; font-size: 11px; letter-spacing: .05em; }
.receipt table { width: 100%; border-collapse: collapse; margin: 10px 0; } .receipt th { background: #0f172a; color: #fff; padding: 6px 8px; text-align: left; } .receipt td { padding: 6px 8px; border-bottom: 1px solid #e2e8f0; }
.receipt .tot td { background: #eff6ff; font-weight: 800; border-top: 1px solid #0f172a; }
.receipt .void { border: 2px solid #be123c; color: #be123c; padding: 6px; text-align: center; font-weight: 800; border-radius: 8px; margin-bottom: 10px; }
.receipt .sign { display: flex; justify-content: space-between; align-items: flex-end; margin-top: 18px; gap: 20px; } .receipt .sign .ttd { text-align: center; min-width: 170px; } .receipt .sign .ttd .sp { height: 54px; }
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; padding: 0; } body { background: #fff; }
  .no-print { display: none !important; } .receipt { border-radius: 0; }
  .rep-print table { width: 100%; border-collapse: collapse; font-size: 10px; } .rep-print th, .rep-print td { border: 1px solid #94a3b8; padding: 3px 5px; } .rep-print th { background: #e2e8f0; }
}

/* ---------- Responsif */
@media (max-width: 1100px) { .g6 { grid-template-columns: repeat(3, 1fr); } .g4 { grid-template-columns: repeat(2, 1fr); } .g-main { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); } .sidebar.open { transform: none; } .overlay.on { display: block; }
  .burger { display: inline-flex; } .content { padding: 14px; } .topbar { padding: 8px 14px; } .g3 { grid-template-columns: repeat(2, 1fr); }
  .login-box { grid-template-columns: 1fr; } .login-l { padding: 22px; } .login-r { padding: 24px; } .hide-m { display: none !important; }
}
@media (max-width: 640px) {
  .g2, .g3, .g4, .g6, .form-grid { grid-template-columns: 1fr; } .g6, .g4 { grid-template-columns: repeat(2, 1fr); } .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; }
  .filters .field { max-width: none; flex-basis: 100%; }
  .tbl.stack thead { display: none; } .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; width: 100%; }
  .tbl.stack tr { border-bottom: 8px solid var(--line2); padding: 6px 0; } .tbl.stack td { border: 0; display: flex; justify-content: space-between; gap: 12px; padding: 4px 12px; text-align: right !important; }
  .tbl.stack td::before { content: attr(data-label); color: var(--ink2); font-weight: 600; text-align: left; flex-shrink: 0; font-size: 12px; }
  .tbl.stack td.act { justify-content: flex-end; flex-wrap: wrap; } .tbl.stack td.act::before { display: none; } .tbl.stack tfoot td { display: flex; }
  .tbl-wrap { border: 0; } .m-b { padding: 14px; } .topbar .sub { display: none; }
}

/* Tambahan halaman kasir/transaksi */
.pick { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: var(--ink); }
.pick:hover { border-color: var(--primary); background: var(--line2); }
.row-void td { opacity: .55; text-decoration: line-through; } .row-void td.act, .row-void td:last-child, .row-void td:nth-last-child(2) { text-decoration: none; }
.btn.lg { padding: 12px 20px; font-size: 15px; }
.kpi-inline { font-size: 14px; }
.hidden { display: none !important; }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0; }
code.var { background: var(--line2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-size: 12px; cursor: pointer; }
