/* ─────────────────────────────────────────────────────────────────────────────
   SWISH Local  —  styles.css
   Visual style modelled after SWISH (SWI-Prolog for SHaring)
───────────────────────────────────────────────────────────────────────────── */

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

:root {
  --swish-blue:        #2c5bf7;
  --swish-blue-dark:   #1a3ab4;
  --swish-blue-light:  #4a7fff;
  --header-bg:         linear-gradient(135deg, #1a3ab4 0%, #2c5bf7 60%, #4a7fff 100%);
  --bg:                #f5f7fb;
  --panel-bg:          #ffffff;
  --panel-border:      #d0d8ea;
  --panel-shadow:      0 2px 8px rgba(44,91,247,.10);
  --sidebar-bg:        #eef1f8;
  --text:              #1a2233;
  --text-muted:        #6b7a99;
  --text-light:        #a0aabf;
  --green:             #1a7f4b;
  --green-bg:          #e6f7ee;
  --red:               #c0392b;
  --red-bg:            #fdecea;
  --orange:            #c97000;
  --orange-bg:         #fff3e0;
  --accent:            #2c5bf7;

  --toolbar-h:         52px;
  --statusbar-h:       26px;
  --tab-h:             38px;
  --query-panel-h:     108px;
  --sidebar-w:         210px;
  --result-panel-w:    420px;
}

/* Dark theme */
[data-theme="dark"] {
  --header-bg:         linear-gradient(135deg, #1a2845 0%, #1f3a7a 60%, #2c4a9f 100%);
  --bg:                #1a1a1a;
  --panel-bg:          #252525;
  --panel-border:      #3a3a3a;
  --panel-shadow:      0 2px 8px rgba(0,0,0,.60);
  --sidebar-bg:        #1f1f1f;
  --text:              #f5f5f5;
  --text-muted:        #b0b0b0;
  --text-light:        #8a8a8a;
  --green:             #5eed7f;
  --green-bg:          #1a4d2e;
  --red:               #ff7575;
  --red-bg:            #4a1a1a;
  --orange:            #ffb84d;
  --orange-bg:         #4d3319;
  --accent:            #6db3f2;
}

[data-theme="dark"] .pred-item {
  color: #6db3f2;
}

[data-theme="dark"] .pred-item:hover {
  background: #3a3a3a;
}

[data-theme="dark"] .qblock-header {
  background: #2a3a4a;
  color: #6db3f2;
  border-bottom-color: #3a3a3a;
}

[data-theme="dark"] .sol-row {
  border-bottom-color: #3a3a3a;
  color: #f5f5f5;
}

[data-theme="dark"] .sol-row.done-row {
  background: #2a2a2a;
  color: #b0b0b0;
}

[data-theme="dark"] .sep-row {
  color: #8a8a8a;
}

[data-theme="dark"] #btn-clear-results:hover {
  background: #3a3a3a;
}

[data-theme="dark"] .bind-value {
  color: #6db3f2;
}

[data-theme="dark"] #query-prompt {
  color: #6db3f2;
}

html, body {
  height: 100%;
  font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  overflow: hidden;
}

/* ── Main layout ─────────────────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── Header / toolbar ────────────────────────────────────────────────────── */
#toolbar {
  height: var(--toolbar-h);
  background: var(--header-bg);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,30,.22);
  z-index: 10;
}

#logo {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 1px;
  text-shadow: 0 1px 3px rgba(0,0,0,.3);
  margin-right: 8px;
  user-select: none;
}
#logo svg { width: 28px; height: 28px; }

.tb-btn {
  padding: 6px 16px;
  border-radius: 6px;
  border: 1.5px solid rgba(255,255,255,.35);
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  white-space: nowrap;
  backdrop-filter: blur(4px);
}
.tb-btn:hover { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.6); }

.tb-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid rgba(255,255,255,.35);
  border-radius: 6px;
  padding: 5px 10px;
  background: rgba(255,255,255,.15);
  cursor: pointer;
  user-select: none;
}

.tb-toggle:hover {
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.6);
}

.tb-toggle input {
  accent-color: var(--swish-blue-light);
}

#session-badge {
  font-size: 11px;
  color: rgba(255,255,255,.7);
  font-family: monospace;
  background: rgba(0,0,0,.2);
  border-radius: 4px;
  padding: 2px 8px;
  margin-left: auto;
}

