:root {
  color-scheme: light;
  --bg: #f4efe7;
  --panel: rgba(255, 250, 243, 0.86);
  --panel-strong: #fffdf9;
  --border: rgba(90, 64, 42, 0.14);
  --text: #24170f;
  --muted: #7b6858;
  --accent: #b4492f;
  --accent-dark: #8b341f;
  --user: #f3d8c6;
  --assistant: #f7f2eb;
  --shadow: 0 24px 80px rgba(66, 35, 18, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100vh;
  font-family: "IBM Plex Sans", "Noto Sans TC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(180, 73, 47, 0.15), transparent 28%),
    radial-gradient(circle at bottom right, rgba(99, 132, 111, 0.16), transparent 28%),
    linear-gradient(160deg, #f8f1e8, #efe5da 56%, #f7f3ed);
  overflow: hidden;
}

body.admin-page {
  height: auto;
  min-height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(244, 239, 231, 0.86);
  backdrop-filter: blur(18px);
  z-index: 10;
}

.auth-card {
  width: min(420px, calc(100vw - 32px));
  padding: 40px 28px 28px;
  border-radius: 28px;
  border: 1px solid var(--border);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-card h2 {
  margin: 0 0 12px;
  font-size: 28px;
}

.auth-hint {
  margin: 12px 0 16px;
  font-size: 13px;
  color: var(--muted);
}

.admin-shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.admin-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.admin-header-actions {
  display: flex;
  gap: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 8px 0 28px;
}

.admin-grid-cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-grid-status {
  grid-template-columns: 1fr;
}

.admin-grid-charts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
  width: 100%;
}

.admin-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-end;
  width: 100%;
}

.admin-filter-row-actions {
  justify-content: flex-start;
}

.admin-field {
  min-width: 0;
  flex: 0 0 auto;
}

.admin-field-date,
.admin-field-role {
  width: 152px;
}

.admin-field-aggregate {
  width: 116px;
}

.admin-field-user,
.admin-field-model {
  width: 220px;
}

.admin-field-auto-refresh {
  margin-left: auto;
  width: 160px;
}

.admin-filter-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.admin-filter-actions-main {
  width: 100%;
}

.admin-action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff7f2;
  text-decoration: none;
  font-weight: 600;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease, color 120ms ease;
}

.admin-action-button:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.admin-action-button.ghost {
  background: transparent;
  color: var(--muted);
}

.admin-action-button.ghost:hover {
  background: rgba(36, 23, 15, 0.06);
  color: var(--text);
}

.admin-toggle-button {
  width: 100%;
  min-width: 0;
  white-space: nowrap;
}

.admin-toggle-button.is-active {
  background: var(--accent);
  color: #fff7f2;
  border-color: transparent;
}

.admin-toggle-button.is-active:hover {
  background: var(--accent-dark);
  color: #fff7f2;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

.stats-table th {
  color: var(--muted);
  font-weight: 600;
}

.stats-sub {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.stats-user-row {
  cursor: pointer;
}

.stats-day-row {
  cursor: pointer;
}

.stats-day-row.is-selected,
.stats-user-row.is-selected {
  background: rgba(243, 216, 198, 0.4);
}

.bar-chart {
  min-height: 260px;
  width: 100%;
}

.line-chart {
  width: 100%;
  height: 220px;
}

.line-chart-grid {
  stroke: rgba(90, 64, 42, 0.14);
  stroke-width: 1;
}

.line-chart-path {
  fill: none;
  stroke: #b4492f;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart-point {
  fill: #fff;
  stroke: #8b341f;
  stroke-width: 2;
}

.line-chart-labels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
}

.line-chart-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  color: var(--muted);
}

.line-chart-label strong {
  color: var(--text);
  font-weight: 600;
}

