:root {
  color-scheme: light;
  --bg: oklch(0.972 0.004 225);
  --surface: oklch(1 0 0);
  --surface-muted: oklch(0.956 0.006 225);
  --surface-strong: oklch(0.93 0.008 225);
  --sidebar-bg: oklch(0.948 0.008 225);
  --sidebar-panel: oklch(0.985 0.003 225);
  --sidebar-hover: oklch(0.925 0.012 225);
  --ink: oklch(0.25 0.018 235);
  --muted: oklch(0.46 0.018 235);
  --faint: oklch(0.62 0.014 235);
  --line: oklch(0.875 0.01 225);
  --line-strong: oklch(0.74 0.018 225);
  --primary: oklch(0.56 0.12 158);
  --primary-hover: oklch(0.5 0.125 158);
  --primary-soft: oklch(0.94 0.035 158);
  --primary-ink: oklch(0.22 0.05 158);
  --agent: oklch(0.29 0.07 165);
  --agent-soft: oklch(0.94 0.032 165);
  --agent-line: oklch(0.72 0.075 165);
  --user-soft: oklch(0.94 0.026 245);
  --user-line: oklch(0.81 0.04 245);
  --user-ink: oklch(0.34 0.08 245);
  --info: oklch(0.55 0.11 245);
  --info-soft: oklch(0.94 0.026 245);
  --warning: oklch(0.66 0.13 78);
  --warning-soft: oklch(0.96 0.035 78);
  --danger: oklch(0.56 0.18 27);
  --danger-soft: oklch(0.95 0.034 27);
  --success: oklch(0.52 0.12 150);
  --success-soft: oklch(0.94 0.034 150);
  --shadow-small: 0 1px 3px oklch(0.2 0.018 235 / 0.08);
  --shadow-panel: 0 10px 24px oklch(0.2 0.018 235 / 0.08);
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --sidebar-width: 328px;
  --composer-height: 72px;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 3px solid oklch(0.62 0.11 158 / 0.28);
  outline-offset: 2px;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
  transition: grid-template-columns 180ms ease;
}

.history-backdrop {
  display: none;
}

.sidebar {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 18px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-bg);
  color: var(--ink);
  padding: 24px 20px;
  transition:
    opacity 160ms ease,
    padding 180ms ease,
    border-color 180ms ease;
}

.mobile-only,
.ghost-button.mobile-only {
  display: none;
}

.brand {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: center;
  min-height: 46px;
}

.brand > div {
  min-width: 0;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--agent);
  color: oklch(1 0 0);
  font-size: 0.96rem;
  font-weight: 780;
}

.brand h1,
.chat-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.04rem;
  font-weight: 760;
  letter-spacing: 0;
  text-wrap: balance;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 680;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  padding: 0;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.icon-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink);
}

.icon-button:active {
  transform: translateY(1px);
}

.sidebar .icon-button {
  background: var(--sidebar-panel);
}

.sidebar-open-button {
  display: none;
}

.sidebar-icon {
  position: relative;
  display: block;
  width: 16px;
  height: 14px;
  border: 1.7px solid currentColor;
  border-radius: 4px;
}

.sidebar-icon::before {
  content: "";
  position: absolute;
  top: -1.7px;
  bottom: -1.7px;
  left: 5px;
  border-left: 1.7px solid currentColor;
}

.chat-titlebar {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.chat-titlebar > div {
  min-width: 0;
}

.primary-action {
  display: inline-flex;
  width: 100%;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: oklch(1 0 0);
  padding: 9px 14px;
  font-weight: 740;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.primary-action span:first-child {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: var(--radius-xs);
  background: oklch(1 0 0 / 0.18);
  font-size: 1rem;
  line-height: 1;
}

.primary-action:hover,
.send-button:hover {
  background: var(--primary-hover);
}

.primary-action:active,
.send-button:active,
.mini-button:active,
.ghost-button:active {
  transform: translateY(1px);
}

.search-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.field-label,
.section-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 720;
}

.search-field input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--sidebar-panel);
  color: var(--ink);
  outline: none;
  padding: 9px 11px;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.search-field input::placeholder,
