:root {
  color-scheme: light;
  --background: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-solid: #ffffff;
  --surface-subtle: #f7f7f9;
  --surface-raised: rgba(255, 255, 255, 0.96);
  --border: rgba(29, 29, 31, 0.12);
  --border-strong: rgba(29, 29, 31, 0.2);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --primary: #0071e3;
  --primary-dark: #0058b0;
  --primary-soft: #e8f3ff;
  --success: #18794e;
  --success-soft: #e8f6ee;
  --warning: #8a5700;
  --warning-soft: #fff3d6;
  --danger: #b42318;
  --danger-soft: #ffebe9;
  --radius-large: 24px;
  --radius-medium: 16px;
  --radius-small: 12px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.04),
    0 18px 48px rgba(0, 0, 0, 0.08);
  --shadow-float: 0 8px 24px rgba(0, 0, 0, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI",
    sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 0%, rgba(0, 113, 227, 0.08), transparent 28rem),
    radial-gradient(circle at 92% 18%, rgba(110, 90, 230, 0.06), transparent 24rem),
    var(--background);
  -webkit-font-smoothing: antialiased;
}

::selection {
  color: var(--text);
  background: rgba(0, 113, 227, 0.2);
}

button,
textarea {
  font: inherit;
}

button,
summary {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

button:focus-visible,
textarea:focus-visible,
input:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.32);
  outline-offset: 3px;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

.site-header {
  /* Same columns and gap as .app-shell so the copy aligns with the chat card. */
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
  align-items: start;
  gap: 1.25rem;
  max-width: 1380px;
  margin: 0 auto;
  width: 100%;
  padding: 1.75rem clamp(1.25rem, 4vw, 3.5rem) 1.25rem;
}

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

h1 {
  margin-bottom: 0.65rem;
  font-size: clamp(2.15rem, 4vw, 3.6rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

h2 {
  margin-bottom: 0;
  font-size: 1.15rem;
  letter-spacing: -0.018em;
}

h3 {
  margin: 1.35rem 0 0.65rem;
  font-size: 0.95rem;
  letter-spacing: -0.01em;
}

.eyebrow,
.label,
.message-role {
  margin-bottom: 0.42rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

.product-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.product-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(0, 113, 227, 0.1);
}

.intro {
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  letter-spacing: -0.012em;
  line-height: 1.55;
}

.route-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-card {
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-raised);
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.route-card h2 {
  margin-bottom: 0.2rem;
  color: var(--text);
  font-size: 0.98rem;
}

.route-card p {
  margin-bottom: 0;
}

.route-card .route-example {
  margin-top: 0.3rem;
  font-style: italic;
}

.route-note {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.intro-details {
  margin-top: 0.35rem;
  color: var(--muted);
}

.intro-details summary {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border-radius: 6px;
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

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

.intro-details summary::after {
  content: "";
  width: 0.42rem;
  height: 0.42rem;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 160ms ease;
}

.intro-details[open] summary::after {
  transform: translateY(1px) rotate(-135deg);
}

.intro-details summary:hover {
  text-decoration: underline;
}

.intro-details p {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  letter-spacing: -0.008em;
  line-height: 1.55;
}

.api-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  justify-self: end;
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    transform 120ms ease;
}

.api-link:hover {
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.94);
}

.api-link:active {
  transform: scale(0.97);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(320px, 0.85fr);
  gap: 1.25rem;
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem) 1.25rem;
}

/*
 * On desktop the page is exactly one viewport tall: the header keeps its
 * natural height and the cards fill the remaining space, so the composer is
 * visible without scrolling. Cards keep a minimum height, so very short
 * windows scroll the page rather than collapsing the chat.
 */
@media (min-width: 901px) and (min-height: 641px) {
  body {
    height: 100vh;
    height: 100dvh;
  }

  .app-shell {
    grid-template-rows: minmax(0, 1fr);
  }

  .chat-card,
  .details-card {
    min-height: 480px;
  }
}

.chat-card,
.details-card {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-large);
  background: var(--surface);
  box-shadow: var(--shadow-card);
  -webkit-backdrop-filter: saturate(140%) blur(22px);
  backdrop-filter: saturate(140%) blur(22px);
}

