:root {
  --blue: #079bd7;
  --blue-deep: #0076bc;
  --navy: #073c72;
  --ink: #122033;
  --muted: #708096;
  --line: #e7edf3;
  --paper: #ffffff;
  --soft: #f4f8fb;
  --gold: #ffbf21;
  --green: #16a67a;
  --orange: #e98c22;
  --shadow: 0 12px 30px rgba(24, 68, 104, .08);
}

* { box-sizing: border-box; }
html { background: #d9eef8; scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: #f5f8fb;
  color: var(--ink);
  font: 400 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; }
button:focus-visible { outline: 3px solid rgba(7, 155, 215, .38); outline-offset: 2px; }
.app-shell { width: 100%; max-width: 620px; min-height: 100vh; margin: 0 auto; background: var(--soft); box-shadow: 0 0 50px rgba(4, 61, 91, .12); }

.hero {
  position: relative;
  overflow: hidden;
  padding: 18px 20px 24px;
  color: #fff;
  background: linear-gradient(150deg, #08a8df 0%, #079bd7 47%, #007fc4 100%);
  border-radius: 0 0 28px 28px;
}
.hero::after { content: ""; position: absolute; right: -75px; bottom: -95px; width: 280px; height: 190px; border-radius: 50%; background: rgba(255,255,255,.09); transform: rotate(-17deg); }
.hero-orbit { position: absolute; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; pointer-events: none; }
.orbit-one { width: 245px; height: 245px; right: -125px; top: -125px; }
.orbit-two { width: 170px; height: 170px; left: -115px; bottom: -115px; }
.hero-top, .brand-lockup, .next-main, .next-actions, .section-heading, .progress-meta, .row-title { display: flex; align-items: center; }
.hero-top { position: relative; z-index: 1; justify-content: space-between; }
.icon-button { width: 44px; height: 44px; display: inline-grid; place-items: center; border: 0; border-radius: 14px; cursor: pointer; background: transparent; font-size: 30px; line-height: 1; }
.icon-button.light { color: #fff; background: rgba(255,255,255,.12); }
.brand-lockup { gap: 10px; }
.brand-mark { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 13px; color: #2f6090; background: linear-gradient(145deg, #ffe58b, #fff7d8 52%, #e9b951); box-shadow: 0 6px 12px rgba(0, 40, 80, .14); font-size: 25px; }
.brand-lockup strong, .brand-lockup small { display: block; }
.brand-lockup strong { font-size: 15px; letter-spacing: .02em; }
.brand-lockup small { margin-top: 1px; color: rgba(255,255,255,.76); font-size: 12px; }
.hero-account { position: relative; z-index: 1; margin: 20px 0 18px 54px; }
.hero-account strong { display: block; margin-top: 5px; letter-spacing: .16em; font-size: 22px; font-weight: 700; }
.hero-account small { display: block; margin-top: 5px; color: rgba(255,255,255,.7); font-size: 12px; }
.eyebrow, .overline { display: block; text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; }
.eyebrow { color: rgba(255,255,255,.72); }
.hero-summary { position: relative; z-index: 1; padding: 18px 16px 15px; border-radius: 19px; background: rgba(255,255,255,.97); color: var(--ink); box-shadow: 0 12px 20px rgba(0, 82, 131, .12); }
.hero-summary .eyebrow { color: #748296; }
.hero-summary > strong { display: block; margin: 6px 0 13px; font-size: clamp(25px, 7vw, 34px); letter-spacing: -.045em; }
.progress-track { height: 10px; overflow: hidden; border-radius: 20px; background: #e7ebef; }
.progress-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffb600, #ffc92e); transition: width .35s ease; }
.progress-meta { justify-content: space-between; gap: 8px; margin-top: 7px; color: #738093; font-size: 12px; }
.progress-meta span:first-child { color: #e38b00; font-weight: 800; }

main { display: grid; gap: 13px; padding: 14px 14px 24px; }
.next-card, .metric-card, .info-card, .tracker-card, .finish-card, .privacy-note { border: 1px solid var(--line); background: var(--paper); box-shadow: var(--shadow); }
.next-card { padding: 17px; border: 2px solid #ffd45d; border-radius: 20px; background: linear-gradient(145deg, #fffdf6, #fff); }
.next-card.overdue { border-color: #ef8d63; }
.section-kicker { display: flex; align-items: center; gap: 7px; color: #b06f00; text-transform: uppercase; letter-spacing: .09em; font-size: 12px; font-weight: 800; }
.pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #f2a400; box-shadow: 0 0 0 5px rgba(242,164,0,.13); }
.next-main { justify-content: space-between; gap: 12px; margin-top: 12px; }
.muted-label { display: block; color: var(--muted); font-size: 12px; }
.amount { display: block; margin-top: 3px; color: var(--ink); font-size: 25px; letter-spacing: -.04em; }
.due-box { min-width: 128px; padding-left: 13px; border-left: 1px solid #e9e1c9; }
.due-box strong { display: block; margin-top: 3px; font-size: 14px; }
.next-actions { gap: 8px; margin-top: 17px; }
.button { min-height: 44px; border: 0; border-radius: 12px; padding: 0 13px; cursor: pointer; font-size: 12px; font-weight: 800; }
.button.primary { flex: 1; color: #fff; background: linear-gradient(135deg, #11a778, #087c69); box-shadow: 0 6px 14px rgba(14, 148, 111, .18); }
.button.secondary { color: #3f5062; border: 1px solid #dfe7ee; background: #fff; }
.button:disabled { cursor: not-allowed; opacity: .58; }
.helper { margin: 10px 0 0; color: #8691a0; font-size: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.metric-card { min-width: 0; padding: 14px; border-radius: 17px; }
.metric-icon { width: 29px; height: 29px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 10px; font-weight: 900; }
.metric-icon.green { color: #078463; background: #dff7ed; }
.metric-icon.orange { color: #b76a00; background: #fff0d2; }
.metric-card strong { display: block; overflow: hidden; margin-top: 4px; color: var(--ink); font-size: clamp(14px, 4vw, 18px); text-overflow: ellipsis; white-space: nowrap; }
.metric-card small { display: block; margin-top: 2px; color: #98a3b0; font-size: 12px; }
.info-card, .tracker-card { padding: 17px; border-radius: 20px; }
.section-heading { justify-content: space-between; gap: 12px; }
.section-heading h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -.03em; }
.overline { color: #91a0b1; }
.status-chip { padding: 6px 9px; border-radius: 9px; color: #087c67; background: #e5f7f0; font-size: 12px; font-weight: 800; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; margin-top: 15px; border-top: 1px solid var(--line); }
.detail-grid div { min-width: 0; padding: 12px 8px 4px 0; border-bottom: 1px solid var(--line); }
.detail-grid div:nth-child(even) { padding-left: 10px; border-left: 1px solid var(--line); }
.detail-grid span, .detail-grid strong { display: block; }
.detail-grid span { color: var(--muted); font-size: 12px; }
.detail-grid strong { overflow: hidden; margin-top: 3px; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.tracker-heading { align-items: end; }
.fraction { padding: 7px 9px; border-radius: 9px; color: #087fc0; background: #e9f6fc; font-size: 12px; font-weight: 900; }
.section-note { margin: 7px 0 13px; color: var(--muted); font-size: 12px; }
.filter-row { display: flex; gap: 7px; overflow-x: auto; padding: 1px 1px 8px; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter { min-height: 44px; flex: 0 0 auto; padding: 0 12px; border: 1px solid #dfe8ef; border-radius: 20px; color: #6e7c8d; background: #fff; cursor: pointer; font-size: 12px; font-weight: 800; }
.filter.active { color: #fff; border-color: var(--blue); background: var(--blue); }
.schedule-list { display: grid; gap: 8px; }
.payment-row { display: flex; align-items: center; gap: 10px; min-height: 65px; padding: 10px; border: 1px solid #e5ebf0; border-radius: 15px; background: #fff; }
.payment-row.is-current { border-color: #ffc23a; background: #fffaf0; }
.payment-row.is-paid { background: #f8fbfc; }
.check-button { width: 44px; height: 44px; flex: 0 0 44px; border: 2px solid #bdc9d4; border-radius: 10px; color: #fff; background: #fff; cursor: pointer; font-size: 20px; font-weight: 900; }
.check-button.checked { border-color: var(--green); background: var(--green); }
.row-copy { min-width: 0; flex: 1; }
.row-title { gap: 6px; min-width: 0; }
.row-title strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.is-paid .row-title strong { color: #7f8c9b; text-decoration: line-through; }
.row-copy > span { display: block; margin-top: 3px; color: #8996a5; font-size: 12px; }
.row-badge { flex: 0 0 auto; padding: 3px 6px; border-radius: 6px; font-size: 12px; font-weight: 900; }
.row-badge.current { color: #a86a00; background: #ffe2a0; }
.row-badge.done { color: #087c67; background: #dff6ec; }
.row-amount { flex: 0 0 auto; color: #31516e; font-size: 12px; white-space: nowrap; }
.empty-state { padding: 25px 10px; border-radius: 14px; color: #8492a2; background: #f7fafc; text-align: center; font-size: 12px; }
.finish-card { display: flex; gap: 13px; padding: 17px; border: 0; border-radius: 20px; color: #fff; background: linear-gradient(135deg, #087f72, #05a87d); }
.finish-icon { width: 38px; height: 38px; flex: 0 0 38px; display: grid; place-items: center; border-radius: 13px; color: #08755f; background: #c9f4df; font-size: 20px; }
.finish-card .overline { color: #b3f1d5; }
.finish-card h2 { margin: 3px 0; font-size: 17px; }
.finish-card p { margin: 0; color: rgba(255,255,255,.85); font-size: 12px; }
.privacy-note { padding: 14px 16px; border-radius: 16px; color: #607184; background: #fafdff; box-shadow: none; font-size: 12px; }
.privacy-note strong { color: #334b63; font-size: 12px; }
.privacy-note p { margin: 4px 0 0; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding: 0 17px 25px; color: #9aa8b7; font-size: 12px; }
.text-button { min-height: 44px; padding: 0; border: 0; color: #5e7d97; background: transparent; cursor: pointer; font-size: 12px; font-weight: 700; }
.toast { position: fixed; z-index: 10; right: 16px; bottom: 18px; left: 16px; max-width: 380px; margin: auto; padding: 12px 15px; border-radius: 13px; color: #fff; background: #172d42; box-shadow: 0 10px 30px rgba(11, 43, 69, .2); text-align: center; font-size: 12px; font-weight: 700; opacity: 0; pointer-events: none; transform: translateY(12px); transition: opacity .2s ease, transform .2s ease; }
.toast.visible { opacity: 1; transform: translateY(0); }
@media (min-width: 600px) { main { padding: 18px 20px 30px; } .hero { padding-left: 28px; padding-right: 28px; } .hero-summary { max-width: 570px; margin: 0 auto; } }
@media (max-width: 365px) { .hero-account { margin-left: 0; } .hero-account strong { font-size: 19px; } .next-main { align-items: flex-start; flex-direction: column; } .due-box { width: 100%; padding: 8px 0 0; border-top: 1px solid #e9e1c9; border-left: 0; } .row-amount { font-size: 12px; } }

/* Grid and flex children default to min-width:auto, so they refuse to shrink
   below their min-content width — which is why every card rendered 458px wide
   inside a 320px phone. The inner elements already carried min-width:0; the
   top-level grid children and the button row were the ones still missing it. */
main > * { min-width: 0; }
.next-actions { flex-wrap: wrap; }
.next-actions .button { min-width: 0; }
.section-kicker { flex-wrap: wrap; }
/* Rows are grid items of .schedule-list, one level below main, so the rule
   above does not reach them — they were 316px inside a 256px list. */
.schedule-list > * { min-width: 0; }

/* On a phone the "Lunas" chip repeats what the green tick and the struck-through
   title already say, and it was eating the 58px the title needed — so the label
   truncated to "C…". Dropping the duplicate keeps rows one line and readable.
   The "Bulan ini" chip stays: that one is not encoded anywhere else. */
@media (max-width: 380px) { .row-badge.done { display: none; } }

/* "Cicilan #28" needs 82px and the row gave it 80 — every two-digit row lost its
   last character to the ellipsis. Buying 6px back from the gap and side padding
   fixes all 39 without changing the type scale. */
@media (max-width: 380px) { .payment-row { gap: 8px; padding: 10px 8px; } }
/* And when a row does carry a chip, let the chip drop to a second line rather
   than eat the title. Only the row that needs it grows. */
.row-title { flex-wrap: wrap; }
