/* SQL Intelligence Platform workbench — no build step, plain CSS. */

/* Dark is the default theme (the original look). */
:root {
  --bg: #0f1217;
  --bg-pane: #171b22;
  --bg-input: #0c0f13;
  --border: #2a3038;
  --text: #d7dce2;
  --text-muted: #8a93a0;
  --accent: #4d9fff;
  --accent-dim: #2c5f99;
  --ok: #3fb27f;
  --warn: #d9a13b;
  --err: #e0605e;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
  --sans: "Segoe UI", system-ui, sans-serif;
}

/* Light theme — applied when the toggle sets data-theme="light" on <html>. */
:root[data-theme="light"] {
  --bg: #eef1f4;
  --bg-pane: #ffffff;
  --bg-input: #f6f8fa;
  --border: #d6dde4;
  --text: #1c2530;
  --text-muted: #5a6672;
  --accent: #2b7fd4;
  --accent-dim: #1f6ac0;
  --ok: #2e9e6b;
  --warn: #b07d15;
  --err: #c0392b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
}

/* ---------- header ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  position: relative;
  /* Full-bleed bar, contents aligned to the same centered 1500px column as main */
  padding: 10px max(20px, calc((100% - 1500px) / 2 + 20px));
  border-bottom: 1px solid var(--border);
  background: var(--bg-pane);
  flex-wrap: wrap;
}
.theme-toggle {
  position: absolute; top: 12px; right: 20px; z-index: 5;
  background: var(--bg-input); color: var(--text); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 12px; font-size: 13px; cursor: pointer;
}
.theme-toggle:hover { border-color: var(--accent-dim); }

/* signed-in chip (left of the theme toggle) */
.user-box {
  position: absolute; top: 12px; right: 110px; z-index: 5;
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-muted);
}
.user-box .btn { padding: 5px 10px; font-size: 12px; }

/* trial-quota chip (BYOK commercial model) */
.trial-chip {
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: rgba(217, 161, 59, 0.15); color: var(--warn);
  border: 1px solid var(--warn); white-space: nowrap;
}
.trial-chip.err { background: rgba(220, 80, 80, 0.15); color: var(--err); border-color: var(--err); }

/* API keys & plan pane */
.key-label { min-width: 110px; }
.num-inp { width: 70px; }

/* inline hint under a form input */
.hint-text { font-size: 12px; margin-top: 4px; line-height: 1.4; }
.hint-text code { background: var(--code); border: 1px solid var(--border);
  border-radius: 4px; padding: 0 4px; font-size: 11.5px; }