.session-bar,
.details-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.3rem;
  border-bottom: 1px solid var(--border);
  background: rgba(250, 250, 252, 0.7);
}

.session-context {
  min-width: 0;
}

.session-id-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.session-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
}

.demo-menu {
  position: relative;
}

.demo-list {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.35rem);
  left: 0;
  min-width: 16rem;
  margin: 0;
  padding: 0.3rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-solid);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  list-style: none;
}

.demo-list[hidden] {
  display: none;
}

.demo-choice {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: var(--radius-small);
  color: var(--text);
  background: transparent;
  font-size: 0.88rem;
  text-align: left;
}

.demo-choice:hover,
.demo-choice:focus-visible {
  background: var(--surface-subtle);
}

.session-bar code {
  display: block;
  overflow: hidden;
  max-width: min(52vw, 500px);
  color: var(--text);
  font-family: ui-monospace, "SFMono-Regular", Menlo, monospace;
  font-size: 0.88rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.copy-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface-solid);
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    transform 120ms ease;
}

.copy-icon {
  grid-area: 1 / 1;
  width: 14px;
  height: 14px;
}

.copy-icon-done,
.copy-icon-error,
.copy-button-copied .copy-icon-idle,
.copy-button-failed .copy-icon-idle {
  display: none;
}

.copy-button-copied .copy-icon-done,
.copy-button-failed .copy-icon-error {
  display: block;
}

.copy-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.copy-button:active:not(:disabled) {
  transform: scale(0.97);
}

.copy-button-copied {
  border-color: var(--success);
  color: var(--success);
  background: var(--success-soft);
}

.copy-button-copied:hover:not(:disabled) {
  border-color: var(--success);
  background: var(--success-soft);
}

.copy-button-failed {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

.copy-button-failed:hover:not(:disabled) {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.read-only-banner {
  margin: 0;
  padding: 0.5rem 1rem;
  color: var(--warning);
  background: var(--warning-soft);
  border-radius: var(--radius-small);
  font-size: 0.82rem;
  line-height: 1.4;
  text-align: center;
}

.read-only-banner[hidden] {
  display: none;
}

.primary-button,
.secondary-button {
  min-height: 42px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 650;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 120ms ease;
}

.primary-button:active:not(:disabled),
.secondary-button:active:not(:disabled) {
  transform: scale(0.97);
}

.primary-button {
  min-width: 124px;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--primary);
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 4px 14px rgba(0, 113, 227, 0.2);
}

.primary-button:hover:not(:disabled) {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  box-shadow: 0 6px 18px rgba(0, 88, 176, 0.24);
}

.secondary-button {
  flex: 0 0 auto;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border);
  color: var(--text);
  background: var(--surface-solid);
}

.secondary-button:hover:not(:disabled) {
  border-color: var(--border-strong);
  background: var(--surface-subtle);
}

.transcript {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 0.9rem;
  min-height: 0;
  margin: 0;
  padding: clamp(1.25rem, 3vw, 2rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(29, 29, 31, 0.2) transparent;
  scrollbar-gutter: stable;
  list-style: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 35%);
}

.conversation-welcome {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 520px;
  margin: auto;
  padding: 1.25rem;
  color: var(--muted);
}

.conversation-welcome h3 {
  margin: 0 0 0.3rem;
  color: var(--text);
  font-size: 1rem;
}

.conversation-welcome p {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
}

