/* ═══════════════════════════════════════════════════════════════════
   promptlibretto studio — "Manuscript"
   Warm editorial dark mode — burnished copper accents on deep umber.
   Artisanal warmth meets precision tooling.
   ═══════════════════════════════════════════════════════════════════ */

:root {
  /* Warm umber palette */
  --bg: #0d0b09;
  --panel: #15120f;
  --panel-2: #1c1914;
  --panel-3: #24201a;
  --border: #332e26;
  --border-subtle: #272219;

  /* Typography — cream on dark */
  --text: #ede6db;
  --text-dim: #c4b9a8;
  --muted: #7d7264;
  --muted-soft: #5a5147;

  /* Accent palette — burnished copper with dusty blue complement */
  --accent: #d4915c;
  --accent-glow: rgba(212, 145, 92, 0.12);
  --accent-2: #94b4d4;
  --accent-rose: #c46b6b;
  --warn: #d4a84c;
  --error: #c45858;

  /* Derived */
  --pill-bg: #1a1710;

  /* Fonts */
  --font-display: 'Crimson Pro', 'Georgia', serif;
  --font-body: 'Manrope', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Consolas', monospace;

  /* Noise overlay — warm grain texture */
  --noise: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

/* ── Global typography ─────────────────────────────────────────── */
body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* subtle noise texture across the entire page */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--noise);
  background-repeat: repeat;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ── Scrollbars ────────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 6px; height: 0; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #4a4035; }

/* ── Animations ────────────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 16px 4px var(--accent-glow); }
}

/* ── Header ────────────────────────────────────────────────────── */
header {
  padding: 0 20px;
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--panel);
  position: relative;
}
/* decorative warm rule under header — copper to amber fade */
header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--warn) 30%, rgba(212, 145, 92, 0.1) 70%, transparent);
}

/* Brand cluster */
.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
header h1 {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  font-style: italic;
  margin: 0;
  letter-spacing: 0.01em;
  color: var(--accent);
}
/* Page navigation tabs beside the brand */
.header-page-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px;
}
.header-page-link {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 160ms ease;
}
.header-page-link:hover:not(.active) {
  color: var(--text-dim);
  background: rgba(212, 145, 92, 0.06);
}
.header-page-link.active {
  color: var(--accent);
  background: var(--panel);
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  cursor: default;
}

/* Snapshot indicator */
.snapshot-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: 2px;
  padding: 4px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
}
.snapshot-indicator[hidden] { display: none; }
.snapshot-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 1100px) {
  .snapshot-name { max-width: 220px; }
}
.snapshot-dirty {
  font-size: 10px;
  font-weight: 600;
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.snapshot-dirty[hidden] { display: none; }
.snapshot-save-btn {
  background: var(--accent);
  color: #0d0b09;
  border: none;
  font-family: var(--font-body);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: opacity 150ms ease;
}
.snapshot-save-btn[hidden] { display: none; }
.snapshot-save-btn:hover { opacity: 0.85; }
.header-nav-btn {
  background: transparent;
  color: var(--muted);
  border: none;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  text-decoration: none;
  transition: all 160ms ease;
  display: inline-flex;
  align-items: center;
}
.header-nav-btn:hover {
  color: var(--text);
  background: rgba(212, 145, 92, 0.06);
}
.header-nav-btn.header-nav-accent {
  color: var(--accent);
  background: rgba(212, 145, 92, 0.08);
  border: 1px solid rgba(212, 145, 92, 0.2);
  font-weight: 600;
}
.header-nav-btn.header-nav-accent:hover {
  background: rgba(212, 145, 92, 0.14);
  border-color: var(--accent);
}
.header-nav-sep {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}

/* Meta status chips — right-aligned */
.header-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.meta-chip {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
  color: var(--muted-soft);
  background: var(--panel-2);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px 10px 2px;
  white-space: nowrap;
  transition: color 180ms ease, border-color 180ms ease;
}
.meta-chip:hover {
  color: var(--muted);
  border-color: var(--border);
}

.connection-slot { display: inline-flex; }
.meta-chip--action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.meta-chip--action .chip-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted-soft);
  box-shadow: 0 0 0 1px var(--border-subtle) inset;
}
.meta-chip--action .chip-dot[data-ok="1"] {
  background: #d4915c;
  box-shadow: 0 0 6px rgba(212, 145, 92, 0.5);
}
.meta-chip--action .chip-sep { color: var(--border-subtle); }
.meta-chip--action .chip-model { color: var(--muted); }

#conn-status[data-kind="ok"] { color: #d4915c; }
#conn-status[data-kind="warn"] { color: #d4915c; }
#conn-status[data-kind="err"] { color: #c45858; }

.conn-cors-warning {
  border: 1px solid rgba(212, 145, 92, 0.35);
  background: rgba(212, 145, 92, 0.08);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}
.conn-cors-warning strong { color: #d4915c; }
.conn-cors-warning code {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--panel-2);
  border: 1px solid var(--border-subtle);
  color: var(--text);
}
.conn-cors-warning .conn-origin-hint { color: var(--accent-2); }

