/*
 * TASK-UI-01: the approved three-region student product shell
 * (conversations / chat / sources), replacing the earlier single-column
 * technical-shell layout. TASK-14 §7 "14.7 Accessibility/responsiveness"
 * and "14.6 Print/save" still govern everything below:
 *
 * - one layout that works from a 320px phone (single column, panels as
 *   drawers) up through a desktop three-column layout, no horizontal
 *   scrolling of the page body;
 * - system light/dark preference honoured (`prefers-color-scheme`), and
 *   `prefers-reduced-motion` respected;
 * - focus is always visible; nothing important is hover-only (source
 *   panels are <details>, operable by keyboard and touch);
 * - a print stylesheet that drops the composer/sidebars/controls and
 *   keeps the conversation, its ID, and version metadata.
 *
 * Visual language: white/light-neutral surfaces, navy/blue institutional
 * accents, restrained shadows, no gradients or glassmorphism — an
 * academic study tool, not a consumer chatbot or a startup landing page.
 */

:root {
  color-scheme: light dark;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-sunken: #eef1f8;
  --fg: #15202b;
  --muted: #5b6675;
  --line: #dbe1ec;
  --line-strong: #c2cbdc;
  --user-bg: #eef2fb;
  --assistant-bg: #ffffff;
  --navy: #0f2d52;
  --accent: #2f5fd0;
  --accent-fg: #ffffff;
  --accent-soft: #e8eefb;
  --error-fg: #8a1220;
  --error-bg: #fdecee;
  --error-line: #f3c6cb;
  --focus: #2f5fd0;
  --radius: 10px;
  --radius-lg: 14px;
  --sidebar-w: 264px;
  --sources-w: 300px;
  --header-h: 3.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1319;
    --surface: #161b22;
    --surface-sunken: #1b212a;
    --fg: #e7ecf3;
    --muted: #99a3b2;
    --line: #2a323d;
    --line-strong: #3a4552;
    --user-bg: #1c2636;
    --assistant-bg: #161b22;
    --navy: #cfe0ff;
    --accent: #7fa4f0;
    --accent-fg: #0b1220;
    --accent-soft: #1c2740;
    --error-fg: #ffb3ba;
    --error-bg: #3a1c20;
    --error-line: #5a2a30;
    --focus: #7fa4f0;
  }
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 1rem/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 0.5rem;
  z-index: 100;
  background: var(--surface);
  padding: 0.5rem 0.75rem;
  border: 2px solid var(--focus);
  border-radius: var(--radius);
}

button {
  font: inherit;
  color: var(--fg);
  cursor: pointer;
}
button[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ------------------------------------------------------------- shell -- */

.app-shell {
  display: grid;
  grid-template-columns: 1fr;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

.panel {
  background: var(--surface);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* Author rules normally beat the UA `[hidden]{display:none}` rule
 * regardless of specificity/order (different cascade origins), so the
 * unconditional `display: flex` above would otherwise defeat `hidden` —
 * this restores it. Higher-specificity than plain `.panel`, so it wins
 * outside the desktop override below (which uses `!important` and so
 * wins again there). */
.panel[hidden] {
  display: none;
}

/* --------------------------------------------------- conversations -- */

.panel-conversations {
  border-right: 1px solid var(--line);
  padding: 1.1rem 0.9rem;
  gap: 0.9rem;
  overflow-y: auto;
}

.brand-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.01em;
}

/* TASK-UI-01 final polish §3/§4: EN | PT, restrained enough to sit
 * directly under the brand without reading as a settings panel. */
.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  overflow: hidden;
  width: fit-content;
}
.lang-toggle-btn {
  padding: 0.3rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--surface);
  color: var(--muted);
  border: none;
}
.lang-toggle-btn + .lang-toggle-btn { border-left: 1px solid var(--line-strong); }
.lang-toggle-btn[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent);
}
.lang-toggle-btn:hover { color: var(--fg); }
.lang-toggle-btn[aria-pressed="true"]:hover { color: var(--accent); }

.new-conversation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  padding: 0.65rem 0.9rem;
  min-height: 44px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}
.new-conversation:hover { filter: brightness(1.06); }

