/* ── Google Fonts ──────────────────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ── Design tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Background layers */
  --bg:          #0e1118;
  --bg2:         #151922;
  --bg3:         #1c2333;
  --bg4:         #222d3d;

  /* Borders */
  --border:      #2a3547;
  --border2:     #374761;

  /* Brand colours */
  --blue:        #4f8ef7;
  --blue-dim:    #1e3a6e;
  --blue-pale:   rgba(79,142,247,0.10);
  --blue-glow:   rgba(79,142,247,0.20);

  --teal:        #2dd4bf;
  --teal-dim:    #0d4a42;
  --teal-pale:   rgba(45,212,191,0.10);

  --amber:       #f59e0b;
  --amber-dim:   #4a3008;
  --amber-pale:  rgba(245,158,11,0.10);

  --red:         #ef4444;
  --red-dim:     #4a1010;
  --red-pale:    rgba(239,68,68,0.10);

  --violet:      #a78bfa;
  --violet-dim:  #3b1f7a;
  --violet-pale: rgba(167,139,250,0.10);

  /* Text */
  --text:        #e2e8f0;
  --text-dim:    #7d8d9e;   /* was #64748b — lifted for 4.09:1 min contrast */
  --text-mute:   #7a8a9a;   /* was #334155 — lifted for 3.92:1 min contrast */

  /* Typography */
  --ui:   'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Shape */
  --r-sm: 4px;
  --r:    6px;
  --r-lg: 10px;
  --r-xl: 14px;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.5;
  height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar       { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-mute); }

/* ── Typography helpers ────────────────────────────────────────────────────── */
.label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

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

/* ── Form elements ─────────────────────────────────────────────────────────── */
input[type=text],
input[type=password],
input[type=number],
select,
textarea {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--ui);
  font-size: 13px;
  padding: 8px 10px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-pale);
}
input::placeholder { color: var(--text-mute); }
select option { background: var(--bg3); }

/* Custom dropdown arrow — replaces the system chevron */
select:not([size]):not([multiple]) {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%236a826a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--ui);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  user-select: none;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

.btn-primary {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}
.btn-primary:hover { background: #6b9ef8; box-shadow: 0 0 20px var(--blue-glow); }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border2);
}
.btn-outline:hover { border-color: var(--text-dim); background: var(--bg3); }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg3); }

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--red-dim);
}
.btn-danger:hover { background: var(--red-pale); border-color: var(--red); }

.btn-teal {
  background: var(--teal);
  color: var(--bg);
  border-color: var(--teal);
  font-weight: 600;
}
.btn-teal:hover { background: #3de8d2; box-shadow: 0 0 20px rgba(45,212,191,0.25); }

.btn-sm { font-size: 11px; padding: 5px 10px; }
.btn-icon {
  width: 28px; height: 28px;
  padding: 0;
  border-radius: var(--r-sm);
  font-size: 14px;
}

/* ── App layout ────────────────────────────────────────────────────────────── */
#appView {
  display: grid;
  grid-template-rows: 52px 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ── Header ────────────────────────────────────────────────────────────────── */
.app-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  flex-shrink: 0;
}

/* ── Session expired banner ─────────────────────────────────────────────────── */
.session-expired-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 20px;
  background: var(--amber-pale);
  border-bottom: 1px solid var(--amber-dim);
  font-size: 12px;
  color: var(--amber);
  flex-shrink: 0;
}
.session-expired-banner span { flex: 1; }
.session-expired-banner .btn-sm {
  background: var(--amber);
  color: var(--bg);
  border-color: transparent;
  font-weight: 600;
  padding: 4px 12px;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.app-tb-logo {
  height: 22px;
  width: auto;
  mix-blend-mode: screen;
}
.app-logo-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 400;
  letter-spacing: 0.02em;
  border-left: 1px solid var(--border2);
  padding-left: 8px;
  margin-left: 2px;
}

.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
}

.header-badge {
  font-size: 11px;
  font-family: var(--mono);
  padding: 3px 8px;
  border-radius: var(--r-sm);
  background: var(--blue-pale);
  color: var(--blue);
  border: 1px solid var(--blue-dim);
}

.header-user {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.stages-indicator {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

.version-badge {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-dim);
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 7px;
  white-space: nowrap;
}

.version-badge-tb {
  color: var(--teal);
  border-color: var(--teal-dim);
  background: var(--teal-pale);
}

/* ── Three-panel layout ────────────────────────────────────────────────────── */
.workspace {
  display: flex;
  flex-direction: row;
  overflow: hidden;
  height: 100%;
}

/* ── Pane resize handle ────────────────────────────────────────────────────── */
.pane-resize-handle {
  width: 4px;
  flex-shrink: 0;
  background: var(--border);
  cursor: col-resize;
  transition: background 0.15s;
  position: relative;
  z-index: 5;
}
.pane-resize-handle:hover,
.pane-resize-handle:active { background: var(--blue-dim); }


/* ── Panel headers ─────────────────────────────────────────────────────────── */
.panel-header {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}

/* ── Palette ───────────────────────────────────────────────────────────────── */
.palette {
  width: 210px;
  flex-shrink: 0;
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.palette-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.palette-group {
  margin-bottom: 4px;
}

.palette-group-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 8px 6px 5px;
}

.palette-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: grab;
  transition: all 0.12s;
  margin-bottom: 2px;
  user-select: none;
}
.palette-item:hover {
  background: var(--bg3);
  border-color: var(--border);
}
.palette-item:active { cursor: grabbing; }
.palette-item.palette-dragging { opacity: 0.4; }

.palette-item-info { flex: 1; min-width: 0; }
.palette-item-name { font-size: 12px; font-weight: 500; color: var(--text); }
.palette-item-desc {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.palette-item-tags {
  font-size: 9px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ── Task badges ───────────────────────────────────────────────────────────── */
.task-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  flex-shrink: 0;
}
.task-badge.asr {
  background: var(--teal-pale);
  color: var(--teal);
  border: 1px solid var(--teal-dim);
}
.task-badge.nlp {
  background: var(--amber-pale);
  color: var(--amber);
  border: 1px solid var(--amber-dim);
}
.task-badge.tts {
  background: var(--violet-pale);
  color: var(--violet);
  border: 1px solid var(--violet-dim);
}

/* ── Pipeline canvas ───────────────────────────────────────────────────────── */
.pipeline-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
  position: relative;
}

.pipeline-toolbar {
  height: 44px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  flex-shrink: 0;
}

.pipeline-name-input {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  padding: 4px 0;
  width: 160px;
  outline: none;
  transition: border-color 0.15s;
}
.pipeline-name-input:focus { border-color: var(--blue); }

.mode-tabs { display: flex; gap: 3px; margin-left: auto; }
.mode-tab {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
}
.mode-tab.active {
  background: var(--blue-pale);
  border-color: var(--blue-dim);
  color: var(--blue);
}
.mode-tab:not(.active):hover { color: var(--text); border-color: var(--border2); }

.pipeline-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

/* ── Bookends ──────────────────────────────────────────────────────────────── */
.bookend {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  border: 1.5px dashed var(--border2);
  background: var(--bg2);
  margin: 0 4px;
}
.bookend-input  { border-color: var(--teal-dim); }
.bookend-output { border-color: var(--blue-dim); }

.bookend-icon {
  width: 32px; height: 32px;
  border-radius: var(--r);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.bookend-input  .bookend-icon { background: var(--teal-pale); }
.bookend-output .bookend-icon { background: var(--blue-pale); }

.bookend-info { flex: 1; }
.bookend-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.bookend-sub {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 1px;
}

.bookend-wire-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 20px;
  font-weight: 600;
}
.wire-audio .bookend-wire-badge,
.wire-badge-audio { background: var(--teal-pale); color: var(--teal); border: 1px solid var(--teal-dim); }
.wire-badge-text  { background: var(--blue-pale); color: var(--blue); border: 1px solid var(--blue-dim); }

/* ── Wire connector ────────────────────────────────────────────────────────── */
.wire-connector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 18px;
  margin: 2px 0;
}
.wire-line {
  flex: 1;
  height: 1px;
}
.wire-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.wire-connector.wire-audio .wire-line  { background: var(--teal); }
.wire-connector.wire-audio .wire-label { background: var(--teal-pale); color: var(--teal); }
.wire-connector.wire-text  .wire-line  { background: var(--blue); }
.wire-connector.wire-text  .wire-label { background: var(--blue-pale); color: var(--blue); }
.wire-connector.wire-mismatch .wire-line  { background: var(--red); }
.wire-connector.wire-mismatch .wire-label { background: var(--red-pale); color: var(--red); }

/* ── Pipeline stage card ───────────────────────────────────────────────────── */
.stage-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  margin: 0 4px;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.stage-card:hover { border-color: var(--border2); }
.stage-card.drag-over {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px var(--blue-pale);
}
.stage-card.dragging { opacity: 0.3; }

.stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  cursor: grab;
  user-select: none;
}
.stage-header:active { cursor: grabbing; }

.stage-num {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  width: 16px;
  text-align: right;
  flex-shrink: 0;
}

.stage-config { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }

/* Wrapper for tag select + origin badge */
.tag-select-wrap {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
  min-width: 0;
}

.tag-origin-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 10px;
  opacity: 0.75;
  cursor: default;
}
.tag-origin-cloud  { color: var(--blue);  }
.tag-origin-local  { color: var(--amber); }

.stage-tag-select {
  flex: 1;
  min-width: 0;
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  cursor: pointer;
}
.stage-tag-select:focus { border-color: var(--blue); }

