:root {
  color-scheme: dark;
  --bg: #0a0a0a;
  --bg-elevated: #111111;
  --border: #2a2a2a;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --accent: #fafafa;
  --accent-dim: #d4d4d8;
  --danger: #f87171;
  --ok: #86efac;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 6px;
  --max: 68rem;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent-dim);
}

code,
pre,
.mono {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.site-header__inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  font-weight: 600;
  letter-spacing: -0.02em;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
}

.logo span {
  color: var(--muted);
  font-weight: 400;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
  font-size: 0.9rem;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--text);
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

/* Landing */
.hero {
  padding: 2rem 0 3.5rem;
}

.hero__eyebrow {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 1rem;
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.15;
  max-width: 22ch;
}

.hero__lead {
  margin: 0 0 2rem;
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 42ch;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.15rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.btn--primary {
  background: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}

.btn--primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  color: var(--bg);
}

.btn--ghost {
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--muted);
}

.section {
  padding: 2.5rem 0;
  border-top: 1px solid var(--border);
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

.section p {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
}

.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.node-pill {
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
  text-align: center;
  color: var(--muted);
  background: var(--bg-elevated);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
}

/* Control center */
.control-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  margin-bottom: 1.5rem;
}

.field {
  flex: 1 1 12rem;
  min-width: 0;
}

.field label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.5rem 0.65rem;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 1px solid var(--muted);
  outline-offset: 0;
}

.api-hint {
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0;
}

.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.tab {
  padding: 0.65rem 1rem;
  font: inherit;
  font-size: 0.9rem;
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text);
}

.tab.is-active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

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

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  margin-bottom: 1rem;
  background: var(--bg-elevated);
}

.card h3 {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 0.5rem 0 0.75rem;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.65rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.empty {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.5rem 0;
}

.flash {
  border: 1px solid var(--ok);
  background: rgba(134, 239, 172, 0.08);
  padding: 1rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}

.flash__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ok);
  margin: 0 0 0.5rem;
}

.flash pre {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.error-banner {
  border: 1px solid var(--danger);
  background: rgba(248, 113, 113, 0.08);
  color: var(--danger);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr));
  gap: 0.75rem;
}

.stat {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.stat__value {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.stat__label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

pre.overview-json {
  margin: 1rem 0 0;
  padding: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  font-size: 0.8rem;
}

@media (max-width: 600px) {
  .hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }
}