/* ── Channel detail modal ────────────────────────────── */
.chm-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.65);
  display: flex; align-items: center; justify-content: center; z-index: 700;
  backdrop-filter: blur(5px);
}
.chm-bg.hidden { display: none; }

.chm {
  background: var(--s2); border: 1px solid var(--border); border-radius: 16px;
  width: 320px; box-shadow: 0 28px 80px rgba(0,0,0,.7);
  display: flex; flex-direction: column; overflow: hidden;
}

.chm-hd {
  display: flex; align-items: center; padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.chm-hd-info { flex: 1; min-width: 0; }
.chm-ch-num  { font-size: 24px; font-weight: 800; line-height: 1; }
.chm-dmx-addr { font-size: 11px; color: var(--muted); margin-top: 4px; letter-spacing: .02em; }
.chm-dmx-addr.hidden { display: none; }
.chm-fn-row  { display: flex; align-items: center; gap: 8px; margin-top: 5px; }
.chm-fn-dot  { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.chm-fn-name { font-size: 15px; font-weight: 600; }
.chm-fx-name { font-size: 13px; color: var(--muted); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chm-nav { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.chm-nav button {
  width: 30px; height: 30px; border-radius: 7px; border: 1px solid var(--border);
  background: var(--s1); color: var(--text); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center; transition: background .1s;
}
.chm-nav button:hover { background: var(--border); }

/* preview area */
.chm-preview {
  display: flex; align-items: center; justify-content: center;
  height: 90px; padding: 12px 18px;
}
.chm-preview-circle {
  width: 66px; height: 66px; border-radius: 50%;
  transition: background .06s, box-shadow .06s;
}
.chm-preview-sym { font-size: 46px; line-height: 1; transition: opacity .06s; }
.chm-preview-angle {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.chm-preview-angle .sym  { font-size: 38px; }
.chm-preview-angle .deg  { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* fader area: range track + slider side by side */
.chm-fader-row {
  display: flex; align-items: stretch; gap: 10px;
  padding: 0 28px;
}

/* capability range track */
.chm-range-track {
  width: 14px; flex-shrink: 0;
  display: flex; flex-direction: column-reverse;
  border-radius: 7px; overflow: hidden;
  background: var(--border);
}
.chm-range-track.empty { display: none; }
.cap-seg {
  flex-shrink: 0; width: 100%;
  transition: opacity .1s, filter .1s;
  cursor: default;
}
.cap-seg.active { filter: brightness(1.4) saturate(1.3); opacity: 1 !important; }
.cap-seg:not(.active) { opacity: .28; }

/* vertical slider */
.v-slider {
  writing-mode: vertical-lr; direction: rtl;
  -webkit-appearance: none; appearance: none;
  width: 44px; height: 220px;
  background: transparent; border-radius: 22px;
  outline: none; cursor: pointer; flex-shrink: 0;
}
.v-slider::-webkit-slider-runnable-track {
  width: 44px; height: 220px; border-radius: 22px;
  background: var(--border);
}
.v-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--accent); cursor: pointer;
  box-shadow: 0 3px 10px rgba(0,0,0,.5);
  transition: box-shadow .1s;
  margin-top: 2px;
}
.v-slider::-webkit-slider-thumb:hover { box-shadow: 0 0 0 6px rgba(99,102,241,.25), 0 3px 10px rgba(0,0,0,.4); }

/* value + cap label below fader */
.chm-bottom {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 10px 18px 18px;
}
.chm-vals-row { display: flex; align-items: baseline; gap: 8px; }
.chm-val { font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.chm-pct { font-size: 15px; color: var(--muted); }

/* capability label */
.chm-cap-label {
  font-size: 14px; font-weight: 600; text-align: center;
  padding: 5px 14px; border-radius: 6px;
  background: rgba(99,102,241,.14); color: var(--accent);
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-height: 28px; display: flex; align-items: center; justify-content: center;
  gap: 6px;
}
.chm-cap-label.hidden { display: none; }
.chm-cap-swatch {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}

/* ── Add Fixture Modal ───────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 700;
  backdrop-filter: blur(4px);
}
.modal-bg.hidden { display: none; }
.modal {
  background: var(--s2); border: 1px solid var(--border); border-radius: 14px;
  width: 520px; max-height: 90vh; display: flex; flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,.7);
}
.modal-hd { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-hd h3 { font-size: 16px; font-weight: 700; }
.modal-tabs { display: flex; gap: 2px; padding: 10px 22px 0; flex-shrink: 0; }
.modal-tab { padding: 6px 18px; border-radius: 6px; cursor: pointer; font-size: 13px; color: var(--muted); font-weight: 500; }
.modal-tab.on { background: var(--accent); color: #fff; }

.lib-section { flex: 1; overflow: hidden; display: flex; flex-direction: column; padding: 14px 22px 0; }
.lib-section.hidden,.custom-section.hidden { display: none; }
.search-wrap { position: relative; flex-shrink: 0; }
.search-input {
  width: 100%; background: var(--s1); border: 1px solid var(--border);
  color: var(--text); padding: 9px 12px 9px 38px; border-radius: 8px; font-size: 14px; outline: none;
}
.search-input:focus { border-color: var(--accent); }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }
.results-list { flex: 1; overflow-y: auto; margin: 10px 0 0; border: 1px solid var(--border); border-radius: 8px; background: var(--s1); max-height: 200px; }
.result-item { padding: 9px 13px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background .1s; }
.result-item:last-child { border-bottom: none; }
.result-item:hover { background: var(--s2); }
.result-item.sel { background: rgba(99,102,241,.15); border-left: 2px solid var(--accent); }
.result-mfr  { font-size: 11px; color: var(--muted); margin-bottom: 2px; }
.result-name { font-size: 14px; font-weight: 600; }
.result-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }
.modes-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; flex-shrink: 0; }
.mode-btn { padding: 5px 12px; border-radius: 6px; cursor: pointer; font-size: 12px; font-weight: 500; background: var(--border); color: var(--muted); border: 1px solid transparent; transition: all .1s; }
.mode-btn:hover { color: var(--text); }
.mode-btn.on { background: rgba(99,102,241,.2); color: var(--accent); border-color: var(--accent); }
.ch-preview { margin: 10px 0 0; padding: 10px 12px; background: var(--s1); border: 1px solid var(--border); border-radius: 8px; font-size: 12px; color: var(--muted); line-height: 2; flex-shrink: 0; max-height: 90px; overflow-y: auto; }

.custom-section { flex: 1; overflow-y: auto; padding: 14px 22px 0; display: flex; flex-direction: column; gap: 10px; }
.custom-ch-row { display: grid; grid-template-columns: 26px 1fr 130px 28px; align-items: center; gap: 8px; }
.ch-idx { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; }
.custom-ch-row input, .custom-ch-row select {
  background: var(--s1); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 6px; font-size: 13px; outline: none;
}
.custom-ch-row input:focus, .custom-ch-row select:focus { border-color: var(--accent); }
.btn-del-ch { width: 26px; height: 26px; border-radius: 5px; border: none; cursor: pointer; background: transparent; color: var(--muted); font-size: 15px; display: flex; align-items: center; justify-content: center; transition: color .1s; }
.btn-del-ch:hover { color: var(--red); background: rgba(239,68,68,.1); }

.modal-fields { display: grid; grid-template-columns: 1fr 120px; gap: 10px; padding: 12px 22px 0; flex-shrink: 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .4px; text-transform: uppercase; }
.field input, .field select { background: var(--s1); border: 1px solid var(--border); color: var(--text); padding: 8px 11px; border-radius: 7px; font-size: 14px; outline: none; }
.field input:focus, .field select:focus { border-color: var(--accent); }
.modal-ft { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 22px 18px; border-top: 1px solid var(--border); flex-shrink: 0; margin-top: 14px; }

/* ── Settings Modal (redesigned) ──────────────────────────────────── */
.settings-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.72);
  display: flex; align-items: center; justify-content: center;
  z-index: 900;
  backdrop-filter: blur(4px);
}
.settings-bg.hidden { display: none; }
.settings-modal {
  width: min(960px, calc(100vw - 40px));
  height: min(720px, calc(100vh - 40px));
  background: #1c1c22;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
  box-shadow: 0 28px 70px rgba(0,0,0,.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.settings-hd {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.settings-hd h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #f5f5fb;
  letter-spacing: 0.01em;
}
.settings-close {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.55);
  font-size: 22px;
  line-height: 1;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.settings-close:hover { background: rgba(255,255,255,.06); color: #fff; }

/* Legacy class kept so any stale markup degrades gracefully. */
.settings-top-tabs {
  display: flex;
  background: rgba(0,0,0,.12);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.settings-scope-tab {
  flex: 1;
  border: 0;
  border-right: 1px solid rgba(255,255,255,.08);
  background: transparent;
  color: rgba(255,255,255,.75);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 18px;
  cursor: pointer;
}
.settings-scope-tab:last-child { border-right: 0; }
.settings-scope-tab.on {
  background: rgba(255,255,255,.05);
  color: #fff;
}
.settings-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
}
.settings-sidebar {
  background: #15151a;
  border-right: 1px solid rgba(255,255,255,.06);
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-nav-btn {
  border: 0;
  background: transparent;
  color: rgba(255,255,255,.7);
  text-align: left;
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.settings-nav-btn:hover { background: rgba(255,255,255,.04); color: #f5f5fb; }
.settings-nav-btn.on {
  background: rgba(99,102,241,.18);
  color: #fff;
}
.settings-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}
.settings-pane-head {
  padding: 18px 24px 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.settings-pane-title {
  font-size: 17px;
  font-weight: 600;
  color: #fff;
}
.settings-pane-sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.settings-pane-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 24px 24px;
}

.settings-section {
  margin: 16px 0 8px;
}
.settings-section-hd {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 10px 0;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.settings-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(200px, 240px);
  gap: 12px 24px;
  align-items: center;
  padding: 12px 0;
}
.settings-row + .settings-row {
  border-top: 1px solid rgba(255,255,255,.04);
}
.settings-label {
  font-size: 13px;
  font-weight: 500;
  color: #f5f5fb;
}
.settings-help {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  margin-top: 3px;
}
.settings-control,
.settings-control input,
.settings-control select { width: 100%; }
.settings-control input[type="text"],
.settings-control input[type="number"],
.settings-control select {
  background: #15151a;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  font: inherit;
  font-size: 13px;
}
.settings-control input:focus,
.settings-control select:focus {
  border-color: var(--accent);
  outline: none;
}
.settings-control input[type="range"] { accent-color: var(--accent); }
.settings-inline-note {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}
.settings-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f5f5fb;
  font-size: 13px;
}
.settings-check input { accent-color: var(--accent); }
.settings-empty {
  padding: 32px 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ── Memory pane (Settings → Memory) ───────────────────────────────── */

.memory-pane {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.memory-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0 10px;
  position: sticky;
  top: 0;
  background: #1c1c22;
  z-index: 3;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.memory-toolbar input[type="search"] {
  flex: 1;
  padding: 7px 12px;
  background: #15151a;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  outline: none;
}
.memory-toolbar input[type="search"]:focus {
  border-color: var(--accent);
}
.memory-count {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.memory-info {
  font-size: 12px;
  color: var(--muted);
  padding: 10px 0;
  line-height: 1.5;
}
.memory-info strong { color: #c4b5fd; font-weight: 500; }

.memory-list {
  display: flex;
  flex-direction: column;
}

.memory-empty {
  padding: 40px 8px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.memory-empty code {
  background: #15151a;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.memory-section {
  display: flex;
  flex-direction: column;
  margin-bottom: 24px;
}
.memory-section-hd {
  position: sticky;
  top: 50px; /* below the search toolbar */
  z-index: 2;
  background: linear-gradient(to bottom, #1c1c22 70%, rgba(28,28,34,0.92));
  padding: 12px 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
}
.memory-section-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.memory-section-icon.kind-show {
  background: color-mix(in srgb, #4ade80 14%, transparent);
  color: #86efac;
  border: 1px solid color-mix(in srgb, #4ade80 28%, transparent);
}
.memory-section-icon.kind-user {
  background: color-mix(in srgb, #a78bfa 14%, transparent);
  color: #c4b5fd;
  border: 1px solid color-mix(in srgb, #a78bfa 28%, transparent);
}
.memory-section-icon.kind-venue,
.memory-section-icon.kind-org,
.memory-section-icon.kind-community {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
}
.memory-section-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}
.memory-section-name {
  font-size: 13px;
  font-weight: 600;
  color: #f5f5fb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.memory-section-scope {
  font-size: 11px;
  color: var(--muted);
}
.memory-section-count {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  padding: 2px 8px;
  background: rgba(255,255,255,.04);
  border-radius: 10px;
  flex-shrink: 0;
}

/* Compact row design — scales to 100+ entries comfortably. */
.memory-entry {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.04);
  position: relative;
}
.memory-entry:last-child { border-bottom: 0; }
.memory-entry:hover { background: rgba(255,255,255,.02); }
.memory-entry.disabled {
  opacity: 0.5;
}
.memory-entry.disabled .memory-title,
.memory-entry.disabled .memory-body {
  text-decoration: line-through;
}

.memory-entry-status {
  flex-shrink: 0;
  margin-top: 4px;
}
.memory-toggle {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  width: 26px;
  height: 14px;
  background: rgba(255,255,255,.12);
  border-radius: 7px;
  position: relative;
  transition: background 0.15s;
}
.memory-toggle input {
  appearance: none;
  position: absolute;
  inset: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}
.memory-toggle::after {
  content: '';
  width: 10px;
  height: 10px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: transform 0.15s;
}
.memory-toggle:has(input:checked) { background: var(--accent); }
.memory-toggle:has(input:checked)::after { transform: translateX(12px); }

.memory-entry-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.memory-title {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 6px;
  margin: -3px -6px 0;
  color: #f5f5fb;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  outline: none;
  line-height: 1.35;
}
.memory-title:hover { background: rgba(255,255,255,.04); }
.memory-title:focus {
  background: #15151a;
  border-color: var(--accent);
}
.memory-body {
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 3px 6px;
  margin: 0 -6px;
  color: var(--muted);
  font-size: 12px;
  font-family: inherit;
  line-height: 1.4;
  resize: none;
  outline: none;
  overflow: hidden;
  min-height: 18px;
}
.memory-body:hover { background: rgba(255,255,255,.04); }
.memory-body:focus {
  background: #15151a;
  border-color: var(--accent);
  resize: vertical;
  min-height: 50px;
}

.memory-entry-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  flex-wrap: wrap;
}
.memory-chip-rule {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10px;
  color: var(--accent);
  padding: 1px 6px;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-radius: 3px;
  white-space: nowrap;
}
.memory-chip-conf {
  font-size: 10px;
  color: var(--muted);
}
.memory-quote {
  font-style: italic;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.75;
}

.memory-entry-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.memory-entry:hover .memory-entry-actions,
.memory-entry:focus-within .memory-entry-actions { opacity: 1; }

.memory-action-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 11px;
  font-family: inherit;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.memory-action-btn:hover {
  background: rgba(255,255,255,.06);
  color: #f5f5fb;
  border-color: rgba(255,255,255,.08);
}
.memory-action-btn.danger:hover {
  background: rgba(239,68,68,.14);
  color: #fca5a5;
  border-color: rgba(239,68,68,.3);
}
.memory-move {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.memory-move:hover { background: rgba(255,255,255,.06); color: #f5f5fb; }

/* ── Conflicts banner in the Memory pane ──────────────────────────────── */

.memory-conflicts-banner {
  background: color-mix(in srgb, #fbbf24 8%, #15151a);
  border: 1px solid color-mix(in srgb, #fbbf24 28%, var(--border));
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
}
.memory-conflicts-hd {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: #fcd34d;
  margin-bottom: 8px;
}
.memory-conflicts-hint {
  font-weight: 400;
  color: var(--muted);
  font-size: 11px;
}
.memory-conflict-item {
  padding: 8px 0;
  border-top: 1px solid rgba(251, 191, 36, 0.18);
  font-size: 12px;
}
.memory-conflict-item:first-of-type { border-top: 0; padding-top: 4px; }
.memory-conflict-item.severity-error .memory-conflict-msg { color: #fca5a5; }
.memory-conflict-msg { color: var(--text); line-height: 1.45; }
.memory-conflict-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
}
.memory-conflict-link {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #fcd34d;
  text-decoration: none;
  padding: 1px 5px;
  background: rgba(251, 191, 36, 0.12);
  border-radius: 3px;
}
.memory-conflict-link:hover { background: rgba(251, 191, 36, 0.22); }
.memory-conflict-hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 3px;
  font-style: italic;
}

@keyframes memoryFlash {
  0%   { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 0%, transparent); }
  20%  { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 70%, transparent); }
  100% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 0%, transparent); }
}
.memory-entry.flash { animation: memoryFlash 1.3s ease-out; }

.modal.rdm-learn-modal { width: min(700px, 94vw); max-height: 90vh; }
.modal.import-eos-modal { width: min(600px, 94vw); max-height: 90vh; }
.modal.file-io-modal { width: min(560px, 94vw); max-height: 90vh; }
.import-eos-body {
  padding: 16px;
  overflow: auto;
  min-height: 200px;
}
.import-eos-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.import-eos-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.import-eos-dropzone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 116px;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.14);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.import-eos-dropzone:hover,
.import-eos-dropzone:focus-visible {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.10);
  outline: none;
}
.import-eos-dropzone.drag {
  border-color: var(--accent);
  background: rgba(99, 102, 241, 0.16);
  transform: translateY(-1px);
}
.import-eos-drop-title { font-weight: 600; }
.import-eos-drop-sub { font-size: 12px; color: var(--muted); }
.import-eos-file-meta {
  display: none;
  font-size: 12px;
  color: var(--muted);
}

.import-show-body,
.export-show-body {
  padding: 16px;
  overflow: auto;
  min-height: 160px;
}
.import-show-step {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.import-show-hint {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}
.file-io-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.file-io-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.file-io-field label {
  font-size: 12px;
  color: var(--muted);
}
.file-io-field input,
.file-io-field select {
  width: 100%;
  background: var(--s2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 10px;
  font: inherit;
  outline: none;
}
.file-io-field input:focus,
.file-io-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.16);
}
.file-io-note {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Import .asc modal (component picker) ─────────────────── */
.modal.import-asc-modal { width: min(720px, 94vw); max-height: 92vh; }
.asc-components {
  display: flex; flex-direction: column; gap: 6px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px; background: rgba(0,0,0,0.14);
  max-height: 340px; overflow: auto;
}
.asc-component-row {
  display: grid; grid-template-columns: 24px 1fr auto; align-items: center;
  gap: 10px; padding: 8px 10px; border-radius: 6px;
  border: 1px solid transparent;
}
.asc-component-row:hover { background: rgba(99,102,241,0.06); }
.asc-component-row.disabled { opacity: 0.45; pointer-events: none; }
.asc-component-row input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.asc-component-label { font-weight: 600; font-size: 13px; }
.asc-component-detail { font-size: 12px; color: var(--muted); margin-top: 2px; }
.asc-component-count {
  font-size: 12px; color: var(--accent); font-weight: 700;
  font-variant-numeric: tabular-nums; padding-left: 8px;
}
.asc-meta {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12px; color: var(--muted);
}
.asc-meta b { color: var(--text); font-weight: 600; }
.asc-mode {
  display: flex; gap: 14px; font-size: 13px;
  padding: 8px 0;
}
.asc-mode label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.rdm-learn-hint {
  font-size: 13px; color: var(--muted); line-height: 1.52;
  padding: 8px 22px 14px; flex-shrink: 0;
}
.rdm-learn-toolbar {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap; padding: 0 22px 12px; flex-shrink: 0;
}
.rdm-learn-toolbar .stat { margin-right: auto; font-size: 13px; }
.rdm-learn-table-wrap {
  flex: 1; overflow: hidden;
  margin: 0 22px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--s1); display: none; flex-direction: column;
  min-height: 0;
}
.rdm-learn-table-wrap.visible { display: flex; }
.rdm-learn-scroll { overflow-y: auto; overflow-x: auto; max-height: min(340px, 52vh); }
.rdm-learn-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.rdm-learn-table th {
  background: rgba(255,255,255,.06); padding: 8px 10px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); text-align: left;
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.rdm-learn-table td { padding: 8px 10px; border-top: 1px solid rgba(63,63,102,.42); vertical-align: middle; }
.rdm-learn-table tbody tr:first-child td { border-top: none; }
.rdm-learn-table td input[type="text"] {
  background: var(--s2); border: 1px solid var(--border); color: var(--text);
  border-radius: 6px; padding: 6px 8px; width: 100%; min-width: 120px; font-size: 12px; outline: none;
}
.rdm-learn-table td input[type="text"]:focus { border-color: var(--accent); }
.rdm-learn-table td select.map-sel {
  max-width: 280px; width: 100%; background: var(--s2);
  border: 1px solid var(--border); color: var(--text);
  padding: 5px 8px; border-radius: 6px; font-size: 12px;
}
.rdm-learn-table td .uid-cell { word-break: break-all; opacity: .9; font-size: 11px; color: var(--muted); }
.rdm-learn-table td .uid-cell span { opacity: .75; white-space: nowrap; }

/* Status bar */
.sb { height: 28px; background: var(--s1); border-top: 1px solid var(--border); display: flex; align-items: center; padding: 0 22px; gap: 20px; font-size: 13px; color: var(--muted); flex-shrink: 0; }
/* display:flex above beats the [hidden] attribute — the legacy status bar is
   kept only so old JS updating #sbLeft doesn't break; never show it. */
.sb[hidden] { display: none; }
.tx-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-right: 6px; transition: background .1s, box-shadow .1s; }
.tx-dot.pulse { background: var(--green); box-shadow: 0 0 6px var(--green); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3b3b62; }

/* ── Rig Analysis (tab: #panel-rig) ───────────────────────────────────── */
.rig-analysis-body {
  /* flex: 1 1 auto + min-height: 0 lets the body shrink when the fixture
     table is long, keeping the footer pinned to the visible viewport. */
  padding: 18px 22px; overflow-y: auto; flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column; gap: 22px;
}
#panel-rig .rig-analysis-body { max-width: 1100px; width: 100%; margin: 0 auto; }

/* Setup checklist — the guided path from empty patch to analyzed rig. */
.ra-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.ra-step {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px;
  background: var(--s2); border: 1px solid var(--border); border-radius: 10px;
}
.ra-step-badge {
  flex-shrink: 0;
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700;
  background: var(--s3, #262643); color: var(--muted);
  border: 1px solid var(--border);
}
.ra-step--done .ra-step-badge {
  background: rgba(74, 222, 128, .14); color: #4ade80; border-color: rgba(74, 222, 128, .4);
}
.ra-step--done { border-color: rgba(74, 222, 128, .25); }
.ra-step-main { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ra-step-title { font-size: 13px; font-weight: 600; }
.ra-step-tag {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; vertical-align: 1px;
}
.ra-step-sub { font-size: 12px; color: var(--muted); line-height: 1.4; }
.ra-step-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.ra-mini-btn--accent {
  background: var(--accent); color: #fff; border-color: var(--accent);
}
.ra-mini-btn--accent:hover:not(:disabled) { filter: brightness(1.1); }

/* ── Empty-rig welcome: the tab's "start here" screen ── */
.ra-welcome {
  max-width: 560px;
  margin: 8vh auto 0;
  padding: 0 24px 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.ra-welcome-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.ra-welcome-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
  max-width: 440px;
}
.ra-welcome-cta {
  padding: 12px 26px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 4px;
}
.ra-welcome-or {
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 10px;
}
.ra-welcome-paths {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.ra-welcome-path {
  flex: 1 1 150px;
  max-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--s1);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color .12s, background .12s;
}
.ra-welcome-path:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--s1));
}
.ra-welcome-path-title {
  font-size: 13px;
  font-weight: 600;
}
.ra-welcome-path-sub {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.ra-welcome-foot {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 14px 0 0;
  max-width: 420px;
}

/* "About this rig" — AI prose overview. */
.ra-explain {
  padding: 14px 16px;
  background: var(--s2); border: 1px solid var(--border); border-radius: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
/* Brief highlight when the checklist's "Choose theatre" scrolls here. */
.ra-explain.ra-flash {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .25);
  transition: border-color .3s, box-shadow .3s;
}
.ra-explain-head { display: flex; align-items: center; gap: 10px; }
.ra-explain-head h4 { font-size: 14px; font-weight: 600; flex: 1; }
.ra-explain-stale {
  font-size: 11px; font-weight: 600; color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, .35); border-radius: 5px;
  padding: 2px 7px; background: rgba(251, 191, 36, .08);
  white-space: nowrap;
}
.ra-explain-text { font-size: 13px; line-height: 1.55; color: var(--text); }
.ra-explain-text p { margin: 0 0 8px; }
.ra-explain-text p:last-child { margin-bottom: 0; }
.ra-explain-text ul { margin: 0 0 8px; padding-left: 18px; }
.ra-explain-text li { margin-bottom: 3px; }
.ra-foot {
  display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 12px 22px; flex-shrink: 0;
  background: var(--s2); border-top: 1px solid var(--border);
  box-shadow: 0 -8px 12px -8px rgba(0, 0, 0, 0.5);
}
.ra-foot-left { flex: 1; font-size: 12px; color: var(--muted); }

.ra-section { display: flex; flex-direction: column; gap: 10px; }
.ra-section h4 { font-size: 14px; font-weight: 600; }
.ra-section .hint { color: var(--muted); font-size: 12px; line-height: 1.4; }

.ra-field-row { display: grid; grid-template-columns: 140px 1fr; gap: 10px; align-items: center; }
.ra-field-row-multi { align-items: start; }
.ra-field-row label { color: var(--muted); font-size: 12px; }
.ra-field-row input[type="text"],
.ra-field-row textarea {
  background: var(--s1); border: 1px solid var(--border); color: var(--text);
  padding: 7px 10px; border-radius: 6px; font-size: 13px; outline: none;
  font-family: inherit;
}
.ra-field-row textarea { resize: vertical; line-height: 1.4; }
.ra-field-row input:focus,
.ra-field-row textarea:focus { border-color: var(--accent); }

.ra-drop-zone {
  border: 2px dashed var(--border); border-radius: 10px;
  padding: 18px; text-align: center; background: var(--s1);
  transition: border-color .1s, background .1s;
}
.ra-drop-zone.drag-over { border-color: var(--accent); background: rgba(99,102,241,.08); }
.ra-drop-inner { font-size: 13px; color: var(--muted); }
.ra-drop-pick { color: var(--accent); cursor: pointer; text-decoration: underline; }

.ra-doc-list { display: flex; flex-direction: column; gap: 6px; }
.ra-doc-row {
  display: grid; grid-template-columns: 1fr auto auto auto; gap: 12px;
  align-items: center; padding: 8px 12px;
  background: var(--s1); border: 1px solid var(--border); border-radius: 6px;
  font-size: 13px;
}
.ra-doc-name { font-weight: 500; }
.ra-doc-meta { color: var(--muted); font-size: 11px; }
.ra-doc-dl, .ra-doc-del {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  padding: 4px 8px; border-radius: 5px; font-size: 12px; cursor: pointer;
  text-decoration: none; line-height: 1;
}
.ra-doc-dl:hover, .ra-doc-del:hover { color: var(--text); border-color: var(--muted); }
.ra-doc-empty { padding: 4px 0; }

.ra-table-bar { display: flex; align-items: center; gap: 12px; }
.ra-search {
  margin-left: auto; flex: 0 0 240px;
  background: var(--s1); border: 1px solid var(--border); color: var(--text);
  padding: 6px 10px; border-radius: 6px; font-size: 13px; outline: none;
}
.ra-search:focus { border-color: var(--accent); }
.ra-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.ra-pill {
  padding: 4px 10px; border-radius: 999px; font-size: 11px;
  background: var(--s1); color: var(--muted); border: 1px solid var(--border);
  cursor: pointer;
}
.ra-pill.on { background: var(--accent); color: #fff; border-color: var(--accent); }

.ra-view-tabs {
  display: flex; gap: 2px; margin-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.ra-view-tab {
  padding: 7px 16px; font-size: 13px; font-weight: 600;
  background: transparent; color: var(--muted);
  border: none; border-bottom: 2px solid transparent;
  cursor: pointer;
}
.ra-view-tab:hover { color: var(--text); }
.ra-view-tab.on { color: var(--text); border-bottom-color: var(--accent); }

.ra-table-wrap {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.ra-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ra-table thead th {
  background: var(--s1); color: var(--muted);
  text-align: left; padding: 8px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.ra-table tbody td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.ra-table tbody tr:last-child td { border-bottom: 0; }
.ra-table tbody tr.ra-row-has-prop { background: rgba(99,102,241,.04); }
.ra-c-num { width: 56px; font-variant-numeric: tabular-nums; color: var(--muted); font-family: ui-monospace, monospace; }
.ra-c-addr { width: 70px; font-variant-numeric: tabular-nums; color: var(--muted); font-family: ui-monospace, monospace; font-size: 12px; }
.ra-c-name { min-width: 200px; }
.ra-fx-name { font-weight: 500; display: flex; align-items: center; gap: 8px; }
.ra-fx-type { color: var(--muted); font-size: 11px; }
.ra-usage {
  font-size: 10px; font-weight: 600; color: var(--accent);
  background: rgba(99,102,241,.12); padding: 1px 6px; border-radius: 999px;
  cursor: help; font-variant-numeric: tabular-nums;
}
.ra-usage.ra-usage-zero { color: var(--muted); background: transparent; font-weight: 400; }
.ra-c-bands { width: 220px; }
.ra-band-chip {
  display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0;
  border-radius: 999px; font-size: 10px; line-height: 1.5;
  background: var(--s1); color: var(--muted); border: 1px solid var(--border);
  font-family: ui-monospace, monospace; cursor: help;
}
.ra-band-chip--pos {
  background: rgba(34, 197, 94, .12); color: #86efac; border-color: rgba(34, 197, 94, .3);
}
.ra-band-chip--func {
  background: rgba(99, 102, 241, .12); color: var(--accent); border-color: rgba(99, 102, 241, .3);
}
.ra-band-chip--group {
  background: rgba(251, 191, 36, .10); color: #fcd34d; border-color: rgba(251, 191, 36, .25);
}
.ra-overwrite-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--muted);
}

/* ── Hero: big numbers + live stage map ──────────────────────────────── */
.ra-hero {
  display: grid; grid-template-columns: 190px 1fr; gap: 20px;
  align-items: stretch;
}
.ra-hero-stats { display: flex; flex-direction: column; gap: 14px; justify-content: center; }
.ra-stat-num {
  font-size: 30px; font-weight: 800; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.ra-stat--hero .ra-stat-num { font-size: 52px; color: var(--accent); }
.ra-stat-unit { font-size: .55em; font-weight: 700; margin-left: 2px; opacity: .85; }
.ra-stat-label { font-size: 12px; font-weight: 600; color: var(--text); margin-top: 2px; }
.ra-stat-sub { font-size: 11px; color: var(--muted); margin-top: 1px; }
.ra-stat--review .ra-stat-num { color: #fbbf24; }
.ra-stat-hint {
  font-size: 12px; color: var(--muted); line-height: 1.45;
  border-left: 3px solid var(--accent); padding-left: 10px;
}

.ra-hero-stage { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.ra-stage-head {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.ra-stage-title { font-size: 13px; font-weight: 600; }
.ra-legend { display: inline-flex; gap: 12px; margin-left: auto; flex-wrap: wrap; }
.ra-legend-item {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--muted);
}
.ra-dot-swatch {
  width: 9px; height: 9px; border-radius: 50%; display: inline-block;
}

.ra-stage {
  position: relative; aspect-ratio: 2.2 / 1; border-radius: 10px;
  background:
    repeating-linear-gradient(to right, transparent 0, transparent calc(100% / 12 - 1px), rgba(255,255,255,.035) calc(100% / 12 - 1px), rgba(255,255,255,.035) calc(100% / 12)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(100% / 6 - 1px), rgba(255,255,255,.035) calc(100% / 6 - 1px), rgba(255,255,255,.035) calc(100% / 6)),
    var(--s1);
  border: 1px solid var(--border);
  overflow: hidden;
}
.ra-stage-caption {
  position: absolute; top: 4px; left: 0; right: 0; text-align: center;
  font-size: 9px; letter-spacing: .35em; color: var(--muted); opacity: .7;
  pointer-events: none;
}
/* Margin keeps dots at the plot edges (x/y = 0 or 1) fully visible —
   dots are centered on their coordinate. */
.ra-stage-dots { position: absolute; inset: 18px 14px 14px; }
.ra-dot {
  position: absolute; width: 12px; height: 12px; border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left .9s cubic-bezier(.22,1,.36,1), top .9s cubic-bezier(.22,1,.36,1),
              background .35s, box-shadow .35s;
  cursor: help;
}
.ra-dot--unknown, .ra-dot-swatch.ra-dot--unknown {
  background: #4b4b66; box-shadow: inset 0 0 0 1px rgba(255,255,255,.14);
}
.ra-dot--assigned, .ra-dot-swatch.ra-dot--assigned {
  background: #22c55e; box-shadow: 0 0 8px rgba(34,197,94,.55);
}
.ra-dot--proposed, .ra-dot-swatch.ra-dot--proposed {
  background: #fbbf24; box-shadow: 0 0 8px rgba(251,191,36,.55);
}
.ra-dot--analyzing, .ra-dot-swatch.ra-dot--analyzing {
  background: var(--accent);
  animation: ra-dot-pulse 1s ease-in-out infinite;
}
@keyframes ra-dot-pulse {
  0%, 100% { box-shadow: 0 0 4px rgba(99,102,241,.5); }
  50%      { box-shadow: 0 0 14px rgba(99,102,241,.95); }
}

.ra-stage-foot {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  font-size: 11px; color: var(--muted);
}
.ra-stage-tray { flex: 1; }
.ra-mini-btn {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px;
  padding: 3px 10px; font-size: 11px; cursor: pointer; white-space: nowrap;
}
.ra-mini-btn:hover { color: var(--text); border-color: var(--muted); }
.ra-mini-btn:disabled { opacity: .45; cursor: default; }

.ra-progress { display: flex; flex-direction: column; gap: 5px; }
.ra-progress.hidden { display: none; }
.ra-progress-track {
  height: 6px; border-radius: 999px; background: var(--s1);
  border: 1px solid var(--border); overflow: hidden;
}
.ra-progress-fill {
  height: 100%; width: 0; background: var(--accent);
  border-radius: 999px; transition: width .4s ease;
}
.ra-progress-fill.paused { background: #fbbf24; }
.ra-progress-row { display: flex; align-items: center; gap: 8px; }
.ra-progress-text { flex: 1; font-size: 12px; color: var(--muted); }
.ra-mini-btn--danger:hover { color: #f4b4b4; border-color: #a15b5b; }

/* Learning feed — a short scrolling log of what the analysis is doing. */
.ra-feed {
  max-height: 96px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--s1); padding: 6px 10px;
  display: flex; flex-direction: column; gap: 3px;
}
.ra-feed.hidden { display: none; }
.ra-feed-row {
  display: flex; gap: 8px; font-size: 11px; color: var(--muted);
  line-height: 1.4;
}
.ra-feed-row:last-child { color: var(--text); }
.ra-feed-icon { flex: 0 0 14px; text-align: center; color: var(--accent); }

/* Clarifying questions from the analyzer */
.ra-questions {
  display: flex; flex-direction: column; gap: 8px;
  border: 1px solid rgba(251, 191, 36, .35); border-radius: 10px;
  background: rgba(251, 191, 36, .05); padding: 10px 12px;
}
.ra-questions.hidden { display: none; }
.ra-questions-head { font-size: 12px; font-weight: 600; color: #fcd34d; }
.ra-question { display: flex; flex-direction: column; gap: 5px; }
.ra-question.saved { opacity: .65; }
.ra-question-text { font-size: 12px; color: var(--text); }
.ra-question-ctx { font-size: 11px; color: var(--muted); }
.ra-question-answer { display: flex; gap: 8px; }
.ra-question-answer input {
  flex: 1; background: var(--s1); border: 1px solid var(--border);
  color: var(--text); padding: 5px 9px; border-radius: 6px;
  font-size: 12px; outline: none;
}
.ra-question-answer input:focus { border-color: #fbbf24; }

/* Collapsible "tell the AI about your show" section */
.ra-rest { display: flex; flex-direction: column; gap: 22px; }
.ra-details {
  border: 1px solid var(--border); border-radius: 10px; background: var(--s1);
}
.ra-details summary {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 12px 16px; cursor: pointer; list-style: none; user-select: none;
}
.ra-details summary::-webkit-details-marker { display: none; }
.ra-details summary::before {
  content: "▸"; color: var(--muted); font-size: 11px; transition: transform .15s;
}
.ra-details[open] summary::before { transform: rotate(90deg); }
.ra-details-title { font-size: 13px; font-weight: 600; }
.ra-details-sum { margin-left: auto; font-size: 11px; color: var(--muted); }
.ra-details-body {
  display: flex; flex-direction: column; gap: 18px;
  padding: 4px 16px 16px;
}
.ra-views-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.ra-c-purpose { width: 160px; }
.ra-purpose-input {
  width: 100%; background: var(--s1); border: 1px solid var(--border); color: var(--text);
  padding: 5px 8px; border-radius: 5px; font-size: 12px; outline: none;
  font-family: ui-monospace, monospace;
}
.ra-purpose-input:focus { border-color: var(--accent); }
.ra-c-desc { min-width: 260px; }
.ra-desc-input {
  width: 100%; background: var(--s1); border: 1px solid var(--border); color: var(--text);
  padding: 6px 8px; border-radius: 5px; font-size: 12px; outline: none;
  font-family: inherit; line-height: 1.35; resize: vertical;
}
.ra-desc-input:focus { border-color: var(--accent); }
.ra-c-prop { width: 220px; }
.ra-prop-cell { display: flex; flex-direction: column; gap: 4px; font-size: 12px; }
.ra-prop-head { display: flex; align-items: center; gap: 8px; }
.ra-prop-val {
  font-family: ui-monospace, monospace; color: var(--accent);
  background: rgba(99,102,241,.12); padding: 2px 8px; border-radius: 4px;
  cursor: help;
}
.ra-prop-desc {
  color: var(--muted); font-size: 11px; line-height: 1.35;
  cursor: help;
  /* Truncate the inline preview at two lines so the row stays compact;
     hover-tooltip on the parent reveals the full text. */
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.ra-prop-apply {
  background: var(--accent); color: #fff; border: none;
  padding: 3px 10px; border-radius: 5px; font-size: 11px; cursor: pointer;
}
.ra-prop-apply:hover { opacity: .9; }
.ra-prop-match { color: var(--green); font-weight: 700; cursor: help; }
.ra-analyze-btn {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent); border-radius: 5px;
  padding: 3px 10px; font-size: 11px; cursor: pointer;
  white-space: nowrap;
}
.ra-analyze-btn:hover { background: rgba(99,102,241,.12); }
.ra-analyze-btn:disabled { opacity: .45; cursor: default; }
.ra-analyzing {
  font-size: 11px; color: var(--muted); font-style: italic;
}
.ra-empty { padding: 20px; text-align: center; color: var(--muted); font-size: 13px; }

.ra-status { font-size: 12px; }
.ra-status-ok { color: var(--green); }
.ra-status-err { color: #f4b4b4; }

/* Footer Top-N input — lives between status text and the action buttons. */
.ra-topn-label {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); margin-right: 6px;
}
.ra-topn-input {
  width: 64px;
  background: var(--s1); border: 1px solid var(--border); color: var(--text);
  padding: 4px 8px; border-radius: 5px; font-size: 12px;
  font-variant-numeric: tabular-nums; outline: none; text-align: right;
}
.ra-topn-input:focus { border-color: var(--accent); }
.ra-topn-hint { color: var(--muted); font-size: 11px; }


/* Venue profile editor */
.vp-sec { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px 12px; }
.vp-sec legend { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.vp-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 14px; }
.vp-f { display: flex; flex-direction: column; gap: 3px; }
.vp-f > span:first-child { font-size: 11px; color: var(--muted); }
.vp-f input[type="text"], .vp-f input[type="number"], .vp-f select, .vp-f textarea {
  background: var(--bg2, rgba(0,0,0,0.25)); border: 1px solid var(--border); border-radius: 6px;
  color: inherit; padding: 5px 8px; font-size: 13px;
  width: 100%; min-width: 0; box-sizing: border-box;
}
.vp-grid .vp-f { min-width: 0; }

/* Deterministic theatre-load block on the empty-rig welcome. */
.ra-welcome-theatre {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  width: 100%;
  max-width: 560px;
  padding: 14px 16px;
  margin-top: 4px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: var(--accent-soft, rgba(99,102,241,.10));
  text-align: left;
}
.ra-welcome-theatre-txt {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 110px;
}
.ra-welcome-theatre-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
}
/* No min-width:0 — the select keeps its intrinsic width (widest option) so
   theatre names never truncate; the row wraps instead when space runs out. */
.ra-welcome-theatre select {
  flex: 1 1 auto;
  max-width: 100%;
  background: var(--s1);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  font-size: 13px;
}
.ra-welcome-theatre .btn { white-space: nowrap; }
.ra-welcome-theatre .btn:disabled { opacity: .45; cursor: default; }

/* Pull-based theatre-rig update notice on the Stage & Rig theatre card. */
.ra-rig-updated {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
  background: rgba(251,191,36,.12);
  border: 1px solid rgba(251,191,36,.45);
  white-space: nowrap;
}

/* ── Mover focus references (Rig Analysis) ────────────────────────────── */
.ra-focus-fixture {
  padding: 10px 0 6px;
  border-top: 1px solid var(--border-soft);
}
.ra-focus-fx-head { font-size: 13px; margin-bottom: 6px; }
.ra-focus-refs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.ra-focus-del {
  margin-left: 4px;
  border: none; background: none; cursor: pointer;
  color: inherit; opacity: .6; font-size: 12px; padding: 0;
}
.ra-focus-del:hover { opacity: 1; }
.ra-focus-cand {
  display: flex;
  gap: 14px;
  align-items: stretch;
  padding: 8px 10px;
  margin: 6px 0;
  border: 1px dashed var(--border);
  border-radius: 10px;
  background: rgba(0,0,0,.15);
}
.ra-focus-cand-info { flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.ra-focus-label {
  background: var(--s1); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); padding: 5px 8px; font-size: 12.5px; max-width: 320px;
}
.ra-focus-actions { display: flex; gap: 6px; }
.ra-focus-map {
  position: relative;
  flex: 0 0 190px;
  height: 110px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background:
    linear-gradient(rgba(99,102,241,.06), rgba(99,102,241,.02)),
    repeating-linear-gradient(0deg, transparent 0 21px, rgba(255,255,255,.05) 21px 22px),
    repeating-linear-gradient(90deg, transparent 0 37px, rgba(255,255,255,.05) 37px 38px);
  cursor: crosshair;
  overflow: hidden;
}
.ra-focus-map-edge {
  position: absolute; top: 2px; left: 50%; transform: translateX(-50%);
  font-size: 9px; letter-spacing: .5px; text-transform: uppercase;
  color: var(--muted-2); pointer-events: none;
}
.ra-focus-fx-dot, .ra-focus-marker {
  position: absolute; transform: translate(-50%, -50%);
  border-radius: 50%; pointer-events: none;
}
.ra-focus-fx-dot { width: 8px; height: 8px; border: 1.5px dashed var(--muted); }
.ra-focus-marker {
  width: 12px; height: 12px;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(99,102,241,.3);
}
