:root {
  --bg: #efe9dd;
  --canvas: #faf6ef;
  --surface: #ffffff;
  --pill-bg: #efe9dd;
  --ink: #231f1d;
  --muted: #78716c;
  --mint: #18b26b;
  --mint-soft: #dcfce7;
  --amber: #f59e0b;
  --amber-soft: #fef3c7;
  --coral: #ea580c;
  --rose: #e11d48;
  --rose-soft: #ffe4e6;
  --lilac-soft: #f3e8ff;
  --sky-soft: #e0f2fe;
  --border: #ede6da;
}

body.dark {
  --bg: #12100e;
  --canvas: #1c1917;
  --surface: #292524;
  --pill-bg: #342f2c;
  --ink: #faf6ef;
  --muted: #a8a29e;
  --border: #3f3a36;
}

body.elder-mode { font-size: 18px; }

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Plus Jakarta Sans", "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--ink);
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.shell {
  width: 100%;
  max-width: 460px;
  min-height: 100vh;
  background: var(--canvas);
  padding: 20px 18px 108px;
  box-shadow: 0 20px 55px rgba(35, 31, 29, 0.12);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.greeting-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--amber-soft);
  color: #92400e;
  font-weight: 800;
  display: grid;
  place-items: center;
}

.eyebrow {
  font-size: 0.76rem;
  color: var(--muted);
  font-weight: 600;
}

h1 { margin: 2px 0 0; font-size: 1.18rem; font-weight: 800; }
h2 { margin: 18px 0 10px; font-size: 0.94rem; font-weight: 800; color: var(--muted); }
h3 { margin: 0 0 6px; font-size: 0.96rem; font-weight: 800; }

.topbar-actions { display: flex; gap: 8px; }

.round-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 0;
  background: var(--pill-bg);
  color: var(--ink);
  cursor: pointer;
}

.persona-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 0 10px;
}

.chip {
  border: 0;
  background: var(--pill-bg);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}
.chip.active {
  background: var(--ink);
  color: #ffffff;
}

.segmented {
  display: inline-flex;
  background: var(--pill-bg);
  padding: 4px;
  border-radius: 999px;
  margin-bottom: 14px;
}
.segmented button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 7px 16px;
  border-radius: 999px;
  cursor: pointer;
}
.segmented button.active {
  background: var(--ink);
  color: #ffffff;
}

.tab-view { display: none; }
.tab-view.active { display: block; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 18px;
  margin-bottom: 12px;
}

.coach-card {
  background: var(--amber-soft);
  color: #451a03;
  border: 0;
  border-radius: 26px;
  padding: 16px;
  margin-bottom: 10px;
}

.hero-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.cashflow-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.cf-in { background: #f0fdf4; color: #15803d; padding: 10px 12px; border-radius: 18px; }
.cf-out { background: #fff1f2; color: #be123c; padding: 10px 12px; border-radius: 18px; }

/* 2-Column Bank Jago Kantong Grid */
.kantong-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.kantong-tile {
  border-radius: 26px;
  padding: 16px;
  min-height: 138px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #231f1d;
}
.kantong-tile.shared { background: #fff7ed; }
.kantong-tile.savings { background: #ecfdf5; }
.kantong-tile.personal { background: #f3e8ff; }
.kantong-tile.surprise { background: #fdf2f8; }

.kantong-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.8);
}

/* Money Lover Daily Grouped Ledger */
.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.day-num { font-size: 1.6rem; font-weight: 900; line-height: 1; }

.tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.84rem;
}

.cat-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  font-size: 0.78rem;
  flex-shrink: 0;
}

.btn-primary, .btn-outline {
  border-radius: 999px;
  padding: 9px 16px;
  font-weight: 800;
  cursor: pointer;
  font-size: 0.78rem;
}
.btn-primary { background: var(--ink); color: #ffffff; border: 0; }
.btn-outline { background: transparent; color: var(--ink); border: 1px solid var(--border); }

.muted { color: var(--muted); font-size: 0.8rem; margin: 4px 0; }

.bottom-nav {
  position: fixed;
  bottom: 0;
  width: 100%;
  max-width: 460px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr 68px 1fr 1fr;
  align-items: center;
  padding: 8px 10px 14px;
}
.nav-item {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.76rem;
  cursor: pointer;
  padding: 8px 4px;
}
.nav-item.active { color: var(--mint); font-weight: 800; }

.center-plus {
  width: 54px;
  height: 54px;
  margin: -24px auto 0;
  border-radius: 50%;
  border: 4px solid var(--canvas);
  background: var(--mint);
  color: #ffffff;
  font-size: 1.7rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 10px 22px rgba(24, 178, 107, 0.35);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(35, 31, 29, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
}
.hidden { display: none !important; }

.bottom-sheet {
  width: 100%;
  max-width: 460px;
  background: var(--canvas);
  border-radius: 30px 30px 0 0;
  padding: 16px 20px 28px;
}
.sheet-handle {
  width: 42px;
  height: 5px;
  border-radius: 99px;
  background: var(--muted);
  opacity: 0.35;
  margin: 0 auto 12px;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; font-weight: 700; }
input, select {
  padding: 10px 12px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
}
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

.toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: #231f1d;
  color: #faf6ef;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  z-index: 50;
}
