:root {
  --bg: #f4f6f5; --card: #ffffff; --text: #1a2421; --muted: #6b7b76; --border: #e2e8e5;
  --primary: #0f766e; --primary-dark: #0b5c56; --danger: #b91c1c;
  --warn: #b45309; --warn-bg: #fef3c7; --masuk: #0f766e; --keluar: #b91c1c; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding-bottom: 78px; min-height: 100vh; }
h1, h2, h3 { margin: 0 0 8px; }
button, input, select, textarea { font-family: inherit; font-size: 16px; }
a { color: var(--primary); }
.container { padding: 12px 16px 16px; max-width: 900px; margin: 0 auto; }
.muted { color: var(--muted); font-size: 13px; font-weight: 400; }

/* ---- Topbar + strip ringkas ---- */
.topbar { background: var(--card); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px 8px; max-width: 900px; margin: 0 auto; }
.brand { font-size: 16px; font-weight: 700; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions a { color: var(--muted); font-size: 13px; text-decoration: none; }
.btn-add { min-height: 40px; padding: 0 14px; border-radius: 10px; border: none; background: var(--primary);
  color: #fff; font-size: 14px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn-add:active { background: var(--primary-dark); }
.summary-strip { display: flex; gap: 8px; padding: 0 16px 10px; max-width: 900px; margin: 0 auto; }
.sum-item { flex: 1; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sum-label { font-size: 11px; color: var(--muted); white-space: nowrap; }
.sum-value { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sum-item:first-child .sum-value { font-size: 19px; }
.sum-value.masuk { color: var(--masuk); }
.sum-value.keluar { color: var(--keluar); }

/* ---- Cards ---- */
.card { background: var(--card); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; border: 1px solid var(--border); }
.card-row { display: flex; gap: 12px; }
.card .label { color: var(--muted); font-size: 13px; }
.card.warn { background: var(--warn-bg); border-color: #fde68a; }
.card.warn .label { color: var(--warn); font-weight: 600; }
.pos-item { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 15px; }
.pos-item:last-child { border-bottom: none; }
.pos-item .jumlah { font-weight: 600; }
.empty-state { color: var(--muted); font-size: 14px; padding: 12px 0; }
.info-msg { color: var(--muted); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* ---- Buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 20px;
  border-radius: 12px; border: none; background: var(--primary); color: #fff; font-size: 16px; font-weight: 600; cursor: pointer; width: 100%; }
.btn:active { background: var(--primary-dark); }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--border); width: auto; min-height: 40px; font-size: 14px; padding: 0 14px; }
.link-btn { background: none; border: none; color: var(--primary); font-size: 14px; cursor: pointer; padding: 6px 0; min-height: 32px; }

/* ---- Bottom nav ---- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom, 0); }
.bottom-nav a { flex: 1; text-align: center; padding: 10px 4px 8px; color: var(--muted); text-decoration: none; font-size: 12px; min-height: 44px; }
.bottom-nav a .icon { display: block; font-size: 20px; margin-bottom: 2px; }
.bottom-nav a.active { color: var(--primary); font-weight: 600; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-card { width: 100%; max-width: 360px; }
.login-card h1 { font-size: 22px; margin-bottom: 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field textarea { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.field textarea { min-height: 70px; resize: vertical; }
.error-msg { color: var(--danger); font-size: 14px; margin: 8px 0; min-height: 18px; }

/* ---- Form modal ---- */
.modal-overlay[hidden] { display: none; }
.modal-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 20, 18, .45); }
.modal-sheet { position: relative; width: 100%; max-width: 520px; margin: 0 auto; background: var(--card);
  border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 16px;
  position: sticky; top: 0; background: var(--card); z-index: 2; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 17px; }
.modal-close { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; min-width: 44px; min-height: 44px; }
.modal-body { padding: 0 16px; }
.modal-footer { display: flex; gap: 10px; padding: 16px; position: sticky; bottom: 0; background: var(--card);
  border-top: 1px solid var(--border); padding-bottom: calc(16px + env(safe-area-inset-bottom, 0)); }
.modal-footer .btn { width: auto; flex: 1; }
.nominal-field { text-align: center; padding: 10px 0 16px; }
.nominal-field .label { color: var(--muted); font-size: 14px; margin-bottom: 6px; }
.nominal-field input { width: 100%; border: none; background: transparent; text-align: center; font-size: 40px; font-weight: 700; color: var(--text); outline: none; }
.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: #fff; color: var(--text);
  font-size: 15px; cursor: pointer; display: inline-flex; align-items: center; }
.chip.selected { background: var(--primary); border-color: var(--primary); color: #fff; }
.section-label { font-size: 13px; color: var(--muted); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .02em; }
.rincian-toggle { background: none; border: none; color: var(--primary); font-size: 15px; padding: 12px 0; min-height: 44px; cursor: pointer; width: 100%; text-align: left; }
.rincian-body { display: none; }
.rincian-body.open { display: block; }
.checkbox-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.checkbox-row input { width: 20px; height: 20px; }
.placeholder-tab { padding: 40px 16px; text-align: center; color: var(--muted); }

/* ---- Filter & tabel ---- */
.filter-row { display: flex; gap: 8px; margin: 10px 0; }
.filter-row select { flex: 1; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.custom-range { display: flex; gap: 8px; margin: 10px 0; }
.custom-range input[type="date"] { flex: 1; min-height: 44px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); }
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 6px 0 10px; }
.toolbar-row input[type="month"] { min-height: 40px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--text); }
.daftar-total { font-size: 14px; }
.daftar-total strong { font-size: 19px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.data-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.data-table th, .data-table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; background: var(--bg); }
.data-table .num { text-align: right; }
.data-table tbody tr { cursor: pointer; }
.data-table tbody tr:active { background: var(--bg); }
.data-table .desc { max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
.data-table .desc .sub { display: none; font-size: 11px; color: var(--muted); font-weight: 400; }
.data-table td.total { font-weight: 600; }
.row-kosong td { color: var(--muted); }
.status-ok { color: var(--primary); font-weight: 700; }
.status-belum { color: var(--muted); }

/* Di HP kolom sekunder disembunyikan supaya tabel muat tanpa geser; tap baris untuk detail lengkap. */
@media (max-width: 640px) {
  .data-table .col-opt { display: none; }
  .data-table .desc { max-width: 165px; }
  .data-table .desc .sub { display: block; }
  .data-table th, .data-table td { padding: 8px 6px; }
}
