/* llmchat.css - LLM playground column.
 *
 * Uses the dashboard's OWN variables. The first version invented --panel2 with a dark fallback,
 * and since this console is a light theme the fallback applied: #171a21 panels under --ink text,
 * i.e. black on black. Every colour below resolves to a variable that actually exists in
 * styles.css :root, and text colour is stated rather than inherited.
 */

/* .kb-app is `display:grid; grid-template-columns:300px 1fr`. A third child in a two-track grid
   wraps onto its own row, so the grid gains a track - only while this column is mounted. */
.kb-app.has-lc { grid-template-columns: 400px 300px 1fr; }
@media (max-width: 1400px) { .kb-app.has-lc { grid-template-columns: 350px 280px 1fr; } }
@media (max-width: 1100px) { .kb-app.has-lc { grid-template-columns: 1fr; } }

.lc-col {
  position: sticky; top: 12px; height: calc(100vh - 24px);
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow);
  overflow: hidden; display: flex; flex-direction: column;
}
@media (max-width: 1100px) { .lc-col { position: static; height: auto; max-height: 80vh; } }

/* Expanded: 90% of the viewport, over everything, with a backdrop. Fixed positioning takes it out
   of the grid entirely, so the layout underneath is undisturbed while it is open. */
.lc-col.lc-max {
  position: fixed; inset: 5vh 5vw; width: auto; height: auto; max-height: none;
  z-index: 1000; box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
}
.lc-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .38); z-index: 999; }

.lc-wrap { display: flex; flex-direction: column; height: 100%; min-height: 0; flex: 1 1 auto; }
/* The panes sit between the bounded column and the scrollers. Without min-height:0 here
   the chain breaks at this level and neither scroller can shrink. */
#lc-pane-chat, #lc-pane-set { display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0; overflow: hidden; }

.lc-head { padding: 13px 15px 11px; border-bottom: 1px solid var(--line); flex: 0 0 auto; position: relative; }
.lc-title { font-weight: 600; font-size: 15px; letter-spacing: -.02em; color: var(--ink); }
.lc-sub { color: var(--faint); font-size: 12px; margin-top: 2px; }
.lc-tabs { display: flex; gap: 6px; margin-top: 10px; }
.lc-tab { background: var(--surface-2); border: 1px solid var(--line); color: var(--sub);
  border-radius: 8px; padding: 5px 13px; font-size: 12.5px; font-weight: 550; }
.lc-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* expand / collapse */
.lc-exp { position: absolute; top: 12px; right: 13px; width: 28px; height: 28px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--sub);
  border-radius: 8px; display: grid; place-items: center; padding: 0; }
.lc-exp:hover { color: var(--ink); border-color: rgba(0, 0, 0, .16); }

.lc-thread { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 15px; min-height: 0; }
.lc-empty { color: var(--faint); font-size: 13px; line-height: 1.6; padding: 16px 2px; }

.lc-msg { margin-bottom: 16px; }
.lc-who { font-size: 10px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint); font-weight: 700; margin-bottom: 5px; }
.lc-body { font-size: 13.5px; line-height: 1.62; color: var(--ink); }
.lc-u .lc-body { background: var(--surface-2); border-left: 2px solid var(--accent);
  padding: 9px 11px; border-radius: 0 10px 10px 0; white-space: pre-wrap; }
.lc-e .lc-body { color: #B3261E; background: rgba(255, 59, 48, .07);
  border-left: 2px solid var(--red); padding: 9px 11px; border-radius: 0 10px 10px 0; }
.lc-meta { font-size: 11px; color: var(--faint); margin-top: 7px; font-variant-numeric: tabular-nums; }