.welcome-mark {
  display: grid;
  flex: 0 0 auto;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 14px;
  color: #ffffff;
  background: linear-gradient(145deg, #2691ff, #0063c7);
  box-shadow: 0 8px 20px rgba(0, 113, 227, 0.22);
  font-size: 1rem;
  font-weight: 750;
}

.message {
  width: min(87%, 760px);
  min-width: 0;
  padding: 0.9rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: 18px;
  animation: message-arrive 260ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.message-user {
  align-self: flex-end;
  border-color: var(--primary);
  border-bottom-right-radius: 6px;
  color: #ffffff;
  background: var(--primary);
  box-shadow: 0 5px 15px rgba(0, 113, 227, 0.16);
}

.message-user .message-role {
  color: rgba(255, 255, 255, 0.74);
}

.message-user .message-body p {
  white-space: pre-wrap;
}

.message-assistant {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: var(--surface-solid);
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.04);
}

.message-role {
  display: inline-block;
  margin-right: 0.5rem;
}

.message-status {
  display: inline-block;
  padding: 0.17rem 0.5rem;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-subtle);
  font-size: 0.7rem;
  font-weight: 600;
}

.message-body > :last-child {
  margin-bottom: 0;
}

.message-body > :first-child {
  margin-top: 0;
}

.message-body p,
.message-body li,
.message-body blockquote {
  line-height: 1.58;
  overflow-wrap: anywhere;
}

.message-body h1,
.message-body h2,
.message-body h3,
.message-body h4,
.message-body h5,
.message-body h6 {
  margin: 0.9rem 0 0.4rem;
  font-size: 1rem;
  line-height: 1.35;
}

.message-body ul,
.message-body ol {
  margin: 0.55rem 0 0.85rem;
  padding-left: 1.45rem;
}

.message-body li + li {
  margin-top: 0.3rem;
}

.message-body blockquote {
  margin: 0.75rem 0;
  padding: 0.1rem 0 0.1rem 0.8rem;
  border-left: 3px solid var(--border-strong);
  color: var(--muted);
}

.message-body pre {
  max-width: 100%;
  margin: 0.75rem 0;
  padding: 0.8rem;
  overflow-x: auto;
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
  font-size: 0.78rem;
  line-height: 1.5;
}

.message-body :not(pre) > code {
  padding: 0.1rem 0.3rem;
  border-radius: 5px;
  background: var(--surface-subtle);
  font-size: 0.9em;
}

.message-body a {
  color: var(--primary-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.message-body table {
  display: block;
  max-width: 100%;
  margin: 0.75rem 0;
  overflow-x: auto;
  border-collapse: collapse;
}

.message-body th,
.message-body td {
  padding: 0.4rem 0.6rem;
  border: 1px solid var(--border);
  text-align: left;
}

.message-body-plain {
  white-space: pre-wrap;
}

.message-working {
  width: auto;
  padding: 0.8rem 1rem;
}

.working-dots {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  height: 1.25rem;
}

.working-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: dot-pulse 1.1s ease-in-out infinite;
}

.working-dots span:nth-child(2) {
  animation-delay: 120ms;
}

.working-dots span:nth-child(3) {
  animation-delay: 240ms;
}

.message-form {
  flex: 0 0 auto;
  padding: 0 1.25rem 1.25rem;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), var(--surface-solid) 22%);
}

.files-panel {
  flex: 0 0 auto;
  margin: 0 1.25rem 0.65rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-medium);
  background: var(--surface-subtle);
}

.files-panel[hidden] {
  display: none;
}

.files-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.files-header h3 {
  margin: 0;
  font-size: 0.88rem;
}

.upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.45;
}

.file-help-button {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--muted);
  background: var(--surface-solid);
  font-size: 0.72rem;
  font-weight: 700;
}

.file-help-button:hover,
.file-help-button:focus-visible {
  color: var(--primary-dark);
  border-color: var(--primary);
}

.tooltip-anchor {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
}

.tooltip-anchor[hidden] {
  display: none;
}

.tooltip-bubble {
  position: absolute;
  z-index: 5;
  bottom: calc(100% + 0.55rem);
  left: 0;
  width: max-content;
  max-width: min(18rem, 75vw);
  padding: 0.55rem 0.7rem;
  visibility: hidden;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface-solid);
  box-shadow: var(--shadow-float);
  font-size: 0.74rem;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(3px);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
}

