#chat-messages {
  max-height: 300px !important;
}

#chat-panel [data-chat-actions] {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.15rem 0 0.1rem 2rem;
}

#chat-panel .chat-action,
#chat-panel .chat-retry,
#chat-panel .chat-reset {
  border: 1px solid #bfdbfe;
  background: #fff;
  color: #1b6ef3;
  border-radius: 0.65rem;
  font: 600 0.72rem/1.2 "Plus Jakarta Sans", sans-serif;
  padding: 0.48rem 0.68rem;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}

#chat-panel .chat-action:hover,
#chat-panel .chat-retry:hover,
#chat-panel .chat-reset:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

#chat-panel .chat-action:active,
#chat-panel .chat-retry:active,
#chat-panel .chat-reset:active {
  transform: translateY(1px);
}

#chat-panel .chat-action:focus-visible,
#chat-panel .chat-retry:focus-visible,
#chat-panel .chat-reset:focus-visible,
#chat-panel button:focus-visible,
#chat-toggle:focus-visible {
  outline: 3px solid #7dd3fc;
  outline-offset: 2px;
}

#chat-panel [data-chat-composer] {
  margin: 0.65rem 0.75rem 0;
  padding: 0.48rem 0.48rem 0.48rem 0.75rem !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 0.85rem;
  background: #f8fafc;
  box-shadow: inset 0 1px 1px rgba(15, 23, 42, 0.03);
  transition: background-color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

#chat-panel [data-chat-composer]:focus-within {
  border-color: #94a3b8 !important;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.055), 0 4px 14px rgba(15, 23, 42, 0.06);
}

#chat-panel [data-chat-composer] input:focus,
#chat-panel [data-chat-composer] input:focus-visible {
  outline: none;
  box-shadow: none;
}

#chat-panel .chat-reset {
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
  color: #fff;
  padding: 0.38rem 0.55rem;
}

#chat-panel .chat-meta {
  display: flex;
  justify-content: flex-end;
  min-height: 1rem;
  padding: 0.3rem 1rem 0.4rem;
  color: #6b7280;
  font: 500 0.64rem/1.2 Inter, sans-serif;
}

#chat-panel .chat-msg-bot,
#chat-panel .chat-msg-user {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#chat-panel .chat-typing {
  display: inline-flex;
  align-items: center;
  gap: 0.24rem;
  min-height: 2.25rem;
}

#chat-panel .chat-typing span {
  width: 0.3rem;
  height: 0.3rem;
  border-radius: 50%;
  background: #60a5fa;
  animation: barrance-chat-pulse 1s ease-in-out infinite;
}

#chat-panel .chat-typing span:nth-child(2) { animation-delay: 0.15s; }
#chat-panel .chat-typing span:nth-child(3) { animation-delay: 0.3s; }

#chat-panel .chat-error {
  background: #fff7ed;
  color: #9a3412;
}

#chat-panel [data-chat-composer][aria-busy="true"] button,
#chat-panel [data-chat-composer][aria-busy="true"] input {
  opacity: 0.65;
}

@keyframes barrance-chat-pulse {
  0%, 100% { opacity: 0.35; transform: translateY(0); }
  50% { opacity: 1; transform: translateY(-2px); }
}

@media (max-width: 380px) {
  #chat-panel {
    width: calc(100vw - 24px) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  #chat-panel,
  #chat-toggle,
  #chat-panel .chat-typing span,
  #chat-panel .chat-action,
  #chat-panel .chat-retry,
  #chat-panel .chat-reset {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
