@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --b1: #0A1628;   /* navy gelap */
  --b2: #1340A6;   /* biru royal */
  --b3: #1A6FD4;   /* biru cobalt */
  --b4: #3EA8F5;   /* biru langit */
  --b5: #7FCFFF;   /* biru muda */
  --b6: #C8E9FF;   /* biru sangat muda */
  --b7: #EBF5FF;   /* hampir putih */
  --white: #FFFFFF;
  --inc: #0D7A4E;
  --inc-bg: #D6F5E9;
  --exp: #B91C1C;
  --exp-bg: #FEE2E2;
  --border: rgba(26,111,212,.15);
  --shadow-sm: 0 1px 4px rgba(10,22,40,.08);
  --shadow-md: 0 4px 16px rgba(10,22,40,.12);
  --shadow-lg: 0 8px 32px rgba(10,22,40,.16);
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  font-size: 16px;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--b7);
  color: var(--b1);
  min-height: 100vh;
  width: 100%;
  margin: 0 auto;
  position: relative;
  padding-bottom: 90px;
}

/* ── SCREENS ─────────────────────────────── */
.screen { display: none; flex-direction: column; min-height: 100vh; }
.screen.active { display: flex; }

/* ── LOGIN ───────────────────────────────── */
#screen-login {
  background: linear-gradient(160deg, var(--b2) 0%, var(--b3) 45%, var(--b4) 100%);
  justify-content: flex-end;
  padding: 0;
}
.login-hero {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem 2rem;
  color: var(--white);
}
.login-logo {
  width: 72px; height: 72px;
  background: rgba(255,255,255,.18);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  margin-bottom: 1.25rem;
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255,255,255,.25);
}
.login-hero h1 { font-size: 26px; font-weight: 700; margin-bottom: .4rem; }
.login-hero p { font-size: 14px; opacity: .8; }
.login-sheet {
  background: var(--white);
  border-radius: 28px 28px 0 0;
  padding: 2rem 1.5rem 2.5rem;
  box-shadow: 0 -4px 32px rgba(10,22,40,.15);
}
.login-tab-row {
  display: flex; gap: 0;
  background: var(--b7);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 1.5rem;
}
.tab-btn {
  flex: 1; padding: 9px; border: none; background: none;
  border-radius: 10px; font-size: 14px; font-weight: 600;
  font-family: inherit; color: var(--b3); cursor: pointer;
  transition: all .2s;
}
.tab-btn.active {
  background: var(--white);
  color: var(--b2);
  box-shadow: var(--shadow-sm);
}
.form-wrap { display: none; }
.form-wrap.active { display: block; }
.f-group { margin-bottom: 1rem; }
.f-label { font-size: 12px; font-weight: 600; color: var(--b3); margin-bottom: 6px; display: block; letter-spacing: .04em; text-transform: uppercase; }
.f-input {
  width: 100%; padding: 12px 14px;
  border: 1.5px solid var(--b6);
  border-radius: var(--r-sm);
  font-size: 15px; font-family: inherit;
  background: var(--b7); color: var(--b1);
  outline: none; transition: border-color .2s, background .2s;
}
.f-input:focus { border-color: var(--b3); background: var(--white); }
.btn-primary {
  width: 100%; padding: 13px;
  background: linear-gradient(135deg, var(--b2), var(--b3));
  color: var(--white); border: none;
  border-radius: var(--r-sm); font-size: 15px; font-weight: 700;
  font-family: inherit; cursor: pointer; letter-spacing: .02em;
  transition: opacity .2s, transform .15s;
  box-shadow: 0 4px 16px rgba(26,111,212,.35);
}
.btn-primary:active { transform: scale(.98); opacity: .9; }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.f-alert {
  font-size: 13px; padding: 10px 12px; border-radius: 8px;
  margin-bottom: 1rem; display: none;
}
.f-alert.error { background: var(--exp-bg); color: var(--exp); display: block; }
.f-alert.success { background: var(--inc-bg); color: var(--inc); display: block; }

