/* ============================================================
   Uangku — mobile-first, hangat & playful
   ============================================================ */
:root {
  --pink: #FF8FA3;
  --pink-dark: #E96D85;
  --orange: #FFB570;
  --yellow: #FFD166;
  --green: #4CAF7D;
  --green-bg: #E6F7EE;
  --amber: #F5A524;
  --amber-bg: #FFF6E0;
  --red: #F25C5C;
  --red-bg: #FDEAEA;
  --cream: #FFF8F1;
  --card: #FFFFFF;
  --ink: #3A2E2E;
  --ink-soft: #8A7B78;
  --border: #F1E4DC;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 4px 16px rgba(58, 46, 46, 0.06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--cream);
  position: relative;
}

.app-main {
  flex: 1;
  padding: 20px 16px 96px;
}

.auth-main {
  flex: 1;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* ---------- Typography ---------- */
h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; color: var(--ink-soft); font-weight: 600; }
p { line-height: 1.5; }
.subtle { color: var(--ink-soft); font-size: 14px; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-hero {
  background: linear-gradient(135deg, var(--pink) 0%, var(--orange) 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(255, 143, 163, 0.35);
}
.card-hero .hero-label { font-size: 14px; opacity: 0.9; margin-bottom: 6px; }
.card-hero .hero-amount { font-size: 30px; font-weight: 800; margin-bottom: 10px; letter-spacing: -0.5px; }
.card-hero .hero-sub { font-size: 15px; opacity: 0.95; }
.card-hero .hero-sub b { font-size: 18px; }

.balance-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.balance-row .label { font-size: 13px; color: var(--ink-soft); }
.balance-row .value { font-size: 19px; font-weight: 700; }

.summary-grid {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.summary-chip {
  flex: 1;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.summary-chip .chip-label { font-size: 12px; color: var(--ink-soft); }
.summary-chip .chip-value { font-size: 16px; font-weight: 700; margin-top: 2px; }
.summary-chip.in .chip-value { color: var(--green); }
.summary-chip.out .chip-value { color: var(--red); }

/* ---------- Buttons ---------- */
.btn {
  display: block;
  width: 100%;
  text-align: center;
  padding: 15px 18px;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:active { background: var(--pink-dark); }
.btn-secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--border); }
.btn-outline { background: transparent; color: var(--pink-dark); border: 1.5px solid var(--pink); }
.btn-ghost { background: transparent; color: var(--ink-soft); font-weight: 600; }
.btn-danger { background: var(--red); color: #fff; }
.btn-sm { padding: 10px 14px; font-size: 14px; border-radius: 10px; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.big-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 8px;
}
.big-choice {
  background: var(--card);
  border-radius: var(--radius);
  padding: 26px 14px;
  text-align: center;
  box-shadow: var(--shadow);
  border: 2px solid transparent;
}
.big-choice.income { border-color: var(--green); }
.big-choice.expense { border-color: var(--red); }
.big-choice .choice-icon { font-size: 34px; display: block; margin-bottom: 8px; }
.big-choice .choice-label { font-weight: 700; font-size: 16px; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field .hint { font-size: 12px; color: var(--ink-soft); margin-top: 4px; }

input[type=text], input[type=email], input[type=password], input[type=date],
input[type=number], input[inputmode], select, textarea {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 16px;
  color: var(--ink);
  font-family: inherit;
}
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); }

.amount-input-wrap {
  display: flex;
  align-items: center;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 0 16px;
}
.amount-input-wrap .prefix { font-size: 18px; font-weight: 700; color: var(--ink-soft); margin-right: 4px; }
.amount-input-wrap input {
  border: none; padding: 14px 0; font-size: 20px; font-weight: 700;
}
.amount-input-wrap input:focus { outline: none; }

.chip-select { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-option {
  padding: 10px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.chip-option input { display: none; }
.chip-option.selected { background: var(--pink); border-color: var(--pink); color: #fff; }

/* ---------- Budget items ---------- */
.budget-item {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.budget-item.nested { margin-left: 18px; border-left: 3px solid var(--border); }
.budget-item-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.budget-item-head .name { font-weight: 700; font-size: 15px; }
.budget-period-row { margin-bottom: 8px; }
.budget-period-row .bp-top { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.budget-period-row .bp-top .bp-label { color: var(--ink-soft); }
.progress-bar { height: 8px; border-radius: 6px; background: var(--border); overflow: hidden; }
.progress-bar > div { height: 100%; border-radius: 6px; }
.status-safe .progress-bar > div, .badge-safe { background: var(--green); }
.status-warning .progress-bar > div, .badge-warning { background: var(--amber); }
.status-danger .progress-bar > div, .badge-danger { background: var(--red); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; color: #fff; }
.friendly-msg { font-size: 13px; margin-top: 10px; padding: 8px 10px; border-radius: 10px; }
.friendly-msg.status-safe { background: var(--green-bg); color: #2E7D53; }
.friendly-msg.status-warning { background: var(--amber-bg); color: #8A5A00; }
.friendly-msg.status-danger { background: var(--red-bg); color: #B23A3A; }

/* ---------- List items (riwayat, wishlist) ---------- */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow);
}
.list-item .li-left { display: flex; gap: 12px; align-items: center; }
.list-item .li-icon { font-size: 22px; }
.list-item .li-title { font-weight: 700; font-size: 14px; }
.list-item .li-sub { font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.list-item .li-amount { font-weight: 700; font-size: 15px; }
.list-item .li-amount.in { color: var(--green); }
.list-item .li-amount.out { color: var(--red); }

.filter-tabs { display: flex; gap: 8px; margin-bottom: 16px; overflow-x: auto; }
.filter-tab {
  padding: 8px 14px; border-radius: 999px; background: #fff; border: 1.5px solid var(--border);
  font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.filter-tab.active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Coret-coret ---------- */
.scribble-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.scribble-row input[type=text] { flex: 2; }
.scribble-row .sign-toggle { flex: 0 0 44px; text-align: center; font-weight: 800; font-size: 18px; background: #fff; border: 1.5px solid var(--border); border-radius: 10px; padding: 12px 0; }
.scribble-row .sign-toggle.plus { color: var(--green); }
.scribble-row .sign-toggle.minus { color: var(--red); }
.scribble-row input[inputmode=numeric] { flex: 1.4; text-align: right; }
.scribble-row .row-del { flex: 0 0 36px; text-align: center; color: var(--ink-soft); font-size: 18px; background: none; border: none; cursor: pointer; }
.scribble-total { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 4px; font-size: 18px; font-weight: 800; border-top: 2px dashed var(--border); margin-top: 8px; }

/* ---------- Toast / flash ---------- */
.toast {
  position: sticky; top: 12px; z-index: 20;
  margin: 0 0 12px; padding: 12px 16px; border-radius: 12px; font-size: 14px; font-weight: 600;
}
.toast-success { background: var(--green-bg); color: #2E7D53; }
.toast-info { background: #E7F0FF; color: #2E5FA3; }
.toast-warning { background: var(--amber-bg); color: #8A5A00; }
.toast-error { background: var(--red-bg); color: #B23A3A; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px;
  background: #fff;
  display: flex;
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  z-index: 30;
}
.nav-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; border-radius: 12px; color: var(--ink-soft); }
.nav-item.active { color: var(--pink-dark); background: #FFF0F3; }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; font-weight: 600; }

/* ---------- Auth pages ---------- */
.auth-logo { text-align: center; font-size: 40px; margin-bottom: 6px; }
.auth-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.auth-sub { text-align: center; color: var(--ink-soft); font-size: 14px; margin-bottom: 28px; }
.auth-links { text-align: center; margin-top: 16px; font-size: 14px; }

/* ---------- Empty state ---------- */
.empty-state { text-align: center; padding: 40px 16px; color: var(--ink-soft); }
.empty-state .emoji { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---------- FAB / add link ---------- */
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.link-add { color: var(--pink-dark); font-weight: 700; font-size: 14px; }

.progress-wrap { margin-top: 10px; }
