/* ═══════════════════════════════════════════════════════════════
   Entitir Playground  ·  v2 — Schema / Graph / Play
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  --bg:       #0d1117;
  --bg-2:     #161b22;
  --bg-3:     #1c2230;
  --bg-4:     #232d42;
  --bg-5:     #2a3550;
  --border:   #30363d;
  --border-2: #3d4d63;
  --text:     #e6edf3;
  --muted:    #7d8590;
  --dim:      #4a5568;
  --accent:   #4facfe;
  --accent-d: #0073e6;
  --accent2:  #3fb950;
  --accent3:  #d29922;
  --green:    #3fb950;
  --error:    #f85149;
  --red:      #f85149;
  --entity-col: #58a6ff;
  --coll-col:   #3fb950;
  --r-sm:   4px;
  --radius: 6px;
  --r-lg:   10px;
  --shadow: 0 8px 32px rgba(0,0,0,.4);
  --header-h:  52px;
  --sidebar-w: 270px;
  --fn-ui:   'Inter', system-ui, sans-serif;
  --fn-mono: 'JetBrains Mono', 'Fira Code', monospace;
}
:root { --bg2: var(--bg-2); --bg3: var(--bg-3); --text-muted: var(--muted); }

[data-theme="light"] {
  --bg: #f5f7fb; --bg-2: #fff; --bg-3: #f0f4fa; --bg-4: #e5eaf4; --bg-5: #dde4f2;
  --border: #dde4f0; --border-2: #c5cfe0;
  --text: #1e293b; --muted: #566987; --dim: #8fa0b8;
  --accent: #0073e6; --accent-d: #0055b3; --accent2: #15803d;
  --accent3: #b45309; --error: #dc2626; --red: #dc2626;
}

html, body {
  height: 100%; overflow: hidden;
  background: var(--bg); color: var(--text);
  font-family: var(--fn-ui); font-size: 14px;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.header {
  height: var(--header-h);
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 14px; gap: 12px;
  flex-shrink: 0; z-index: 100;
  position: fixed; top: 0; left: 0; right: 0;
}
.header-left  { flex: 0 0 auto; }
.header-center { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; }
.header-right { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }

.logo { display: flex; align-items: center; gap: 10px; }
.logo-svg { color: var(--accent); }
.hex-stroke { stroke: var(--accent); }
.logo-text-group { display: flex; flex-direction: column; line-height: 1.2; }
.logo-text { font-size: 15px; font-weight: 700; letter-spacing: -.3px; }
.logo-accent { color: var(--accent); }
.logo-sub { font-size: 10px; color: var(--muted); letter-spacing: .1px; }

.header-tabs { display: flex; gap: 4px; }
.header-link { color: var(--muted); display: flex; align-items: center; text-decoration: none; transition: color .12s; font-size: 13px; }
.header-link:hover { color: var(--accent); }
.header-brand {
  font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 3px 8px; border-radius: var(--r-sm); border: 1px solid var(--border);
  transition: background .14s, border-color .14s;
}
.header-brand:hover { background: rgba(79,172,254,.08); border-color: var(--accent); }

.btn-theme { background: none; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 5px 9px; cursor: pointer; color: var(--muted); font-size: 13px; }
.btn-theme:hover { border-color: var(--accent); color: var(--accent); }
.btn-login { background: var(--bg-4); color: var(--text); border: 1px solid var(--border-2); padding: 5px 12px; border-radius: var(--r-sm); cursor: pointer; font-size: 12px; }
.btn-login:hover { background: var(--accent); color: #fff; }
.user-chip { display: flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer; font-size: 12px; color: var(--text); }
.user-chip:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); }

/* Tab buttons */
.tab {
  padding: 6px 14px; border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--muted); cursor: pointer;
  font-size: 13px; font-family: var(--fn-ui); transition: all .15s;
  display: inline-flex; align-items: center;
}
.tab:hover { background: var(--bg-3); color: var(--text); }
.tab.active { background: var(--accent); color: #031a30; font-weight: 600; }
.tab-play.active { background: linear-gradient(135deg, #4facfe, #00e5ff); color: #031a30; }

/* ── Layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: flex;
  margin-top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow: hidden;
}

/* No-sidebar mode (Schema / Graph tabs) */
.layout.no-sidebar .sidebar { display: none; }

/* ── Sidebar ────────────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width .2s, min-width .2s;
}
.sidebar.collapsed { width: 36px; min-width: 36px; }
.sidebar.collapsed .example-list,
.sidebar.collapsed .sidebar-header span { display: none; }
.sidebar.hidden-sidebar { display: none; }

.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .07em; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-toggle {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  font-size: 16px; padding: 2px 4px; border-radius: 4px; transition: color .15s;
}
.sidebar-toggle:hover { color: var(--text); }

.example-list { overflow-y: auto; flex: 1; padding: 4px 6px 8px; }
.example-item {
  padding: 9px 10px; border-radius: var(--r-sm);
  cursor: pointer; border: 1px solid transparent;
  transition: all .12s; margin-bottom: 3px;
}
.example-item:hover { background: var(--bg3); border-color: var(--border); }
.example-item.active { background: rgba(79,172,254,.08); border-color: rgba(79,172,254,.4); }
.example-item .ex-title { font-weight: 600; font-size: 12px; color: var(--text); margin-bottom: 3px; }
.example-item .ex-desc  { font-size: 10px; color: var(--text-muted); line-height: 1.45; overflow-wrap: break-word; word-break: break-word; }

/* ── Content area ───────────────────────────────────────────────────────── */
.content-area { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }

.panel { display: flex; flex-direction: column; flex: 1; min-height: 0; overflow: hidden; }
.panel.hidden { display: none !important; }

/* ── Shared toolbar ─────────────────────────────────────────────────────── */
.editor-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--bg3); border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.toolbar-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; display: flex; align-items: center; }
.toolbar-actions { display: flex; gap: 8px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  padding: 6px 14px; border: none; border-radius: var(--radius);
  cursor: pointer; font-size: 13px; font-weight: 600; transition: all .15s;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn-run { background: var(--accent2); color: #031a30; }
.btn-run:hover { filter: brightness(1.1); }
.btn-run:disabled { opacity: .5; cursor: not-allowed; }

.btn-reset-world {
  font-size: 11px; padding: 3px 10px;
  background: transparent; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text-muted); cursor: pointer;
  transition: all .15s;
}
.btn-reset-world:hover { background: var(--bg3); color: var(--text); border-color: var(--text-muted); }

/* Generate button */
.btn-generate {
  background: linear-gradient(135deg, #4facfe 0%, #00c8ff 100%);
  color: #031a30; border: none; border-radius: var(--radius);
  padding: 7px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: opacity .15s, box-shadow .15s; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(79,172,254,.3);
  white-space: nowrap;
}
.btn-generate:hover { opacity: .9; box-shadow: 0 4px 16px rgba(79,172,254,.45); }
.btn-generate:disabled { opacity: .55; cursor: not-allowed; box-shadow: none; }

/* ══════════════════════════════════ PLAY PANEL */
#panel-play { flex-direction: column; }

/* Prompt bar */
/* ── VirtualSet gen bar (inline, compact, hidden by default) ───────── */
.vs-gen-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; background: var(--bg-3);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.vs-gen-bar.hidden { display: none; }
.vs-gen-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 12px; font-family: var(--fn-ui); padding: 4px 0; min-width: 0;
}
.vs-gen-input::placeholder { color: var(--dim); }
.btn-xs { padding: 2px 7px; font-size: 11px; }
.btn-sm-gen { padding: 4px 10px; font-size: 11px; }

/* Thinking panel — for VirtualSet generate */
.thinking-panel {
  padding: 8px 12px 4px;
  background: linear-gradient(180deg, rgba(13,17,23,.98) 0%, var(--bg) 100%);
  border-bottom: 1px solid rgba(79,172,254,.15);
  flex-shrink: 0; overflow-y: auto; max-height: 120px;
}
.thinking-panel.hidden { display: none; }
.thinking-steps { display: flex; flex-direction: column; gap: 4px; scroll-behavior: smooth; }
.thinking-step {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 11.5px; color: var(--muted); line-height: 1.5;
  opacity: 0; transform: translateY(4px);
  transition: opacity .3s ease, transform .3s ease;
}
.thinking-step.step-visible { opacity: 1; transform: translateY(0); }
.step-icon { flex-shrink: 0; font-size: 12px; }
.step-msg  { color: var(--text); }
.step-discover .step-msg { color: #79b8ff; }
.step-traverse .step-msg { color: #a3e635; }
.step-generate .step-msg { color: #4facfe; font-weight: 600; }
.step-explain  .step-msg { color: var(--accent3); }
.step-warn     .step-msg { color: var(--accent3); }
.step-error    .step-msg { color: var(--error); }

/* Spin animation */
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ── Play main area: left column (split) + right result ──────────── */
.play-main-area { flex: 1; min-height: 0; display: flex; overflow: hidden; }

/* Left column: split vertically into VirtualSet (top) + AI Decision (bottom) */
.editor-pane {
  flex: 1; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); min-width: 0;
}

/* VirtualSet panel: editor fills all available height */
#editor-wrapper { flex: 1; overflow: hidden; min-height: 80px; }
#editor-container { width: 100%; height: 100%; }

/* ── Decision Panel Layout ────────────────────────────────────────── */
#panel-decision { overflow: hidden; }
.decision-panel-layout {
  display: flex; width: 100%; height: 100%; overflow: hidden;
}

/* Left sidebar: decision templates */
.decision-sidebar {
  width: 260px; min-width: 220px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg-2); overflow: hidden;
}
.decision-tmpl-count {
  font-size: 10.5px; font-weight: 600;
  background: var(--bg-4); color: var(--muted);
  padding: 1px 7px; border-radius: 20px;
}
.decision-tmpl-list {
  flex: 1; overflow-y: auto; padding: 8px 0;
}
.dt-card {
  padding: 8px 14px; cursor: default;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.dt-card:hover { background: var(--bg-3); }
.dt-header {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-bottom: 3px;
}
.dt-id { font-size: 11.5px; font-weight: 600; font-family: var(--fn-mono); color: var(--accent); }
.dt-badge {
  font-size: 9.5px; font-weight: 700; padding: 1px 6px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: .04em; flex-shrink: 0;
}
.dt-badge-outline { background: rgba(79,172,254,.12); color: var(--accent); border: 1px solid rgba(79,172,254,.3); }
.dt-badge-and     { background: rgba(40,200,80,.12);  color: #40d070; border: 1px solid rgba(40,200,80,.3); }
.dt-badge-or      { background: rgba(210,153,34,.12); color: var(--accent3); border: 1px solid rgba(210,153,34,.3); }
.dt-intent { font-size: 11.5px; color: var(--text); line-height: 1.5; }
.dt-meta   { font-size: 10.5px; color: var(--dim); margin-top: 2px; }
.sidebar-loading { padding: 16px 14px; font-size: 12px; color: var(--dim); }

/* Right column: prompt (top) + output (bottom) */
.decision-right {
  flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
}

/* Prompt section */
.decision-prompt-section {
  flex-shrink: 0;
  border-bottom: 2px solid var(--border);
}
.dp-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px; background: var(--bg-3);
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.dp-prompt-row {
  padding: 10px 16px 8px; display: flex; flex-direction: column; gap: 8px;
}
.dp-prompt-textarea {
  width: 100%; background: var(--bg-3); border: 1px solid var(--border-2);
  border-radius: var(--r-sm); color: var(--text); font-size: 13px;
  font-family: var(--fn-ui); padding: 8px 12px; resize: none;
  outline: none; line-height: 1.6; box-sizing: border-box;
  transition: border-color .15s;
}
.dp-prompt-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79,172,254,.1); }
.dp-prompt-textarea::placeholder { color: var(--dim); font-size: 12px; }
.dp-prompt-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}

/* Example chips */
.ai-examples {
  display: flex; align-items: center; flex-wrap: nowrap;
  overflow-x: auto; gap: 4px 5px; flex: 1; min-width: 0;
  /* hide scrollbar but keep functionality */
  scrollbar-width: none;
}
.ai-examples::-webkit-scrollbar { display: none; }
.ai-scenario-group { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; }
.ai-scenario-label {
  font-size: 9.5px; color: var(--dim); white-space: nowrap;
  padding: 1px 4px; border-radius: 3px;
  background: rgba(255,255,255,.05); border: 1px solid var(--border);
  font-family: var(--fn-ui);
}
.ai-scenario-sep { color: var(--border); font-size: 10px; padding: 0 1px; flex-shrink: 0; }
.ai-examples-label { font-size: 10.5px; color: var(--dim); white-space: nowrap; }
.ai-example-chip {
  display: inline-flex; align-items: center; flex-shrink: 0;
  padding: 2px 7px; border-radius: 20px; cursor: pointer;
  font-size: 10.5px; font-family: var(--fn-ui);
  background: var(--bg-4); color: var(--muted);
  border: 1px solid var(--border); transition: all .12s; white-space: nowrap;
}
.ai-example-chip:hover {
  background: rgba(79,172,254,.12); color: var(--accent);
  border-color: rgba(79,172,254,.35);
}

/* Ask AI button */
.btn-ask {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 11px; font-size: 12px; font-weight: 600;
  background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  color: #0d1117; border: none; border-radius: var(--r-sm); cursor: pointer;
  white-space: nowrap; transition: opacity .15s, transform .1s; flex-shrink: 0;
}
.btn-ask:hover { opacity: .88; }
.btn-ask:active { transform: scale(.97); }
.btn-ask:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* Output section (thinking + final result in one scrollable area) */
.decision-output-section {
  flex: 1; display: flex; flex-direction: column; min-height: 0;
}
.decision-output {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
  scroll-behavior: smooth; font-family: var(--fn-ui);
}
.decision-output-placeholder {
  color: var(--dim); font-size: 12px; font-style: italic; padding: 4px 0;
}

/* AI reasoning steps */
.ai-step {
  font-size: 12px; color: var(--muted); line-height: 1.6; padding: 1px 0;
  opacity: 0; transform: translateY(3px);
  transition: opacity .22s ease, transform .22s ease;
}
.ai-step.ai-step-visible { opacity: 1; transform: translateY(0); }
.ai-step-think .ai-step-msg { color: var(--accent); font-weight: 500; }
.ai-step-trace .ai-step-msg { color: var(--text); }
.ai-step-error .ai-step-msg { color: var(--error); }
.ai-step-msg { display: inline; }

/* ── Type-chain strip (GCP inline type annotation) ───────────────────── */
.tc-strip {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 2px; margin: 5px 0 3px 18px;
  font-family: var(--fn-mono); font-size: 10.5px;
  opacity: 0.92;
}
.tc-arrow {
  color: var(--muted); font-size: 11px; margin: 0 1px; line-height: 1;
  flex-shrink: 0;
}
.tc-pill {
  display: inline-flex; flex-direction: column; align-items: flex-start;
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 5px; padding: 2px 6px;
  min-width: 40px; max-width: 180px;
  overflow: hidden;
  transition: border-color .15s;
}
.tc-pill:hover { border-color: var(--accent); }
.tc-step {
  color: var(--text); font-size: 10px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px;
}
.tc-type {
  color: var(--accent); font-size: 9.5px; font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 160px; opacity: 0.85;
}
.tc-terminal .tc-step { color: var(--accent2); }
.tc-terminal .tc-type  { color: var(--accent2); opacity: 0.8; }
.tc-terminal { border-color: var(--accent2); }

/* Divider between reasoning and final result */
.ai-result-divider {
  margin: 10px 0; border: none;
  border-top: 1px dashed var(--border);
}

/* Confidence badge */
.confidence-badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; flex-shrink: 0;
}
.confidence-badge.hidden { display: none; }
.conf-high { background: rgba(40,200,80,.15);  color: #40d070;          border: 1px solid rgba(40,200,80,.3); }
.conf-mid  { background: rgba(210,153,34,.12); color: var(--accent3);   border: 1px solid rgba(210,153,34,.3); }
.conf-low  { background: rgba(248,81,73,.12);  color: var(--error);     border: 1px solid rgba(248,81,73,.3); }

/* ── Decision result formatting ─────────────────────────────────── */
.decision-result { display: flex; flex-direction: column; gap: 14px; }
.dr-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.dr-query { font-size: 13px; color: var(--muted); font-style: italic; flex: 1; line-height: 1.5; }
.dr-section { display: flex; flex-direction: column; gap: 5px; }
.dr-label {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.dr-label.dr-muted { font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 12px; color: var(--dim); }

/* Answer — markdown-rendered, no raw pre-wrap */
.dr-answer {
  font-size: 13px; color: var(--text); line-height: 1.7;
  background: var(--bg-3); border-radius: var(--r-sm); padding: 10px 14px;
  word-break: break-word;
}
.dr-answer.dr-not-found { color: var(--accent3); border-left: 3px solid var(--accent3); }

/* Chart section */
.dr-chart-section { gap: 8px; }
.dr-chart-wrapper {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 14px 16px; position: relative; overflow: hidden;
  transition: border-color .15s;
}
.dr-chart-wrapper:hover { border-color: var(--accent); }
.dr-chart-canvas { display: block; max-width: 100%; }
.dr-chart-raw-btn {
  align-self: flex-start;
  background: none; border: 1px solid var(--border-2); border-radius: 4px;
  color: var(--muted); font-size: 11px; cursor: pointer; padding: 3px 10px;
  transition: color .15s, border-color .15s;
}
.dr-chart-raw-btn:hover { color: var(--accent); border-color: var(--accent); }
.dr-chart-raw-data {
  font-family: var(--fn-mono); font-size: 11.5px; color: var(--muted);
  background: var(--bg-4); border-radius: 4px; padding: 8px 12px;
  overflow-x: auto; margin: 0;
}

/* Chart expand modal */
.chart-modal-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.72); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
}
.chart-modal {
  background: var(--bg-2); border: 1px solid var(--border-2);
  border-radius: var(--r-lg); padding: 28px 32px; position: relative;
  box-shadow: 0 24px 64px rgba(0,0,0,.5);
  animation: chart-modal-in .18s ease;
}
@keyframes chart-modal-in {
  from { opacity: 0; transform: scale(.94); }
  to   { opacity: 1; transform: scale(1); }
}
.chart-modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 4px 8px;
  border-radius: 4px; line-height: 1;
  transition: color .15s, background .15s;
}
.chart-modal-close:hover { color: var(--text); background: var(--bg-4); }
.chart-modal-canvas { display: block; }