.exc-select {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg3);
  cursor: pointer;
  width: auto;
  flex-shrink: 0;
}
.exc-throw { color: var(--red);      border-color: var(--red-dim);  }
.exc-skip  { color: var(--text-dim); border-color: var(--border);   }

.stage-actions { display: flex; gap: 3px; flex-shrink: 0; }

.stage-params-panel {
  border-top: 1px solid var(--border);
  padding: 10px 12px 12px;
}

.param-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.param-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 3px 0;
}
.param-toggle input[type=checkbox] { width: 13px; height: 13px; accent-color: var(--blue); cursor: pointer; }
.param-toggle-label { font-size: 11px; font-family: var(--mono); color: var(--text-dim); }

.param-field { margin-bottom: 6px; }
.param-field label { font-size: 10px; color: var(--text-dim); font-family: var(--mono); display: block; margin-bottom: 3px; }
.param-field input, .param-field textarea {
  font-family: var(--mono); font-size: 11px;
  padding: 5px 8px; width: 100%;
}
.param-field textarea { resize: vertical; min-height: 44px; }

/* ── Drop zone ─────────────────────────────────────────────────────────────── */
.drop-zone {
  border: 1.5px dashed var(--border2);
  border-radius: var(--r-lg);
  padding: 20px;
  text-align: center;
  color: var(--text-dim);
  font-size: 12px;
  margin: 8px 4px;
  transition: all 0.15s;
  pointer-events: auto;
}
.drop-zone.drag-over {
  border-color: var(--blue);
  color: var(--blue);
  background: var(--blue-pale);
}

/* ── RIVA hint ─────────────────────────────────────────────────────────────── */
.riva-hint {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--amber-pale);
  border: 1px solid var(--amber-dim);
  border-radius: var(--r);
  margin: 0 4px 8px;
  font-size: 11px;
  color: var(--amber);
}
.riva-hint-text { flex: 1; line-height: 1.4; }

/* ── Code panel ────────────────────────────────────────────────────────────── */
.code-pane {
  width: 380px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

.code-toolbar {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  flex-shrink: 0;
  flex-wrap: wrap;
  min-height: 44px;
  row-gap: 0;
}

/* Panel type switcher: Code | Recipes */
.panel-type-tabs {
  display: flex;
  height: 44px;
  margin-right: 4px;
}
.panel-type-tab {
  font-size: 11px;
  font-weight: 500;
  padding: 0 14px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.12s;
  white-space: nowrap;
}
.panel-type-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.panel-type-tab:not(.active):hover { color: var(--text); }


.lang-tabs { display: flex; gap: 3px; }
.lang-tab {
  font-size: 11px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
  font-family: var(--mono);
}
.lang-tab.active {
  background: var(--blue-pale);
  border-color: var(--blue-dim);
  color: var(--blue);
}
.lang-tab:not(.active):hover { color: var(--text); }

.code-scroll {
  flex: 1;
  overflow: auto;
  background: #080c12;
}

.code-block {
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.7;
  padding: 16px 20px;
  white-space: pre;
  tab-size: 4;
  min-height: 100%;
  color: #abb2bf;
}
.code-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

/* ── Recipes panel ─────────────────────────────────────────────────────────── */
.recipes-scroll {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
#recipesBody {
  flex: 1;
  overflow-y: auto;
  padding: 4px 10px 16px;
}

.recipe-category { margin-bottom: 8px; }

.recipe-cat-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  padding: 6px 8px 4px;
}

.recipe-item {
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.12s;
}
.recipe-item:hover   { border-color: var(--border2); }
.recipe-item.open    { border-color: var(--blue-dim); }
.recipe-item.na      { opacity: 0.45; }

.recipe-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  background: var(--bg2);
}
.recipe-item-header:hover { background: var(--bg3); }

.recipe-item-title {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  flex: 1;
}
.recipe-na-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg4);
  color: var(--text-dim);
  border: 1px solid var(--border);
}
.recipe-chevron {
  font-size: 9px;
  color: var(--text-dim);
  flex-shrink: 0;
}

.recipe-body {
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.recipe-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--border);
}
.recipe-code-wrap {
  position: relative;
}
.recipe-copy-btn {
  position: absolute;
  top: 8px;
  right: 10px;
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: var(--bg3);
  color: var(--text-dim);
  cursor: pointer;
  z-index: 1;
  transition: all 0.12s;
}
.recipe-copy-btn:hover { color: var(--text); border-color: var(--text-dim); }

.recipe-code {
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.65;
  padding: 10px 12px 12px;
  white-space: pre;
  overflow-x: auto;
  color: #abb2bf;
  background: #080c12;
  margin: 0;
}

/* ── Recipes search ────────────────────────────────────────────────────────── */
.recipes-search-wrap {
  padding: 10px 10px 4px;
  flex-shrink: 0;
}
.recipes-search {
  width: 100%;
  font-size: 12px;
  padding: 7px 10px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r);
  color: var(--text);
  font-family: var(--ui);
  outline: none;
}
.recipes-search:focus { border-color: var(--teal); }
.recipes-no-results {
  padding: 28px 16px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
}
mark.recipe-hl {
  background: var(--amber-pale);
  color: var(--amber);
  border-radius: 2px;
  font-style: normal;
}
#recipesBody { padding-bottom: 16px; }

/* ── Boost phrases editor ──────────────────────────────────────────────────── */
.boost-editor {
  width: 100%;
  padding: 4px 0;
}
.boost-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.boost-editor-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
}
.boost-loading,
.boost-empty {
  font-size: 11px;
  color: var(--text-dim);
  font-style: italic;
  padding: 4px 0;
}
.boost-sets-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.boost-set-row {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 5px 8px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--bg3);
  transition: border-color 0.12s;
}
.boost-set-row:hover { border-color: var(--border2); }
.boost-set-row input[type=checkbox] { flex-shrink: 0; }
.boost-set-name {
  font-size: 12px;
  color: var(--text);
  flex: 1;
}
.boost-set-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--blue-pale);
  color: var(--blue);
  border: 1px solid var(--blue-dim);
  flex-shrink: 0;
}


/* ── Replacement sets editor ───────────────────────────────────────────────── */
.repl-editor {
  width: 100%;
  padding: 4px 0;
}
.repl-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 6px;
}
.repl-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.repl-from, .repl-to {
  flex: 1;
  font-size: 12px;
  padding: 5px 8px;
  min-width: 0;
}
.repl-arrow {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
}
.repl-empty {
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 0;
  font-style: italic;
}


