.rich-response {
  display: grid;
  gap: 12px;
  min-width: 0;
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.rich-response > :first-child { margin-top: 0; }
.rich-response > :last-child { margin-bottom: 0; }

.rich-response-heading {
  margin: 14px 0 2px;
  font-size: 1.03rem;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.rich-response-paragraph {
  margin: 0;
  white-space: pre-wrap;
}

.rich-response-list {
  margin: 0;
  padding-left: 1.45rem;
}

.rich-response-list li + li { margin-top: 5px; }

.rich-response-quote {
  margin: 2px 0;
  padding: 9px 12px;
  border-left: 3px solid rgba(45, 55, 72, 0.28);
  background: rgba(45, 55, 72, 0.045);
  border-radius: 0 8px 8px 0;
  white-space: pre-wrap;
}

.rich-code-block,
.rich-table-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.13);
  border-radius: 10px;
  background: #f7f8fa;
}

.rich-code-header,
.rich-table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.1);
  font-size: 0.78rem;
  color: #5b6472;
}

.rich-code-copy,
.rich-table-download {
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid rgba(31, 41, 55, 0.16);
  border-radius: 7px;
  background: #fff;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.rich-code-copy:hover,
.rich-table-download:hover { background: #f0f2f5; }

.rich-code-copy:focus-visible,
.rich-table-download:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.rich-code-block pre {
  margin: 0;
  padding: 14px;
  overflow: auto;
  background: #15181d;
  color: #eef2f7;
  font: 0.88rem/1.62 ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}

.rich-code-block code {
  font: inherit;
  white-space: pre;
}

.rich-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.rich-table-block table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  background: #fff;
  font-size: 0.9rem;
}

.rich-table-block th,
.rich-table-block td {
  padding: 9px 11px;
  border-bottom: 1px solid rgba(31, 41, 55, 0.1);
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
}

.rich-table-block th {
  background: #f7f8fa;
  font-weight: 700;
}

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

@media (max-width: 640px) {
  .rich-response { gap: 10px; }
  .rich-code-block pre { padding: 12px; font-size: 0.82rem; }
  .rich-table-block table { min-width: 360px; font-size: 0.84rem; }
  .rich-table-block th,
  .rich-table-block td { padding: 8px 9px; }
}