#clpfd-status {
  font-size: 11px;
  color: #f5fff5;
  background: rgba(18, 123, 72, .55);
  border: 1px solid rgba(223, 255, 233, .35);
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}

/* ── Workspace ───────────────────────────────────────────────────────────── */
#workspace { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-hdr {
  padding: 10px 14px 6px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .9px;
  border-bottom: 1px solid var(--panel-border);
}

#pred-search {
  margin: 8px 10px 4px;
  padding: 4px 8px;
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  font-size: 12px;
  outline: none;
  background: #fff;
  color: var(--text);
}
#pred-search:focus { border-color: var(--accent); }

#pred-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0 8px;
}
.pred-item {
  padding: 4px 14px 4px 12px;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 11.5px;
  color: #0a52b0;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 3px;
  margin: 0 4px;
}
.pred-item:hover { background: #dce5f8; }

/* ── Main column (editor + results) ─────────────────────────────────────── */
#main { display: flex; flex-direction: column; flex: 1; overflow: hidden; }

/* ── Tab bar ─────────────────────────────────────────────────────────────── */
#tab-bar {
  display: flex;
  align-items: center;
  height: var(--tab-h);
  background: var(--panel-bg);
  border-bottom: 2px solid var(--panel-border);
  overflow-x: auto;
  flex-shrink: 0;
}
#tab-bar::-webkit-scrollbar { height: 3px; }
#tab-bar::-webkit-scrollbar-thumb { background: var(--panel-border); }

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 14px;
  height: 100%;
  font-size: 12.5px;
  cursor: pointer;
  border-right: 1px solid var(--panel-border);
  white-space: nowrap;
  color: var(--text-muted);
  user-select: none;
  transition: background .1s;
}
.tab:hover { background: #eef1f8; }
.tab.active {
  color: var(--swish-blue);
  background: var(--panel-bg);
  border-bottom: 2.5px solid var(--swish-blue);
  font-weight: 600;
}
.tab-close {
  opacity: 0;
  font-size: 14px;
  line-height: 1;
  width: 16px; height: 16px;
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
}
.tab:hover .tab-close { opacity: .6; }
.tab-close:hover { opacity: 1 !important; background: var(--red-bg); color: var(--red); }

#new-tab-btn {
  padding: 0 14px;
  height: 100%;
  display: flex; align-items: center;
  font-size: 19px;
  color: var(--text-muted);
  cursor: pointer;
  flex-shrink: 0;
}
#new-tab-btn:hover { background: #eef1f8; color: var(--swish-blue); }

/* ── Editor + results split ──────────────────────────────────────────────── */
#split { display: flex; flex: 1; overflow: hidden; }

#editor-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--panel-border);
  min-width: 300px;
}

#monaco-editor { flex: 1; overflow: hidden; }

#notebook-root {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 14px;
}

#notebook-root::-webkit-scrollbar { width: 6px; }
#notebook-root::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 3px; }

.notebook-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.notebook-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1.5px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--panel-shadow);
}

.notebook-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 260px;
}

.notebook-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--text-muted);
}

.notebook-title {
  border: 1.5px solid var(--panel-border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
  outline: none;
}

.notebook-title:focus {
  border-color: var(--swish-blue);
  box-shadow: 0 0 0 3px rgba(44,91,247,.12);
}

.notebook-cells {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.notebook-cell {
  border: 1.5px solid var(--panel-border);
  border-radius: 8px;
  background: var(--panel-bg);
  box-shadow: var(--panel-shadow);
  overflow: hidden;
}

.notebook-cell.dragging {
  opacity: .7;
}

.notebook-cell.drag-target {
  border-color: var(--swish-blue);
}

.notebook-cell-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--panel-border);
  background: #f7f9ff;
}

[data-theme="dark"] .notebook-cell-header {
  background: #2a2a2a;
}

.notebook-cell-meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.drag-handle {
  font-size: 14px;
  color: var(--text-muted);
  cursor: grab;
  user-select: none;
}

.cell-index {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .6px;
  font-weight: 700;
}

.notebook-cell-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cell-type {
  border: 1px solid var(--panel-border);
  border-radius: 5px;
  padding: 4px 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 11px;
}

