.ai-chat-tools {
  width: min(820px, 100%);
  margin: 1.5rem auto .65rem;
  text-align: right;
}
.ai-chat { width: min(820px, 100%); margin: 0 auto; }
.ai-turn {
  width: min(100%, 700px);
  margin: 0 auto 1rem 0;
  padding: clamp(.85rem, 2.8vw, 1.35rem);
  border: 1px solid #d3dfef;
  border-radius: 6px 20px 20px;
  background: #ffffffed;
  box-shadow: 0 7px 22px #283f6010;
  color: #192e50;
  overflow-wrap: anywhere;
  scroll-margin-top: 18px;
}
.ai-turn-user {
  width: fit-content;
  max-width: 85%;
  margin-inline: auto 0;
  border-color: #ccd9f4;
  border-radius: 20px 6px 20px 20px;
  background: #e8eeff;
}
.ai-turn-author { font-size: .78rem; color: #4a5d87; font-weight: 750; }
.ai-turn-message { margin: .3rem 0 0; line-height: 1.5; }
.ai-chat-tags, .ai-chat-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .8rem; }
.ai-chat-tags span { padding: .25rem .55rem; border-radius: 8px; background: #eef2fa; color: #344a75; font-size: .75rem; }
.ai-chat-tools button, .ai-chat-actions button {
  display: inline-flex;
  align-items: center;
  width: auto;
  min-height: 38px;
  height: auto;
  padding: .4rem .65rem;
  flex: none;
  border: 1px solid #bdcce8;
  border-radius: 10px;
  background: #f7f9ff;
  color: #274d85;
  font: inherit;
  font-size: .8rem;
  font-weight: 650;
  text-align: left;
}
.ai-chat-tools button:hover, .ai-chat-actions button:hover { background: #e5edff; }
.ai-chat-cards { display: grid; gap: .4rem; margin-top: .85rem; }
.ai-chat-card {
  display: flex;
  align-items: center;
  gap: clamp(.35rem, 1.5vw, .75rem);
  padding: .35rem .5rem;
  border: 1px solid #e0e7f2;
  border-radius: 10px;
  background: #f9fbff;
  color: #203658;
  text-decoration: none;
}
.ai-chat-card:hover { background: #eaf1fd; }
.ai-chat-card img { width: 34px; height: 47px; object-fit: contain; flex: none; }
.ai-chat-card span { flex: 1; min-width: 0; }
.ai-chat-card span > * { display: block; }
.ai-chat-card small { font-size: .72rem; color: #53678a; }
.ai-chat-card b { flex: none; font-size: .88rem; }
.ai-chat-rank { min-width: .8rem; text-align: center; }
#ai-search-form button[disabled] { opacity: .5; }
@media (max-width: 420px) {
  .ai-chat-card strong { font-size: .88rem; }
  .ai-chat-card img { width: 26px; height: 36px; }
  .ai-chat-card b { font-size: .76rem; }
}

.ai-chat-reply {
  width: min(820px, 100%);
  margin: 0 auto 2rem;
}
.ai-chat-reply .search-form { margin: .7rem auto 0; }
