:root {
	--bg: #f4f6fb;
	--card-border: #e6e9f0;
	--ink: #111827;
	--muted: #6b7280;
	--brand: #2563eb;
	--brand-soft: #e8efff;
	--ok: #16a34a;
	--warn: #d97706;
	--warn-soft: #fff4e0;
	--bad: #dc2626;
	--radius: 14px;
}

body {
	background: var(--bg);
	color: var(--ink);
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: .94rem;
}

.num { font-variant-numeric: tabular-nums; }
.tiny { font-size: .74rem; }
.min-w-0 { min-width: 0; }

/* Navbar */
.app-nav { background: #fff; border-bottom: 1px solid var(--card-border); }
.app-nav .navbar-brand { font-weight: 700; letter-spacing: -.01em; display: flex; align-items: center; gap: .5rem; }
.app-nav .nav-link { color: var(--muted); border-radius: 8px; padding: .4rem .75rem !important; font-weight: 500; }
.app-nav .nav-link:hover { color: var(--ink); background: #f3f4f6; }
.app-nav .nav-link.active { color: var(--brand); background: var(--brand-soft); }
.brand-mark {
	display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 8px;
	background: var(--brand); color: #fff; font-weight: 800; font-size: .95rem;
}
.brand-mark-lg { width: 52px; height: 52px; border-radius: 14px; font-size: 1.5rem; }

/* Kartu */
.card { border: 1px solid var(--card-border); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(16, 24, 40, .04); }
.card-header { background: transparent; border-bottom: 1px solid var(--card-border); font-weight: 600; padding: .85rem 1.1rem; }
.card > .table-responsive { border-radius: var(--radius); }

.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; }
.periode-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.periode-bar input[type=date] { width: 140px; }

/* KPI */
.kpi .card-body { padding: 1.1rem 1.2rem; }
.kpi-label { color: var(--muted); font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.kpi-value { font-size: clamp(1.15rem, 2.2vw, 1.6rem); font-weight: 700; margin-top: .35rem; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-sub { color: var(--muted); font-size: .8rem; margin-top: .15rem; }
.kpi-primary { background: linear-gradient(135deg, #1d4ed8, #2563eb 60%, #3b82f6); color: #fff; border: 0; }
.kpi-primary .kpi-label, .kpi-primary .kpi-sub { color: rgba(255, 255, 255, .8); }
.kpi-warning { background: var(--warn-soft); border-color: #fcd9a5; color: var(--ink); }
a.kpi:hover { border-color: #c7d2fe; }

.chart-box { position: relative; height: 300px; }

/* Tabel */
.table { --bs-table-bg: transparent; margin: 0; }
.table > thead th { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .03em; font-weight: 600; background: #fafbfd; border-bottom-color: var(--card-border); white-space: nowrap; }
.table > tfoot th { background: #fafbfd; }
.table td, .table th { padding: .6rem .9rem; }
tr[data-href] { cursor: pointer; }
.row-cek > td { background: #fffaf0 !important; }
.row-cek > td:first-child { box-shadow: inset 3px 0 0 var(--warn); }
.trx-table .row-hari > td { border-top: 2px solid #e3e7ef; }

.badge-pinjol { font-weight: 600; font-size: .74rem; padding: .38em .6em; border-radius: 6px; letter-spacing: .01em; color: #fff; }
.badge-kosong { background: #e5e7eb !important; color: #4b5563 !important; }

.btn-warning-soft { background: var(--warn-soft); color: #9a5b00; border: 1px solid #fcd9a5; }
.btn-warning-soft:hover { background: #ffe8c2; color: #7c4900; }

.filter-bar { padding: .9rem 1rem; }

/* Upload */
.dropzone { border: 2px dashed #c7cfdd; background: #fbfcfe; cursor: pointer; transition: border-color .15s, background .15s, transform .15s; }
.dropzone:hover, .dropzone:focus { border-color: var(--brand); background: #f5f8ff; outline: none; }
.dropzone.drag { border-color: var(--brand); background: var(--brand-soft); transform: scale(1.005); }
.dz-icon { font-size: 3rem; color: var(--brand); }
.upload-item .thumb { width: 56px; height: 84px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--card-border); background: #f3f4f6; flex-shrink: 0; }
.upload-item .card-body { padding: .75rem .9rem; }

.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .2rem .6rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.chip-wait { background: #f3f4f6; color: #6b7280; }
.chip-proses { background: var(--brand-soft); color: var(--brand); }
.chip-ok { background: #e7f7ec; color: #15803d; }
.chip-cek { background: var(--warn-soft); color: #9a5b00; }
.chip-dup { background: #f1eefe; color: #5b21b6; }
.chip-gagal { background: #fdecec; color: #b91c1c; }

/* Form transaksi */
.shot-card { position: sticky; top: 80px; overflow: hidden; background: #e5e7eb; }
.shot-img { width: 100%; max-height: calc(100vh - 120px); object-fit: contain; display: block; }
.ocr-ok { color: var(--ok); }
.ocr-satu { color: #9ca3af; }
.ocr-beda { color: var(--warn); }
.ocr-kosong { color: var(--bad); }
.ocr-raw { white-space: pre-wrap; background: #fff; border: 1px solid var(--card-border); border-radius: 8px; padding: .75rem; max-height: 320px; overflow: auto; font-size: .78rem; }
.form-sticky { position: sticky; top: 80px; }

/* Login */
.auth-body { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 10% -10%, #dbe6ff, transparent), var(--bg); padding: 1rem; }
.auth-card { width: 100%; max-width: 420px; }

@media (max-width: 767.98px) {
	.chart-box { height: 240px; }
	.shot-card, .form-sticky { position: static; }
	.shot-img { max-height: 60vh; }
	.page-head { align-items: flex-start; }
	.periode-bar, .periode-bar .btn-group { width: 100%; }
	.periode-bar .btn-group { flex-wrap: nowrap !important; overflow-x: auto; }
	.periode-bar .btn-group .btn { white-space: nowrap; }
	.periode-bar input[type=date] { flex: 1; width: auto; }
}