.notebook-run-btn {
  background: #1a7f4b;
  color: #fff;
}

.notebook-delete-btn {
  background: var(--red);
  color: #fff;
}

.notebook-editor {
  height: 180px;
  border-bottom: 1px solid var(--panel-border);
}

.notebook-output {
  padding: 10px;
  min-height: 46px;
  background: var(--panel-bg);
}

.notebook-output .qblock {
  margin-bottom: 0;
}

.notebook-add-wrap {
  display: flex;
  justify-content: center;
  padding: 8px 0 2px;
}

@media (max-width: 980px) {
  .notebook-header {
    flex-direction: column;
    align-items: stretch;
  }

  .notebook-cell-header {
    flex-direction: column;
    align-items: stretch;
  }

  .notebook-cell-actions {
    justify-content: flex-end;
  }
}

/* ── Query panel ─────────────────────────────────────────────────────────── */
#query-panel {
  height: var(--query-panel-h);
  background: var(--panel-bg);
  border-top: 2px solid var(--panel-border);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}

#query-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
}

#query-row { display: flex; align-items: center; gap: 7px; }

#query-prompt {
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 14px;
  color: var(--swish-blue);
  font-weight: 700;
  white-space: nowrap;
}

#query-input {
  flex: 1;
  border: 1.5px solid var(--panel-border);
  border-radius: 6px;
  padding: 5px 10px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#query-input:focus {
  border-color: var(--swish-blue);
  box-shadow: 0 0 0 3px rgba(44,91,247,.12);
}

#query-history {
  min-width: 130px;
  max-width: 180px;
  border: 1.5px solid var(--panel-border);
  border-radius: 6px;
  padding: 5px 8px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg);
  outline: none;
}

#query-history:focus {
  border-color: var(--swish-blue);
  box-shadow: 0 0 0 3px rgba(44,91,247,.12);
}

/* ── Query buttons ───────────────────────────────────────────────────────── */
.q-btn {
  padding: 5px 14px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity .15s, transform .1s;
}
.q-btn:hover:not(:disabled) { opacity: .88; }
.q-btn:active:not(:disabled) { transform: scale(.97); }
.q-btn:disabled { opacity: .4; cursor: default; }

#btn-run   { background: #1a7f4b; color: #fff; }
#btn-next  { background: var(--swish-blue); color: #fff; }
#btn-all   { background: #5b7fff; color: #fff; }
#btn-stop  { background: var(--red); color: #fff; }
#btn-reset { background: var(--panel-bg); color: var(--text-muted); border: 1.5px solid var(--panel-border); }

#query-opts { display: flex; align-items: center; gap: 12px; }

.opt-label { font-size: 11px; color: var(--text-muted); }

#limit-sel {
  border: 1px solid var(--panel-border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  background: var(--bg);
  color: var(--text);
}

/* ── Results panel ───────────────────────────────────────────────────────── */
#result-col {
  width: var(--result-panel-w);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel-bg);
  flex-shrink: 0;
}

#result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  height: var(--tab-h);
  border-bottom: 2px solid var(--panel-border);
  font-weight: 700;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .7px;
  flex-shrink: 0;
}

#result-header-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

#result-view-title {
  white-space: nowrap;
}

#answers-terminal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px;
  cursor: pointer;
}

#answers-terminal-toggle .mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(26, 58, 180, 0.08);
  font-size: 13px;
  letter-spacing: 0;
}

#answers-terminal-toggle .mode-label {
  white-space: nowrap;
}

#answers-terminal-toggle[data-mode="terminal"],
#answers-terminal-toggle[data-mode="split"] {
  color: var(--swish-blue);
  border-color: var(--swish-blue-light);
  background: #eef3ff;
}

#answers-terminal-toggle[data-mode="terminal"] .mode-icon,
#answers-terminal-toggle[data-mode="split"] .mode-icon {
  background: rgba(44, 91, 247, 0.14);
}

[data-theme="dark"] #answers-terminal-toggle[data-mode="terminal"],
[data-theme="dark"] #answers-terminal-toggle[data-mode="split"] {
  color: #6db3f2;
  border-color: #6db3f2;
  background: #2a3a4a;
}

[data-theme="dark"] #answers-terminal-toggle .mode-icon {
  background: rgba(109, 179, 242, 0.18);
}