/* Syntax highlight */
.sh-kw   { color: #c678dd; }   /* keywords */
.sh-kw2  { color: #e06c75; }   /* control flow, special */
.sh-fn   { color: #61afef; }   /* functions, classes */
.sh-str  { color: #98c379; }   /* strings */
.sh-cm   { color: #5c6370; font-style: italic; }  /* comments */
.sh-num  { color: #d19a66; }   /* numbers */
.sh-type { color: #e5c07b; }   /* types */

/* ── Test panel ────────────────────────────────────────────────────────────── */
.test-panel {
  position: absolute;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.test-header {
  height: 52px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  flex-shrink: 0;
}
.test-header h2 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.test-header-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.test-run-again-btn {
  display: block;
  margin: 16px auto 0;
}

/* ── Server message log ───────────────────────────────────────────────────── */
.test-msg-log {
  flex-shrink: 0;
  height: 200px;        /* overridden by JS / localStorage */
  min-height: 60px;
  max-height: 70vh;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

/* Drag-to-resize handle at top of message log */
.msg-log-resize-handle {
  height: 5px;
  cursor: row-resize;
  background: var(--border);
  flex-shrink: 0;
  transition: background .15s;
}
.msg-log-resize-handle:hover,
.msg-log-resize-handle.dragging {
  background: var(--teal);
}

.test-msg-log-header {
  display: flex;
  align-items: center;
  padding: 0 12px;
  height: 34px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg2);
}

.test-msg-log-title {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  flex: 1;
}

.test-msg-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.msg-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 3px 12px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.msg-row:last-child { border-bottom: none; }

.msg-ts {
  color: var(--text-mute);
  flex-shrink: 0;
  font-size: 10px;
}

.msg-summary {
  flex: 1;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.msg-expand-btn {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.1s;
}
.msg-expand-btn:hover { color: var(--text); border-color: var(--text-dim); }

.msg-detail {
  width: 100%;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-dim);
  padding: 6px 0 4px;
  white-space: pre;
  overflow-x: auto;
}

/* Row colour coding */
.msg-init      .msg-summary { color: var(--text-dim); }
.msg-configured .msg-summary { color: var(--teal); }
.msg-finished  .msg-summary { color: var(--blue); }
.msg-final     .msg-summary { color: var(--text); }
.msg-interim   .msg-summary { color: var(--text-dim); opacity: 0.7; }
.msg-error     .msg-summary,
.msg-error     .msg-ts      { color: var(--red); }

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}
.status-dot::before {
  content: '';
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-idle        { color: var(--text-dim); }
.status-connecting  { color: var(--amber);  animation: pulse-dot 1s ease-in-out infinite; }
.status-running     { color: var(--teal);   animation: pulse-dot 1s ease-in-out infinite; }
.status-finished    { color: var(--blue); }
.status-error       { color: var(--red); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.test-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Source picker */
.source-picker {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  padding: 24px;
  text-align: center;
}
.source-picker h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.source-picker p  { font-size: 12px; color: var(--text-dim); margin-bottom: 20px; }
.source-options   { display: flex; gap: 12px; justify-content: center; }
.source-option {
  flex: 1; max-width: 160px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 16px;
  background: var(--bg3);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  cursor: pointer;
  transition: all 0.15s;
}
.source-option:hover { border-color: var(--blue); background: var(--blue-pale); }
.source-option-icon  { font-size: 28px; }
.source-option-label { font-size: 13px; font-weight: 600; }
.source-option-desc  { font-size: 10px; color: var(--text-dim); text-align: center; }

/* VU meter */
.vu-meter-wrap {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 40px;
  padding: 4px;
  background: var(--bg3);
  border-radius: var(--r);
}
.vu-bar {
  flex: 1;
  background: var(--teal);
  border-radius: 2px;
  transition: height 0.04s linear;
  min-height: 3px;
}

/* Transcript */
.transcript-area {
  flex: 1;
  overflow-y: auto;
  min-height: 100px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 0;
}
.transcript-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  padding: 20px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  line-height: 1.6;
}

.output-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 4px;
  margin-bottom: 4px;
}
  flex: 1;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow-y: auto;
  min-height: 200px;
}
.transcript-no-text {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  padding: 12px 4px;
  line-height: 1.5;
}

.chain-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--teal-dim);
  border-radius: var(--r);
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.55;
}
.chain-info-icon {
  color: var(--teal);
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 100px;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
}

.transcript-segment {
  display: flex;
  gap: 10px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}
.transcript-segment:last-child { border-bottom: none; }
.transcript-segment.interim { opacity: 0.55; }

.seg-ts {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  white-space: nowrap;
  padding-top: 1px;
  flex-shrink: 0;
  width: 38px;
}
.seg-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  flex-shrink: 0;
  height: fit-content;
  margin-top: 2px;
}
.seg-badge.final   { background: var(--teal-pale); color: var(--teal); }
.seg-badge.interim { background: var(--bg4); color: var(--text-dim); }
.seg-text { font-size: 13px; color: var(--text); }

/* ── Text input panel (TTS / NLP) ──────────────────────────────────────────── */
.text-input-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.text-input-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.text-input-area {
  width: 100%;
  min-height: 100px;
  resize: vertical;
  font-size: 13px;
  padding: 10px 12px;
  line-height: 1.6;
}
.text-input-hint {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
}
.text-input-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.text-char-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
}

/* ── Audio output area (collect-then-play) ─────────────────────────────────── */
.audio-output-area {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px;
  margin-top: 8px;
}
.audio-output-placeholder {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 12px;
  padding: 8px 0;
}
.audio-output-icon { font-size: 20px; }
.audio-output-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  flex-wrap: wrap;
  gap: 8px;
}
/* ── Custom audio player ──────────────────────────────────────────────────── */
.cp-player {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 8px 12px;
  margin-bottom: 10px;
  user-select: none;
}
.cp-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border2);
  background: var(--bg2);
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s, background 0.15s;
}
.cp-btn:hover { border-color: var(--teal); background: var(--teal-pale); }
.cp-btn.cp-playing { border-color: var(--teal); background: var(--teal-pale); }
.cp-btn svg {
  width: 14px; height: 14px;
  fill: var(--text);
  stroke: none;
}
.cp-play svg polygon { fill: var(--text); }
.cp-play svg rect    { fill: var(--text); }
.cp-dl {
  border-radius: var(--r-sm);
  text-decoration: none;
}
.cp-dl svg {
  fill: none;
  stroke: var(--text);
  stroke-width: 1.5;
}
.cp-dl:hover svg { stroke: var(--teal); }
.cp-track {
  flex: 1;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
}
.cp-track:hover .cp-thumb { opacity: 1; }
.cp-fill {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  background: var(--teal);
  border-radius: 2px;
  pointer-events: none;
}
.cp-thumb {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--teal);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  box-shadow: 0 0 0 3px var(--teal-pale);
}
.cp-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  min-width: 32px;
}
.cp-cur { text-align: right; }
.cp-dur { text-align: left; }

/* ── Mic controls row ──────────────────────────────────────────────────────── */
.mic-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

/* File drop area */
.file-drop-area {
  border: 1.5px dashed var(--border2);
  border-radius: var(--r-lg);
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
  display: block;
}
.file-drop-area:hover, .file-drop-area.drag-over {
  border-color: var(--teal);
  background: var(--teal-pale);
}
.file-drop-area input[type=file] { display: none; }
.file-drop-icon { font-size: 32px; margin-bottom: 8px; }
.file-drop-text { font-size: 13px; font-weight: 500; }
.file-drop-sub  { font-size: 11px; color: var(--text-dim); margin-top: 4px; }


/* ── Login View ────────────────────────────────────────────────────────────── */
#loginView {
  display: grid;
  grid-template-columns: 1fr 1fr;
  height: 100vh;
}
@media (max-width: 820px) {
  #loginView { grid-template-columns: 1fr; }
  .login-brand { display: none; }
}

/* Left branding panel */
.login-brand {
  background: linear-gradient(160deg, #0a2e2a 0%, #050f0f 100%);
  padding: 60px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-brand::before {
  content: '';
  position: absolute;
  top: -80px; left: -80px;
  width: 500px; height: 500px;
  background: radial-gradient(circle, rgba(45,212,191,0.10) 0%, transparent 65%);
  pointer-events: none;
}
.login-brand-inner { flex: 1; }

/* Logo — real image with text fallback */
.login-brand-logo { margin-bottom: 24px; }
.login-brand-logo img {
  height: 28px;
  width: auto;
  display: block;
  mix-blend-mode: screen;
}
.login-logo-fallback {
  font-size: 26px;
  font-weight: 800;
  color: var(--teal);
  letter-spacing: -0.02em;
  display: none;
}

.login-brand-tag {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--teal);
  opacity: 0.65;
  margin-bottom: 36px;
}
.login-brand-desc {
  font-size: 15px;
  color: #4a8a80;
  line-height: 1.7;
  margin-bottom: 44px;
  max-width: 340px;
}
.login-features {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-feature {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  color: #4a8a80;
  line-height: 1.5;
}
.login-feature-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
  margin-top: 5px;
}
.login-brand-foot {
  font-size: 10px;
  color: #2a4a44;
  margin-top: 40px;
}

/* Right form panel */
.login-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 56px;
  overflow-y: auto;
  background: #080e12;
}

.login-card {
  width: 100%;
  max-width: 360px;
}
.login-card-head { margin-bottom: 32px; }
.login-card-title {
  font-size: 22px;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}
.login-card-sub {
  font-size: 12px;
  color: #4a8a80;
  line-height: 1.5;
}

.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4a7a70;
  margin-bottom: 6px;
}

/* Override global input styles for the login form */
.login-card input[type=text],
.login-card input[type=password],
.login-card select {
  background: #061414;
  border: 1px solid #1a3535;
  color: #c8e8e4;
}
.login-card input[type=text]:focus,
.login-card input[type=password]:focus,
.login-card select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(45,212,191,0.1);
}
.login-card input::placeholder { color: #2a4a44; }

/* Teal connect button */
#connectBtn {
  background: var(--teal) !important;
  border-color: var(--teal) !important;
  color: #041010 !important;
  font-weight: 600;
}
#connectBtn:hover {
  background: #3de8d2 !important;
  box-shadow: 0 0 24px rgba(45,212,191,0.22) !important;
}

.login-error {
  background: var(--red-pale);
  border: 1px solid var(--red-dim);
  border-radius: var(--r);
  padding: 10px 12px;
  font-size: 11px;
  color: var(--red);
  margin-top: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.custom-server-fields {
  background: #061414;
  border: 1px solid #1a3535;
  border-radius: var(--r);
  padding: 12px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.custom-server-fields input { font-size: 11px; padding: 6px 8px; }
.custom-server-fields label { font-size: 10px; }

/* ── Template cards ────────────────────────────────────────────────────────── */
.template-card {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 10px 11px;
  margin-bottom: 5px;
  cursor: pointer;
  transition: all 0.15s;
}
.template-card:hover {
  border-color: var(--blue-dim);
  background: var(--blue-pale);
}
.template-card:active { opacity: 0.8; }

.template-card-top {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 5px;
}
.template-icon {
  font-size: 15px;
  flex-shrink: 0;
}
.template-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.template-mode-badge {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--bg4);
  color: var(--text-dim);
  border: 1px solid var(--border2);
  flex-shrink: 0;
}
.template-desc {
  font-size: 10px;
  color: var(--text-dim);
  line-height: 1.45;
}

/* ── Parameter help icon ───────────────────────────────────────────────────── */
.param-help-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--border2);
  color: var(--text-dim);
  font-size: 8px;
  font-weight: 700;
  font-style: normal;
  cursor: help;
  margin-left: 3px;
  vertical-align: middle;
}

/* ── Capability badges ─────────────────────────────────────────────────────── */
.cap-badges-row {
  display: flex;
  gap: 4px;
  padding: 0 2px;
  flex-wrap: wrap;
}
.cap-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 1px 6px;
  border-radius: 3px;
  cursor: default;
  user-select: none;
}
.cap-badge-on {
  background: var(--teal-pale);
  color: var(--teal);
  border: 1px solid var(--teal-dim);
}
.cap-badge-off {
  background: var(--bg4);
  color: var(--text-dim);
  border: 1px solid var(--border2);
}

/* ── Conflict hint ─────────────────────────────────────────────────────────── */
.conflict-hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  background: var(--red-pale);
  border: 1px solid var(--red-dim);
  border-radius: var(--r);
  margin: 0 4px 8px;
  font-size: 11px;
  color: var(--red);
  line-height: 1.5;
}