.conversations-heading {
  margin-top: 0.25rem;
}
.conversations-heading h2 {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.scope-note {
  margin: 0.15rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

.conversation-list {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.conversation-item { margin: 0; }
.conversation-item-button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
}
.conversation-item-button:hover { background: var(--surface-sunken); }
.conversation-item-button[aria-current="true"] {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.conversation-item-title {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.conversation-item-time {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.76rem;
  color: var(--muted);
}
.conversation-list-empty {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* --------------------------------------------------------- chat col -- */

.chat-column {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: var(--header-h);
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.chat-header-title { flex: 1; min-width: 0; }
/* TASK-UI-01 final polish §9: exactly one of these two is ever visible
 * -- the desktop media query below flips which. Below desktop, the
 * sidebar carrying "ChatDECIDES" is a closed drawer, so the header
 * shows the brand; at desktop, the sidebar's own brand is always on
 * screen, so the header shows the current conversation instead, never
 * a second "ChatDECIDES". */
.chat-header-brand {
  margin: 0;
  font-weight: 700;
  color: var(--navy);
  font-size: 1rem;
}
.chat-header-conversation {
  display: none;
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--fg);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.panel-toggle {
  display: none;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 0.6rem;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.85rem;
}
.panel-toggle:hover { border-color: var(--accent); }

/* TASK-UI-01 §8: demoted to a small, restrained icon action — never a
 * text-labeled peer of "+ New conversation" — so it also never competes
 * for space in the header at narrow widths (a text label here was
 * previously wide enough to clip the "DECIDES" wordmark on a phone). */
.secondary-action {
  flex: none;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 1.05rem;
}
.secondary-action:hover { border-color: var(--accent); color: var(--fg); }

.bootstrap-status {
  padding: 0.6rem 1rem;
  color: var(--muted);
  font-size: 0.88rem;
}
.bootstrap-status:empty { display: none; }
.bootstrap-status[data-phase="failed"] {
  color: var(--error-fg);
  background: var(--error-bg);
}

.transcript-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1rem 0.5rem;
}

.conversation-meta { color: var(--muted); font-size: 0.8rem; }

.empty-state {
  max-width: 40rem;
  margin: 2rem auto;
  text-align: center;
  padding: 0 1rem;
}
.empty-state-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 0.4rem;
}
.empty-state-hint {
  margin: 0 0 1rem;
  color: var(--muted);
}
.empty-state-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
}
.prompt-chip {
  padding: 0.55rem 0.9rem;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.85rem;
}
.prompt-chip:hover { border-color: var(--accent); color: var(--accent); }

.load-earlier {
  display: block;
  margin: 0 auto 0.9rem;
  padding: 0.4rem 0.8rem;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.82rem;
}
.load-earlier:hover { border-color: var(--accent); color: var(--accent); }
/* See `.panel[hidden]` above: an unconditional `display` on the class
 * would otherwise defeat the `hidden` attribute app.ts toggles this
 * with (author rules beat the UA `[hidden]` rule regardless of
 * specificity). */
.load-earlier[hidden] { display: none; }

.transcript {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-width: 46rem;
  margin-inline: auto;
}

.message {
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.message[data-role="user"] {
  background: var(--user-bg);
  margin-left: 2rem;
}
.message[data-role="assistant"] {
  background: var(--assistant-bg);
  margin-right: 2rem;
  box-shadow: 0 1px 2px rgba(15, 45, 82, 0.06);
}
.message[data-pending="true"] { opacity: 0.72; }

.message-role {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.message-content { margin: 0; }
/* The student's own typed message is still plain textContent (app.ts) --
 * preserve its raw newlines/spacing exactly as typed. The assistant's
 * answer is markdown-rendered (markdown.ts): explicit <br> elements and
 * normal block-level flow control layout instead. */
.message[data-role="user"] .message-content { white-space: pre-wrap; }

.citation-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}
.citation-chip {
  min-width: 1.6rem;
  height: 1.6rem;
  padding: 0 0.4rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.6rem;
}
.citation-chip:hover { background: var(--accent); color: var(--accent-fg); }

.sources { margin-top: 0.7rem; }
.sources > summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--accent);
  padding: 0.3rem 0;
}
.source-list {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.source {
  border-left: 3px solid var(--line);
  padding-left: 0.75rem;
}
.source-title { font-weight: 600; }
.source-section,
.source-attribution,
.source-chunk-id {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}
.source-chunk-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.source-excerpt {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
}

.turn-status {
  max-width: 46rem;
  margin: 0.6rem auto 0;
  color: var(--muted);
  font-size: 0.88rem;
}
.turn-status:empty { margin: 0; }

.turn-error {
  max-width: 46rem;
  margin: 0.75rem auto 0;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error-fg);
  border: 1px solid var(--error-line);
}
.turn-error .diagnostic {
  display: block;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  margin-top: 0.4rem;
  color: var(--error-fg);
  opacity: 0.85;
}
.turn-error button {
  margin-top: 0.6rem;
  padding: 0.4rem 0.8rem;
  min-height: 40px;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  background: transparent;
  color: var(--error-fg);
  font-weight: 600;
}

.educational-footnote {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0.4rem 1rem 0.7rem;
  color: var(--muted);
  font-size: 0.74rem;
  text-align: center;
}

/* TASK-UI-01 final polish §7/§8: deliberately as quiet as the footnote
 * above -- plain text, no border/background/icon that would read as a
 * banner or a call to action. "Moodle" is plain text, never styled as
 * a link (no color/underline/cursor change). */
.mistake-disclaimer,
.quality-note {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1rem;
  color: var(--muted);
  font-size: 0.72rem;
  text-align: center;
}
.quality-note { padding-bottom: 0.9rem; }

/* ------------------------------------------------------------ composer -- */

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "input send";
  gap: 0.5rem;
  align-items: end;
  max-width: 46rem;
  margin: 0 auto;
  width: 100%;
  padding: 0.75rem 1rem 0.4rem;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.composer > textarea {
  grid-area: input;
  font: inherit;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--fg);
  resize: vertical;
  min-height: 2.9rem;
  max-height: 12rem;
  max-width: 100%;
}
#composer-send {
  grid-area: send;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 50%;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
#composer-send:hover:not([disabled]) { filter: brightness(1.06); }
.composer-hint {
  grid-column: 1 / -1;
  margin: 0.3rem 0 0;
  font-size: 0.76rem;
  color: var(--muted);
}

/* ---------------------------------------------------------- sources -- */

.panel-sources {
  border-left: 1px solid var(--line);
  padding: 1.1rem 0.95rem;
  gap: 0.75rem;
  overflow-y: auto;
}
.sources-panel-heading {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.source-panel-empty {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.source-card-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.source-card-list[hidden] { display: none; }
.source-card {
  display: flex;
  gap: 0.55rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-sunken);
}
.source-card-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}
.source-card-number {
  flex: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.source-card-body { min-width: 0; flex: 1; }
.source-card-title {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--fg);
}
.source-card-title a { color: inherit; }
.source-card-section,
.source-card-attribution {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.78rem;
  color: var(--muted);
}
.source-card-excerpt {
  margin: 0.4rem 0 0;
  font-size: 0.84rem;
  color: var(--fg);
}

/* ------------------------------------------------- markdown/math content -- */
/* Shared by the assistant's answer (.message-content) and a corpus
 * excerpt (.source-excerpt / .source-card-excerpt) -- both rendered by
 * markdown.ts's deliberately limited, DOM-node-only subset. Restrained
 * on purpose: no card/border/radius pile-up, consistent with this
 * app's academic, source-forward visual language. */
.message-content :is(p, ul, ol, blockquote, pre, table, h2, h3, h4) { margin: 0.6rem 0 0; }
.message-content > :first-child,
.source-excerpt > :first-child,
.source-card-excerpt > :first-child { margin-top: 0; }

.message-content :is(h2, h3, h4),
.source-excerpt :is(h2, h3, h4),
.source-card-excerpt :is(h2, h3, h4) {
  font-weight: 700;
  line-height: 1.3;
}
.message-content h2, .source-excerpt h2, .source-card-excerpt h2 { font-size: 1.05rem; }
.message-content h3, .source-excerpt h3, .source-card-excerpt h3 { font-size: 0.98rem; }
.message-content h4, .source-excerpt h4, .source-card-excerpt h4 { font-size: 0.92rem; }

.message-content :is(ul, ol),
.source-excerpt :is(ul, ol),
.source-card-excerpt :is(ul, ol) {
  padding-left: 1.35rem;
}
.message-content li,
.source-excerpt li,
.source-card-excerpt li {
  margin: 0.2rem 0;
}

.message-content blockquote,
.source-excerpt blockquote,
.source-card-excerpt blockquote {
  margin-left: 0;
  padding-left: 0.75rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}
.message-content blockquote p,
.source-excerpt blockquote p,
.source-card-excerpt blockquote p {
  margin: 0;
}

.message-content code,
.source-excerpt code,
.source-card-excerpt code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--surface-sunken);
  border-radius: 4px;
  padding: 0.1em 0.3em;
}
.message-content pre,
.source-excerpt pre,
.source-card-excerpt pre {
  background: var(--surface-sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.6rem 0.75rem;
  overflow-x: auto;
}
.message-content pre code,
.source-excerpt pre code,
.source-card-excerpt pre code {
  background: none;
  padding: 0;
  font-size: 0.85em;
}

.message-content table,
.source-excerpt table,
.source-card-excerpt table {
  border-collapse: collapse;
  font-size: 0.88em;
  display: block;
  overflow-x: auto;
  max-width: 100%;
}
.message-content :is(th, td),
.source-excerpt :is(th, td),
.source-card-excerpt :is(th, td) {
  border: 1px solid var(--line);
  padding: 0.35rem 0.55rem;
  text-align: left;
  vertical-align: top;
}
.message-content th, .source-excerpt th, .source-card-excerpt th {
  background: var(--surface-sunken);
  font-weight: 600;
}

.md-math-display {
  display: block;
  overflow-x: auto;
  margin: 0.6rem 0;
  text-align: center;
}
.md-math-inline { display: inline-block; }
/* Malformed LaTeX degrades to its own literal source text (never
 * KaTeX's red error markup) -- shown as plain, slightly muted text, not
 * styled to look broken or alarming. */
.md-math-fallback {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--muted);
}
/* ---------------------------------------------------------------- drawers -- */

