:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --text: #1a1a1a;
  --hint: #6b7280;
  --muted: #9ca3af;
  --panel-bg: #f3f4f6;
  --border: #e5e7eb;
  --input-bg: #ffffff;
  --input-text: #1a1a1a;
  --button-bg: #2563eb;
  --button-text: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17212b;
    --text: #f5f5f5;
    --hint: #a8b3bd;
    --muted: #8a97a3;
    --panel-bg: #242f3d;
    --border: #34404d;
    --input-bg: #2b3847;
    --input-text: #f5f5f5;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

h1 { font-size: 1.5rem; margin: 0.5rem 0 0.25rem; }
h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hint);
  margin: 1.5rem 0.25rem 0.5rem;
}
.hint { color: var(--hint); margin: 0 0 1rem; }
.small { font-size: 0.8rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.hidden { display: none !important; }
em { font-style: normal; color: var(--muted); }

/* Top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.4rem; font-weight: 700; }
.logo { font-size: 1.2rem; }
.steps { display: flex; gap: 0.35rem; font-size: 0.75rem; }
.steps span {
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-bg);
}
.steps span.done { color: var(--ok); }
.steps span.done::before { content: "✓ "; }
.steps span.active { background: var(--button-bg); color: var(--button-text); }

/* Cards */
.card {
  background: var(--panel-bg);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}
.card-title { font-weight: 600; margin-bottom: 0.5rem; }

/* Form fields */
.field { display: block; margin-bottom: 0.85rem; }
.field > span { display: block; font-size: 0.8rem; color: var(--hint); margin-bottom: 0.3rem; }
input, select, textarea {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.75rem;
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--border);
  border-radius: 10px;
  outline: none;
}
textarea { resize: vertical; font-size: 0.85rem; }
input:focus, textarea:focus { border-color: var(--button-bg); }
.row { display: flex; gap: 0.5rem; }
.row input { flex: 1; font-size: 0.85rem; }