/* ── TOPBAR ──────────────────────────────── */
.topbar {
  background: linear-gradient(135deg, var(--b2) 0%, var(--b3) 100%);
  padding: 1rem 1.25rem .9rem;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 2px 12px rgba(10,22,40,.2);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; }
.topbar-brand { display: flex; align-items: center; gap: 8px; color: var(--white); }
.topbar-icon { font-size: 20px; }
.topbar-title { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.user-chip {
  background: rgba(255,255,255,.15);
  color: var(--white); border-radius: 20px;
  padding: 5px 12px; font-size: 13px; font-weight: 600;
  max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.btn-logout {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(255,255,255,.15); border: 1.5px solid rgba(255,255,255,.25);
  color: var(--white); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(255,255,255,.25); }

/* ── HERO BALANCE ────────────────────────── */
.balance-hero {
  background: linear-gradient(160deg, var(--b2) 0%, var(--b3) 60%, var(--b4) 100%);
  padding: 1.5rem 1.25rem 2.5rem;
  color: var(--white);
  position: relative;
  overflow: hidden;
}
.balance-hero::before {
  content: '';
  position: absolute; top: -40px; right: -40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,.06);
  border-radius: 50%;
}
.balance-hero::after {
  content: '';
  position: absolute; bottom: -20px; left: -20px;
  width: 100px; height: 100px;
  background: rgba(255,255,255,.04);
  border-radius: 50%;
}
.balance-label { font-size: 13px; opacity: .75; font-weight: 500; margin-bottom: 6px; }
.balance-amount { font-size: 36px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 1.25rem; }
.balance-amount.negative { color: #fca5a5; }
.summary-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; position: relative; z-index: 1; }
.sum-card {
  background: rgba(255,255,255,.14);
  backdrop-filter: blur(8px);
  border-radius: var(--r-md);
  padding: 12px 14px;
  border: 1px solid rgba(255,255,255,.2);
}
.sum-card-label { font-size: 11px; opacity: .75; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.sum-card-val { font-size: 17px; font-weight: 700; }

/* ── CONTENT AREA ────────────────────────── */
.content { padding: 1.25rem; margin-top: -18px; }

/* ── CARD ────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  margin-bottom: 1.25rem;
  overflow: hidden;
  border: 1px solid var(--b6);
}
.card-header {
  padding: .9rem 1.25rem;
  font-size: 12px; font-weight: 700;
  color: var(--b3); text-transform: uppercase;
  letter-spacing: .06em; border-bottom: 1px solid var(--b7);
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 1.25rem; }

/* ── FORM ADD ────────────────────────────── */
.inp-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.inp-full { margin-bottom: 10px; }
.inp-label { font-size: 11px; font-weight: 700; color: var(--b3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; display: block; }
.inp {
  width: 100%; padding: 11px 13px;
  border: 1.5px solid var(--b6); border-radius: var(--r-sm);
  font-size: 14px; font-family: inherit;
  background: var(--b7); color: var(--b1);
  outline: none; transition: border-color .2s;
}
.inp:focus { border-color: var(--b3); background: var(--white); }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.btn-inc {
  padding: 12px 8px;
  background: linear-gradient(135deg, #0ea96a, #059952);
  color: var(--white); border: none; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 3px 10px rgba(14,169,106,.3);
}
.btn-exp {
  padding: 12px 8px;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: var(--white); border: none; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: opacity .15s, transform .1s;
  box-shadow: 0 3px 10px rgba(220,38,38,.3);
}
.btn-inc:active, .btn-exp:active { transform: scale(.97); }
.btn-inc:disabled, .btn-exp:disabled { opacity: .5; cursor: not-allowed; }
.form-msg { font-size: 13px; color: var(--exp); margin-top: 8px; min-height: 16px; }

/* ── FILTER BAR ──────────────────────────── */
.filter-wrap {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--b7);
  align-items: center;
}
.chip {
  padding: 6px 14px; border-radius: 20px;
  border: 1.5px solid var(--b6);
  background: var(--b7); color: var(--b3);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .15s;
}
.chip.active {
  background: linear-gradient(135deg, var(--b2), var(--b3));
  color: var(--white); border-color: transparent;
  box-shadow: 0 2px 8px rgba(26,111,212,.3);
}
.cat-select {
  padding: 6px 10px; border-radius: 20px;
  border: 1.5px solid var(--b6); background: var(--b7);
  color: var(--b3); font-size: 13px; font-weight: 600;
  font-family: inherit; outline: none;
}

/* ── TRANSACTION LIST ────────────────────── */
.tx-list { max-height: 380px; overflow-y: auto; }
.tx-item {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 1.25rem;
  border-bottom: 1px solid var(--b7);
  transition: background .1s;
  animation: slidein .2s ease-out;
}
@keyframes slidein { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:none; } }
.tx-item:last-child { border-bottom: none; }
.tx-item:active { background: var(--b7); }
.tx-icon {
  width: 40px; height: 40px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.tx-icon.income { background: var(--inc-bg); }
.tx-icon.expense { background: var(--exp-bg); }
.tx-info { flex: 1; min-width: 0; }
.tx-name { font-size: 14px; font-weight: 600; color: var(--b1); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-meta { font-size: 11px; color: var(--b4); margin-top: 2px; display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.cat-tag {
  padding: 2px 7px; border-radius: 8px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em;
}
.cat-tag.income { background: var(--inc-bg); color: var(--inc); }
.cat-tag.expense { background: var(--exp-bg); color: var(--exp); }
.tx-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex-shrink: 0; }
.tx-amount { font-size: 15px; font-weight: 700; }
.tx-amount.income { color: var(--inc); }
.tx-amount.expense { color: var(--exp); }
.tx-del {
  width: 26px; height: 26px; border-radius: 7px;
  border: 1px solid var(--b6); background: none;
  cursor: pointer; font-size: 13px; color: var(--b4);
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.tx-del:hover { background: var(--exp-bg); color: var(--exp); border-color: #fca5a5; }
.empty { padding: 2.5rem 1.25rem; text-align: center; color: var(--b4); font-size: 14px; }
.empty-icon { font-size: 36px; margin-bottom: 8px; opacity: .5; }

/* ── CHART ───────────────────────────────── */
.cat-chart { display: flex; gap: 8px; align-items: flex-end; height: 80px; padding: 0 .25rem; }
.bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bars { display: flex; gap: 3px; align-items: flex-end; height: 60px; }
.bar { width: 13px; border-radius: 4px 4px 0 0; min-height: 2px; transition: height .35s; }
.bar.inc { background: linear-gradient(to top, var(--b2), var(--b4)); }
.bar.exp { background: linear-gradient(to top, #ef4444, #fca5a5); }
.bar-lbl { font-size: 9px; color: var(--b4); font-weight: 600; white-space: nowrap; }

/* ── BOTTOM NAV ──────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--b6);
  display: flex; padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom));
  z-index: 100; box-shadow: 0 -4px 20px rgba(10,22,40,.1);
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 8px 4px; border: none; background: none;
  cursor: pointer; border-radius: var(--r-sm); transition: all .15s;
  font-family: inherit; color: var(--b5);
}
.nav-btn.active { color: var(--b2); }
.nav-btn .nav-icon { font-size: 22px; }
.nav-btn .nav-lbl { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }

/* ── TABS in app ──────────────────────────── */
.app-tab { display: none; }
.app-tab.active { display: block; }

/* ── SCROLLBAR ───────────────────────────── */
.tx-list::-webkit-scrollbar { width: 3px; }
.tx-list::-webkit-scrollbar-track { background: transparent; }
.tx-list::-webkit-scrollbar-thumb { background: var(--b5); border-radius: 4px; }
