














.chat-shell {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 220px);
  min-height: 420px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-empty {
  margin: auto;
  text-align: center;
  color: var(--text-secondary);
  max-width: 40ch;
}

.chat-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 1rem;
}

.chat-starter-chip {
  font: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--page-bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.chat-starter-chip:hover {
  background: var(--card-bg);
  border-color: var(--red);
}

.chat-turn {
  max-width: 78%;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.chat-turn.user {
  align-self: flex-end;
  align-items: flex-end;
}

.chat-turn.assistant {
  align-self: flex-start;
  align-items: flex-start;
}

.chat-bubble {
  border-radius: var(--radius-lg);
  padding: 0.7rem 1rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.chat-turn.user .chat-bubble {
  background: var(--red);
  color: #ffffff;
}

.chat-turn.assistant .chat-bubble {
  background: var(--page-bg);
  border: 1px solid var(--border-light);
  color: var(--text);
}


.chat-bubble p {
  margin: 0 0 0.6em;
}
.chat-bubble p:last-child {
  margin-bottom: 0;
}
.chat-bubble ul,
.chat-bubble ol {
  margin: 0 0 0.6em 1.2em;
  padding: 0;
}
.chat-bubble code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 3px;
  padding: 0.1em 0.3em;
}
.chat-bubble pre {
  background: rgba(0, 0, 0, 0.06);
  border-radius: var(--radius);
  padding: 0.6em 0.8em;
  overflow-x: auto;
  margin: 0 0 0.6em;
}
.chat-bubble pre code {
  background: none;
  padding: 0;
}



.chat-thought {
  font-size: 0.78rem;
  color: var(--text-label);
  font-style: italic;
}

.chat-thought summary {
  cursor: pointer;
  list-style: none;
}
.chat-thought summary::-webkit-details-marker {
  display: none;
}
.chat-thought summary::before {
  content: "▸ ";
}
.chat-thought[open] summary::before {
  content: "▾ ";
}


.chat-sql {
  font-size: 0.8rem;
  align-self: stretch;
}

.chat-sql summary {
  cursor: pointer;
  color: var(--text-secondary);
  font-weight: 600;
  padding: 0.3rem 0;
}

.chat-sql pre {
  background: #1a1a1a;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  overflow-x: auto;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.8rem;
  margin: 0.4rem 0 0;
}



.chat-table-wrap {
  align-self: stretch;
  overflow-x: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.chat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.chat-table th,
.chat-table td {
  padding: 0.45rem 0.7rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.chat-table th {
  background: var(--page-bg);
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.chat-table-note {
  font-size: 0.75rem;
  color: var(--text-label);
  padding: 0.4rem 0.7rem;
}











.chat-chart {
  align-self: stretch;
  max-height: 360px;
  overflow-y: auto;
  overflow-x: hidden;
}

.chat-error {
  align-self: stretch;
  background: rgba(166, 38, 38, 0.06);
  border: 1px solid rgba(166, 38, 38, 0.25);
  color: var(--red);
  border-radius: var(--radius);
  padding: 0.6rem 0.9rem;
  font-size: 0.85rem;
}

.chat-input-row {
  display: flex;
  gap: 0.6rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--card-bg);
}

.chat-input {
  flex: 1;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
}

.chat-input:disabled {
  background: var(--page-bg);
  color: var(--text-label);
}

.chat-send-btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.85rem;
  color: #ffffff;
  background: var(--red);
  border: none;
  border-radius: var(--radius);
  padding: 0 1.25rem;
  cursor: pointer;
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--red-hover);
}

.chat-send-btn:disabled {
  background: var(--border);
  color: var(--text-label);
  cursor: not-allowed;
}

.chat-typing {
  align-self: flex-start;
  color: var(--text-label);
  font-size: 0.8rem;
  font-style: italic;
}