.composer textarea::placeholder {
  color: oklch(0.5 0.016 235);
}

.search-field input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.conversation-list {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  overflow: auto;
  padding-right: 2px;
  scrollbar-gutter: stable;
}

.conversation-item {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  padding: 11px;
  text-align: left;
  transition:
    background 160ms ease,
    border-color 160ms ease;
}

.conversation-item:hover {
  border-color: var(--line);
  background: var(--sidebar-hover);
}

.conversation-item.active {
  border-color: oklch(0.73 0.058 158);
  background: var(--primary-soft);
}

.conversation-item.sending {
  border-color: oklch(0.78 0.06 158);
  background: oklch(0.968 0.022 158);
}

.conversation-item.sending span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  vertical-align: 0.08em;
  animation: loadingDot 1s ease-in-out infinite;
}

.conversation-item strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 740;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-item span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding-top: 4px;
}

.sidebar-footer .ghost-button {
  min-height: 44px;
}

.ghost-button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 8px 11px;
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.sidebar .ghost-button {
  background: var(--sidebar-panel);
}

.ghost-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.sidebar .ghost-button:hover {
  background: var(--sidebar-hover);
}

.ghost-button.danger {
  border-color: oklch(0.82 0.05 27);
  background: var(--danger-soft);
  color: var(--danger);
}

.ghost-button.compact {
  min-height: 34px;
  padding: 7px 10px;
}

.chat-panel {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: auto auto minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: oklch(0.985 0.003 225 / 0.96);
  padding: 22px 34px 16px;
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.health-text {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: var(--radius-pill);
  background: var(--faint);
}

.status-dot.ok {
  background: var(--success);
}

.status-dot.warn {
  background: var(--danger);
}

.setup-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid oklch(0.84 0.055 78);
  background: var(--warning-soft);
  color: var(--ink);
  padding: 10px 34px;
  font-size: 0.88rem;
}

.setup-banner strong {
  font-weight: 760;
}

.hidden {
  display: none;
}

.messages {
  display: flex;
  min-height: 0;
  flex-direction: column;
  gap: 20px;
  overflow: auto;
  padding: 26px min(5vw, 68px) calc(var(--composer-height) + 44px);
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

.message-row {
  display: flex;
  width: 100%;
  gap: 12px;
  align-items: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.message-avatar {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 780;
}

.message-row.assistant .message-avatar {
  border: 1px solid var(--agent-line);
  background: var(--agent);
  color: oklch(0.98 0.012 165);
  box-shadow: 0 1px 0 oklch(1 0 0 / 0.18) inset;
}

.message-row.user .message-avatar {
  border: 1px solid var(--user-line);
  background: var(--user-soft);
  color: var(--user-ink);
}

.message-bubble {
  width: fit-content;
  max-width: min(820px, calc(100% - 44px));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 14px 15px;
  box-shadow: var(--shadow-small);
}

.message-row.user .message-bubble {
  border-color: var(--user-line);
  background: var(--user-soft);
  box-shadow: none;
}

.message-row.streaming .message-bubble {
  border-color: var(--agent-line);
  background: var(--agent-soft);
}

.message-meta {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 720;
}

.message-content {
  max-width: 74ch;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.96rem;
  line-height: 1.72;
  text-wrap: pretty;
}

.message-row.streaming .message-content::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 1em;
  margin-left: 4px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  vertical-align: -0.15em;
  animation: cursorBlink 1s steps(2, start) infinite;
}

.message-row.streaming .loading-card::after {
  content: none;
}

.loading-card {
  display: grid;
  gap: 8px;
  min-width: min(320px, 68vw);
}

.loading-heading {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--agent);
  font-weight: 780;
}

.loading-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.loading-dots i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: var(--radius-pill);
  background: var(--agent);
  animation: loadingDot 1s ease-in-out infinite;
}

.loading-dots i:nth-child(2) {
  animation-delay: 140ms;
}

