.chat-agent-messages {
  display: grid;
  gap: 1.25rem;
}
.chat-agent-message {
  padding-block: 0.25rem;
  min-width: 0;
}
.chat-agent-message + .chat-agent-message {
  border-top: 1px solid var(--border, #e2e8f0);
  padding-top: 1.25rem;
}
.chat-rich-card {
  margin: 1rem 0;
  padding: 1.1rem;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 16px;
  background: var(--surface, #fff);
  color: var(--text, #172033);
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.chat-rich-card h3,
.chat-rich-card figcaption {
  margin: 0 0 0.9rem;
  font-size: 1rem;
  font-weight: 650;
}
.chat-choice-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
}
.chat-choice-list button {
  display: flex;
  align-items: center;
  gap: 1rem;
  white-space: normal;
  text-align: start;
  border-radius: 12px;
  min-height: 44px;
  padding: 0.7rem 1rem;
  overflow-wrap: anywhere;
}
.chat-choice-list button span {
  margin-inline-start: auto;
  opacity: 0.5;
}
.chat-rich-card small,
.chat-chart-readout {
  font-size: 0.8rem;
  color: var(--muted, #64748b);
}
.chat-rich-form fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
  display: grid;
  gap: 0.85rem;
}
.chat-rich-form legend {
  font-weight: 650;
  margin-bottom: 0.85rem;
  padding: 0;
}
.chat-rich-form label {
  display: grid;
  gap: 0.4rem;
  font-size: 0.9rem;
}
.chat-rich-form input,
.chat-rich-form select,
.chat-rich-form textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
  padding: 0.75rem;
  background: var(--surface, #fff);
  color: inherit;
  font: inherit;
  min-height: 44px;
}
.chat-rich-form textarea {
  resize: vertical;
}
.chat-rich-form button {
  justify-self: start;
  min-height: 44px;
}
.chat-rich-feedback:empty {
  display: none;
}
.chat-rich-form .chat-rich-items {
  padding: 0.85rem;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
}
.chat-rich-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.chat-rich-form .chat-rich-item-choice {
  display: flex;
  align-items: center;
  flex: 1 1 12rem;
  min-height: 44px;
  overflow-wrap: anywhere;
}
.chat-rich-form .chat-rich-item-choice input {
  flex: 0 0 auto;
  width: 1.25rem;
  height: 1.25rem;
  min-height: 0;
  margin: 0 0.4rem 0 0;
}
.chat-rich-item-quantity {
  flex: 0 1 8rem;
}
.chat-rich-items [hidden] {
  display: none;
}
.chat-rich-card :is(button, input, textarea, select):focus-visible {
  outline: 2px solid #6366f1;
  outline-offset: 3px;
}
.chat-rich-card button:disabled {
  opacity: 0.5;
  cursor: default;
}
.chat-chart-legend {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.chat-chart-legend button {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 36px;
  font-size: 0.8rem;
  padding: 0.4rem 0.6rem;
}
.chat-chart-legend button[aria-pressed="false"] {
  opacity: 0.5;
  text-decoration: line-through;
}
.chat-chart-scroll {
  overflow: auto;
  max-width: 100%;
}
.chat-chart-plot {
  display: block;
  width: 100%;
  min-width: 340px;
  height: auto;
  overflow: visible;
  stroke: none;
}
.chat-chart-plot text {
  fill: var(--muted, #64748b);
  stroke: none;
  font: 11px system-ui;
}
.chat-chart-grid {
  stroke: var(--border, #e2e8f0);
  stroke-dasharray: 3 4;
}
.chat-chart-plot .is-hidden {
  display: none;
}
.chat-chart-plot [data-chart-point] {
  cursor: crosshair;
  outline: none;
}
.chat-chart-plot [data-chart-point]:is(:hover, :focus) :is(circle, rect) {
  stroke: var(--text, #172033);
  stroke-width: 3;
}
.chat-chart-readout {
  min-height: 2.4em;
  margin: 0.65rem 0;
}
.chat-chart summary {
  cursor: pointer;
  font-size: 0.85rem;
}
.chat-chart table {
  font-size: 0.85rem;
  width: 100%;
  margin-top: 0.7rem;
}
.chat-rich-pending {
  color: var(--muted, #64748b);
  font-size: 0.9rem;
}
@media (max-width: 600px) {
  .chat-rich-card {
    padding: 0.85rem;
    border-radius: 12px;
  }
  .chat-choice-list {
    display: grid;
  }
  .chat-choice-list button {
    width: 100%;
  }
  .chat-rich-form input,
  .chat-rich-form select,
  .chat-rich-form textarea {
    font-size: 16px;
  }
  .chat-chart-legend button {
    min-height: 44px;
  }
}

[data-rich-picker] {
  position: relative;
}
[data-rich-picker] [role="listbox"] {
  position: absolute;
  z-index: 5;
  inset: 100% 0 auto;
  max-height: 15rem;
  overflow-y: auto;
  background: var(--surface, white);
  color: var(--text, #172033);
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 8px;
  box-shadow: 0 5px 15px #0002;
}
[data-rich-option] {
  padding: 0.65rem 0.8rem;
  cursor: pointer;
  overflow-wrap: anywhere;
}
[data-rich-option]:is(:hover, [data-active], [aria-selected="true"]) {
  background: var(--accent-soft, #e0e7ff);
}
[data-rich-picker] [hidden] {
  display: none;
}
