:root {
  color-scheme: light;
  --ink: #0b0b0f;
  --muted: #6b6f76;
  --faint: #8b9097;
  --line: #e7e8ec;
  --line-strong: #d6d8de;
  --panel: #ffffff;
  --soft: #faf8f7;
  --soft-red: #fff3f3;
  --accent: #d71920;
  --accent-dark: #a80f15;
  --danger: #b42318;
  --warning: #9a4d00;
  --shadow: 0 20px 70px rgba(12, 15, 20, 0.08);
  --evidence-width: 390px;
  --chat-width: 1040px;
  --content-gutter: 28px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 10%, rgba(215, 25, 32, 0.04), transparent 34%),
    linear-gradient(180deg, #fffdfc 0%, #faf7f5 58%, #f8f8f9 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 740;
}

button:hover {
  background: var(--accent-dark);
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(215, 25, 32, 0.18);
  outline-offset: 2px;
}

h1,
h2,
h3,
p,
figure {
  margin: 0;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(247, 247, 248, 0.94);
  backdrop-filter: blur(18px);
}

.auth-box {
  display: grid;
  gap: 13px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 24px;
  animation: riseIn 520ms ease both;
}

.auth-logo {
  width: 210px;
  max-width: 100%;
  height: auto;
}

.auth-box h2 {
  font-size: 24px;
  letter-spacing: 0;
}

.auth-box p,
.auth-error {
  color: var(--muted);
  font-size: 14px;
}

.auth-error {
  min-height: 20px;
  color: var(--danger);
}

input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0 0;
  height: 100vh;
  min-height: 0;
  background: #fff;
  transition: grid-template-columns 360ms ease;
}

.shell.has-sources {
  grid-template-columns: minmax(0, 1fr) 8px var(--evidence-width);
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(215, 25, 32, 0.055), transparent 35%),
    linear-gradient(180deg, #fffdfc 0%, #fbf8f6 52%, #f8f8f9 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: 0 0 auto;
  gap: 22px;
  padding: 14px var(--content-gutter);
  border-bottom: 1px solid transparent;
  transition: border-color 280ms ease, background 280ms ease;
}

.shell.has-conversation .topbar {
  border-bottom-color: var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}

.brand-logo-link {
  display: inline-flex;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-logo-link {
  flex: 0 0 auto;
  border-radius: 8px;
}

.brand-logo-link:focus-visible,
.topbar-links a:focus-visible {
  outline: 2px solid rgba(215, 25, 32, 0.45);
  outline-offset: 3px;
}

.brand-logo-link img,
.topbar-brand img {
  width: 286px;
  height: auto;
  object-fit: contain;
}

.brand-copy {
  min-width: 0;
}

.topbar-brand h1 {
  font-size: 21px;
  font-weight: 760;
  letter-spacing: 0;
  line-height: 1.08;
}

.topbar-brand h1 span {
  display: inline;
}

.topbar-brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.25;
}

.topbar-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: flex-end;
  gap: 8px 14px;
  margin-left: auto;
  font-size: 13px;
  font-weight: 720;
  line-height: 1.15;
}

