.tr-chat {
  scroll-margin-top: 16px;
  margin: 0 0 20px;
}
.tr-chat-collapsed {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  padding: 14px 16px;
  background: #eef4fb;
  border: 1px solid #d4e3f4;
  border-radius: 12px;
}
.tr-chat-btn {
  appearance: none;
  border: 0;
  background: #2b6cb0;
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
}
.tr-chat-btn:hover { background: #245c96; }
.tr-chat-hint {
  appearance: none;
  border: 0;
  background: transparent;
  color: #2d3748;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 0;
  flex: 1;
  min-width: 220px;
  line-height: 1.45;
}
.tr-chat-hint:hover { color: #2b6cb0; }
.tr-chat-panel {
  display: flex;
  flex-direction: column;
  max-height: min(70vh, 640px);
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.tr-chat-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid #edf2f7;
  background: #f8fafc;
}
.tr-chat-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.tr-chat-head-btn {
  appearance: none;
  border: 1px solid #cbd5e0;
  background: #fff;
  color: #4a5568;
  font: inherit;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 8px;
  cursor: pointer;
}
.tr-chat-head-btn:hover { border-color: #2b6cb0; color: #2b6cb0; }
.tr-chat-head-btn:disabled {
  opacity: 0.45;
  cursor: default;
  border-color: #e2e8f0;
  color: #a0aec0;
}
.tr-chat-hint-type {
  display: inline-block;
  min-width: 15.5em;
  color: #2b6cb0;
  font-weight: 700;
  border-right: 2px solid #2b6cb0;
  white-space: nowrap;
  animation: tr-chat-caret 0.9s step-end infinite;
}
@keyframes tr-chat-caret {
  50% { border-right-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-chat-hint-type { animation: none; border-right: 0; }
}
.tr-chat-log {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tr-chat-bubble {
  max-width: 92%;
  padding: 10px 12px;
  border-radius: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
}
.tr-chat-bubble.is-assistant {
  background: #edf2f7;
  color: #1a202c;
  align-self: flex-start;
}
.tr-chat-bubble.is-user {
  background: #2b6cb0;
  color: #fff;
  align-self: flex-end;
}
.tr-chat-bubble .tr-chat-plan {
  white-space: normal;
}
.tr-chat-plan ol { margin: 8px 0 0; padding-left: 1.2em; }
.tr-chat-plan li { margin: 0 0 8px; }
.tr-chat-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 14px 12px;
}
.tr-chat-replies:empty {
  display: none;
  padding: 0;
  margin: 0;
}
.tr-chat-quota[hidden] {
  display: none !important;
  margin: 0;
  padding: 0;
}
.tr-chat-chip {
  appearance: none;
  border: 1px solid #cbd5e0;
  background: #fff;
  color: #2d3748;
  font: inherit;
  font-size: 0.92rem;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.tr-chat-chip:hover { border-color: #2b6cb0; color: #2b6cb0; }
.tr-chat-form {
  display: flex;
  gap: 8px;
  padding: 0 14px 14px;
  align-items: flex-end;
}
.tr-chat-input {
  flex: 1;
  resize: none;
  font: inherit;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  min-height: 44px;
}
.tr-chat-send {
  appearance: none;
  border: 0;
  background: #2b6cb0;
  color: #fff;
  font: inherit;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}
.tr-chat-form[hidden],
.tr-chat-panel[hidden] { display: none !important; }
.tr-chat.is-open .tr-chat-collapsed { display: none; }
.tr-chat.is-open .tr-chat-panel { display: flex; }
.tr-chat.is-busy .tr-chat-send,
.tr-chat.is-busy .tr-chat-chip,
.tr-chat.is-busy [data-tr-chat-back],
.tr-chat.is-busy [data-tr-chat-reset] { opacity: 0.6; pointer-events: none; }
.tr-chat-typing {
  align-self: flex-start;
  color: #718096;
  font-size: 0.9rem;
}
.tr-chat-error { color: #c53030; font-size: 0.9rem; padding: 0 14px 10px; }
.tr-chat-quota {
  margin: 0;
  padding: 0 14px 10px;
  font-size: 0.82rem;
  color: #718096;
}
.tr-chat-quota.is-exhausted {
  color: #9a3412;
  font-weight: 600;
  background: #fff1f2;
  margin: 0 12px 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #fecdd3;
  line-height: 1.45;
}
.tr-chat-bottom { margin: 28px 0 8px; }
.tr-chat-bottom .tr-chat-btn { width: auto; }

.tr-full-offer {
  margin: 16px 0 20px;
  padding: 18px 20px;
  border-radius: 12px;
  border: 1px solid #bfdbfe;
  background: linear-gradient(180deg, #eff6ff 0%, #f8fafc 100%);
}
.tr-full-offer-lead { margin: 0 0 10px; color: #1e293b; font-size: 1.02rem; }
.tr-full-offer-body { margin: 0 0 10px; color: #334155; line-height: 1.55; }
.tr-full-offer-list { margin: 0 0 14px 18px; padding: 0; color: #334155; line-height: 1.55; }
.tr-full-offer-list li { margin-bottom: 6px; }
.tr-full-offer-btn {
  appearance: none; border: 0; cursor: pointer;
  background: #1d4ed8; color: #fff; font: inherit; font-weight: 700;
  padding: 12px 18px; border-radius: 10px;
}
.tr-full-offer-btn:hover { background: #1e40af; }
.tr-full-offer-note { margin: 12px 0 0; font-size: 0.9rem; color: #64748b; }

@media (max-width: 768px) {
  .tr-chat-panel { max-height: min(78vh, 560px); }
  .tr-chat-hint { min-width: 0; }
  .tr-chat-hint-type { min-width: 0; }
}
