:root {
  --base-font-size: calc(1rem + 0.1618vw);
  --ratio: 1.618;
  --s-2: calc(var(--s-1) / var(--ratio));
  --s-1: calc(var(--s0) / var(--ratio));
  --s0: var(--base-font-size);
  --s1: calc(var(--s0) * var(--ratio));
  --s2: calc(var(--s1) * var(--ratio));
  --s3: calc(var(--s2) * var(--ratio));

  --font-sans: system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, monospace;

  --color-black: #1d1f21;
  --color-blue: #4271ae;
  --color-brown: #a3685a;
  --color-cyan: #3e999f;
  --color-gray0: #efefef;
  --color-gray1: #e0e0e0;
  --color-gray2: #d6d6d6;
  --color-gray3: #8e908c;
  --color-gray4: #969896;
  --color-gray5: #4d4d4c;
  --color-gray6: #282a2e;
  --color-green: #718c00;
  --color-orange: #f5871f;
  --color-purple: #8959a8;
  --color-red: #c82829;
  --color-yellow: #eab700;

  --color-bg: var(--color-gray0);
  --color-surface: white;
  --color-text: var(--color-black);
  --color-text-muted: var(--color-gray3);
  --color-border: var(--color-black);
  --color-border-light: var(--color-gray2);
  --color-primary: var(--color-blue);
  --color-primary-hover: var(--color-cyan);
  --color-recording: var(--color-red);
  --color-error: var(--color-yellow);

  --measure: 80ch;
  --radius: 0.375rem;
  --icon-size: 1.25rem;
  --action-icon-size: 0.875rem;
  --border-width: 2px;
  --textarea-line-height: 1.5rem;
}

/* ==================== */
/* Reset                */
/* ==================== */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
}

/* ==================== */
/* Base                 */
/* ==================== */

html {
  font-size: 100%;
  font-family: var(--font-sans);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
}

body {
  overflow: hidden;
  min-height: 100dvh;
}

/* ==================== */
/* Layout               */
/* ==================== */

.container {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  height: 100dvh;
  max-width: calc(var(--measure) + var(--s3) * 2);
  margin-inline: auto;
  padding: var(--s0);
  padding-bottom: 0;
}

/* ==================== */
/* Chat                 */
/* ==================== */

.chat {
  flex: 1 1 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--s1);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
}

.chat > * + * {
  margin-top: var(--s0);
}

.chat-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s1) 0;
}

.chat-loading[hidden] {
  display: none;
}

.chat-loading__spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid var(--color-gray2);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
/* ==================== */
/* Compose              */
/* ==================== */

.compose {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: var(--s0);
}

.compose__action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background-color 0.15s ease;
}

@media (hover: hover) {
  .compose__action-btn:hover {
    color: var(--color-text);
  }
}

.compose__action-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.compose__action-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.compose__action-btn .icon {
  width: var(--action-icon-size);
  height: var(--action-icon-size);
}

.compose__action-btn--location.active {
  color: var(--color-green);
}

.compose__action-btn--record.recording {
  color: white;
  background: var(--color-recording);
  animation: pulse 1s ease-in-out infinite;
}

/* Transcribe button: recording state (same as PTT but for transcribe) */
.compose__action-btn--recording {
  color: white;
  background: var(--color-recording);
  animation: pulse 1s ease-in-out infinite;
}

/* Transcribe button: transcribing state (spinning) */
.compose__action-btn--transcribing {
  color: var(--color-primary);
  animation: spin 1s linear infinite;
}

.compose__action-btn--send .compose__icon--stop {
  display: none;
}

.compose__action-btn--send.loading {
  pointer-events: auto;
  cursor: pointer;
}

/* Hide the send icon, show the stop icon during loading */
.compose__action-btn--send.loading .compose__icon--send {
  display: none;
}

.compose__action-btn--send.loading .compose__icon--stop {
  display: block;
}

/* Pending stop: yellow background, click again to confirm */
.compose__action-btn--send.loading.pending {
  background: var(--color-yellow);
  color: var(--color-black);
}

@media (hover: hover) {
  .compose__action-btn--send.loading.pending:hover {
    background: var(--color-yellow);
  }
}

.compose__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.125rem var(--s-2);
  border-top: 1px dotted var(--color-border-light);
}

.compose__actions-left {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.compose__actions-right {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.compose__attachment {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: var(--s-1);
  background: var(--color-gray1);
  border-radius: var(--radius);
  color: var(--color-text);
}

.compose__attachment-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compose__attachment-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .compose__attachment-remove:hover {
    color: var(--color-red);
  }
}

.compose__attachment-remove .icon {
  width: 0.875rem;
  height: 0.875rem;
}

.compose__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-1);
  border-top: 1px dotted var(--color-border-light);
}

.compose__attachments:empty {
  display: none;
}