.tooltip-anchor:hover .tooltip-bubble,
.tooltip-anchor:focus-within .tooltip-bubble {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.file-help-tooltip ul {
  margin: 0;
  padding-left: 1.1rem;
}

.file-help-tooltip li + li {
  margin-top: 0.3rem;
}

.upload-tooltip {
  right: 0;
  left: auto;
}

.upload-status {
  margin-top: 0.35rem;
}

.upload-status:empty {
  display: none;
}

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

.uploaded-files {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  max-height: 7rem;
  margin: 0.45rem 0 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  list-style: none;
}

.uploaded-file {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-width: 0;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-solid);
}

.uploaded-file.is-selected {
  border-color: rgba(0, 113, 227, 0.48);
  background: var(--primary-soft);
}

.uploaded-file-description {
  display: grid;
  gap: 0.15rem;
  min-width: 0;
}

.uploaded-file-description strong {
  overflow: hidden;
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.uploaded-file-description span,
.files-empty {
  color: var(--muted);
  font-size: 0.72rem;
}

.uploaded-file-controls {
  display: flex;
  flex: 0 0 auto;
  gap: 0.25rem;
}

.file-action {
  min-height: 34px;
  padding: 0.35rem 0.55rem;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--primary-dark);
  background: transparent;
  font-size: 0.73rem;
  font-weight: 650;
}

.file-action:hover:not(:disabled) {
  border-color: var(--border);
  background: var(--surface-solid);
}

.file-action:active:not(:disabled) {
  transform: scale(0.97);
}

.file-delete {
  color: var(--danger);
}

.message-attachment {
  display: inline-block;
  margin-top: 0.45rem;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.22);
  font-size: 0.72rem;
}

.composer-shell {
  padding: 0.75rem 0.8rem 0.7rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--surface-raised);
  box-shadow: var(--shadow-float);
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.composer-shell:focus-within {
  border-color: rgba(0, 113, 227, 0.58);
  box-shadow:
    0 0 0 4px rgba(0, 113, 227, 0.1),
    var(--shadow-float);
}

.message-form label {
  display: block;
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 650;
}

.message-form textarea {
  width: 100%;
  min-height: 44px;
  max-height: 180px;
  resize: vertical;
  padding: 0.4rem 0.15rem;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  line-height: 1.5;
}

.message-form textarea::placeholder {
  color: #929298;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 0.45rem;
}

.composer-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

.upload-button {
  display: grid;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--text);
  background: var(--surface-solid);
  transition: background-color 180ms ease, border-color 180ms ease, transform 120ms ease;
}

.upload-button svg {
  width: 19px;
  height: 19px;
}

.upload-button:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-button:active:not(:disabled) {
  transform: scale(0.97);
}

.app-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.app-status:empty {
  display: none;
}

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

.details-card {
  min-width: 0;
}

.details-scroll {
  flex: 1 1 auto;
  min-height: 0;
  margin-right: 0.4rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(29, 29, 31, 0.2) transparent;
  scrollbar-width: thin;
}

#turn-details,
.empty-state {
  padding: 1.3rem;
}

.empty-state {
  max-width: 34rem;
  color: var(--muted);
  line-height: 1.55;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-idle {
  color: var(--muted);
  background: #e9e9ed;
}

.status-answered {
  color: var(--success);
  background: var(--success-soft);
}

.status-clarification_required {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-no-evidence {
  color: #535359;
  background: #e9e9ed;
}

.status-failed {
  color: var(--danger);
  background: var(--danger-soft);
}

.detail-section:first-child h3 {
  margin-top: 0;
}

.citation-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.citation-chip {
  min-height: 32px;
  padding: 0.35rem 0.7rem;
  border: 1px solid rgba(0, 113, 227, 0.2);
  border-radius: 999px;
  color: var(--primary-dark);
  background: var(--primary-soft);
  font-size: 0.75rem;
  font-weight: 650;
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    transform 120ms ease;
}

.citation-chip:hover {
  border-color: rgba(0, 113, 227, 0.42);
  background: #ddecff;
}

.citation-chip:active {
  transform: scale(0.97);
}

.turn-metadata {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.55rem;
  margin: 0;
}

.turn-metadata div {
  min-width: 0;
  padding: 0.7rem;
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
}

.turn-metadata dt {
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.turn-metadata dd {
  margin: 0.3rem 0 0;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  font-weight: 600;
}

.compact-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text);
  font-size: 0.84rem;
  line-height: 1.45;
}

.compact-list li + li {
  margin-top: 0.45rem;
}

.source-list {
  display: grid;
  gap: 0.55rem;
}

.source-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-small);
  background: var(--surface-subtle);
  transition:
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.source-item[open],
.source-item.source-highlight {
  border-color: rgba(0, 113, 227, 0.3);
  background: var(--surface-solid);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.06);
}

