:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2d3f56;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #3ecf8e;
  --accent-dim: #2da86e;
  --danger: #f87171;
  --warning: #fbbf24;
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}

header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

header p {
  color: var(--muted);
  font-size: 0.95rem;
}

.grid {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: 1fr 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.card h2 {
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
}

.badge.connected {
  background: rgba(62, 207, 142, 0.15);
  color: var(--accent);
}

.badge.error {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

input,
select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 1rem;
}

input:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #0a1a12;
}

.btn-primary:hover:not(:disabled) {
  background: var(--accent-dim);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  margin-top: 0.75rem;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--border);
}

.merchant-info {
  font-size: 0.9rem;
  color: var(--muted);
}

.merchant-info dt {
  font-weight: 600;
  color: var(--text);
  margin-top: 0.75rem;
}

.merchant-info dd {
  margin-left: 0;
}

.qr-section {
  text-align: center;
}

.qr-section.hidden {
  display: none;
}

.qr-image {
  width: 220px;
  height: 220px;
  background: #fff;
  border-radius: 8px;
  padding: 0.5rem;
  margin: 0 auto 1rem;
}

.qr-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.payment-meta {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 1rem;
}

.payment-meta strong {
  color: var(--text);
}

.status-pill {
  display: inline-block;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status-pill.pending {
  background: rgba(251, 191, 36, 0.15);
  color: var(--warning);
}

.status-pill.paid {
  background: rgba(62, 207, 142, 0.15);
  color: var(--accent);
}

.status-pill.expired,
.status-pill.cancelled {
  background: rgba(248, 113, 113, 0.15);
  color: var(--danger);
}

.pay-link {
  display: inline-block;
  margin-top: 0.75rem;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.pay-link:hover {
  text-decoration: underline;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 2rem 1rem;
  font-size: 0.95rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.alert.error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--danger);
}

.alert.success {
  background: rgba(62, 207, 142, 0.12);
  border: 1px solid rgba(62, 207, 142, 0.3);
  color: var(--accent);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.polling-note {
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 1rem;
}