.compose__textarea {
  display: block;
  width: 100%;
  height: auto;
  min-height: calc(var(--textarea-line-height) + var(--s-1) * 2);
  max-height: calc(var(--textarea-line-height) * 5 + var(--s-1) * 2);
  padding: var(--s-1);
  font-family: inherit;
  font-size: var(--s0);
  line-height: var(--textarea-line-height);
  color: var(--color-text);
  background: var(--color-surface);
  border: none;
  resize: none;
  overflow-y: auto;
  field-sizing: content;
}

.compose__textarea:focus {
  outline: none;
}

.compose__textarea::placeholder {
  color: var(--color-text-muted);
}

/* ==================== */
/* Footer               */
/* ==================== */

.footer {
  margin-top: var(--s0);
  background: var(--color-bg);
}

.footer__select {
  height: 2rem;
  padding: 0 var(--s-1);
  font-family: inherit;
  font-size: var(--s-1);
  line-height: 2rem;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  cursor: pointer;
  max-width: 150px;
}

.footer__select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.footer__toolbar {
  border-inline: none;
  border-bottom: none;
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
}

.footer__toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 2rem;
  width: 2rem;
  padding: 0;
  background: transparent;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

@media (hover: hover) {
  .footer__toolbar-btn:hover {
    color: var(--color-text);
    border-color: var(--color-text-muted);
  }
}

.footer__toolbar-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.footer__toolbar-btn .icon {
  width: 1rem;
  height: 1rem;
}

/* Following state: cyan accent on the down button. */
#scroll-down.following {
  color: var(--color-cyan);
  border-color: var(--color-cyan);
}

@media (hover: hover) {
  #scroll-down.following:hover {
    color: var(--color-cyan);
    border-color: var(--color-cyan);
  }
}

.footer__toolbar-btn--muted {
  color: var(--color-red);
  border-color: var(--color-red);
}

.footer__toolbar-btn--pending {
  background: var(--color-yellow);
  color: var(--color-black);
  border-color: var(--color-yellow);
}

@media (hover: hover) {
  .footer__toolbar-btn--pending:hover {
    background: var(--color-yellow);
    color: var(--color-black);
    border-color: var(--color-yellow);
  }
}

@media (hover: hover) {
  .footer__toolbar-btn--muted:hover {
    color: var(--color-red);
    border-color: var(--color-red);
  }
}

.footer__toolbar-spacer {
  flex: 1;
}

/* ==================== */
/* Message              */
/* ==================== */

.message {
  max-width: 100%;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.message__icon {
  width: var(--action-icon-size);
  height: var(--action-icon-size);
  flex-shrink: 0;
  color: var(--color-text-muted);
}

.message--assistant .message__icon {
  color: var(--color-primary);
}

.message--streaming {
  border-style: dashed;
}

.message__debug {
  display: none;
  padding: var(--s-2) var(--s-1);
  border-top: 1px dotted var(--color-border-light);
  background: var(--color-surface);
}

.message--debug-open .message__debug {
  display: block;
}

.message--error {
  border-color: var(--color-error);
}

.message--user .message__icon {
  color: var(--color-green);
}

.message__action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.125rem;
  background: transparent;
  border: none;
  border-radius: 0.125rem;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
}

@media (hover: hover) {
  .message__action-btn:hover {
    color: var(--color-text);
  }
}

.message__action-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.message__action-btn svg {
  width: var(--action-icon-size);
  height: var(--action-icon-size);
}

.message__action-btn--success {
  color: var(--color-primary);
}

.message__action-btn--play.playing {
  color: var(--color-red);
}

@media (hover: hover) {
  .message__action-btn--delete:hover {
    color: var(--color-red);
  }
}

/* Pending delete: yellow highlight, click again to confirm */
.message__action-btn--delete.pending {
  color: var(--color-yellow);
}

@media (hover: hover) {
  .message__action-btn--delete.pending:hover {
    color: var(--color-yellow);
  }
}

.message__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.125rem;
  padding: 0.125rem 0.25rem;
  border-top: 1px dotted var(--color-border-light);
  background: var(--color-surface);
}

.message__actions:empty {
  display: none;
}

.message__actions-buttons {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.message__body {
  display: flex;
  flex-direction: column;
}

.message__content {
  padding: var(--s-2) var(--s-1);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.message__content img {
  display: block;
  max-width: 100%;
  height: auto;
  margin-block: var(--s-1);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
}

.message__debug-list {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.125rem 1rem;
  margin: 0;
  font-size: var(--s-1);
}

.message__debug-list dt,
.message__debug-list dd {
  margin: 0;
  text-align: left;
  color: var(--color-text);
}

.message__debug-list dt {
  white-space: nowrap;
}

/* ==================== */
/* Settings Modal       */
/* ==================== */

.settings-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: var(--s1);
}

.settings-overlay.open {
  display: flex;
}

.settings-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--s1);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.settings-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--s1);
}