.source-item summary {
  padding: 0.72rem 0.78rem;
  cursor: pointer;
  font-size: 0.79rem;
  font-weight: 650;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.source-item p {
  margin: 0;
  padding: 0 0.78rem 0.78rem;
  font-size: 0.82rem;
  line-height: 1.52;
}

.source-item .source-metadata,
.muted-item {
  color: var(--muted);
  font-size: 0.76rem;
}

.execution-details {
  margin-top: 1.4rem;
  border-top: 1px solid var(--border);
}

.execution-details > summary {
  padding: 1rem 0 0;
  cursor: pointer;
  color: var(--text);
  font-size: 0.84rem;
  font-weight: 650;
}

.execution-details > summary::marker {
  color: var(--muted);
}

.execution-content {
  padding-top: 0.9rem;
}

.noscript-message {
  max-width: 1380px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 3.5rem) 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

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

@keyframes message-arrive {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes dot-pulse {
  0%,
  60%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }

  30% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

@media (max-width: 900px) {
  .site-header,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .site-header {
    gap: 1.15rem;
    padding-top: 2rem;
  }

  .api-link {
    justify-self: start;
  }

  .chat-card,
  .details-card {
    position: static;
    width: 100%;
    height: auto;
  }

  .chat-card {
    min-height: 700px;
  }

  .transcript {
    min-height: 390px;
    max-height: 560px;
  }

  .details-scroll {
    margin-right: 0;
    overflow: visible;
  }
}

@media (max-height: 640px) and (min-width: 901px) {
  .chat-card,
  .details-card {
    position: static;
    height: auto;
  }

  .transcript {
    min-height: 280px;
    max-height: 400px;
  }

  .details-scroll {
    margin-right: 0;
    overflow: visible;
  }
}

@media (max-width: 560px) {
  .site-header {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .route-cards {
    grid-template-columns: 1fr;
  }

  .app-shell {
    gap: 0.85rem;
    padding-right: 0.65rem;
    padding-bottom: 1.25rem;
    padding-left: 0.65rem;
  }

  .chat-card,
  .details-card {
    border-radius: 20px;
  }

  .session-bar,
  .details-header {
    align-items: stretch;
    flex-direction: column;
  }

  .session-bar code {
    max-width: 100%;
  }

  .chat-card {
    min-height: 650px;
  }

  .transcript {
    padding: 1rem;
  }

  .conversation-welcome {
    align-items: flex-start;
    padding: 0.6rem;
  }

  .message {
    width: 94%;
  }

  .message-form {
    padding-right: 0.7rem;
    padding-bottom: 0.7rem;
    padding-left: 0.7rem;
  }

  .files-panel {
    margin-right: 0.7rem;
    margin-left: 0.7rem;
  }

  .file-help-tooltip {
    left: -6rem;
  }

  .uploaded-file {
    align-items: stretch;
    flex-direction: column;
  }

  .uploaded-file-controls {
    justify-content: flex-end;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .composer-actions {
    justify-content: flex-end;
  }

  .turn-metadata {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .api-link,
  .chat-card,
  .details-card {
    background: var(--surface-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --border: rgba(29, 29, 31, 0.34);
    --border-strong: rgba(29, 29, 31, 0.56);
  }

  .chat-card,
  .details-card,
  .message,
  .source-item {
    border-color: var(--border-strong);
  }
}
