:root {
  --brand: #4f46e5;
  --brand-bright: #6366f1;
  --brand-violet: #8b5cf6;
  --brand-ink: #3730a3;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --border: #e3e6ef;
  --text: #1b1e28;
  --muted: #6e7480;
  --faint: #9aa1b2;
  --green: #16a765;
  --green-bg: rgba(22, 167, 101, 0.1);
  --orange: #c47a05;
  --orange-bg: rgba(245, 166, 35, 0.14);
  --red: #dc2626;
  --red-bg: rgba(239, 68, 68, 0.1);
  --purple: #7c3aed;
  --purple-bg: rgba(139, 92, 246, 0.12);
  --wa: #1faa59;
  --shadow: 0 18px 40px -28px rgba(23, 26, 38, 0.35), 0 2px 8px rgba(23, 26, 38, 0.04);
  --radius: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1117;
    --surface: #171a23;
    --surface-2: #1f2330;
    --border: #2a2f3d;
    --text: #f2f4f9;
    --muted: #9aa1b2;
    --faint: #6e7689;
    --brand-ink: #c7c9ff;
    --green: #34d399;
    --green-bg: rgba(52, 211, 153, 0.12);
    --orange: #fbbf24;
    --orange-bg: rgba(251, 191, 36, 0.12);
    --red: #f87171;
    --red-bg: rgba(248, 113, 113, 0.12);
    --purple: #a78bfa;
    --purple-bg: rgba(167, 139, 250, 0.14);
    --shadow: 0 18px 40px -28px rgba(0, 0, 0, 0.8), 0 2px 8px rgba(0, 0, 0, 0.3);
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(1100px 520px at 50% -18%, rgba(99, 102, 241, 0.16), transparent 68%),
    var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.page {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(28px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 2px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(135deg, var(--brand) 0%, var(--brand-violet) 100%);
  box-shadow: 0 10px 22px -12px rgba(79, 70, 229, 0.9);
}

.brand-mark svg {
  width: 22px;
  height: 22px;
}

.brand-copy {
  min-width: 0;
}

.brand-name {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  margin: 1px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.status-pill {
  flex: 0 0 auto;
  padding: 6px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.status-pill.is-pending {
  color: var(--orange);
  background: var(--orange-bg);
}

.status-pill.is-late {
  color: var(--red);
  background: var(--red-bg);
}

.status-pill.is-isolated {
  color: var(--purple);
  background: var(--purple-bg);
}

.status-pill.is-paid {
  color: var(--green);
  background: var(--green-bg);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 20px;
  color: #fff;
  border: 0;
  background:
    radial-gradient(420px 210px at 92% 0%, rgba(255, 255, 255, 0.2), transparent 62%),
    linear-gradient(135deg, #4f46e5 0%, #6366f1 46%, #8b5cf6 100%);
  box-shadow: 0 24px 46px -24px rgba(79, 70, 229, 0.65);
}

.hero::after {
  content: "";
  position: absolute;
  right: -46px;
  bottom: -76px;
  width: 190px;
  height: 190px;
  border: 26px solid rgba(255, 255, 255, 0.08);
  border-radius: 50%;
  pointer-events: none;
}

.hero.is-paid {
  background:
    radial-gradient(420px 210px at 92% 0%, rgba(255, 255, 255, 0.18), transparent 62%),
    linear-gradient(135deg, #0f9d63 0%, #16a765 55%, #34d399 100%);
  box-shadow: 0 24px 46px -24px rgba(22, 167, 101, 0.55);
}

.hero-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-label {
  font-size: 13px;
  font-weight: 600;
  opacity: 0.86;
}

.hero-period {
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.hero-amount {
  position: relative;
  z-index: 1;
  margin: 10px 0 2px;
  font-size: clamp(34px, 10vw, 44px);
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.hero-sub {
  position: relative;
  z-index: 1;
  margin: 6px 0 0;
  font-size: 12.5px;
  opacity: 0.88;
}

.hero-sub strong {
  font-weight: 700;
}

.hero-foot {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.meta-label {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.78;
  text-transform: uppercase;
}

.meta-value {
  margin: 2px 0 0;
  font-size: 13.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.hero-ref {
  text-align: right;
  min-width: 0;
}

.hero-ref .meta-value {
  overflow-wrap: anywhere;
}

.banner {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 12px;
  padding: 13px 15px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
}

.banner strong {
  font-size: 13.5px;
}

.banner-warn {
  color: var(--purple);
  background: var(--purple-bg);
  border: 1px solid color-mix(in srgb, var(--purple) 24%, transparent);
}

.banner-late {
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid color-mix(in srgb, var(--red) 24%, transparent);
}

.details,
.qris {
  margin-top: 12px;
  padding: 18px;
}

.section-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.detail-list {
  margin: 10px 0 0;
}

.detail-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.detail-row dt {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
}

.detail-row dd {
  margin: 0;
  text-align: right;
  font-size: 13.5px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.qris-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.qris-badge {
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--brand-ink);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.qr-wrap {
  width: min(230px, 72vw);
  margin: 16px auto 0;
  padding: 11px;
  background: #ffffff;
  border: 1px solid #e3e6ef;
  border-radius: 17px;
}

.qr-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
}

.qr-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
}

.qr-amount {
  margin: 10px 0 0;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.steps {
  margin: 16px 0 0;
  padding: 14px 16px 14px 32px;
  background: var(--surface-2);
  border-radius: 13px;
  color: var(--muted);
  font-size: 12.8px;
  line-height: 1.55;
}

.steps li + li {
  margin-top: 6px;
}

.steps strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.manual-text {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.payment-note {
  margin: 12px 2px 0;
  padding: 12px 14px;
  border-left: 3px solid var(--brand);
  border-radius: 0 10px 10px 0;
  background: color-mix(in srgb, var(--brand) 7%, var(--surface));
  color: var(--muted);
  font-size: 13px;
  white-space: pre-line;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-top: 16px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  padding: 12px 18px;
  border: 1px solid transparent;
  border-radius: 14px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, background-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:active {
  transform: scale(0.985);
}

.btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 38%, transparent);
  outline-offset: 2px;
}

.btn svg {
  flex: 0 0 auto;
  width: 19px;
  height: 19px;
}

.btn-wa {
  color: #ffffff;
  background: var(--wa);
  box-shadow: 0 14px 26px -16px rgba(31, 170, 89, 0.9);
}

.btn-ghost {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.btn-link {
  min-height: 44px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
}

.footer {
  margin-top: 20px;
  padding: 0 4px;
  color: var(--faint);
  font-size: 11.5px;
  line-height: 1.55;
  text-align: center;
}

.footer p {
  margin: 0;
}

.footer p + p {
  margin-top: 4px;
}

.privacy {
  display: inline-flex;
  align-items: flex-start;
  gap: 6px;
  text-align: left;
}

.privacy svg {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-top: 2px;
}

.state-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 34px 24px;
  text-align: center;
}

.state-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 50%;
}

.state-icon svg {
  width: 26px;
  height: 26px;
}

.state-icon--error {
  color: var(--red);
  background: var(--red-bg);
}

.state-icon--warn {
  color: var(--orange);
  background: var(--orange-bg);
}

.state-title {
  margin: 4px 0 0;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -0.015em;
}

.state-text {
  margin: 0;
  max-width: 300px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.55;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 10;
  max-width: min(360px, calc(100vw - 36px));
  padding: 11px 16px;
  border-radius: 12px;
  background: #171a26;
  color: #f2f4f9;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .toast {
    transition: none;
  }

  .spinner {
    animation-duration: 2.4s;
  }
}