/* ── Speaker label in transcript ───────────────────────────────────────────── */
.seg-speaker {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 3px;
  background: rgba(255,255,255,0.05);
  border: 1px solid currentColor;
  margin-right: 6px;
  flex-shrink: 0;
  opacity: 0.85;
}

/* ── Custom tooltip ────────────────────────────────────────────────────────── */
#customTooltip {
  position: fixed;
  z-index: 99999;
  max-width: 280px;
  background: #1c2333;
  border: 1px solid #374761;
  border-radius: 6px;
  padding: 8px 11px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  line-height: 1.55;
  color: #e2e8f0;
  box-shadow: 0 6px 24px rgba(0,0,0,0.5);
  pointer-events: none;
  opacity: 0;
  white-space: normal;
  word-wrap: break-word;
}
#customTooltip.visible { opacity: 1; }

/* ── Template modal ────────────────────────────────────────────────────────── */
.tpl-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.tpl-modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r-xl); width: 460px; max-width: calc(100vw - 32px);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5); overflow: hidden;
}
.tpl-modal-header {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 20px 20px 16px; border-bottom: 1px solid var(--border);
}
.tpl-modal-icon { font-size: 24px; flex-shrink: 0; margin-top: 2px; }
.tpl-modal-title { flex: 1; }
.tpl-modal-name { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.tpl-modal-desc { font-size: 11px; color: var(--text-dim); line-height: 1.5; }
.tpl-modal-close { flex-shrink: 0; }
.tpl-modal-body { padding: 16px 20px; }
.tpl-modal-section-label {
  font-size: 9px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-dim); margin-bottom: 10px;
}
.tpl-modal-rows { display: flex; flex-direction: column; gap: 6px; }
.tpl-modal-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px;
  background: var(--bg3); border-radius: var(--r); border: 1px solid var(--border);
}
.tpl-stage-icon { font-size: 13px; font-weight: 700; width: 18px; flex-shrink: 0; text-align: center; }
.tpl-stage-icon.ok      { color: var(--teal); }
.tpl-stage-icon.missing { color: var(--red); }
.tpl-stage-task {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--text); width: 72px; flex-shrink: 0;
}
.tpl-stage-tag {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tpl-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 14px 20px; border-top: 1px solid var(--border); background: var(--bg3);
}

/* ── Load panel ────────────────────────────────────────────────────────────── */
.load-panel {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 20;
  display: flex; flex-direction: column; overflow: hidden;
}
.load-panel-header {
  height: 44px; background: var(--bg2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 16px; gap: 10px; flex-shrink: 0;
}
.load-panel-title { font-size: 13px; font-weight: 600; color: var(--text); flex: 1; }
.load-panel-body {
  flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
}
.load-empty {
  text-align: center; padding: 48px 20px;
  color: var(--text-dim); font-size: 12px; font-style: italic;
}
.load-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-lg); transition: border-color 0.12s;
}
.load-item:hover { border-color: var(--border2); }
.load-item-main { flex: 1; min-width: 0; }
.load-item-name {
  font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.load-item-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 4px; }
.load-item-mode {
  font-family: var(--mono); font-size: 9px; font-weight: 700;
  padding: 1px 6px; border-radius: 2px;
  background: var(--blue-pale); color: var(--blue); border: 1px solid var(--blue-dim);
}
.load-item-date { font-family: var(--mono); font-size: 10px; color: var(--text-dim); }
.load-item-stages {
  font-family: var(--mono); font-size: 10px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.load-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Load warnings banner ──────────────────────────────────────────────────── */
.load-warnings-banner {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--bg2); border: 1px solid var(--amber-dim);
  border-radius: var(--r); padding: 10px 12px; margin: 0 4px 8px;
}
.load-warnings-body { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.load-warning-item { font-size: 11px; line-height: 1.5; }
.load-warning-error { color: var(--red); }
.load-warning-warn  { color: var(--amber); }

#toastContainer {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 9999;
}
.toast {
  font-size: 12px;
  padding: 10px 16px;
  border-radius: var(--r);
  border-left: 3px solid;
  background: var(--bg2);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  animation: toast-in 0.2s ease;
  max-width: 340px;
  line-height: 1.4;
}
.toast.success { border-color: var(--teal);  color: var(--teal); }
.toast.error   { border-color: var(--red);   color: var(--red); }
.toast.info    { border-color: var(--blue);  color: var(--text); }
@keyframes toast-in {
  from { opacity: 0; transform: translateX(12px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════════════════════════════
   DICTIONARY PANEL
   ═══════════════════════════════════════════════════════════════════════════ */

.dict-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 200;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.dict-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(780px, 92vw);
  background: var(--bg);
  border-left: 1px solid var(--border);
  z-index: 201;
  display: flex;
  flex-direction: column;
  animation: slideIn 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.35);
}

@keyframes slideIn {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}

/* ── Panel header ─────────────────────────────────────────────────────────── */
.dict-panel-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  position: relative;
}

.dict-panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.dict-panel-icon { font-size: 18px; }

.dict-panel-sub {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  max-width: 560px;
}

.dict-panel-sub code {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg3);
  padding: 1px 4px;
  border-radius: 3px;
  color: var(--teal);
}

.dict-close-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 28px;
  height: 28px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.dict-close-btn:hover { background: var(--bg3); color: var(--text); border-color: var(--text-dim); }

/* ── Panel body: two columns ──────────────────────────────────────────────── */
.dict-panel-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* ── Tab strip ────────────────────────────────────────────────────────────── */
.dict-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg2);
}

.dict-tab {
  font-family: var(--ui);
  font-size: 12px;
  font-weight: 500;
  padding: 10px 20px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  margin-bottom: -1px;
}
.dict-tab:hover { color: var(--text); }
.dict-tab.active { color: var(--teal); border-bottom-color: var(--teal); }

/* ── Search bar ───────────────────────────────────────────────────────────── */
.dict-search-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg2);
}

.dict-search-input {
  flex: 1;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 5px 8px;
  outline: none;
  transition: border-color 0.12s;
}
.dict-search-input:focus { border-color: var(--teal); }
.dict-search-input::placeholder { color: var(--text-dim); }

.dict-search-clear {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: var(--r-sm);
  line-height: 1;
  flex-shrink: 0;
  transition: color 0.1s;
}
.dict-search-clear:hover { color: var(--text); }

/* ── Replacement type badge ───────────────────────────────────────────────── */
.dict-type-global {
  background: var(--amber-pale);
  color: var(--amber);
  border-color: var(--amber-dim);
}

/* ── Replacement item rows ────────────────────────────────────────────────── */
.repl-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
}
.repl-item-row:last-child { border-bottom: none; }

.repl-item-sources {
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.repl-source-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
}

.repl-target-chip {
  font-family: var(--mono);
  font-size: 11px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--teal-pale);
  border: 1px solid var(--teal-dim);
  color: var(--teal);
}

.repl-arrow-label {
  font-size: 13px;
  color: var(--text-mute);
  flex-shrink: 0;
}

.repl-case-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  border: 1px solid var(--border2);
  color: var(--text-dim);
  background: var(--bg2);
  flex-shrink: 0;
}

/* ── Add replacement form ─────────────────────────────────────────────────── */
.repl-add-form {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.repl-add-form-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.repl-add-label {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  flex-shrink: 0;
  width: 28px;
}

.repl-case-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ── Source chip tags input ───────────────────────────────────────────────── */
.repl-source-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 4px 8px;
  min-height: 32px;
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  flex: 1;
  cursor: text;
  transition: border-color 0.12s;
}
.repl-source-tags:focus-within { border-color: var(--teal); }

.repl-source-tag {
  display: flex;
  align-items: center;
  gap: 3px;
  font-family: var(--mono);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
}

.repl-source-tag-del {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 10px;
  padding: 0 0 0 2px;
  line-height: 1;
}
.repl-source-tag-del:hover { color: var(--red); }

.repl-source-input {
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  outline: none;
  min-width: 80px;
  flex: 1;
}
.repl-source-input::placeholder { color: var(--text-dim); }

/* ── Sets column (left) ───────────────────────────────────────────────────── */
.dict-sets-col {
  width: 260px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ── Phrases column (right) ───────────────────────────────────────────────── */
.dict-phrases-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Column header ────────────────────────────────────────────────────────── */
.dict-col-header {
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  gap: 10px;
  flex-shrink: 0;
}

.dict-col-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dict-phrase-count {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
  flex-shrink: 0;
}

/* ── Sets list ────────────────────────────────────────────────────────────── */
.dict-sets-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dict-set-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 10px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  position: relative;
  transition: background 0.1s, border-color 0.1s;
}
.dict-set-row:hover               { background: var(--bg3); border-color: var(--border); }
.dict-set-row.selected            { background: var(--teal-pale); border-color: var(--teal-dim); }
.dict-set-row.selected .dict-set-name { color: var(--teal); }

.dict-set-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--text);
  padding-right: 24px;
}

.dict-set-meta {
  display: flex;
  gap: 5px;
}

.dict-type-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 2px;
  background: var(--bg2);
  color: var(--text-dim);
  border: 1px solid var(--border2);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dict-shared-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--blue-pale);
  color: var(--blue);
  border: 1px solid var(--blue-dim);
}