.settings-panel__title {
  font-size: var(--s1);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

/* Close button: remove toolbar border, darken the X. */
#settings-close {
  border: none;
  color: var(--color-text);
}

@media (hover: hover) {
  #settings-close:hover {
    border-color: transparent;
    color: var(--color-text);
  }
}

#compose-settings-close {
  border: none;
  color: var(--color-text);
}

@media (hover: hover) {
  #compose-settings-close:hover {
    border-color: transparent;
    color: var(--color-text);
  }
}

/* Tabs */
.settings-tabs {
  display: flex;
  border-bottom: 2px solid var(--color-border-light);
  margin-bottom: var(--s1);
}

.settings-tab {
  padding: var(--s-2) var(--s-1);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  font-size: var(--s-1);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

@media (hover: hover) {
  .settings-tab:hover {
    color: var(--color-text);
  }
}

.settings-tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.settings-tab.active {
  color: var(--color-text);
  border-bottom-color: var(--color-primary);
  font-weight: 500;
}

/* Tab panels */
.settings-tab-panel {
  display: none;
}

.settings-tab-panel.active {
  display: block;
}

.settings-label {
  display: block;
  font-size: var(--s-1);
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: var(--s-2);
}

.settings-label__sub {
  display: block;
  font-size: var(--s-1);
  font-weight: 400;
  color: var(--color-text-muted);
  margin-top: 0.125rem;
}

.settings-select {
  width: 100%;
  height: var(--s2);
  padding: 0 var(--s-1);
  font-family: inherit;
  font-size: var(--s-1);
  line-height: var(--s2);
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  cursor: pointer;
  margin-bottom: var(--s1);
}

.settings-select:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.settings-textarea {
  display: block;
  width: 100%;
  min-height: calc(var(--s2) * 6);
  padding: var(--s-1);
  font-family: var(--font-mono);
  font-size: var(--s-1);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  resize: vertical;
  margin-bottom: var(--s-1);
}

.settings-textarea:focus {
  outline: 2px solid var(--color-primary);
  outline-offset: 1px;
}

.settings-save-row {
  display: flex;
  justify-content: flex-end;
}

.settings-save-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s-2) var(--s-1);
  font-family: inherit;
  font-size: var(--s-1);
  font-weight: 500;
  color: white;
  background: var(--color-primary);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 0.15s ease;
  min-width: var(--s2);
}

@media (hover: hover) {
  .settings-save-btn:hover {
    background: var(--color-primary-hover);
  }
}

.settings-save-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.settings-save-btn--success {
  background: var(--color-green);
}

.settings-save-btn .icon {
  width: 1rem;
  height: 1rem;
}

/* ==================== */
/* Animations           */
/* ==================== */

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

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ==================== */
/* Media: Mobile        */
/* ==================== */

@media (max-width: 639px) {
  .container {
    padding: 0;
    padding-top: var(--s-1);
  }

  .chat {
    border-radius: 0;
    border-inline: none;
  }

  .footer {
    margin-top: var(--s-1);
    padding-bottom: 0;
  }

  .compose {
    border-radius: 0;
    border-inline: none;
    margin-bottom: var(--s-1);
  }

  .compose__action-btn {
    min-width: 44px;
    min-height: 44px;
    padding: var(--s-1);
  }

  .compose__action-btn .icon {
    width: var(--icon-size);
    height: var(--icon-size);
  }

  .footer__toolbar {
    border-inline: none;
    border-bottom: none;
    border-radius: 0;
    margin-top: 0;
  }

  .footer__toolbar-btn {
    height: 1.75rem;
    width: 1.75rem;
  }

  .footer__select {
    height: 1.75rem;
    line-height: 1.75rem;
    max-width: 128px;
    font-size: var(--s-1);
  }

  .settings-overlay {
    padding: 0;
  }

  .settings-panel {
    max-width: 100%;
    max-height: 100dvh;
    height: 100dvh;
    border-radius: 0;
    border: none;
  }
}

/* Unavailable model indicators in settings select */
.settings-select option.model-unavailable-not-found {
  color: #dc2626;
  font-style: italic;
}

.settings-select option.model-unavailable-error {
  color: #6b7280;
  font-style: italic;
}

.settings-select optgroup {
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--color-text-secondary);
}

/* Context usage indicator in toolbar. */
.footer__toolbar-context {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  padding: 0 var(--s-1);
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--color-text-muted);
  white-space: nowrap;
  line-height: 1;
}
.footer__toolbar-context[hidden] {
  display: none;
}
.footer__toolbar-context--warning {
  color: var(--color-yellow);
}
.footer__toolbar-context--critical {
  color: var(--color-red);
}

