:root {
  color-scheme: light;
  --ink: #0b0b0f;
  --muted: #6b6f76;
  --faint: #8b9097;
  --line: #e7e8ec;
  --line-strong: #d6d8de;
  --panel: #ffffff;
  --soft: #faf8f7;
  --soft-red: #fff7f7;
  --accent: #d71920;
  --accent-dark: #a80f15;
  --danger: #b42318;
  --warning: #9a4d00;
  --heading-brown: #6b3f2a;
  --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;
}

.startup-loader {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 35%, rgba(215, 25, 32, 0.045), transparent 32%),
    rgba(255, 253, 252, 0.94);
  backdrop-filter: blur(18px);
  transition: opacity 240ms ease, visibility 240ms ease;
}

.startup-loader-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.startup-loader-box {
  display: grid;
  justify-items: center;
  gap: 14px;
  width: min(420px, 92vw);
  color: var(--ink);
  text-align: center;
}

.startup-loader-box img {
  width: min(240px, 58vw);
  border-radius: 12px;
  box-shadow: 0 18px 54px rgba(90, 32, 32, 0.08);
}

.startup-loader-box strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0;
}

.startup-loader-box p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.startup-progress-wrap {
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto;
  align-items: center;
  gap: 10px;
  width: min(380px, 82vw);
}

.startup-progress {
  position: relative;
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(215, 25, 32, 0.10);
}

.startup-progress span {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--startup-progress, 8%);
  border-radius: inherit;
  background: var(--accent);
  transition: width 220ms ease;
}

.startup-progress-label {
  min-width: 4ch;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.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(1540px, 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(-28px) scale(0.965);
}

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

.shell.conversation-starting .workspace {
  animation: workspaceSettle 540ms cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.welcome.welcome-exiting .assistant-logo {
  animation: logoFoldAway 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.welcome.welcome-exiting .welcome-copy,
.welcome.welcome-exiting .suggestions {
  animation: welcomeCopyAway 360ms ease both;
}

.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: nowrap;
  justify-content: center;
  gap: 8px;
  width: min(1480px, calc(100vw - 64px));
  max-width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  padding: 3px 0 4px;
  scrollbar-width: none;
  opacity: 0;
  animation: fadeIn 520ms ease 520ms both;
}

.suggestions::-webkit-scrollbar {
  display: none;
}

.suggestions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 32px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 680;
  line-height: 1.2;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.suggestion-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2em;
  line-height: 1;
}

.suggestion-label {
  display: inline-flex;
  align-items: center;
}

.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: var(--line-strong);
  background: #fff;
  transform: translateY(-1px);
}

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

.composer-prompt-tray {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 0 0 auto;
  width: min(var(--chat-width), calc(100% - 56px));
  min-height: 36px;
  max-height: 52px;
  margin: 0 auto 8px;
  opacity: 1;
  overflow: hidden;
  transform: translateY(0);
  transition: max-height 260ms cubic-bezier(0.2, 0.8, 0.2, 1), margin 260ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 220ms ease, transform 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.shell:not(.has-conversation) .composer-prompt-tray {
  display: none;
}

.composer-suggestions {
  flex: 0 1 auto;
  justify-content: center;
  width: auto;
  min-width: 0;
  max-width: none;
  max-height: 44px;
  padding-right: 46px;
  opacity: 1;
  animation: none;
  transition: max-height 300ms cubic-bezier(0.2, 0.8, 0.2, 1), opacity 240ms ease, transform 300ms cubic-bezier(0.2, 0.8, 0.2, 1), padding 300ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.prompt-tray-toggle {
  position: absolute;
  right: 0;
  top: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--muted);
  padding: 0;
  box-shadow: 0 8px 22px rgba(12, 15, 20, 0.05);
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease, transform 160ms ease;
}

.prompt-tray-toggle::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.prompt-tray-toggle:hover {
  border-color: rgba(215, 25, 32, 0.22);
  background: #fff;
  color: var(--accent);
}

.shell.prompt-chips-hidden .composer-suggestions {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

.shell.prompt-chips-hidden .prompt-tray-toggle::after {
  transform: translateY(2px) rotate(225deg);
}

.shell.prompt-tray-paused .composer-prompt-tray {
  min-height: 0;
  max-height: 0;
  margin-bottom: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
}

.movie-dock {
  flex: 0 0 auto;
  width: min(var(--chat-width), calc(100% - 56px));
  margin: 0 auto 8px;
  position: relative;
  z-index: 1;
  animation: mediaTrayIn 220ms ease both;
}

.movie-dock[hidden] {
  display: none;
}

.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 300ms cubic-bezier(0.2, 0.85, 0.25, 1) 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.12);
  border-radius: 8px;
  background: rgba(255, 247, 247, 0.72);
  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-content a.masala-inline-citation {
  color: var(--accent-dark);
  font-weight: 780;
  text-decoration-line: underline;
  text-decoration-thickness: 1.5px;
}

.faq-inline-citation {
  color: var(--accent-dark);
  font-weight: 680;
  text-decoration: none;
  white-space: nowrap;
}

.instagram-inline-citation {
  color: var(--accent-dark);
  font-weight: 780;
  text-decoration: none;
}

.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 {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: auto 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;
}

.agent-toggle {
  position: relative;
  z-index: 22;
  order: 1;
  display: inline-flex;
  align-items: center;
  align-self: center;
  justify-self: start;
}

.agent-toggle-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 720;
  white-space: nowrap;
}

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