.dict-icon-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.1s, background 0.1s, color 0.1s;
}
.dict-set-row:hover .dict-icon-btn { opacity: 1; }
.dict-del-set-btn:hover             { background: var(--red-pale, #2a0808); color: var(--red); }

/* ── Add set form ─────────────────────────────────────────────────────────── */
.dict-add-set-form {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* ── Phrases body ─────────────────────────────────────────────────────────── */
.dict-phrases-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px;
}

.dict-phrase-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dict-phrase-header-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

.dict-ph-text    { flex: 1; font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.dict-ph-boost   { width: 68px;  font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; flex-shrink: 0; }
.dict-ph-variants{ flex: 1;      font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }
.dict-ph-acc     { width: 130px; font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; flex-shrink: 0; }
.dict-ph-ipa     { width: 130px; font-size: 10px; font-weight: 600; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; flex-shrink: 0; }
.dict-ph-actions { width: 60px; flex-shrink: 0; }

.dict-phrase-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}

.dict-phrase-row.readonly {
  padding: 6px 4px;
  border-bottom: 1px solid var(--border);
}
.dict-phrase-row.readonly:last-child { border-bottom: none; }

.dict-ph-text-val     { flex: 1; font-size: 12px; color: var(--text); }
.dict-ph-boost-val    { width: 68px;  font-size: 12px; color: var(--text-dim); font-family: var(--mono); flex-shrink: 0; }
.dict-ph-variants-val { flex: 1;      font-size: 11px; color: var(--text-dim); font-family: var(--mono); }
.dict-ph-acc-val      { width: 130px; font-size: 12px; color: var(--text-dim); font-family: var(--mono); flex-shrink: 0; }
.dict-ph-ipa-val      { width: 130px; font-size: 12px; color: var(--text-dim); font-family: var(--mono); flex-shrink: 0; }

.dict-phrase-row .dict-phrase-input   { flex: 1; min-width: 0; }
.dict-phrase-row .dict-variants-input { flex: 1; min-width: 0; }
.dict-phrase-row .dict-acc-input      { width: 130px; flex-shrink: 0; }
.dict-phrase-row .dict-ipa-input      { width: 130px; flex-shrink: 0; }

.dict-phrase-row-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
  width: 56px;
  justify-content: flex-end;
}

.dict-phrase-save-btn {
  opacity: 0;
  transition: opacity 0.15s, color 0.12s;
  color: var(--teal);
}
.dict-phrase-save-btn.visible { opacity: 1; }
.dict-phrase-save-btn:hover   { color: var(--teal); }

/* ── Add phrase form ──────────────────────────────────────────────────────── */
.dict-add-phrase-form {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: var(--bg2);
}

.dict-add-phrase-form .dict-phrase-input {
  flex: 1;
  min-width: 0;
}

/* Restore spinner and fix height for number inputs inside dict rows */
.dict-boost-wrap {
  display: flex;
  align-items: stretch;
  width: 100px;
  flex-shrink: 0;
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg4);
}

.dict-boost-btn {
  width: 26px;
  flex-shrink: 0;
  background: var(--bg3);
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  user-select: none;
}
.dict-boost-btn:hover  { background: var(--border2); color: var(--text); }
.dict-boost-btn:active { background: var(--teal-dim); color: var(--teal); }

.dict-boost-wrap .dict-boost-input {
  flex: 1;
  min-width: 0;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: var(--bg4);
  color: var(--text);
  font-size: 12px;
  font-family: var(--mono);
  padding: 5px 2px;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
}
/* Hide native spinners — we use custom buttons */
.dict-boost-wrap .dict-boost-input::-webkit-inner-spin-button,
.dict-boost-wrap .dict-boost-input::-webkit-outer-spin-button { display: none; }
.dict-boost-wrap .dict-boost-input[type=number] { -moz-appearance: textfield; }

.dict-add-phrase-form .dict-variants-input {
  flex: 1;
  min-width: 0;
}

/* G2A add form — wider acc/ipa fields */
.dict-add-phrase-form--g2a .dict-acc-input,
.dict-add-phrase-form--g2a .dict-ipa-input {
  flex: 1;
  min-width: 0;
}

/* ── Type badge colour variants ───────────────────────────────────────────── */
.dict-type-boost {
  background: var(--blue-pale);
  color: var(--blue);
  border-color: var(--blue-dim);
}
.dict-type-g2a {
  background: var(--violet-pale);
  color: var(--violet);
  border-color: var(--violet-dim);
}
.dict-set-type-note {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 2px;
  border: 1px solid;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
  cursor: default;
}

/* ── Set type selector in add-set form ────────────────────────────────────── */
.dict-new-set-name { flex: 1; min-width: 0; }
.dict-new-set-type { width: 72px; flex-shrink: 0; padding: 6px 4px; }

/* ── Shared input style ───────────────────────────────────────────────────── */
.dict-input {
  background: var(--bg4);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 12px;
  font-family: inherit;
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.12s;
}
.dict-input::placeholder { color: var(--text-dim); opacity: 1; }
.dict-input:focus { border-color: var(--teal); background: var(--bg4); }

/* ── States ───────────────────────────────────────────────────────────────── */
.dict-loading {
  padding: 24px 16px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
}

.dict-empty {
  padding: 24px 16px;
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
  text-align: center;
  line-height: 1.6;
}

.dict-error {
  padding: 16px;
  font-size: 12px;
  color: var(--red);
  background: var(--bg2);
  border-radius: var(--r);
  margin: 8px;
}
/* ── Replacement edit row ─────────────────────────────────────────────────── */
.repl-item-editing {
  flex-direction: column;
  align-items: stretch;
  background: var(--bg2);
  padding: 10px 14px;
  gap: 0;
}

/* ── Offline mode UI ──────────────────────────────────────────────────────── */
.offline-input-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.offline-mode-toggle {
  display: flex;
  gap: 10px;
}

.offline-mode-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 12px;
  border-radius: var(--r);
  border: 2px solid var(--border2);
  background: var(--bg2);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.offline-mode-btn:hover {
  border-color: var(--teal-dim);
  color: var(--text);
}
.offline-mode-btn.active {
  border-color: var(--teal);
  background: var(--teal-pale);
  color: var(--teal);
}
.offline-mode-icon { font-size: 22px; line-height: 1; }
.offline-mode-label { font-size: 13px; font-weight: 600; }
.offline-mode-desc  { font-size: 10px; opacity: 0.75; font-family: var(--mono); }

/* ── Offline output ───────────────────────────────────────────────────────── */
.offline-output-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 120px;
  padding: 16px;
  background: var(--bg2);
  border-radius: var(--r);
  border: 1px solid var(--border);
  gap: 12px;
  overflow: auto;
}

.offline-output-placeholder {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 16px 0;
}

.offline-session-meta {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.offline-session-meta code {
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--teal);
}

.offline-transcript {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.offline-raw-details {
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.offline-raw-summary {
  font-size: 11px;
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  font-family: var(--mono);
  letter-spacing: 0.03em;
}
.offline-raw-summary:hover { color: var(--text); }
.offline-raw-json {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  overflow: auto;
  max-height: 300px;
  white-space: pre;
}

/* ── Offline run-again/clear button row ──────────────────────────────────── */
.offline-run-again-row {
  display: flex;
  gap: 10px;
  padding: 12px 0 4px;
  justify-content: center;
}

/* ── TTS collect progress indicator ──────────────────────────────────────── */
.tts-progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  height: 100%;
  color: var(--text-dim);
}
.tts-progress-icon { font-size: 28px; animation: tts-pulse 1s ease-in-out infinite; }
@keyframes tts-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.tts-progress-text  { font-size: 14px; color: var(--text); }
.tts-progress-stats { font-family: var(--mono); font-size: 11px; color: var(--teal); }

/* ── TTS streaming statistics panel ──────────────────────────────────────── */
.tts-stats-details {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.tts-stats-summary {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text-dim);
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.03em;
  list-style: none;
}
.tts-stats-summary:hover { color: var(--text); }
.tts-stats-summary::before { content: '▶ '; font-size: 9px; }
details[open] .tts-stats-summary::before { content: '▼ '; }

.tts-stats-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 11px;
  font-family: var(--mono);
}
.tts-stats-table td {
  padding: 3px 8px 3px 0;
  vertical-align: top;
}
.tts-stat-label {
  color: var(--text-dim);
  white-space: nowrap;
  padding-right: 16px !important;
  width: 180px;
}
.tts-stat-value {
  color: var(--text);
  white-space: nowrap;
  padding-right: 16px !important;
}
.tts-stat-note {
  color: var(--text-dim);
  font-size: 10px;
  opacity: 0.75;
}
.tts-stat-section {
  color: var(--teal);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding-top: 8px !important;
  opacity: 0.8;
}

/* ── Voice chatbot chain banner ───────────────────────────────────────────── */
.chain-info-chatbot {
  border-left-color: var(--teal);
  background: var(--teal-pale);
  color: var(--text);
}
.chain-info-chatbot strong { color: var(--teal); }


/* ── Offline transcript speaker blocks ───────────────────────────────────── */
.offline-speaker-block {
  display: flex;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 6px;
}
.offline-speaker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
  text-align: right;
}
.offline-speaker-text {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
}

/* ── Speakers panel ───────────────────────────────────────────────────────── */
.spk-panel { width: 820px; }

.spk-panel-inner { flex: 1; overflow: hidden; position: relative; }

.spk-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  height: 100%;
  overflow: hidden;
}

