:root {
  --color-primary: #A78BFA;
  --color-primary-dark: #7C5FE0;
  --color-primary-soft: #F3EEFF;
  --color-bg: #FFF7FB;
  --color-card: #ffffff;
  --color-text: #4A4458;
  --color-text-muted: #A79BC0;
  --color-income: #4FCB92;
  --color-expense: #FF7A93;
  --color-border: #F0E6FA;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(167, 139, 250, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Quicksand', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  padding-bottom: 78px;
}

.app-header {
  background: linear-gradient(135deg, #B9A6FF 0%, #FFAAD4 100%);
  color: #fff;
  padding: 18px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 10px rgba(167, 139, 250, 0.25);
}
.app-header h1 { margin: 0; font-size: 21px; font-weight: 700; }

#app { padding: 16px; max-width: 480px; margin: 0 auto; }

.view.hidden { display: none; }
.hidden { display: none !important; }

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.screen-header h2 { margin: 0; font-size: 18px; font-weight: 700; color: var(--color-text); }

.btn {
  border: none;
  border-radius: 999px;
  padding: 11px 18px;
  font-size: 14px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:active { transform: scale(0.95); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-secondary { background: var(--color-primary-soft); color: var(--color-primary-dark); margin-right: 8px; margin-bottom: 8px; display: inline-block; }
.btn-danger { background: #FFE3EA; color: #E0507A; }
.btn-full { width: 100%; margin-top: 8px; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-back { background: none; border: none; color: var(--color-primary-dark); font-size: 14px; font-weight: 700; padding: 4px 0; cursor: pointer; font-family: inherit; }
.btn-half { flex: 1; }

.card-list { display: flex; flex-direction: column; gap: 10px; }

.budget-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: transform 0.12s ease;
}
.budget-card:active { transform: scale(0.98); }
.budget-card-top { display: flex; justify-content: space-between; margin-bottom: 6px; }
.budget-date { color: var(--color-text-muted); font-size: 12px; font-weight: 600; }
.budget-card-bottom { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; }

.budget-title-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.budget-title-row h2 { margin: 0; font-size: 19px; font-weight: 700; }
.budget-actions { display: flex; gap: 4px; }

.summary-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.summary-row { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; font-weight: 600; }
.summary-total { border-top: 2px dashed var(--color-border); margin-top: 4px; padding-top: 10px; font-size: 17px; }

.text-income { color: var(--color-income); }
.text-expense { color: var(--color-expense); }

.section-block { margin-bottom: 20px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.section-header h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--color-text); }

.item-list { display: flex; flex-direction: column; gap: 8px; }

.list-row {
  background: var(--color-card);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
}

.row-actions { display: flex; align-items: center; gap: 4px; }
.amount { font-weight: 700; margin-right: 4px; }

.icon-btn {
  border: none;
  background: none;
  font-size: 16px;
  cursor: pointer;
  padding: 5px;
  border-radius: 999px;
  transition: transform 0.12s ease, background 0.12s ease;
}
.icon-btn:active { transform: scale(0.9); background: var(--color-primary-soft); }

.category-groups { display: flex; flex-direction: column; gap: 12px; }
.category-group {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.category-group-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 2px dashed var(--color-border);
}
.category-row { background: none; box-shadow: none; padding: 4px 0; }
.subcategory-list { display: flex; flex-direction: column; gap: 4px; margin-left: 8px; }

.item-meta { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; font-weight: 600; }
.badge {
  background: #FFE9F3;
  color: #E0508B;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.empty-text { color: var(--color-text-muted); font-size: 14px; text-align: center; padding: 24px 0; font-weight: 600; }
.empty-text-small { color: var(--color-text-muted); font-size: 12px; padding: 4px 0; }

.chip-tabs { display: flex; gap: 8px; margin-bottom: 12px; overflow-x: auto; padding-bottom: 4px; }
.chip {
  border: 2px solid var(--color-border);
  background: var(--color-card);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease;
}
.chip:active { transform: scale(0.95); }
.chip-active { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.hint-text { font-size: 13px; color: var(--color-text-muted); margin-bottom: 10px; font-weight: 600; }

.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: #fff;
  display: flex;
  border-top: 2px solid var(--color-border);
  z-index: 20;
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: var(--color-text-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  font-family: inherit;
  transition: transform 0.12s ease;
}
.nav-btn:active { transform: scale(0.92); }
.nav-btn.active { color: var(--color-primary-dark); }
.nav-icon { font-size: 21px; transition: transform 0.15s ease; }
.nav-btn.active .nav-icon { transform: scale(1.15) translateY(-2px); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(122, 95, 224, 0.28);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 30;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: #fff;
  width: 100%;
  max-width: 480px;
  border-radius: 26px 26px 0 0;
  padding: 20px;
  max-height: 85vh;
  overflow-y: auto;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-header h3 { margin: 0; font-weight: 700; font-size: 17px; }
.modal-close { border: none; background: var(--color-primary-soft); color: var(--color-primary-dark); width: 30px; height: 30px; border-radius: 999px; font-size: 15px; cursor: pointer; }

form label { display: block; font-size: 13px; font-weight: 700; color: var(--color-text-muted); margin: 12px 0 5px; }
form input[type="text"], form input[type="number"], form input[type="date"], form select {
  width: 100%;
  padding: 11px 14px;
  border: 2px solid var(--color-border);
  border-radius: 14px;
  font-size: 14px;
  font-family: inherit;
  background: #FFFBFE;
}
form input:focus, form select:focus {
  outline: none;
  border-color: var(--color-primary);
}
.checkbox-label { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; color: var(--color-text); margin-top: 16px; }
.checkbox-label input { width: auto; }

.split-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.split-row span { flex: 1; font-size: 13px; font-weight: 600; }
.split-input { width: 110px !important; }

.split-remainder-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 700;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 2px dashed var(--color-border);
}
.form-error {
  color: #E0507A;
  background: #FFE3EA;
  font-size: 13px;
  font-weight: 700;
  padding: 10px 12px;
  border-radius: 14px;
  margin-top: 12px;
}

.modal-message { font-size: 14px; color: var(--color-text); line-height: 1.5; margin: 4px 0 0; font-weight: 600; }
.modal-btn-row { display: flex; gap: 10px; margin-top: 18px; }

.report-row {
  background: var(--color-card);
  border: 2px solid var(--color-border);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 8px;
}
.report-row-name { font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.report-row-figures { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.report-row-figures span { display: flex; justify-content: space-between; }
.report-row-total {
  background: var(--color-primary-soft);
  border: 2px solid var(--color-primary);
}

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--color-primary-dark);
  color: #fff;
  padding: 11px 20px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow);
  z-index: 40;
}
.toast.hidden { display: none; }

@media (min-width: 600px) {
  body { padding-bottom: 0; }
  .bottom-nav { max-width: 480px; margin: 0 auto; position: sticky; border-radius: 0 0 16px 16px; }
}

/* ---- Tambahan: pemilih bulan Perbelanjaan Harian ---- */
.month-filter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.month-filter-row label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  margin: 0;
}
.month-filter-row input[type="month"] {
  flex: 1;
  padding: 9px 14px;
  border: 2px solid var(--color-border);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  background: #FFFBFE;
  color: var(--color-text);
}
.month-filter-row input[type="month"]:focus {
  outline: none;
  border-color: var(--color-primary);
}
