/* ============================================================
   OmniData Django — app.css
   Dark ChatGPT-style UI with Bootstrap 5.3 dark theme
   ============================================================ */

/* ── CSS Variables ─────────────────────────────────────────── */
:root {
  --omni-bg:          #212121;
  --omni-sidebar:     #171717;
  --omni-surface:     #2f2f2f;
  --omni-surface-2:   #3a3a3a;
  --omni-border:      #3f3f3f;
  --omni-text:        #ececec;
  --omni-text-muted:  #8e8ea0;
  --omni-accent:      #10a37f;
  --omni-accent-hover:#0d8f6f;
  --omni-danger:      #ef4444;
  --omni-warning:     #f59e0b;
  --omni-sidebar-w:   260px;
  --omni-input-h:     120px;
  --omni-radius:      12px;
  --omni-radius-sm:   8px;
}

/* ── Base ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  background: var(--omni-bg);
  color: var(--omni-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.omni-body {
  background: var(--omni-bg);
}

/* ── Chat Layout ───────────────────────────────────────────── */
.chat-layout {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}

/* ── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  width: var(--omni-sidebar-w);
  min-width: var(--omni-sidebar-w);
  background: var(--omni-sidebar);
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--omni-border);
  transition: transform 0.25s ease;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 12px 12px;
  border-bottom: 1px solid var(--omni-border);
}

.btn-sidebar-new {
  background: transparent;
  border: 1px solid var(--omni-border);
  color: var(--omni-text);
  border-radius: var(--omni-radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  transition: background 0.15s;
  text-align: left;
}
.btn-sidebar-new:hover {
  background: var(--omni-surface);
  color: var(--omni-text);
}

.sidebar-conv-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--omni-border) transparent;
}

/* ── Conversation items ────────────────────────────────────── */
.conv-group-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--omni-text-muted);
  padding: 12px 8px 4px;
}

.conv-item {
  display: flex;
  align-items: center;
  border-radius: var(--omni-radius-sm);
  margin-bottom: 2px;
  position: relative;
}
.conv-item:hover, .conv-item--active {
  background: var(--omni-surface);
}
.conv-item--active .conv-item-btn {
  color: var(--omni-text);
}

.conv-item-btn {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: none;
  border: none;
  color: var(--omni-text-muted);
  text-align: left;
  font-size: 13.5px;
  cursor: pointer;
  border-radius: var(--omni-radius-sm);
  white-space: nowrap;
  overflow: hidden;
}
.conv-item-btn:hover { color: var(--omni-text); }
.conv-icon { font-size: 12px; flex-shrink: 0; }
.conv-title { overflow: hidden; text-overflow: ellipsis; }

.conv-actions {
  display: none;
  padding-right: 6px;
}
.conv-item:hover .conv-actions { display: flex; }

/* ── Sidebar footer ────────────────────────────────────────── */
.sidebar-footer {
  border-top: 1px solid var(--omni-border);
  padding: 8px;
  position: relative;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--omni-radius-sm);
  cursor: pointer;
  color: var(--omni-text-muted);
  font-size: 13.5px;
  transition: background 0.15s;
}
.sidebar-user:hover {
  background: var(--omni-surface);
  color: var(--omni-text);
}

.user-menu {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 8px;
  right: 8px;
  background: var(--omni-surface-2);
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius-sm);
  padding: 6px;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.user-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--omni-text);
  text-decoration: none;
  font-size: 13.5px;
  cursor: pointer;
  transition: background 0.15s;
}
.user-menu-item:hover { background: var(--omni-surface); color: var(--omni-text); }
.user-menu-item--danger:hover { background: rgba(239,68,68,0.15); color: var(--omni-danger); }
.user-menu-divider { height: 1px; background: var(--omni-border); margin: 4px 0; }

/* ── Avatar ────────────────────────────────────────────────── */
.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--omni-accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.avatar-lg {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--omni-accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 28px;
}

/* ── Main chat area ────────────────────────────────────────── */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.conv-header {
  padding: 12px 24px;
  border-bottom: 1px solid var(--omni-border);
  font-size: 15px;
  color: var(--omni-text-muted);
  background: var(--omni-bg);
  min-height: 48px;
  align-items: center;
}