/* ── List column ──────────────────────────────────────────────────────────── */
.spk-list-col {
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.spk-list-header {
  display: flex;
  gap: 6px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.spk-search {
  flex: 1;
  font-size: 12px;
  padding: 5px 8px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
}
.spk-search:focus { border-color: var(--teal-dim); }

.spk-list {
  flex: 1;
  overflow-y: auto;
}

.spk-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.spk-row:hover { background: var(--bg3); }
.spk-row-active {
  background: var(--teal-pale) !important;
  border-left: 3px solid var(--teal);
  padding-left: 9px;
}

.spk-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--teal-dim);
  color: var(--teal);
  font-size: 11px;
  font-weight: 600;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: var(--mono);
}
.spk-avatar-lg {
  width: 44px; height: 44px;
  font-size: 15px;
  flex-shrink: 0;
}

.spk-row-info { flex: 1; min-width: 0; }
.spk-row-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spk-row-roles {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.spk-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.spk-dot-enrolled { background: var(--green-mid); box-shadow: 0 0 4px var(--green-dim); }
.spk-dot-empty    { background: var(--border2); }

.spk-empty {
  padding: 24px;
  color: var(--text-mute);
  font-size: 12px;
  text-align: center;
  font-family: var(--mono);
}
.spk-empty-detail { margin-top: 60px; }

/* ── Add form ──────────────────────────────────────────────────────────────── */
.spk-add-form {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg2);
}

.spk-input {
  width: 100%;
  font-size: 12px;
  padding: 7px 10px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  font-family: var(--sans);
}
.spk-input:focus { border-color: var(--teal-dim); }

.spk-label {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.spk-form-btns {
  display: flex;
  gap: 6px;
}

/* ── Detail column ─────────────────────────────────────────────────────────── */
.spk-detail-col {
  overflow-y: auto;
}

.spk-detail {
  padding: 20px 24px;
}

.spk-detail-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.spk-detail-meta { flex: 1; min-width: 0; }
.spk-detail-name { font-size: 16px; font-weight: 600; color: var(--text); }
.spk-detail-roles { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.spk-detail-created { font-size: 11px; color: var(--text-mute); font-family: var(--mono); margin-top: 4px; }

.spk-detail-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.btn-danger-outline {
  border-color: var(--red) !important;
  color: var(--red) !important;
}
.btn-danger-outline:hover {
  background: rgba(255,68,68,0.08) !important;
}

/* ── Sections ──────────────────────────────────────────────────────────────── */
.spk-section {
  border-top: 1px solid var(--border);
  padding: 16px 0;
}

.spk-section-title {
  font-size: 11px;
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.spk-section-desc {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 12px;
}

.spk-enrolled-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
}

.spk-ml-auto { margin-left: auto; }
.spk-text-dim { color: var(--text-dim); }

/* ── Session row ───────────────────────────────────────────────────────────── */
.spk-session-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.spk-input-wrap { flex: 1; }

/* ── Segments ──────────────────────────────────────────────────────────────── */
.spk-seg-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.spk-seg-input {
  width: 90px;
  font-size: 12px;
  padding: 6px 8px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  outline: none;
  font-family: var(--mono);
}
.spk-seg-input:focus { border-color: var(--teal-dim); }

.spk-seg-sep { color: var(--text-mute); font-size: 12px; }

.spk-add-seg { margin-top: 4px; }

/* ── Preview status ────────────────────────────────────────────────────────── */
.spk-preview-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
  font-size: 12px;
  color: var(--teal);
  font-family: var(--mono);
  background: var(--teal-pale);
  border: 1px solid var(--teal-dim);
  border-radius: var(--r-sm);
  padding: 6px 10px;
}

/* ── Enroll row ────────────────────────────────────────────────────────────── */
.spk-enroll-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

/* ── Hint ──────────────────────────────────────────────────────────────────── */
.spk-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.6;
}
.spk-hint code {
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  color: var(--teal);
  font-family: var(--mono);
}

/* ── Speaker suggestions (from text-segments) ────────────────────────────── */
.spk-suggestions-loading,
.spk-suggestions-none {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--mono);
  padding: 8px 0;
}

.spk-suggestions-title {
  font-size: 10px;
  font-family: var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin: 12px 0 6px;
}