.topbar-links a {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  padding: 5px 0;
  text-decoration: none;
  white-space: nowrap;
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

.topbar-links a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.model-select-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

select {
  width: min(360px, 34vw);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

.chat-surface {
  position: relative;
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.shell:not(.has-conversation) .chat-surface {
  display: block;
  flex: 0 0 auto;
  min-height: auto;
  overflow: visible;
}

.welcome {
  align-self: center;
  justify-self: center;
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(760px, calc(100% - 40px));
  padding: 10px 0 28px;
  text-align: center;
  transition: opacity 260ms ease, transform 360ms ease, visibility 260ms ease;
}

.shell.has-conversation .welcome {
  pointer-events: none;
  visibility: hidden;
  opacity: 0;
  transform: translateY(-22px) scale(0.98);
}

.shell.welcome-removed .welcome {
  display: none;
}

.assistant-logo {
  display: block;
  width: min(520px, 82vw);
  height: auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 14px;
  box-shadow: 0 18px 54px rgba(90, 32, 32, 0.09);
  opacity: 0;
  overflow: hidden;
  transform: scale(0.96);
  animation: imageSettle 620ms ease 180ms both;
}

.welcome-copy {
  display: grid;
  gap: 8px;
  opacity: 0;
  transform: translateY(8px);
  animation: riseIn 540ms ease 300ms both;
}

.welcome-copy p {
  color: var(--muted);
  font-size: 16px;
  font-weight: 650;
}

.suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 9px;
  width: min(900px, 100%);
  opacity: 0;
  animation: fadeIn 520ms ease 520ms both;
}

.suggestions button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 32px;
  padding: 6px 15px;
  font-size: 12px;
  font-weight: 680;
  line-height: 1.2;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.suggestions button:nth-child(2) {
  animation-delay: 580ms;
}

.suggestions button:nth-child(3) {
  animation-delay: 640ms;
}

.suggestions button:nth-child(4) {
  animation-delay: 700ms;
}

.suggestions button:hover {
  border-color: rgba(215, 25, 32, 0.32);
  background: var(--soft-red);
  transform: translateY(-1px);
}

.messages {
  min-height: 0;
  overflow: auto;
  padding: 22px max(var(--content-gutter), calc((100% - var(--chat-width)) / 2)) 18px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 300ms ease, transform 300ms ease;
}

.shell:not(.has-conversation) .messages {
  display: none;
}

.shell.has-conversation .messages {
  opacity: 1;
  transform: translateY(0);
}

.message {
  max-width: min(var(--chat-width), 100%);
  border-radius: 8px;
  padding: 0;
  margin-bottom: 22px;
  line-height: 1.55;
  white-space: pre-wrap;
  animation: messageIn 260ms ease both;
}

.message.assistant {
  width: min(var(--chat-width), 100%);
  border: 0;
  background: transparent;
  box-shadow: none;
  white-space: normal;
}

.message.user {
  width: fit-content;
  max-width: min(720px, 86%);
  margin-left: auto;
  border: 1px solid rgba(215, 25, 32, 0.18);
  border-radius: 8px;
  border-color: rgba(215, 25, 32, 0.18);
  background: var(--soft-red);
  padding: 10px 13px;
}

.message.pending {
  min-height: 32px;
}

.answer-content {
  display: grid;
  gap: 10px;
  font-size: 15px;
  line-height: 1.64;
  max-width: min(860px, 100%);
}

.answer-content p,
.answer-content ul,
.answer-content ol {
  margin: 0;
}

.answer-content ul,
.answer-content ol {
  padding-left: 22px;
}

.answer-content strong {
  font-weight: 780;
}

.answer-content a,
.citation-links a {
  color: var(--accent-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.answer-stage {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  padding: 0 11px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.answer-stage::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulseDot 1.15s ease-in-out infinite;
}

.answer-stage::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  animation: stageDots 1.2s steps(4, end) infinite;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.answer-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  table-layout: auto;
  font-size: 14px;
}

.answer-table th,
.answer-table td {
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  vertical-align: top;
}

.answer-table th {
  background: #f7f7f8;
  color: var(--ink);
  font-weight: 760;
}

.answer-table td {
  background: #fff;
}

.composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
  flex: 0 0 auto;
  width: min(var(--chat-width), calc(100% - 56px));
  min-height: 48px;
  margin: 0 auto 8px;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 36px rgba(12, 15, 20, 0.08);
  padding: 6px;
  opacity: 0;
  transform: translateY(8px);
  animation: riseIn 520ms ease 420ms both;
}

.model-toggle {
  position: relative;
  order: 2;
  display: inline-flex;
  align-items: center;
  justify-self: end;
}

.model-toggle-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: auto;
  min-height: 36px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 13px;
  font-weight: 680;
}

.model-toggle-button:hover {
  background: transparent;
  color: var(--ink);
}

.model-toggle-button::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
}

.model-toggle.open .model-toggle-button::after {
  transform: translateY(2px) rotate(225deg);
}

.model-toggle-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 5;
  display: none;
  min-width: 118px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 36px rgba(12, 15, 20, 0.12);
  padding: 4px;
}

.model-toggle.open .model-toggle-menu {
  display: grid;
}

.model-toggle-option {
  min-height: 32px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 680;
}

.model-toggle-option:hover,
.model-toggle-option.active {
  background: var(--soft);
  color: var(--ink);
}

#messageInput {
  order: 1;
  min-height: 36px;
  max-height: min(31vh, 374px);
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 7px 8px;
  font-size: 15px;
  line-height: 1.45;
  overflow: hidden;
  resize: none;
}

#messageInput:focus {
  outline: none;
}

.composer:focus-within {
  border-color: rgba(215, 25, 32, 0.38);
  box-shadow: 0 18px 55px rgba(215, 25, 32, 0.12);
}

.composer button {
  align-self: center;
}

.composer > button[type="submit"] {
  order: 3;
  min-width: 58px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 7px;
  font-size: 13px;
}

.footer-warning {
  width: min(var(--chat-width), calc(100% - 56px));
  margin: 0 auto 12px;
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
}