.agent-toggle-button span {
  color: var(--accent);
}

.agent-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);
}

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

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

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

.agent-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;
  white-space: nowrap;
}

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

.model-toggle {
  position: relative;
  z-index: 22;
  order: 3;
  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 span {
  color: var(--accent);
}

.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: 40;
  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: 2;
  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);
}

.agent-toggle.agent-switched .agent-toggle-button {
  animation: selectorSwitch 340ms ease both;
}

.composer button {
  align-self: center;
}

.composer > button[type="submit"] {
  order: 4;
  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 cubic-bezier(0.2, 0.85, 0.25, 1);
}

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

.shell.sources-entering .evidence {
  animation: sourcePanelPop 520ms cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.shell.sources-exiting .evidence {
  animation: sourcePanelOut 300ms ease both;
}

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

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

.citation {
  border: 1px solid rgba(214, 216, 222, 0.78);
  border-radius: 8px;
  margin-bottom: 8px;
  background: #fff;
  overflow: hidden;
  transform-origin: top right;
}

.citation.citation-pop {
  animation: citationPop 440ms cubic-bezier(0.2, 0.85, 0.25, 1) var(--citation-stagger, 0ms) both;
}

.citation.source-target-pulse {
  border-color: var(--heading-brown);
  box-shadow: 0 0 0 3px rgba(107, 63, 42, 0.14);
  animation: sourceTargetPulse 1.35s ease both;
}

@keyframes sourceTargetPulse {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-2px); }
}

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

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

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

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

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

.faq-source-title {
  color: var(--heading-brown);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.35;
}

.faq-source-number {
  color: var(--ink);
  margin-top: 1px;
}

.masala-chunk-detail {
  color: var(--heading-brown);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.35;
}

.masala-paper-title {
  color: var(--ink);
  font-size: 12px;
  font-weight: 640;
  line-height: 1.4;
}

