.screen[data-page="CHATBOT"] {
  min-height: 0;
}

.screen[data-page="CHATBOT"] .mobile-topbar {
  flex: 0 0 auto;
}

.mm-chat-page {
  min-height: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--mm-color-chat-overlay);
}

.mm-chat-profile {
  display: flex;
  align-items: center;
  gap: var(--mm-space-2);
  padding: var(--mm-space-2) var(--mm-page-gutter);
  border-bottom: 1px solid var(--mm-color-border);
  background: rgb(26 32 48 / 82%);
}

.mm-chat-avatar {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: grid;
  place-items: center;
  border-radius: var(--mm-radius-control);
  background: var(--mm-color-chat-gradient);
  box-shadow: 0 4px 14px var(--mm-color-action-shadow);
  font-size: 18px;
}

.mm-chat-avatar svg {
  width: 23px;
  height: 23px;
}

.mm-chat-profile-copy {
  min-width: 0;
}

.mm-chat-profile-copy h1 {
  margin: 0;
  color: var(--mm-color-text);
  font-size: var(--mm-font-size-section);
  line-height: 1.25;
}

.mm-chat-status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 3px 0 0;
  color: var(--mm-color-success);
  font-size: var(--mm-font-size-caption);
  font-weight: 650;
}

.mm-chat-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 7px currentColor;
}

.mm-chat-messages {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: var(--mm-space-3) var(--mm-page-gutter);
  scrollbar-width: thin;
  scrollbar-color: var(--mm-color-border) transparent;
}

.mm-chat-message {
  max-width: 88%;
  display: flex;
  flex-direction: column;
  animation: mm-chat-message-in 180ms ease-out both;
}

.mm-chat-message.user {
  align-self: flex-end;
}

.mm-chat-message.bot {
  align-self: flex-start;
}

.mm-chat-bubble {
  padding: 12px 14px;
  color: var(--mm-color-chat-copy);
  background: var(--mm-color-chat-bubble);
  border: 1px solid var(--mm-color-border);
  border-radius: 18px 18px 18px 4px;
  box-shadow: 0 4px 14px rgb(0 0 0 / 20%);
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.mm-chat-message.user .mm-chat-bubble {
  color: #fff;
  background: var(--mm-color-chat-gradient);
  border-color: transparent;
  border-radius: 18px 18px 4px 18px;
  box-shadow: 0 4px 15px var(--mm-color-action-shadow);
}

.mm-chat-chips {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: var(--mm-space-1);
}

.mm-chat-follow-ups::before {
  content: "You may also want to ask";
  margin: 2px 2px 0;
  color: var(--mm-color-text-muted);
  font-size: var(--mm-font-size-caption);
}

.mm-chat-follow-ups[hidden] {
  display: none;
}

.mm-chat-chip {
  min-height: 46px;
  padding: 9px 12px;
  color: var(--mm-color-chat-copy);
  background: rgb(255 255 255 / 5%);
  border: 1px solid rgb(255 255 255 / 10%);
  border-radius: var(--mm-radius-control);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
  cursor: pointer;
}

.mm-chat-chip:hover,
.mm-chat-chip:focus-visible {
  color: var(--mm-color-text);
  background: var(--mm-color-brand-tint);
  border-color: var(--mm-color-brand);
}

.mm-chat-typing {
  display: none;
  align-self: flex-start;
  gap: 5px;
  padding: 12px 16px;
  background: var(--mm-color-chat-bubble);
  border: 1px solid var(--mm-color-border);
  border-radius: 16px;
}

.mm-chat-typing.is-visible {
  display: flex;
}

.mm-chat-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mm-color-brand);
  animation: mm-chat-dot 1.2s infinite ease-in-out both;
}

.mm-chat-dot:nth-child(1) { animation-delay: -240ms; }
.mm-chat-dot:nth-child(2) { animation-delay: -120ms; }

.mm-chat-composer {
  flex: 0 0 auto;
  padding: var(--mm-space-2) var(--mm-page-gutter) 18px;
  background: var(--mm-color-footer-backdrop);
  border-top: 1px solid var(--mm-color-border);
}

.mm-chat-composer .mm-chat-follow-ups {
  margin: 0 0 var(--mm-space-2);
}

.mm-chat-input-row {
  display: flex;
  align-items: center;
  gap: var(--mm-space-1);
  min-height: var(--mm-control-height);
  padding: 5px 6px 5px 15px;
  background: var(--mm-color-chat-bubble);
  border: 1px solid var(--mm-color-border);
  border-radius: var(--mm-radius-pill);
}

.mm-chat-input-row:focus-within {
  border-color: var(--mm-color-interaction-border);
  outline: var(--mm-focus-ring-width) solid var(--mm-color-focus);
  outline-offset: var(--mm-focus-ring-offset);
}

.mm-chat-input-row:hover {
  border-color: var(--mm-color-interaction-border);
}

.mm-chat-input {
  min-width: 0;
  flex: 1;
  padding: 8px 0;
  color: var(--mm-color-text);
  background: transparent;
  border: 0;
  outline: 0;
  font: inherit;
  font-size: 13px;
}

input.mm-chat-input:focus-visible {
  outline: none;
}

.mm-chat-input::placeholder {
  color: var(--mm-color-disabled);
}

.mm-chat-send {
  width: var(--mm-target-min);
  height: var(--mm-target-min);
  flex: 0 0 var(--mm-target-min);
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--mm-color-chat-gradient);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.mm-chat-send svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.mm-chat-send:disabled {
  opacity: .55;
  cursor: wait;
}

.mm-chat-mode {
  margin: 7px 4px 0;
  color: var(--mm-color-text-muted);
  font-size: var(--mm-font-size-caption);
  line-height: 1.35;
  text-align: center;
}

.mm-chat-mode.offline {
  color: var(--mm-color-chat-offline);
}

@keyframes mm-chat-message-in {
  from { opacity: 0; transform: translateY(6px) scale(.98); }
  to { opacity: 1; transform: none; }
}

@keyframes mm-chat-dot {
  0%, 80%, 100% { opacity: .4; transform: scale(.65); }
  40% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .mm-chat-message,
  .mm-chat-dot { animation: none; }
}