@media (max-width: 1100px) {
  .admin-field-date,
  .admin-field-role,
  .admin-field-aggregate,
  .admin-field-user,
  .admin-field-model {
    width: 180px;
  }

  .admin-field-auto-refresh {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  .admin-grid-charts {
    grid-template-columns: 1fr;
  }

  .admin-grid-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-field-date,
  .admin-field-role,
  .admin-field-aggregate,
  .admin-field-user,
  .admin-field-model,
  .admin-field-auto-refresh,
  .admin-filter-actions-main {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .admin-shell {
    padding: 16px;
  }

  .admin-grid-cards,
  .admin-grid,
  .admin-grid-charts {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: auto;
    padding: 16px;
  }

  .metric-value {
    font-size: 28px;
    line-height: 1.05;
    word-break: break-word;
  }

  .metric-sub {
    font-size: 11px;
  }

  .bar-chart {
    min-height: 220px;
  }

  .line-chart {
    height: 180px;
  }

  .line-chart-labels {
    grid-template-columns: repeat(auto-fit, minmax(56px, 1fr));
    gap: 6px;
  }

  .line-chart-label {
    font-size: 11px;
  }

  .admin-filter-actions-main {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .admin-action-button {
    width: 100%;
    min-width: 0;
  }

  .stats-table {
    font-size: 12px;
  }
}

.shell {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  height: 100vh;
  gap: 24px;
  padding: 24px;
}

.sidebar,
.chat {
  border: 1px solid var(--border);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 24px;
  overflow: auto;
}

.sidebar-topics-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
}

.sidebar-status-panel {
  margin-top: auto;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 12px;
  color: var(--accent);
}

h1 {
  margin: 0;
  font-size: 36px;
  line-height: 1;
}

.muted {
  color: var(--muted);
  line-height: 1.5;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#localLoginFields .field:last-of-type {
  margin-bottom: 18px;
}

.field span,
.status,
.meta {
  font-size: 13px;
  color: var(--muted);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px 16px;
  background: var(--panel-strong);
  color: var(--text);
  resize: vertical;
}

select {
  appearance: none;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease;
}

button:hover {
  transform: translateY(-1px);
}

#sendButton {
  background: var(--accent);
  color: #fff7f2;
}

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

.secondary {
  background: #eadfd3;
  color: var(--text);
}

.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 8px 12px;
}

.toolbar-icon-button {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}

.toolbar-icon-group {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.toolbar-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.thread-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.thread-item {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  position: relative;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 253, 249, 0.68);
  color: var(--text);
  gap: 10px;
}

.thread-item-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  padding: 0;
}

.thread-item-main:hover {
  transform: none;
}

.thread-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
  justify-content: center;
}

.thread-indicators {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.thread-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #1f6fff;
  box-shadow: 0 0 0 3px rgba(31, 111, 255, 0.14);
}

.thread-dot.is-processing {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(180, 73, 47, 0.14);
  animation: pulseDot 1.2s ease-in-out infinite;
}

.thread-item.is-active {
  border-color: rgba(180, 73, 47, 0.35);
  background: rgba(243, 216, 198, 0.75);
}

.thread-title {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.2;
}

.thread-delete {
  display: none;
}

.thread-actions {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.thread-menu-trigger {
  border: 0;
  background: transparent;
  color: rgba(90, 64, 42, 0.72);
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 10px;
  font-size: 20px;
  line-height: 1;
  opacity: 0;
  transition: opacity 120ms ease, background 120ms ease;
}

.thread-item:hover .thread-menu-trigger,
.thread-item.is-active .thread-menu-trigger,
.thread-menu-trigger:focus-visible {
  opacity: 1;
}

.thread-menu-trigger:hover {
  background: rgba(36, 23, 15, 0.06);
  transform: none;
}

.trash-icon {
  width: 19px;
  height: 19px;
  display: block;
  margin: 0 auto;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 6px;
}

.panel + .panel {
  margin-top: 12px;
}

.stat-card,
.response-usage {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 12px 14px;
  background: var(--panel-strong);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}

.status-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.compact-status-card {
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
}

.metric-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 110px;
  justify-content: center;
  padding: 18px 18px 16px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(248, 241, 232, 0.94));
  box-shadow: 0 12px 28px rgba(66, 35, 18, 0.06);
}

.metric-label {
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-value {
  font-size: 32px;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
}

.metric-sub {
  font-size: 12px;
  color: var(--muted);
}

.table-card {
  padding: 6px 16px 8px;
  overflow: hidden;
}

.response-sources {
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 0;
  background: var(--panel-strong);
  font-size: 13px;
  line-height: 1.6;
}

.response-sources-panel {
  width: 100%;
}

.response-sources-panel summary {
  list-style: none;
}

.response-sources-panel summary::-webkit-details-marker {
  display: none;
}

.response-sources-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
}