/* Markdown elements inside .dr-answer */
.dr-answer .dr-p   { margin: 0 0 8px; }
.dr-answer .dr-p:last-child { margin-bottom: 0; }
.dr-answer .dr-h   { font-weight: 700; color: var(--accent2); margin: 10px 0 4px; font-size: 12.5px; }
.dr-answer .dr-hr  { border: none; border-top: 1px solid var(--border); margin: 8px 0; }
.dr-answer .dr-li  {
  display: flex; gap: 8px; align-items: baseline;
  padding: 2px 0; font-size: 13px;
}
.dr-answer .dr-li::before { content: '•'; color: var(--accent); flex-shrink: 0; }
.dr-answer .dr-oli .dr-li-num { color: var(--accent); font-weight: 600; flex-shrink: 0; min-width: 18px; }
.dr-answer .dr-oli::before { display: none; }
.dr-answer .dr-ic  { font-family: var(--fn-mono); font-size: 11.5px; background: var(--bg2); padding: 1px 5px; border-radius: 3px; color: var(--accent2); }

/* Decision chips */
.dr-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dr-chip {
  display: inline-flex; align-items: center;
  padding: 3px 10px; border-radius: 20px;
  font-size: 11.5px; font-weight: 500; font-family: var(--fn-mono);
}
.dr-chip-template { background: rgba(79,172,254,.12); color: var(--accent); border: 1px solid rgba(79,172,254,.25); }

