:root {
  --teal-900: #134e4a;
  --teal-700: #0f766e;
  --teal-600: #0d9488;
  --teal-50: #f0fdfa;
  --ink: #14201e;
  --muted: #5b6b68;
  --line: #d7e5e2;
  --danger: #b91c1c;
  --ok: #047857;
  --card: rgba(255, 255, 255, 0.92);
  --shadow: 0 18px 50px rgba(19, 78, 74, 0.12);
  --radius: 18px;
  font-family: "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  line-height: 1.45;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100dvh;
  background: #e8f4f1;
}

.bg-wash {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 480px at 10% -10%, #99f6e4 0%, transparent 55%),
    radial-gradient(700px 420px at 100% 0%, #bae6fd 0%, transparent 50%),
    linear-gradient(165deg, #ecfdf5 0%, #e0f2fe 45%, #f8fafc 100%);
}

.shell {
  width: min(560px, calc(100% - 1.5rem));
  margin: 0 auto;
  padding: 1.5rem 0 2.5rem;
}

.brand {
  text-align: center;
  margin-bottom: 1.25rem;
}
.brand-lockup {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  background: #070b12;
  border-radius: 16px;
  padding: 0.35rem 0.7rem;
}
.brand-logo-img {
  height: 64px;
  width: auto;
  display: block;
}
.brand-tag {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.steps {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
  padding: 0;
  margin: 0 0 1rem;
}
.steps li {
  text-align: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.45rem 0.2rem;
  border-radius: 999px;
  background: rgba(255,255,255,0.55);
  border: 1px solid transparent;
}
.steps li.is-active {
  color: var(--teal-900);
  background: #fff;
  border-color: #99f6e4;
}
.steps li.is-done {
  color: var(--ok);
  background: #ecfdf5;
}

.panel {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem 1.25rem 1.5rem;
  animation: rise 0.35s ease both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

h1 {
  font-family: "Fraunces", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  color: var(--teal-900);
  letter-spacing: -0.02em;
}
.lede {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.9rem;
}
.field span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--teal-900);
}
.field input {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.85rem 0.95rem;
  font: inherit;
  font-size: 1.05rem;
  background: #fff;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field input:focus {
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.18);
}

.card-modal[hidden] { display: none; }
.card-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.card-modal-panel {
  background: #fff;
  width: min(420px, 100%);
  max-height: min(92dvh, 640px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  overflow: auto;
  box-shadow: var(--shadow);
}
.card-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.card-modal-bar strong { font-size: 1rem; }
.card-modal-close { padding: 0.35rem 0.7rem; }
.card-modal-body {
  padding: 1.1rem 1rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}
.card-modal-body p {
  margin: 0;
  color: var(--muted);
}

.pay-methods {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
  margin: 0.25rem 0 1rem;
}
.pay-methods .method {
  text-align: left;
  border: 1.5px solid #d1d5db;
  background: #fff;
  border-radius: 0.85rem;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
}
.pay-methods .method strong { display: block; font-size: 0.95rem; }
.pay-methods .method span { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.78rem; }
.pay-methods .method.is-active {
  border-color: #0f766e;
  background: #f0fdfa;
}
.btn-row {
  display: flex;
  gap: 0.6rem;
  margin-top: 0.4rem;
}
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  border-radius: 12px;
  padding: 0.85rem 1.1rem;
  transition: transform 0.12s, background 0.15s, opacity 0.15s;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
  flex: 1;
  background: linear-gradient(180deg, var(--teal-600), var(--teal-700));
  color: #fff;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.28);
}
.btn-primary:hover:not(:disabled) { background: linear-gradient(180deg, #14b8a6, var(--teal-700)); }
.btn-ghost {
  background: #fff;
  color: var(--teal-900);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--teal-50); }

.captcha-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
}
.captcha-img {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #f0fdf4;
  max-width: 100%;
  height: auto;
}

.meter-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}
.tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.55rem 0.75rem;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
}
.tab.is-active {
  background: var(--teal-50);
  color: var(--teal-900);
  border-color: #99f6e4;
}