/* Runtime fill panel (pick_persona + slot→pool mapping). */
.runtime-fill {
  padding: 0;
  margin-bottom: 8px;
}
.runtime-fill .runtime-fill-row { padding: 6px 0; }
.runtime-fill select,
.runtime-fill input[type="number"] {
  font-family: var(--font-mono);
  font-size: 11px;
}
.runtime-fill-slots {
  padding: 8px 10px;
  border: 1px dashed var(--border-subtle, #2a2a2a);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.01);
}

/* Persona cards (flat, no collapsible) — for v2.1 examples. */
.persona-card {
  padding: 10px 12px;
  margin-bottom: 6px;
  border: 1px solid var(--border-subtle, #2a2a2a);
  border-radius: 6px;
  background: var(--panel-2, #1a1a1a);
  font-size: 12px;
}
.persona-card .persona-text {
  color: var(--text, #eee);
  margin-bottom: 6px;
  line-height: 1.4;
}
.persona-card .persona-nudges {
  margin: 0;
  padding-left: 18px;
  color: var(--muted, #888);
  font-size: 11px;
  line-height: 1.45;
}
.persona-card .persona-nudges li { margin-bottom: 2px; }

.persona-card--selectable .persona-text { cursor: pointer; }
.persona-card--selectable .persona-nudges li { cursor: pointer; padding: 1px 4px; border-radius: 3px; }
.persona-card--selectable .persona-text:hover { color: var(--accent, #d4915c); }
.persona-card--selectable .persona-nudges li:hover { background: rgba(212,145,92,0.08); }
.persona-card.is-selected {
  border-color: var(--accent, #d4915c);
  box-shadow: 0 0 0 1px var(--accent, #d4915c) inset;
}
.persona-card .persona-nudge.is-selected {
  background: rgba(212,145,92,0.18);
  color: var(--text, #eee);
}
#persona-list.selectable-disabled .persona-card--selectable {
  opacity: 0.55;
  pointer-events: none;
}

.route-slot-value {
  font-family: var(--font-mono);
  font-size: 12px;
  width: 100%;
  min-height: 28px;
  max-height: 220px;
  resize: vertical;
  line-height: 1.45;
}
.route-slot-empty {
  border-color: rgba(212, 145, 92, 0.35);
  background: rgba(212, 145, 92, 0.05);
}
.route-slot-empty .route-slot-value { border-color: rgba(212, 145, 92, 0.4); }


/* ── Buttons ───────────────────────────────────────────────────── */
input, select, textarea, button {
  font-family: inherit;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
input, select, textarea {
  width: 100%;
  max-width: 100%;
  min-width: 0;
}
textarea {
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

button {
  background: var(--accent);
  color: #0d0b09;
  font-weight: 600;
  border: none;
  cursor: pointer;
  padding: 7px 16px;
  border-radius: 4px;
  font-size: 13px;
  letter-spacing: 0.01em;
  transition: all 160ms ease;
}
button:hover { filter: brightness(1.1); transform: translateY(-1px); }
button:active { transform: translateY(0); }
button.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}
button.ghost:hover { color: var(--text); border-color: var(--accent); }
button.small { padding: 4px 8px; font-size: 12px; }

button.example {
  background: linear-gradient(135deg, var(--accent), #b07040);
  color: #0d0b09;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  box-shadow: 0 2px 8px rgba(212, 145, 92, 0.2);
}
button.example:hover { box-shadow: 0 4px 16px rgba(212, 145, 92, 0.3); }

button.help {
  background: var(--panel-2);
  color: var(--muted-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 20px;
  height: 20px;
  padding: 0;
  font-size: 11px;
  font-weight: 700;
  font-family: var(--font-display);
  line-height: 1;
  cursor: pointer;
  margin-left: 4px;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 200ms ease;
  position: relative;
}
button.help:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(212, 145, 92, 0.1);
  box-shadow: 0 0 8px rgba(212, 145, 92, 0.15);
  transform: scale(1.1);
}

.ghost-action {
  align-self: flex-start;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.ghost-action:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-glow); }

.primary-action {
  background: linear-gradient(135deg, var(--accent), #b07040);
  color: #0d0b09;
  font-weight: 600;
  border: none;
  padding: 7px 18px;
  border-radius: 4px;
  font-size: 13px;
  letter-spacing: 0.02em;
  box-shadow: 0 2px 10px rgba(212, 145, 92, 0.2);
}
.primary-action:hover { box-shadow: 0 4px 20px rgba(212, 145, 92, 0.35); }
.primary-action:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  box-shadow: none;
}

.base-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions { display: flex; align-items: center; gap: 10px; margin-top: 4px; }
.inline { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }

/* ── Modal ─────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(13, 11, 9, 0.8);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  width: min(580px, 92vw);
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(212, 145, 92, 0.06);
  animation: fadeInUp 200ms ease-out;
}
.modal-card header {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 8px 8px 0 0;
}
.modal-card header h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  color: var(--accent);
}
.modal-close {
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--text); }
.modal-card--wide {
  width: min(720px, 94vw);
  max-height: 85vh;
}
.modal-body {
  padding: 18px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.6;
}
.modal-body p { margin: 0 0 10px 0; }
.modal-body p:last-child { margin-bottom: 0; }
.modal-body code {
  background: var(--panel-3);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
}
.modal-body ul { margin: 6px 0 10px 18px; padding: 0; }
.modal-body li { margin-bottom: 4px; }
.modal-body strong { color: var(--accent-2); }

/* Dialog variants */
.modal-body .dialog-form { display: flex; flex-direction: column; gap: 10px; }
.modal-body .dialog-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.modal-body .dialog-form .hint { font-size: 12px; color: var(--muted); }
.modal-body .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.modal-body .dialog-actions .primary { background: var(--accent); color: #0d0b09; font-weight: 600; border: none; }
.modal-body .library-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.modal-body .library-item {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 180ms ease;
}
.modal-body .library-item:hover { border-color: var(--accent); }
.modal-body .library-item .item-head { display: flex; align-items: center; gap: 8px; }
.modal-body .library-item .item-name { font-weight: 600; color: var(--accent); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.modal-body .library-item .item-date { font-size: 11px; color: var(--muted); font-family: var(--font-mono); }
.modal-body .library-item .item-text {
  font-size: 12px; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere;
  max-height: 4.5em; overflow: hidden; text-overflow: ellipsis;
}
.modal-body .library-item .item-actions { display: flex; gap: 6px; }
.modal-body .library-empty { color: var(--muted); font-style: italic; }

/* ── Policy Editor ─────────────────────────────────────────────── */
.policy-editor {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}
.policy-editor > legend {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  padding: 0 4px;
}
.policy-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.policy-row > label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex: 1;
}
.policy-check {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.policy-check input[type="checkbox"] { margin: 0; width: auto; }
.policy-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.policy-label small { text-transform: none; font-weight: 400; letter-spacing: 0; }
.policy-field {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.policy-field textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  resize: vertical;
}
.policy-field input[type="text"] {
  font-family: var(--font-mono);
  font-size: 12px;
}

/* ── Main Grid ─────────────────────────────────────────────────── */
main.grid {
  display: grid;
  grid-template-columns: minmax(420px, 480px) minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  height: calc(100vh - 52px);
  overflow: hidden;
}
main.grid.no-debug { grid-template-columns: minmax(420px, 480px) minmax(0, 1fr); }
main.grid.no-debug .debug-panel { display: none; }

/* ── Panels ────────────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  min-height: 0;
  animation: fadeInUp 350ms ease-out both;
}
.panel:nth-child(2) { animation-delay: 60ms; }
.panel:nth-child(3) { animation-delay: 120ms; }

.panel h2 {
  font-family: var(--font-display);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 4px 0;
  font-weight: 600;
}
.panel h3 {
  font-family: var(--font-display);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 8px 0 4px 0;
  font-weight: 600;
}
.panel h4 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 10px 0 2px 0;
  font-weight: 600;
  font-family: var(--font-body);
}

/* ── Controls Panel (tabbed left column) ───────────────────────── */
.controls-panel {
  padding: 0;
  gap: 0;
  overflow: hidden;
  border-color: var(--border);
  position: relative;
}
/* warm glow along left edge */
.controls-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), transparent 70%);
  opacity: 0.3;
  z-index: 1;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  flex-shrink: 0;
}
.tabs .tab {
  flex: 1 1 0;
  background: transparent;
  color: var(--muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 11px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 180ms ease;
  font-family: var(--font-body);
}
.tabs .tab:hover { color: var(--text-dim); background: rgba(212, 145, 92, 0.04); }
.tabs .tab.active {
  color: var(--text);
  background: var(--panel);
  border-bottom-color: var(--accent);
}
.tabs .tab-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--border);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-mono);
  transition: all 180ms ease;
}
.tabs .tab.active .tab-num { background: var(--accent); color: #0d0b09; }
.tabs .tab .help { margin-left: 0; }

.tab-panel {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 14px;
  padding-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tab-panel[hidden] { display: none; }

/* ── Fields & Labels ───────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span, .field > legend { font-size: 12px; color: var(--muted); }
.field > .field-label { padding: 0; }

.field-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  font-family: var(--font-body);
}

/* Route select + buttons row */
.route-controls {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.route-controls select { flex: 1; min-width: 140px; }

.subhead {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
  margin-top: 4px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 10px;
  font-family: var(--font-body);
}
.subhead:first-child { border-top: none; padding-top: 0; margin-top: 0; }
.subhead .spacer { flex: 1; }
.subhead .inline-num {
  width: 48px;
  padding: 2px 6px;
  font-size: 12px;
  text-align: center;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
  font-weight: 500;
  font-family: var(--font-mono);
}

.muted { color: var(--muted); font-size: 12px; }

/* ── Grid-2 (generation overrides) ─────────────────────────────── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 12px;
  padding: 8px 0;
}
.grid-2 label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--muted); }
.grid-2 input { padding: 4px 6px; font-family: var(--font-mono); font-size: 12px; }

/* ── Overlay Suggestions ───────────────────────────────────────── */
.overlay-suggestions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--accent-glow);
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 8px;
}
.overlay-suggestions[hidden] { display: none; }
.suggestion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-weight: 600;
}
.suggestion-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: border-color 180ms ease;
}
.suggestion-card:hover { border-color: var(--accent); }
.suggestion-card.added { opacity: 0.55; }
.suggestion-top { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.suggestion-top .spacer { flex: 1; }
.suggestion-top .suggestion-name { color: var(--accent); font-weight: 600; font-family: var(--font-mono); font-size: 11px; }
.suggestion-text { font-size: 12px; color: var(--text-dim); line-height: 1.4; }
.suggestion-scenario {
  font-size: 12px; color: var(--text); line-height: 1.4; padding: 4px 8px;
  background: var(--accent-glow); border-left: 2px solid var(--accent); border-radius: 2px;
}
.suggestion-slot { display: flex; flex-direction: column; gap: 3px; }
.suggestion-slot > span {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 600;
}
.suggestion-slot .slot-input { padding: 4px 8px; font-size: 12px; }
.suggestion-rationale { font-size: 11px; font-style: italic; color: var(--muted); }
.suggestion-error { font-size: 12px; color: var(--warn); }
button.primary.small { padding: 2px 8px; font-size: 11px; background: var(--accent); color: #0d0b09; }
button.ghost.small { padding: 2px 8px; font-size: 11px; }

/* ── Overlay List & Cards ──────────────────────────────────────── */
.overlay-list { display: flex; flex-direction: column; gap: 6px; }
/* ── Policy display (read-only in compose tab) ────────────────── */
.policy-display {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 6px 0;
}
.policy-display-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
}
.policy-display-key {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 140px;
}
.policy-display-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
}

/* ── Policy field grid (preset editor modal) ──────────────────── */
.policy-field-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.policy-field-grid > label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.policy-field-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.policy-field-row-small {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.policy-field-row-small > label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.policy-check-label {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding-bottom: 4px;
}

.section-list { display: flex; flex-direction: column; gap: 8px; }
.section-card textarea.section-text {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  min-height: 72px;
  line-height: 1.5;
}
.section-card .section-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.section-slot-tests {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.slot-test-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.slot-test-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  min-width: 80px;
  flex-shrink: 0;
  padding-top: 6px;
  line-height: 1.3;
}
.slot-test-control {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.slot-test-select {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 8px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  appearance: auto;
}
.slot-test-select:focus {
  border-color: var(--accent);
  outline: none;
}
.slot-test-custom-row {
  display: flex;
  gap: 4px;
  align-items: flex-start;
}
.slot-test-custom {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 5px 8px;
  border: 1px dashed var(--border);
  background: rgba(212, 145, 92, 0.04);
  color: var(--text);
  border-radius: 4px;
  resize: vertical;
  min-height: 32px;
  transition: border-color 180ms ease;
}
.slot-test-custom:focus {
  border-color: var(--accent);
  border-style: solid;
  outline: none;
}
.slot-test-save-btn {
  flex-shrink: 0;
  padding: 4px 8px !important;
  font-size: 14px !important;
  line-height: 1;
  margin-top: 2px;
}
.slot-list { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px 0; }
.overlay-card {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  overflow: hidden;
  transition: border-color 180ms ease;
}
.overlay-card:hover { border-color: var(--accent); }
.overlay-card > summary {
  list-style: none;
  cursor: pointer;
  padding: 6px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.overlay-card > summary::-webkit-details-marker { display: none; }
.overlay-card .chevron {
  color: var(--muted);
  font-size: 10px;
  transition: transform 160ms ease;
  flex-shrink: 0;
}
.overlay-card[open] .chevron { transform: rotate(90deg); }
.overlay-card .name { font-weight: 600; color: var(--accent); font-family: var(--font-mono); font-size: 12px; flex-shrink: 0; }
.overlay-card .text {
  color: var(--muted); font-size: 12px; flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.overlay-card[open] > summary .text { display: none; }
.overlay-card button.remove {
  background: transparent; color: var(--accent-rose); border: 1px solid var(--border);
  padding: 2px 6px; font-size: 11px; flex-shrink: 0;
}
.overlay-card button.remove:hover { border-color: var(--accent-rose); background: rgba(196, 107, 107, 0.1); }
.overlay-card .overlay-body {
  padding: 0 10px 10px 22px; display: flex; flex-direction: column; gap: 6px;
  border-top: 1px dashed var(--border-subtle); padding-top: 8px; margin-top: 2px;
}
.overlay-card .overlay-full {
  font-size: 12px; color: var(--text-dim); line-height: 1.45;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.overlay-card .overlay-edit-field { display: flex; flex-direction: column; gap: 3px; }
.overlay-card .overlay-edit-field > span {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 600;
}
.overlay-card .edit-priority { width: 80px; }
.overlay-card .edit-text { font-family: var(--font-mono); font-size: 12px; }
.overlay-card .runtime-fields {
  display: flex; flex-direction: column; gap: 6px;
  padding: 6px 8px; margin-top: 2px;
  border: 1px dashed var(--border); border-radius: 4px;
  background: rgba(212, 145, 92, 0.03);
}
.overlay-card .runtime-fields[hidden] { display: none; }
.overlay-card .runtime-fields input {
  font-family: var(--font-mono); font-size: 12px;
}
.overlay-card .overlay-edit-status { font-size: 11px; min-height: 14px; }
.overlay-card.dirty .overlay-edit-status .save-state { color: var(--warn); }
/* Drag-and-drop reordering */
.overlay-card > summary .drag-handle {
  cursor: grab; color: var(--muted); font-size: 14px; flex-shrink: 0;
  user-select: none; line-height: 1; padding: 0 2px;
  opacity: 0.5; transition: opacity 150ms ease;
}
.overlay-card > summary:hover .drag-handle { opacity: 1; }
.overlay-card.dragging { opacity: 0.4; border-color: var(--accent); }
.overlay-card.drag-over { border-top: 2px solid var(--accent); margin-top: -2px; }
.overlay-form input#overlay-priority[hidden] { display: none; }

.overlay-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
}
.overlay-form input#overlay-template {
  font-family: var(--font-mono);
  font-size: 12px;
}
.overlay-form input#overlay-template[hidden] { display: none; }
.overlay-form .actions { gap: 6px; margin-top: 0; }

/* ── Injections ────────────────────────────────────────────────── */
.injection-groups { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; min-width: 0; }
.injection-group { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.injection-group .group-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
.injection-group .group-label {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.1em; font-weight: 600; flex-shrink: 0;
}
.injection-group .segmented {
  display: inline-flex; flex: 1 1 auto;
  border: 1px solid var(--border); border-radius: 999px;
  overflow: hidden; background: var(--panel-2); min-width: 0;
}
.injection-group .segmented .seg {
  flex: 1 1 0; background: transparent; color: var(--muted);
  border: none; border-radius: 0; padding: 4px 10px;
  font-size: 12px; font-weight: 500; cursor: pointer;
  white-space: nowrap; min-width: 0; overflow: hidden;
  text-overflow: ellipsis; transition: all 160ms ease;
}
.injection-group .segmented .seg + .seg { border-left: 1px solid var(--border); }
.injection-group .segmented .seg:hover { color: var(--text-dim); background: rgba(212, 145, 92, 0.06); }
.injection-group .segmented .seg.active {
  background: var(--accent);
  color: #0d0b09;
  font-weight: 600;
}

/* ── Injection editor ──────────────────────────────────────────── */
.inj-edit-btn {
  background: transparent;
  color: var(--muted-soft);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 160ms ease;
}
.inj-edit-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(212, 145, 92, 0.1);
}
.inj-edit-btn.overridden {
  color: var(--warn);
  border-color: var(--warn);
}
.inj-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  margin-top: 4px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.inj-editor-wrap[hidden] { display: none; }
.inj-editor-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.inj-editor-label strong {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 11px;
}
.inj-editor-textarea {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
  resize: vertical;
  min-height: 48px;
}
.inj-editor-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.checklist { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; }
.checklist label { display: flex; align-items: center; gap: 8px; font-size: 13px; }

/* ── Shared panel header base ──────────────────────────────────── */
.panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--border);
}
.panel-header .section-title {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
  font-style: italic;
}
.panel-header .spacer { flex: 1; }

/* ── Output Panel ──────────────────────────────────────────────── */
.output-panel { padding: 10px; gap: 8px; }
.output-panel > .panel-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 6px 10px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
}
.panel-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}
.panel-header-row .spacer { flex: 1; }
.output-panel > .panel-header .section-title {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
  font-style: italic;
}

/* Generation controls strip — toggles + buttons in one bar */
.gen-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px;
}
.gen-controls .switch {
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  transition: background 160ms ease;
}
.gen-controls .switch:hover {
  background: rgba(212, 145, 92, 0.06);
}
.gen-controls .switch[hidden] { display: none; }
.gen-controls-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
  flex-shrink: 0;
}
.gen-controls-sep[hidden] { display: none; }

/* Action buttons — usable inside gen-controls or standalone */
.action-btn {
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 160ms ease;
  white-space: nowrap;
}
.action-btn--secondary {
  background: transparent;
  color: var(--text-dim);
}
.action-btn--secondary:hover {
  background: rgba(212, 145, 92, 0.1);
  color: var(--text);
}
.action-btn--secondary[hidden] { display: none; }
.action-btn--primary {
  background: linear-gradient(135deg, var(--accent), #b07040);
  color: #0d0b09;
  box-shadow: 0 1px 4px rgba(212, 145, 92, 0.25);
}
.action-btn--primary:hover {
  filter: brightness(1.1);
  box-shadow: 0 2px 10px rgba(212, 145, 92, 0.35);
}
.action-btn--primary:disabled {
  background: var(--border);
  color: var(--muted);
  cursor: not-allowed;
  filter: none;
  box-shadow: none;
}
.output-panel-body > .output-meta,
.output-panel-body > .reject-banner,
.output-panel-body > #output-rendered,
.output-panel-body > #output-raw { margin: 0 4px; }
.output-panel-body > .output-meta { padding-top: 4px; }

/* ── Switch toggle ─────────────────────────────────────────────── */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  color: var(--muted);
}
.switch input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.switch .switch-track {
  position: relative;
  width: 30px; height: 16px;
  background: var(--border);
  border-radius: 999px;
  transition: background 180ms ease;
  flex-shrink: 0;
}
.switch .switch-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 12px; height: 12px;
  background: var(--muted);
  border-radius: 50%;
  transition: transform 180ms ease, background 180ms ease;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(14px);
  background: #0d0b09;
}
.switch input:focus-visible + .switch-track {
  outline: 1px solid var(--accent);
  outline-offset: 2px;
}
.switch .switch-label { color: var(--muted); }
.switch input:checked ~ .switch-label { color: var(--text-dim); }

/* ── Output Tabs ───────────────────────────────────────────────── */
.output-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin: 8px 0 0;
}
.output-tab {
  padding: 6px 14px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 4px 4px 0 0;
  color: var(--muted);
  user-select: none;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: color 160ms ease;
}
.output-tab:hover { color: var(--text-dim); }
.output-tab[aria-selected="true"] {
  color: var(--accent);
  border-color: var(--border);
  background: rgba(212, 145, 92, 0.06);
  margin-bottom: -1px;
  padding-bottom: 7px;
}
.output-panels { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.output-panel-body { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 6px; overflow-y: auto; padding-bottom: 8px; }
.output-panel-body[hidden] { display: none; }

/* ── Output Meta Pills ─────────────────────────────────────────── */
.output-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.output-meta .spacer { flex: 1; }

/* Rejection banner */
.reject-banner {
  background: rgba(196, 107, 107, 0.1);
  border: 1px solid var(--accent-rose);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--accent-rose);
  font-family: var(--font-mono);
  line-height: 1.5;
}
.reject-banner[hidden] { display: none; }
.reject-banner .reject-title {
  font-weight: 700;
  margin-bottom: 4px;
}
.reject-banner .reject-detail {
  color: var(--text-dim);
  font-size: 11px;
}

/* Route detail & policy display */
.route-detail {
  display: flex;
  gap: 6px;
  align-items: baseline;
  margin-top: 2px;
}
.route-detail-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  flex-shrink: 0;
}
.route-detail-value {
  font-size: 12px;
  color: var(--text-dim);
}
.route-policy-fieldset {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px 8px;
  margin: 0;
}
.route-policy-fieldset > legend {
  font-size: 10px;
  padding: 0 4px;
}
.route-policy-list {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.route-policy-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  line-height: 1.4;
}
.route-policy-item .pol-key {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent-2);
  font-weight: 600;
  flex-shrink: 0;
  min-width: 120px;
}
.route-policy-item .pol-val {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  word-break: break-all;
}