/* ── Two-column: Event Bus | Ontology Changes ─────────────────────── */
/* Three-row layout: Event Bus / Ontology Changes / Actions Called */
.dr-three-rows {
  display: flex; flex-direction: column; gap: 0;
  border-top: 1px solid var(--border); margin-top: 4px;
}
.dr-row-block {
  display: flex; flex-direction: column; gap: 4px;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.dr-row-block:last-child { border-bottom: none; }
.dr-row-header {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em; margin-bottom: 2px;
}
.dr-row-body  { display: flex; flex-direction: column; gap: 4px; }
.dr-row-empty { font-size: 11.5px; color: var(--dim); font-style: italic; padding: 2px 0; }

/* Actions row */
.dr-action-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; padding: 2px 0;
}
.act-id   { font-weight: 600; color: var(--accent); font-family: monospace; }
.act-sep  { color: var(--muted); font-size: 11px; }
.act-tmpl { color: var(--text-muted); font-size: 11px; }
.act-eid  { font-size: 11px; color: var(--dim); }

/* Legacy col aliases (keep for backward compat) */
.dr-col { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dr-col-header {
  font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
  padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.dr-col-body  { display: flex; flex-direction: column; gap: 4px; }
.dr-col-empty { font-size: 11.5px; color: var(--dim); font-style: italic; padding: 4px 0; }

/* Event row (Event Bus column) */
.dr-event {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; padding: 4px 8px;
  background: var(--bg-3); border-radius: var(--r-sm);
  border-left: 3px solid var(--border);
  font-family: var(--fn-mono);
}
.ev-create { border-left-color: #40d070; }
.ev-update { border-left-color: var(--accent); }
.ev-delete { border-left-color: var(--error); }
.ev-op   { font-weight: 700; font-size: 9.5px; text-transform: uppercase; min-width: 46px; color: var(--muted); }
.ev-type { color: var(--accent2); font-weight: 600; flex: 1; }
.ev-id   { color: var(--muted); font-size: 10.5px; }
.ev-ts   { color: var(--dim); font-size: 10px; margin-left: auto; }

/* ── JSON highlight block ─────────────────────────────────────────── */
.dr-json-block {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; margin: 0;
  font-family: var(--fn-mono); font-size: 11.5px; line-height: 1.65;
  overflow-x: auto; white-space: pre; word-break: normal;
  max-height: 320px; overflow-y: auto;
}
.jh-key  { color: var(--accent);  font-weight: 600; }
.jh-str  { color: var(--accent2); }
.jh-num  { color: #f8a65a; }
.jh-bool { color: #c792ea; }
.jh-null { color: var(--muted); }

/* ── Collapsible reasoning ────────────────────────────────────────── */
.dr-collapsible-toggle {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
}
.dr-collapsible-toggle:hover { color: var(--accent); }
.dr-collapse-icon { font-size: 10px; opacity: .7; }
.dr-collapsible-body { display: flex; flex-direction: column; gap: 3px; padding-top: 4px; }
.dr-reason-row {
  font-size: 11px; color: var(--muted); padding: 3px 8px;
  background: var(--bg-3); border-radius: var(--r-sm);
  border-left: 2px solid var(--border);
  white-space: normal; line-height: 1.5;
}

/* Ontology Changes column */
.oc-group  { display: flex; flex-direction: column; gap: 3px; margin-bottom: 6px; }
.oc-type   { font-size: 11px; font-weight: 700; color: var(--accent2); padding: 2px 0; }
.oc-count  { background: rgba(79,172,254,.18); color: var(--accent); font-size: 10px;
             font-weight: 600; padding: 1px 5px; border-radius: 10px; margin-left: 4px; }
.dr-change-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px;
  font-size: 11px; padding: 4px 8px;
  background: var(--bg-3); border-radius: var(--r-sm);
  border-left: 3px solid var(--border);
  font-family: var(--fn-mono);
}
.oc-payload { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.oc-field   { color: var(--muted); font-size: 10px; }
.oc-val     { color: var(--accent2); font-size: 10px; margin-right: 4px; }

/* Shared result pane — persistent right column for VS + Decision tabs */
.shared-result-pane {
  width: 400px; min-width: 300px; flex-shrink: 0;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--bg2); overflow: hidden;
}
.shared-result-pane.hidden { display: none !important; }

.result-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 14px; background: var(--bg3); border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.result-header-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.result-title { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; }
.exec-time { font-size: 11px; color: var(--text-muted); }

.result-body {
  flex: 1; min-height: 0; overflow: auto; padding: 16px;
  font-family: var(--fn-mono);
  font-size: 13px; line-height: 1.7; white-space: pre-wrap; word-break: break-word;
}
.result-body.hidden { display: none !important; }
.result-placeholder { color: var(--text-muted); font-style: italic; font-family: inherit; font-size: 12px; }
.result-ok    { color: var(--accent2); }
.result-error { color: var(--error); }
.result-lazy  { color: var(--accent3); }
.result-lazy-tag  { color: var(--accent3); font-style: italic; }
.result-entity    { color: var(--accent2); }
.result-empty     { color: var(--text-muted); font-style: italic; }

/* ── Inline comments ────────────────────────────────────────────────────── */
.inline-comments-section {
  flex: 1; min-height: 0; display: flex; flex-direction: column;
  border-top: 1px solid var(--border); background: var(--bg2); overflow: hidden;
}
.inline-comments-header {
  flex-shrink: 0; display: flex; align-items: center; gap: 6px;
  padding: 6px 12px 4px;
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .06em;
}
.inline-comments-ctx {
  font-weight: 400; text-transform: none; letter-spacing: 0; font-size: 10px;
  color: var(--text-muted); opacity: .7;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px;
}
#inline-comments-login-prompt { flex-shrink: 0; padding: 4px 12px 8px; }
#inline-comments-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#inline-comment-list {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 0 12px 4px; display: flex; flex-direction: column; gap: 4px;
}
.comment-compose { flex-shrink: 0; padding: 6px 12px 8px; box-sizing: border-box; }
.comment-input {
  display: block; width: 100%; box-sizing: border-box;
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-size: 12px;
  padding: 5px 10px; height: 30px; font-family: inherit;
}
.comment-input:focus { outline: none; border-color: var(--accent); }
.comment-item { font-size: 12px; color: var(--muted); padding: 3px 0; }
.comment-item strong { color: var(--text); }
.comment-empty { font-size: 12px; color: var(--muted); padding: 8px 0; }

/* Code-generated flash animation */
@keyframes code-flash {
  0%   { box-shadow: inset 0 0 0 1px rgba(79,172,254,.6); }
  50%  { box-shadow: inset 0 0 0 2px rgba(79,172,254,.4); }
  100% { box-shadow: none; }
}
.code-generated { animation: code-flash .8s ease-out; }

/* ══════════════════════════════════ SCHEMA PANEL */
#panel-schema { overflow: hidden; }

.world-layout {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}

.world-editor-pane {
  flex: 1; overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}
#world-editor-wrapper {
  flex: 1; height: 100%; border-right: 1px solid var(--border);
}
#world-editor-container { width: 100%; height: 100%; }

/* Schema right panel (symbols / actions / decisions) */
.world-types-pane {
  width: 340px; min-width: 240px;
  background: var(--bg2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; overflow: hidden; flex-shrink: 0;
}

/* Sub-tabs inside Schema right pane */
.schema-pane-tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.schema-tab {
  flex: 1; padding: 8px 4px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; font-size: 11px; font-weight: 600;
  font-family: var(--fn-ui); text-transform: uppercase; letter-spacing: .05em;
  transition: all .12s; border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.schema-tab:hover { color: var(--text); background: var(--bg-3); }
.schema-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.schema-sub-panel { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.schema-sub-panel.hidden { display: none; }

/* Symbol table */
.world-types-list { overflow-y: auto; flex: 1; padding: 8px 0; }
.sym-item {
  padding: 7px 14px; border-bottom: 1px solid rgba(48,54,61,.5);
  cursor: default; transition: background .1s;
}
.sym-item:hover { background: var(--bg3); }
.sym-item:last-child { border-bottom: none; }
.sym-name { font-size: 12px; font-weight: 600; color: var(--text); font-family: monospace; }
.sym-kind {
  font-size: 10px; color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .05em; display: inline-block; margin-left: 6px;
  background: var(--bg3); border-radius: 3px; padding: 1px 5px;
}
.sym-kind.outline { color: var(--accent); }
.sym-kind.let     { color: var(--accent2); }
.sym-type { font-size: 11px; color: var(--accent3); margin-top: 2px; font-family: monospace; word-break: break-all; }

/* Actions panel */
.actions-list { padding: 6px 0; }
.action-entity-group { border-bottom: 1px solid var(--border); padding: 8px 0 10px; }
.action-entity-group:last-child { border-bottom: none; }
.action-entity-name {
  font-size: 12px; font-weight: 700; color: var(--entity-col); font-family: monospace;
  padding: 4px 14px 6px; display: flex; align-items: center; gap: 8px;
}
.action-module { font-size: 10px; color: var(--muted); font-weight: 400; font-family: var(--fn-ui); }
.action-item { padding: 5px 14px 3px; }
.action-name { font-size: 12px; font-weight: 600; color: var(--text); font-family: monospace; }
.action-sig  {
  font-size: 11px; color: var(--accent3); font-family: monospace;
  background: var(--bg-3); border-radius: 3px; padding: 1px 6px; margin-left: 6px;
}
.action-desc { font-size: 11px; color: var(--muted); margin-top: 2px; padding-left: 2px; }

/* Decisions panel */
.decisions-list { padding: 6px 0; }
.decision-item {
  padding: 10px 14px; border-bottom: 1px solid rgba(48,54,61,.5);
  transition: background .1s;
}
.decision-item:hover { background: var(--bg3); }
.decision-item:last-child { border-bottom: none; }
.decision-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px;
}
.decision-ontology { font-size: 12px; font-weight: 700; color: var(--entity-col); font-family: monospace; }
.decision-status {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em;
  padding: 1px 7px; border-radius: 3px; background: rgba(63,185,80,.15); color: var(--accent2);
}
.decision-status.intention { background: rgba(79,172,254,.15); color: var(--accent); }
.decision-desc { font-size: 12px; color: var(--text); margin-bottom: 6px; line-height: 1.5; }
.decision-triggers { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 4px; }
.decision-triggers code {
  font-size: 10px; font-family: monospace; color: var(--accent3);
  background: var(--bg-4); border-radius: 3px; padding: 2px 7px;
  border: 1px solid var(--border);
}
.decision-meta { font-size: 10px; color: var(--dim); }

/* ══════════════════════════════════ GRAPH PANEL */
#panel-graph { position: relative; flex-direction: column; }

.graph-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 16px; background: var(--bg3); border-bottom: 1px solid var(--border);
  flex-shrink: 0; height: 40px;
}
.graph-source-badge {
  font-size: 10px; color: var(--text-muted);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 4px; padding: 2px 8px; letter-spacing: .03em;
}
.legend { display: flex; gap: 14px; align-items: center; }
.legend-item { font-size: 11px; color: var(--text-muted); }
.legend-item.entity     { color: var(--entity-col); }
.legend-item.collection { color: var(--coll-col); }
.legend-item.single     { color: var(--text-muted); }
.legend-item.reverse    { color: var(--accent3); }

#graphContainer {
  position: relative; flex: 1; width: 100%; min-height: 0; background: var(--bg);
}
#graphContainer canvas { display: block; cursor: pointer; }
.graph-hint {
  position: absolute; bottom: 12px; right: 16px;
  font-size: 11px; color: var(--text-muted); pointer-events: none;
}

/* ── Lint status ────────────────────────────────────────────────────────── */
.lint-status { font-size: 12px; padding: 2px 10px; border-radius: 4px; flex-shrink: 0; display: none; }
.lint-status.running { display: inline-block; color: var(--accent3); background: rgba(210,153,34,.13); animation: lint-pulse 1.2s ease-in-out infinite; }
.lint-status.ok      { display: inline-block; color: var(--accent2); background: rgba(63,185,80,.13); }
.lint-status.warn    { display: inline-block; color: var(--accent3); background: rgba(210,153,34,.13); }
.lint-status.error   { display: inline-block; color: var(--error);   background: rgba(248,81,73,.13); }
@keyframes lint-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Modal / Auth / Profile / Toast ────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 0; min-width: 320px; max-width: 90vw; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--muted); font-size: 18px; padding: 0 4px; }
.modal-close:hover { color: var(--text); }
.modal-input { width: 100%; padding: 10px 12px; margin: 8px 0; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg); color: var(--text); font-size: 14px; }
.modal-footer { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--border); }
.auth-tabs { display: flex; gap: 8px; padding: 14px 18px 6px; }
.auth-tab {
  flex: 1;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.auth-tab.active { background: rgba(167,139,250,.14); color: var(--accent); border-color: var(--accent); }
.auth-panel { padding: 0 18px 14px; }
.auth-error { min-height: 18px; margin-top: 4px; color: var(--error); font-size: 12px; }
.auth-switch-row { color: var(--muted); font-size: 12px; }
.auth-switch-link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font-size: 12px;
  font-weight: 600;
}
.auth-switch-link:hover { text-decoration: underline; }
.auth-hint { font-size: 13px; color: var(--muted); padding: 12px 18px 0; }
.profile-field { padding: 10px 18px; }
.profile-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.profile-value { font-size: 14px; color: var(--text); }
.btn-danger  { background: var(--error); color: #fff; border: none; padding: 6px 14px; border-radius: var(--r-sm); cursor: pointer; font-size: 12px; font-weight: 600; }
.btn-danger:hover { filter: brightness(1.1); }
.btn-primary { background: linear-gradient(135deg, #4facfe, #00c8ff); color: #031a30; border: none; padding: 6px 14px; border-radius: var(--r-sm); cursor: pointer; font-size: 12px; font-weight: 600; }
.btn-primary:hover { filter: brightness(1.1); }
.btn-ghost   { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 6px 14px; border-radius: var(--r-sm); cursor: pointer; font-size: 12px; }
.btn-ghost:hover { background: var(--bg-3); color: var(--text); }
.btn-sm      { padding: 4px 10px; font-size: 11px; }

.comments-login-prompt { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; gap: 12px; }
.comments-login-text   { font-size: 13px; color: var(--muted); }
.comment-reactions     { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.reaction-btn  { display: flex; align-items: center; gap: 6px; background: var(--bg-3); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 12px; cursor: pointer; font-size: 12px; color: var(--text); }
.reaction-btn:hover { border-color: var(--accent); }
.reaction-count { color: var(--muted); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  padding: 10px 20px; border-radius: var(--radius);
  background: var(--bg-4); border: 1px solid var(--border);
  color: var(--text); font-size: 13px; z-index: 2000;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; animation: toast-in .2s ease; }
.toast-error { background: rgba(248,81,73,.15); border-color: var(--error); color: var(--error); }
.toast-warn  { background: rgba(210,153,34,.12); border-color: var(--accent3); color: var(--accent3); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

.btn-lang-toggle {
  padding: 4px 10px; font-size: 11px; font-weight: 600; border-radius: var(--r-sm);
  background: var(--bg-4); color: var(--muted); border: 1px solid var(--border-2);
  cursor: pointer; transition: color .15s, border-color .15s; letter-spacing: .04em;
}
.btn-lang-toggle:hover { color: var(--text); border-color: var(--accent); }

/* ═══════════════════════════════════════════════════ Decision Center */
.dc-layout {
  display: grid;
  grid-template-columns: 220px 1fr 340px;
  height: 100%;
  overflow: hidden;
}
.dc-templates { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.dc-graph-pane { border-right: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.dc-feed-pane { display: flex; flex-direction: column; overflow: hidden; }

.dc-section-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; font-size: 12px; font-weight: 600;
  border-bottom: 1px solid var(--border);
  background: var(--bg-3); color: var(--text); flex-shrink: 0;
}
.dc-tmpl-count {
  margin-left: auto; font-size: 11px; color: var(--muted); font-weight: 400;
}

.dc-tmpl-list { overflow-y: auto; flex: 1; }
.dc-tmpl-item {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  cursor: default; transition: background .12s;
}
.dc-tmpl-item:hover { background: var(--bg-3); }
.dc-tmpl-item-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.dc-tmpl-id { font-size: 12px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-activator-badge {
  font-size: 10px; font-weight: 700; padding: 1px 5px;
  border-radius: 3px; text-transform: uppercase; flex-shrink: 0;
}
.dc-activator-badge.manual   { background: rgba(100,120,150,.2); color: var(--muted); }
.dc-activator-badge.schedule { background: rgba(210,153,34,.2); color: var(--accent3); }
.dc-activator-badge.decision { background: rgba(79,172,254,.2); color: var(--accent); }
.dc-tmpl-goal { font-size: 11px; color: var(--muted); line-height: 1.4; margin-bottom: 6px;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dc-tmpl-activate {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500; padding: 3px 8px;
  background: var(--bg-4); color: var(--accent); border: 1px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; transition: all .12s;
}
.dc-tmpl-activate:hover { background: rgba(79,172,254,.1); border-color: var(--accent); }
.dc-tmpl-activate:disabled { opacity: .5; cursor: not-allowed; }

.dc-graph-container { flex: 1; overflow: hidden; background: var(--bg); }

.dc-feed { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 3px; }
.dc-feed-placeholder { padding: 20px 12px; color: var(--muted); font-size: 12px; text-align: center; }
.dc-feed-entry {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 6px 8px; border-radius: var(--r-sm);
  background: var(--bg-3); border: 1px solid var(--border);
  font-size: 11.5px; animation: dc-slide-in .15s ease;
}
@keyframes dc-slide-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: translateY(0); } }
.dc-feed-type {
  font-size: 10px; font-weight: 700; padding: 2px 5px; border-radius: 3px;
  flex-shrink: 0; text-transform: uppercase; letter-spacing: .03em;
}
.dc-feed-type.EXECUTED        { background: rgba(63,185,80,.2); color: var(--accent2); }
.dc-feed-type.CHAIN_SIGNAL    { background: rgba(79,172,254,.15); color: var(--accent); }
.dc-feed-type.TRIGGER_PASSED  { background: rgba(63,185,80,.12); color: #7ee787; }
.dc-feed-type.TRIGGER_BLOCKED { background: rgba(248,81,73,.12); color: #f85149; }
.dc-feed-body { flex: 1; min-width: 0; }
.dc-feed-template { font-weight: 600; color: var(--text); }
.dc-feed-detail   { color: var(--muted); margin-top: 2px; word-break: break-all; }
.dc-feed-time     { font-size: 10px; color: var(--dim); flex-shrink: 0; align-self: center; }

.dc-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--muted); display: inline-block; transition: background .3s;
}
.dc-live-dot.connected { background: var(--accent2); box-shadow: 0 0 4px var(--accent2); }

/* ══════════════════════════════════════════════════════════════════
   Real Cases panel
   ══════════════════════════════════════════════════════════════════ */

/* Layout */
.cases-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Case selector cards ──────────────────────────────────────────── */
.cases-selector-row {
  display: flex;
  gap: 12px;
  padding: 14px 16px 0;
  flex-shrink: 0;
}
.case-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--bg-2);
  cursor: pointer;
  flex: 1;
  transition: border-color .18s, background .18s, box-shadow .18s;
  text-align: left;
  position: relative;
  min-width: 0;
}
.case-card:hover { border-color: var(--accent); background: var(--bg-3); }
.case-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.case-card-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.case-card-body { min-width: 0; flex: 1; }
.case-card-name { font-size: 13px; font-weight: 700; color: var(--text); white-space: nowrap; }
.case-card-sub  { font-size: 11px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.case-card-badge {
  position: absolute;
  top: 7px; right: 9px;
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  padding: 1px 5px; border-radius: 3px; letter-spacing: .4px;
}
.badge-agent { background: #2d1b4e; color: #c4b5fd; }
.badge-eai   { background: #1e3a5f; color: #93c5fd; }
.badge-grid  { background: #3b2400; color: #fcd34d; }
.badge-query { background: #1c2d3a; color: #67e8f9; }

/* ── Welcome ─────────────────────────────────────────────────────── */
.cases-welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cases-welcome-inner { text-align: center; }
.cases-welcome-icon  { font-size: 48px; margin-bottom: 12px; opacity: .5; }
.cases-welcome-title { font-size: 20px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.cases-welcome-sub   { font-size: 13px; color: var(--muted); margin-bottom: 16px; }
.cases-welcome-tags  { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.cases-tag {
  padding: 3px 10px; border-radius: 12px;
  background: var(--bg-4); color: var(--muted);
  font-size: 11px; font-weight: 500;
}

/* ── Case detail ─────────────────────────────────────────────────── */
.case-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 16px 0;
  gap: 0;
}

/* Sub-tab bar */
.case-subtabs-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  margin-bottom: 12px;
  flex-shrink: 0;
}
.case-subtab {
  padding: 6px 12px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s;
  margin-bottom: -1px;
}
.case-subtab:hover  { color: var(--text); }
.case-subtab.active { color: var(--accent); border-bottom-color: var(--accent); }
.btn-case-reset {
  padding: 4px 10px; font-size: 11px; font-weight: 500;
  background: var(--bg-4); color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer; transition: all .15s;
}
.btn-case-reset:hover { background: var(--bg-5); color: var(--text); border-color: var(--accent); }

/* Sub-panels */
.case-subpanel {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.case-subpanel.hidden { display: none; }

/* ── Purpose sub-panel ───────────────────────────────────────────── */
.purpose-layout { padding: 4px 0; }
.purpose-title    { font-size: 15px; font-weight: 700; color: var(--text); margin: 0 0 4px; }
.purpose-subtitle { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.purpose-body p   { font-size: 13px; color: var(--text); line-height: 1.75; margin-bottom: 8px; }
.purpose-body ul  { padding-left: 18px; margin-bottom: 8px; }
.purpose-body li  { font-size: 13px; color: var(--text); line-height: 1.75; margin-bottom: 4px; }
.purpose-body code { font-family: var(--fn-mono); background: var(--bg-4); padding: 1px 5px; border-radius: 3px; color: var(--accent); font-size: 12px; }
.purpose-arch     { margin-top: 16px; }

/* Architecture diagrams */
.arch-diagram { display: flex; flex-direction: column; gap: 10px; padding: 12px 0; }
.arch-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.arch-row-indent { padding-left: 24px; }
.arch-box {
  padding: 8px 12px; border-radius: var(--r-sm); font-size: 12px; font-weight: 600;
  text-align: center; min-width: 100px; border: 1px solid var(--border);
  line-height: 1.4;
}
.arch-box .arch-sub { font-weight: 400; font-size: 10px; color: var(--muted); margin-top: 2px; }
.arch-external { background: #0f2417; border-color: #16a34a; color: #4ade80; }
.arch-world    { background: #0f1e3d; border-color: #3b82f6; color: #93c5fd; }
.arch-decision { background: #2d1a00; border-color: #f59e0b; color: #fcd34d; }
.arch-action   { background: #1a0f2e; border-color: #7c3aed; color: #c4b5fd; }
.arch-listener { background: #0f2417; border-color: #059669; color: #6ee7b7; }
.arch-command  { background: #1e1215; border-color: #e11d48; color: #fda4af; }
.arch-llm      { background: #0f1e3d; border-color: #06b6d4; color: #67e8f9; }
.arch-user     { background: var(--bg-4); border-color: var(--border); color: var(--text); }
.arch-result   { background: #0f2d1a; border-color: #16a34a; color: #4ade80; }
.arch-arrow    { color: var(--muted); font-size: 16px; flex-shrink: 0; }
.arch-arrow-back { font-size: 12px; color: var(--accent); }
.arch-phases   { display: flex; align-items: center; gap: 4px; }
.arch-phase    { background: var(--bg-4); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 6px 10px; font-size: 11px; font-weight: 600; color: var(--text); text-align: center; }
.arch-phase span { display: block; font-weight: 400; color: var(--muted); font-size: 10px; }
.arch-phase-arrow { color: var(--muted); font-size: 14px; }

/* ── Schema sub-panel ────────────────────────────────────────────── */
.schema-three-col {
  display: flex; height: 100%; gap: 0;
}
.schema-editor-col {
  flex: 0 0 46%; min-width: 0;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
}
#schemaOutlineEditorContainer {
  flex: 1; min-height: 0; overflow: hidden;
}
.schema-entities-col  {
  flex: 0 0 30%; min-width: 0; overflow: auto;
  padding: 10px 12px;
  border-right: 1px solid var(--border);
}
.schema-decisions-col {
  flex: 1; min-width: 0; overflow: auto;
  padding: 10px 12px;
}
.schema-col-header {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--muted);
  padding: 7px 12px 6px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.schema-apply-btn {
  font-size: 10px; font-weight: 700; padding: 2px 9px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 4px; cursor: pointer; letter-spacing: .3px;
  text-transform: uppercase; transition: opacity .15s;
}
.schema-apply-btn:hover:not(:disabled) { opacity: .8; }
.schema-apply-btn:disabled { opacity: .4; cursor: default; }
.schema-entity-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 10px;
}
.schema-entity-name {
  font-size: 13px; font-weight: 700; color: var(--accent);
  margin-bottom: 8px; display: flex; align-items: baseline; gap: 6px;
}
.schema-entity-module { font-size: 10px; color: var(--muted); font-weight: 400; }
.schema-fields-table  { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.schema-fields-table th { text-align: left; font-weight: 600; color: var(--muted); padding: 3px 0; border-bottom: 1px solid var(--border); }
.schema-fields-table td { padding: 3px 6px 3px 0; }
.field-name { color: var(--text); font-family: var(--fn-mono); }
.field-type { color: var(--accent); font-family: var(--fn-mono); font-size: 11px; }
.schema-relations { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.relation-pill {
  background: rgba(59,130,246,.08); border: 1px solid rgba(59,130,246,.25);
  color: #60a5fa; border-radius: 10px; padding: 2px 8px;
  font-size: 10px; font-family: var(--fn-mono);
}
.schema-actions { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.action-pill { background: var(--bg-4); border: 1px solid var(--border); color: var(--muted); border-radius: 10px; padding: 2px 8px; font-size: 10px; font-family: var(--fn-mono); }
.schema-decision-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 10px;
}
.schema-decision-id {
  font-size: 12px; font-weight: 700; color: var(--text);
  font-family: var(--fn-mono); margin-bottom: 4px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.schema-decision-goal    { font-size: 12px; color: var(--text); margin-bottom: 6px; line-height: 1.5; }
.schema-decision-context { font-size: 11px; color: var(--muted); overflow: hidden; }
.schema-decision-context code { font-family: var(--fn-mono); font-size: 10px; word-break: break-all; }
.decision-activation-badge { font-size: 9px; font-weight: 700; text-transform: uppercase; padding: 1px 5px; border-radius: 3px; }
.badge-agent    { background: #0f1e3d; color: #93c5fd; }
.badge-action   { background: #2d1a00; color: #fcd34d; }
.badge-pipeline { background: #0f2417; color: #4ade80; }
.schema-empty   { color: var(--muted); font-size: 12px; padding: 16px 0; }

/* ── Execute sub-panel ───────────────────────────────────────────── */
.execute-layout { display: flex; gap: 16px; height: 100%; }
.execute-form-col {
  width: 280px; flex-shrink: 0;
  display: flex; flex-direction: column; gap: 12px;
}
.execute-form-header { font-size: 12px; font-weight: 700; color: var(--text); }
/* ── Execute right column ─────────────────────────────────────── */
.execute-right-col { flex: 1; display: flex; flex-direction: column; gap: 0; min-width: 0; min-height: 0; }

/* Events panel — full height in execute sub-tab */
.exec-events-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.exec-events-header {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
}
.exec-events-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: rgba(99,102,241,.35); flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.exec-events-dot.active {
  background: #818cf8; box-shadow: 0 0 7px #818cf8;
  animation: evt-dot-blink 1s ease-in-out infinite;
}
@keyframes evt-dot-blink { 0%,100%{opacity:.65} 50%{opacity:1} }
.execute-log-badge { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 10px; }
.badge-success { background: #0f2417; color: #4ade80; }
.badge-warn    { background: #2d1a00; color: #fcd34d; }
.badge-error   { background: #1e0510; color: #fda4af; }
.exec-events-body {
  flex: 1; background: var(--bg-1); border: 1px solid var(--border);
  border-radius: var(--r-sm); overflow-y: auto;
  padding: 10px 12px; font-size: 12px; min-height: 0;
}
.execute-log-placeholder { color: var(--muted); font-size: 12px; padding: 8px 0; }

/* Event cards */
.evt-card {
  display: flex; flex-direction: column; gap: 3px;
  padding: 7px 10px; margin-bottom: 6px; border-radius: 6px; border-left: 3px solid;
  animation: evt-appear .22s ease both;
}
@keyframes evt-appear { from{opacity:0;transform:translateY(5px)} to{opacity:1;transform:translateY(0)} }
.evt-card-decision { border-left-color: #fcd34d; background: rgba(251,191,36,.06); }
.evt-card-action   { border-left-color: #c4b5fd; background: rgba(167,139,250,.06); }
.evt-card-pipeline { border-left-color: #6ee7b7; background: rgba(52,211,153,.05); }
.evt-card-complete { border-left-color: #4ade80; background: rgba(74,222,128,.06); }
.evt-card-info     { border-left-color: #818cf8; background: rgba(99,102,241,.05); }
.evt-card-error    { border-left-color: #fda4af; background: rgba(253,164,175,.06); }
.evt-type-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .9px;
  text-transform: uppercase; font-family: var(--fn-mono); opacity: .75;
}
.evt-card-decision .evt-type-tag { color: #fcd34d; }
.evt-card-action   .evt-type-tag { color: #c4b5fd; }
.evt-card-pipeline .evt-type-tag { color: #6ee7b7; }
.evt-card-complete .evt-type-tag { color: #4ade80; }
.evt-card-info     .evt-type-tag { color: #818cf8; }
.evt-card-error    .evt-type-tag { color: #fda4af; }
.evt-card-title  { font-size: 12px; font-weight: 600; color: var(--text); }
.evt-card-detail { font-size: 11px; color: var(--muted); font-family: var(--fn-mono); white-space: pre-wrap; word-break: break-word; margin-top: 2px; }

.query-result-meta {
  display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px;
}
.query-meta-pill {
  display: inline-flex; align-items: center; padding: 3px 8px;
  border-radius: 999px; font-size: 10.5px; font-weight: 600;
  color: var(--accent); background: rgba(79,172,254,.12);
  border: 1px solid rgba(79,172,254,.24); font-family: var(--fn-mono);
}
.query-answer-block,
.query-result-card,
.query-table-wrap,
.query-metric-wrap,
.query-chart-wrap {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px; margin-bottom: 10px;
}
.query-display-title {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px;
}
.query-md-h2, .query-md-h3 {
  font-weight: 700; color: var(--text); margin: 2px 0 8px;
}
.query-md-h2 { font-size: 14px; }
.query-md-h3 { font-size: 12.5px; color: var(--accent2); }
.query-md-p, .query-md-li {
  font-size: 12px; color: var(--text); line-height: 1.65; margin: 0 0 6px;
}
.query-md-li::before { content: '• '; color: var(--accent); }
.query-md-gap { height: 6px; }
.query-md-p code, .query-md-li code {
  font-family: var(--fn-mono); font-size: 11px;
  background: var(--bg2); border-radius: 4px; padding: 1px 5px; color: var(--accent2);
}
.query-table {
  width: 100%; border-collapse: collapse; font-size: 11.5px;
}
.query-table th, .query-table td {
  text-align: left; padding: 7px 8px; border-bottom: 1px solid rgba(148,163,184,.12);
}
.query-table th {
  color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
}
.query-table td { color: var(--text); }
.query-table tbody tr:last-child td { border-bottom: none; }
.query-metric-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px;
}
.query-metric-card {
  border: 1px solid rgba(79,172,254,.18); background: rgba(79,172,254,.06);
  border-radius: 10px; padding: 12px 10px;
}
.query-metric-label {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px;
}
.query-metric-value {
  font-size: 20px; font-weight: 800; color: var(--accent2); line-height: 1.2;
}
.query-chart-wrap { min-height: 280px; }
.query-chart-canvas {
  width: 100%; height: 220px; display: block;
}

/* ── Decision Verdict right panel — three sections ─────────────── */
.dvr-body {
  flex: 1; min-height: 0; overflow: hidden;
  display: flex; flex-direction: column;
}
.dvr-body.hidden { display: none !important; }

/* Shared header style used by cmd & result panels */
.dvr-panel-header {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 8px 14px 6px; display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* Upper: decision commands */
.dvr-cmd-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid var(--border); }
.dvr-cmd-body {
  flex: 1; overflow-y: auto; padding: 6px 14px 10px; min-height: 0;
  font-size: 12px;
}

/* Middle: engine animation canvas */
.dvr-vis-panel {
  flex-shrink: 0; height: 110px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 0 14px 6px;
}
.dvr-vis-header {
  display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  padding-top: 8px; margin-bottom: 5px; flex-shrink: 0;
}
.dvr-vis-canvas { flex: 1; display: block; width: 100%; min-height: 0; }

/* Engine icon + status (shared by dvr-vis-panel) */
.exec-engine-icon { display: inline-block; transition: transform .2s; }
@keyframes eng-rot { to { transform: rotate(360deg); } }
.exec-engine-status {
  margin-left: auto; font-size: 10px; font-weight: 700;
  padding: 1px 8px; border-radius: 10px;
  background: rgba(99,102,241,.1); color: rgba(148,163,184,.6); transition: all .3s;
}
.dvr-vis-panel.running .exec-engine-icon { animation: eng-rot 0.9s linear infinite; }
.dvr-vis-panel.running .exec-engine-status { background: rgba(251,191,36,.18); color: #fcd34d; }
.dvr-vis-panel.done    .exec-engine-status { background: rgba(74,222,128,.14);  color: #4ade80; }

/* Lower: execution results */
.dvr-result-panel { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.dvr-result-body {
  flex: 1; overflow-y: auto; padding: 6px 14px 10px; min-height: 0;
  font-size: 12px;
}

/* DB write row (EAI / Grid simulated writes) */
.db-write-row {
  display: flex; flex-direction: column; gap: 2px;
  padding: 5px 8px; margin-bottom: 5px; border-radius: 5px;
  border-left: 3px solid rgba(99,102,241,.4); background: rgba(99,102,241,.04);
  animation: evt-appear .2s ease both;
}
.db-write-table { font-size: 9px; font-weight: 700; color: #818cf8; text-transform: uppercase; letter-spacing: .7px; font-family: var(--fn-mono); }
.db-write-op    { font-size: 9px; color: #6ee7b7; font-family: var(--fn-mono); }
.db-write-sql   { font-size: 10.5px; color: var(--muted); white-space: pre-wrap; word-break: break-word; font-family: var(--fn-mono); }

/* Query result card */
.query-result-card {
  background: rgba(99,102,241,.04); border: 1px solid rgba(99,102,241,.15);
  border-radius: 8px; padding: 10px 12px; font-size: 12px;
  color: var(--text); line-height: 1.7; white-space: pre-wrap; word-break: break-word;
  font-family: inherit; animation: evt-appear .25s ease both;
}
.query-result-card strong { color: #fcd34d; font-weight: 700; }
.exec-field { display: flex; flex-direction: column; gap: 4px; }
.exec-label { font-size: 11px; font-weight: 600; color: var(--muted); }
.exec-req   { color: #e11d48; }
.exec-input {
  background: var(--bg-3); border: 1px solid var(--border);
  border-radius: var(--r-sm); color: var(--text);
  font-size: 12px; padding: 6px 10px;
  font-family: inherit;
  transition: border-color .15s;
}
.exec-input:focus { outline: none; border-color: var(--accent); }
.exec-textarea    { resize: vertical; min-height: 60px; }
.exec-note  { font-size: 11px; color: var(--muted); line-height: 1.5; }
.exec-examples { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.exec-examples-label { font-size: 10px; color: var(--muted); }
.exec-chip {
  background: var(--bg-4); border: 1px solid var(--border); color: var(--muted);
  border-radius: 10px; padding: 3px 9px; font-size: 10px; cursor: pointer;
  transition: all .15s;
}
.exec-chip:hover { background: var(--bg-5); color: var(--text); border-color: var(--accent); }
.btn-execute {
  display: flex; align-items: center; gap: 6px; justify-content: center;
  padding: 8px 16px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--r-sm); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: opacity .15s;
}
.btn-execute:hover    { opacity: .88; }
.btn-execute:disabled { opacity: .45; cursor: not-allowed; }

/* Grid line visual */
.grid-lines-visual { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.grid-line-btn {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 4px; background: var(--bg-3); border: 1.5px solid var(--border);
  border-radius: var(--r-sm); cursor: pointer; transition: all .15s;
  font-size: 11px;
}
.grid-line-btn:hover    { border-color: var(--accent); background: var(--bg-4); }
.grid-line-btn.selected { border-color: #f59e0b; background: #2d1a00; }
.grid-line-btn.line-grounded { border-color: #e11d48; background: #1e0510; }
.line-icon { font-size: 18px; }
.line-id   { font-size: 10px; font-weight: 700; color: var(--text); font-family: var(--fn-mono); }
.line-mw   { font-size: 10px; color: var(--muted); }

/* Log steps */
.log-step { padding: 6px 0; border-bottom: 1px solid var(--border); }
.log-step:last-child { border-bottom: none; }
.log-step-title  { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.log-step-detail { font-size: 11px; color: var(--muted); font-family: var(--fn-mono); }
.log-step-decision .log-step-title { color: #fcd34d; }
.log-step-action   .log-step-title { color: #c4b5fd; }
.log-step-command  .log-step-title { color: #fda4af; }
.log-step-complete .log-step-title { color: #4ade80; }
.log-step-pipeline .log-step-title { color: #6ee7b7; }
.log-step-result   .log-step-title { color: #67e8f9; }
.log-step-error    .log-step-title { color: #fda4af; }
.log-step-tool .log-step-detail    { color: var(--text); }
.log-running { color: var(--muted); font-size: 12px; animation: pulse 1.2s ease-in-out infinite; }
.log-error   { color: #fda4af; font-size: 12px; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .4 } }

/* SCADA commands table */
.log-commands-summary { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.commands-title { font-size: 12px; font-weight: 700; color: #fda4af; margin-bottom: 8px; }
.commands-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.commands-table th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 8px 4px 0; border-bottom: 1px solid var(--border); }
.commands-table td { padding: 4px 8px 4px 0; color: var(--text); }
.commands-table code { font-family: var(--fn-mono); color: var(--accent); font-size: 10px; }

/* Query response */
.log-query-response { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.qr-label { font-size: 12px; font-weight: 700; color: #67e8f9; margin-bottom: 6px; }
.qr-text  { font-size: 11px; color: var(--text); white-space: pre-wrap; word-break: break-word; font-family: var(--fn-mono); background: var(--bg-1); padding: 8px; border-radius: var(--r-sm); max-height: 320px; overflow-y: auto; }

/* Light theme overrides */
body.light .arch-external { background: #dcfce7; border-color: #16a34a; color: #166534; }
body.light .arch-world    { background: #dbeafe; border-color: #2563eb; color: #1e40af; }
body.light .arch-decision { background: #fef3c7; border-color: #d97706; color: #92400e; }
body.light .arch-action   { background: #ede9fe; border-color: #7c3aed; color: #4c1d95; }
body.light .arch-listener { background: #d1fae5; border-color: #059669; color: #065f46; }
body.light .arch-command  { background: #ffe4e6; border-color: #e11d48; color: #9f1239; }
body.light .arch-llm      { background: #cffafe; border-color: #0891b2; color: #164e63; }
body.light .arch-result   { background: #dcfce7; border-color: #16a34a; color: #166534; }
body.light .badge-agent   { background: #ede9fe; color: #5b21b6; }

/* EAI-Agent suspend banner */
.agent-suspend-banner {
  display: flex; gap: 12px; align-items: flex-start;
  background: #2d1b4e; border: 1px solid #7c3aed;
  border-radius: 8px; padding: 12px 14px; margin-bottom: 12px;
}
.suspend-icon { font-size: 22px; line-height: 1; }
.suspend-text { font-size: 13px; line-height: 1.6; color: #e9d5ff; }
.suspend-text strong { color: #c4b5fd; }
.suspend-text code   { background: #4c1d95; padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.suspend-sub { color: #a78bfa; font-size: 12px; }
.agent-llm-form { background: #1e1e2e; border: 1px solid #4c1d95; border-radius: 8px; padding: 14px; }
.agent-llm-form input, .agent-llm-form select, .agent-llm-form textarea {
  width: 100%; box-sizing: border-box; margin-top: 4px; margin-bottom: 10px;
  background: #12121c; color: #e2e8f0; border: 1px solid #6d28d9;
  border-radius: 6px; padding: 7px 10px; font-size: 13px;
}
.agent-llm-form label { color: #c4b5fd; font-size: 12px; display: block; margin-top: 8px; }
body.light .agent-suspend-banner { background: #ede9fe; border-color: #7c3aed; }
body.light .suspend-text         { color: #4c1d95; }
body.light .suspend-sub          { color: #7c3aed; }
body.light .agent-llm-form       { background: #f9f5ff; border-color: #a78bfa; }
body.light .agent-llm-form input, body.light .agent-llm-form select, body.light .agent-llm-form textarea {
  background: #fff; color: #1e1e2e; border-color: #7c3aed;
}
body.light .agent-llm-form label { color: #5b21b6; }
/* arch-agent */
.arch-agent .arch-suspend { background: #2d1b4e; border-color: #7c3aed; }
.arch-agent .arch-highlight { box-shadow: 0 0 0 2px #7c3aed; }
body.light .badge-eai     { background: #dbeafe; color: #1e40af; }
body.light .badge-grid    { background: #fef3c7; color: #92400e; }
body.light .badge-query   { background: #cffafe; color: #164e63; }
body.light .badge-success { background: #dcfce7; color: #166534; }
body.light .badge-warn    { background: #fef3c7; color: #92400e; }
body.light .badge-error   { background: #ffe4e6; color: #9f1239; }
body.light .badge-agent   { background: #dbeafe; color: #1e40af; }
body.light .badge-action  { background: #fef3c7; color: #92400e; }
body.light .badge-pipeline{ background: #dcfce7; color: #166534; }
body.light .grid-line-btn.selected  { border-color: #d97706; background: #fef3c7; }
body.light .grid-line-btn.line-grounded { border-color: #e11d48; background: #ffe4e6; }
body.light .log-step-decision .log-step-title { color: #92400e; }
body.light .log-step-action   .log-step-title { color: #4c1d95; }
body.light .log-step-command  .log-step-title { color: #9f1239; }
body.light .log-step-complete .log-step-title { color: #166534; }
body.light .log-step-pipeline .log-step-title { color: #065f46; }
body.light .log-step-result   .log-step-title { color: #164e63; }
body.light .log-error { color: #9f1239; }

/* Spinner */
.spin { display: inline-block; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Case VirtualSet sub-panel ───────────────────────────────────── */
.case-vs-layout {
  display: flex;
  gap: 12px;
  height: 100%;
  padding: 12px;
  box-sizing: border-box;
  min-height: 0;
}
.case-vs-editor-col {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 52%;
  min-height: 0;
}
.case-vs-result-col {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.case-vs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.case-vs-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
}
.case-vs-editor-monaco {
  flex: 0 0 220px;
  height: 220px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: border-color .15s;
}
.case-vs-editor-monaco:focus-within { border-color: var(--accent); }
.case-vs-examples {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  max-height: 200px;
}
.case-vs-example-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 5px 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.case-vs-example-item:hover { border-color: var(--accent); background: var(--hover); }
.case-vs-example-code {
  flex: 1;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--accent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.case-vs-example-desc {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
}
.case-vs-result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.case-vs-result {
  flex: 1;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  overflow: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  white-space: pre-wrap;
  color: var(--text);
  min-height: 120px;
}
.case-vs-result.result-error { color: #f87171; }
.case-vs-result.result-ok    { color: var(--text); }

/* ── Case Decision Center sub-panel ─────────────────────────────── */
.case-center-layout {
  display: flex;
  gap: 12px;
  height: 100%;
  padding: 12px;
  box-sizing: border-box;
  min-height: 0;
}
.case-center-decisions {
  width: 44%;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.case-center-graph-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.case-center-graph-header {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.case-center-graph {
  flex: 1;
  min-height: 260px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.cc-decision-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 10px 12px;
  transition: border-color .15s;
}
.cc-decision-card:hover { border-color: var(--accent); }
.cc-decision-id {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  font-family: 'JetBrains Mono', monospace;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.cc-decision-goal {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.cc-decision-context {
  margin-top: 5px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--accent);
  background: var(--editor-bg, rgba(59,130,246,.06));
  border-radius: 4px;
  padding: 3px 7px;
  word-break: break-all;
}
body.light .case-vs-result { background: #f8fafc; }