.response-sources-title {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.response-sources-chevron {
  flex-shrink: 0;
  color: var(--muted);
  font-size: 12px;
}

.response-sources-panel[open] .response-sources-chevron {
  font-size: 0;
}

.response-sources-panel[open] .response-sources-chevron::after {
  content: "收合";
  font-size: 12px;
}

.response-sources-list {
  padding: 0 14px 14px;
  max-height: 280px;
  overflow: auto;
}

.message-sources-panel {
  margin-top: 14px;
  border: 1px solid rgba(90, 64, 42, 0.12);
  border-radius: 16px;
  background: rgba(255, 253, 249, 0.52);
}

.source-group + .source-group {
  margin-top: 10px;
}

.source-group-title {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: lowercase;
}

.source-group-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.source-link {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  text-decoration: none;
  border: 1px solid var(--border);
  background: rgba(255, 252, 247, 0.8);
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.source-link + .source-link {
  margin-top: 8px;
}

.source-link:hover {
  border-color: rgba(180, 73, 47, 0.35);
}

.source-link.is-highlighted {
  border-color: rgba(180, 73, 47, 0.55);
  background: rgba(243, 216, 198, 0.5);
}

.source-title {
  display: block;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.source-url {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}

.inline-link:hover {
  color: var(--accent-dark);
}

.inline-code {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(90, 64, 42, 0.08);
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.source-ref {
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  cursor: pointer;
  text-decoration: none;
}

.source-ref:hover {
  color: var(--accent-dark);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 6px 0;
}

.rich-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 14px;
  background: rgba(255, 253, 249, 0.55);
  border-radius: 14px;
  overflow: hidden;
}

.rich-table th,
.rich-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(90, 64, 42, 0.12);
  text-align: left;
  vertical-align: top;
}

.rich-table th {
  color: var(--muted);
  font-weight: 600;
  background: rgba(255, 253, 249, 0.72);
}

.rich-table tbody tr:last-child td {
  border-bottom: 0;
}

.rich-table tbody tr:last-child th {
  border-bottom: 0;
}

.bubble p {
  margin: 0;
}

.bubble p + p,
.bubble p + .table-wrap,
.bubble p + .md-list,
.bubble p + .md-blockquote,
.bubble p + .code-block,
.bubble .table-wrap + p,
.bubble .md-list + p,
.bubble .md-blockquote + p,
.bubble .code-block + p,
.bubble .md-heading + p,
.bubble .md-heading + .table-wrap,
.bubble .md-heading + .md-list,
.bubble .md-heading + .md-blockquote,
.bubble .md-heading + .code-block,
.bubble .md-list + .md-list,
.bubble .table-wrap + .table-wrap,
.bubble .code-block + .code-block {
  margin-top: 12px;
}

.md-heading {
  margin: 0;
  font-weight: 700;
  line-height: 1.35;
}

.md-heading-1,
.md-heading-2 {
  font-size: 1.22em;
}

.md-heading-3 {
  font-size: 1.1em;
}

.md-list {
  margin: 0;
  padding-left: 22px;
}

.md-list li + li {
  margin-top: 6px;
}

.md-blockquote {
  margin: 0;
  padding: 10px 14px;
  border-left: 3px solid rgba(180, 73, 47, 0.35);
  background: rgba(255, 253, 249, 0.5);
  color: var(--muted);
  border-radius: 0 14px 14px 0;
}

.code-block {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(90, 64, 42, 0.12);
  border-radius: 16px;
  background: #2c241f;
  color: #f8f1e8;
}

.code-block-label {
  padding: 8px 12px;
  font-size: 12px;
  color: rgba(248, 241, 232, 0.72);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-transform: lowercase;
}

.code-block code {
  display: block;
  padding: 14px 16px;
  overflow-x: auto;
  font-family: "IBM Plex Mono", "SFMono-Regular", monospace;
  font-size: 13px;
  line-height: 1.65;
  white-space: pre;
}

.is-hidden {
  display: none;
}

.chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.messages {
  padding: 28px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1 1 auto;
  min-height: 0;
  scroll-behavior: smooth;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: min(780px, 100%);
  animation: rise 180ms ease;
}

.message-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
  color: var(--muted);
  font-size: 13px;
}

.thinking-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 2px;
}

.thinking-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(36, 23, 15, 0.78);
  animation: thinkingPulse 1s ease-in-out infinite;
}

.thinking-indicator span:nth-child(2) {
  animation-delay: 0.14s;
}