.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid var(--omni-border);
  background: var(--omni-bg);
}

/* ── Messages container ────────────────────────────────────── */
.messages-container {
  flex: 1;
  overflow-y: auto;
  padding: 24px 0 8px;
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--omni-border) transparent;
}

.message-row {
  display: flex;
  padding: 12px 24px;
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.message-row--user  { justify-content: flex-end; }
.message-row--assistant { justify-content: flex-start; align-items: flex-start; }

/* ── Message bubbles ───────────────────────────────────────── */
.message {
  max-width: 80%;
  border-radius: var(--omni-radius);
  padding: 12px 16px;
  line-height: 1.65;
  font-size: 14.5px;
}
.message--user {
  background: var(--omni-surface);
  color: var(--omni-text);
  border-radius: var(--omni-radius) var(--omni-radius) 4px var(--omni-radius);
}
.message--assistant {
  background: transparent;
  color: var(--omni-text);
  padding: 4px 0;
  max-width: 95%;
}

.assistant-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--omni-accent);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  flex-shrink: 0;
  margin-top: 4px;
}

/* ── Thinking indicator ────────────────────────────────────── */
.thinking {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  background: var(--omni-surface);
  border-radius: var(--omni-radius);
}
.thinking .dot {
  width: 8px; height: 8px;
  background: var(--omni-accent);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.thinking .dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(1); opacity: 0.5; }
  40% { transform: scale(1.3); opacity: 1; }
}

/* ── Input area ────────────────────────────────────────────── */
.input-area {
  padding: 16px 24px 20px;
  background: var(--omni-bg);
  border-top: 1px solid var(--omni-border);
}

.loading-bar {
  height: 3px;
  background: var(--omni-surface);
  border-radius: 2px;
  margin-bottom: 10px;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.2s;
}
.loading-bar.htmx-request { opacity: 1; }

/* Per-answer Cache toggle (templates/chat/partials/_cache_toggle.html):
   busy state while the cache save request is in flight. */
.qcache-save__busy { display: none; align-items: center; gap: 6px; }
.qcache-form.htmx-request .qcache-save__label { display: none; }
.qcache-form.htmx-request .qcache-save__busy { display: inline-flex; }
.qcache-form.htmx-request select,
.qcache:has(.qcache-form.htmx-request) .form-switch { opacity: 0.6; pointer-events: none; }
.loading-bar__fill {
  height: 100%;
  width: 30%;
  background: var(--omni-accent);
  border-radius: 2px;
  animation: loading 1.5s ease-in-out infinite;
}
@keyframes loading {
  0% { transform: translateX(-200%); width: 30%; }
  50% { width: 70%; }
  100% { transform: translateX(350%); width: 30%; }
}

.input-form {
  max-width: 1050px;
  margin: 0 auto;
}

/* The pill-shaped bar itself — now the outer flex row (attach button +
   textarea + send button all share one bar), matching the single-pill
   "GPT style" input rather than two separate boxes side by side. */