.pill {
  background: var(--pill-bg);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  color: var(--muted);
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
  border: 1px solid var(--border-subtle);
}
.pill.ok { color: var(--accent-2); border-color: rgba(138, 171, 127, 0.25); }
.pill.bad { color: var(--error); border-color: rgba(196, 88, 88, 0.25); }

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.view-toggle .toggle {
  background: transparent;
  color: var(--muted);
  border: none;
  border-radius: 0;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 160ms ease;
}
.view-toggle .toggle.active {
  background: var(--accent);
  color: #0d0b09;
  font-weight: 600;
}

/* ── Output Text ───────────────────────────────────────────────── */
.output-text {
  background: var(--panel-2);
  padding: 14px;
  border-radius: 6px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 13px;
  overflow-y: auto;
  max-width: 100%;
  box-sizing: border-box;
  margin: 0;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--border-subtle);
}

/* Editable raw textarea */
.output-raw-edit {
  resize: vertical;
  color: var(--text);
  line-height: 1.5;
}
.output-raw-edit:not([readonly]) {
  border-color: var(--accent);
  background: var(--panel);
  cursor: text;
}
.output-raw-edit[readonly] {
  cursor: default;
}

/* Rendered markdown variant */
.output-text.markdown {
  white-space: pre-wrap;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
}
.output-text.markdown > *:first-child { margin-top: 0; }
.output-text.markdown > *:last-child { margin-bottom: 0; }
.output-text.markdown h1,
.output-text.markdown h2,
.output-text.markdown h3,
.output-text.markdown h4,
.output-text.markdown h5,
.output-text.markdown h6 {
  margin: 18px 0 6px 0;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 600;
  font-family: var(--font-display);
}
.output-text.markdown h1 { font-size: 22px; color: var(--accent); }
.output-text.markdown h2 { font-size: 18px; }
.output-text.markdown h3 { font-size: 15px; color: var(--accent); }
.output-text.markdown h4 { font-size: 14px; color: var(--accent-2); }
.output-text.markdown h5,
.output-text.markdown h6 { font-size: 12px; color: var(--muted); }
.output-text.markdown p { margin: 6px 0; }
.output-text.markdown ul,
.output-text.markdown ol { margin: 6px 0 6px 22px; padding: 0; }
.output-text.markdown li { margin: 2px 0; }
.output-text.markdown strong { color: var(--accent); }
.output-text.markdown em { color: var(--text-dim); font-style: italic; }
.output-text.markdown code {
  background: rgba(212, 145, 92, 0.08);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
}
.output-text.markdown pre.md-code {
  background: #0a0907;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  overflow-x: auto;
  margin: 8px 0;
}
.output-text.markdown pre.md-code code {
  background: transparent;
  border: none;
  padding: 0;
  color: var(--text-dim);
  font-size: 12px;
}
.output-text.markdown a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(212, 145, 92, 0.35);
}
.output-text.markdown a:hover { text-decoration-color: var(--accent); }