.thinking-indicator span:nth-child(3) {
  animation-delay: 0.28s;
}

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

  50% {
    transform: scale(0.82);
    opacity: 0.7;
  }
}

@keyframes thinkingPulse {
  0%,
  80%,
  100% {
    transform: scale(0.7);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

.message.user {
  align-self: flex-end;
}

.message-actions {
  display: flex;
  gap: 8px;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 140ms ease, transform 140ms ease;
}

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

.message:hover .message-actions {
  opacity: 1;
  transform: translateY(0);
}

.copy-message {
  width: 24px;
  min-width: 24px;
  height: 24px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: transparent;
}

.action-group {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.action-tooltip {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 16px;
  background: #000;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.action-group:hover .action-tooltip {
  opacity: 1;
}

.copy-icon {
  width: 20px;
  height: 20px;
  display: block;
}

.copy-icon-success {
  display: none;
}

.copy-message.is-copied .copy-icon-default {
  display: none;
}

.copy-message.is-copied .copy-icon-success {
  display: block;
}

.bubble {
  padding: 16px 18px;
  border-radius: 22px;
  line-height: 1.6;
  white-space: normal;
  word-break: break-word;
  border: 1px solid var(--border);
}

.message-text + .message-attachments {
  margin-top: 12px;
}

.message-attachments {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.message-attachment {
  margin: 0;
}

.message-image {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  max-height: min(60vh, 520px);
  object-fit: contain;
  border-radius: 16px;
  border: 1px solid rgba(90, 64, 42, 0.12);
}

.message-file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(90, 64, 42, 0.12);
  background: rgba(255, 253, 249, 0.72);
  font-size: 12px;
}

.message.user .bubble {
  background: var(--user);
}

.message.assistant .bubble {
  background: var(--assistant);
}

.composer {
  position: sticky;
  bottom: 0;
  border-top: 1px solid var(--border);
  padding: 20px;
  background: rgba(255, 252, 247, 0.75);
  border-bottom-left-radius: 28px;
  border-bottom-right-radius: 28px;
  backdrop-filter: blur(18px);
  flex-shrink: 0;
}

.composer-shell {
  border: 1px solid rgba(90, 64, 42, 0.2);
  border-radius: 24px;
  background: rgba(255, 253, 249, 0.9);
  padding: 10px 12px;
}

.composer-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  height: 36px;
}

.composer-attach {
  position: relative;
  flex-shrink: 0;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(90, 64, 42, 0.14);
  background: rgba(255, 253, 249, 0.72);
  box-shadow: 0 1px 6px rgba(66, 35, 18, 0.05);
  overflow: hidden;
  align-self: center;
}

.composer-attach::before,
#sendButton::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 999px;
  z-index: 0;
}

.composer-shell.is-dragover {
  border-color: var(--accent);
  background: rgba(243, 216, 198, 0.32);
}

.attachment-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 2px;
}

.attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  font-size: 12px;
}

.attachment-remove {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--muted);
}

.response-usage {
  margin-top: 12px;
}

.composer-input-wrap {
  margin: 5px;
  height: 36px;
  display: flex;
  align-items: center;
}

#messageInput {
  height: 24px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  line-height: 24px;
  margin: 0;
  display: block;
  font: inherit;
}

#messageInput::placeholder {
  line-height: 24px;
}

#messageInput:focus {
  outline: none;
}

.attach-icon {
  width: 18px;
  height: 18px;
  display: block;
  position: relative;
  z-index: 1;
}

#sendButton {
  position: relative;
  width: 36px;
  min-width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fffdf9;
  color: #2f2620;
  border: 1px solid rgba(90, 64, 42, 0.12);
  box-shadow: 0 2px 8px rgba(66, 35, 18, 0.08);
  overflow: hidden;
  align-self: center;
}

#sendButton:hover {
  background: #fffdf9;
  color: #2f2620;
}

.composer-attach::before {
  background: rgba(255, 255, 255, 0.96);
}

.send-icon {
  width: 26px;
  height: 26px;
  display: block;
  position: relative;
  z-index: 1;
}

.send-icon-stop {
  display: none;
}

#sendButton.is-busy .send-icon-arrow {
  display: none;
}

#sendButton.is-busy .send-icon-stop {
  display: block;
}

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

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

@media (max-width: 920px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
  }

  .shell {
    grid-template-columns: 1fr;
    height: auto;
  }

  .chat {
    min-height: 70vh;
    height: 70vh;
  }
}