#btn-clear-results {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
}
#btn-clear-results:hover { background: #eef1f8; }

#btn-export-csv, #btn-export-json {
  background: none;
  border: none;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
}
#btn-export-csv:hover, #btn-export-json:hover { background: #eef1f8; }

[data-theme="dark"] #btn-export-csv:hover,
[data-theme="dark"] #btn-export-json:hover {
  background: #3a3a3a;
}

#result-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
}
#result-body::-webkit-scrollbar { width: 5px; }
#result-body::-webkit-scrollbar-thumb { background: var(--panel-border); border-radius: 3px; }

#terminal-output-root {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  background: #0f1218;
}

[data-theme="dark"] #terminal-output-root {
  background: #0b0d12;
}

.terminal-output-content {
  margin: 0;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 12.5px;
  line-height: 1.5;
  color: #d8dee9;
  white-space: pre-wrap;
  word-break: break-word;
}

.terminal-shell {
  display: flex;
  flex-direction: column;
  min-height: 100%;
}

.terminal-shell .terminal-output-content {
  flex: 1;
  min-height: 0;
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #2e3440;
}

.terminal-input-prompt {
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  color: #8fbcbb;
  font-size: 12px;
  font-weight: 700;
}

.terminal-input {
  flex: 1;
  border: 1px solid #2e3440;
  border-radius: 6px;
  background: #11151e;
  color: #d8dee9;
  padding: 6px 8px;
  font-family: 'Cascadia Code', 'Fira Code', 'Courier New', monospace;
  font-size: 12px;
  outline: none;
}

.terminal-input:focus {
  border-color: #6db3f2;
}

.terminal-input:disabled {
  opacity: 0.6;
}

.terminal-input-run {
  border: 1px solid #2e3440;
  border-radius: 6px;
  background: #1d2430;
  color: #d8dee9;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.terminal-input-clear {
  border: 1px solid #2e3440;
  border-radius: 6px;
  background: #1d2430;
  color: #d8dee9;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.terminal-input-run:hover:enabled {
  border-color: #6db3f2;
  color: #6db3f2;
}

.terminal-input-clear:hover {
  border-color: #6db3f2;
  color: #6db3f2;
}

.terminal-input-run:disabled {
  opacity: 0.6;
  cursor: default;
}

#terminal-output-root::-webkit-scrollbar { width: 5px; }
#terminal-output-root::-webkit-scrollbar-thumb { background: #2e3440; border-radius: 3px; }

#result-split-resizer {
  display: none;
  height: 6px;
  cursor: row-resize;
  background: var(--panel-border);
  transition: background .15s;
  flex-shrink: 0;
}

#result-split-resizer:hover,
#result-split-resizer.active {
  background: var(--swish-blue);
}

#result-col.result-split-mode {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows:
    var(--tab-h)
    minmax(120px, var(--result-split-top, 50%))
    6px
    minmax(120px, calc(100% - var(--tab-h) - 6px - var(--result-split-top, 50%)));
}

#result-col.result-split-mode #result-header {
  grid-column: 1;
  grid-row: 1;
}

#result-col.result-split-mode #result-body,
#result-col.result-split-mode #result-split-resizer,
#result-col.result-split-mode #terminal-output-root {
  min-height: 0;
}

#result-col.result-split-mode #result-body {
  grid-column: 1;
  grid-row: 2;
  border-right: 0;
}

#result-col.result-split-mode #terminal-output-root {
  grid-column: 1;
  grid-row: 4;
  border-top: 1px solid var(--panel-border);
}

#result-col.result-split-mode #result-split-resizer {
  display: block;
  grid-column: 1;
  grid-row: 3;
}

/* ── Individual query result blocks ─────────────────────────────────────── */
.qblock {
  margin-bottom: 14px;
  border: 1.5px solid var(--panel-border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--panel-shadow);
}

.qblock-header {
  background: #f0f4fd;
  border-bottom: 1px solid var(--panel-border);
  padding: 5px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  color: var(--swish-blue);
  font-weight: 600;
}

.qblock-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.qblock-clear-btn {
  border: 1px solid var(--panel-border);
  background: #fff;
  color: var(--text-muted);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 8px;
  cursor: pointer;
  flex-shrink: 0;
}

