:root {
  --bg: #f4f7f6; --card: #ffffff; --text: #16211e; --muted: #62726d; --line: #e1e8e5;
  --brand: #0f9d7a; --brand-d: #0b7a5f; --brand-l: #e3f5ef;
  --red: #d64545; --red-l: #fdeaea; --amber: #c98a0b; --amber-l: #fdf3dc; --blue: #2f6fd1;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 40, 32, .06), 0 4px 14px rgba(16, 40, 32, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1513; --card: #16201d; --text: #e6efec; --muted: #8fa39d; --line: #263430;
    --brand: #2ec79f; --brand-d: #22a581; --brand-l: #12302a; --red: #ef6a6a; --red-l: #3a1d1d;
    --amber: #e5ad3a; --amber-l: #3a2d12; --blue: #6aa1f0; --shadow: none;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
a { color: var(--brand-d); }
button, input, select { font: inherit; color: inherit; }
.hidden { display: none !important; }
.wrap { max-width: 960px; margin: 0 auto; padding: 0 16px; }

/* tombol */
.btn { border: 1px solid var(--line); background: var(--card); padding: 10px 16px; border-radius: 10px; cursor: pointer; font-weight: 600; text-decoration: none; display: inline-block; text-align: center; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-d); }
.btn.danger { color: var(--red); }
.btn.ghost { background: transparent; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.block { display: block; width: 100%; }

/* form */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; font-weight: 600; }
input, select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
input:focus, select:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: transparent; }
.form-error { color: var(--red); font-size: 13px; min-height: 1.2em; margin: 10px 0 0; }
.form-ok { color: var(--brand-d); font-size: 13px; margin: 10px 0 0; }

/* kartu */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.grid3 > .card { margin-top: 0; }
.grid3 + .card { margin-top: 12px; }
.card h3 { font-size: 16px; }
.grid3 { display: grid; gap: 12px; grid-template-columns: repeat(3, 1fr); }
.stat { padding: 14px; }
.stat .lbl { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.stat .val { font-size: 19px; font-weight: 800; margin-top: 4px; word-break: break-word; }
.pos { color: var(--brand-d); } .neg { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

/* progress */
.bar { height: 9px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.bar.warn > i { background: var(--amber); } .bar.over > i { background: var(--red); }

/* lencana */
.badge { white-space: nowrap; display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--brand-l); color: var(--brand-d); }
.badge.warn { background: var(--amber-l); color: var(--amber); }
.badge.bad { background: var(--red-l); color: var(--red); }

/* landing */
.hero { padding: 40px 0 24px; }
.hero h1 { font-size: 32px; }
.hero p { color: var(--muted); font-size: 17px; max-width: 520px; }
.logo { font-weight: 800; font-size: 20px; color: var(--brand-d); letter-spacing: -.02em; }
.logo b { color: var(--text); }
.auth-grid { display: grid; gap: 20px; grid-template-columns: 1.1fr 1fr; align-items: start; }
.tabs { display: flex; gap: 6px; background: var(--bg); padding: 4px; border-radius: 10px; margin-bottom: 8px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 8px; font-weight: 700; cursor: pointer; color: var(--muted); }
.tabs button.on { background: var(--card); color: var(--text); box-shadow: var(--shadow); }
.features { list-style: none; padding: 0; margin: 20px 0 0; display: grid; gap: 10px; }
.features li { display: flex; gap: 10px; }
.features li::before { content: "✓"; color: var(--brand-d); font-weight: 800; }
.plans { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.plan { border: 2px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--card); }
.plan.best { border-color: var(--brand); }
.plan .price { font-size: 24px; font-weight: 800; margin: 6px 0; }
.demo-banner { background: var(--amber-l); color: var(--amber); padding: 8px 16px; font-size: 13px; text-align: center; font-weight: 600; }

/* aplikasi */
.topbar { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.nav { display: flex; gap: 4px; overflow-x: auto; padding: 8px 0; }
.nav button { border: 0; background: transparent; padding: 9px 14px; border-radius: 10px; font-weight: 700; cursor: pointer; color: var(--muted); white-space: nowrap; }
.nav button.on { background: var(--brand-l); color: var(--brand-d); }
main.wrap { padding-top: 16px; padding-bottom: 90px; }
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.month-nav strong { font-size: 17px; }
.status-bar { padding: 10px 14px; border-radius: 12px; margin-bottom: 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; font-size: 14px; background: var(--brand-l); color: var(--brand-d); }
.status-bar.warn { background: var(--amber-l); color: var(--amber); }
.status-bar.bad { background: var(--red-l); color: var(--red); }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t { font-weight: 600; overflow-wrap: anywhere; }
.list .amt { font-weight: 800; white-space: nowrap; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 6px; color: var(--muted); border-radius: 8px; font-size: 16px; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.empty { text-align: center; color: var(--muted); padding: 28px 8px; }
.fab { position: fixed; right: 16px; bottom: 18px; z-index: 15; box-shadow: 0 6px 18px rgba(15, 157, 122, .4); border-radius: 99px; padding: 14px 20px; }
.cat-row { margin: 10px 0; }
.cat-row .row { margin-bottom: 4px; }

/* modal */
dialog.modal { border: 0; border-radius: 16px; padding: 0; width: min(440px, calc(100vw - 24px)); background: var(--card); color: var(--text); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog.modal::backdrop { background: rgba(5, 15, 12, .5); }
.modal-form { padding: 20px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: #16211e; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 100; max-width: calc(100vw - 32px); font-size: 14px; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.err { background: var(--red); }

.pay-box { background: var(--bg); border: 1px dashed var(--line); border-radius: 12px; padding: 14px; }
.pay-box .big { font-size: 22px; font-weight: 800; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
table.t th { font-size: 12px; color: var(--muted); text-transform: uppercase; border-top: 0; }
.scroll-x { overflow-x: auto; }

.user-email { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 640px) {
  .user-email { display: none; }
  .grid3 { grid-template-columns: 1fr; }
  .auth-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 26px; }
  .stat { display: flex; justify-content: space-between; align-items: center; }
  .stat .val { margin: 0; }
}
