:root {
  --orange: #E89400;
  --blue: #004C94;
  --pix: #32BCAD;
  --pix-bg: #e6f9f7;
  --pix-text: #0f7a6e;
  --text: #161a22;
  --text-muted: #6b7280;
  --placeholder: #9aa1b0;
  --border: #d7dbe2;
  --border-light: #eef0f3;
  --bg: #ffffff;
  --bg-soft: #f4f6f8;
  --bg-card: #f7f9fb;
  --dark-bg: #0c0f14;
  --dark-card: #161a22;
  --dark-card-2: #1c2129;
  --dark-text-muted: #6b7280;
  --dark-text-dim: #8891a5;
  --green: #1a9e6a;
  --amber-bg: #fdf3e0;
  --amber-border: #f1dcab;
  --amber-icon: #b8790f;
  --amber-text: #7a5a12;
  --red-text: #c22a2a;
  --red-border: #eab8b8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-soft);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--blue); text-decoration: none; }

button { font-family: inherit; cursor: pointer; }
input, select { font-family: inherit; }

#app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  position: relative;
}

.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg);
}
.screen.dark { background: var(--dark-bg); }
.screen.soft { background: var(--bg-soft); }

/* header */
.header {
  padding: 18px 20px 8px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.header-title { color: var(--text); font-size: 15px; font-weight: 700; }
.header-title.on-dark { color: #fff; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%;
  background: #f4f6f8; border: none;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.icon-btn.on-dark { background: rgba(255,255,255,0.12); }
.icon-btn svg { pointer-events: none; }

/* progress bar (5 steps) */
.progress-bar { display: flex; gap: 4px; flex: 1; }
.progress-seg { flex: 1; height: 4px; border-radius: 2px; background: var(--border-light); }
.progress-seg.filled { background: var(--orange); }

.content { padding: 20px 24px 0 24px; flex: 1; min-height: 0; overflow-y: auto; }
.content.no-top-pad { padding-top: 8px; }

.title { color: var(--text); font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.subtitle { color: var(--text-muted); font-size: 13.5px; line-height: 1.5; margin-bottom: 24px; }

.field { margin-bottom: 16px; }
.field-label { color: #374151; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; }
.field-label .optional { color: var(--placeholder); font-weight: 400; }
.field-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 13px 14px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
}
.field-input::placeholder { color: var(--placeholder); }
.field-input:focus { outline: none; border-color: var(--blue); }
.field-row { display: flex; gap: 12px; }
.field-row > .field { flex: 1; margin-bottom: 16px; }

.hint-box {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 10px; padding: 12px 14px; margin-bottom: 20px;
  color: var(--text-muted); font-size: 11.5px; line-height: 1.5;
}
.hint-box.tight { background: none; border: none; padding: 0; margin-top: 14px; margin-bottom: 0; }

.footer { padding: 16px 24px 28px 24px; }
.footer .link-secondary { display: block; text-align: center; color: var(--text-muted); font-size: 12.5px; margin-top: 14px; }

.btn {
  width: 100%; border: none; border-radius: 12px; padding: 15px;
  font-size: 15px; font-weight: 700; display: flex; align-items: center;
  justify-content: center; gap: 8px;
}
.btn-primary { background: var(--orange); color: #fff; }
.btn-primary:disabled { opacity: 0.5; }
.btn-outline-danger { background: #fff; color: var(--red-text); border: 1.5px solid var(--red-border); }
.btn-ghost-link { background: none; color: var(--placeholder); font-size: 12.5px; font-weight: 500; padding: 8px; }

/* charger summary card */
.charger-card {
  background: var(--bg-card); border: 1px solid var(--border-light);
  border-radius: 14px; padding: 16px; display: flex; align-items: center; gap: 12px;
  margin-bottom: 18px;
}
.charger-icon {
  width: 48px; height: 48px; border-radius: 10px; background: #eef3f8;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.charger-id { color: var(--text); font-size: 14.5px; font-weight: 700; font-family: ui-monospace, monospace; }
.charger-meta { color: var(--text-muted); font-size: 12px; }

.kv-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 20px; }
.kv-row {
  display: flex; justify-content: space-between; padding: 12px 2px;
  border-bottom: 1px solid var(--border-light); font-size: 13px;
}
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--text-muted); }
.kv-row .v { color: var(--text); font-weight: 600; }

/* payment option cards */
.pay-option {
  display: flex; align-items: center; gap: 14px; text-align: left;
  background: #fff; border: 1.5px solid #e2e5ea; border-radius: 14px;
  padding: 16px; position: relative; width: 100%; margin-bottom: 12px;
}
.pay-option.selected { border-color: var(--blue); }
.pay-option .check {
  position: absolute; top: 12px; right: 12px; width: 20px; height: 20px;
  border-radius: 50%; background: var(--blue); display: flex; align-items: center; justify-content: center;
}
.pay-option-icon {
  width: 46px; height: 46px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.pay-option-title { color: var(--text); font-size: 14.5px; font-weight: 700; }
.pay-option-desc { color: var(--text-muted); font-size: 12px; margin-top: 2px; }

/* card visual */
.card-visual {
  border-radius: 16px; padding: 20px;
  background: linear-gradient(135deg, #0c2338 0%, #004C94 100%);
  color: #fff; margin-bottom: 24px; position: relative; overflow: hidden;
}
.card-visual-glow {
  position: absolute; right: -30px; top: -30px; width: 120px; height: 120px;
  border-radius: 50%; background: rgba(255,255,255,0.08);
}
.card-visual-top { display: flex; justify-content: space-between; align-items: center; position: relative; }
.card-visual-number { font-size: 18px; letter-spacing: 0.12em; margin-top: 26px; font-family: ui-monospace, monospace; position: relative; }
.card-visual-bottom { display: flex; justify-content: space-between; margin-top: 18px; font-size: 11.5px; opacity: 0.85; position: relative; }

/* pix amounts */
.amount-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.amount-chip {
  border: 1.5px solid #e2e5ea; border-radius: 10px; padding: 12px 0; text-align: center;
  color: #374151; font-size: 13.5px; font-weight: 600; background: #fff;
}
.amount-chip.selected { border-color: var(--pix); background: var(--pix-bg); color: var(--pix-text); font-weight: 700; }

.pix-box {
  display: flex; flex-direction: column; align-items: center; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: 14px; padding: 20px;
}
.pix-qr {
  width: 160px; height: 160px; background: #fff; border: 1px solid #e2e5ea; border-radius: 10px;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.pix-copy-btn {
  display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; color: #374151; font-size: 12.5px; font-weight: 600;
}
.spinner {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border);
  border-top-color: var(--orange); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* charging (dark) */
.live-badge { display: flex; align-items: center; gap: 6px; color: #34c785; font-size: 11.5px; font-weight: 600; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: #34c785; }
.charge-ring {
  width: 200px; height: 200px; border-radius: 50%; border: 10px solid var(--dark-card-2);
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.charge-ring-value { color: #fff; font-size: 30px; font-weight: 700; text-align: center; }
.charge-ring-label { color: var(--dark-text-dim); font-size: 11.5px; margin-top: 2px; text-align: center; }
.stat-row { display: flex; gap: 10px; margin-top: 26px; }
.stat-card { flex: 1; background: var(--dark-card); border-radius: 12px; padding: 14px; }
.stat-card .label { color: var(--text-muted); font-size: 10.5px; }
.stat-card .value { color: #fff; font-size: 17px; font-weight: 700; margin-top: 4px; }
.charging-sheet { background: #fff; border-radius: 20px 20px 0 0; padding: 22px 20px 28px 20px; }

/* receipt */
.receipt-icon-wrap { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 24px; }
.receipt-check {
  width: 64px; height: 64px; border-radius: 50%; background: #e2f6ec;
  display: flex; align-items: center; justify-content: center; margin-bottom: 14px;
}
.receipt-total-box { background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 14px; padding: 18px; text-align: center; margin-bottom: 20px; }
.receipt-total-box .amount { color: var(--text); font-size: 32px; font-weight: 700; margin-top: 4px; }

/* profile */
.profile-header { background: #fff; padding: 20px 24px 24px 24px; border-radius: 0 0 20px 20px; }
.avatar {
  width: 56px; height: 56px; border-radius: 50%; background: #eef3f8;
  display: flex; align-items: center; justify-content: center; color: var(--blue);
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-box { background: #fff; border-radius: 12px; padding: 14px; }
.stat-box .label { color: var(--placeholder); font-size: 11px; }
.stat-box .value { color: var(--text); font-size: 19px; font-weight: 700; margin-top: 4px; }
.wallet-card {
  background: linear-gradient(135deg, #0f8a7c 0%, #0c6e63 100%); border-radius: 12px;
  padding: 16px; display: flex; align-items: center; justify-content: space-between;
}
.wallet-card .label { color: #d8f3ef; font-size: 11px; }
.wallet-card .value { color: #fff; font-size: 18px; font-weight: 700; margin-top: 2px; }
.topup-btn { background: rgba(255,255,255,0.15); color: #fff; font-size: 11.5px; font-weight: 600; padding: 8px 12px; border-radius: 8px; border: none; white-space: nowrap; }
.section-title { color: var(--text); font-size: 13.5px; font-weight: 700; }
.list-card { background: #fff; border-radius: 12px; overflow: hidden; }
.list-row { display: flex; justify-content: space-between; align-items: center; padding: 13px 14px; border-bottom: 1px solid var(--border-light); }
.list-row:last-child { border-bottom: none; }
.pm-row { background: #fff; border-radius: 12px; padding: 14px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.badge-default { background: #eaf1ff; color: var(--blue); font-size: 10.5px; padding: 3px 8px; border-radius: 12px; font-weight: 600; }
.empty-state { color: var(--placeholder); font-size: 12.5px; text-align: center; padding: 20px 0; }

/* bottom nav */
.bottom-nav {
  background: #fff; border-top: 1px solid #e2e5ea; padding: 12px 24px 22px 24px;
  display: flex; justify-content: space-around;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--placeholder); background: none; border: none; }
.nav-item.active { color: var(--blue); }
.nav-item span { font-size: 10px; }
.nav-item.active span { font-weight: 700; }
.nav-item.disabled { opacity: 0.4; }

/* scan */
.scan-frame { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; }
.scan-square { width: 250px; height: 250px; position: relative; }
.scan-corner { position: absolute; width: 36px; height: 36px; border-color: var(--orange); border-style: solid; }
.scan-hint { text-align: center; color: #c7cbd6; font-size: 13px; padding: 0 40px 24px 40px; }
.scan-sheet { background: #fff; border-radius: 20px 20px 0 0; padding: 22px 20px 28px 20px; box-shadow: 0 -8px 24px rgba(0,0,0,0.25); }
.found-badge { display: flex; align-items: center; gap: 6px; color: #1a9e6a; font-size: 11.5px; font-weight: 600; margin-bottom: 10px; }
.found-dot { width: 7px; height: 7px; border-radius: 50%; background: #1a9e6a; }
#scan-video { width: 100%; border-radius: 12px; background: #000; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  background: var(--text); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13px; max-width: 90%; text-align: center; z-index: 50;
  box-shadow: 0 6px 20px rgba(0,0,0,0.2);
}
.toast.error { background: var(--red-text); }

.otp-inputs { display: flex; gap: 10px; justify-content: center; margin-bottom: 22px; }
.otp-box {
  width: 44px; height: 54px; border: 1.5px solid var(--border); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: var(--text);
  font-size: 20px; font-weight: 700; text-align: center; background: #fff;
}
.otp-box:focus { outline: none; border-color: var(--blue); }

.loading-page { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px; text-align: center; }
.loading-page .spinner { width: 28px; height: 28px; border-width: 3px; }
.loading-page p { color: var(--text-muted); font-size: 13px; }
