:root {
  --bg: #f6faf7;
  --surface: #ffffff;
  --surface-2: #f1f7f3;
  --border: #e3ece6;
  --text: #0f1f17;
  --text-muted: #5a6b62;
  --accent: #16a34a;
  --accent-hover: #15803d;
  --accent-soft: #dcfce7;
  --danger: #dc2626;
  --warn: #ca8a04;
  --shadow-sm: 0 1px 2px rgba(15, 31, 23, 0.04);
  --shadow-md: 0 4px 16px rgba(15, 31, 23, 0.06);
  --shadow-lg: 0 12px 40px rgba(15, 31, 23, 0.10);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }

.app {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.01em;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent) 0%, #22c55e 100%);
  display: grid; place-items: center;
  color: #fff;
  box-shadow: 0 6px 16px rgba(22,163,74,0.32);
}
.brand-mark svg { width: 20px; height: 20px; }
.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent-hover);
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 13px;
}
.user-name { font-weight: 600; font-size: 14px; }

/* Balance card */
.balance-card {
  background: linear-gradient(135deg, #16a34a 0%, #22c55e 60%, #4ade80 100%);
  color: #fff;
  border-radius: 20px;
  padding: 28px 28px 26px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(22,163,74,0.25);
}
.balance-card::before, .balance-card::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(255,255,255,0.12); pointer-events: none;
}
.balance-card::before { width: 220px; height: 220px; right: -60px; top: -80px; }
.balance-card::after { width: 140px; height: 140px; right: 80px; bottom: -70px; }
.balance-label {
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.85;
  font-weight: 600;
}
.balance-amount {
  display: flex; align-items: baseline; gap: 10px;
  margin-top: 8px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.balance-amount .num { font-size: 44px; line-height: 1; }
.balance-amount .unit { font-size: 16px; font-weight: 600; opacity: 0.9; }
.balance-meta { margin-top: 14px; font-size: 13px; opacity: 0.85; }

/* Redeem window banner */
.window-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  box-shadow: var(--shadow-sm);
}
.window-banner .window-text { line-height: 1.4; }
.window-banner strong { font-weight: 700; }
.window-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--text-muted);
  flex: 0 0 10px;
  box-shadow: 0 0 0 4px rgba(90,107,98,0.15);
}
.window-banner.open {
  background: var(--accent-soft);
  border-color: #bbf7d0;
  color: var(--accent-hover);
}
.window-banner.open .window-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(22,163,74,0.18);
  animation: pulse 1.6s ease-in-out infinite;
}
.window-banner.before {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #9a3412;
}
.window-banner.before .window-dot {
  background: #ea580c;
  box-shadow: 0 0 0 4px rgba(234,88,12,0.18);
}
.window-banner.after {
  background: #f3f4f6;
  border-color: #e5e7eb;
  color: #4b5563;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(22,163,74,0.18); }
  50%      { box-shadow: 0 0 0 7px rgba(22,163,74,0.10); }
}