.loading-dots i:nth-child(3) {
  animation-delay: 280ms;
}

.loading-detail {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
}

.prompt-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.prompt-suggestions button {
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 680;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.prompt-suggestions button:hover {
  border-color: oklch(0.73 0.058 158);
  background: var(--primary-soft);
  color: var(--primary-ink);
}

.answer-card {
  display: grid;
  gap: 10px;
  white-space: normal;
}

.answer-section {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: oklch(0.988 0.003 225);
  padding: 11px;
}

.answer-section h3 {
  display: inline-flex;
  width: fit-content;
  margin: 0;
  border-radius: var(--radius-xs);
  color: var(--primary-ink);
  font-size: 0.82rem;
  font-weight: 780;
}

.answer-section-collapsible {
  gap: 0;
  background: var(--surface);
  padding: 0;
}

.answer-section-collapsible summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  padding: 10px 11px;
  font-size: 0.82rem;
  font-weight: 760;
}

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

.answer-section-collapsible summary::after {
  content: "展开";
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 780;
}

.answer-section-collapsible[open] summary {
  border-bottom: 1px solid var(--line);
  border-bottom-right-radius: 0;
  border-bottom-left-radius: 0;
  color: var(--ink);
}

.answer-section-collapsible[open] summary::after {
  content: "收起";
}

.answer-section-collapsible .answer-section-body {
  padding: 10px 11px 11px;
}

.answer-section-body {
  color: var(--ink);
  white-space: pre-wrap;
}

.message-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.mini-button {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--muted);
  padding: 5px 9px;
  font-size: 0.78rem;
  font-weight: 720;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.mini-button:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
  color: var(--ink);
}

.references {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.references summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 720;
}

.reference-item {
  display: grid;
  gap: 4px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--muted);
  padding: 9px 10px;
  font-size: 0.82rem;
}

.reference-item strong {
  display: block;
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 720;
}

.typing {
  width: 54px;
  height: 14px;
  border-radius: var(--radius-pill);
  background:
    radial-gradient(circle at 9px 50%, var(--faint) 0 3px, transparent 4px),
    radial-gradient(circle at 27px 50%, var(--faint) 0 3px, transparent 4px),
    radial-gradient(circle at 45px 50%, var(--faint) 0 3px, transparent 4px);
  animation: pulse 1.2s infinite ease-in-out;
}

.composer {
  position: absolute;
  right: 34px;
  bottom: 24px;
  left: 34px;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 96px;
  gap: 10px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: oklch(1 0 0 / 0.96);
  padding: 10px;
  box-shadow: var(--shadow-panel);
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 46px;
  max-height: 148px;
  resize: none;
  border: 0;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink);
  outline: none;
  padding: 11px 12px;
  line-height: 1.45;
  overflow-y: auto;
}

.composer textarea:disabled {
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
}

.send-button {
  width: 96px;
  min-width: 96px;
  min-height: 46px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--primary);
  color: oklch(1 0 0);
  padding: 0 12px;
  font-weight: 740;
  transition:
    background 160ms ease,
    transform 160ms ease;
}

.send-button:disabled {
  background: oklch(0.7 0.012 235);
  color: oklch(0.98 0 0);
}

.settings-dialog {
  width: min(520px, calc(100vw - 48px));
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 0;
  box-shadow: var(--shadow-panel);
}

.settings-dialog::backdrop {
  background: oklch(0.2 0.018 235 / 0.28);
}

.settings-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.settings-header h2 {
  margin: 0;
  font-size: 1rem;
}

.settings-status {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--muted);
  padding: 10px 11px;
  font-size: 0.86rem;
  font-weight: 680;
}

.settings-status[data-tone="ok"] {
  border-color: oklch(0.78 0.055 150);
  background: var(--success-soft);
  color: var(--primary-ink);
}

.settings-status[data-tone="warn"] {
  border-color: oklch(0.84 0.055 78);
  background: var(--warning-soft);
  color: var(--ink);
}