.input-bar {
  display: flex;
  align-items: flex-end;
  background: var(--omni-surface);
  border: 1px solid var(--omni-border);
  border-radius: 26px;
  padding: 6px 6px 6px 10px;
  gap: 4px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input-bar:focus-within {
  border-color: var(--omni-accent);
  box-shadow: 0 0 0 3px rgba(16,163,127,0.15);
}

.input-box {
  display: flex;
  align-items: flex-end;
  flex: 1;
  min-width: 0;
  gap: 8px;
  padding: 4px 4px 4px 0;
}

.input-textarea {
  flex: 1;
  background: transparent !important;
  border: none !important;
  color: var(--omni-text) !important;
  resize: none;
  padding: 4px 0;
  font-size: 15px;
  line-height: 1.6;
  min-height: 28px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: none !important;
}
.input-textarea:focus { outline: none; box-shadow: none !important; }
.input-textarea::placeholder { color: var(--omni-text-muted); }

.input-actions { display: flex; align-items: flex-end; padding-bottom: 2px; }

.btn-send {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--omni-surface-2);
  color: var(--omni-text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.btn-send--active {
  background: var(--omni-accent);
  color: white;
}
.btn-send:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-attach {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: none;
  flex-shrink: 0;
  background: transparent;
  color: var(--omni-text-muted);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: background 0.15s, color 0.15s, transform 0.15s;
  cursor: pointer;
  margin-bottom: 2px;
}
.btn-attach i { display: block; transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); }
.btn-attach:hover { background: var(--omni-surface-2); color: var(--omni-text); }
.btn-attach:hover i { transform: scale(1.1); }
.btn-attach.show { background: var(--omni-accent); color: #fff; }
.btn-attach.show i { transform: rotate(45deg); }

/* ── GPT-style floating attach menu ──────────────────────────── */
.attach-menu {
  background: var(--omni-surface-2);
  border: 1px solid var(--omni-border);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.5), 0 2px 8px rgba(0,0,0,0.3);
  min-width: 300px;
  max-width: 340px;
  animation: attachMenuIn 0.16s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.attach-menu.attach-menu--drag-over {
  outline: 2px dashed var(--omni-accent);
  outline-offset: -6px;
}
@keyframes attachMenuIn {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.attach-menu-header {
  font-size: 13px;
  font-weight: 600;
  color: var(--omni-text);
  padding: 6px 10px 8px;
}

.attach-menu-scroll { max-height: 260px; overflow-y: auto; }

/* ── Upload dropzone tile ─────────────────────────────────────── */
.attach-upload-tile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed var(--omni-border);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.attach-upload-tile:hover {
  background: var(--omni-surface);
  border-color: var(--omni-accent);
}
.attach-upload-tile-icon {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--omni-accent) 16%, transparent);
  color: var(--omni-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.attach-upload-tile-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.attach-upload-tile-title { font-size: 14px; font-weight: 500; color: var(--omni-text); }
.attach-upload-tile-sub { font-size: 12px; color: var(--omni-text-muted); }
#attach-file-input { display: none; }

.attach-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-size: 14px;
  color: var(--omni-text);
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
}
.attach-menu-item:hover { background: var(--omni-surface); color: var(--omni-text); }
.attach-menu-item-icon { width: 18px; text-align: center; color: var(--omni-text-muted); flex-shrink: 0; }
.attach-menu-item input[type="file"] { display: none; }
.attach-menu-item--footer { color: var(--omni-text-muted); }
.attach-menu-item--footer:hover { color: var(--omni-text); }
.attach-menu-item-chevron { margin-left: auto; font-size: 12px; opacity: 0.6; }

.attach-menu-divider { height: 1px; background: var(--omni-border); margin: 8px 4px; }

.attach-menu-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--omni-text-muted);
  padding: 8px 10px 6px;
}
.attach-menu-label-count {
  font-size: 11px;
  text-transform: none;
  letter-spacing: normal;
  color: var(--omni-accent);
  background: color-mix(in srgb, var(--omni-accent) 14%, transparent);
  padding: 1px 7px;
  border-radius: 999px;
}

.attach-menu-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 6px;
  padding: 20px 14px;
  font-size: 13px;
  color: var(--omni-text-muted);
  line-height: 1.4;
}
.attach-menu-empty-icon { font-size: 20px; opacity: 0.5; }

.attach-doc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  margin: 0;
}
.attach-doc-row:hover { background: var(--omni-surface); }
.attach-doc-row input[type="checkbox"] {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0; pointer-events: none;
}
.attach-doc-row-icon { color: var(--omni-text-muted); font-size: 15px; flex-shrink: 0; }
.attach-doc-row-label { flex: 1; min-width: 0; font-size: 14px; color: var(--omni-text); }
.attach-doc-row-check {
  opacity: 0;
  transform: scale(0.6);
  color: var(--omni-accent);
  font-size: 16px;
  transition: opacity 0.12s, transform 0.12s;
  flex-shrink: 0;
}
.attach-doc-row input:checked ~ .attach-doc-row-check { opacity: 1; transform: scale(1); }
.attach-doc-row input:checked ~ .attach-doc-row-label { color: var(--omni-text); }

