/*
 * Maximus Bone Expander IA — chat público
 * Sistema visual: Consultor Maximus Design System v1.0 (handoff).
 * Todas as regras são prefixadas com .mbeai- para não vazar para o tema.
 * Exceção controlada: .mbeai-scroll-lock / .mbeai-body-lock, aplicadas via JS
 * apenas enquanto o chat fullscreen mobile está ativo.
 */

/* ===== Lock global (somente com o app mobile aberto) =====
 *
 * Trava apenas o overflow. NÃO usamos position:fixed nem top negativo no
 * <body>: com o teclado virtual aberto isso produzia uma segunda compensação,
 * concorrente com o reposicionamento do próprio navegador, e empurrava o
 * composer para fora da tela. Sem deslocar o body, a posição de rolagem da
 * página é naturalmente preservada.
 */
html.mbeai-scroll-lock {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

body.mbeai-body-lock {
  overflow: hidden !important;
  overscroll-behavior: none !important;
}

/* ===== Shell ===== */
.mbeai-chat-shell,
.mbeai-chat-shell *,
.mbeai-chat-shell *::before,
.mbeai-chat-shell *::after {
  box-sizing: border-box;
}

.mbeai-chat-shell {
  /* Tokens — Consultor Maximus DS v1.0 */
  --mbeai-bg-base: #07070b;
  --mbeai-bg-secondary: #101119;
  --mbeai-bg-chat: #0c0c12;
  --mbeai-glass: rgba(255, 255, 255, 0.05);
  --mbeai-glass-soft: rgba(255, 255, 255, 0.04);
  --mbeai-glass-medium: rgba(255, 255, 255, 0.06);
  --mbeai-glass-strong: rgba(255, 255, 255, 0.08);
  --mbeai-panel-bg: rgba(12, 12, 18, 0.6);
  --mbeai-menu-bg: rgba(18, 18, 26, 0.92);
  --mbeai-toast-bg: rgba(12, 12, 18, 0.82);
  --mbeai-border: rgba(255, 255, 255, 0.08);
  --mbeai-border-soft: rgba(255, 255, 255, 0.07);
  --mbeai-border-strong: rgba(255, 255, 255, 0.12);
  --mbeai-text: #f5f5f7;
  --mbeai-text-secondary: rgba(245, 245, 247, 0.6);
  --mbeai-text-tertiary: rgba(245, 245, 247, 0.38);
  --mbeai-placeholder: rgba(245, 245, 247, 0.4);
  --mbeai-gold-light: #ead199;
  --mbeai-gold: #d8b26a;
  --mbeai-gold-mid: #c79a48;
  --mbeai-gold-deep: #b98b3e;
  --mbeai-gold-gradient: linear-gradient(150deg, #ead199, #c79a48);
  --mbeai-gold-ink: #1c1608;
  --mbeai-success: #5fd08a;
  --mbeai-warning: #f0b24a;
  --mbeai-error: #f0685e;
  --mbeai-info: #6fa8ff;
  --mbeai-radius-sm: 8px;
  --mbeai-radius-md: 14px;
  --mbeai-radius-lg: 20px;
  --mbeai-radius-xl: 28px;
  --mbeai-desktop-width: 760px;
  --mbeai-shadow: 0 30px 70px -30px rgba(0, 0, 0, 0.9);
  --mbeai-blur: blur(24px) saturate(150%);

  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overscroll-behavior: none;
  color: var(--mbeai-text);
  background:
    radial-gradient(1100px 700px at 82% -8%, rgba(216, 178, 106, 0.16), transparent 60%),
    radial-gradient(900px 620px at 8% 108%, rgba(120, 108, 200, 0.13), transparent 60%),
    linear-gradient(180deg, var(--mbeai-bg-chat) 0%, var(--mbeai-bg-base) 100%);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  isolation: isolate;
}

.mbeai-chat-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(0, 0, 0, 0.5) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), transparent 36%);
}

/* Fullscreen real no mobile (classe aplicada via JS)
 *
 * top/left/width/height são explícitos e vêm do visualViewport (via JS). Nunca
 * use `inset: 0` aqui: um position:fixed se ancora no viewport de LAYOUT, que
 * não encolhe quando o teclado abre — no iOS o viewport visual apenas desliza
 * para dentro dele. Sem aplicar offsetTop, o app ficaria deslocado e o
 * composer sumiria atrás do teclado.
 *
 * Os fallbacks cobrem o primeiro frame e navegadores sem visualViewport.
 */
.mbeai-chat-shell.mbeai-fullscreen {
  position: fixed;
  top: var(--mbeai-app-top, 0px);
  left: var(--mbeai-app-left, 0px);
  right: auto;
  bottom: auto;
  z-index: 999999;
  width: var(--mbeai-app-width, 100vw);
  height: var(--mbeai-app-height, 100svh);
  min-height: 0;
  max-height: none;
  overflow: hidden;
}

@supports not (height: 100svh) {
  .mbeai-chat-shell.mbeai-fullscreen {
    height: var(--mbeai-app-height, 100vh);
  }
}