/* ── Pre-generate Stage ────────────────────────────────────────── */
.prompt-stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: rgba(212, 145, 92, 0.03);
  margin: 0 4px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  box-sizing: border-box;
}
.prompt-stage .stage-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
.prompt-stage .stage-banner .spacer { flex: 1; }
.prompt-stage h4 {
  margin: 0 0 6px 0;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  font-family: var(--font-body);
}
.prompt-stage .stage-group {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.prompt-stage .stage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-height: 24px;
}
.prompt-stage .stage-empty { font-size: 12px; padding: 4px 2px; }
.stage-card {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  background: rgba(212, 145, 92, 0.04);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: grab;
  font-family: var(--font-mono);
  font-size: 12px;
  white-space: pre-wrap;
  user-select: none;
  transition: border-color 180ms ease, background 180ms ease;
}
.stage-card:hover { border-color: var(--accent); }
.stage-card:active { cursor: grabbing; }
.stage-card.dragging { opacity: 0.4; }
.stage-card.drop-before { border-top: 2px solid var(--accent); }
.stage-card.drop-after  { border-bottom: 2px solid var(--accent); }
.stage-card .handle { color: var(--muted); flex-shrink: 0; line-height: 1.4; }
.stage-card .body { flex: 1; overflow-wrap: anywhere; }

