:root {
  color-scheme: light;
  --bg: #f8f2f4;
  --surface: #ffffff;
  --surface-2: #f4e9ed;
  --ink: #2a171d;
  --muted: #8c7b81;
  --line: #efe2e7;
  --primary: #800020;
  --primary-dark: #4d0013;
  --primary-light: #a8324e;
  --primary-soft: #f5e4e8;
  --glow: rgba(128, 0, 32, .28);
  --accent: #800020;
  --accent-soft: #f9eef0;
  --good: #2f8f57;
  --good-soft: #e5f4ea;
  --red: #d63a3a;
  --red-soft: #fde8e8;
  --orange: #a8324e;
  --orange-soft: #f9e9ed;
  --radius: 18px;
  --display: "Bricolage Grotesque", Georgia, serif;
  --body: Figtree, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--body);
  font-size: 15px;
  background:
    linear-gradient(115deg, transparent 0%, transparent 30%, rgba(255, 255, 255, .55) 38%, transparent 46%, transparent 100%),
    linear-gradient(115deg, transparent 0%, transparent 58%, rgba(255, 255, 255, .45) 66%, transparent 74%, transparent 100%),
    radial-gradient(ellipse at 15% 10%, #f4f2f6 0%, transparent 55%),
    radial-gradient(ellipse at 85% 90%, #c9c5d0 0%, transparent 60%),
    linear-gradient(135deg, #e6e3ea 0%, #d3d0da 50%, #c5c2cd 100%);
  background-attachment: fixed;
  color: var(--ink);
  display: flex;
  justify-content: center;
  align-items: center;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { display: block; flex-shrink: 0; }
h1, h2, h3, h4, .amount, .amt, .display {
  font-family: var(--display);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.grow { flex: 1; min-width: 0; }

/* ---------- Frame ---------- */
.phone {
  position: relative;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  background: 
    radial-gradient(circle at 95% 0%, rgba(160, 40, 80, .2) 0%, transparent 38%),
    radial-gradient(circle at 0% 35%, rgba(200, 120, 150, .2) 0%, transparent 35%),
    radial-gradient(circle at 100% 75%, rgba(190, 110, 140, .16) 0%, transparent 35%),
    linear-gradient(180deg, #fdf8fa 0%, #f8eff3 100%);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.screen {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: calc(16px + env(safe-area-inset-top)) 16px 110px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.page { width: 100%; margin: 0 auto; }
.desk-only { display: none !important; }
.screen::-webkit-scrollbar { display: none; }

/* ---------- Bottom nav ---------- */
.bottom-nav {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: calc(68px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 5;
}
.nav-item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #a8979d;
  padding: 6px 0;
}
.nav-item.active { color: var(--primary); font-weight: 700; }
.nav-dot {
  position: absolute;
  top: 3px; left: calc(50% + 6px);
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--surface);
}
.nav-center {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  margin-top: -30px;
  border-radius: 18px;
  border: 4px solid var(--bg);
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 22px var(--glow);
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.topbar h1 { font-size: 20px; font-weight: 700; flex: 1; }
.greet small { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.greet h2 { font-size: 22px; font-weight: 800; }
.top-actions { display: flex; gap: 10px; align-items: center; }
.icon-btn {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--ink);
}
.icon-btn.plain { border: 0; background: transparent; }
.badge {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 19px; height: 19px;
  padding: 0 5px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  border: 2px solid var(--bg);
}
.avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary-light);
  border: 1px solid #ecc9d4;
  font-family: var(--display);
  font-weight: 800;
  display: grid;
  place-items: center;
}
.avatar.lg { width: 60px; height: 60px; font-size: 24px; position: relative; }
.avatar.xl { width: 84px; height: 84px; font-size: 32px; }
.avatar.ring-w { width: 50px; height: 50px; font-size: 20px; }
.avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.avatar-cam {
  position: absolute;
  right: -2px; bottom: -2px;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  border: 2px solid var(--surface);
  display: grid;
  place-items: center;
}
.photo-edit { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.photo-actions { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.photo-actions .btn { padding: 11px; font-size: 14px; }

/* ---------- Dark summary cards ---------- */
.hero, .progress-card {
  background:
    radial-gradient(circle at 90% 5%, rgba(255, 255, 255, .22) 0%, transparent 45%),
    linear-gradient(145deg, #9a1030 0%, #800020 55%, #4d0013 100%);
  box-shadow: 0 14px 30px var(--glow);
}
.hero {
  position: relative;
  color: #fff;
  border-radius: 22px;
  padding: 20px;
}
.hero-top { display: flex; justify-content: space-between; align-items: center; }
.hero .label { font-size: 13px; color: rgba(255, 255, 255, .72); }
.hero .amount { font-size: 32px; font-weight: 800; margin: 4px 0; }
.hero-sub { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: rgba(255, 255, 255, .8); }
.pill {
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .12);
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.hero-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, .12);
  font-size: 12px;
}
.hero-row small { display: block; color: rgba(255, 255, 255, .65); margin-bottom: 2px; }
.hero-row b { font-family: var(--display); font-size: 15px; }
.hero-row > div:last-child { text-align: right; }
.hero-icon {
  width: 44px; height: 44px;
  border-radius: 13px;
  background: rgba(255, 255, 255, .1);
  display: grid;
  place-items: center;
}

.progress {
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, .16);
  overflow: hidden;
  margin-top: 12px;
}
.progress i { display: block; height: 100%; border-radius: 6px; background: #fff; }
.progress.light { background: var(--surface-2); margin-top: 10px; }
.progress.light i { background: var(--primary); }
.progress.dark { background: rgba(255, 255, 255, .16); margin-top: 10px; }

/* ---------- Beranda ---------- */
.home-head { margin-bottom: 18px; }
.home-head .greet small { margin-top: 1px; }
.greet-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
}
.home-head .greet h2 { line-height: 1.15; }
.icon-btn.glass { width: 46px; height: 46px; }

.progress-card {
  position: relative;
  margin-bottom: 44px;
  padding: 20px 18px 36px;
  border-radius: 22px;
  color: #fff;
}
.pc-body { display: flex; align-items: center; gap: 16px; }
.pc-title { font-size: 13px; color: rgba(255, 255, 255, .72); }
.pc-count { font-family: var(--display); font-size: 20px; font-weight: 700; margin-top: 2px; line-height: 1.2; }
.pc-count b { color: #ffd3df; }
.pc-count span { color: rgba(255, 255, 255, .55); font-weight: 500; }
.pc-sisa { font-size: 12.5px; margin-top: 8px; color: rgba(255, 255, 255, .72); }
.pc-sisa b { color: #fff; font-family: var(--display); }
.big-ring { position: relative; width: 92px; height: 92px; flex-shrink: 0; }
.big-ring svg { transform: rotate(-90deg); }
.big-ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 22px; font-weight: 800; }
.continue-btn {
  position: absolute;
  right: 14px;
  bottom: -24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 5px 5px 20px;
  border-radius: 999px;
  border: 4px solid var(--bg);
  background: var(--primary);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 8px 24px var(--glow);
}
.continue-btn span {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  display: grid;
  place-items: center;
}

.menu-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.menu-btn {
  aspect-ratio: 1 / 1.08;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}
.menu-btn svg { color: var(--primary); }
.menu-btn.dark { background: linear-gradient(145deg, #9a1030, #6a0019); border-color: var(--primary); color: #fff; box-shadow: 0 8px 22px var(--glow); }
.menu-btn.dark svg { color: #fff; }
.menu-btn:active, .cat-card:active, .continue-btn:active, .debt-card:active { transform: scale(.98); }

.cat-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px 6px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.cat-scroll::-webkit-scrollbar { display: none; }
.cat-card {
  --c: var(--primary);
  position: relative;
  overflow: hidden;
  flex: 0 0 68%;
  scroll-snap-align: start;
  border-radius: 18px;
  padding: 16px 16px 14px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 4px solid var(--c);
}
.cat-card h4 { font-size: 19px; font-weight: 700; }
.cat-card small { font-size: 12.5px; color: var(--muted); }
.cat-card .progress { margin-top: 16px; background: var(--surface-2); }
.cat-card .progress i { background: var(--c); }
.cc-foot { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; color: var(--muted); }
.cc-ic { position: absolute; right: 14px; top: 12px; color: var(--c); opacity: .9; }
.cc-ic svg { width: 26px; height: 26px; }

/* ---------- Generic ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.mt { margin-top: 18px; }
.mt-s { margin-top: 10px; }
.muted { color: var(--muted); }
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 24px 0 10px;
}
.section-title h3 { font-size: 17px; font-weight: 700; }
.link { font-size: 13px; font-weight: 600; color: var(--primary); display: inline-flex; align-items: center; gap: 2px; }
.link.u { text-decoration: underline; text-underline-offset: 3px; }

.alert-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--red-soft);
  border-left: 4px solid var(--red);
  color: #7d1f1f;
  width: 100%;
  text-align: left;
}
.alert-card.warn { background: var(--orange-soft); border-left-color: var(--primary); color: var(--primary-dark); }
.alert-card .a-ic { color: var(--red); }
.alert-card.warn .a-ic { color: var(--orange); }
.alert-card b { display: block; font-size: 14px; }
.alert-card span { font-size: 12px; opacity: .85; }

.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 18px; }

/* ---------- Lists ---------- */
.list { padding: 2px 16px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
}
.list-item:last-child { border-bottom: 0; }
.licon {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.li-main { flex: 1; min-width: 0; }
.li-title { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.amt { font-size: 15px; font-weight: 700; white-space: nowrap; }
.amt.red { color: var(--red); }
.amt.green { color: var(--good); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
}
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.orange { background: var(--orange-soft); color: var(--orange); }
.chip.green { background: var(--good-soft); color: var(--good); }
.chip.gray { background: var(--surface-2); color: var(--muted); }

.pay-btn {
  font-size: 12.5px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
}
.undo-btn { font-size: 11px; color: var(--muted); text-decoration: underline; }

.empty {
  text-align: center;
  padding: 28px 20px;
  color: var(--muted);
  font-size: 13px;
}
.empty .e-ic {
  width: 52px; height: 52px;
  margin: 0 auto 10px;
  border-radius: 16px;
  background: var(--surface-2);
  color: var(--primary);
  display: grid;
  place-items: center;
}
.empty b { display: block; color: var(--ink); font-family: var(--display); font-size: 16px; margin-bottom: 4px; }

/* ---------- Segmented / filters ---------- */
.seg {
  display: flex;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
}
.seg button {
  flex: 1;
  padding: 9px 6px;
  border-radius: 9px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}
.seg button.active { background: var(--primary); color: #fff; box-shadow: 0 6px 16px var(--glow); }

.filters { display: flex; gap: 6px; margin: 16px 0 4px; }
.fchip {
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
}
.fchip.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Debt cards ---------- */
.debt-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  margin-top: 10px;
}
.dc-top { display: flex; align-items: center; gap: 12px; }
.dc-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.summary-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sum-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.sum-tile small { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.sum-tile b { font-family: var(--display); font-size: 16px; font-weight: 700; }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.info-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.info-tile small { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); margin-bottom: 4px; }
.info-tile b { font-family: var(--display); font-size: 16px; }

.note {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--accent-soft);
  border: 1px solid #f1d6df;
  font-size: 13px;
  line-height: 1.5;
  color: #5b2a38;
  display: flex;
  gap: 10px;
}
.note svg { color: var(--primary-light); margin-top: 1px; }

/* ---------- FAB ---------- */
.fab {
  position: absolute;
  right: 18px;
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: 52px; height: 52px;
  border-radius: 16px;
  background: var(--primary);
  color: #fff;
  display: grid;
  place-items: center;
  z-index: 4;
  box-shadow: 0 8px 22px var(--glow);
}

/* ---------- Charts ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; }
.month-nav b { font-family: var(--display); font-size: 16px; text-transform: capitalize; }
.bars {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px;
  height: 150px;
  margin-top: 14px;
}
.bar-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
}
.bar-val { font-size: 10px; font-weight: 600; color: var(--muted); }
.bar {
  width: 100%;
  max-width: 28px;
  border-radius: 6px 6px 3px 3px;
  background: var(--surface-2);
  overflow: hidden;
  min-height: 6px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.bar i { display: block; width: 100%; background: #d48aa0; }
.bar-col.active .bar { background: #ead3db; }
.bar-col.active .bar i { background: var(--primary); }
.bar-col.active { color: var(--ink); font-weight: 700; }
.bar-col.active .bar-val { color: var(--ink); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex-shrink: 0; }

.donut-wrap { display: flex; align-items: center; gap: 16px; }
.donut { position: relative; width: 140px; height: 140px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); }
.donut-c {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.donut-c b { font-family: var(--display); font-size: 16px; }
.donut-c small { font-size: 11px; color: var(--muted); }
.donut-legend { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend span.n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.donut-legend span.p { font-weight: 700; font-variant-numeric: tabular-nums; }

.month-sum { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.month-sum div { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.month-sum small { display: block; font-size: 11px; color: var(--muted); }
.month-sum b { font-family: var(--display); font-size: 14px; }

/* ---------- Priority ---------- */
.strategy-desc { font-size: 13px; color: var(--muted); margin-top: 10px; line-height: 1.5; }
.top-pick { margin-top: 14px; }
.top-pick .tp-head { display: flex; align-items: center; gap: 12px; }
.top-pick h4 { font-size: 19px; font-weight: 700; }
.top-pick p { font-size: 13px; color: rgba(255, 255, 255, .82); margin-top: 12px; line-height: 1.5; }
.top-pick p b { color: #ffd3df; }
.range-head { display: flex; justify-content: space-between; align-items: baseline; }
.range-head b { font-family: var(--display); font-size: 17px; color: var(--primary-light); }
input[type=range] { width: 100%; margin-top: 12px; accent-color: var(--primary); }
.sim-result { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.sim-result > div { border-radius: 14px; padding: 12px; background: var(--surface); border: 1px solid var(--line); }
.sim-result small { display: block; font-size: 11.5px; color: var(--muted); }
.sim-result b { display: block; font-family: var(--display); font-size: 18px; color: var(--primary-light); margin: 2px 0; text-transform: capitalize; }
.sim-result span { font-size: 11.5px; color: var(--muted); }
.rank {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.rank.r1 { background: var(--primary); color: #fff; }
.rank.r2 { background: var(--primary-soft); color: var(--primary-light); }

/* ---------- Profile ---------- */
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head h2 { font-size: 19px; }
.health { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.health h4 { font-size: 22px; margin: 2px 0; }
.health small { font-size: 12.5px; color: rgba(255, 255, 255, .72); }
.ring { position: relative; width: 70px; height: 70px; }
.ring svg { transform: rotate(-90deg); }
.ring b { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: 16px; }
.set-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
  width: 100%;
  text-align: left;
  font-size: 14.5px;
}
.set-row:last-child { border-bottom: 0; }
.set-row .s-ic { color: var(--primary-light); }
.set-row .grow { flex: 1; }
.set-row small { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.set-row.danger, .set-row.danger .s-ic { color: var(--red); }
.mini-seg { display: flex; gap: 4px; }
.mini-seg button {
  padding: 5px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--muted);
}
.mini-seg button.active { background: var(--primary); color: #fff; }
.switch {
  width: 44px; height: 26px;
  border-radius: 999px;
  background: #e2d3d8;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(18px); }

/* ---------- Notif page ---------- */
.group-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  margin: 18px 0 8px;
}
.group-label.red { color: var(--red); }
.group-label.orange { color: var(--orange); }

/* ---------- Cari ---------- */
.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--muted);
}
.search-box:focus-within { border-color: var(--primary); }
.search-box input { flex: 1; border: 0; outline: 0; background: none; padding: 13px 0; font-size: 15px; color: var(--ink); }
.scroll-x { overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 0 16px 4px; }
.scroll-x::-webkit-scrollbar { display: none; }
.scroll-x .fchip { white-space: nowrap; flex-shrink: 0; }

/* ---------- Panduan ---------- */
.guide details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-top: 8px; overflow: hidden; }
.guide summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
}
.guide summary::-webkit-details-marker { display: none; }
.guide .chev { margin-left: auto; color: var(--muted); transition: transform .2s; }
.guide details[open] .chev { transform: rotate(180deg); }
.guide .g-body { padding: 0 16px 16px 64px; font-size: 13.5px; line-height: 1.6; color: var(--muted); }
.guide .g-body ol, .guide .g-body ul { padding-left: 18px; }
.guide .g-body li { margin-bottom: 4px; }

/* ---------- Sheet ---------- */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(42, 23, 29, .45);
  opacity: 0;
  transition: opacity .25s;
  z-index: 20;
}
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 90%;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  z-index: 21;
}
.sheet::before {
  content: "";
  display: block;
  width: 40px; height: 4px;
  border-radius: 4px;
  background: var(--line);
  margin: 0 auto 14px;
}
#sheet-root.open .overlay { opacity: 1; }
#sheet-root.open .sheet { transform: translateY(0); }
.sheet h3 { font-size: 20px; margin-bottom: 4px; }
.sheet .sub { font-size: 13.5px; color: var(--muted); margin-bottom: 16px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 15px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.field textarea { resize: vertical; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); background: var(--surface); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.prefix { position: relative; }
.prefix span {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  color: var(--muted);
  font-weight: 600;
}
.prefix input { padding-left: 42px; }
.form-error { color: var(--red); font-size: 13px; margin-bottom: 10px; }

.btn {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  font-size: 15px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 22px var(--glow);
}
.btn.ghost { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn.danger { background: var(--red); box-shadow: none; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }

.pay-summary {
  border-radius: 16px;
  background: var(--bg);
  border: 1px dashed var(--line);
  padding: 16px;
  margin-bottom: 16px;
  text-align: center;
}
.pay-summary b { display: block; font-family: var(--display); font-size: 28px; color: var(--primary-light); margin: 4px 0; }
.pay-summary small { font-size: 13px; color: var(--muted); }

/* ---------- Toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: calc(88px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  background: var(--primary-dark);
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  padding: 11px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 40px);
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   Mode gelap
   ========================================================= */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #120d0f;
  --surface: #1d1619;
  --surface-2: #2a2024;
  --ink: #f5eef0;
  --muted: #a8979d;
  --line: #33282c;
  --primary: #b8325a;
  --primary-dark: #4d0013;
  --primary-light: #f08aa8;
  --primary-soft: rgba(184, 50, 90, .2);
  --glow: rgba(184, 50, 90, .35);
  --accent: #b8325a;
  --accent-soft: rgba(184, 50, 90, .12);
  --good: #4cc38a;
  --good-soft: rgba(76, 195, 138, .14);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, .14);
  --orange: #f08aa8;
  --orange-soft: rgba(240, 138, 168, .12);
}
[data-theme="dark"] body {
  background:
    linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, .04) 38%, transparent 46%),
    linear-gradient(115deg, transparent 58%, rgba(255, 255, 255, .03) 66%, transparent 74%),
    radial-gradient(ellipse at 15% 10%, #2a1a20 0%, transparent 55%),
    linear-gradient(135deg, #17111a 0%, #0c090b 100%);
  background-attachment: fixed;
}
[data-theme="dark"] .phone {
  background:
    radial-gradient(circle at 95% 0%, rgba(184, 50, 90, .3) 0%, transparent 38%),
    radial-gradient(circle at 0% 35%, rgba(140, 29, 59, .2) 0%, transparent 35%),
    radial-gradient(circle at 100% 75%, rgba(140, 29, 59, .16) 0%, transparent 35%),
    linear-gradient(180deg, #160f12 0%, #110b0d 100%);
}
[data-theme="dark"] .nav-item { color: #7d6d73; }
[data-theme="dark"] .nav-item.active,
[data-theme="dark"] .greet-time,
[data-theme="dark"] .link,
[data-theme="dark"] .empty .e-ic,
[data-theme="dark"] .menu-btn:not(.dark) svg { color: var(--primary-light); }
[data-theme="dark"] .alert-card { color: #ffd0d0; }
[data-theme="dark"] .alert-card.warn { color: #ffd6e2; }
[data-theme="dark"] .note { border-color: rgba(240, 138, 168, .22); color: #ecd3da; }
[data-theme="dark"] .bar i { background: #8a3a55; }
[data-theme="dark"] .bar-col.active .bar { background: #3a2c31; }
[data-theme="dark"] .bar-col.active .bar i { background: var(--primary-light); }
[data-theme="dark"] .switch { background: #3d3135; }
[data-theme="dark"] .avatar { border-color: rgba(240, 138, 168, .35); }
[data-theme="dark"] .toast { background: #f5eef0; color: #1d1619; }
[data-theme="dark"] .overlay { background: rgba(0, 0, 0, .6); }
[data-theme="dark"] .rank.r2,
[data-theme="dark"] .chip.orange { color: var(--primary-light); }

/* Transisi halus saat berganti mode */
.phone, .card, .debt-card, .menu-btn, .cat-card, .bottom-nav, .icon-btn, .sum-tile, .info-tile {
  transition: background-color .3s, border-color .3s, color .3s;
}

/* =========================================================
   Responsif: HP, tablet, laptop
   ========================================================= */
* { -webkit-tap-highlight-color: transparent; }
/* Font 16px di input mencegah iPhone auto-zoom saat mengetik */
.field input, .field select, .field textarea, .search-box input { font-size: 16px; }
.set-row.wrap { flex-wrap: wrap; }
.set-row.wrap .grow { min-width: 160px; }
.li-title, .greet h2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* HP kecil (≤ 360px) */
@media (max-width: 360px) {
  .screen { padding-left: 12px; padding-right: 12px; }
  .cat-scroll, .scroll-x { margin-left: -12px; margin-right: -12px; padding-left: 12px; padding-right: 12px; }
  .menu-grid { gap: 6px; }
  .menu-btn { font-size: 10.5px; }
  .big-ring { width: 78px; height: 78px; }
  .big-ring svg { width: 78px; height: 78px; }
  .pc-count { font-size: 17px; }
  .hero .amount { font-size: 26px; }
  .summary-row { gap: 6px; }
  .sum-tile { padding: 10px; }
  .sum-tile b { font-size: 14px; }
}

/* Tablet: isi dipusatkan agar tidak melebar */
@media (min-width: 640px) and (max-width: 1023px) {
  .page { max-width: 600px; }
  .bottom-nav { padding-left: calc((100% - 560px) / 2); padding-right: calc((100% - 560px) / 2); }
  .cat-card { flex-basis: 46%; }
  .sheet { left: 50%; right: auto; width: 600px; margin-left: -300px; }
}

/* Laptop / desktop: sidebar kiri + isi dua kolom */
@media (min-width: 1024px) {
  .mob-only { display: none !important; }
  .desk-only { display: revert !important; }
  .desk-only.side-brand, .desk-only.side-add, .desk-only.side-item, .desk-only.side-user { display: flex !important; }

  .phone { display: grid; grid-template-columns: 252px minmax(0, 1fr); }
  #sheet-root { display: contents; }

  .bottom-nav {
    position: relative;
    grid-column: 1;
    grid-row: 1;
    height: 100vh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: 2px;
    padding: 24px 16px 18px;
    border-top: 0;
    border-right: 1px solid var(--line);
    border-radius: 0;
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: blur(12px);
    overflow-y: auto;
  }
  .side-brand {
    align-items: center;
    gap: 10px;
    padding: 4px 8px 20px;
    font-family: var(--display);
    font-size: 19px;
    font-weight: 800;
  }
  .side-add {
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    margin-bottom: 18px;
    border-radius: 13px;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 8px 20px var(--glow);
  }
  .side-label {
    padding: 0 10px 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted);
  }
  .side-item {
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 11px;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    text-align: left;
    transition: background-color .15s, color .15s;
  }
  .side-item:hover { background: var(--surface-2); color: var(--ink); }
  .side-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
  [data-theme="dark"] .side-item.active { color: var(--primary-light); }
  .side-item span:not(.side-count) { flex: 1; }
  .side-count {
    min-width: 20px; height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--red);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: grid;
    place-items: center;
  }
  .side-user {
    margin-top: auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    text-align: left;
  }
  .side-user .avatar { width: 38px; height: 38px; font-size: 15px; flex-shrink: 0; }
  .side-user b { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .side-user small { font-size: 12px; color: var(--muted); }

  .screen {
    grid-column: 2;
    grid-row: 1;
    height: 100vh;
    padding: 32px 40px 48px;
    scrollbar-width: thin;
  }
  .screen::-webkit-scrollbar { display: block; width: 10px; }
  .screen::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
  .page { max-width: 1120px; }
  .page.narrow { max-width: 820px; }

  .cols {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    gap: 28px;
    align-items: start;
  }
  .col > :first-child, .col > .section-title:first-child { margin-top: 0; }
  .page-profile .cols, .page-report .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  .topbar h1 { font-size: 26px !important; }
  .home-head { margin-bottom: 24px; }
  .home-head .greet h2 { font-size: 28px; }
  .menu-grid { gap: 10px; }
  .menu-btn { aspect-ratio: auto; padding: 18px 8px; font-size: 12.5px; }
  .menu-btn:hover:not(.dark), .debt-card:hover, .cat-card:hover { border-color: var(--primary-light); }
  .cat-scroll { margin: 0; padding: 2px 0 6px; }
  .cat-card { flex-basis: calc(50% - 5px); }
  .list-item:hover { background: linear-gradient(90deg, transparent, var(--surface-2) 12%, var(--surface-2) 88%, transparent); }
  .scroll-x { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }

  .card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
  .card-grid .debt-card { margin-top: 0; }
  .fab { display: none; }

  .bars { height: 200px; }
  .hero .amount { font-size: 36px; }

  /* Lembar input jadi dialog di tengah */
  .sheet {
    left: 50%;
    right: auto;
    top: 50%;
    bottom: auto;
    width: 500px;
    max-height: 86vh;
    padding: 26px 28px;
    border-radius: 22px;
    opacity: 0;
    transform: translate(-50%, -46%);
    transition: transform .22s ease, opacity .22s ease;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .25);
  }
  .sheet::before { display: none; }
  #sheet-root.open .sheet { opacity: 1; transform: translate(-50%, -50%); }
  .toast { bottom: 32px; left: calc(50% + 126px); }
}

@media (min-width: 1440px) {
  .page-debts .card-grid, .page-categories .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .screen { padding: 40px 56px 56px; }
}
@media (min-width: 1024px) {
  .btn.desk-only { display: flex !important; }
}

/* Label status + tombol Bayar: bertumpuk di HP, sejajar di layar lebar */
.pay-row { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
@media (min-width: 640px) { .pay-row { flex-direction: row; align-items: center; gap: 6px; } }
.set-row.wrap .mini-seg { margin-left: 32px; }
@media (min-width: 1024px) { .set-row.wrap { flex-wrap: nowrap; } .set-row.wrap .mini-seg { margin-left: 0; } }

/* =========================================================
   Beranda: kartu bulan ini, ringkasan, pintasan, sebaran, agenda
   ========================================================= */
.month-card .amount { font-size: 34px; }
.seg-bar { display: flex; gap: 3px; height: 10px; margin-top: 14px; }
.seg-bar i { min-width: 6px; border-radius: 4px; background: rgba(255, 255, 255, .22); }
.seg-bar i.on { background: #fff; }
.seg-legend { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; font-size: 12px; color: rgba(255, 255, 255, .78); }
.next-due {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .12);
}
.nd-date {
  width: 46px; height: 50px;
  flex-shrink: 0;
  border-radius: 12px;
  background: #fff;
  color: var(--primary-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.nd-date b { font-family: var(--display); font-size: 19px; }
.nd-date small { margin-top: 3px; font-size: 10px; font-weight: 700; text-transform: uppercase; }
.next-due .grow small { display: block; font-size: 11px; color: rgba(255, 255, 255, .7); }
.next-due .grow b { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-due .grow span { font-size: 12px; color: rgba(255, 255, 255, .85); }
.nd-pay { padding: 9px 16px; border-radius: 12px; background: #fff; color: var(--primary-dark); font-size: 13px; font-weight: 700; }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 12px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}
.stat { padding: 12px 14px; text-align: left; border-left: 1px solid var(--line); min-width: 0; }
.stat:first-child { border-left: 0; }
.stat small { display: block; font-size: 11.5px; color: var(--muted); }
.stat b { display: block; margin-top: 2px; font-family: var(--display); font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat .progress { height: 4px; margin-top: 7px; }
.stat em { font-style: normal; font-size: 11px; font-weight: 700; color: var(--primary); }
[data-theme="dark"] .stat em { color: var(--primary-light); }

.pills {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -16px;
  padding: 2px 16px 4px;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }
.quick-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 7px 14px 7px 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.qp-ic {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid;
  place-items: center;
}
[data-theme="dark"] .qp-ic { color: var(--primary-light); }

.stack-bar { display: flex; gap: 2px; height: 14px; border-radius: 7px; overflow: hidden; }
.stack-bar i { display: block; height: 100%; min-width: 4px; }
.spread-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
  text-align: left;
}
.spread-row:last-child { border-bottom: 0; padding-bottom: 0; }
.spread-row .n { flex: 1; min-width: 0; }
.spread-row .n small { margin-left: 6px; font-size: 11.5px; color: var(--muted); }
.spread-row b { font-family: var(--display); font-size: 14px; }
.spread-row .p { width: 38px; text-align: right; font-size: 12px; color: var(--muted); }

.agenda { padding: 6px 16px; }
.agenda-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 0;
  text-align: left;
}
.agenda-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 22px;
  top: 58px;
  bottom: -10px;
  width: 2px;
  background: var(--line);
}
.ag-date {
  position: relative;
  z-index: 1;
  width: 46px; height: 48px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.ag-date b { font-family: var(--display); font-size: 18px; }
.ag-date small { margin-top: 3px; font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--muted); }
.ag-date.late { background: var(--red); color: #fff; }
.ag-date.soon { background: var(--primary); color: #fff; }
.ag-date.late small, .ag-date.soon small { color: rgba(255, 255, 255, .85); }

@media (min-width: 1024px) {
  .pills { flex-wrap: wrap; margin: 0; padding: 0; overflow: visible; }
  .quick-pill:hover, .spread-row:hover b { color: var(--primary); }
  .month-card .amount { font-size: 40px; }
}
@media (min-width: 1024px) {
  .pills { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .quick-pill { border-radius: 14px; padding: 8px 10px 8px 8px; white-space: normal; text-align: left; line-height: 1.2; }
}
.pill-btn { color: #fff; cursor: pointer; transition: background-color .15s; }
.pill-btn:hover { background: rgba(255, 255, 255, .22); }

/* Lembar rincian: tab Total Utang */
.total-box {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(145deg, #9a1030 0%, #6a0019 100%);
  color: #fff;
}
.total-box small { font-size: 12px; color: rgba(255, 255, 255, .75); }
.total-box b { display: block; margin: 2px 0 12px; font-family: var(--display); font-size: 28px; }
.total-box .stack-bar { height: 10px; background: rgba(255, 255, 255, .15); }
.part-no {
  width: 28px; height: 28px;
  flex-shrink: 0;
  border-radius: 9px;
  color: #fff;
  font-family: var(--display);
  font-size: 13px;
  font-weight: 700;
  display: grid;
  place-items: center;
}
.sheet .sub b { color: var(--ink); }

/* Kartu bulan ini: satu garis persentase total yang sudah dibayar */
.month-progress { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
.month-progress .progress { flex: 1; height: 10px; margin: 0; }
.month-progress b { font-family: var(--display); font-size: 15px; min-width: 38px; text-align: right; }

/* =========================================================
   Jadwal: kalender bertanggal
   ========================================================= */
.date-title { flex: 1; text-align: center; min-width: 0; }
.date-title b { display: block; font-family: var(--display); font-size: 16px; }
.date-title small { font-size: 11.5px; color: var(--muted); }
.cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  margin-top: 14px;
}
.cal-wd { text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); padding-bottom: 4px; }
.cal-day {
  position: relative;
  aspect-ratio: 1;
  max-height: 46px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  color: var(--ink);
  transition: background-color .15s;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.has { font-weight: 700; }
.cal-day.today { box-shadow: inset 0 0 0 1.5px var(--primary); color: var(--primary); }
[data-theme="dark"] .cal-day.today { box-shadow: inset 0 0 0 1.5px var(--primary-light); color: var(--primary-light); }
.cal-day.sel, .cal-day.sel:hover { background: var(--primary); color: #fff; box-shadow: 0 6px 14px var(--glow); }
.cal-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--muted);
}
.cal-day .cal-dot { position: absolute; bottom: 5px; left: 50%; transform: translateX(-50%); }
.cal-dot.late { background: var(--red); }
.cal-dot.due { background: var(--primary); }
[data-theme="dark"] .cal-dot.due { background: var(--primary-light); }
.cal-dot.paid { background: var(--good); }
.cal-day.sel .cal-dot { background: #fff; }
.legend .cal-dot { margin-right: 2px; }
@media (min-width: 1024px) { .cal-day { max-height: 52px; } }

/* Sapaan pertama kali */
.welcome-ic {
  width: 64px; height: 64px;
  margin: 6px auto 14px;
  border-radius: 20px;
  background: linear-gradient(145deg, #9a1030, #4d0013);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px var(--glow);
}

/* =========================================================
   Logo: rantai putus + kata "Hutang" dicoret (animasi 4,5 detik)
   ========================================================= */
.logo { display: block; flex-shrink: 0; border-radius: 27%; box-shadow: 0 6px 18px rgba(229, 23, 143, .28); }
.logo .lg-x { transform-box: view-box; transform-origin: 368px 655px; /* titik tengah X */ animation: lg-spin 4.5s cubic-bezier(.7, 0, .2, 1) infinite; }
.logo .lg-x polygon { animation: 4.5s cubic-bezier(.7, 0, .2, 1) infinite; }
.logo .lg-x .b-wl { animation-name: lg-wl; }
.logo .lg-x .b-wr { animation-name: lg-wr; }
.logo .lg-x .b-pt { animation-name: lg-pt; }
.logo .lg-x .b-pb { animation-name: lg-pb; }
.logo .lg-flash { opacity: 0; transform-box: fill-box; transform-origin: center; animation: lg-flash 4.5s ease-out infinite; }
.logo .lg-shine { animation: lg-shine 4.5s ease-in-out infinite; }

/* Bilah merenggang ke arah ujungnya, X berputar 180°, lalu menyatu lagi */
@keyframes lg-wl { 0%, 14% { transform: translate(0, 0); } 32%, 56% { transform: translate(-70px, -70px); } 68%, 100% { transform: translate(0, 0); } }
@keyframes lg-wr { 0%, 14% { transform: translate(0, 0); } 32%, 56% { transform: translate(70px, 70px); } 68%, 100% { transform: translate(0, 0); } }
@keyframes lg-pt { 0%, 14% { transform: translate(0, 0); } 32%, 56% { transform: translate(70px, -70px); } 68%, 100% { transform: translate(0, 0); } }
@keyframes lg-pb { 0%, 14% { transform: translate(0, 0); } 32%, 56% { transform: translate(-70px, 70px); } 68%, 100% { transform: translate(0, 0); } }
@keyframes lg-spin { 0%, 22% { transform: rotate(0deg) scale(1); } 60% { transform: rotate(180deg) scale(.92); } 68% { transform: rotate(180deg) scale(1.08); } 76%, 100% { transform: rotate(180deg) scale(1); } }
@keyframes lg-flash { 0%, 64% { opacity: 0; transform: scale(.2); } 68% { opacity: .55; transform: scale(.6); } 84%, 100% { opacity: 0; transform: scale(1.6); } }
@keyframes lg-shine { 0%, 70% { transform: rotate(22deg) translateX(0); } 92%, 100% { transform: rotate(22deg) translateX(115px); } }

.wordmark { font-family: var(--display); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.wm-debt { position: relative; color: var(--primary); }
[data-theme="dark"] .wm-debt { color: var(--primary-light); }
.wm-debt i {
  position: absolute;
  left: -3px; right: -3px;
  top: 54%;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  animation: wm-strike 4.5s cubic-bezier(.6, 0, .2, 1) infinite;
}
@keyframes wm-strike {
  0%, 30% { transform: scaleX(0); transform-origin: left center; }
  44%, 78% { transform: scaleX(1); transform-origin: left center; }
  79% { transform: scaleX(1); transform-origin: right center; }
  92%, 100% { transform: scaleX(0); transform-origin: right center; }
}

.welcome-logo { display: flex; justify-content: center; margin: 6px 0 14px; }
.welcome-logo .logo { border-radius: 22px; box-shadow: 0 14px 34px rgba(229, 23, 143, .3); }
.brand-foot { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 18px; text-align: left; }
.brand-foot .wordmark { font-size: 15px; }
.brand-foot small { display: block; font-size: 11.5px; color: var(--muted); }
@media (min-width: 1024px) {
  .side-brand { gap: 12px; }
  .side-brand .wordmark { font-size: 19px; }
}
/* Hormati pengaturan "kurangi gerakan" di perangkat */
@media (prefers-reduced-motion: reduce) {
  .logo *, .wm-debt i { animation: none !important; }
  .wm-debt i { transform: scaleX(1); }
}

/* =========================================================
   Layar pembuka: logo besar beranimasi tiap web dibuka / refresh
   ========================================================= */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 42%, #3a0f22 0%, #120509 45%, #000 100%);
  cursor: pointer;
  transition: opacity .55s ease, visibility .55s ease;
}
.splash:empty { display: none; }
.splash.hide { opacity: 0; visibility: hidden; }
.splash.hide .splash-inner { transform: scale(1.12); }
.splash-inner { display: flex; flex-direction: column; align-items: center; transition: transform .55s ease; }
.splash-mark { position: relative; display: grid; place-items: center; }

/* Lencana muncul dengan pantulan */
.splash .logo {
  border-radius: 34px;
  box-shadow: 0 0 70px rgba(229, 23, 143, .45), 0 20px 50px rgba(0, 0, 0, .6);
  animation: sp-pop .7s cubic-bezier(.2, .9, .3, 1.35) both;
}
@keyframes sp-pop { from { opacity: 0; transform: scale(.4) rotate(-12deg); } to { opacity: 1; transform: none; } }

/* X berputar masuk; bilah meluncur dari empat penjuru */
.splash .logo .lg-x { animation: sp-spin 1.1s cubic-bezier(.6, 0, .2, 1) .2s both; }
@keyframes sp-spin { from { transform: rotate(-270deg) scale(.5); } 80% { transform: rotate(8deg) scale(1.08); } to { transform: none; } }
.splash .logo .lg-x polygon { animation: .7s cubic-bezier(.2, .9, .3, 1.2) both; }
.splash .logo .lg-x .b-wl { animation-name: sp-wl; animation-delay: .25s; }
.splash .logo .lg-x .b-pt { animation-name: sp-pt; animation-delay: .35s; }
.splash .logo .lg-x .b-wr { animation-name: sp-wr; animation-delay: .45s; }
.splash .logo .lg-x .b-pb { animation-name: sp-pb; animation-delay: .55s; }
@keyframes sp-wl { from { opacity: 0; transform: translate(-320px, -320px); } to { opacity: 1; transform: none; } }
@keyframes sp-wr { from { opacity: 0; transform: translate(320px, 320px); } to { opacity: 1; transform: none; } }
@keyframes sp-pt { from { opacity: 0; transform: translate(320px, -320px); } to { opacity: 1; transform: none; } }
@keyframes sp-pb { from { opacity: 0; transform: translate(-320px, 320px); } to { opacity: 1; transform: none; } }

/* Kilatan + gelombang cahaya saat bilah menyatu */
.splash .logo .lg-flash { animation: sp-flash .7s ease-out 1.15s forwards; }
@keyframes sp-flash { 0% { opacity: .9; transform: scale(.2); } 100% { opacity: 0; transform: scale(2.6); } }
.splash .logo .lg-shine { animation: sp-shine .9s ease-in-out 1.35s both; }
@keyframes sp-shine { from { transform: rotate(22deg) translateX(0); } to { transform: rotate(22deg) translateX(115px); } }
.splash-ring {
  position: absolute;
  width: 128px; height: 128px;
  border-radius: 50%;
  border: 2px solid #ff4fb3;
  opacity: 0;
  animation: sp-ring 1.1s cubic-bezier(.2, .7, .3, 1) 1.15s forwards;
}
.splash-ring.r2 { border-color: #fff; animation-delay: 1.3s; }
@keyframes sp-ring { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: scale(2.8); } }

@media (prefers-reduced-motion: reduce) {
  .splash *, .splash .logo * { animation: none !important; }
}