.qblock-clear-btn:hover {
  background: #eef1f8;
  color: var(--swish-blue);
}

[data-theme="dark"] .qblock-clear-btn {
  background: #252525;
  border-color: #3a3a3a;
  color: #c8d3e6;
}

[data-theme="dark"] .qblock-clear-btn:hover {
  background: #303846;
  color: #6db3f2;
}

.sol-row {
  padding: 6px 14px;
  border-bottom: 1px solid #eef1f8;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.7;
}
.sol-row:last-child { border-bottom: none; }

.sol-row.true-sol  { color: var(--green);  background: var(--green-bg); }
.sol-row.false-sol { color: var(--red);    background: var(--red-bg); font-style: italic; }
.sol-row.done-row  { color: var(--text-muted); font-size: 11px; font-style: italic; background: #f7f9ff; }
.sol-row.error-row { color: var(--red);    background: var(--red-bg); }
.sol-row.status-row{ color: var(--orange); font-size: 11px; }
.sep-row { display: inline; color: var(--text-light); font-size: 12px; padding: 0; }

/* ── Table view ──────────────────────────────────────────────────────────── */
#result-body.table-view .qblock {
  margin-bottom: 20px;
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-family: 'Cascadia Code', 'Fira Code', monospace;
  font-size: 12px;
  margin-bottom: 14px;
  border: 1.5px solid var(--panel-border);
  border-radius: 6px;
  overflow: hidden;
}

.results-table thead {
  background: #f0f4fd;
  font-weight: 600;
  color: var(--swish-blue);
}

.results-table th {
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1.5px solid var(--panel-border);
}

.results-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eef1f8;
  word-break: break-word;
}

.results-table tbody tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr:hover {
  background: #f7f9ff;
}

[data-theme="dark"] .results-table thead {
  background: #2a3a4a;
  color: #6db3f2;
}

[data-theme="dark"] .results-table th {
  border-bottom-color: #3a3a3a;
}

[data-theme="dark"] .results-table td {
  border-bottom-color: #3a3a3a;
  color: #f5f5f5;
}

[data-theme="dark"] .results-table tbody tr:hover {
  background: #2a2a2a;
}

/* Variable binding layout */
.binding-line {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.bind-sep   { color: var(--text-muted); }
.bind-name  { color: #c7254e; font-weight: 600; }
.bind-eq    { color: var(--text-muted); }
.bind-value { color: #0a52b0; }

/* ── Resizer ─────────────────────────────────────────────────────────────── */
.resizer {
  width: 5px;
  cursor: col-resize;
  background: var(--panel-border);
  flex-shrink: 0;
  transition: background .15s;
}
.resizer:hover, .resizer.active { background: var(--swish-blue); }

/* ── Status bar ──────────────────────────────────────────────────────────── */
#statusbar {
  height: var(--statusbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  background: var(--header-bg);
  color: rgba(255,255,255,.85);
  font-size: 11px;
  flex-shrink: 0;
}

#conn-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #aaa;
  flex-shrink: 0;
}
#conn-dot.ok   { background: #4dff91; }
#conn-dot.err  { background: #ff6b6b; }
#conn-dot.wait { background: #ffd36b; }

#status-msg { flex: 1; }

#footer-license-link {
  font-size: 10px;
  color: rgba(255,255,255,.78);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.35);
  transition: color .15s, border-color .15s;
  white-space: nowrap;
}

#footer-license-link:hover {
  color: #fff;
  border-bottom-color: rgba(255,255,255,.9);
}

#footer-attribution {
  font-size: 10px;
  color: rgba(255,255,255,.7);
  white-space: nowrap;
  margin-left: auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
}

#footer-attribution a {
  color: rgba(255,255,255,.9);
  text-decoration: none;
  border-bottom: 1px solid rgba(255,255,255,.5);
  transition: color .15s, border-color .15s;
}

#footer-attribution a:hover {
  color: #fff;
  border-bottom-color: #fff;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spin {
  display: inline-block;
  width: 10px; height: 10px;
  border: 2px solid rgba(44,91,247,.2);
  border-top-color: var(--swish-blue);
  border-radius: 50%;
  animation: rotate .6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes rotate { to { transform: rotate(360deg); } }

/* ── Scrollbars ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cdd6ea; border-radius: 3px; }