.drawer-scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 33, 0.35);
  z-index: 40;
}

/* ---------------------------------------------------- responsive layout -- */

/* Desktop: static three-column shell. `display: flex !important`
 * overrides the `[hidden]` attribute the markup ships (closed-by-default
 * drawer state below desktop) so the panels are always-on columns here
 * regardless of whatever the drawer toggles last did at a narrower
 * width. */
@media (min-width: 1100px) {
  .app-shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--sources-w);
  }
  .panel-conversations,
  .panel-sources {
    display: flex !important;
  }
  /* TASK-UI-01 final polish §9: the sidebar's own "ChatDECIDES" is
   * always on screen here, so the header shows the conversation instead
   * of repeating the brand a second time. */
  .chat-header-brand { display: none; }
  .chat-header-conversation { display: block; }
}

/* Below desktop: conversations/sources become off-canvas drawers, toggled
 * via the `hidden` attribute (app.ts) rather than a transform — so a
 * closed drawer is genuinely not rendered (not merely moved off-screen),
 * which keeps it out of the tab order and off-screen-scroll for free. */
@media (max-width: 1099.98px) {
  .panel-toggle { display: inline-flex; }

  .panel-conversations,
  .panel-sources {
    position: fixed;
    inset-block: 0;
    width: min(20rem, 86vw);
    z-index: 50;
    box-shadow: 0 0 0 1px var(--line);
  }
  .panel-conversations { left: 0; border-right: 1px solid var(--line); }
  .panel-sources { right: 0; border-left: 1px solid var(--line); }
}

