:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --muted: #8b9cb3;
  --accent: #00d4aa;
  --accent-dim: #00a884;
  --warn: #f5a623;
  --error: #ff5c5c;
  --success: #3dd68c;
  --radius: 10px;
  --font: 'DM Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

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

a:hover {
  text-decoration: underline;
}

.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem;
}

.shell--wide {
  max-width: 1400px;
}

header.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

header.page-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

header.page-header p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge--pending {
  background: rgba(245, 166, 35, 0.15);
  color: var(--warn);
}

.badge--paid {
  background: rgba(61, 214, 140, 0.15);
  color: var(--success);
}

.badge--failed,
.badge--expired {
  background: rgba(255, 92, 92, 0.15);
  color: var(--error);
}

.banner {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  border: 1px solid transparent;
}

.banner--warn {
  background: rgba(245, 166, 35, 0.1);
  border-color: rgba(245, 166, 35, 0.35);
  color: #ffd89b;
}

.banner--info {
  background: rgba(0, 212, 170, 0.08);
  border-color: rgba(0, 212, 170, 0.25);
  color: #b8f5e8;
}

.banner--saved {
  background: rgba(61, 214, 140, 0.1);
  border-color: rgba(61, 214, 140, 0.35);
  color: #c8f5e0;
}

.banner--saved strong {
  color: var(--success);
}

.card-intro {
  margin: -0.25rem 0 1rem;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

.api-key-saved {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(61, 214, 140, 0.08);
  border: 1px solid rgba(61, 214, 140, 0.25);
  font-size: 0.85rem;
  color: var(--success);
}

.api-key-saved[hidden] {
  display: none !important;
}

.checkout-failure {
  margin-bottom: 1rem;
  font-size: 0.88rem;
}

.checkout-failure ul {
  margin: 0.5rem 0 0;
  padding-left: 1.2rem;
}

.api-key-saved {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
  padding: 0.5rem 0.65rem;
  border-radius: 8px;
  background: rgba(61, 214, 140, 0.08);
  border: 1px solid rgba(61, 214, 140, 0.25);
  font-size: 0.85rem;
  color: var(--success);
}

.api-key-saved[hidden] {
  display: none !important;
}

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

.card + .card {
  margin-top: 1rem;
}

.card h2 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.form-grid {
  display: grid;
  gap: 1rem;
}

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

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

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

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(0, 212, 170, 0.2);
}

.hint {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.35rem;
}

.hint--warn {
  color: #e8b86d;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: none;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

button:disabled,
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent);
  color: #042a22;
}

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

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

.btn-secondary:hover:not(:disabled) {
  background: #2d3d54;
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.status-line {
  margin-top: 0.75rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  display: none;
}

.status-line.visible {
  display: block;
}

.status-line--ok {
  background: rgba(61, 214, 140, 0.1);
  color: var(--success);
}

.status-line--err {
  background: rgba(255, 92, 92, 0.1);
  color: #ff9b9b;
}

.pay-layout {
  display: grid;
  gap: 1rem;
}

@media (min-width: 960px) {
  .pay-layout {
    grid-template-columns: 1fr 380px;
    align-items: start;
  }
}

.checkout-panel {
  min-height: 520px;
  display: flex;
  flex-direction: column;
}

.checkout-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

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

.checkout-launch {
  flex: 1;
  min-height: 200px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 1.25rem;
}

.checkout-launch__placeholder {
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}

.checkout-launch__url-label {
  margin: 0 0 0.35rem;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.checkout-launch__cta {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.85rem 1rem;
  font-size: 1rem;
}

.checkout-launch__url {
  display: block;
  word-break: break-all;
  font-family: var(--mono);
  font-size: 0.8rem;
  margin-bottom: 0.75rem;
}

.log-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 8rem);
}

.log-panel h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.log-live {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 1.5s ease infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.log-view {
  flex: 1;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.65rem;
  min-height: 320px;
  max-height: 70vh;
}

.log-entry {
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(45, 58, 79, 0.5);
  word-break: break-word;
}

.log-entry:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.log-ts {
  color: var(--muted);
}

.log-level--error {
  color: var(--error);
}

.log-level--warn {
  color: var(--warn);
}

.log-level--info {
  color: var(--accent);
}

.log-meta {
  color: #7a8fa8;
  white-space: pre-wrap;
  margin-top: 0.2rem;
}
