:root {
  --bg: #0f1419;
  --panel: #1a2332;
  --border: #2d3a4f;
  --text: #e8edf5;
  --muted: #8fa3bf;
  --accent: #3b82f6;
  --accent-soft: #1e3a5f;
  --success: #22c55e;
  --error: #ef4444;
  --warn: #f59e0b;
  --radius: 12px;
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", "Consolas", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: linear-gradient(160deg, #0b1020 0%, #111827 50%, #0f172a 100%);
  color: var(--text);
  min-height: 100vh;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 2rem 2rem 1rem;
  border-bottom: 1px solid var(--border);
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 { margin: 0; font-size: 1.75rem; }
.subtitle { margin: 0.5rem 0 0; color: var(--muted); }

.badge {
  background: var(--accent-soft);
  color: #93c5fd;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid #2563eb;
}

.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 1rem;
  padding: 1rem 2rem 2rem;
  min-height: calc(100vh - 120px);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.sidebar {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.sidebar h2 {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

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

input, select, textarea {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}

textarea {
  min-height: 280px;
  resize: vertical;
  line-height: 1.5;
}

.facts div {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.facts dt { color: var(--muted); margin: 0; }
.facts dd { margin: 0; font-family: var(--mono); }

.scenario-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.scenario, .primary, .secondary {
  border: none;
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.scenario {
  background: #111827;
  color: var(--text);
  border: 1px solid var(--border);
  text-align: left;
}

.scenario:hover { border-color: var(--accent); background: #172033; }

.primary {
  background: var(--accent);
  color: white;
  font-weight: 600;
}

.secondary {
  background: transparent;
  color: #93c5fd;
  border: 1px solid #2563eb;
}

.workspace { padding: 1rem; }

.request-bar {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.path-input { font-family: var(--mono); }

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.response-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

#responseBody {
  margin: 0;
  min-height: 280px;
  max-height: 420px;
  overflow: auto;
  background: #0f172a;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.status-badge {
  font-family: var(--mono);
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  background: #1f2937;
}

.status-badge.ok { color: var(--success); }
.status-badge.err { color: var(--error); }
.status-badge.warn { color: var(--warn); }

.flow {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.flow h3 { margin: 0 0 0.5rem; color: var(--muted); font-size: 0.9rem; }
.flow ol { margin: 0 0 0.75rem; padding-left: 1.2rem; color: var(--muted); }

.hint { font-size: 0.78rem; color: var(--muted); line-height: 1.45; margin: 0 0 0.65rem; }
.hint a { color: #93c5fd; }

.citizen-section { margin-bottom: 0.5rem; }

.count-badge {
  font-size: 0.72rem;
  background: var(--accent-soft);
  color: #93c5fd;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  vertical-align: middle;
}

.filter-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.filter-row select {
  font-size: 0.75rem;
  padding: 0.45rem;
}

.citizen-list {
  max-height: 160px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background: #0f172a;
}

.citizen-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.45rem 0.6rem;
  cursor: pointer;
  font-size: 0.78rem;
}

.citizen-item:hover { background: #172033; }
.citizen-item.active { background: #1e3a5f; }
.citizen-item .meta { color: var(--muted); font-size: 0.72rem; margin-top: 0.15rem; }

#factAddress { font-size: 0.78rem; line-height: 1.4; }

@media (max-width: 960px) {
  .layout { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; }
}