/* rendered markdown */
.lc-md .lc-h { margin: 14px 0 6px; font-weight: 600; line-height: 1.35; letter-spacing: -.015em; color: var(--ink); }
.lc-md h1.lc-h { font-size: 17px; } .lc-md h2.lc-h { font-size: 15.5px; }
.lc-md h3.lc-h { font-size: 14px; } .lc-md h4.lc-h, .lc-md h5.lc-h, .lc-md h6.lc-h { font-size: 13px; }
.lc-md .lc-p { margin: 0 0 10px; }
.lc-md .lc-list { margin: 0 0 10px; padding-left: 21px; }
.lc-md .lc-list li { margin-bottom: 4px; }
.lc-md .lc-q { margin: 0 0 10px; padding: 7px 11px; border-left: 2px solid var(--line); color: var(--sub); }
.lc-md .lc-hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
.lc-md .lc-code { background: var(--surface-2); border: 1px solid var(--line-2);
  padding: 1px 5px; border-radius: 5px; font-size: 12.5px; font-family: var(--mono); color: var(--ink); }
.lc-md .lc-pre { background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 11px 13px; overflow-x: auto; margin: 0 0 10px; }
.lc-md .lc-pre code { font-family: var(--mono); font-size: 12px; line-height: 1.55; color: var(--ink); }
.lc-md .lc-tab { width: 100%; border-collapse: collapse; margin: 0 0 11px;
  font-size: 12.5px; display: block; overflow-x: auto; }
.lc-md .lc-tab th, .lc-md .lc-tab td { border: 1px solid var(--line); padding: 6px 9px;
  text-align: left; vertical-align: top; color: var(--ink); }
.lc-md .lc-tab th { background: var(--surface-2); font-weight: 600; }
.lc-md a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

.lc-web { margin-top: 9px; font-size: 12px; }
.lc-web summary { cursor: pointer; color: var(--faint); }
.lc-web ul { margin: 7px 0 0; padding-left: 17px; }
.lc-web li { margin-bottom: 4px; line-height: 1.5; color: var(--sub); }
.lc-web a { color: var(--accent); }
.lc-web .lc-bad { color: var(--red); }

.lc-compose { border-top: 1px solid var(--line); padding: 11px 13px; flex: 0 0 auto; background: var(--surface); }

/* Inputs: explicit surface AND explicit ink. Inheriting one but not the other is what produced
   dark text on a dark panel in the first version. */
.lc-in, .lc-sys, .lc-mini {
  width: 100%; background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
  font-family: var(--font); font-size: 13px; line-height: 1.5;
  resize: vertical; box-sizing: border-box;
}
.lc-in::placeholder, .lc-sys::placeholder, .lc-mini::placeholder { color: var(--faint); }
.lc-in:focus, .lc-sys:focus, .lc-mini:focus { outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(59, 110, 246, .12); }
.lc-sys { min-height: 300px; font-family: var(--mono); font-size: 12px; }
.lc-col.lc-max .lc-sys { min-height: 46vh; }
.lc-mini { font-family: var(--mono); font-size: 12.5px; }

.lc-row { display: flex; align-items: center; gap: 9px; margin-top: 9px; }
.lc-sp { flex: 1 1 auto; }
.lc-chk { font-size: 12px; color: var(--sub); display: flex; align-items: center; gap: 7px; cursor: pointer; }
.lc-btn { border-radius: 9px; padding: 7px 15px; font-size: 13px; font-weight: 550;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.lc-ghost { color: var(--sub); }
.lc-ghost:hover { color: var(--ink); }
.lc-go { background: var(--accent); border-color: var(--accent); color: #fff; }
.lc-go:disabled { opacity: .55; cursor: default; }

.lc-set { padding: 13px 15px; overflow-y: auto; overscroll-behavior: contain;
  flex: 1 1 auto; min-height: 0; }
.lc-lbl { display: block; font-size: 12px; color: var(--sub); margin: 11px 0 6px; line-height: 1.45; }
.lc-count { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.lc-note { margin-top: 15px; font-size: 12px; color: var(--faint); line-height: 1.55;
  border-left: 2px solid var(--line); padding-left: 11px; }