.spk-suggestions-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.spk-suggestion-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 12px;
  border: 1px solid var(--border2);
  border-radius: var(--r);
  background: var(--bg2);
  cursor: pointer;
  transition: all 0.15s;
}
.spk-suggestion-btn:hover {
  border-color: var(--teal-dim);
  background: var(--teal-pale);
}
.spk-suggestion-active {
  border-color: var(--teal) !important;
  background: var(--teal-pale) !important;
}
.spk-suggestion-label {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text);
  font-weight: 600;
}
.spk-suggestion-meta {
  font-size: 10px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ── Hide number input spinners ──────────────────────────────────────────── */
input[type=number].spk-input,
input[type=number].spk-seg-input {
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: textfield;
}
input[type=number].spk-input::-webkit-inner-spin-button,
input[type=number].spk-input::-webkit-outer-spin-button,
input[type=number].spk-seg-input::-webkit-inner-spin-button,
input[type=number].spk-seg-input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ── Speaker label above segment (offline transcript) ────────────────────── */
.offline-speaker-block {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-bottom: 10px;
}
.offline-speaker {
  min-width: unset;
  text-align: left;
}

/* ── Inline confirm dialog ───────────────────────────────────────────────── */
.spk-confirm-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: inherit;
}
.spk-confirm-box {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  max-width: 340px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.spk-confirm-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.spk-confirm-msg {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.5;
}
.spk-confirm-btns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.btn-danger-solid {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.btn-danger-solid:hover {
  background: #cc3333;
  border-color: #cc3333;
}

/* ── Session row load button ──────────────────────────────────────────────── */
.spk-load-btn {
  flex-shrink: 0;
  align-self: flex-end;
  margin-bottom: 1px;
}

/* ── TTS streaming hint ───────────────────────────────────────────────────── */
.tts-streaming-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.btn-link {
  background: none;
  border: none;
  color: var(--teal);
  font-size: 11px;
  font-family: var(--mono);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.btn-link:hover { color: var(--text); }

/* ── Template demo link ───────────────────────────────────────────────────── */
.template-demo-link {
  display: block;
  font-size: 10px;
  font-family: var(--mono);
  color: var(--teal);
  text-decoration: none;
  margin-top: 5px;
  padding-top: 5px;
  border-top: 1px solid var(--border);
  letter-spacing: 0.03em;
  opacity: 0.85;
}
.template-demo-link:hover { opacity: 1; text-decoration: underline; }

.tpl-modal-demo-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--teal);
  text-decoration: none;
}
.tpl-modal-demo-link:hover { text-decoration: underline; }

/* ── TTS real-time controls ───────────────────────────────────────────────── */
.tts-rt-bar {
  margin: 8px 0 4px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tts-rt-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.tts-rt-toggle input[type=checkbox] { display: none; }
.tts-rt-toggle-track {
  width: 32px; height: 18px;
  border-radius: 9px;
  background: var(--border2);
  position: relative;
  flex-shrink: 0;
  transition: background .15s;
}
.tts-rt-toggle input:checked + .tts-rt-toggle-track { background: var(--teal); }
.tts-rt-toggle-thumb {
  position: absolute;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: left .15s;
}
.tts-rt-toggle input:checked ~ .tts-rt-toggle-track .tts-rt-toggle-thumb { left: 17px; }
/* Firefox workaround */
.tts-rt-toggle input:checked + .tts-rt-toggle-track .tts-rt-toggle-thumb { left: 17px; }
.tts-rt-toggle-label {
  font-size: 12px;
  color: var(--text-dim);
}
.tts-rt-params {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.tts-rt-param {
  display: grid;
  grid-template-columns: 90px 1fr 52px;
  align-items: center;
  gap: 8px;
}
.tts-rt-param-label {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.tts-rt-param input[type=range] { width: 100%; accent-color: var(--teal); cursor: pointer; }
.tts-rt-param-val {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text);
  text-align: right;
}

/* ── TTS run log ─────────────────────────────────────────────────────────── */
.tts-run-log {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.tts-run-log-scroll {
  overflow-y: auto;
  max-height: 240px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.tts-run-log-scroll::-webkit-scrollbar { width: 5px; }
.tts-run-log-scroll::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
.tts-run-log-scroll::-webkit-scrollbar-track { background: transparent; }
.tts-run-log-title {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-dim);
  padding: 6px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.tts-run-log-sub { font-weight: 400; color: var(--text-mute); text-transform: none; letter-spacing: 0; }
.tts-run-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-family: var(--mono);
}
.tts-run-log-table thead { position: sticky; top: 0; z-index: 1; }
.tts-run-log-table th {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-mute);
  padding: 4px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.tts-run-log-table td {
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: middle;
}
.tts-run-log-table tr:last-child td { border-bottom: none; }
.tts-run-log-latest td { background: rgba(45,212,191,.04); }
.tts-run-log-tag { color: var(--text); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tts-run-log-ttfc { font-weight: 600; }
.tts-run-log-ttfc.good { color: #4ade80; }
.tts-run-log-ttfc.warn { color: var(--amber); }
.tts-run-log-ttfc.bad  { color: #f87171; }
.tts-run-log-time { color: var(--text-mute); font-size: 10px; }
.tts-run-log-del { font-size: 10px; opacity: .4; }
.tts-run-log-del:hover { opacity: 1; color: var(--red) !important; }

/* ── TTS live playback indicator ─────────────────────────────────────────── */
.tts-progress-live { padding: 10px 0; }
.tts-progress-live-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.tts-live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--teal);
  flex-shrink: 0;
  animation: tts-live-pulse 1s ease-in-out infinite;
}
@keyframes tts-live-pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(45,212,191,.4); }
  50%       { opacity: .6; box-shadow: 0 0 0 5px rgba(45,212,191,0); }
}
.tts-live-sent {
  font-size: 10px;
  font-family: var(--mono);
  color: var(--teal);
  margin-left: auto;
}

/* ── TTS live bar ────────────────────────────────────────────────────────── */
.tts-live-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}
.tts-live-bar-text {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}

/* ── TTS live pause button ────────────────────────────────────────────────── */
.tts-live-pause-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 11px;
  padding: 1px 9px;
  cursor: pointer;
  margin-left: 6px;
  transition: all .15s;
  line-height: 1.4;
  white-space: nowrap;
}
.tts-live-pause-btn:hover {
  border-color: #f87171;
  color: #f87171;
}

/* ── TTS run log additions ───────────────────────────────────────────────── */
.tts-run-log-ttfc-sub {
  color: var(--text-mute);
  font-size: 10px;
}
.tts-run-log-na {
  color: var(--text-mute);
  font-size: 10px;
  text-align: center;
}

/* ── TTS stats guidance boxes ────────────────────────────────────────────── */
.tts-stat-guidance {
  font-size: 11px;
  line-height: 1.6;
  padding: 8px 10px !important;
  border-radius: 3px;
  margin-top: 2px;
}
.tts-stat-guidance-ok   { background: rgba(34,197,94,.07);  color: #86efac; }
.tts-stat-guidance-warn { background: rgba(251,191,36,.07); color: #fde68a; }
.tts-stat-guidance-bad  { background: rgba(239,68,68,.07);  color: #fca5a5; }
.tts-rtf-val { font-weight: 600; font-family: var(--mono); }
.tts-rtf-good { color: #4ade80; }
.tts-rtf-warn { color: var(--amber); }
.tts-rtf-bad  { color: #f87171; }

/* ── TTS mode segmented control ──────────────────────────────────────────── */
.tts-mode-seg {
  display: flex;
  gap: 2px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px;
  width: fit-content;
}
.tts-mode-btn {
  background: none;
  border: none;
  border-radius: 3px;
  color: var(--text-dim);
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.tts-mode-btn:hover  { color: var(--text); background: var(--bg2); }
.tts-mode-btn.active { background: var(--teal); color: var(--bg); font-weight: 600; }

/* ── Chatbot progress panel ──────────────────────────────────────────────── */
.chatbot-progress {
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 4px;
}
.chatbot-progress-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.chatbot-progress-status {
  flex: 1;
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--mono);
}
.chatbot-nlpst-warn {
  font-size: 10px;
  color: var(--amber);
  background: rgba(251,191,36,.07);
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

/* ── Chatbot sentence list ───────────────────────────────────────────────── */
.chatbot-sent-list {
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.chatbot-sent-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--mono);
  transition: background .2s;
}
.chatbot-sent-row:last-child { border-bottom: none; }
.chatbot-sent-num   { color: var(--text-mute); text-align: right; font-size: 10px; }
.chatbot-sent-text  { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chatbot-sent-state { color: var(--text-mute); font-size: 10px; white-space: nowrap; min-width: 80px; text-align: right; }

.chatbot-sent-pending    { }
.chatbot-sent-streaming  { background: rgba(99,102,241,.05); }
.chatbot-sent-streaming .chatbot-sent-state { color: var(--blue); }
.chatbot-sent-synth      { background: rgba(251,191,36,.05); }
.chatbot-sent-synth .chatbot-sent-state     { color: var(--amber); }
.chatbot-sent-queued     { background: rgba(59,130,246,.05); }
.chatbot-sent-queued .chatbot-sent-state    { color: var(--blue); }
.chatbot-sent-done       { background: rgba(34,197,94,.04); }
.chatbot-sent-done .chatbot-sent-state      { color: #4ade80; }
.chatbot-sent-error      { background: rgba(239,68,68,.05); }
.chatbot-sent-error .chatbot-sent-state     { color: #f87171; }

/* ── Chatbot message log divider ─────────────────────────────────────────── */
.test-msg-divider {
  font-size: 10px;
  color: var(--text-mute);
  text-align: center;
  padding: 4px 0;
  border-top: 1px solid var(--border);
  margin-top: 2px;
  font-family: var(--mono);
  letter-spacing: .05em;
}

/* ── Session ID display ──────────────────────────────────────────────────── */
.session-link {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
  padding: 4px 0 2px;
  letter-spacing: 0.06em;
}
.session-link-label { color: var(--text-mute); }
.session-link-id {
  color: var(--text-dim);
  font-weight: 600;
}

/* ── Session inspect button & panel ─────────────────────────────────────── */
.session-inspect-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 2px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 6px;
  margin-left: 6px;
  transition: all .15s;
}
.session-inspect-btn:hover { border-color: var(--teal); color: var(--teal); }

.session-details-panel {
  flex-basis: 100%;   /* force full-width line in .msg-row flex container */
  width: 100%;
  margin-top: 4px;
}
.session-inspect-loading,
.session-inspect-error  {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  padding: 6px 0;
}
.session-inspect-error { color: var(--red); }

.session-inspect-inner {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
}

/* Tabs */
.si-tabs {
  display: flex;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.si-tab-btn {
  background: none;
  border: none;
  border-right: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .08em;
  padding: 5px 12px;
  text-transform: uppercase;
  transition: all .15s;
}
.si-tab-btn:hover  { color: var(--text); background: var(--bg2); }
.si-tab-btn.active { color: var(--teal); background: var(--bg2); }

/* Panes */
.si-panes {
  background: var(--bg2);
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.si-tab-pane { padding: 8px 10px; }

/* Info table */
.si-table { width: 100%; border-collapse: collapse; }
.si-table tr:not(:last-child) td { border-bottom: 1px solid var(--border); }
.si-key {
  color: var(--text-mute);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .06em;
  padding: 3px 8px 3px 0;
  text-transform: uppercase;
  white-space: nowrap;
  width: 30%;
}
.si-val {
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  padding: 3px 0;
  word-break: break-all;
}
.si-json {
  color: var(--text-dim);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1.5;
  margin: 0;
  white-space: pre-wrap;
}
.si-empty { color: var(--text-mute); font-family: var(--mono); font-size: 9px; }
.si-error { color: var(--red); font-family: var(--mono); font-size: 9px; }

/* Segments */
.si-seg {
  display: grid;
  grid-template-columns: 20px 70px 1fr;
  gap: 6px;
  align-items: baseline;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 10px;
}
.si-seg:last-child { border-bottom: none; }
.si-seg-idx  { color: var(--text-mute); font-size: 9px; text-align: right; }
.si-seg-time { color: var(--text-mute); font-size: 9px; }
.si-seg-text { color: var(--text); }
.si-seg-final   .si-seg-text { color: var(--text); }
.si-seg-interim .si-seg-text { color: var(--text-dim); font-style: italic; }

/* Logs */
.si-log-list { display: flex; flex-direction: column; gap: 1px; }
.si-log-row {
  display: grid;
  grid-template-columns: 60px 44px 1fr;
  gap: 6px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 0;
}
.si-log-ts  { color: var(--text-mute); }
.si-log-lvl { font-weight: 600; }
.si-log-msg { color: var(--text-dim); word-break: break-all; }
.si-log-info  .si-log-lvl { color: var(--text-dim); }
.si-log-warn  .si-log-lvl { color: var(--amber); }
.si-log-error .si-log-lvl { color: var(--red); }

/* ── Custom tag select (cs-*) ────────────────────────────────────────────── */
.cs-wrap {
  position: relative;
  flex: 1;
  min-width: 0;
}

.cs-trigger {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text);
  user-select: none;
  min-width: 0;
  transition: border-color .15s;
  outline: none;
}
.cs-trigger:hover,
.cs-trigger:focus  { border-color: var(--border2); }
.cs-trigger.open   { border-color: var(--blue); box-shadow: 0 0 0 2px var(--blue-pale); }

.cs-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.cs-chevron {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform .2s;
}
.cs-trigger.open .cs-chevron { transform: rotate(180deg); }

/* Dropdown panel */
.cs-dropdown {
  position: absolute;
  top: calc(100% + 3px);
  left: 0;
  z-index: 9999;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  min-width: 100%;
  width: max-content;
  max-width: min(480px, 90vw);
  max-height: 280px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Search box */
.cs-search-wrap {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cs-search {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  color: var(--text);
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 8px;
  outline: none;
  transition: border-color .15s;
}
.cs-search:focus { border-color: var(--blue); }

/* Options list */
.cs-list {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.cs-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-dim);
  transition: background .1s;
  white-space: nowrap;
}
.cs-option:hover,
.cs-option.focused  { background: var(--bg3); color: var(--text); }
.cs-option.selected { color: var(--teal); }
.cs-option.selected::after {
  content: '✓';
  margin-left: auto;
  padding-left: 8px;
  color: var(--teal);
  font-size: 9px;
}
.cs-option.cs-hidden { display: none; }

.cs-opt-text {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

/* ── Parameter panel select (sampleRate etc.) ───────────────────────────── */
.param-select {
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 28px 4px 8px;
  width: 100%;
  cursor: pointer;
  color: var(--text);
}

/* ── Sample rate warning banner ─────────────────────────────────────────── */
.sr-warn-banner {
  background: rgba(239,68,68,.08);
  border: 1px solid var(--red-dim);
  border-radius: var(--r-sm);
  color: var(--red);
  font-size: 11px;
  line-height: 1.5;
  padding: 8px 12px;
  margin-bottom: 10px;
}
.sr-warn-banner strong { font-weight: 700; }

/* ── G2A pronunciation preview ───────────────────────────────────────────── */
#g2aPreviewPanel {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg2);
  overflow: hidden;
}

.g2a-preview-loading,
.g2a-preview-empty {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--text-mute);
  padding: 8px 12px;
}

.g2a-preview-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.g2a-preview-title {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.g2a-preview-count {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--teal);
  flex: 1;
}
.g2a-preview-close {
  background: none;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 10px;
  padding: 0 2px;
  line-height: 1;
}
.g2a-preview-close:hover { color: var(--text); }

.g2a-preview-text {
  padding: 10px 12px;
  font-family: var(--ui);
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.g2a-preview-word { /* plain token — no special styling */ }

.g2a-preview-match {
  color: var(--teal);
  border-bottom: 2px solid var(--teal);
  cursor: help;
  border-radius: 1px;
}

/* Legend row: word → acc /ipa/ ... */
.g2a-preview-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 6px 12px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
}
.g2a-legend-entry {
  display: flex;
  align-items: baseline;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
}
.g2a-legend-word  { color: var(--teal); font-weight: 600; }
.g2a-legend-arrow { color: var(--text-mute); }
.g2a-legend-acc   { color: var(--text); }
.g2a-legend-ipa   { color: var(--text-dim); }

/* ── G2A preview button bar ──────────────────────────────────────────────── */
.g2a-preview-bar {
  margin-top: 6px;
}
.g2a-preview-bar .btn {
  font-size: 10px;
  padding: 3px 10px;
  color: var(--teal);
  border-color: var(--teal);
  opacity: 0.8;
}
.g2a-preview-bar .btn:hover { opacity: 1; }

/* ── SSML support chips (pipeline stage card) ───────────────────────────── */
.ssml-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px 0 2px;
}
.ssml-chip {
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 5px;
  border: 1px solid;
  cursor: default;
}
.ssml-yes     { color: #4ade80; border-color: rgba(74,222,128,.35); background: rgba(74,222,128,.07); }
.ssml-partial { color: var(--amber); border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.07); }
.ssml-no      { color: var(--text-mute); border-color: var(--border); background: transparent; text-decoration: line-through; }

/* ── SSML tag annotations (text preview panel) ──────────────────────────── */
.ssml-tag-yes     { color: #4ade80;        background: rgba(74,222,128,.10);  border-radius: 2px; padding: 0 2px; cursor: help; font-family: var(--mono); font-size: 11px; }
.ssml-tag-partial { color: var(--amber);   background: rgba(245,158,11,.10);  border-radius: 2px; padding: 0 2px; cursor: help; font-family: var(--mono); font-size: 11px; }
.ssml-tag-no      { color: var(--red);     background: rgba(239,68,68,.10);   border-radius: 2px; padding: 0 2px; cursor: help; font-family: var(--mono); font-size: 11px; text-decoration: line-through; }
.ssml-tag-unknown { color: var(--text-mute); background: var(--bg3);          border-radius: 2px; padding: 0 2px; cursor: help; font-family: var(--mono); font-size: 11px; }
.ssml-tag-wrap    { color: var(--text-mute); font-family: var(--mono); font-size: 11px; }

/* Warning banners inside preview */
.g2a-preview-warning {
  background: rgba(245,158,11,.08);
  border-left: 3px solid var(--amber);
  color: var(--amber);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
  padding: 6px 12px;
}

/* SSML legend row in preview */
.ssml-preview-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 8px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
}
.ssml-legend-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
  margin-right: 4px;
}

/* ── [audio tags] chip on stage card ────────────────────────────────────────── */
.ssml-chip.ssml-audiotag {
  color: var(--teal);
  border-color: rgba(45,212,191,.4);
  background: rgba(45,212,191,.08);
  font-weight: 600;
  letter-spacing: .02em;
  cursor: help;
}

/* ── Audio tag picker panel ─────────────────────────────────────────────────── */
.audio-tags-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg2);
  overflow: hidden;
  margin-top: 6px;
}

.at-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.at-title {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.at-hint {
  flex: 1;
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
}
.at-close {
  background: none;
  border: none;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 10px;
  padding: 0 2px;
}
.at-close:hover { color: var(--text); }

.at-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  max-height: 220px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
  padding: 6px 10px 8px;
}

.at-category { margin-bottom: 6px; }
.at-cat-label {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.at-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.at-tag-btn {
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--teal);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  transition: all .12s;
}
.at-tag-btn:hover {
  background: rgba(45,212,191,.1);
  border-color: var(--teal);
  color: var(--teal);
}
.at-tag-btn:active { transform: scale(.95); }

/* ── TTS example picker ─────────────────────────────────────────────────────── */
.example-btn-wrap { position: relative; }

.example-btn {
  font-size: 10px;
  padding: 3px 10px;
  color: var(--text-dim);
  border-color: var(--border2);
}
.example-btn:hover { color: var(--text); border-color: var(--text-mute); }

.example-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9999;
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-sm);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  min-width: 200px;
  overflow: hidden;
}

.example-menu-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 10px;
  padding: 8px 12px;
  text-align: left;
  transition: background .1s, color .1s;
}
.example-menu-item:last-child { border-bottom: none; }
.example-menu-item:hover { background: var(--bg3); color: var(--text); }

/* ── AI context panel ───────────────────────────────────────────────────────── */
.ai-ctx-panel {
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  max-height: 70vh;
  overflow: hidden;
}

.ai-ctx-header {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
}
.ai-ctx-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
}
.ai-ctx-close { padding: 2px 6px; color: var(--text-mute); }
.ai-ctx-close:hover { color: var(--text); }

.ai-ctx-body {
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}

.ai-ctx-intro {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.6;
}
.ai-ctx-intro em { color: var(--text); font-style: normal; font-weight: 500; }

.ai-ctx-section { display: flex; flex-direction: column; gap: 6px; }

.ai-ctx-section-label {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-mute);
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-ctx-section-label.collapsible {
  cursor: pointer;
  user-select: none;
}
.ai-ctx-section-label.collapsible:hover { color: var(--text-dim); }
.ai-ctx-chevron { font-size: 10px; }

.ai-ctx-questions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-ctx-q {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.5;
  padding: 4px 8px;
  border-radius: var(--r-sm);
  background: var(--bg3);
  border-left: 2px solid var(--teal-dim);
}
.ai-ctx-q span { flex: 1; }

.ai-ctx-preview {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg);
  max-height: 160px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.ai-ctx-preview pre {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-dim);
  white-space: pre-wrap;
  padding: 8px 10px;
  margin: 0;
  line-height: 1.5;
}