/* result-vs-screenshot verification banner */
.verify-ok, .verify-bad { border-radius: 8px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.verify-ok { background: rgba(118,184,42,.12); border: 1px solid var(--green); color: var(--green); }
.verify-bad { background: rgba(224,108,108,.12); border: 1px solid var(--err); color: var(--err); }
.verify-note { margin-top: 5px; font-size: 13px; color: var(--text); opacity: .9; }

/* ---------- auth pages (login / verify / invite) ---------- */
.auth-body {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background: var(--bg); margin: 0;
}
.auth-card {
  background: var(--bg-pane); border: 1px solid var(--border); border-radius: 14px;
  padding: 36px 40px; width: 420px; max-width: 92vw; text-align: center;
  box-shadow: 0 10px 40px rgba(0,0,0,0.35);
}
.auth-logo { height: 84px; margin-bottom: 6px; }
.auth-title { font-size: 22px; margin: 0 0 18px; }
.auth-card input[type="email"] {
  width: 100%; font-size: 15px; padding: 10px 12px; margin: 10px 0 12px; text-align: center;
}
.auth-btn { width: 100%; margin-top: 6px; text-decoration: none; display: inline-block; }
.auth-big { font-size: 42px; margin: 6px 0; }
.auth-link { display: inline-block; margin-top: 12px; }
.auth-card .progress-spinner { margin: 14px auto; }
.auth-card .error-box { margin-top: 14px; }
.brand {
  font-size: 19px; font-weight: 650; letter-spacing: 0.4px;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
}
.brand-logo { height: 90px; width: 95px; border-radius: 8px; }
/* Right of the logo: two stacked lines — title centered on top, menu below. */
.topbar-right {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.page-title {
  margin: 0; font-size: 26px; font-weight: 650; letter-spacing: 0.4px;
  display: flex; align-items: baseline; white-space: nowrap;
  justify-content: flex-start;   /* left, next to the logo */
}
.page-title .brand-sub { font-size: 13px; padding-bottom: 0; }
.brand-core { color: #2b7fd4; }   /* CoreSQL wordmark blue */
.brand-sql  { color: #76b82a; }   /* CoreSQL wordmark green */
.brand-sub {
  font-size: 11.5px; color: var(--text-muted); margin-left: 8px; font-weight: 600;
  letter-spacing: 0.22em; text-transform: uppercase;
}
.project-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.project-bar label { color: var(--text-muted); }
.schema-status { font-size: 12px; color: var(--text-muted); }
.schema-status.ok { color: var(--ok); }
.schema-status.err { color: var(--err); }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 2px;
  padding: 0 max(20px, calc((100% - 1500px) / 2 + 20px));
  background: var(--bg-pane); border-bottom: 1px solid var(--border);
}
.tab {
  background: none; border: none; color: var(--text-muted);
  padding: 10px 16px; cursor: pointer; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

main { padding: 16px 20px 60px; max-width: 1500px; margin: 0 auto; }

/* ---------- panes ---------- */
.pane {
  background: var(--bg-pane);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.pane h2 { margin: 0 0 12px; font-size: 15px; font-weight: 600; }
.pane h3 { margin: 16px 0 8px; font-size: 13px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.split-3 { grid-template-columns: 1fr 1fr 230px; }
@media (max-width: 1200px) { .split-3 { grid-template-columns: 1fr 1fr; } .pane-history { grid-column: 1 / -1; } }
@media (max-width: 1000px) { .split, .split-3 { grid-template-columns: 1fr; } }

/* ---------- execution history ---------- */
.pane-history { min-width: 0; }
.history-toolbar { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.history-search { width: 100%; font-size: 12.5px; padding: 5px 8px; }
.history-actions { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.history-selall { font-size: 12px; }
.history-list {
  list-style: none; margin: 0; padding: 0;
  max-height: 460px; overflow-y: auto;
}
.history-list li {
  border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; margin-bottom: 8px;
  font-size: 12.5px; display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: start;
}
.history-list li .h-check { margin-top: 2px; accent-color: var(--accent); cursor: pointer; }
.history-list li .h-body { cursor: pointer; min-width: 0; }
.history-list li:hover { border-color: var(--accent-dim); }
.history-list li.selected { border-color: var(--accent); background: rgba(77, 159, 255, 0.07); }
.history-list li .h-time { color: var(--text-muted); font-size: 11px; display: flex; justify-content: space-between; }
.history-list li .h-mode { color: var(--accent); font-weight: 600; }
.history-list li .h-prompt {
  margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.history-list li .h-thumb {
  margin-top: 5px; height: 42px; border: 1px solid var(--border); border-radius: 4px;
  cursor: zoom-in; display: block;
}
.history-list li.history-empty { display: block; border: 1px dashed var(--border); cursor: default; }

/* ---------- image lightbox ---------- */
#imageModal { overflow: hidden; }
#imageModalImg {
  max-width: 92vw; max-height: 92vh; border-radius: 8px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5); background: #fff;
  transform-origin: center center; cursor: grab; user-select: none;
  transition: transform 0.05s linear;
}
#imageModalImg.dragging { cursor: grabbing; transition: none; }
.lightbox-toolbar {
  position: fixed; top: 16px; right: 16px; z-index: 30;
  display: flex; align-items: center; gap: 6px;
  background: rgba(20, 24, 30, 0.9); border: 1px solid var(--border);
  border-radius: 8px; padding: 5px 8px; color: #fff;
}
.lightbox-toolbar button {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 5px; min-width: 30px; height: 28px; font-size: 15px; cursor: pointer; padding: 0 8px;
}
.lightbox-toolbar button:hover { background: rgba(255,255,255,0.12); }
.lightbox-toolbar #imgZoomLevel { font-size: 12.5px; min-width: 42px; text-align: center; color: #cdd3da; }
.screenshot-thumb img { cursor: zoom-in; }

/* ---------- progress modal ---------- */
.progress-modal {
  width: 420px; text-align: center; position: relative; overflow: hidden;
  padding: 28px 28px 24px;
}
.progress-logo {
  width: 180px; height: auto; opacity: 0.9;
  border-radius: 10px; margin: 0 auto 14px; display: block;
}
.progress-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 4px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.9s linear infinite; margin: 0 auto 12px;
}
.progress-text { font-size: 15px; margin: 0 0 4px; font-weight: 600; }
.progress-hint { font-size: 12.5px; margin: 0 0 16px; }
.progress-log {
  list-style: none; margin: 6px 0 12px; padding: 8px 10px; text-align: left;
  max-height: 180px; overflow-y: auto; width: 100%;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 6px;
  font-size: 12.5px; font-family: var(--mono);
}
.progress-log li { padding: 2px 0; color: var(--text-muted); }
.progress-log li:last-child { color: var(--text); font-weight: 600; }
.progress-log li::before { content: "› "; color: var(--accent); }

/* ---------- form controls ---------- */
select, input[type="text"], textarea {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 14px;
}
select:focus, input:focus, textarea:focus { outline: none; border-color: var(--accent-dim); }
textarea { width: 100%; resize: vertical; }
textarea.drag-over { border-color: var(--accent); border-style: dashed; background: rgba(77, 159, 255, 0.06); }
.sql-output, .code-block { font-family: var(--mono); font-size: 13px; }
.field-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.field-row label { color: var(--text-muted); }
.grow { flex: 1; min-width: 200px; }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); cursor: pointer; }
.mt { margin-top: 12px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 14px;
  background: var(--bg-input);
  color: var(--text);
}
.btn:hover:not(:disabled) { border-color: var(--accent-dim); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-primary { background: var(--accent-dim); border-color: var(--accent-dim); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.btn-secondary { border-color: var(--accent-dim); color: var(--accent); }
.btn-ghost { background: none; }
.btn-sm { padding: 4px 10px; font-size: 13px; }
.btn-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; }

/* ---------- SQL output ---------- */
.sql-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.feedback-row { margin-left: auto; display: flex; gap: 4px; }
.notes-output { margin-top: 10px; font-size: 13px; }
.notes-output .note-warn { color: var(--warn); }
.notes-output .note-assume { color: var(--text-muted); }
.notes-output ul { margin: 4px 0; padding-left: 20px; }

/* ---------- grids ---------- */
.grid-wrap { overflow-x: auto; max-height: 420px; overflow-y: auto; }
.grid { border-collapse: collapse; width: 100%; font-size: 13px; }
.grid th, .grid td {
  border: 1px solid var(--border);
  padding: 5px 10px;
  text-align: left;
  white-space: nowrap;
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid th { background: var(--bg-input); position: sticky; top: 0; }
.grid td.null { color: var(--text-muted); font-style: italic; }
.grid tr:hover td { background: rgba(77, 159, 255, 0.05); }

.sev-High, .sev-Critical, .sev-Error { color: var(--err); font-weight: 600; }
.sev-Medium, .sev-Warning { color: var(--warn); }
.sev-Low, .sev-Info { color: var(--text-muted); }

/* ---------- boxes ---------- */
.error-box, .warn-box {
  border-radius: 6px; padding: 10px 12px; margin-top: 10px;
  font-size: 13px; white-space: pre-wrap;
}
.error-box { background: rgba(224, 96, 94, 0.1); border: 1px solid var(--err); color: var(--err); }
.warn-box { background: rgba(217, 161, 59, 0.1); border: 1px solid var(--warn); color: var(--warn); }
.hidden { display: none !important; }
.muted { color: var(--text-muted); }

.code-block {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  overflow-x: auto;
  white-space: pre;
}

.diagram-box {
  background: #fff;
  border-radius: 6px;
  padding: 12px;
  min-height: 80px;
  overflow: auto;
}
.diagram-box.muted { background: var(--bg-input); border: 1px dashed var(--border); color: var(--text-muted); }
.diagram-box svg { max-width: 100%; }

/* zoomable / pannable diagram */
.diagram-box { position: relative; }
.diagram-zoom-toolbar {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  display: flex; align-items: center; gap: 5px;
  background: rgba(20, 24, 30, 0.88); border: 1px solid var(--border);
  border-radius: 7px; padding: 4px 7px;
}
.diagram-zoom-toolbar button {
  background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.25);
  border-radius: 4px; min-width: 26px; height: 24px; font-size: 14px; cursor: pointer; padding: 0 7px;
}
.diagram-zoom-toolbar button:hover { background: rgba(255,255,255,0.14); }
.diagram-zoom-toolbar .dz-level { color: #cdd3da; font-size: 12px; min-width: 40px; text-align: center; }
.diagram-viewport {
  overflow: hidden; cursor: grab; height: 100%; min-height: 80px; outline: none;
}
.diagram-viewport.panning { cursor: grabbing; }
.diagram-viewport svg { transition: transform 0.05s linear; }
/* used-table highlight */
.diagram-used rect, .diagram-used path, .diagram-used polygon {
  stroke: #0e8a5f !important; stroke-width: 3px !important;
}
.diagram-used text { fill: #0b6b49 !important; font-weight: 700 !important; }

/* ---------- screenshots ---------- */
.screenshot-zone { margin-top: 10px; }
.file-label {
  display: inline-block; cursor: pointer;
  border: 1px dashed var(--border); border-radius: 6px;
  padding: 6px 12px; color: var(--text-muted);
}
.file-label:hover { border-color: var(--accent-dim); color: var(--text); }
.screenshot-list { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.screenshot-thumb { position: relative; }
.screenshot-thumb img { height: 64px; border-radius: 4px; border: 1px solid var(--border); display: block; }
.screenshot-thumb button {
  position: absolute; top: -6px; right: -6px;
  background: var(--err); color: #fff; border: none; border-radius: 50%;
  width: 18px; height: 18px; font-size: 11px; line-height: 1; cursor: pointer;
}

/* ---------- agent investigation ---------- */
.agent-steps {
  margin-top: 14px; border: 1px solid var(--accent-dim); border-radius: 6px;
  padding: 12px 16px; background: rgba(77, 159, 255, 0.05);
}
.agent-steps h3 { margin: 0 0 8px; font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; }
.agent-steps ol { margin: 0; padding-left: 22px; }
.agent-steps li { margin: 7px 0; font-size: 13.5px; }
.agent-steps li .purpose { font-weight: 600; }
.agent-steps li .outcome { color: var(--text-muted); }
.agent-steps li pre {
  margin: 4px 0 0; padding: 6px 10px; font-size: 12px;
  background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px;
  overflow-x: auto; font-family: var(--mono); white-space: pre-wrap;
}

/* ---------- screenshot confirm modal (spec §11.2) ---------- */
.confirm-modal { width: 720px; max-width: 94vw; }
.confirm-modal h2 { color: var(--warn); }
.confirm-details { max-height: 60vh; overflow-y: auto; margin: 12px 0 16px; padding-right: 6px; }
.confirm-goal { margin: 0 0 12px; }
.confirm-row { margin: 12px 0; }
.confirm-row-title {
  font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; margin-bottom: 5px;
}
.confirm-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.confirm-tags .tag {
  display: inline-block; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 4px; padding: 3px 9px; font-size: 12px; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.confirm-filter-table {
  border-collapse: collapse; width: 100%; font-size: 12.5px; margin: 4px 0 4px;
  table-layout: fixed;
}
.confirm-filter-table td { border: 1px solid var(--border); padding: 5px 9px; vertical-align: top; }
.confirm-filter-table .cf-field { width: 26%; font-weight: 600; color: var(--accent); word-break: break-word; }
.confirm-filter-table .cf-op { width: 10%; color: var(--text-muted); font-family: var(--mono); }
.confirm-filter-table .cf-val {
  font-family: var(--mono); font-size: 12px; word-break: break-word;
  max-height: 90px; overflow: auto; display: block;
}

/* ---------- modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center; z-index: 10;
}
.modal {
  background: var(--bg-pane); border: 1px solid var(--border); border-radius: 10px;
  padding: 20px 24px; width: 560px; max-width: 92vw;
}
.modal h2 { margin: 0 0 16px; font-size: 16px; }
.form-grid { display: grid; grid-template-columns: 140px 1fr; gap: 10px 12px; align-items: center; }
.form-grid > label:not(.check) { color: var(--text-muted); }

/* file drop zone (importer) */
.dropzone {
  border: 2px dashed var(--border); border-radius: 10px; background: var(--bg-input);
  padding: 22px 16px; text-align: center; margin: 6px 0 12px; transition: border-color .12s, background .12s;
}
.dropzone.drag-over { border-color: var(--accent); background: rgba(77, 159, 255, 0.08); }
.dropzone.has-file { border-style: solid; border-color: var(--ok); }
.dropzone .dz-icon { font-size: 26px; color: var(--text-muted); line-height: 1; }
.dropzone .dz-main { margin: 8px 0 4px; font-size: 14px; }
.dropzone .dz-sub { margin: 0; font-size: 12.5px; }
.dropzone.has-file .dz-sub { color: var(--ok); font-weight: 600; }
.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: inherit; text-decoration: underline; padding: 0;
}

.fcp-block { margin: 4px 0 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-input); }
.fcp-layout { width: 100%; font-family: var(--mono); font-size: 12.5px; margin-top: 6px; }
.step2 { margin-top: 22px; padding-top: 16px; border-top: 2px solid var(--border); }
.map-grid select { width: 100%; }
.map-grid .pk { color: var(--accent); font-weight: 700; font-size: 11px; }
.map-grid .req { color: var(--warn); font-size: 11px; }
.map-grid td.miss { background: rgba(224,96,94,0.08); }
.results-bar { display: flex; justify-content: flex-end; margin: 4px 0 2px; }
.info-box {
  border: 1px solid var(--accent); background: rgba(76, 199, 154, 0.08);
  color: var(--text); border-radius: 8px; padding: 10px 14px; margin: 8px 0; font-size: 13.5px;
}
.code-block { position: relative; }
.copy-btn {
  position: absolute; top: 6px; right: 6px; z-index: 2;
  background: rgba(20,24,30,0.85); color: #fff; border: 1px solid var(--border);
  border-radius: 5px; font-size: 11.5px; padding: 3px 9px; cursor: pointer; opacity: 0.75;
}
.copy-btn:hover { opacity: 1; border-color: var(--accent-dim); }
.copy-btn.copied { color: var(--ok); border-color: var(--ok); }

.refine-row { display: flex; gap: 8px; margin-top: 8px; }
.refine-input { flex: 1; font-size: 12.5px; padding: 6px 9px; }
.refine-input:disabled { opacity: 0.5; }

.templates-modal { width: 760px; max-width: 94vw; }
.tpl-body {
  width: 100%; font-family: var(--mono); font-size: 12.5px; line-height: 1.4;
  margin: 10px 0; resize: vertical; min-height: 260px;
}

.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--accent);
  animation: spin 0.8s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 6px 20px; font-size: 12px;
  background: var(--bg-pane); border-top: 1px solid var(--border);
}
.footer a { color: var(--accent); text-decoration: none; }

/* ---------------------------------------------------------------------------
   Migration tab
--------------------------------------------------------------------------- */
.mig-list {
  max-height: 520px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; margin: 10px 0;
}
.mig-group-head {
  display: flex; align-items: center; gap: 8px;
  margin: 10px 0 4px; font-size: 12.5px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px;
}
.mig-group-head:first-child { margin-top: 0; }
.mig-group-head .mig-count { font-weight: 400; text-transform: none; letter-spacing: 0; }
.mig-item {
  display: flex; align-items: center; gap: 8px;
  padding: 3px 4px; border-radius: 4px; cursor: pointer;
}
.mig-item:hover { background: var(--bg-input); }
.mig-item.disabled { opacity: 0.5; cursor: not-allowed; }
.mig-item .mig-detail { margin-left: auto; font-size: 11.5px; color: var(--text-muted); white-space: nowrap; }
.mig-meta { margin-right: auto; }
.mig-results { margin-top: 10px; }
.mig-result {
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; margin-bottom: 12px;
}
.mig-result-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mig-result-head .mig-name { font-weight: 600; }
.mig-result-head .mig-model { font-size: 11.5px; color: var(--text-muted); margin-left: auto; }
/* SSMS-style: wrap long lines to the pane edge — never a horizontal
   scrollbar — and give each query room to breathe vertically. */
.mig-result .code-block {
  max-height: 560px; overflow-y: auto; overflow-x: hidden; margin: 0;
  white-space: pre-wrap; word-break: break-word;
}
.mig-result.failed { border-color: #a33; }
.mig-result .mig-fail { color: #d66; font-size: 12.5px; white-space: pre-wrap; }

/* Migration: collapsible groups + original/translated tabs */
.mig-toggle {
  width: 20px; height: 20px; line-height: 1;
  background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: 4px;
  cursor: pointer; font-size: 13px; padding: 0;
}
.mig-toggle:hover { border-color: var(--accent); }
.mig-group-body { margin-bottom: 4px; }
.mig-tabs { display: flex; gap: 4px; margin: 4px 0 6px; }
.mig-tab {
  background: none; border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); font-size: 12px; padding: 2px 10px; cursor: pointer;
}
.mig-tab.active {
  color: var(--text); border-color: var(--accent);
  background: var(--bg-input); font-weight: 600;
}
.mig-all-row { border-bottom: 1px solid var(--border); padding-bottom: 6px; }

/* Model override knob (topbar) */
.model-knob-label { color: var(--text-muted); font-size: 12.5px; }
.model-knob { max-width: 170px; }
.model-knob-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