/* Runtime slot cards in pre-generate */
.stage-slot {
  border-color: var(--accent);
  border-style: dashed;
  background: rgba(212, 145, 92, 0.04);
}
.stage-slot-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.stage-slot-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.stage-slot-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
}
.stage-slot-mode {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
}
.stage-slot-mode.required {
  color: var(--accent-rose);
  background: rgba(196, 107, 107, 0.12);
}
.stage-slot-mode.optional {
  color: var(--muted);
  background: var(--panel-3);
}
.stage-slot-input {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 4px 8px;
  width: 100%;
}

/* ── Debug Panel ───────────────────────────────────────────────── */
.debug-panel { padding: 10px; gap: 8px; }
.debug-panel > .panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px 10px;
  border-bottom: 1px solid var(--border);
}
.debug-panel > .panel-header .section-title {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 600;
  font-style: italic;
}
.debug-panel .debug-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0 6px 16px;
}
.debug-panel .debug-body h4:first-child { margin-top: 4px; }
.debug-panel .debug-body .trace { max-height: none; overflow-y: visible; }

.trace {
  background: var(--panel-2);
  padding: 10px;
  border-radius: 4px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 12px;
  margin: 0;
  max-width: 100%;
  max-height: max-content;
  overflow-y: auto;
  box-sizing: border-box;
  color: var(--muted);
  border: 1px solid var(--border-subtle);
  line-height: 1.5;
}