/* Flash */
.flash {
  margin-top: 18px;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash.success { background: var(--accent-soft); color: var(--accent-hover); border-color: #bbf7d0; }
.flash.error   { background: #fee2e2; color: #b91c1c; border-color: #fecaca; }
.flash.warn    { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* Tabs */
.tabs {
  display: inline-flex;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px;
  border-radius: 999px;
  margin: 28px 0 16px;
  box-shadow: var(--shadow-sm);
}
.tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 4px 10px rgba(22,163,74,0.30);
}

/* Reward grid — 2 cols on mobile, auto-fill on larger screens */
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 540px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
  }
}
.reward {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.reward:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cfe6d6;
}
.reward-img {
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  background-size: cover;
  background-position: center;
  display: grid;
  place-items: center;
  color: #b9c8c0;
}
.reward-img svg { width: 40%; height: 40%; opacity: 0.6; }
.reward-body {
  padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 8px;
  flex: 1;
}
.reward-name { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; }
.reward-desc {
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.reward-meta {
  display: flex; align-items: center; justify-content: flex-start; gap: 6px;
  font-size: 12px; color: var(--text-muted); margin-top: 4px;
}
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-hover);
}
.badge.warn { background: #fef3c7; color: #a16207; }
.badge.muted { background: var(--surface-2); color: var(--text-muted); }
.reward-foot {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.price {
  font-weight: 800;
  color: var(--text);
  display: flex; align-items: center; gap: 6px;
}
.price .pt { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.price-hidden {
  letter-spacing: 0.1em;
  color: #94a3b8;
}
.btn {
  border: 0; font: inherit;
  font-weight: 600; font-size: 13px;
  padding: 8px 14px; border-radius: 10px;
  cursor: pointer;
  background: var(--accent); color: #fff;
  transition: background .15s, transform .1s, box-shadow .15s;
}
.btn:hover:not(:disabled) {
  background: var(--accent-hover);
  box-shadow: 0 4px 10px rgba(22,163,74,0.30);
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { background: #cbd5d0; color: #fff; cursor: not-allowed; }
.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn.secondary:hover:not(:disabled) {
  background: var(--surface-2);
  box-shadow: none;
}
.reward-foot form { margin: 0; }

/* History list */
.history {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.history-row {
  display: grid;
  grid-template-columns: 48px 1fr auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
}
.history-row:first-child { border-top: 0; }
.history-thumb {
  width: 48px; height: 48px;
  border-radius: 10px;
  background: var(--surface-2) center/cover no-repeat;
  display: grid; place-items: center;
  color: #b9c8c0;
}
.history-thumb svg { width: 22px; height: 22px; }
.history-name { font-weight: 600; font-size: 14px; }
.history-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.history-cost { font-weight: 700; font-size: 14px; color: var(--text); }
.history-cost .pt { font-size: 11px; color: var(--text-muted); margin-left: 4px; font-weight: 600; }
.status-pill {
  font-size: 11px; font-weight: 600;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-muted);
}
.status-pill[data-status="0"] { background: #fee2e2; color: var(--danger); }
.status-pill[data-status="1"] { background: var(--accent-soft); color: var(--accent-hover); }
.status-pill[data-status="2"] { background: #fef3c7; color: var(--warn); }
.status-pill[data-status="3"] { background: #dbeafe; color: #1d4ed8; }

/* Shipping detail block under a delivered shipping redeem */
.shipping-info {
  margin: 0;
  padding: 12px 16px 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.shipping-info-title {
  font-weight: 700;
  font-size: 12.5px;
  color: var(--accent-hover);
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}
.shipping-info-list {
  margin: 0;
  display: grid;
  grid-template-columns: 88px 1fr;
  row-gap: 4px;
  column-gap: 12px;
}
.shipping-info-list dt {
  color: var(--text-muted);
  font-size: 12.5px;
  margin: 0;
}
.shipping-info-list dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}
.shipping-info-list strong {
  font-family: 'JetBrains Mono', ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  background: var(--surface);
  padding: 1px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.shipping-info .muted { color: var(--text-muted); }

.empty {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
  font-size: 14px;
}

/* Detail forms (cash / shipping) */
.warning-card {
  display: flex;
  gap: 14px;
  background: #fef2f2;
  border: 2px solid #fca5a5;
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 18px;
  color: #7f1d1d;
  font-size: 14px;
  line-height: 1.55;
}
.warning-card strong { font-weight: 700; color: #991b1b; }
.warning-icon { font-size: 22px; flex: 0 0 24px; line-height: 1.2; }

.detail-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.detail-form .form-row { display: flex; flex-direction: column; gap: 6px; margin-top: 0; }
.detail-form label { font-size: 13px; font-weight: 600; color: var(--text); }
.detail-form input[type="text"],
.detail-form input[type="tel"],
.detail-form select,
.detail-form textarea {
  font: inherit;
  font-size: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.detail-form textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.detail-form input:focus, .detail-form select:focus, .detail-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(22,163,74,0.18);
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* "Lengkapi" CTA button on history rows — self-contained pill */
.btn-mini.cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  background: linear-gradient(135deg, var(--accent) 0%, #22c55e 100%);
  color: #fff;
  box-shadow: 0 3px 10px rgba(22,163,74,0.32);
  cursor: pointer;
  transition: transform .12s ease, box-shadow .15s ease, filter .15s ease;
}
.btn-mini.cta::after {
  content: "›";
  font-size: 14px;
  line-height: 1;
  opacity: 0.85;
  transition: transform .15s ease;
}
.btn-mini.cta:hover {
  filter: brightness(1.05);
  box-shadow: 0 5px 14px rgba(22,163,74,0.42);
  transform: translateY(-1px);
}
.btn-mini.cta:hover::after { transform: translateX(2px); }
.btn-mini.cta:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(22,163,74,0.25);
}

/* Login screen */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  max-width: 380px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}
.login-card .brand-mark { margin: 0 auto; }
.login-card h2 { margin: 12px 0 6px; }
.login-card p { color: var(--text-muted); margin: 0; font-size: 14px; }

@media (max-width: 480px) {
  .balance-amount .num { font-size: 36px; }
  .balance-card { padding: 22px; }
  .history-row { grid-template-columns: 44px 1fr auto; }
  .history-row .status-pill { grid-column: 2 / 4; justify-self: start; margin-top: 4px; }
}

/* Tighter reward cards in 2-col mobile layout */
@media (max-width: 539px) {
  .reward-body { padding: 10px 12px 12px; gap: 6px; }
  .reward-name { font-size: 13.5px; }
  .reward-desc { font-size: 12px; line-height: 1.4; }
  .reward-meta { gap: 4px; }
  .badge { font-size: 10.5px; padding: 2px 6px; }
  .reward-foot { padding: 10px 12px; }
  .price { font-size: 13.5px; }
  .price .pt { font-size: 10px; }
  .reward-foot .btn { font-size: 12px; padding: 6px 10px; }
}