.attach-upload-progress { padding: 10px; }
.attach-upload-progress-row { display: flex; align-items: center; gap: 10px; }
.attach-upload-progress-status { flex-shrink: 0; font-size: 12px; }
.attach-upload-progress-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--omni-border);
  margin-top: 8px;
  overflow: hidden;
}
.attach-upload-progress-bar-fill {
  height: 100%;
  width: 0;
  background: var(--omni-accent);
  border-radius: 2px;
  transition: width 0.2s;
}

.input-hint { font-size: 12px; color: var(--omni-text-muted); }

/* ── Result panels (tabs) ──────────────────────────────────── */
.result-panel {
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius);
  background: var(--omni-surface);
  /* isolation: isolate creates a stacking context so the Plotly chart cannot
     escape visually above the tab navigation row. */
  isolation: isolate;
}

.result-panel-label {
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--omni-text-muted);
  background: var(--omni-surface-2);
  border-bottom: 1px solid var(--omni-border);
}

/* KPI cards — the "just show the number" rendering for a single-row query
   result (chart_data.chart_type == "kpi", result_panel.html) instead of a
   chart nobody asked for. */
.kpi-card {
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius);
  background: var(--omni-surface-2);
  padding: 14px 18px;
  min-width: 140px;
}

.kpi-card-label {
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 4px;
}

.kpi-card-value {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--omni-text);
}

.result-tabs {
  background: var(--omni-surface-2);
  border-bottom: 1px solid var(--omni-border);
  padding: 0 4px;
  flex-wrap: nowrap;
  position: relative;   /* sit above the tab content in the stacking order */
  z-index: 1;
}
.result-tabs .nav-link {
  color: var(--omni-text-muted);
  font-size: 13px;
  padding: 8px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
}
.result-tabs .nav-link.active {
  color: var(--omni-accent);
  background: transparent;
  border-bottom-color: var(--omni-accent);
}
.result-tabs .nav-link:hover:not(.active) {
  color: var(--omni-text);
  background: transparent;
}

.result-tab-content {
  padding: 16px;
  /* Contain the tab panes so no pane content bleeds outside this box.
     position:relative is needed for child tab-pane stacking. */
  position: relative;
  overflow: hidden;
}

/* ── Chart container ───────────────────────────────────────── */
.chart-container {
  border-radius: var(--omni-radius-sm);
  /* position:relative ensures Plotly's absolutely-positioned modebar
     and drag layer are anchored to this container, not a distant ancestor. */
  position: relative;
}
.chart-container .js-plotly-plot {
  border-radius: var(--omni-radius-sm);
}

/* ── SQL block ─────────────────────────────────────────────── */
.sql-block {
  background: #1e1e1e;
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius-sm);
  padding: 14px;
  font-size: 13px;
  overflow-x: auto;
  margin: 0;
}

/* ── Context section ───────────────────────────────────────── */
.context-pre {
  background: #1e1e1e;
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius-sm);
  padding: 12px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  color: var(--omni-text-muted);
}

/* ── NL response (markdown) ────────────────────────────────── */
.nl-response, .md-content, .md-rendered {
  line-height: 1.7;
  font-size: 14.5px;
}
.nl-response p, .md-content p, .md-rendered p { margin-bottom: 0.6em; }
.nl-response ul, .md-content ul, .md-rendered ul,
.nl-response ol, .md-content ol, .md-rendered ol {
  padding-left: 1.4em;
  margin-bottom: 0.6em;
}
.nl-response li, .md-content li, .md-rendered li { margin-bottom: 0.2em; }
.nl-response table, .md-content table, .md-rendered table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 8px 0;
}
.nl-response th, .md-content th, .md-rendered th {
  background: var(--omni-surface-2);
  padding: 6px 10px;
  text-align: left;
  border: 1px solid var(--omni-border);
}
.nl-response td, .md-content td, .md-rendered td {
  padding: 6px 10px;
  border: 1px solid var(--omni-border);
}
.nl-response code, .md-content code, .md-rendered code {
  background: var(--omni-surface-2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 13px;
}
.nl-response pre, .md-content pre, .md-rendered pre {
  background: #1e1e1e;
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius-sm);
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
}
.nl-response pre code, .md-content pre code, .md-rendered pre code {
  background: transparent;
  padding: 0;
  font-size: 13px;
}
.nl-response h1, .nl-response h2, .nl-response h3,
.md-content h1, .md-content h2, .md-content h3,
.md-rendered h1, .md-rendered h2, .md-rendered h3 {
  font-size: 1em;
  font-weight: 600;
  margin: 0.8em 0 0.3em;
}
.nl-response strong, .md-content strong, .md-rendered strong { font-weight: 600; }
.nl-response em, .md-content em, .md-rendered em { font-style: italic; }

