:root {
  --bg: #0a0a0f;
  --panel: #14141c;
  --panel2: #1a1a24;
  --border: #2a2a38;
  --text: #d4d4dc;
  --muted: #6b6b7a;
  --accent: #7c5cfc;
  --green: #34d399;
  --red: #f87171;
  --amber: #fbbf24;
  --radius: 10px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}
#app { max-width: 760px; margin: 0 auto; padding: 24px 20px 60px; }

header { text-align: center; margin-bottom: 32px; }
header h1 { font-size: 1.6rem; }
.subtitle { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.scope-note { color: var(--amber); font-size: 0.8rem; margin-top: 6px; }

.step {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  display: none;
}
.step.active { display: block; }
.step h2 {
  font-size: 1rem;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
}
.step-body { padding: 20px; }

.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.form-row input, .form-row select {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-family: inherit;
}
.form-row input:focus, .form-row select:focus { border-color: var(--accent); outline: none; }
.field-help { color: var(--muted); font-size: 0.8rem; margin-top: 6px; }
.inline-inputs { display: flex; align-items: center; gap: 10px; }
.inline-inputs input { width: 80px; }
.inline-inputs span { color: var(--muted); }

.btn {
  padding: 10px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel2);
  color: var(--text);
  cursor: pointer;
  font-size: 0.88rem;
  transition: all 0.15s;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #6a4fe0; }
.btn-warn { background: var(--amber); border-color: var(--amber); color: #1a1a24; }
.btn-warn:hover { background: #e0ae20; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn-danger:hover { background: #e55555; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.info-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
  font-family: monospace;
  word-break: break-all;
}
.info-box .label { color: var(--muted); }
.error-detail { color: var(--red); font-size: 0.8rem; overflow-wrap: anywhere; }

.status-area { margin-top: 16px; }

.service-card {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.service-card:hover { border-color: var(--accent); }
.service-card:disabled { cursor: not-allowed; opacity: 0.65; }
.service-card.selected { border-color: var(--green); background: #0f1f15; }
.service-card .endpoint { font-size: 0.9rem; font-weight: 600; }
.service-card .meta { font-size: 0.75rem; color: var(--muted); margin-top: 4px; }

.invoice-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  text-align: center;
}
.invoice-card .inv-label { font-size: 0.85rem; margin-bottom: 8px; }
.invoice-card canvas { border-radius: 8px; }
.invoice-card .inv-amount { font-size: 0.8rem; color: var(--muted); margin-top: 8px; }
.invoice-card .inv-bolt11 { font-size: 0.72rem; color: var(--muted); margin-top: 6px; word-break: break-all; max-height: 40px; overflow: hidden; }
.invoice-actions { display: flex; justify-content: center; gap: 8px; margin-top: 10px; }
.invoice-actions .btn { padding: 6px 10px; font-size: 0.75rem; text-decoration: none; }

.state-funded { color: var(--green); }
.state-settled { color: #60a5fa; }
.state-cancelled { color: var(--red); }
.state-disputed { color: var(--amber); }

.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

.resolution-panel {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-family: monospace;
  word-break: break-all;
}
.resolution-panel .label { color: var(--muted); }

#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; }
#toast.ok { background: #0f2f1f; border: 1px solid var(--green); color: var(--green); }
#toast.err { background: #2f0f0f; border: 1px solid var(--red); color: var(--red); }

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.paid-badge { color: var(--green); font-weight: 600; }
.pending-badge { color: var(--amber); }
.empty-result { color: var(--muted); padding: 12px 0; }