/* ==================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  padding: var(--s2);
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  border: var(--border-width) solid var(--color-border);
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-1) var(--s1);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.modal__header h2 {
  font-size: var(--s0);
  font-weight: 600;
  margin: 0;
}

.modal__close {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--s-2);
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.modal__close .icon {
  width: var(--icon-size);
  height: var(--icon-size);
}

.modal__close:hover {
  color: var(--color-text);
}

.modal__body {
  padding: var(--s1);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.modal__textarea {
  width: 100%;
  min-height: 200px;
  height: 100%;
  padding: var(--s-1);
  font-family: var(--font-mono);
  font-size: var(--s-1);
  line-height: 1.5;
  border: var(--border-width) solid var(--color-border-light);
  border-radius: var(--radius);
  resize: none;
  outline: none;
}

/* Collapsible sections within the tool-call edit modal only.
   The textarea inside keeps its own border and focus styles so it looks
   identical to the bare textarea in single-section modals. */
.modal__collapsible + .modal__collapsible {
  margin-top: var(--s-1);
}

.modal__collapsible-summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0 0 var(--s-1) 0;
  cursor: pointer;
  user-select: none;
  list-style: none;
  font-size: var(--s-1);
  font-weight: 500;
  color: var(--color-text-muted);
}

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

.modal__collapsible-summary::before {
  content: "▶";
  font-size: 0.625em;
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
}

.modal__collapsible[open] > .modal__collapsible-summary::before {
  transform: rotate(90deg);
}

.modal__textarea:focus {
  border-color: var(--color-primary);
}

.modal__textarea--error {
  border-color: var(--color-red);
}

.modal__footer {
  padding: var(--s-1) var(--s1);
  border-top: 1px solid var(--color-border-light);
  display: flex;
  justify-content: flex-end;
  flex-shrink: 0;
}

.modal__save {
  padding: var(--s-1) var(--s2);
  font-size: var(--s0);
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.modal__save:hover {
  background: var(--color-primary-hover);
}

.modal__save--error {
  background: var(--color-red);
  animation: modal-flash 0.3s ease-in-out;
}

@keyframes modal-flash {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* Mobile: full-screen modal */
@media (max-width: 768px) {
  .modal-overlay {
    padding: 0;
    align-items: stretch;
  }

  .modal {
    max-width: 100%;
    max-height: 100%;
    height: 100%;
    border-radius: 0;
    border: none;
  }

  .modal__header {
    padding: var(--s-1) var(--s1);
  }

  .modal__body {
    padding: var(--s-1) var(--s1);
  }

  .modal__footer {
    padding: var(--s-1) var(--s1);
  }

  .modal__save {
    width: 100%;
    padding: var(--s-1) var(--s2);
    font-size: var(--s0);
  }
}

/* ==================== */
/* Reasoning & Tool Bubbles */
/* ==================== */

.message--reasoning .message__icon {
  color: var(--color-primary);
}

.message--reasoning .message__icon--reasoning {
  color: var(--color-purple);
}

.message--tool .message__icon {
  color: var(--color-primary);
}

.message--tool .message__icon--tool {
  color: var(--color-orange);
}

.message__collapsible {
  border-bottom: none;
}

.message__collapsible-summary {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  padding: var(--s-2) var(--s-1);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

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

.message__collapsible-summary::before {
  content: "▶";
  font-size: 0.625em;
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
}

.message__collapsible[open] > .message__collapsible-summary::before {
  transform: rotate(90deg);
}

.message__collapsible-label {
  font-size: var(--s-1);
  color: var(--color-text-muted);
}

/* .message__content inherits white-space: pre-wrap for plain text messages
   (to preserve newlines from LLM output). For tool messages, the content is
   structured HTML with newlines between child elements; pre-wrap renders those
   as visible blank lines, causing large vertical gaps. Reset to normal. */
.message--tool .message__content {
  white-space: normal;
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
}

.message__tool-section-label {
  font-size: var(--s-2);
  font-weight: 500;
  color: var(--color-text-muted);
  margin: 0 0 var(--s-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.message__tool-pre {
  margin: 0;
  padding: var(--s-2);
  font-family: var(--font-mono);
  font-size: var(--s-1);
  background: var(--color-bg);
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.message--system .message__icon {
  color: var(--color-text-muted);
}

.message--system .message__icon--system {
  color: var(--color-text-muted);
}

.message__placeholder {
  color: var(--color-text-muted);
}

/* Image attachment pills in user messages */
.message__image-pills {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  padding: 0 var(--s-1) var(--s-2);
}

.message__image-pill {
  display: flex;
  flex: 1 1 100%;
  min-width: 0;
  align-items: center;
  gap: 0.25rem;
  padding: 0.125rem 0.375rem;
  font-size: var(--s-1);
  background: var(--color-gray1);
  border-radius: var(--radius);
  color: var(--color-text);
}

.message__image-pill-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