/* ── Clarification prompt ──────────────────────────────────── */
.gate-source-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--omni-text-muted);
  font-size: 12px;
  margin-bottom: 8px;
}
.gate-source-badge i { color: var(--omni-accent); }

.clarification-card {
  background: var(--omni-surface);
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius);
  padding: 14px 16px;
  max-width: 560px;
}
.clarification-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--omni-text-muted);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.clarification-card-header i { color: var(--omni-accent); font-size: 15px; }
.clarification-question {
  color: var(--omni-text);
  margin-bottom: 8px;
}
.clarification-question:last-child { margin-bottom: 0; }
.clarification-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.clarification-chips--footer {
  margin-top: 4px;
  margin-bottom: 0;
  padding-top: 10px;
  border-top: 1px solid var(--omni-border);
}
.clarification-chip {
  background: var(--omni-surface-2);
  border: 1px solid var(--omni-border);
  border-radius: 20px;
  color: var(--omni-text);
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  transition: all 0.15s;
}
.clarification-chip:hover {
  background: var(--omni-accent);
  border-color: var(--omni-accent);
  color: #fff;
}
.clarification-chip--muted {
  color: var(--omni-text-muted);
  font-style: italic;
}
.clarification-datasource-choices {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.clarification-datasource-choice {
  background: var(--omni-surface-2);
  border: 1px solid var(--omni-border);
  border-radius: 8px;
  padding: 8px 12px;
}

/* ── Feedback ──────────────────────────────────────────────── */
.message-feedback {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}
.message--assistant:hover .message-feedback { opacity: 1; }

/* ── Button utilities ──────────────────────────────────────── */
.btn-accent {
  background: var(--omni-accent);
  color: white;
  border: none;
}
.btn-accent:hover { background: var(--omni-accent-hover); color: white; }

.btn-ghost {
  background: transparent;
  border: none;
  color: var(--omni-text-muted);
  padding: 4px 8px;
}
.btn-ghost:hover { background: var(--omni-surface); color: var(--omni-text); }

.btn-xs { padding: 2px 6px; font-size: 12px; }

.text-accent { color: var(--omni-accent); }

/* ── Welcome screen ────────────────────────────────────────── */
.welcome-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  min-height: calc(100vh - 200px);
}
.welcome-icon {
  font-size: 48px;
  color: var(--omni-accent);
  margin-bottom: 16px;
}
.welcome-title { font-size: 24px; font-weight: 700; margin-bottom: 8px; }
.welcome-subtitle { color: var(--omni-text-muted); margin-bottom: 32px; }

/* Full example questions, one per row — they're sentences, not short labels. */
.welcome-chips {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 640px;
}
.welcome-chip {
  background: var(--omni-surface);
  border: 1px solid var(--omni-border);
  border-radius: 12px;
  color: var(--omni-text-muted);
  font-size: 13.5px;
  line-height: 1.45;
  padding: 10px 16px;
  text-align: left;
  cursor: pointer;
  transition: all 0.15s;
}
.welcome-chip:hover {
  background: var(--omni-surface-2);
  color: var(--omni-text);
  border-color: var(--omni-accent);
}

/* ── Auth pages ────────────────────────────────────────────── */
.auth-wrapper {
  background: var(--omni-bg);
  min-height: 100vh;
}
.auth-card {
  background: var(--omni-sidebar);
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius);
  padding: 40px;
  width: 100%;
  max-width: 420px;
}
.auth-card--wide { max-width: 520px; }
.brand-icon { color: var(--omni-accent); }