.masala-paper-link-row {
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.masala-paper-link {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 720;
}

.youtube-source-video {
  color: var(--heading-brown);
  font-size: 13px;
  font-weight: 720;
  letter-spacing: 0;
  line-height: 1.3;
  text-transform: none;
}

.instagram-source-title {
  color: var(--heading-brown);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.35;
}

.instagram-source-date {
  color: var(--ink);
  font-size: 12px;
  font-weight: 680;
  line-height: 1.2;
}

.movie-chunk-title {
  color: var(--heading-brown);
  font-size: 13px;
  font-weight: 680;
  line-height: 1.35;
}

.movie-youtube-link-row {
  margin-top: 12px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

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

.citation[open] .citation-body {
  animation: citationBodyReveal 260ms ease both;
}

.citation-body h3 {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 760;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.citation-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.instagram-player {
  margin: 0 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.instagram-player-frame {
  width: 100%;
  aspect-ratio: 9 / 14;
  max-height: min(620px, 72vh);
  background: #fff;
  overflow: hidden;
}

.instagram-player-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.instagram-player-link {
  border-top: 1px solid var(--line);
  padding: 10px;
  font-size: 13px;
  font-weight: 650;
}

.instagram-player-fallback {
  padding: 0;
}

.movie-player {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(12, 15, 20, 0.045);
  overflow: hidden;
}

.movie-player-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  border-bottom: 1px solid var(--line);
  padding: 5px 9px;
  color: var(--ink);
  cursor: pointer;
  font-size: 13px;
  font-weight: 680;
  list-style: none;
}

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

.movie-player-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.movie-player-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  color: var(--muted);
  transform: rotate(45deg);
  transition: transform 160ms ease;
}

.movie-player[open] .movie-player-chevron {
  transform: translateY(2px) rotate(225deg);
}

.movie-player:not([open]) .movie-player-summary {
  border-bottom: 0;
}

.movie-player-language {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 9px;
  font-weight: 720;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: default;
}

.movie-language-select {
  max-width: 104px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  padding: 3px 6px;
  font-size: 11px;
}

.movie-player-frame {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #111;
}

.movie-player-frame iframe {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.movie-source-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.movie-source-time {
  display: block;
  margin-bottom: 5px;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  padding: 0;
  font-size: 13px;
  font-weight: 760;
  text-align: left;
}

.movie-summary-time {
  appearance: none;
  display: block;
  width: fit-content;
  margin: 0 0 5px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--accent-dark);
  padding: 0;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.2;
  text-align: left;
}

.movie-summary-time:hover {
  border: 0;
  background: transparent;
  color: #8f1111;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.movie-play-button,
.movie-timestamp-button {
  border: 1px solid rgba(185, 28, 28, 0.16);
  border-radius: 999px;
  background: #fff;
  color: var(--accent-dark);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}

.movie-play-button {
  background: #fff;
}

.movie-play-button:hover,
.movie-timestamp-button:hover {
  border-color: rgba(185, 28, 28, 0.24);
  background: #fff;
  color: #8f1111;
}

.movie-source-link-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 9px;
  align-items: baseline;
  margin-bottom: 12px;
  font-size: 13px;
}

.movie-source-link-row span {
  color: var(--faint);
  font-size: 10px;
  font-weight: 720;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.movie-source-link,
.movie-inline-citation,
.youtube-inline-citation {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 720;
}

.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(--faint);
  font-size: 10px;
  font-weight: 720;
  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: 4;
}

.source-section[data-source-lines="2"] .source-preview { -webkit-line-clamp: 2; }
.source-section[data-source-lines="1"] .source-preview { -webkit-line-clamp: 1; }
.source-section[data-source-lines="5"] .source-preview { -webkit-line-clamp: 5; }
.source-section[data-source-lines="6"] .source-preview { -webkit-line-clamp: 6; }
.source-section[data-source-lines="8"] .source-preview { -webkit-line-clamp: 8; }

.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: 700;
  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: 720;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

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

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

.response-tools {
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 7px;
}

.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: 0;
  margin-left: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  box-shadow: none;
  overflow: visible;
}

.sources-chip {
  min-height: auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--faint);
  padding: 5px 9px;
  font-size: 9px;
  font-weight: 760;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.sources-chip:hover {
  background: var(--soft);
  color: var(--ink);
}

.sources-chip.sources-chip-active {
  animation: sourceChipRecall 420ms ease both;
}

.citations.citations-entering {
  animation: citationsFadeIn 380ms ease both;
}

.citations.citations-recalled {
  animation: citationsRecall 520ms cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.citations.citations-clearing {
  animation: citationsFadeOut 260ms ease both;
}

.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 mediaTrayIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes startupProgress {
  0% {
    transform: translateX(-110%);
  }

  50% {
    transform: translateX(80%);
  }

  100% {
    transform: translateX(230%);
  }
}

@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 workspaceSettle {
  0% {
    transform: translateY(8px);
  }
  100% {
    transform: translateY(0);
  }
}

@keyframes logoFoldAway {
  0% {
    opacity: 1;
    transform: scale(1);
    filter: blur(0);
  }
  70% {
    opacity: 0.18;
    transform: translateY(-20px) scale(0.94);
    filter: blur(1px);
  }
  100% {
    opacity: 0;
    transform: translateY(-28px) scale(0.9);
    filter: blur(2px);
  }
}

@keyframes welcomeCopyAway {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes selectorSwitch {
  0% {
    background: transparent;
  }
  45% {
    background: var(--soft-red);
    transform: translateY(-1px);
  }
  100% {
    background: transparent;
    transform: translateY(0);
  }
}

@keyframes sourcePanelPop {
  from {
    opacity: 0;
    transform: translateX(22px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes sourcePanelOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(12px);
  }
}

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

@keyframes citationsFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0.45;
  }
}

@keyframes citationsRecall {
  0% {
    opacity: 0.58;
    transform: translateY(8px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes citationPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes citationBodyReveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes sourceChipRecall {
  0% {
    border-color: var(--line);
    color: var(--faint);
    transform: translateY(0);
  }
  44% {
    border-color: rgba(215, 25, 32, 0.36);
    color: var(--accent-dark);
    background: var(--soft-red);
    transform: translateY(-1px);
  }
  100% {
    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;
    justify-content: flex-start;
    width: min(520px, 100%);
    max-width: calc(100vw - 28px);
    padding-bottom: 2px;
  }

  .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: auto minmax(0, 1fr) auto;
    align-items: end;
    margin-bottom: 10px;
    gap: 5px;
    padding: 5px;
  }

  .composer-prompt-tray {
    width: calc(100% - 28px);
    gap: 5px;
  }

  .agent-toggle {
    order: 2;
  }

  .agent-toggle-button {
    min-height: 30px;
    padding: 0 6px;
    font-size: 11px;
  }

  .model-toggle {
    order: 3;
  }

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

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

  #messageInput {
    order: 1;
    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(100%, 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;
  }
}