.meter-shot {
  position: relative;
  margin: 0 auto 0.65rem;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0f172a;
  max-width: 240px;
  max-height: 280px;
}
.meter-shot img {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
  object-position: center 28%;
}
.callout {
  position: absolute;
  left: 10%;
  top: 58%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  pointer-events: none;
  animation: pulse 1.8s ease-in-out infinite;
}
.callout-three {
  left: 8%;
  top: 56%;
}
.callout-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 6px rgba(245, 158, 11, 0.35), 0 0 0 2px #fff;
}
.callout-label {
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.55rem;
  border-radius: 8px;
  letter-spacing: 0.01em;
}
@keyframes pulse {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.unit-card {
  background: linear-gradient(135deg, #ecfdf5, #e0f2fe);
  border: 1px solid #99f6e4;
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-bottom: 1.1rem;
}
.unit-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--teal-700);
}
.unit-number {
  font-family: "Fraunces", Georgia, serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--teal-900);
  letter-spacing: -0.02em;
  margin-top: 0.15rem;
}
.unit-meta {
  margin-top: 0.25rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.quick-amounts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin: -0.2rem 0 1rem;
}
.quick-amounts button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  padding: 0.55rem 0.2rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--teal-900);
  cursor: pointer;
}
.quick-amounts button:hover,
.quick-amounts button.is-selected {
  border-color: var(--teal-600);
  background: var(--teal-50);
}

.summary {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
}
.summary > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}
.summary dt { color: var(--muted); font-size: 0.9rem; }
.summary dd { margin: 0; font-weight: 700; color: var(--teal-900); }

.msg {
  margin: 0.85rem 0 0;
  padding: 0.7rem 0.85rem;
  border-radius: 10px;
  font-size: 0.9rem;
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}
.msg.is-ok {
  background: #ecfdf5;
  color: var(--ok);
  border-color: #a7f3d0;
}

.status-icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 0.75rem;
  background: #ecfdf5;
  color: var(--ok);
  font-size: 1.6rem;
  font-weight: 700;
}
.status-icon.is-fail { background: #fef2f2; color: var(--danger); }
.status-icon.is-ok { background: #ecfdf5; color: var(--ok); }

.spinner {
  width: 26px;
  height: 26px;
  border: 3px solid #99f6e4;
  border-top-color: var(--teal-700);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.spinner.inline {
  width: 14px;
  height: 14px;
  border-width: 2px;
  vertical-align: -2px;
  margin-right: 0.35rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.status-card {
  margin: 0 0 1rem;
  padding: 0.75rem 0.95rem;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  text-align: left;
}
.status-card > div {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.3rem 0;
  font-size: 0.9rem;
}
.status-card span { color: var(--muted); }
.status-card strong { color: var(--teal-900); font-weight: 700; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: 0.04em; }

.delivery-box {
  text-align: left;
  border-radius: 14px;
  padding: 1rem;
  margin-bottom: 1rem;
  border: 2px solid var(--line);
}
.delivery-box.downlink {
  border-color: #22c55e;
  background: #f0fdf4;
}
.delivery-box.keypad {
  border-color: #f59e0b;
  background: #fffbeb;
}
.delivery-box.pending {
  border-color: #fbbf24;
  background: #fffbeb;
}
.delivery-box.fail {
  border-color: #f87171;
  background: #fef2f2;
}
.delivery-title {
  margin: 0 0 0.35rem;
  font-weight: 700;
  color: var(--teal-900);
}
.delivery-desc {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}
.token-label {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
}
.token {
  margin: 0 0 0.75rem;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  word-break: break-all;
  color: var(--ink);
}

#step-done { text-align: center; }
#step-done .btn-primary { width: 100%; margin-top: 0.25rem; }
#step-done .btn-ghost { width: 100%; }

.foot {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.foot a { color: var(--teal-700); text-decoration: none; font-weight: 600; }
.foot a:hover { text-decoration: underline; }

.back-home {
  margin: 0 0 0.75rem;
  font-size: 0.85rem;
}
.back-home a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.back-home a:hover { color: var(--teal-700); }

@media (max-width: 420px) {
  .quick-amounts { grid-template-columns: repeat(2, 1fr); }
  .unit-number { font-size: 1.7rem; }
  .meter-shot, .meter-shot img { max-height: 240px; height: 240px; }
}