/* ── Settings / Profile pages ──────────────────────────────── */
.settings-layout {
  min-height: 100vh;
  background: var(--omni-bg);
}
.settings-topbar {
  padding: 16px 24px;
  border-bottom: 1px solid var(--omni-border);
  background: var(--omni-sidebar);
}
.settings-content {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ── Settings sidebar shell (category pages) ─────────────────── */
.settings-shell {
  display: flex;
  height: 100dvh;
  overflow: hidden;
}
.settings-scroll {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
}
.settings-scroll .settings-topbar {
  position: sticky;
  top: 0;
  z-index: 10;
}
.sidebar-search {
  padding: 8px 12px 12px;
  border-bottom: 1px solid var(--omni-border);
}
.settings-cat-card {
  transition: border-color 0.15s;
}
.settings-cat-card:hover {
  border-color: var(--omni-accent);
}

/* ── Table overrides ───────────────────────────────────────── */
.table-responsive { max-height: 400px; overflow: auto; }
.table th { position: sticky; top: 0; background: var(--omni-surface-2) !important; z-index: 1; }
/* 2026-09 table-formatting fix: belt-and-suspenders alongside
   chart_service.py::_df_to_html()'s justify="left" — pandas' to_html()
   used to emit an inline style="text-align: right;" on every <thead><tr>
   regardless of column type, while <td> cells got no inline style and
   defaulted left, so headers and body visibly disagreed. justify="left"
   fixes it at the source; this rule just guards against any other render
   path (or a future pandas default change) silently reintroducing it. */
.table-responsive table th, .table-responsive table td { text-align: left; }
/* table-sm's default padding reads cramped compared to the rest of the
   app's spacing — a modest bump without giving up the compact density. */
.table-responsive .table-sm td, .table-responsive .table-sm th { padding: 0.35rem 0.6rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 991px) {
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    transform: translateX(-100%);
  }
  .sidebar--open { transform: translateX(0); }
  .message { max-width: 95%; }
  .message-row { padding: 10px 12px; }
}

[x-cloak] { display: none !important; }

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

/* ── Schema Graph page ────────────────────────────────────── */
.schema-graph-content {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px;
}
.schema-graph-canvas {
  position: relative;
  width: 100%;
  background: var(--omni-bg);
  border: 1px solid var(--omni-border);
  border-radius: var(--omni-radius-sm);
}
.schema-graph-canvas--detail {
  height: calc(100vh - 260px);
  min-height: 420px;
}
.schema-graph-canvas--panel {
  height: 340px;
}
.schema-graph-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 16px;
}
.schema-graph-panel .card-header {
  font-size: 0.9rem;
}
.schema-graph-legend-swatch {
  display: inline-block;
  width: 22px;
  height: 0;
  border-top: 3px solid;
  margin-right: 4px;
  vertical-align: middle;
}
.schema-graph-legend-swatch--declared {
  border-top-style: solid;
  border-top-color: var(--omni-accent);
}
.schema-graph-legend-swatch--inferred {
  border-top-style: dashed;
  border-top-color: var(--omni-warning);
}
.schema-graph-legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 4px;
  vertical-align: middle;
}
.schema-graph-legend-dot--fact { background: #4c8bf5; }
.schema-graph-legend-dot--dimension { background: #2fb787; }
.schema-graph-legend-dot--isolated { background: #4c8bf5; opacity: 0.45; }
.schema-graph-legend-dot--column-pk { background: #ffd166; }
.schema-graph-legend-dot--column-fk { background: #f59e0b; }
.schema-graph-legend-dot--column-plain { background: #9aa0ab; }

.schema-graph-label-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.schema-graph-node-label {
  position: absolute;
  top: 0;
  left: 0;
  transform: translate(-50%, 6px);
  font-size: 10px;
  line-height: 1.2;
  color: #ececec;
  text-shadow: 0 1px 2px rgba(0,0,0,0.9), 0 0 4px rgba(0,0,0,0.6);
  white-space: nowrap;
  will-change: transform, opacity;
}
.schema-graph-node-label--panel {
  font-size: 8px;
}