.resize-handle {
  position: relative;
  z-index: 3;
  display: none;
  cursor: col-resize;
  background: #fff;
}

.shell.has-sources .resize-handle {
  display: block;
}

.resize-handle::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 3px;
  width: 2px;
  background: transparent;
}

.resize-handle:hover::before,
.resize-handle.active::before {
  background: var(--accent);
}

body.resizing {
  cursor: col-resize;
  user-select: none;
}

.evidence {
  min-width: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #fbfbfc;
  padding: 18px 16px;
  opacity: 0;
  transform: translateX(18px);
  pointer-events: none;
  transition: opacity 300ms ease, transform 360ms ease;
}

.shell.has-sources .evidence {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.panel h2 {
  font-size: 19px;
  font-weight: 780;
}

.panel-kicker {
  margin: 3px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

.citation {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 9px;
  background: #fff;
  overflow: hidden;
}

.citation summary {
  cursor: pointer;
  padding: 11px 12px;
  list-style: none;
}

.citation summary::-webkit-details-marker {
  display: none;
}

.citation-title {
  display: grid;
  gap: 4px;
}

.citation-label {
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.citation-topic {
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.35;
}

.citation-body {
  border-top: 1px solid var(--line);
  padding: 12px;
}

.citation-body h3 {
  margin: 0 0 6px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.citation-body p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.source-section {
  margin-bottom: 10px;
}

.source-section summary {
  position: relative;
  cursor: pointer;
  list-style: none;
  padding: 0 18px 0 0;
}

.source-section summary::-webkit-details-marker {
  display: none;
}

.source-section summary::after {
  content: "";
  position: absolute;
  top: 4px;
  right: 2px;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
}

.source-section[open] summary::after {
  top: 8px;
  transform: rotate(225deg);
}

.source-section summary span {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 780;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-preview {
  display: -webkit-box;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--source-lines, 4);
}

.source-section[open] .source-preview {
  display: none;
}

.source-full {
  display: none;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.source-section[open] .source-full {
  display: block;
}

.citation-links {
  margin: 0 0 12px;
  padding-left: 19px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.citation-metrics {
  width: 100%;
  margin-top: 8px;
  border-collapse: collapse;
  table-layout: fixed;
}

.citation-metrics-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2px;
  margin: 5px 0 0;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.retrieval-details {
  width: fit-content;
  max-width: 100%;
  margin: 4px 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  overflow: visible;
}

.retrieval-details[open] {
  width: 100%;
  border-radius: 8px;
}

.retrieval-details summary {
  cursor: pointer;
  padding: 4px 8px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.06em;
  line-height: 1;
  list-style: none;
  text-transform: uppercase;
}

.retrieval-details summary::-webkit-details-marker {
  display: none;
}

.citation-metrics td {
  border: 1px solid var(--line);
  padding: 7px;
  vertical-align: top;
  background: #fafafa;
}

.citation-metrics td:empty {
  border: 0;
  background: transparent;
}

.citation-metrics span,
.stat-card span,
.metric-card span {
  display: block;
  color: var(--faint);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.citation-metrics strong,
.stat-card strong,
.metric-card strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.model-stats,
.thinking-inline {
  margin-top: 14px;
}

.thinking-inline {
  margin-top: 0;
  margin-bottom: 12px;
  border: 0;
  background: transparent;
  overflow: visible;
}

.thinking-inline[hidden] {
  display: none;
}

.thinking-inline summary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  width: fit-content;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 5px 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  list-style: none;
}

.thinking-inline summary::-webkit-details-marker {
  display: none;
}

.thinking-inline summary::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.thinking-inline[open] summary::after {
  transform: rotate(225deg);
}

.thinking-inline.thinking-active summary {
  color: var(--accent-dark);
}

.model-stats {
  position: relative;
  width: fit-content;
  max-width: 100%;
  margin-top: 10px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  overflow: visible;
}

.model-stats summary span {
  color: var(--faint);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.model-stats summary {
  display: block;
  cursor: pointer;
  padding: 5px 9px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.thinking-inline-text {
  max-height: 150px;
  overflow: auto;
  margin-top: 8px;
  border-left: 2px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  padding: 4px 0 4px 10px;
  white-space: pre-line;
}

.stats-grid {
  position: absolute;
  right: 0;
  bottom: 28px;
  z-index: 4;
  display: grid;
  grid-template-columns: 1fr;
  gap: 3px;
  min-width: 230px;
  max-width: min(280px, calc(100vw - 40px));
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(12, 15, 20, 0.1);
}

.stat-card,
.metric-card {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  font-size: 10px;
  line-height: 1.25;
}

.citation-metrics-grid .metric-card {
  font-size: 9px;
}

.citation-metrics-grid .metric-card span,
.citation-metrics-grid .metric-card strong {
  font-size: 9px;
}

.message-warning {
  display: none;
}

.empty {
  color: var(--muted);
}

.hidden {
  display: none;
}

[hidden] {
  display: none !important;
}

.warning {
  color: var(--warning);
}

.error {
  color: var(--danger);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes imageSettle {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes pulseDot {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.85);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes stageDots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%,
  100% { content: "..."; }
}

@keyframes thinkingGlow {
  0%,
  100% {
    opacity: 0.62;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 980px) {
  :root {
    --content-gutter: 14px;
  }

  html,
  body {
    height: auto;
    overflow: auto;
  }

  .shell,
  .shell.has-sources {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
  }

  .workspace {
    min-height: 100vh;
  }

  .shell.has-conversation.has-sources .workspace {
    min-height: auto;
  }

  .topbar {
    align-items: center;
    flex-direction: row;
    gap: 10px;
    padding: 12px 14px;
  }

  .topbar-brand img {
    width: clamp(142px, 33vw, 190px);
  }

  .topbar-brand {
    flex: 1 1 auto;
    gap: 10px;
    min-width: 0;
  }

  .topbar-brand h1 {
    font-size: clamp(16px, 4.2vw, 19px);
  }

  .topbar-brand h1 span {
    display: block;
  }

  .topbar-brand p {
    display: none;
  }

  .topbar-links {
    flex: 0 1 auto;
    justify-content: flex-end;
    align-items: center;
    gap: 5px 9px;
    margin-left: 0;
    max-width: 38vw;
    font-size: clamp(11px, 2.8vw, 12px);
    line-height: 1.1;
  }

  .topbar-links a {
    padding: 3px 0;
  }

  .brand-copy {
    min-width: 0;
  }

  select {
    width: 100%;
  }

  .chat-surface {
    flex: 0 0 auto;
    overflow: visible;
  }

  .welcome {
    width: min(100% - 28px, 640px);
    gap: 12px;
    padding: 6px 0 20px;
  }

  .assistant-logo {
    width: min(400px, 88vw);
    border-radius: 12px;
  }

  .welcome-copy p {
    font-size: 14px;
  }

  .suggestions {
    gap: 6px;
    width: min(340px, 100%);
  }

  .suggestions button {
    min-height: 32px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .messages {
    min-height: 48vh;
    padding: 18px 14px;
  }

  .shell.has-sources .messages {
    min-height: 0;
    padding-bottom: 8px;
  }

  .shell.has-sources .message:last-child {
    margin-bottom: 10px;
  }

  .composer {
    width: calc(100% - 28px);
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    margin-bottom: 10px;
    gap: 5px;
    padding: 5px;
  }

  .model-toggle-button {
    min-width: auto;
    min-height: 34px;
    padding: 0 6px;
    font-size: 11px;
  }

  .composer > button[type="submit"] {
    min-width: 50px;
    min-height: 34px;
    padding: 0 9px;
  }

  #messageInput {
    grid-column: 1 / -1;
    max-height: min(28vh, 250px);
    min-height: 36px;
  }

  .footer-warning {
    width: calc(100% - 28px);
    margin-bottom: 10px;
    font-size: 11px;
  }

  .resize-handle {
    display: none !important;
  }

  .evidence {
    display: none;
    border-top: 1px solid var(--line);
    border-left: 0;
    transform: none;
    opacity: 1;
    pointer-events: auto;
    padding: 14px 14px 18px;
  }

  .shell.has-sources .evidence {
    display: block;
  }

  .answer-table {
    min-width: 560px;
  }

  .model-stats {
    margin-left: 0;
  }

  .stats-grid {
    right: auto;
    left: 0;
  }
}

@media (max-width: 560px) {
  .topbar {
    align-items: flex-start;
    gap: 8px;
  }

  .topbar-brand {
    align-items: flex-start;
    gap: 8px;
    max-width: calc(100% - 126px);
  }

  .topbar-brand img {
    width: clamp(84px, 24vw, 118px);
  }

  .topbar-brand h1 {
    font-size: 15px;
    line-height: 1.15;
  }

  .topbar-links {
    flex: 0 0 clamp(112px, 34vw, 132px);
    max-width: clamp(112px, 34vw, 132px);
    font-size: 10px;
  }

  .suggestions {
    width: min(300px, 100%);
  }

  .message.user {
    max-width: 92%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