.settings-status[data-tone="error"] {
  border-color: oklch(0.82 0.05 27);
  background: var(--danger-soft);
  color: var(--danger);
}

.settings-group {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: oklch(0.988 0.003 225);
  padding: 13px;
}

.settings-group h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 780;
}

.settings-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 720;
}

.settings-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  outline: none;
  padding: 9px 11px;
  transition:
    border-color 160ms ease,
    background 160ms ease;
}

.settings-field input:focus {
  border-color: var(--primary);
  background: var(--surface);
}

.settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.settings-save-button {
  width: auto;
  min-width: 94px;
}

.empty-state {
  display: grid;
  gap: 5px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--sidebar-panel);
  color: var(--muted);
  padding: 13px;
  font-size: 0.86rem;
}

.empty-state strong {
  color: var(--ink);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.42;
  }
  50% {
    opacity: 1;
  }
}

@keyframes cursorBlink {
  0%,
  45% {
    opacity: 1;
  }
  46%,
  100% {
    opacity: 0;
  }
}

@keyframes loadingDot {
  0%,
  100% {
    opacity: 0.35;
    transform: translateY(0);
  }
  50% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

@media (min-width: 761px) {
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  body.sidebar-collapsed .sidebar {
    overflow: hidden;
    border-right-color: transparent;
    opacity: 0;
    padding-right: 0;
    padding-left: 0;
    pointer-events: none;
  }

  body.sidebar-collapsed .sidebar-open-button {
    display: inline-grid;
  }
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 300px;
  }

  .chat-header {
    padding-right: 22px;
    padding-left: 22px;
  }

  .messages {
    padding-right: 22px;
    padding-left: 22px;
  }

  .composer {
    right: 22px;
    left: 22px;
  }
}

@media (max-width: 760px) {
  body.sidebar-collapsed .app-shell {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .sidebar {
    opacity: 1;
    padding: 18px;
    pointer-events: auto;
  }

  .sidebar-open-button {
    display: none;
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: min(86vw, 332px);
    border-right: 1px solid var(--line);
    padding: 18px;
    transform: translateX(-104%);
    transition: transform 200ms ease;
    box-shadow: 10px 0 28px oklch(0.2 0.018 235 / 0.16);
  }

  .brand {
    grid-template-columns: 40px minmax(0, 1fr) 34px;
  }

  body.history-open .sidebar {
    transform: translateX(0);
  }

  .history-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19;
    display: block;
    border: 0;
    background: oklch(0.2 0.018 235 / 0.28);
    opacity: 0;
    pointer-events: none;
    transition: opacity 160ms ease;
  }

  body.history-open .history-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  .chat-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px 14px 12px;
  }

  .header-actions {
    width: 100%;
    gap: 8px;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .mobile-only,
  .ghost-button.mobile-only {
    display: inline-flex;
  }

  .health-text {
    min-width: 0;
    flex: 1 1 auto;
  }

  #exportButton {
    display: none;
  }

  .setup-banner {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
    padding: 10px 14px;
  }

  .messages {
    gap: 16px;
    padding: 18px 12px calc(var(--composer-height) + 28px);
  }

  .message-avatar {
    display: none;
  }

  .message-bubble {
    max-width: 100%;
    padding: 13px;
  }

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

  .composer {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    left: 10px;
    grid-template-columns: minmax(0, 1fr) 76px;
    gap: 8px;
    padding: 8px;
  }

  .composer textarea {
    min-height: 44px;
    max-height: 116px;
    padding: 10px 8px;
  }

  .send-button {
    width: 76px;
    min-width: 76px;
    min-height: 44px;
    padding: 0 8px;
  }
}

@media (max-width: 420px) {
  .brand h1,
  .chat-header h2 {
    font-size: 0.98rem;
  }

  .health-text {
    width: 100%;
  }

  .composer {
    grid-template-columns: minmax(0, 1fr) 68px;
  }

  .send-button {
    width: 68px;
    min-width: 68px;
    font-size: 0.84rem;
  }
}

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