.mbeai-chat-shell.mbeai-fullscreen .mbeai-chat-app {
  height: 100%;
  min-height: 0;
  max-width: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ===== Teclado virtual aberto =====
 * Prioriza mensagens e composer: reduz respiros, esconde apenas conteúdo
 * secundário e desliga animações que causariam deslocamento perceptível.
 * Nenhuma função de envio, mídia ou áudio é ocultada.
 */
.mbeai-chat-shell.mbeai-keyboard-open .mbeai-messages {
  padding-top: 10px;
  padding-bottom: 8px;
  scroll-behavior: auto;
}

.mbeai-chat-shell.mbeai-keyboard-open .mbeai-bottom-dock {
  gap: 8px;
  padding-top: 8px;
  /* O teclado já ocupa a safe area inferior. */
  padding-bottom: 8px;
}

.mbeai-chat-shell.mbeai-keyboard-open .mbeai-chat-header {
  padding-top: 8px;
  padding-bottom: 8px;
}

/* As sugestões dividem o dock com o composer: enquanto o usuário digita, o
 * composer tem prioridade. O cartão inicial fica na área rolável e continua
 * acessível — inclusive o botão de voz. */
.mbeai-chat-shell.mbeai-keyboard-open .mbeai-suggestions {
  display: none;
}

.mbeai-chat-shell.mbeai-keyboard-open .mbeai-chat-app,
.mbeai-chat-shell.mbeai-keyboard-open .mbeai-bottom-dock {
  transition: none;
}

/* ===== Reset interno (escopado) ===== */
.mbeai-chat-shell :where(button, textarea, img, p, ul, ol, a, svg, strong, span) {
  font: inherit;
}

.mbeai-chat-shell :where(button, textarea) {
  margin: 0;
}

.mbeai-chat-shell button {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: none;
  color: inherit;
  text-transform: none;
  letter-spacing: normal;
  box-shadow: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.mbeai-chat-shell textarea {
  appearance: none;
  -webkit-appearance: none;
}

.mbeai-chat-shell img,
.mbeai-chat-shell svg {
  display: block;
  max-width: 100%;
}

.mbeai-chat-shell p {
  margin: 0;
  padding: 0;
}

.mbeai-chat-shell a {
  color: var(--mbeai-gold);
  text-decoration: none;
}

.mbeai-chat-shell a:hover {
  color: var(--mbeai-gold-light);
}

/* ===== App ===== */
.mbeai-chat-shell .mbeai-chat-app {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: 100%;
  max-width: var(--mbeai-desktop-width);
  min-width: 0;
  min-height: 100vh;
  min-height: 100svh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(600px 400px at 85% 0%, rgba(216, 178, 106, 0.13), transparent 55%),
    radial-gradient(500px 420px at 0% 100%, rgba(120, 108, 200, 0.12), transparent 55%),
    linear-gradient(180deg, var(--mbeai-bg-chat), var(--mbeai-bg-base));
}

/* ===== Header ===== */
.mbeai-chat-shell .mbeai-chat-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: max(10px, env(safe-area-inset-top, 0px)) 12px 12px 8px;
  background: var(--mbeai-panel-bg);
  border-bottom: 1px solid var(--mbeai-border-soft);
  backdrop-filter: var(--mbeai-blur);
  -webkit-backdrop-filter: var(--mbeai-blur);
}

.mbeai-chat-shell .mbeai-header-btn {
  display: grid;
  width: 38px;
  height: 38px;
  min-width: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 12px;
  color: var(--mbeai-text);
  transition: background 0.16s ease, transform 0.16s ease;
}

.mbeai-chat-shell .mbeai-back {
  background: transparent;
}

.mbeai-chat-shell .mbeai-menu-toggle {
  background: var(--mbeai-glass-medium);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.mbeai-chat-shell .mbeai-header-btn:hover {
  background: var(--mbeai-glass-strong);
}

.mbeai-chat-shell .mbeai-header-btn:active {
  transform: scale(0.94);
}

.mbeai-chat-shell .mbeai-avatar {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  overflow: visible;
  border-radius: 13px;
  color: var(--mbeai-gold-ink);
  background: var(--mbeai-gold-gradient);
  box-shadow: 0 8px 20px -10px rgba(216, 178, 106, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.mbeai-chat-shell .mbeai-avatar img {
  width: 100%;
  height: 100%;
  padding: 5px;
  border-radius: inherit;
  object-fit: contain;
}

.mbeai-chat-shell .mbeai-avatar-status {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 12px;
  height: 12px;
  border: 2.5px solid var(--mbeai-bg-chat);
  border-radius: 999px;
  background: var(--mbeai-success);
}

.mbeai-chat-shell .mbeai-header-copy {
  flex: 1 1 auto;
  min-width: 0;
}

.mbeai-chat-shell .mbeai-header-copy h2 {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--mbeai-text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
  text-transform: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mbeai-chat-shell .mbeai-header-copy p {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  overflow: hidden;
  color: var(--mbeai-text-secondary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mbeai-chat-shell .mbeai-status-dot {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--mbeai-success);
  box-shadow: 0 0 10px rgba(95, 208, 138, 0.8);
}

/* Menu do header */
.mbeai-chat-shell .mbeai-menu-wrap {
  position: relative;
  flex: 0 0 auto;
}

.mbeai-chat-shell .mbeai-menu,
.mbeai-chat-shell .mbeai-attach-menu {
  position: absolute;
  z-index: 60;
  display: flex;
  min-width: 224px;
  flex-direction: column;
  padding: 6px;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 16px;
  background: var(--mbeai-menu-bg);
  box-shadow: 0 24px 50px -22px rgba(0, 0, 0, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: var(--mbeai-blur);
  -webkit-backdrop-filter: var(--mbeai-blur);
  animation: mbeai-pop 0.18s ease both;
}

.mbeai-chat-shell .mbeai-menu {
  top: calc(100% + 8px);
  right: 0;
}

.mbeai-chat-shell .mbeai-menu[hidden],
.mbeai-chat-shell .mbeai-attach-menu[hidden] {
  display: none;
}

.mbeai-chat-shell .mbeai-menu > *,
.mbeai-chat-shell .mbeai-attach-menu > * {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: 11px;
  color: var(--mbeai-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.mbeai-chat-shell .mbeai-menu > *:hover,
.mbeai-chat-shell .mbeai-attach-menu > *:hover {
  color: var(--mbeai-text);
  background: rgba(255, 255, 255, 0.08);
}

.mbeai-chat-shell .mbeai-menu svg,
.mbeai-chat-shell .mbeai-attach-menu svg {
  flex: 0 0 auto;
  color: var(--mbeai-gold);
}

/* ===== Mensagens ===== */
.mbeai-chat-shell .mbeai-messages-panel {
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.mbeai-chat-shell .mbeai-messages {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  gap: 16px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 16px 12px;
  scrollbar-width: none;
  scroll-behavior: smooth;
}

.mbeai-chat-shell .mbeai-messages::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.mbeai-chat-shell .mbeai-date-divider {
  align-self: center;
  flex: 0 0 auto;
  padding: 5px 12px;
  border: 1px solid var(--mbeai-border-soft);
  border-radius: 999px;
  color: var(--mbeai-text-tertiary);
  background: var(--mbeai-glass);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.1;
}

.mbeai-chat-shell .mbeai-start-card {
  display: grid;
  gap: 12px;
  width: min(100%, 560px);
  align-self: center;
  padding: 22px;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: var(--mbeai-radius-xl);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.035)),
    var(--mbeai-glass-soft);
  box-shadow: 0 22px 54px -34px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: var(--mbeai-blur);
  -webkit-backdrop-filter: var(--mbeai-blur);
  animation: mbeai-in 0.38s ease both;
}

.mbeai-chat-shell .mbeai-start-card.is-dismissed {
  display: none;
}

.mbeai-chat-shell .mbeai-start-card > span {
  color: var(--mbeai-gold-light);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.mbeai-chat-shell .mbeai-start-card h1 {
  margin: 0;
  padding: 0;
  border: 0;
  color: var(--mbeai-text);
  font-family: inherit;
  font-size: 28px;
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: 0;
  text-transform: none;
}

.mbeai-chat-shell .mbeai-start-card p {
  max-width: 46ch;
  color: var(--mbeai-text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.mbeai-chat-shell .mbeai-start-voice {
  display: inline-flex;
  width: fit-content;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 18px;
  border-radius: 999px;
  color: var(--mbeai-gold-ink);
  background: var(--mbeai-gold-gradient);
  box-shadow: 0 16px 34px -18px rgba(216, 178, 106, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.55);
  font-size: 14px;
  font-weight: 800;
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s ease;
}

.mbeai-chat-shell .mbeai-start-voice:hover {
  transform: translateY(-1px);
  box-shadow: 0 19px 40px -18px rgba(216, 178, 106, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

.mbeai-chat-shell .mbeai-start-voice:active {
  transform: scale(0.98);
}

.mbeai-chat-shell .mbeai-start-voice:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.mbeai-chat-shell .mbeai-message {
  display: flex;
  width: 100%;
  flex: 0 0 auto;
  animation: mbeai-in 0.32s ease both;
}

.mbeai-chat-shell .mbeai-message-user {
  align-self: flex-end;
  max-width: 82%;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.mbeai-chat-shell .mbeai-message-ai {
  align-self: flex-start;
  max-width: 90%;
  flex-direction: column;
  align-items: flex-start;
}

.mbeai-chat-shell .mbeai-ai-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding-left: 2px;
  color: var(--mbeai-text-secondary);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.1;
}

.mbeai-chat-shell .mbeai-ai-mark {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  color: var(--mbeai-gold-ink);
  background: var(--mbeai-gold-gradient);
}

.mbeai-chat-shell .mbeai-ai-mark img {
  width: 100%;
  height: 100%;
  padding: 2px;
  border-radius: inherit;
  object-fit: contain;
}

.mbeai-chat-shell .mbeai-bubble {
  width: fit-content;
  max-width: 100%;
  padding: 15px 17px;
  overflow-wrap: anywhere;
  word-break: break-word;
  border: 1px solid var(--mbeai-border);
  border-radius: 6px 20px 20px 20px;
  color: var(--mbeai-text);
  background: rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  font-size: 15px;
  line-height: 1.55;
  white-space: normal;
}

.mbeai-chat-shell .mbeai-message-user .mbeai-bubble {
  padding: 12px 16px;
  border-color: var(--mbeai-border-strong);
  border-radius: 20px 20px 6px 20px;
  color: var(--mbeai-text);
  background: rgba(255, 255, 255, 0.09);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  line-height: 1.45;
}

/* Miniaturas de anexos dentro da mensagem do usuário */
.mbeai-chat-shell .mbeai-user-attachments {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.mbeai-chat-shell .mbeai-user-attachments img {
  width: 150px;
  height: 104px;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 20px 20px 6px 20px;
  object-fit: cover;
}

.mbeai-chat-shell .mbeai-user-video-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 20px 20px 6px 20px;
  color: var(--mbeai-text-secondary);
  background: rgba(255, 255, 255, 0.07);
  font-size: 13px;
  font-weight: 600;
}

.mbeai-chat-shell .mbeai-user-video-chip svg {
  color: var(--mbeai-gold);
}

/* Conteúdo formatado das respostas */
.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble p + p,
.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble p + ul,
.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble p + ol,
.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble ul + p,
.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble ol + p {
  margin-top: 10px;
}

.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble ul,
.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble ol {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0 0;
  padding-left: 20px;
  list-style-position: outside;
}

.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble ul {
  list-style-type: disc;
}

.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble ol {
  list-style-type: decimal;
}

.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble li {
  margin: 0;
  padding-left: 2px;
}

.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble strong {
  color: var(--mbeai-text);
  font-weight: 700;
}

.mbeai-chat-shell .mbeai-message-ai .mbeai-bubble a {
  word-break: break-word;
  text-decoration: underline;
  text-decoration-color: rgba(216, 178, 106, 0.4);
  text-underline-offset: 2px;
}

/* Aviso de processamento (ex.: vídeo por áudio) */
.mbeai-chat-shell .mbeai-bubble-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 13px;
  border: 1px solid rgba(111, 168, 255, 0.28);
  border-radius: 12px;
  color: var(--mbeai-text-secondary);
  background: rgba(111, 168, 255, 0.08);
  font-size: 13px;
  line-height: 1.4;
}

.mbeai-chat-shell .mbeai-bubble-notice svg {
  flex: 0 0 auto;
  color: var(--mbeai-info);
}

.mbeai-chat-shell .mbeai-user-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--mbeai-text-tertiary);
  font-size: 11px;
  line-height: 1;
}

.mbeai-chat-shell .mbeai-user-meta svg {
  color: var(--mbeai-success);
}

/* Ações da resposta */
.mbeai-chat-shell .mbeai-response-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 8px;
  padding-left: 2px;
  color: var(--mbeai-text-secondary);
}

.mbeai-chat-shell .mbeai-action {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  color: inherit;
  background: transparent;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.mbeai-chat-shell .mbeai-action:hover {
  color: var(--mbeai-text);
  background: rgba(255, 255, 255, 0.08);
}

.mbeai-chat-shell .mbeai-action:active {
  transform: scale(0.94);
}

.mbeai-chat-shell .mbeai-action.is-done,
.mbeai-chat-shell .mbeai-action.is-liked {
  color: var(--mbeai-success);
}

.mbeai-chat-shell .mbeai-action.is-speaking {
  color: var(--mbeai-gold);
  background: rgba(216, 178, 106, 0.12);
}

.mbeai-chat-shell .mbeai-action:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
}

/* Indicador de digitação */
.mbeai-chat-shell .mbeai-typing-bubble {
  display: flex;
  gap: 5px;
  padding: 13px 16px;
  border-radius: 6px 18px 18px 18px;
}

.mbeai-chat-shell .mbeai-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--mbeai-gold);
  animation: mbeai-type 1.2s infinite;
}

.mbeai-chat-shell .mbeai-typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.mbeai-chat-shell .mbeai-typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

/* Card de encaminhamento (handoff) */
.mbeai-chat-shell .mbeai-handoff {
  display: grid;
  gap: 9px;
  margin-top: 14px;
  padding: 13px 14px;
  border: 1px solid rgba(216, 178, 106, 0.22);
  border-left: 3px solid var(--mbeai-gold);
  border-radius: 12px;
  background: rgba(216, 178, 106, 0.1);
}

.mbeai-chat-shell .mbeai-handoff strong {
  color: var(--mbeai-text);
  font-size: 14px;
  font-weight: 700;
}

.mbeai-chat-shell .mbeai-handoff span {
  color: var(--mbeai-text-secondary);
  font-size: 13.5px;
  line-height: 1.45;
}

.mbeai-chat-shell .mbeai-whatsapp {
  display: inline-flex;
  width: fit-content;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  border-radius: 999px;
  color: #04110d;
  background: linear-gradient(135deg, #75efa5, #25d366);
  box-shadow: 0 12px 26px rgba(37, 211, 102, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.mbeai-chat-shell .mbeai-whatsapp:hover {
  color: #04110d;
  box-shadow: 0 15px 30px rgba(37, 211, 102, 0.28);
  transform: translateY(-1px);
}

/* ===== Dock inferior ===== */
.mbeai-chat-shell .mbeai-bottom-dock {
  position: relative;
  z-index: 30;
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--mbeai-border-soft);
  background: var(--mbeai-panel-bg);
  backdrop-filter: var(--mbeai-blur);
  -webkit-backdrop-filter: var(--mbeai-blur);
}

/* Sugestões */
.mbeai-chat-shell .mbeai-suggestions {
  display: flex;
  gap: 8px;
  margin: 0 -14px;
  padding: 0 14px 1px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mbeai-chat-shell .mbeai-suggestions::-webkit-scrollbar {
  display: none;
}

.mbeai-chat-shell .mbeai-suggestions[hidden] {
  display: none;
}

.mbeai-chat-shell .mbeai-suggestion {
  min-height: 36px;
  flex: 0 0 auto;
  max-width: 82vw;
  padding: 8px 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--mbeai-text-secondary);
  background: var(--mbeai-glass);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.16s ease, border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.mbeai-chat-shell .mbeai-suggestion:hover {
  border-color: rgba(216, 178, 106, 0.32);
  color: var(--mbeai-text);
  background: rgba(216, 178, 106, 0.1);
}

.mbeai-chat-shell .mbeai-suggestion:active {
  transform: scale(0.98);
}

.mbeai-chat-shell .mbeai-suggestion:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

/* Painel de gravação */
.mbeai-chat-shell .mbeai-recording-panel {
  display: flex;
  min-height: 46px;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid rgba(240, 104, 94, 0.3);
  border-radius: 16px;
  color: var(--mbeai-error);
  background: rgba(240, 104, 94, 0.08);
}

.mbeai-chat-shell .mbeai-recording-panel[hidden] {
  display: none;
}

.mbeai-chat-shell .mbeai-recording-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--mbeai-error);
  box-shadow: 0 0 12px var(--mbeai-error);
  animation: mbeai-pulse 1.4s ease-in-out infinite;
}

.mbeai-chat-shell .mbeai-recording-label,
.mbeai-chat-shell [data-mbeai-recording-label] {
  display: block;
  min-width: 0;
  color: var(--mbeai-text);
  font-size: 13px;
  font-weight: 600;
}

.mbeai-chat-shell .mbeai-recording-copy {
  display: grid;
  min-width: 120px;
  flex: 1 1 150px;
  gap: 2px;
}

.mbeai-chat-shell .mbeai-recording-copy small {
  color: var(--mbeai-text-tertiary);
  font-size: 11px;
  line-height: 1.25;
}

.mbeai-chat-shell .mbeai-waveform {
  display: flex;
  height: 26px;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 2.5px;
}

.mbeai-chat-shell .mbeai-waveform span {
  width: 3px;
  height: 50%;
  border-radius: 2px;
  background: currentColor;
  animation: mbeai-wave 1s ease-in-out infinite;
}

.mbeai-chat-shell .mbeai-waveform span:nth-child(2) { height: 80%; animation-delay: 0.1s; }
.mbeai-chat-shell .mbeai-waveform span:nth-child(3) { height: 100%; animation-delay: 0.2s; }
.mbeai-chat-shell .mbeai-waveform span:nth-child(4) { height: 65%; animation-delay: 0.3s; }
.mbeai-chat-shell .mbeai-waveform span:nth-child(5) { height: 90%; animation-delay: 0.4s; }
.mbeai-chat-shell .mbeai-waveform span:nth-child(6) { height: 45%; animation-delay: 0.5s; }
.mbeai-chat-shell .mbeai-waveform span:nth-child(7) { height: 75%; animation-delay: 0.6s; }

.mbeai-chat-shell .mbeai-recording-time {
  flex: 0 0 auto;
  color: var(--mbeai-error);
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  font-weight: 500;
}

.mbeai-chat-shell .mbeai-recording-action {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  color: var(--mbeai-text);
  background: rgba(255, 255, 255, 0.07);
  font-size: 12px;
  font-weight: 800;
  transition: transform 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

.mbeai-chat-shell .mbeai-recording-action.is-primary {
  border-color: rgba(240, 104, 94, 0.4);
  color: #ffffff;
  background: var(--mbeai-error);
}

.mbeai-chat-shell .mbeai-recording-action:active {
  transform: scale(0.96);
}

/* Prévia de anexos */
.mbeai-chat-shell .mbeai-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mbeai-chat-shell .mbeai-attachments[hidden] {
  display: none;
}

.mbeai-chat-shell .mbeai-attachment {
  position: relative;
  flex: 0 0 auto;
  animation: mbeai-pop 0.2s ease both;
}

.mbeai-chat-shell .mbeai-attachment-thumb {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 14px;
}

.mbeai-chat-shell .mbeai-attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mbeai-chat-shell .mbeai-attachment-file {
  display: flex;
  height: 72px;
  align-items: center;
  gap: 10px;
  max-width: 230px;
  padding: 0 14px 0 10px;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 14px;
  background: var(--mbeai-glass-soft);
}

.mbeai-chat-shell .mbeai-attachment-file-icon {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  color: var(--mbeai-info);
  background: rgba(111, 168, 255, 0.15);
}

.mbeai-chat-shell .mbeai-attachment-name {
  overflow: hidden;
  color: var(--mbeai-text);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mbeai-chat-shell .mbeai-attachment-size {
  margin-top: 2px;
  color: var(--mbeai-text-tertiary);
  font-size: 11px;
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
}

.mbeai-chat-shell .mbeai-attachment-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 999px;
  color: #ffffff;
  background: #1c1c22;
  transition: transform 0.15s ease, background 0.15s ease;
}

.mbeai-chat-shell .mbeai-attachment-remove:hover {
  background: var(--mbeai-error);
}

.mbeai-chat-shell .mbeai-attachment-remove:active {
  transform: scale(0.9);
}

/* ===== Composer ===== */
.mbeai-chat-shell .mbeai-composer {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
}

.mbeai-chat-shell .mbeai-attach-wrap {
  position: relative;
  flex: 0 0 auto;
}

.mbeai-chat-shell .mbeai-plus {
  display: grid;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  color: var(--mbeai-text-secondary);
  background: var(--mbeai-glass-medium);
  transition: background 0.16s ease, transform 0.2s ease, border-color 0.16s ease;
}

.mbeai-chat-shell .mbeai-plus:hover {
  background: var(--mbeai-glass-strong);
}

.mbeai-chat-shell .mbeai-plus:active {
  transform: scale(0.94);
}

.mbeai-chat-shell .mbeai-plus[aria-expanded="true"] {
  border-color: rgba(216, 178, 106, 0.4);
  color: var(--mbeai-gold);
  transform: rotate(45deg);
}

.mbeai-chat-shell .mbeai-attach-menu {
  bottom: calc(100% + 10px);
  left: 0;
}

.mbeai-chat-shell .mbeai-input-shell {
  display: flex;
  min-height: 44px;
  min-width: 0;
  flex: 1 1 auto;
  align-items: flex-end;
  gap: 4px;
  padding: 0 5px 0 0;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 22px;
  background: var(--mbeai-glass-medium);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

.mbeai-chat-shell .mbeai-input-shell:focus-within {
  border-color: rgba(216, 178, 106, 0.46);
  background: rgba(255, 255, 255, 0.075);
  box-shadow: 0 0 0 3px rgba(216, 178, 106, 0.14);
}

/* max-height é recalculado pelo JS conforme o viewport visível; o valor aqui
   cobre o primeiro render e navegadores sem JS de redimensionamento. */
.mbeai-chat-shell .mbeai-composer textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  max-height: 120px;
  flex: 1 1 auto;
  resize: none;
  overscroll-behavior: contain;
  border: 0;
  border-radius: 22px;
  padding: 11px 4px 10px 16px;
  color: var(--mbeai-text);
  background: transparent;
  box-shadow: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.35;
}

.mbeai-chat-shell .mbeai-composer textarea::placeholder {
  color: var(--mbeai-placeholder);
  opacity: 1;
}

.mbeai-chat-shell .mbeai-composer textarea:focus {
  outline: none;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.mbeai-chat-shell .mbeai-inline-camera,
.mbeai-chat-shell .mbeai-inline-audio {
  display: grid;
  width: 34px;
  height: 34px;
  min-width: 34px;
  flex: 0 0 auto;
  place-items: center;
  margin-bottom: 5px;
  border-radius: 999px;
  color: var(--mbeai-text-secondary);
  background: transparent;
  transition: color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.mbeai-chat-shell .mbeai-inline-camera:hover,
.mbeai-chat-shell .mbeai-inline-audio:hover {
  color: var(--mbeai-text);
  background: rgba(255, 255, 255, 0.08);
}

.mbeai-chat-shell .mbeai-inline-camera:active,
.mbeai-chat-shell .mbeai-inline-audio:active {
  transform: scale(0.92);
}

/* Botão principal contextual */
.mbeai-chat-shell .mbeai-main-btn {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 999px;
  color: var(--mbeai-gold-ink);
  background: var(--mbeai-gold-gradient);
  box-shadow: 0 6px 18px -6px rgba(216, 178, 106, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: opacity 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.mbeai-chat-shell .mbeai-main-btn:hover {
  transform: translateY(-1px);
}

.mbeai-chat-shell .mbeai-main-btn:active {
  transform: scale(0.92);
}

.mbeai-chat-shell .mbeai-main-btn > * {
  grid-area: 1 / 1;
}

.mbeai-chat-shell .mbeai-icon-send,
.mbeai-chat-shell .mbeai-icon-orb,
.mbeai-chat-shell .mbeai-icon-stop,
.mbeai-chat-shell .mbeai-icon-spinner {
  display: none;
}

.mbeai-chat-shell .mbeai-main-btn.is-send .mbeai-icon-send {
  display: block;
}

.mbeai-chat-shell .mbeai-main-btn.is-realtime {
  overflow: hidden;
  color: #171102;
  background:
    radial-gradient(circle at 38% 30%, rgba(255, 255, 245, 0.92) 0 7px, transparent 18px),
    radial-gradient(circle at 62% 62%, rgba(141, 187, 255, 0.56), transparent 42%),
    conic-gradient(from 210deg, var(--mbeai-gold), var(--mbeai-gold-light), #8dbbff, var(--mbeai-gold));
  box-shadow:
    0 10px 26px -8px rgba(216, 178, 106, 0.82),
    0 0 0 1px rgba(255, 255, 255, 0.22) inset,
    inset 0 -12px 24px rgba(0, 0, 0, 0.2);
}

.mbeai-chat-shell .mbeai-main-btn.is-realtime .mbeai-icon-orb {
  position: relative;
  display: block;
  width: 27px;
  height: 27px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 34% 31%, rgba(255, 255, 245, 0.82) 0 5px, transparent 13px),
    radial-gradient(circle at 33% 64%, rgba(141, 187, 255, 0.72), transparent 43%),
    linear-gradient(135deg, #f7e6aa, #d8b26a);
  box-shadow: 0 0 18px rgba(216, 178, 106, 0.62);
}

.mbeai-chat-shell .mbeai-main-btn.is-realtime .mbeai-icon-orb > span {
  position: absolute;
  inset: -7px;
  border: 1px solid rgba(255, 248, 233, 0.26);
  border-radius: inherit;
}

.mbeai-chat-shell .mbeai-main-btn.is-realtime .mbeai-icon-orb > span:last-child {
  inset: -12px;
  border-color: rgba(141, 187, 255, 0.18);
}

.mbeai-chat-shell .mbeai-main-btn.is-realtime .mbeai-icon-mic {
  display: none;
}

.mbeai-chat-shell .mbeai-main-btn.is-send .mbeai-icon-mic,
.mbeai-chat-shell .mbeai-main-btn.is-send .mbeai-icon-orb,
.mbeai-chat-shell .mbeai-main-btn.is-recording .mbeai-icon-mic,
.mbeai-chat-shell .mbeai-main-btn.is-recording .mbeai-icon-orb,
.mbeai-chat-shell .mbeai-main-btn.is-busy .mbeai-icon-mic {
  display: none;
}

.mbeai-chat-shell .mbeai-main-btn.is-recording {
  color: #ffffff;
  background: var(--mbeai-error);
  box-shadow: 0 0 0 0 rgba(240, 104, 94, 0.34);
  animation: mbeai-record 1.1s ease-in-out infinite;
}

.mbeai-chat-shell .mbeai-main-btn.is-recording .mbeai-icon-stop {
  display: block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: currentColor;
}

/* Durante a gravação comum o botão Realtime é removido do layout e este
   controle independente ocupa exatamente a mesma posição. */
.mbeai-chat-shell .mbeai-main-btn[hidden],
.mbeai-chat-shell .mbeai-recording-stop-btn[hidden] {
  display: none !important;
}

.mbeai-chat-shell .mbeai-recording-stop-btn {
  flex: 0 0 auto;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.mbeai-chat-shell .mbeai-main-btn.is-busy .mbeai-icon-send,
.mbeai-chat-shell .mbeai-main-btn.is-busy .mbeai-icon-orb,
.mbeai-chat-shell .mbeai-main-btn.is-busy .mbeai-icon-stop {
  display: none;
}

.mbeai-chat-shell .mbeai-main-btn.is-busy .mbeai-icon-spinner {
  display: block;
  width: 17px;
  height: 17px;
  border: 2px solid rgba(28, 22, 8, 0.35);
  border-top-color: var(--mbeai-gold-ink);
  border-radius: 999px;
  animation: mbeai-spin 0.7s linear infinite;
}

.mbeai-chat-shell .mbeai-main-btn:disabled,
.mbeai-chat-shell .mbeai-plus:disabled,
.mbeai-chat-shell .mbeai-inline-camera:disabled,
.mbeai-chat-shell .mbeai-inline-audio:disabled,
.mbeai-chat-shell .mbeai-composer textarea:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

/* Rodapé do dock */
.mbeai-chat-shell .mbeai-footer-row {
  display: flex;
  min-height: 18px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.mbeai-chat-shell .mbeai-audio-note,
.mbeai-chat-shell .mbeai-live-status {
  margin: 0;
  color: var(--mbeai-text-tertiary);
  font-size: 11.5px;
  line-height: 1.35;
}

.mbeai-chat-shell .mbeai-live-status {
  flex: 0 0 auto;
  color: rgba(234, 209, 153, 0.78);
  font-weight: 700;
  text-align: right;
}

/* ===== Toast ===== */
.mbeai-chat-shell .mbeai-toast {
  position: absolute;
  right: 14px;
  bottom: calc(118px + env(safe-area-inset-bottom, 0px));
  z-index: 70;
  display: flex;
  max-width: min(360px, calc(100% - 28px));
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 16px;
  color: var(--mbeai-text);
  background: var(--mbeai-toast-bg);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(28px) saturate(160%);
  -webkit-backdrop-filter: blur(28px) saturate(160%);
  font-size: 14px;
  font-weight: 500;
  animation: mbeai-toast 0.28s ease both;
}

.mbeai-chat-shell .mbeai-toast[hidden] {
  display: none;
}

.mbeai-chat-shell .mbeai-toast-icon {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 9px;
  background: rgba(95, 208, 138, 0.16);
  color: var(--mbeai-success);
  font-size: 14px;
  font-weight: 800;
}

.mbeai-chat-shell .mbeai-toast-icon::before {
  content: "✓";
}

.mbeai-chat-shell .mbeai-toast.is-error .mbeai-toast-icon {
  background: rgba(240, 104, 94, 0.16);
  color: var(--mbeai-error);
}

.mbeai-chat-shell .mbeai-toast.is-error .mbeai-toast-icon::before {
  content: "!";
}

.mbeai-chat-shell .mbeai-toast.is-info .mbeai-toast-icon {
  background: rgba(111, 168, 255, 0.16);
  color: var(--mbeai-info);
}

.mbeai-chat-shell .mbeai-toast.is-info .mbeai-toast-icon::before {
  content: "i";
}

/* ===== Acessibilidade ===== */
.mbeai-chat-shell .screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  white-space: nowrap;
}

.mbeai-chat-shell :where(button, textarea, a):focus-visible {
  outline: 2px solid rgba(234, 209, 153, 0.9);
  outline-offset: 3px;
}

/* ===== Animações ===== */
@keyframes mbeai-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes mbeai-pop {
  from { opacity: 0; transform: translateY(6px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes mbeai-type {
  0%, 60%, 100% { opacity: 0.4; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

@keyframes mbeai-wave {
  0%, 100% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
}

@keyframes mbeai-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes mbeai-spin {
  to { transform: rotate(360deg); }
}

@keyframes mbeai-record {
  0% { box-shadow: 0 0 0 0 rgba(240, 104, 94, 0.34); }
  70% { box-shadow: 0 0 0 12px rgba(240, 104, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(240, 104, 94, 0); }
}

@keyframes mbeai-toast {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Desktop (aplicação centralizada) ===== */
@media (min-width: 900px) {
  .mbeai-chat-shell {
    padding: 24px;
  }

  .mbeai-chat-shell .mbeai-chat-app {
    min-height: 0;
    height: min(920px, calc(100vh - 48px));
    height: min(920px, calc(100dvh - 48px));
    border: 1px solid var(--mbeai-border);
    border-radius: var(--mbeai-radius-xl);
    box-shadow: var(--mbeai-shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  }

  .mbeai-chat-shell .mbeai-chat-header {
    padding: 14px 16px 14px 10px;
  }

  .mbeai-chat-shell .mbeai-messages {
    padding: 20px 22px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(150, 150, 160, 0.3) transparent;
  }

  .mbeai-chat-shell .mbeai-messages::-webkit-scrollbar {
    width: 8px;
  }

  .mbeai-chat-shell .mbeai-messages::-webkit-scrollbar-thumb {
    border: 2px solid transparent;
    border-radius: 99px;
    background: rgba(150, 150, 160, 0.3);
    background-clip: content-box;
  }

  .mbeai-chat-shell .mbeai-bottom-dock {
    padding-right: 18px;
    padding-left: 18px;
    padding-bottom: 14px;
  }

  .mbeai-chat-shell .mbeai-suggestions {
    margin-right: -18px;
    margin-left: -18px;
    padding-right: 18px;
    padding-left: 18px;
  }

  .mbeai-chat-shell .mbeai-toast {
    right: 22px;
    bottom: 130px;
  }
}

/* ===== Ajustes mobile estreito ===== */
@media (max-width: 430px) {
  .mbeai-chat-shell .mbeai-chat-header {
    padding-right: 10px;
  }

  .mbeai-chat-shell .mbeai-messages {
    padding-right: 14px;
    padding-left: 14px;
  }

  .mbeai-chat-shell .mbeai-bottom-dock {
    padding-right: 12px;
    padding-left: 12px;
  }

  .mbeai-chat-shell .mbeai-suggestions {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .mbeai-chat-shell .mbeai-message-user {
    max-width: 84%;
  }

  .mbeai-chat-shell .mbeai-message-ai {
    max-width: 91%;
  }

  .mbeai-chat-shell .mbeai-bubble {
    padding: 13px 15px;
  }

  .mbeai-chat-shell .mbeai-start-card {
    padding: 18px;
    border-radius: var(--mbeai-radius-lg);
  }

  .mbeai-chat-shell .mbeai-start-card h1 {
    font-size: 24px;
  }

  .mbeai-chat-shell .mbeai-start-voice {
    width: 100%;
  }

  .mbeai-chat-shell .mbeai-footer-row {
    flex-direction: column;
    gap: 3px;
  }

  .mbeai-chat-shell .mbeai-live-status {
    text-align: left;
  }
}

@media (max-width: 340px) {
  .mbeai-chat-shell .mbeai-header-copy h2 {
    font-size: 15px;
  }

  .mbeai-chat-shell .mbeai-composer {
    gap: 6px;
  }

  .mbeai-chat-shell .mbeai-plus,
  .mbeai-chat-shell .mbeai-main-btn {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
  }

  .mbeai-chat-shell .mbeai-recording-label {
    max-width: 92px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* ===== Movimento reduzido ===== */
@media (prefers-reduced-motion: reduce) {
  .mbeai-chat-shell,
  .mbeai-chat-shell *,
  .mbeai-chat-shell *::before,
  .mbeai-chat-shell *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .mbeai-chat-shell .mbeai-main-btn.is-busy .mbeai-icon-spinner {
    animation-iteration-count: infinite !important;
    animation-duration: 0.7s !important;
  }
}

/* ================= Mídia da resposta (Regras Inteligentes) ================= */

.mbeai-chat-shell .mbeai-media-block {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
  max-width: min(100%, 520px);
}

.mbeai-chat-shell .mbeai-message-ai > .mbeai-media-block {
  margin-left: 30px;
}

.mbeai-chat-shell .mbeai-media-item {
  margin: 0;
  padding: 0;
  border-radius: var(--mbeai-radius-md, 14px);
  overflow: hidden;
  background: var(--mbeai-glass-soft, rgba(255, 255, 255, 0.04));
  border: 1px solid var(--mbeai-border-soft, rgba(255, 255, 255, 0.08));
}

.mbeai-chat-shell .mbeai-media-item video,
.mbeai-chat-shell .mbeai-media-image-btn img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
}

.mbeai-chat-shell .mbeai-media-image-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  cursor: zoom-in;
  background: transparent;
}
.mbeai-chat-shell .mbeai-media-image-btn img {
  max-height: 340px;
  background: transparent;
}
.mbeai-chat-shell .mbeai-media-image-btn:focus-visible {
  outline: 2px solid var(--mbeai-primary, #d8b26a);
  outline-offset: 2px;
}

/* Embed responsivo (Bunny/YouTube/Vimeo) */
.mbeai-chat-shell .mbeai-media-embed {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
}
.mbeai-chat-shell .mbeai-media-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.mbeai-chat-shell .mbeai-media-item figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 12px 10px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--mbeai-text-secondary, rgba(255, 255, 255, 0.72));
}
.mbeai-chat-shell .mbeai-media-item figcaption strong {
  color: var(--mbeai-text, #fff);
  font-weight: 600;
}

.mbeai-chat-shell .mbeai-media-watch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--mbeai-border-strong, rgba(255, 255, 255, 0.16));
  background: var(--mbeai-glass-strong, rgba(255, 255, 255, 0.08));
  color: var(--mbeai-text, #fff);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}
.mbeai-chat-shell .mbeai-media-watch:hover { transform: translateY(-1px); }
.mbeai-chat-shell .mbeai-media-watch:focus-visible {
  outline: 2px solid var(--mbeai-primary, #d8b26a);
  outline-offset: 2px;
}

/* Lightbox (montado no body; escopo global) */
.mbeai-lightbox {
  position: fixed;
  inset: 0;
  z-index: 2147483000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(4, 4, 8, 0.86);
  opacity: 0;
  transition: opacity 0.2s ease;
}
.mbeai-lightbox.is-open { opacity: 1; }
.mbeai-lightbox img {
  max-width: 96vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.mbeai-lightbox-close {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  right: 16px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mbeai-lightbox-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .mbeai-chat-shell .mbeai-media-watch,
  .mbeai-lightbox { transition: none; }
}

/* ================= Cadastro e autenticação ================= */
.mbeai-auth-shell {
  align-items: center;
  justify-content: center;
  padding: clamp(20px, 4vw, 48px);
}

.mbeai-auth-card,
.mbeai-auth-card *,
.mbeai-auth-card *::before,
.mbeai-auth-card *::after {
  box-sizing: border-box;
}

.mbeai-auth-card {
  width: min(100%, 560px);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--mbeai-border-strong);
  border-radius: var(--mbeai-radius-xl);
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.035));
  box-shadow: var(--mbeai-shadow);
  backdrop-filter: var(--mbeai-blur);
}

.mbeai-auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 26px;
}

.mbeai-auth-logo {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid rgba(234, 209, 153, .28);
  border-radius: 20px;
  background: rgba(216, 178, 106, .09);
  color: var(--mbeai-gold-light);
}

.mbeai-auth-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

.mbeai-auth-brand > span {
  color: var(--mbeai-gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.mbeai-auth-brand h1 {
  margin: 8px 0 8px;
  color: var(--mbeai-text);
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1.08;
  letter-spacing: -.035em;
}

.mbeai-auth-brand p {
  max-width: 430px;
  color: var(--mbeai-text-secondary);
  font-size: 14px;
}

.mbeai-auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  padding: 5px;
  margin-bottom: 22px;
  border: 1px solid var(--mbeai-border);
  border-radius: 16px;
  background: rgba(255,255,255,.035);
}

.mbeai-auth-tabs.is-single {
  grid-template-columns: 1fr;
}

.mbeai-auth-tabs button {
  min-height: 44px;
  border-radius: 11px;
  color: var(--mbeai-text-secondary);
  font-weight: 700;
}

.mbeai-auth-tabs button.is-active {
  background: var(--mbeai-gold-gradient);
  color: var(--mbeai-gold-ink);
  box-shadow: 0 8px 22px rgba(216, 178, 106, .18);
}

.mbeai-auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.mbeai-auth-form[hidden] {
  display: none !important;
}

.mbeai-auth-form label:not(.mbeai-auth-check) {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.mbeai-auth-form label > span {
  color: var(--mbeai-text-secondary);
  font-size: 12px;
  font-weight: 700;
}

.mbeai-auth-form input[type="text"],
.mbeai-auth-form input[type="email"],
.mbeai-auth-form input[type="password"],
.mbeai-auth-form input[type="tel"] {
  width: 100%;
  min-height: 50px;
  padding: 0 15px;
  border: 1px solid var(--mbeai-border-strong);
  border-radius: 13px;
  outline: none;
  background: rgba(3, 3, 7, .38);
  color: var(--mbeai-text);
  font: inherit;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.mbeai-auth-form input:focus {
  border-color: rgba(234, 209, 153, .7);
  background: rgba(3, 3, 7, .56);
  box-shadow: 0 0 0 3px rgba(216, 178, 106, .12);
}

.mbeai-auth-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.mbeai-auth-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--mbeai-text-secondary);
  font-size: 12px;
  line-height: 1.45;
}

.mbeai-auth-check input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  margin-top: 1px;
  accent-color: var(--mbeai-gold);
}


.mbeai-auth-login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.mbeai-auth-login-options > a { color: var(--mbeai-gold); font-weight: 700; }

.mbeai-auth-submit {
  min-height: 52px;
  margin-top: 2px;
  border-radius: 14px;
  background: var(--mbeai-gold-gradient) !important;
  color: var(--mbeai-gold-ink) !important;
  font-weight: 800 !important;
  box-shadow: 0 14px 30px rgba(216, 178, 106, .18) !important;
}

.mbeai-auth-submit:disabled {
  cursor: wait;
  opacity: .62;
}

.mbeai-auth-status {
  margin-top: 16px;
  padding: 11px 13px;
  border-radius: 12px;
  font-size: 13px;
  text-align: center;
}

.mbeai-auth-status.is-error {
  border: 1px solid rgba(240, 104, 94, .28);
  background: rgba(240, 104, 94, .1);
  color: #ffaaa3;
}

.mbeai-auth-status.is-success {
  border: 1px solid rgba(95, 208, 138, .28);
  background: rgba(95, 208, 138, .1);
  color: #9ce8b8;
}

.mbeai-auth-status.is-loading {
  border: 1px solid rgba(111, 168, 255, .24);
  background: rgba(111, 168, 255, .09);
  color: #a7c6ff;
}

.mbeai-auth-registration-disabled {
  color: var(--mbeai-text-secondary);
  font-size: 13px;
  text-align: center;
}

.mbeai-chat-shell .mbeai-menu-user {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 13px;
  border-top: 1px solid var(--mbeai-border-soft);
  border-bottom: 1px solid var(--mbeai-border-soft);
  color: var(--mbeai-text-secondary);
  font-size: 11px;
  overflow: hidden;
}

.mbeai-chat-shell .mbeai-menu-user strong,
.mbeai-chat-shell .mbeai-menu-user span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mbeai-chat-shell .mbeai-menu-user strong {
  color: var(--mbeai-text);
  font-size: 12px;
}

@media (max-width: 560px) {
  .mbeai-auth-shell {
    padding: 14px;
  }

  .mbeai-auth-card {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .mbeai-auth-row {
    grid-template-columns: 1fr;
  }
}


/* Tela de conta bloqueada (3.3.1) */
.mbeai-access-blocked-card {
  text-align: center;
}

.mbeai-access-blocked-notice {
  margin: 22px 0;
  padding: 15px 16px;
  border: 1px solid rgba(239, 91, 107, .35);
  border-radius: 16px;
  background: rgba(239, 91, 107, .09);
  color: var(--mbeai-text, #fff);
  line-height: 1.55;
}

.mbeai-access-blocked-actions {
  display: grid;
  gap: 12px;
}

.mbeai-access-blocked-actions .mbeai-auth-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.mbeai-access-blocked-logout {
  color: var(--mbeai-muted, #aeb2bd);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.mbeai-access-blocked-logout:hover,
.mbeai-access-blocked-logout:focus {
  color: var(--mbeai-gold, #d8b26a);
}

/* ========================================================================== */
/* 3.5.0 — Respostas estruturadas com texto, mídia e botões intercalados      */
/* ========================================================================== */

.mbeai-structured-response {
  display: grid;
  justify-items: stretch;
  gap: 14px;
  width: 100%;
  max-width: min(100%, 680px);
}

.mbeai-structured-response > * {
  min-width: 0;
  max-width: 100%;
}

.mbeai-structured-text {
  width: 100%;
}

.mbeai-structured-text > :first-child {
  margin-top: 0 !important;
}

.mbeai-structured-text > :last-child {
  margin-bottom: 0 !important;
}

.mbeai-structured-media {
  width: min(100%, 560px);
  margin: 0;
}

.mbeai-structured-response .mbeai-media-block {
  margin-top: 0;
}

.mbeai-response-link-wrap {
  display: flex;
  width: 100%;
}

.mbeai-response-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  max-width: 100%;
  padding: 10px 18px;
  border-radius: 13px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.25;
  text-align: center;
  text-decoration: none !important;
  transition: transform .18s ease, box-shadow .18s ease, background-color .18s ease, border-color .18s ease;
}

.mbeai-response-link:hover {
  transform: translateY(-1px);
}

.mbeai-response-link-primary {
  border: 1px solid var(--mbeai-primary, #d8b26a);
  background: var(--mbeai-primary, #d8b26a);
  color: #17120a !important;
  box-shadow: 0 8px 22px rgba(216, 178, 106, .24);
}

.mbeai-response-link-secondary {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.08);
  color: var(--mbeai-text, #f5f5f7) !important;
}

.mbeai-response-link-outline {
  border: 1px solid var(--mbeai-primary, #d8b26a);
  background: transparent;
  color: var(--mbeai-primary, #d8b26a) !important;
}

.mbeai-response-link-download::before {
  content: "↓";
  margin-right: .5em;
  font-size: 1.05em;
  font-weight: 800;
}

.mbeai-response-link.is-loading {
  opacity: .72;
  cursor: progress;
}

.mbeai-response-link.is-error {
  background: rgba(239, 96, 96, .16);
  border-color: rgba(239, 96, 96, .6);
  color: #ffd5d5;
}

.mbeai-protocol-card {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(216, 178, 106, .38);
  border-left: 4px solid var(--mbeai-primary, #d8b26a);
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(216, 178, 106, .10), rgba(255, 255, 255, .025)),
    rgba(9, 9, 12, .82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .045);
}

.mbeai-protocol-card-head {
  display: grid;
  gap: 3px;
}

.mbeai-protocol-card-head span {
  color: var(--mbeai-primary, #d8b26a);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.mbeai-protocol-card h3,
.mbeai-protocol-card h4 {
  margin: 0;
  color: #fff;
}

.mbeai-protocol-card h3 {
  font-size: 19px;
  line-height: 1.25;
}

.mbeai-protocol-card h4 {
  font-size: 13px;
  letter-spacing: .02em;
}

.mbeai-protocol-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.mbeai-protocol-facts > div {
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, .075);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
}

.mbeai-protocol-facts dt {
  margin: 0 0 3px;
  color: rgba(255, 255, 255, .55);
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mbeai-protocol-facts dd {
  margin: 0;
  color: rgba(255, 255, 255, .94);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.mbeai-protocol-sequence {
  display: grid;
  gap: 7px;
  margin: -6px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: mbeai-protocol-step;
}

.mbeai-protocol-sequence li {
  position: relative;
  min-height: 30px;
  padding: 7px 10px 7px 38px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .035);
  color: rgba(255, 255, 255, .84);
  font: 600 12px/1.35 "JetBrains Mono", monospace;
  counter-increment: mbeai-protocol-step;
}

.mbeai-protocol-sequence li::before {
  content: counter(mbeai-protocol-step);
  position: absolute;
  top: 7px;
  left: 9px;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 50%;
  background: rgba(216, 178, 106, .16);
  color: var(--mbeai-primary, #d8b26a);
  font: 800 10px/1 "Manrope", sans-serif;
}

.mbeai-protocol-notes {
  padding: 12px;
  border-radius: 12px;
  background: rgba(216, 178, 106, .075);
}

.mbeai-protocol-notes strong {
  display: block;
  margin-bottom: 5px;
  color: rgba(255, 255, 255, .88);
  font-size: 12px;
}

.mbeai-protocol-notes p,
.mbeai-protocol-source,
.mbeai-protocol-disclaimer {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
}

.mbeai-protocol-notes p {
  color: rgba(255, 255, 255, .68);
}

.mbeai-protocol-source {
  color: rgba(255, 255, 255, .45);
}

.mbeai-protocol-disclaimer {
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: rgba(255, 255, 255, .58);
}

.mbeai-table-catalog {
  overflow: hidden;
  border: 1px solid rgba(216, 178, 106, .34);
  border-radius: 18px;
  background: rgba(9, 9, 12, .82);
}

.mbeai-table-catalog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}

.mbeai-table-catalog-head h3 {
  margin: 0;
  color: #fff;
  font-size: 16px;
}

.mbeai-table-catalog-head span {
  flex: 0 0 auto;
  color: var(--mbeai-primary, #d8b26a);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.mbeai-table-catalog details > summary {
  min-height: 46px;
  padding: 13px 16px;
  color: var(--mbeai-primary, #d8b26a);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.mbeai-table-catalog-list {
  display: grid;
  gap: 8px;
  max-height: min(52vh, 560px);
  padding: 0 12px 12px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.mbeai-table-catalog-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
}

.mbeai-table-catalog-list > div > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.mbeai-table-catalog-list strong {
  color: rgba(255, 255, 255, .94);
  font-size: 13px;
}

.mbeai-table-catalog-list small {
  color: rgba(255, 255, 255, .52);
  font-size: 10px;
}

.mbeai-table-catalog-list .mbeai-response-link {
  min-height: 44px;
  padding: 8px 11px;
  font-size: 11px;
}

.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-card,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-card {
  background: rgba(255, 255, 255, .88);
}

.mbeai-chat-shell[data-mode="light"] .mbeai-table-catalog,
.mbeai-chat-shell.mbeai-light .mbeai-table-catalog {
  background: rgba(255, 255, 255, .9);
}

.mbeai-chat-shell[data-mode="light"] .mbeai-table-catalog-head,
.mbeai-chat-shell.mbeai-light .mbeai-table-catalog-head {
  border-bottom-color: rgba(20, 26, 38, .1);
}

.mbeai-chat-shell[data-mode="light"] .mbeai-table-catalog-head h3,
.mbeai-chat-shell[data-mode="light"] .mbeai-table-catalog-list strong,
.mbeai-chat-shell.mbeai-light .mbeai-table-catalog-head h3,
.mbeai-chat-shell.mbeai-light .mbeai-table-catalog-list strong {
  color: #171923;
}

.mbeai-chat-shell[data-mode="light"] .mbeai-table-catalog-list > div,
.mbeai-chat-shell.mbeai-light .mbeai-table-catalog-list > div {
  border-color: rgba(20, 26, 38, .1);
  background: rgba(20, 26, 38, .04);
}

.mbeai-chat-shell[data-mode="light"] .mbeai-table-catalog-list small,
.mbeai-chat-shell.mbeai-light .mbeai-table-catalog-list small {
  color: #5c6473;
}

.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-card h3,
.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-card h4,
.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-facts dd,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-card h3,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-card h4,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-facts dd {
  color: #171923;
}

.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-facts dt,
.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-sequence li,
.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-notes p,
.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-source,
.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-disclaimer,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-facts dt,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-sequence li,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-notes p,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-source,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-disclaimer {
  color: #4d5565;
}

.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-facts > div,
.mbeai-chat-shell[data-mode="light"] .mbeai-protocol-sequence li,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-facts > div,
.mbeai-chat-shell.mbeai-light .mbeai-protocol-sequence li {
  border-color: rgba(20, 26, 38, .10);
  background: rgba(20, 26, 38, .045);
}

@media (max-width: 520px) {
  .mbeai-protocol-card {
    gap: 14px;
    padding: 15px;
    border-radius: 16px;
  }

  .mbeai-protocol-facts {
    grid-template-columns: 1fr;
  }

  .mbeai-protocol-sequence li {
    font-size: 11px;
  }

  .mbeai-table-catalog-list > div {
    grid-template-columns: 1fr;
  }

  .mbeai-table-catalog-list .mbeai-response-link {
    width: 100%;
  }
}

.mbeai-structured-supplement {
  margin-top: 2px;
}

.mbeai-chat-shell[data-mode="light"] .mbeai-response-link-secondary,
.mbeai-chat-shell.mbeai-light .mbeai-response-link-secondary {
  border-color: rgba(20, 26, 38, .12);
  background: rgba(20, 26, 38, .06);
  color: #1d2433 !important;
}

@media (max-width: 640px) {
  .mbeai-structured-response {
    max-width: 100%;
  }

  .mbeai-structured-media {
    width: 100%;
  }

  .mbeai-response-link {
    width: 100%;
  }
}

/* ==========================================================================
   3.7.0 — Refinamento do chat público
   Ajustes conservadores: preservam a identidade escura com dourado e não
   alteram a estrutura já validada do fullscreen/teclado.
   ========================================================================== */

/* Alvos de toque confortáveis sem mudar o layout do composer: a área clicável
   é ampliada por um pseudo-elemento, mantendo o botão com o mesmo tamanho. */
@media (pointer: coarse) {
  .mbeai-chat-shell .mbeai-inline-camera,
  .mbeai-chat-shell .mbeai-inline-audio {
    position: relative;
  }

  .mbeai-chat-shell .mbeai-inline-camera::after,
  .mbeai-chat-shell .mbeai-inline-audio::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 44px;
    height: 44px;
    transform: translate(-50%, -50%);
  }
}

/* Hierarquia do cabeçalho: o nome do assistente domina, o status recua. */
.mbeai-chat-shell .mbeai-chat-header {
  border-bottom: 1px solid var(--mbeai-border-soft);
}

/* Respiro entre turnos: separa visualmente pergunta e resposta sem alongar
   demais a conversa. */
.mbeai-chat-shell .mbeai-message-user + .mbeai-message-ai {
  margin-top: 2px;
}

/* Em telas pequenas o blur pesado custa caro; reduzimos mantendo a leitura. */
@media (max-width: 430px) {
  .mbeai-chat-shell .mbeai-bottom-dock {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}

/* Aparelhos que pedem menos movimento também recebem menos blur. */
@media (prefers-reduced-motion: reduce) {
  .mbeai-chat-shell .mbeai-bottom-dock,
  .mbeai-chat-shell .mbeai-chat-header {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