/* ── details/summary ───────────────────────────────────────────── */
.panel details { min-width: 0; display: block; }
.panel summary { min-width: 0; margin-bottom: 8px; }
.panel details > h4:first-of-type { margin-top: 4px; }
.panel details > h4 { margin: 12px 0 4px 0; }
.panel details > .trace + h4 { margin-top: 14px; }
details summary { cursor: pointer; color: var(--muted); padding: 4px 0; font-size: 12px; }
details summary:hover { color: var(--text-dim); }

/* ── Iterate Strip ─────────────────────────────────────────────── */
.iterate-strip {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
}

.turn-badge {
  display: inline-block; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.5px; background: rgba(212, 145, 92, 0.15);
  color: var(--accent); padding: 1px 6px; border-radius: 3px; margin-left: 4px;
  font-family: var(--font-mono);
}
.turn-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-subtle);
}
.turn-verbatim-peek summary { cursor: pointer; font-size: 11px; }
.turn-verbatim-peek pre {
  white-space: pre-wrap; margin: 4px 0 0; padding: 6px 8px;
  background: rgba(212, 145, 92, 0.04); border-radius: 4px;
  font-size: 11px; max-height: 120px; overflow-y: auto;
}

/* ── Python syntax highlight ───────────────────────────────────── */
.py-hl { font-family: var(--font-mono); }
.py-hl .k  { color: #c46b6b; }
.py-hl .s  { color: var(--accent-2); }
.py-hl .c  { color: var(--muted-soft); font-style: italic; }
.py-hl .n  { color: var(--accent); }
.py-hl .b  { color: var(--accent-2); }
.py-hl .f  { color: #94b4d4; }
.py-hl .d  { color: #b09acc; }

/* ── About / Tour slideshow ────────────────────────────────────── */
.modal-card--tour {
  width: min(920px, 95vw);
  height: min(680px, 88vh);
  display: flex;
  flex-direction: column;
}

.modal-card--tour .modal-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.about-slideshow {
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Persistent diagram ──────────────────────────────────────── */
.slide-diagram {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 12px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  flex-shrink: 0;
}

.sd-box {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  border: 1px solid var(--border);
  white-space: nowrap;
  transition: all 350ms ease;
  opacity: 0.25;
  filter: grayscale(0.8);
}
.sd-plus, .sd-arrow {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  transition: all 350ms ease;
  opacity: 0.25;
}

/* Lit-up state — applied by JS via data-step threshold */
.sd-box.lit {
  opacity: 1;
  filter: grayscale(0);
}
.sd-plus.lit, .sd-arrow.lit {
  opacity: 1;
}

/* Active (current slide's element) gets a glow */
.sd-box.lit-active {
  opacity: 1;
  filter: grayscale(0);
  box-shadow: 0 0 12px rgba(212, 145, 92, 0.35);
  transform: translateY(-2px);
}

/* Color classes — only visible when lit */
.sd-base    { background: rgba(212, 145, 92, 0.12); color: var(--accent); border-color: var(--accent); }
.sd-overlay { background: rgba(148, 180, 212, 0.10); color: #94b4d4; border-color: #94b4d4; }
.sd-route   { background: rgba(176, 154, 204, 0.10); color: #b09acc; border-color: #b09acc; }
.sd-inj     { background: rgba(138, 171, 127, 0.10); color: #8aab7f; border-color: #8aab7f; }
.sd-out     { background: rgba(212, 145, 92, 0.18); color: var(--accent); border-color: var(--accent); font-weight: 700; }
.sd-arrow.lit { color: var(--accent); }

/* Secondary diagram items (after Final Prompt) */
.sd-sep {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
  opacity: 0.25;
  transition: opacity 350ms ease;
}
.sd-sep.lit { opacity: 0.6; }

.sd-secondary {
  background: rgba(212, 145, 92, 0.06);
  color: var(--muted);
  border-color: var(--border);
  font-size: 10px;
  padding: 4px 8px;
}
.sd-secondary.lit {
  color: var(--text-dim);
  border-color: var(--accent);
  background: rgba(212, 145, 92, 0.08);
}
.sd-secondary.lit-active {
  color: var(--accent);
  border-color: var(--accent);
  background: rgba(212, 145, 92, 0.14);
}

/* Slide 0 (overview) — all lit equally */
.slide-diagram.step-all .sd-box,
.slide-diagram.step-all .sd-plus,
.slide-diagram.step-all .sd-arrow,
.slide-diagram.step-all .sd-sep {
  opacity: 1;
  filter: grayscale(0);
}

/* ── Two-column layout ───────────────────────────────────────── */
.about-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.about-content {
  overflow-y: auto;
  padding-right: 4px;
}

/* ── Prompt preview (right column) ───────────────────────────── */
.tour-prompt {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--panel-2);
  overflow: hidden;
}

.tour-prompt-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-soft);
  padding: 8px 10px 6px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.tour-prompt-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tour-prompt-empty {
  color: var(--muted-soft);
  font-size: 12px;
  font-style: italic;
  padding: 20px 8px;
  text-align: center;
}

/* Blocks that appear progressively */
.tour-block {
  display: none;
  flex-direction: column;
  gap: 3px;
  padding: 6px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  background: var(--bg);
  animation: tourBlockIn 350ms ease-out both;
}

.tour-block.visible {
  display: flex;
}

/* New blocks get a highlight flash */
.tour-block.just-added {
  animation: tourBlockIn 350ms ease-out both, tourBlockFlash 800ms ease-out 350ms both;
}

@keyframes tourBlockIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes tourBlockFlash {
  0%   { box-shadow: 0 0 0 2px rgba(212, 145, 92, 0.4); }
  100% { box-shadow: 0 0 0 2px transparent; }
}

.tour-block-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
  align-self: flex-start;
  white-space: nowrap;
}

.tour-block-text {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-dim);
  white-space: pre-wrap;
}

.tour-block--output .tour-block-text {
  color: var(--accent);
  font-weight: 500;
}

.tour-block-divider {
  display: none;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-soft);
  text-align: center;
  padding: 4px 0 2px;
}
.tour-block-divider.visible {
  display: block;
}

.sd-ensemble {
  background: rgba(196, 107, 107, 0.10);
  color: #c46b6b;
  border-color: #c46b6b;
}

.tour-runtime-tag {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(148, 180, 212, 0.15);
  color: #94b4d4;
  border: 1px solid rgba(148, 180, 212, 0.3);
  border-radius: 3px;
  padding: 0 4px;
  margin-left: 4px;
  vertical-align: middle;
}

.tour-template-hint {
  color: var(--muted-soft);
  font-style: italic;
  font-size: 10px;
}

.about-slide {
  display: none;
  flex-direction: column;
  gap: 10px;
  animation: slideIn 300ms ease-out both;
}
.about-slide.active {
  display: flex;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.about-slide h4 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  color: var(--accent);
}

.about-slide p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
}

.about-slide ul,
.about-slide ol {
  margin: 2px 0 4px 18px;
  padding: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}
.about-slide li { margin-bottom: 3px; }

.about-slide strong { color: var(--accent); }

.about-slide code {
  background: var(--panel-3);
  border: 1px solid var(--border-subtle);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 12px;
  font-family: var(--font-mono);
  color: var(--accent);
}

.about-slide em { color: var(--text); font-style: italic; }

.about-code {
  margin: 2px 0;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-subtle);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
  white-space: pre;
  overflow-x: auto;
}


