:root {
  --border: #e5e7eb;
  --radius: 18px;
  --font: sans-serif;

  --text: #e9edef;
  --text-muted: #65676b;
  --link: #4db8ff;

  --bot-bubble: #202c33;
  --user-bubble: #a61e3c;
  --user-bubble-text: #e9edef;

  --chip-bg: #e9edef;
  --chip-border: #a61e3c;
  --chip-text: #a61e3c;
  --chip-bg-hover: #a61e3c;
  --chip-text-hover: #e9edef;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  font-family: var(--font);
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 3px solid var(--border);
  flex-shrink: 0;
  background: var(--bot-bubble);
}

.chat-header__avatar {
  width: 38px;
  height: 38px;
  padding: 6px;
  background-color: var(--border);
  border-radius: 10px;
}

.chat-header__name {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.2;
  color: var(--text);
}

.status {
  font-size: 12px;
  color: var(--text-muted);
}

.status::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #31a24c;
  margin-right: 5px;
}

.clear-chat-btn {
  margin-left: auto;
  flex-shrink: 0;
  border: 1px solid var(--text-muted);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  font-family: var(--font);
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease;
}

.clear-chat-btn:hover {
  background: #fdecea;
  color: #d93025;
  border-color: #d93025;
}

.clear-chat-btn:active {
  transform: scale(0.96);
}

.chat-window {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.msg-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 2px 0;
  max-width: 100%;
}

.msg-row.bot {
  justify-content: flex-start;
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.msg-bubble {
  max-width: 72%;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg-bubble p {
  margin: 0;
}

.msg-bubble p + p {
  margin-top: 8px;
}

.msg-row.bot .msg-bubble {
  background: var(--bot-bubble);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.msg-row.user .msg-bubble {
  background: var(--user-bubble);
  color: var(--user-bubble-text);
  border-bottom-right-radius: 4px;
}

.msg-row.system .msg-bubble {
  background: transparent;
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
  margin: 8px auto;
}

a {
  color: var(--link);
  text-decoration: underline;
}

/* typing indicator */
.typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 6px 4px;
}

.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  opacity: 0.4;
  animation: blink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}
.typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes blink {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-2px);
  }
}

.quick-replies {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px 14px;
  border-top: 1px solid var(--border);
  max-height: 40vh;
  overflow-y: auto;
}

.quick-reply-chip {
  border: 1.5px solid var(--chip-border);
  background: var(--chip-bg);
  color: var(--chip-text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
  font-family: var(--font);
}

.quick-reply-chip:hover {
  background: var(--chip-bg-hover);
  color: var(--chip-text-hover);
}

.quick-reply-chip:active {
  transform: scale(0.96);
}

.quick-reply-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.quick-replies__empty {
  font-size: 13px;
  color: var(--text-muted);
  padding: 4px 6px;
}

.chat-window::-webkit-scrollbar,
.quick-replies::-webkit-scrollbar {
  width: 6px;
}
.chat-window::-webkit-scrollbar-thumb,
.quick-replies::-webkit-scrollbar-thumb {
  background: #d0d3d8;
  border-radius: 3px;
}