/* Buttons */
button {
  font: inherit;
  border: none;
  cursor: pointer;
  border-radius: 10px;
}
button.primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.8rem 1rem;
  font-weight: 600;
  background: var(--button-bg);
  color: var(--button-text);
}
button.primary:active { transform: scale(0.99); }
button.ghost {
  background: transparent;
  color: var(--button-bg);
  padding: 0.5rem 0.75rem;
  font-weight: 600;
}
button.ghost.small { border: 1px solid var(--border); background: var(--input-bg); }
button:disabled { opacity: 0.6; cursor: progress; }
button.loading::after {
  content: "";
  width: 0.9em;
  height: 0.9em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
button.next { margin-top: 0.25rem; animation: rise 0.25s ease-out; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.segmented { display: flex; background: var(--input-bg); border: 1px solid var(--border); border-radius: 10px; padding: 3px; }
.segmented button {
  flex: 1;
  padding: 0.5rem;
  background: transparent;
  color: var(--text);
  border-radius: 8px;
}
.segmented button.active { background: var(--button-bg); color: var(--button-text); }

/* HTTP method badges */
.method {
  display: inline-block;
  min-width: 3.6em;
  text-align: center;
  font: 700 0.7rem ui-monospace, Menlo, Consolas, monospace;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  color: #fff;
}
.method-get { background: #0ea5e9; }
.method-post { background: #16a34a; }
.method-patch, .method-put { background: #d97706; }
.method-delete { background: #dc2626; }
button.primary .method { background: rgba(255, 255, 255, 0.22); }

/* Responses */
.response { margin-top: 0.75rem; animation: rise 0.2s ease-out; }
.response-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.5rem; }
.status { font-weight: 700; font-size: 0.85rem; padding: 0.15rem 0.55rem; border-radius: 999px; color: #fff; }
.status.ok { background: var(--ok); }
.status.warn { background: var(--warn); }
.status.err { background: var(--err); }
.json {
  margin: 0;
  font: 0.8rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 320px;
  overflow: auto;
}
.endpoint .response { background: var(--bg); }

/* Registration documents */
.documents { display: grid; gap: 0.5rem; }
.doc-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
}
.doc-item input { width: 1.15rem; height: 1.15rem; flex: none; accent-color: var(--button-bg); }
.doc-item span { display: flex; flex-direction: column; min-width: 0; }
.doc-item small { overflow: hidden; text-overflow: ellipsis; }

/* Profile */
.profile { display: flex; align-items: center; gap: 0.75rem; }
.avatar {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: var(--button-bg);
  color: var(--button-text);
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-weight: 600; }
.profile-info .hint { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Endpoint list */
.list { padding: 0; overflow: hidden; }
.endpoint + .endpoint { border-top: 1px solid var(--border); }
.endpoint summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
  list-style: none;
}
.endpoint summary::-webkit-details-marker { display: none; }
.endpoint summary::after { content: "›"; margin-left: auto; color: var(--muted); font-size: 1.2rem; transition: transform 0.15s; }
.endpoint[open] summary::after { transform: rotate(90deg); }
.endpoint .path { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.endpoint .lock { font-size: 0.8rem; }
.endpoint-body { padding: 0 1rem 1rem; }

/* Mode switch & pretty mode */
.mode-switch { margin-bottom: 0.75rem; }
.tabs { display: flex; gap: 0.25rem; margin-bottom: 0.75rem; overflow-x: auto; }
.tabs button {
  flex: 1;
  padding: 0.55rem 0.5rem;
  background: var(--panel-bg);
  color: var(--text);
  font-weight: 600;
}
.tabs button.active { background: var(--button-bg); color: var(--button-text); }
.bank-card {
  width: 100%;
  display: grid;
  gap: 0.9rem;
  text-align: left;
  padding: 1.1rem;
  margin-bottom: 0.75rem;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(135deg, #1e3a8a, #2563eb 55%, #7c3aed);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.25);
}
.bank-card.muted { background: linear-gradient(135deg, #4b5563, #6b7280); box-shadow: none; }
.bank-card.processing {
  background: repeating-linear-gradient(135deg, #475569, #475569 12px, #64748b 12px, #64748b 24px);
  box-shadow: none;
  cursor: default;
  opacity: 0.85;
}
.bank-card-top { display: flex; justify-content: space-between; font-size: 0.85rem; opacity: 0.9; }
.bank-card-balance { font-size: 1.6rem; font-weight: 700; }
.actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; margin-bottom: 0.75rem; }
.action { padding: 0.75rem; background: var(--panel-bg); color: var(--text); font-weight: 600; text-align: left; }
.action.danger, button.danger { color: var(--err); }
button.primary.danger { background: var(--err); color: #fff; }
.product {
  width: 100%;
  display: block;
  text-align: left;
  padding: 1rem;
  margin-bottom: 0.6rem;
  background: var(--panel-bg);
  color: var(--text);
  border: 1px solid var(--border);
}
.product.muted { opacity: 0.6; cursor: not-allowed; }
.price { font-weight: 700; color: var(--button-bg); }
.line { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.35rem 0; }
.list .line + .line { border-top: 1px solid var(--border); }
.pad { padding: 0.7rem 1rem; }
.plus { color: var(--ok); }
.big { font-size: 1.15rem; font-weight: 700; margin: 0.4rem 0; }
.quote { margin-top: 0.75rem; }
.empty { text-align: center; }
.notice { padding: 0.7rem 0.85rem; border-radius: 10px; margin: 0.6rem 0; display: grid; gap: 0.5rem; }
.notice.ok { background: color-mix(in srgb, var(--ok) 15%, transparent); }
.notice.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); }
.notice.err { background: color-mix(in srgb, var(--err) 15%, transparent); color: var(--err); }
.card > button.primary, .notice button { margin-top: 0.25rem; }
dialog {
  border: none;
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  width: min(420px, 92vw);
  padding: 0;
}
dialog::backdrop { background: rgba(0, 0, 0, 0.45); }
.dialog-body { padding: 1.25rem; display: grid; gap: 0.75rem; }
.dialog-body h2 { margin: 0; font-size: 1.1rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.dialog-body .row button { flex: 1; }
