/* ==========================================================================
   NuvaKit Ask Data — application styles
   Brand: accent #3C8CF0 · ink #0E1116 · Archivo / IBM Plex Mono
   ========================================================================== */

/* ---------- tokens ---------- */
:root {
  --accent: #3C8CF0;
  --accent-hover: #2B7BE0;
  --accent-soft: rgba(60, 140, 240, 0.10);
  --accent-soft-2: rgba(60, 140, 240, 0.18);
  --ink: #0E1116;
  --green: #2E9E6B;
  --amber: #C08A2D;
  --red: #D4553F;
  --radius: 10px;
  --radius-sm: 7px;
  --font: 'Archivo', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --side-w: 264px;
  --rail-w: 304px;
}

[data-theme="light"] {
  --bg: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #EFF2F6;
  --surface-3: #E7EBF0;
  --border: #E3E7EC;
  --border-strong: #D3D9E0;
  --text: #161B22;
  --muted: #59626E;
  --faint: #8792A0;
  --shadow: 0 1px 2px rgba(14,17,22,.05), 0 8px 24px rgba(14,17,22,.06);
  --code-bg: #0E1116;
  --code-text: #D7DEE7;
}

[data-theme="dark"] {
  --bg: #0E1116;
  --surface: #151B23;
  --surface-2: #1B222C;
  --surface-3: #222B36;
  --border: #232C37;
  --border-strong: #303B48;
  --text: #E7ECF1;
  --muted: #A6B0BC;
  --faint: #66717F;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35);
  --code-bg: #0A0D11;
  --code-text: #D7DEE7;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font-family: var(--font); cursor: pointer; }
input, textarea, select { font-family: var(--font); color: var(--text); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.pad { padding: 14px; }
::selection { background: var(--accent-soft-2); }

/* scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- app grid ---------- */
#app {
  display: grid;
  grid-template-columns: var(--side-w) 1fr auto;
  height: 100vh;
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text);
  font-size: 13.5px; font-weight: 600; padding: 8px 14px;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.btn-ghost { background: transparent; }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn-sm { padding: 4px 10px; font-size: 12.5px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 15px;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
#sidebar {
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  min-height: 0;
}
.side-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; }
.side-logo { border-radius: 7px; flex: none; }
.side-title { display: flex; flex-direction: column; line-height: 1.15; }
.side-brand { font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--faint); font-family: var(--mono); }
.side-product { font-size: 16px; font-weight: 800; letter-spacing: -0.01em; }
.side-close { margin-left: auto; display: none; }

.side-new { margin: 4px 14px 14px; }
.side-new .plus { font-size: 16px; font-weight: 700; }

.side-section { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 0 8px; }
.side-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: .14em;
  text-transform: uppercase; color: var(--faint); padding: 6px 10px;
}
.history-list { overflow-y: auto; min-height: 0; padding-bottom: 8px; }
.history-empty { color: var(--faint); font-size: 13px; padding: 6px 10px; }
.history-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left; border: 0; background: transparent; color: var(--text);
  padding: 7px 10px; border-radius: var(--radius-sm); font-size: 13.5px;
}
.history-item:hover { background: var(--surface-2); }
.history-item .h-q { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .h-mode { font-family: var(--mono); font-size: 9.5px; color: var(--faint); border: 1px solid var(--border); border-radius: 4px; padding: 1px 4px; flex: none; }
.history-item .h-del { visibility: hidden; color: var(--faint); border: 0; background: none; font-size: 12px; padding: 0 2px; }
.history-item:hover .h-del { visibility: visible; }
.history-item .h-del:hover { color: var(--red); }

.side-nav { display: flex; flex-direction: column; gap: 2px; padding: 10px 8px; border-top: 1px solid var(--border); }
.side-nav-item {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 10px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; text-align: left;
}
.side-nav-item:hover { background: var(--surface-2); color: var(--text); }
.side-nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-ico { width: 18px; text-align: center; }

.side-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 999px; padding: 4px 10px;
}
.status-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.status-pill.ok .dot { background: var(--green); }
.status-pill.warn .dot { background: var(--amber); }
.status-pill.err .dot { background: var(--red); }
.side-ver { font-family: var(--mono); font-size: 10px; color: var(--faint); }

/* ==========================================================================
   MAIN COLUMN
   ========================================================================== */
#mainwrap { display: flex; flex-direction: column; min-width: 0; min-height: 0; }

#topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
#btn-burger { display: none; }
.top-title { margin: 0; font-size: 15.5px; font-weight: 700; letter-spacing: -0.01em; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-actions { display: flex; gap: 4px; }

#main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; }

/* ---------- thread ---------- */
.thread {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 26px 26px 10px;
  display: flex; flex-direction: column; gap: 20px;
  scroll-behavior: smooth;
}

/* empty state */
.empty {
  margin: auto; max-width: 620px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 30px 10px;
}
.empty img { width: 52px; height: 52px; border-radius: 12px; }
.empty h2 { margin: 6px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.empty p { margin: 0; color: var(--muted); font-size: 15px; max-width: 480px; }
.empty .chips { margin-top: 8px; }
.empty-actions { display: flex; gap: 10px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 500;
  transition: border-color .12s, color .12s, background .12s;
}
.chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---------- question card ---------- */
.qcard {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: cardIn .25s ease;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.q-head { display: flex; align-items: flex-start; gap: 12px; padding: 15px 18px 13px; }
.q-avatar {
  width: 30px; height: 30px; border-radius: 8px; flex: none;
  background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px;
}
.q-text { flex: 1; font-size: 15.5px; font-weight: 650; letter-spacing: -0.005em; word-break: break-word; }
.q-meta { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 11.5px; font-family: var(--mono); flex: none; padding-top: 3px; }
.q-actions { display: flex; gap: 2px; flex: none; }

/* stages */
.stage { border-top: 1px solid var(--border); }
.stage-head {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px; font-size: 12px; font-weight: 600; color: var(--muted);
  font-family: var(--mono); letter-spacing: .08em; text-transform: uppercase;
  user-select: none;
}
.stage-head .st-toggle { margin-left: auto; color: var(--faint); border: 0; background: none; font-size: 11px; }
.stage-head .st-toggle:hover { color: var(--accent); }
.stage-body { padding: 0 18px 16px; }
.stage.collapsed .stage-body { display: none; }

.st-ico { width: 15px; height: 15px; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.st-ico.spin::after {
  content: ""; width: 11px; height: 11px; border-radius: 50%;
  border: 2px solid var(--accent-soft-2); border-top-color: var(--accent);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.st-ico.ok { color: var(--green); }
.st-ico.err { color: var(--red); }

.stage-error {
  background: color-mix(in srgb, var(--red) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 10px 12px; font-size: 13px;
  display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap;
}
.stage-error .err-msg { flex: 1; min-width: 200px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-word; }

/* SQL block */
.sqlbox { position: relative; }
.sqlbox pre {
  margin: 0; background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius-sm); padding: 14px 16px;
  font-family: var(--mono); font-size: 12.75px; line-height: 1.55;
  overflow-x: auto; white-space: pre;
}
.sql-toolbar { position: absolute; top: 8px; right: 8px; display: flex; gap: 4px; }
.sql-toolbar .icon-btn { width: 28px; height: 28px; font-size: 12.5px; background: rgba(255,255,255,.06); color: #A9B4C0; }
.sql-toolbar .icon-btn:hover { background: rgba(255,255,255,.14); color: #fff; }
.tk-kw { color: #6FB3FF; font-weight: 600; }
.tk-fn { color: #C792EA; }
.tk-str { color: #8BD5A0; }
.tk-num { color: #F0B860; }
.tk-com { color: #5C6773; font-style: italic; }

.sql-edit textarea {
  width: 100%; min-height: 120px; resize: vertical;
  background: var(--code-bg); color: var(--code-text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 12.75px; line-height: 1.55; padding: 12px 14px;
}
.sql-edit textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.sql-edit-actions { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.sql-edit-hint { color: var(--faint); font-size: 11.5px; font-family: var(--mono); margin-left: auto; }

/* results table */
.res-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.res-count { color: var(--muted); font-size: 12.5px; font-family: var(--mono); }
.res-filter {
  border: 1px solid var(--border); background: var(--bg); border-radius: var(--radius-sm);
  font-size: 13px; padding: 5px 10px; width: 180px;
}
.res-filter:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.res-spacer { flex: 1; }
.res-toolbar .btn-sm { font-weight: 500; }

.tablewrap { overflow: auto; max-height: 420px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.res {
  border-collapse: collapse; width: 100%; font-size: 13px;
}
table.res th {
  position: sticky; top: 0; z-index: 1;
  background: var(--surface-2); color: var(--muted);
  text-align: left; font-weight: 650; font-size: 12px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  cursor: pointer; user-select: none; white-space: nowrap;
}
table.res th:hover { color: var(--accent); }
table.res th .arrow { font-size: 10px; margin-left: 4px; }
table.res td {
  padding: 7px 12px; border-bottom: 1px solid var(--border);
  white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis;
}
table.res td.num { font-family: var(--mono); font-size: 12.25px; text-align: right; }
table.res td.null { color: var(--faint); font-style: italic; }
table.res tr:hover td { background: var(--accent-soft); }
.res-pager { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.res-pager button { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 3px 10px; color: var(--text); font-size: 12.5px; }
.res-pager button:disabled { opacity: .4; }

/* chart */
.chart-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 4px 12px; font-size: 12.5px; font-weight: 600;
}
.chart-tab:hover { border-color: var(--accent); color: var(--accent); }
.chart-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.plotbox { min-height: 120px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px; }
.plot-note { color: var(--faint); font-size: 12.5px; padding: 14px; text-align: center; }

/* followups */
.follow-chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- ask bar ---------- */
#askbar { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 22px 9px; }
.askbar-inner {
  display: flex; align-items: flex-end; gap: 10px;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 8px 10px;
  transition: border-color .12s, box-shadow .12s;
}
.askbar-inner:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.mode-toggle { display: flex; background: var(--surface-2); border-radius: 8px; padding: 2px; flex: none; margin-bottom: 2px; }
.mode-btn {
  border: 0; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 700; padding: 5px 12px; border-radius: 6px;
}
.mode-btn.active { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(14,17,22,.1); }
#ask-input {
  flex: 1; border: 0; background: transparent; resize: none;
  font-size: 14.5px; line-height: 1.45; padding: 7px 4px; max-height: 180px;
  outline: none;
}
#ask-input.sql-mode { font-family: var(--mono); font-size: 13px; }
#btn-ask { flex: none; margin-bottom: 1px; }
.askbar-hint { color: var(--faint); font-size: 11px; font-family: var(--mono); padding: 6px 4px 0; text-align: center; }

/* ==========================================================================
   TRAINING VIEW
   ========================================================================== */
.train-wrap {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: minmax(300px, 420px) 1fr; gap: 22px;
  padding: 26px;
  align-items: start;
}
.train-col h2 { margin: 0 0 4px; font-size: 18px; font-weight: 750; letter-spacing: -0.01em; }
.train-form-col p { margin: 0 0 14px; font-size: 13.5px; }
.train-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.train-tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 999px; padding: 5px 13px; font-size: 12.5px; font-weight: 600;
}
.train-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.train-form { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.train-form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 650; color: var(--muted); }
.train-form input, .train-form textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg);
  padding: 8px 10px; font-size: 13.5px;
}
.train-form textarea { font-family: var(--mono); font-size: 12.5px; resize: vertical; }
.train-form input:focus, .train-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.train-form .btn { align-self: flex-start; }

.train-data-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.training-table { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.tr-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.tr-row:last-child { border-bottom: 0; }
.tr-type {
  flex: none; font-family: var(--mono); font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  border-radius: 5px; padding: 3px 7px; margin-top: 2px;
  background: var(--accent-soft); color: var(--accent);
}
.tr-type.ddl { background: color-mix(in srgb, var(--amber) 14%, transparent); color: var(--amber); }
.tr-type.doc { background: color-mix(in srgb, var(--green) 14%, transparent); color: var(--green); }
.tr-content { flex: 1; min-width: 0; }
.tr-q { font-weight: 650; font-size: 13.5px; margin-bottom: 3px; }
.tr-body { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: pre-wrap; word-break: break-word; max-height: 90px; overflow: hidden; }
.tr-del { flex: none; }

.notice {
  border: 1px solid color-mix(in srgb, var(--amber) 35%, transparent);
  background: color-mix(in srgb, var(--amber) 9%, transparent);
  border-radius: var(--radius-sm); padding: 10px 13px; font-size: 13px; margin-top: 14px;
}

/* ==========================================================================
   SCHEMA RAIL
   ========================================================================== */
#rail {
  width: var(--rail-w);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border);
  min-height: 0;
}
body.rail-closed #rail { display: none; }
.rail-head { display: flex; align-items: center; gap: 8px; padding: 14px 14px 10px; }
.rail-title { font-size: 14px; font-weight: 750; }
.rail-meta { font-family: var(--mono); font-size: 10.5px; color: var(--faint); flex: 1; }
#schema-filter {
  margin: 0 14px 10px; border: 1px solid var(--border); background: var(--bg);
  border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px;
}
#schema-filter:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.schema-tree { flex: 1; overflow-y: auto; min-height: 0; padding: 0 8px 14px; }
.sch-table { margin-bottom: 2px; }
.sch-table-head {
  display: flex; align-items: center; gap: 7px; width: 100%;
  border: 0; background: transparent; color: var(--text); text-align: left;
  padding: 6px 8px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 650;
}
.sch-table-head:hover { background: var(--surface-2); }
.sch-caret { font-size: 9px; color: var(--faint); width: 10px; transition: transform .12s; }
.sch-table.open .sch-caret { transform: rotate(90deg); }
.sch-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sch-count { font-family: var(--mono); font-size: 10px; color: var(--faint); }
.sch-cols { display: none; padding: 2px 0 6px 24px; }
.sch-table.open .sch-cols { display: block; }
.sch-col {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; text-align: left; color: var(--muted);
  padding: 3px 8px; border-radius: 5px; font-size: 12.5px;
}
.sch-col:hover { background: var(--accent-soft); color: var(--accent); }
.sch-col .c-type { margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--faint); text-transform: lowercase; }
.sch-col .c-pk { font-size: 9px; color: var(--amber); }
.sch-actions { display: flex; gap: 6px; padding: 4px 8px 2px 24px; }

/* ==========================================================================
   OVERLAYS
   ========================================================================== */
.overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 13, 17, .45);
  display: flex; align-items: flex-start; justify-content: center;
  backdrop-filter: blur(2px);
}
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(10,13,17,.4); display: none; }

/* palette */
.palette-box {
  margin-top: 12vh; width: min(560px, 92vw);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden;
  animation: cardIn .15s ease;
}
#palette-input {
  width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent;
  font-size: 15px; padding: 15px 18px; outline: none;
}
.palette-list { max-height: 320px; overflow-y: auto; padding: 6px; }
.palette-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: transparent; color: var(--text); text-align: left;
  padding: 9px 12px; border-radius: var(--radius-sm); font-size: 13.5px;
}
.palette-item.sel, .palette-item:hover { background: var(--accent-soft); color: var(--accent); }
.palette-item .p-ico { width: 20px; text-align: center; flex: none; }
.palette-item .p-kbd { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--faint); }

/* modal */
.modal-box {
  margin-top: 9vh; width: min(860px, 94vw); max-height: 80vh;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
  animation: cardIn .15s ease;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 18px; border-bottom: 1px solid var(--border);
  font-weight: 750; font-size: 15px;
}
.modal-body { padding: 16px 18px; overflow: auto; }

/* toasts */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--ink); color: #E7ECF1; border-radius: 9px;
  padding: 10px 16px; font-size: 13px; font-weight: 550;
  box-shadow: 0 6px 20px rgba(0,0,0,.35);
  display: flex; align-items: center; gap: 9px;
  animation: cardIn .18s ease;
}
.toast.err { background: #3A1712; color: #F4B9AC; border: 1px solid rgba(212,85,63,.4); }
.toast.ok::before { content: "✓"; color: var(--green); font-weight: 800; }

/* keyless banner */
.keyless {
  margin: 18px 26px 0; padding: 11px 16px;
  border: 1px solid color-mix(in srgb, var(--amber) 40%, transparent);
  background: color-mix(in srgb, var(--amber) 10%, transparent);
  border-radius: var(--radius); font-size: 13px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.keyless b { font-weight: 750; }
.keyless .spacer { flex: 1; }
.keyless code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border-radius: 4px; padding: 1px 6px; }

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 1180px) {
  #app { grid-template-columns: var(--side-w) 1fr; }
  #rail {
    position: fixed; top: 0; right: 0; bottom: 0; z-index: 50;
    box-shadow: -12px 0 30px rgba(0,0,0,.15);
  }
  body.rail-closed #rail { display: none; }
  body:not(.rail-closed) #rail-scrim { display: block; }
}
@media (max-width: 860px) {
  #app { grid-template-columns: 1fr; }
  #sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 55; width: var(--side-w);
    transform: translateX(-100%); transition: transform .18s ease;
  }
  body.side-open #sidebar { transform: none; box-shadow: 12px 0 30px rgba(0,0,0,.2); }
  body.side-open #side-scrim { display: block; z-index: 52; }
  #btn-burger { display: inline-flex; }
  .side-close { display: inline-flex; }
  .thread { padding: 16px 12px 8px; }
  #askbar { padding: 10px 12px 8px; }
  .train-wrap { grid-template-columns: 1fr; }
  .q-meta { display: none; }
}
