.maia-tool-activity {
  font-size: 0.85em;
  opacity: 0.7;
  font-style: italic;
}

.maia-error {
  color: #c0392b;
}

/* Confirmation cards — max-width:100% keeps a wide diff from stretching the
   whole chat bubble (addBubble() in bubbles.js sizes non-reply bubbles to
   their content's offsetWidth), and #maia-chat-bubble's own max-width still
   clamps the outer bubble. */
.maia-tool-card {
  max-width: 100%;
  box-sizing: border-box;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 8px 10px;
  margin: 4px 0;
  background: rgba(0, 0, 0, 0.03);
}

.maia-tool-card__head {
  font-weight: bold;
  margin-bottom: 6px;
}

.maia-tool-card__body {
  font-size: 0.9em;
}

.maia-tool-card__actions {
  margin-top: 8px;
  display: flex;
  gap: 8px;
}

.maia-confirm-btn {
  cursor: pointer;
  border: none;
  border-radius: 4px;
  padding: 4px 12px;
  font-size: 0.9em;
}

.maia-confirm-btn--yes {
  background: #2e7d32;
  color: #fff;
}

.maia-confirm-btn--no {
  background: #c0392b;
  color: #fff;
}

.maia-tool-card--confirmed {
  border-color: #2e7d32;
}

.maia-tool-card--rejected {
  border-color: #c0392b;
  opacity: 0.7;
}

.maia-tool-args {
  margin: 0;
}

.maia-tool-args dt {
  font-weight: bold;
  margin-top: 4px;
}

.maia-tool-args dd {
  margin: 0 0 0 8px;
  word-break: break-word;
  white-space: pre-wrap;
}

.maia-diff-summary {
  font-size: 0.85em;
  opacity: 0.8;
  margin-bottom: 6px;
}

.maia-diff {
  max-height: 300px;
  overflow: auto;
  white-space: pre;
  font-size: 0.8em;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
  padding: 6px;
  margin: 0;
}

.maia-diff-line {
  display: block;
}

.maia-diff-add {
  background: rgba(46, 125, 50, 0.18);
}

.maia-diff-del {
  background: rgba(192, 57, 43, 0.18);
}

.maia-diff-sep {
  opacity: 0.5;
}

/* Image cards (maia_image_search results and maia_generate_image output).
   Uses a grid rather than a fixed width so it still degrades sensibly under
   bubbles.js's addBubble() width hack, which forces 50% width on any bubble
   whose HTML contains the literal string "<img src=" (see bubbles.js). */
.maia-image-card {
  max-width: 100%;
  box-sizing: border-box;
}

.maia-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.maia-image-item {
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 6px;
  padding: 6px;
  background: rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
}

.maia-image-thumb {
  display: block;
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: cover;
  border-radius: 4px;
  margin: 0;
}

.maia-image-source {
  font-size: 0.75em;
  opacity: 0.7;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maia-image-actions {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.maia-image-btn {
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.75em;
  background: #fff;
}

.maia-image-btn:disabled {
  opacity: 0.6;
  cursor: default;
}
