:root {
  --bg: #0a0a0a;
  --card: #0a0a0a;
  --border: #27272a;
  --border-strong: #3f3f46;
  --fg: #fafafa;
  --fg-muted: #a1a1aa;
  --fg-dim: #71717a;
  --primary: #fafafa;
  --primary-fg: #0a0a0a;
  --ok: #22c55e;
  --dead: #ef4444;
  --warn: #eab308;
  --radius: 8px;
  --radius-lg: 12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

.shell {
  width: 100%;
  max-width: 420px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: none;
  animation: in .2s ease;
}
.card.active { display: block; }
@keyframes in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.card-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.card-head h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.card-head h1 span {
  font-variant-numeric: tabular-nums;
}

.card-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
label {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg);
}

.input {
  display: flex;
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  height: 44px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus-within {
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.05);
}
.input-prefix {
  padding: 0 4px 0 12px;
  color: var(--fg-muted);
  font-size: 14px;
  font-weight: 500;
}
.input input {
  flex: 1;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--fg);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  padding: 0 12px 0 4px;
  min-width: 0;
  font-variant-numeric: tabular-nums;
  -webkit-appearance: none;
}
.input input::placeholder { color: var(--fg-dim); font-weight: 500; }

.error {
  font-size: 12px;
  color: var(--dead);
  margin-top: 2px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease, opacity .12s ease;
  user-select: none;
  width: 100%;
  -webkit-appearance: none;
}
.btn:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.btn-primary {
  background: var(--primary);
  color: var(--primary-fg);
}
.btn-primary:hover { background: #e4e4e7; }
.btn-primary:active { background: #d4d4d8; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--fg-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--fg); border-color: var(--border-strong); }
.btn-ghost:active { background: rgba(255,255,255,0.03); }

.btn-label { display: inline-block; }
.btn-spinner {
  position: absolute;
  width: 14px; height: 14px;
  border: 2px solid rgba(0,0,0,.25);
  border-top-color: var(--primary-fg);
  border-radius: 50%;
  display: none;
  animation: spin .7s linear infinite;
}
.btn.loading .btn-label { visibility: hidden; }
.btn.loading .btn-spinner { display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: transparent;
  white-space: nowrap;
}
.badge-pending { color: var(--warn); border-color: rgba(234,179,8,.3); }
.badge-pending .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--warn);
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .3; } }

.badge-ok { color: var(--ok); border-color: rgba(34,197,94,.3); }
.badge-dead { color: var(--dead); border-color: rgba(239,68,68,.3); }

.qr {
  align-self: center;
  background: #fff;
  padding: 12px;
  border-radius: var(--radius);
  width: fit-content;
  max-width: 100%;
}
.qr img {
  display: block;
  width: 192px;
  height: 192px;
  max-width: 100%;
  image-rendering: pixelated;
}

.pix-code {
  background: #09090b;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  overflow: hidden;
}
.pix-code code {
  font-family: ui-monospace, "SF Mono", "Menlo", monospace;
  font-size: 11px;
  color: var(--fg-muted);
  line-height: 1.5;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  position: fixed;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--fg);
  color: var(--primary-fg);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  transition: transform .18s ease, opacity .18s ease;
  pointer-events: none;
  z-index: 50;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 420px) {
  .card-head { padding: 16px 18px; }
  .card-body { padding: 18px; }
  .card-head h1 { font-size: 14px; }
  .qr img { width: 180px; height: 180px; }
}

@media (min-width: 768px) {
  .shell { max-width: 460px; }
}