.ai-ctx-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
}
.ai-ctx-hint {
  font-size: 10px;
  color: var(--text-mute);
  flex: 1;
  font-family: var(--mono);
}

/* ── Pipeline validation panel ──────────────────────────────────────────────── */
.validation-panel {
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.val-header {
  display: flex;
  align-items: center;
  padding: 8px 14px;
  background: var(--bg3);
  border-bottom: 1px solid var(--border);
}
.val-header-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.val-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 10px;
}
.val-badge-error   { background: rgba(239,68,68,.15); color: var(--red); }
.val-badge-warning { background: rgba(245,158,11,.15); color: var(--amber); }
.val-badge-info    { background: rgba(79,142,247,.12); color: var(--blue); }

.val-body {
  display: flex;
  flex-direction: column;
  max-height: 260px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.val-item {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.val-item:last-child { border-bottom: none; }
.val-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.val-icon { font-size: 12px; flex-shrink: 0; }
.val-title {
  font-size: 11px;
  font-weight: 600;
  flex: 1;
}
.val-msg {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.55;
  padding-left: 20px;
}
.val-error   .val-icon, .val-error   .val-title { color: var(--red); }
.val-warning .val-icon, .val-warning .val-title { color: var(--amber); }
.val-info    .val-icon, .val-info    .val-title { color: var(--blue); }

.val-fix-btn {
  background: none;
  border: 1px solid var(--border2);
  border-radius: 3px;
  color: var(--teal);
  cursor: pointer;
  font-family: var(--mono);
  font-size: 9px;
  padding: 1px 8px;
  transition: all .12s;
  flex-shrink: 0;
}
.val-fix-btn:hover { background: rgba(45,212,191,.1); border-color: var(--teal); }
.val-close { padding: 2px 6px; color: var(--text-mute); }
.val-close:hover { color: var(--text); }

/* ── Rules settings modal ───────────────────────────────────────────────────── */
.rules-settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.rules-settings-modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: var(--r-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,.5);
  display: flex;
  flex-direction: column;
  max-height: 80vh;
  width: min(780px, 95vw);
  overflow: hidden;
}
.rules-settings-header {
  display: flex;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
}
.rules-settings-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.rules-version {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
  font-weight: 400;
}
.rules-settings-body {
  overflow-y: auto;
  padding: 14px 18px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--border2) transparent;
}
.rules-settings-hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.6;
}
.rules-settings-hint code {
  font-family: var(--mono);
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 10px;
}
.rules-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.rules-table th {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-mute);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}
.rules-row td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.rules-row:last-child td { border-bottom: none; }
.rules-row-disabled { opacity: .45; }
.rules-td-id code {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--text-mute);
  background: var(--bg3);
  padding: 1px 5px;
  border-radius: 3px;
}
.rules-td-title { color: var(--text-dim); }
.rules-td-sev select { width: 90px; }
.rules-td-fix { color: var(--teal); text-align: center; font-size: 12px; }
.rules-settings-footer {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  background: var(--bg3);
  flex-shrink: 0;
}