/* PlengBoost LIFF — minimal, mobile-first */
:root {
  --bg: #0b0b0c;
  --surface: #18181b;
  --surface-2: #27272a;
  --border: #3f3f46;
  --text: #fafafa;
  --muted: #a1a1aa;
  --primary: #dc2626;
  --primary-hover: #b91c1c;
  --success: #16a34a;
  --error: #dc2626;
  --radius: 12px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, "Helvetica Neue", "IBM Plex Sans Thai", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body { padding-bottom: env(safe-area-inset-bottom); }

.app { max-width: 480px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: rgba(11,11,12,.92); backdrop-filter: blur(8px);
  z-index: 10;
}
.topbar .brand { font-weight: 700; letter-spacing: .02em; }
.topbar button {
  background: transparent; border: 0; color: var(--text); font-size: 20px;
  width: 36px; height: 36px; border-radius: 8px; cursor: pointer;
}
.topbar button:active { background: var(--surface-2); }

.view { padding: 16px; flex: 1; }
.view h1 { font-size: 22px; margin: 8px 0; }
.muted { color: var(--muted); font-size: 14px; }
.center { text-align: center; }

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

.grid { display: grid; gap: 12px; }
.tier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer; transition: transform .1s, border-color .1s;
}
.tier-card:active { transform: scale(.98); }
.tier-card.popular { border-color: var(--primary); }
.tier-card .name { font-weight: 700; font-size: 18px; }
.tier-card .price { color: var(--primary); font-weight: 700; font-size: 24px; margin: 8px 0 4px; }
.tier-card .price small { color: var(--muted); font-size: 12px; font-weight: 400; }
.tier-card .range { color: var(--muted); font-size: 13px; }
.tier-card .eta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tier-card .badge { display: inline-block; background: var(--primary); color: #fff; font-size: 11px; padding: 2px 8px; border-radius: 999px; margin-left: 8px; }

.form label { display: block; margin-bottom: 14px; }
.form label > span { display: block; font-size: 14px; margin-bottom: 6px; color: var(--muted); }
.form input {
  width: 100%; padding: 12px 14px;
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px;
  font: inherit;
}
.form input:focus { outline: 2px solid var(--primary); border-color: transparent; }

.summary {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 0; border-top: 1px solid var(--border);
  margin: 8px 0 14px;
}
.summary .price { font-size: 22px; color: var(--primary); font-weight: 700; }

.btn-primary, .btn-ghost {
  display: block; width: 100%;
  padding: 14px; border-radius: 10px;
  border: 0; font: inherit; font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:active { background: var(--primary-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); margin-top: 8px; }

.qr-wrap { display: flex; justify-content: center; padding: 16px; background: #fff; border-radius: 8px; margin: 8px 0; }
.qr-wrap img { width: 100%; max-width: 280px; height: auto; }
.amount { text-align: center; font-size: 32px; font-weight: 700; color: var(--primary); }
.countdown { text-align: center; margin: 8px 0; }

.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 40px auto;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.checkmark {
  width: 64px; height: 64px; line-height: 64px; text-align: center;
  background: var(--success); color: #fff; font-size: 36px;
  border-radius: 50%; margin: 0 auto 16px;
}
.success { text-align: center; }
.error { text-align: center; }

.order-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; margin-bottom: 10px;
}
.order-card .row { display: flex; justify-content: space-between; align-items: center; }
.order-card .num { font-weight: 700; font-size: 14px; }
.order-card .status {
  display: inline-block; padding: 2px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600;
}
.status.pending    { background: #422006; color: #fbbf24; }
.status.paid       { background: #1e3a8a; color: #93c5fd; }
.status.processing { background: #1e3a8a; color: #93c5fd; }
.status.completed  { background: #14532d; color: #86efac; }
.status.partial    { background: #422006; color: #fbbf24; }
.status.failed     { background: #450a0a; color: #fca5a5; }
.status.cancelled  { background: #27272a; color: var(--muted); }
.status.refunded   { background: #27272a; color: var(--muted); }

/* ---- Toast --------------------------------------------------- */
.toast {
  position: fixed;
  left: 50%; bottom: 24px; transform: translateX(-50%) translateY(40px);
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .2s;
  z-index: 100;
  max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast[data-type="error"] { border-color: var(--error); color: #fca5a5; }
.toast[data-type="warn"]  { border-color: #d97706; color: #fbbf24; }