/* Navigation */
.about-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  margin-top: auto;
  border-top: 1px solid var(--border-subtle);
}

.about-dots {
  display: flex;
  gap: 6px;
  flex: 1;
  justify-content: center;
}

.about-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 200ms ease;
}
.about-dot:hover {
  background: var(--muted);
  transform: scale(1.3);
}
.about-dot.active {
  background: var(--accent);
  box-shadow: 0 0 6px rgba(212, 145, 92, 0.4);
  transform: scale(1.2);
}

/* ── Tour responsive ──────────────────────────────────────────── */
@media (max-width: 700px) {
  .about-columns {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .tour-prompt { max-height: 200px; }
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1300px) {
  main.grid {
    grid-template-columns: minmax(420px, 480px) minmax(0, 1fr);
    grid-template-rows: 1fr 1fr;
  }
  .controls-panel { grid-row: 1 / 3; }
  .output-panel  { grid-column: 2; grid-row: 1; }
  .debug-panel   { grid-column: 2; grid-row: 2; }
}
@media (max-width: 800px) {
  main.grid { grid-template-columns: 1fr; grid-template-rows: none; height: auto; overflow: visible; }
  .controls-panel, .output-panel, .debug-panel { grid-row: auto; grid-column: auto; max-height: none; }
  header h1 { font-size: 18px; }
}

/* ── Registry import (compose tab) ─────────────────────────── */
.registry-field { display: flex; flex-direction: column; gap: 8px; }
.registry-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.registry-meta { margin-left: auto; font-size: 11px; }
.registry-empty { font-size: 11px; padding: 8px 0; }
.registry-controls { display: flex; flex-direction: column; gap: 8px; }
.registry-controls:empty { display: none; }
.registry-section {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.02);
}
.registry-section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px; gap: 8px;
}
.registry-section-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--accent);
}
.registry-badge {
  font-size: 9px; padding: 1px 6px; border-radius: 4px;
  font-weight: 700; letter-spacing: 0.05em;
  background: rgba(255,255,255,0.05); color: var(--muted);
}
.registry-badge.req { background: rgba(212,145,92,0.18); color: var(--accent); }
.registry-checks { display: flex; flex-direction: column; gap: 3px; }
.registry-check {
  display: flex; align-items: center; gap: 6px; font-size: 12px; cursor: pointer;
}
.registry-check input { width: auto; margin: 0; }
.registry-tvars { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border-subtle); }
.registry-tvar-row {
  display: grid; grid-template-columns: 110px 1fr; gap: 6px;
  align-items: center; margin-top: 4px;
}
.registry-tvar-name {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px; color: var(--accent);
}
.registry-tvar-row input { font-size: 12px; padding: 4px 6px; }
.registry-hydrated-wrap { margin-top: 4px; }
.registry-hydrated { max-height: 160px; overflow: auto; font-size: 11px; white-space: pre-wrap; }

.registry-selection-preview {
  margin-top: 6px;
  padding: 6px 8px;
  border-left: 2px solid var(--accent);
  background: rgba(212,145,92,0.05);
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  white-space: pre-wrap;
  color: var(--fg);
  max-height: 140px;
  overflow: auto;
}
.registry-selection-preview:empty { display: none; }

/* ── Registry: add-item button + collapsible form ─────────── */
.registry-section-actions { display: inline-flex; align-items: center; gap: 6px; }
.registry-add-btn {
  width: 22px; height: 22px;
  border-radius: 4px;
  background: rgba(212,145,92,0.12);
  color: var(--accent);
  border: 1px solid rgba(212,145,92,0.35);
  cursor: pointer;
  font-size: 14px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
}
.registry-add-btn:hover { background: rgba(212,145,92,0.22); }
.registry-add-form {
  margin-top: 8px;
  padding: 8px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: rgba(0,0,0,0.18);
  display: flex; flex-direction: column; gap: 6px;
}
.registry-add-form[hidden] { display: none; }
.registry-add-row { display: flex; flex-direction: column; gap: 3px; font-size: 11px; }
.registry-add-row > span { font-size: 10px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.04em; }
.registry-add-row input[type=text], .registry-add-row textarea { width: 100%; font-size: 12px; }
.registry-add-row--inline { flex-direction: row; align-items: center; gap: 6px; }
.registry-add-row--inline input { width: auto; }
.registry-add-actions { display: flex; gap: 6px; justify-content: flex-end; }