@media (max-width: 767.98px) {
  .message[data-role="user"] { margin-left: 0.5rem; }
  .message[data-role="assistant"] { margin-right: 0.5rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* --- Print / Save as PDF (TASK-14 §7 14.6) --------------------------
 * Keeps: the conversation, the conversation ID, corpus/prompt/retrieval
 * versions, and readable source labels. Drops: sidebars, composer,
 * buttons, live status regions — none of which are conversation
 * content. Source details are forced open so a saved PDF is
 * self-contained. */
@media print {
  body { background: #ffffff; color: #000000; font-size: 11pt; }
  .app-shell { display: block; height: auto; overflow: visible; }
  .panel-conversations,
  .panel-sources,
  .chat-header-actions,
  .composer,
  .load-earlier,
  .bootstrap-status,
  .turn-status,
  .skip-link,
  .educational-footnote,
  .mistake-disclaimer,
  .quality-note,
  .drawer-scrim,
  .turn-error button {
    display: none !important;
  }
  .chat-column { display: block; }
  .transcript-scroll { overflow: visible; padding: 0; }
  .conversation-meta {
    position: static;
    width: auto;
    height: auto;
    margin: 0 0 0.75rem;
    padding: 0 0 0.5rem;
    overflow: visible;
    clip: auto;
    white-space: normal;
    border-bottom: 1px solid #999999;
    color: #000000;
    font-size: 10pt;
  }
  .message,
  .source,
  .source-card {
    break-inside: avoid;
    border-color: #999999;
    background: transparent !important;
    box-shadow: none !important;
  }
  .sources > summary { color: #000000; }
  .sources[open] > summary::marker,
  .sources > summary::marker { content: ""; }
  details.sources > .source-list { display: flex !important; }
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 9pt;
    word-break: break-all;
  }
}
