.agent-input-wrap {
  flex: 1;
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 5px;
}

.agent-input-wrap textarea {
  width: 100%;
}

.agent-compose-hint {
  color: var(--muted);
  font-size: 12px;
}

.agent-compose-footer { display: flex; align-items: center; gap: 8px; }

.agent-attach-button {
  min-height: 30px;
  padding: 4px 9px;
  border: 1px solid #c9ded4;
  border-radius: 6px;
  background: #fff;
  color: #07634f;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.agent-attach-button:hover { background: #edf8f2; }
.agent-attach-button:focus-visible { outline: 2px solid #07634f; outline-offset: 2px; }

.agent-attachment-list,
.agent-message-attachments { display: flex; flex-wrap: wrap; gap: 6px; }

.agent-attachment-list {
  padding: 7px;
  border: 1px dashed #b9d5c9;
  border-radius: 8px;
  background: #f8fcfa;
}

.agent-attachment-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  min-height: 28px;
  padding: 3px 7px;
  border: 1px solid #d7e6df;
  border-radius: 6px;
  background: #fff;
  color: #245345;
  font-size: 12px;
}

.agent-attachment-chip a { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.agent-attachment-chip button { border: 0; background: transparent; color: #9b3535; font: inherit; cursor: pointer; }
.agent-message-attachments { margin-top: 8px; }
.agent-message-attachments img { display: block; width: 84px; height: 60px; object-fit: cover; border-radius: 5px; border: 1px solid #d7e6df; }

.agent-message-actions { margin-top: 8px; }
.agent-message-quote, .agent-quote-remove {
  min-height: 26px;
  padding: 2px 8px;
  border: 1px solid #c9ded4;
  border-radius: 6px;
  background: #fff;
  color: #07634f;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.agent-message-quote:hover { background: #edf8f2; }
.agent-message-quote:focus-visible, .agent-quote-remove:focus-visible { outline: 2px solid #07634f; outline-offset: 2px; }
.agent-quote-label { color: #07634f; font-size: 12px; font-weight: 700; }
.agent-quote-text { max-width: min(440px, 70vw); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #536860; font-size: 12px; }
.agent-quote-remove { margin-left: auto; color: #9b3535; border-color: #ebc3c3; }

.agent-message.pending {
  opacity: 0.78;
}

.agent-message.pending .agent-pending-dot::after {
  content: "";
  display: inline-block;
  width: 1.2em;
  animation: agent-pending-dots 1.2s steps(4, end) infinite;
}

.agent-tool-trace {
  display: grid;
  gap: 8px;
}

.agent-tool-item {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid #d7e6df;
  border-radius: 9px;
  background: #f8fcfa;
}

.agent-tool-item.error {
  border-color: #f1caca;
  background: #fff8f8;
}

.agent-tool-title {
  display: flex;
  align-items: center;
  gap: 7px;
}

.agent-tool-title .agent-status {
  margin-left: auto;
}

.agent-tool-toggle {
  margin-left: 8px;
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid #c9ded4;
  border-radius: 6px;
  background: #fff;
  color: #07634f;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.agent-tool-toggle:hover {
  background: #edf8f2;
}

.agent-tool-toggle:focus-visible {
  outline: 2px solid #07634f;
  outline-offset: 2px;
}

.agent-tool-item.error .agent-tool-toggle {
  border-color: #efc1c1;
  color: #ad3030;
}

.agent-tool-detail[hidden] {
  display: none;
}

.agent-tool-icon {
  display: inline-grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #dcefe5;
  color: #07634f;
  font-weight: 800;
}

.agent-tool-item.error .agent-tool-icon {
  background: #fde4e4;
  color: #ad3030;
}

.agent-tool-item small {
  display: block;
  margin-top: 6px;
  color: #536860;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: pre-wrap;
  word-break: break-word;
}

@keyframes agent-pending-dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75%, 100% { content: "..."; }
}

@media (max-width: 560px) {
  .agent-input-wrap {
    width: 100%;
  }
  .agent-compose-footer { align-items: flex-start; flex-wrap: wrap; }
}