.list-field { display: flex; flex-direction: column; gap: 4px; }
.list-item-row { display: grid; grid-template-columns: minmax(0,1fr) auto; align-items: center; gap: 6px; border-radius: 6px; padding: 2px 2px 2px 0; }
.list-item-row:nth-child(odd) { background: rgba(212,145,92,0.04); }
.list-item-row input { border-radius: 6px; padding: 6px 9px; font-size: 12px; }
.list-item-remove { appearance: none; border: none; background: transparent; color: var(--muted-soft); font-size: 15px; line-height: 1; cursor: pointer; padding: 4px 6px; border-radius: 4px; transition: color 120ms ease; flex-shrink: 0; }
.list-item-remove:hover { color: var(--accent-rose); }
.list-item-add { appearance: none; border: 1px dashed rgba(212,145,92,0.3); background: transparent; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0.04em; padding: 5px 10px; border-radius: 6px; cursor: pointer; margin-top: 2px; width: 100%; transition: all 140ms ease; }
.list-item-add:hover { color: var(--accent); border-color: rgba(212,145,92,0.5); background: rgba(212,145,92,0.04); }

/* ── Registry: per-array runtime mode selectors ───────────── */
.registry-modes { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.registry-modes:empty { display: none; }
.registry-mode-row {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 11px;
  padding: 4px 0;
  border-top: 1px dashed rgba(255,255,255,0.05);
}
.registry-mode-row:first-child { border-top: none; }
.registry-mode-pick { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.registry-mode-pick[hidden] { display: none; }
.registry-mode-rand-text { font-size: 11px; color: var(--muted); }
.registry-mode-label {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  color: var(--accent);
  min-width: 110px;
}
.registry-mode-row select {
  font-size: 11px; padding: 2px 4px;
  flex: 1; min-width: 0; max-width: 100%;
}
.registry-mode-count { width: 60px; font-size: 11px; padding: 2px 4px; }
.registry-mode-rand {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted); cursor: pointer;
  padding-left: 116px;
}
.registry-mode-rand input { width: auto; margin: 0; }

/* ── Registry: inline editors (replace static preview) ────── */
.registry-editors { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.registry-editors:empty { display: none; }
.registry-editor-card {
  border-left: 2px solid var(--accent);
  background: rgba(212,145,92,0.04);
  padding: 6px 8px;
  display: flex; flex-direction: column; gap: 5px;
  border-radius: 0 4px 4px 0;
}
.registry-editor-head {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

/* ── Registry: random-1 section toggle ────────────────────── */
.registry-random-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
  font-size: 11px; color: var(--muted);
  cursor: pointer;
}
.registry-random-row input { width: auto; margin: 0; }

/* ── Snapshots modal ──────────────────────────────────────── */
.snapshot-save-row { display: flex; gap: 6px; align-items: center; }
.snapshot-save-row input { flex: 1; }
.snapshot-list { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow: auto; }
.snapshot-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  background: rgba(255,255,255,0.02);
}
.snapshot-row-name {
  font-weight: 600; font-size: 13px;
}
.snapshot-meta { flex: 1; min-width: 0; }
.snapshot-meta .muted { font-size: 11px; }
.snapshot-actions { display: flex; gap: 4px; }

/* ── Registry: section slider (sentiment intensity) ───────── */
.registry-slider-row {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
  font-size: 11px;
}
.registry-slider-row label {
  color: var(--muted); display: inline-flex; align-items: center; gap: 4px;
  white-space: nowrap;
}
.registry-slider-row label > span[data-slider-value] {
  color: var(--accent); font-weight: 700;
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  min-width: 18px; text-align: right;
}
.registry-slider-row input[type=range] { flex: 1; min-width: 0; }
.registry-slider-rand {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--muted); cursor: pointer;
  white-space: nowrap;
}
.registry-slider-rand input { width: auto; margin: 0; }
.registry-slider-row input[type=range][disabled] { opacity: 0.4; }
.registry-scale-details {
  margin-top: 8px;
}
.registry-scale-summary {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--muted); cursor: pointer;
  user-select: none;
}
.registry-scale-summary:hover { color: var(--text-dim); }
.registry-scale-label {
  display: block; margin-top: 8px; margin-bottom: 4px;
  font-size: 11px; color: var(--muted);
}
.registry-scale-hint {
  font-size: 10px; font-style: italic; margin-left: 6px; color: var(--muted-soft);
}
.registry-scale-hint code {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  font-style: normal; color: var(--accent-2);
}
.registry-scale-tmpl { width: 100%; font-size: 11px; }

/* ── Runtime injections: enable + include_sections sub-list ─ */
.registry-rti-list { display: flex; flex-direction: column; gap: 8px; }
.registry-rti-row {
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 6px 8px;
  background: rgba(255,255,255,0.02);
}
.registry-rti-enable { font-size: 12px; }
.registry-rti-includes {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-subtle);
}
.registry-rti-includes small.muted { font-size: 10px; }

/* ── Registry: template-vars header + remove ─────────────── */
.registry-tvars-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 4px;
}
.registry-tvar-add {
  font-size: 10px; padding: 1px 8px;
  border-radius: 4px;
  background: rgba(212,145,92,0.12);
  color: var(--accent);
  border: 1px solid rgba(212,145,92,0.35);
  cursor: pointer;
}
.registry-tvar-add:hover { background: rgba(212,145,92,0.22); }
.registry-tvar-row {
  display: grid;
  grid-template-columns: 110px 1fr 22px;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
}
.registry-tvar-remove {
  width: 22px; height: 22px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--muted);
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px; line-height: 1;
  padding: 0;
}
.registry-tvar-remove:hover { color: var(--warn); border-color: var(--warn); }

/* ── Registry: conditional fragments authoring ────────────── */
.registry-fragments-row { display: flex; flex-direction: column; gap: 4px; }
.registry-fragments-list {
  display: flex; flex-direction: column; gap: 4px;
  margin-top: 2px;
}
.registry-fragments-list:empty { display: none; }
.registry-frag-row {
  display: grid;
  grid-template-columns: 110px 1fr 22px;
  gap: 6px;
  align-items: center;
}
.registry-frag-row select {
  font-size: 11px; padding: 2px 4px;
}
.registry-frag-row input[type=text] {
  font-size: 12px; padding: 4px 6px;
}

/* ── Generation Overrides: help-mark hint ─────────────────── */
.help-mark {
  display: inline-block;
  margin-left: 2px;
  width: 12px; height: 12px; line-height: 12px;
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  text-align: center;
  font-size: 9px;
  color: var(--muted);
  cursor: help;
}
.grid-2 label { cursor: help; }
.grid-2 label input { cursor: text; }
