/* ── bgbot.php — chat com layout três colunas ──────────────────────────── */

/* ── Override de largura para layout wide ─────────────────────────────── */
/* body.ds-app-body tem min-height: max(884px, 100dvh) — em viewports <884px cria scroll.
   Bloqueamos em 100dvh para o layout de chat nunca precisar rolar. */
body.bgbot-page-body,
body.bgbot-page-body .ds-shell {
  min-height: 100dvh;
}

body.bgbot-page-body .app {
  max-width: none;
  padding: var(--ds-top-bar-h, 4rem) 0 0;
  min-height: unset;
}

body.bgbot-page-body .top-app-bar__inner {
  max-width: none;
  padding-inline: 1.5rem;
}

body.bgbot-page-body .ds-main {
  gap: 0;
}

/* ── Layout três colunas ───────────────────────────────────────────────── */
.bgbot-layout {
  display: grid;
  grid-template-columns: 260px 1fr 280px;
  grid-template-rows: 1fr;
  /* Desktop: site-footer é fixed; bottom: 0; min-height: 3.5rem */
  height: calc(100dvh - var(--ds-top-bar-h, 4rem) - 3.5rem);
  overflow: hidden;
  border-top: 1px solid var(--border-2);
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* SIDEBAR ESQUERDA — histórico                                            */
/* ═══════════════════════════════════════════════════════════════════════ */
.bgbot-sidebar {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-right: 1px solid var(--border-2);
  background: var(--ds-surface-container, rgba(255,255,255,.03));
}

.bgbot-sidebar__top {
  display: flex;
  flex-direction: column;
  gap: .625rem;
  padding: 1rem .875rem .75rem;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border-2);
}

.bgbot-sidebar__new-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .375rem;
  width: 100%;
  padding: .625rem 1rem;
  background: var(--ds-primary);
  color: #fff;
  border: none;
  border-radius: var(--ds-radius-md, 12px);
  font-size: .875rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: opacity .15s;
}
.bgbot-sidebar__new-btn:hover { opacity: .88; }
.bgbot-sidebar__new-btn .ds-mso { font-size: 1.1rem; }

.bgbot-sidebar__search-wrap {
  display: flex;
  align-items: center;
  gap: .375rem;
  background: var(--ds-surface-container-high, rgba(255,255,255,.06));
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: .375rem .625rem;
}
.bgbot-sidebar__search-wrap .ds-mso {
  font-size: 1rem;
  color: var(--ds-on-surface-variant);
  flex-shrink: 0;
}

.bgbot-sidebar__search {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-size: .8125rem;
  color: var(--ds-on-surface);
  min-width: 0;
}
.bgbot-sidebar__search::placeholder { color: var(--ds-on-surface-variant); opacity: .7; }

/* History list */
.bgbot-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: .5rem 0;
}

.bgbot-sidebar__group {
  margin-bottom: .25rem;
}

.bgbot-sidebar__group-label {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ds-on-surface-variant);
  padding: .625rem .875rem .25rem;
  text-transform: uppercase;
}

.bgbot-sidebar__item {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  padding: .5rem .875rem;
  cursor: pointer;
  border-radius: 0;
  transition: background .12s;
  text-decoration: none;
  color: inherit;
}
.bgbot-sidebar__item:hover { background: var(--ds-surface-container-high, rgba(255,255,255,.06)); }
.bgbot-sidebar__item--active { background: var(--ds-surface-container-highest, rgba(255,255,255,.1)); }

.bgbot-sidebar__item-dot {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: var(--ds-primary);
  flex-shrink: 0;
  margin-top: .35rem;
}

.bgbot-sidebar__item-text {
  min-width: 0;
  flex: 1;
}

.bgbot-sidebar__item-title {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ds-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.4;
}

.bgbot-sidebar__item-sub {
  font-size: .75rem;
  color: var(--ds-on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  line-height: 1.4;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* CENTER — conversa                                                       */
/* ═══════════════════════════════════════════════════════════════════════ */
.bgbot-center {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  min-width: 0;
}

/* Conversation header */
.bgbot-conv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .75rem 1.25rem;
  border-bottom: 1px solid var(--border-2);
  flex-shrink: 0;
  background: var(--ds-surface-container, rgba(255,255,255,.02));
}

.bgbot-conv-header__left {
  display: flex;
  align-items: center;
  gap: .5rem;
  min-width: 0;
  flex: 1;
}

.bgbot-conv-header__title {
  font-size: .9375rem;
  font-weight: 700;
  color: var(--ds-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bgbot-badge {
  display: inline-flex;
  align-items: center;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .05em;
  padding: .1rem .45rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.bgbot-badge--active {
  background: rgba(74, 222, 128, .18);
  color: #4ade80;
}

.bgbot-conv-header__meta {
  display: flex;
  align-items: center;
  gap: .625rem;
  flex-shrink: 0;
}

.bgbot-header-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--ds-surface-container-high, rgba(255,255,255,.08));
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: .2rem .5rem .2rem .25rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--ds-on-surface);
}

.bgbot-header-chip__img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.bgbot-header-chip__ph {
  font-size: .9rem;
  color: var(--ds-on-surface-variant);
}

.bgbot-online-indicator {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .75rem;
  color: var(--ds-on-surface-variant);
}

.bgbot-online-indicator__dot {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: #4ade80;
  flex-shrink: 0;
  animation: bgbot-pulse 2s infinite;
}

@keyframes bgbot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .5; }
}

/* Chat area */
.bgbot-chat {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .875rem;
  padding: 1.25rem;
}

/* Message bubbles */
.bgbot-message {
  max-width: 85%;
  padding: .75rem 1rem;
  font-size: .9375rem;
  line-height: 1.6;
  border-radius: 1rem;
  word-break: break-word;
}

.bgbot-message--user {
  background: var(--ds-primary);
  color: #fff;
  align-self: flex-end;
  border-radius: 1rem 1rem 0 1rem;
  white-space: pre-wrap;
}

.bgbot-message--assistant {
  background: var(--ds-surface-container);
  color: var(--ds-on-surface);
  align-self: flex-start;
  border-radius: 0 1rem 1rem 1rem;
}

.bgbot-message--typing {
  display: flex;
  align-items: center;
  gap: .3rem;
  padding: .875rem 1.125rem;
  min-height: 2.75rem;
}

.bgbot-dot {
  width: .4rem;
  height: .4rem;
  border-radius: 50%;
  background: var(--ds-on-surface-variant);
  animation: bgbot-blink 1.2s infinite both;
}
.bgbot-dot:nth-child(2) { animation-delay: .2s; }
.bgbot-dot:nth-child(3) { animation-delay: .4s; }

@keyframes bgbot-blink {
  0%, 80%, 100% { opacity: .2; transform: scale(.8); }
  40%           { opacity: 1;  transform: scale(1);  }
}

.bgbot-message--rendered p            { margin: 0 0 .625rem; }
.bgbot-message--rendered p:last-child { margin-bottom: 0; }
.bgbot-message--rendered ul,
.bgbot-message--rendered ol           { margin: .25rem 0 .625rem 1.25rem; padding: 0; }
.bgbot-message--rendered li           { margin-bottom: .3rem; }
.bgbot-message--rendered strong       { font-weight: 700; }
.bgbot-message--rendered em           { font-style: italic; }
.bgbot-message--rendered a            { color: var(--ds-primary); text-decoration: underline; word-break: break-all; }
.bgbot-message--rendered h3,
.bgbot-message--rendered h4           { margin: .625rem 0 .25rem; font-size: 1rem; font-weight: 700; }
.bgbot-message--rendered img          { max-width: 100%; max-height: 250px; border-radius: var(--ds-radius-md, 8px); display: block; margin: 0.625rem 0; object-fit: contain; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15); }

/* Context bar */
.bgbot-context-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding: .5rem 1.25rem;
  border-top: 1px solid var(--border-2);
  flex-shrink: 0;
  background: var(--ds-surface-container, rgba(255,255,255,.02));
}

.bgbot-context-bar__label {
  font-size: .6875rem;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--ds-on-surface-variant);
  text-transform: uppercase;
  flex-shrink: 0;
}

.bgbot-context-bar__games {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .375rem;
}

.bgbot-context-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--ds-surface-container-high, rgba(255,255,255,.08));
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: .2rem .625rem .2rem .3rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ds-on-surface);
  cursor: default;
}

.bgbot-context-chip__img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: cover;
  border-radius: 3px;
  flex-shrink: 0;
}

.bgbot-context-chip__ph {
  font-size: 1rem;
  color: var(--ds-on-surface-variant);
}

.bgbot-context-bar__add {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  background: transparent;
  border: 1px dashed var(--border-2);
  border-radius: 6px;
  padding: .2rem .625rem;
  font-size: .8125rem;
  color: var(--ds-on-surface-variant);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.bgbot-context-bar__add:hover {
  border-color: var(--ds-primary);
  color: var(--ds-primary);
}

/* Mention label (@ chip above composer) */
.bgbot-mention-label {
  padding: 0 1.25rem;
  min-height: 0;
}
.bgbot-mention-label:empty { display: none; }

/* Composer */
.bgbot-composer {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  border-top: 1px solid var(--border-2);
  padding: .625rem 1.25rem .75rem;
  flex-shrink: 0;
  background: var(--ds-surface-container, rgba(255,255,255,.02));
}

.bgbot-composer__attachments {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.bgbot-composer__attachments:empty { display: none; }

.bgbot-assistant-tts-slot {
  padding: .35rem .875rem 0;
}

.bgbot-assistant-tts-bar--chat {
  display: flex;
  align-items: center;
  gap: .45rem;
  flex-wrap: wrap;
}

.bgbot-assistant-tts-action--chat {
  margin-top: .55rem;
}

.bgbot-assistant-tts-play,
.bgbot-assistant-tts-toggle,
.bgbot-assistant-tts-voice,
.bgbot-assistant-tts-speed {
  min-height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border-2);
  background: var(--ds-surface-container-high, rgba(255,255,255,.06));
  color: var(--ds-on-surface);
  font: inherit;
  font-size: .75rem;
}

.bgbot-assistant-tts-play,
.bgbot-assistant-tts-toggle,
.bgbot-assistant-tts-voice {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  padding: .35rem .55rem;
  cursor: pointer;
}

.bgbot-assistant-tts-speed {
  padding: .35rem .45rem;
}

.bgbot-assistant-tts-toggle.is-on {
  border-color: rgba(74, 222, 128, .55);
  background: rgba(74, 222, 128, .14);
}

.bgbot-assistant-tts-play .ds-mso,
.bgbot-assistant-tts-toggle .ds-mso,
.bgbot-assistant-tts-voice .ds-mso {
  font-size: 1rem;
}

.bgbot-composer__row {
  display: flex;
  align-items: flex-end;
  gap: .25rem;
}

.bgbot-composer__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  background: transparent;
  border: none;
  border-radius: var(--ds-radius-sm, 8px);
  color: var(--ds-on-surface-variant);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.bgbot-composer__icon-btn:hover {
  background: var(--ds-surface-container-high, rgba(255,255,255,.08));
  color: var(--ds-on-surface);
}
.bgbot-composer__icon-btn .ds-mso { font-size: 1.1rem; }

.bgbot-composer__mention-btn { color: var(--ds-primary); }

.bgbot-composer__textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: .9375rem;
  line-height: 1.5;
  color: var(--ds-on-surface);
  min-height: 1.5rem;
  max-height: 8rem;
  overflow-y: auto;
  padding: .25rem 0;
}
.bgbot-composer__textarea::placeholder { color: var(--ds-on-surface-variant); opacity: .65; }

.bgbot-composer__send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  background: var(--ds-primary);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity .15s;
}
.bgbot-composer__send:hover { opacity: .88; }
.bgbot-composer__send .ds-mso { font-size: 1.2rem; }

.bgbot-composer__stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;
  padding: .375rem .75rem;
  background: var(--ds-error, #c0392b);
  border: none;
  border-radius: var(--ds-radius-sm, 8px);
  color: #fff;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}
.bgbot-composer__stop:hover { opacity: .88; }
.bgbot-composer__stop .ds-mso { font-size: 1.1rem; }
.bgbot-composer__stop.hidden { display: none; }

.bgbot-composer__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .75rem;
  color: var(--ds-on-surface-variant);
  min-height: 1.25rem;
  padding: 0 .125rem;
}

.bgbot-composer__new {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: transparent;
  border: none;
  color: var(--ds-primary);
  font-size: .75rem;
  font-weight: 600;
  cursor: pointer;
  padding: .125rem .25rem;
  border-radius: 4px;
}
.bgbot-composer__new:hover { text-decoration: underline; }
.bgbot-composer__new .ds-mso { font-size: .9rem; }
.bgbot-composer__new.hidden { display: none; }

/* Image attachments */
.bgbot-attachment {
  display: flex;
  align-items: center;
  gap: .375rem;
  background: var(--ds-surface-container-high, rgba(0,0,0,.06));
  border-radius: 6px;
  padding: .25rem .5rem .25rem .25rem;
  font-size: .8125rem;
  color: var(--ds-on-surface-variant);
}
.bgbot-attachment img {
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  border-radius: 4px;
}
.bgbot-attachment button {
  display: inline-flex;
  align-items: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ds-on-surface-variant);
  padding: 0;
  margin-left: auto;
}
.bgbot-attachment button .ds-mso { font-size: .9rem; }

/* ═══════════════════════════════════════════════════════════════════════ */
/* RIGHT PANEL — jogo + fontes + sugestões                                 */
/* ═══════════════════════════════════════════════════════════════════════ */
.bgbot-right {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  border-left: 1px solid var(--border-2);
  background: var(--ds-surface-container, rgba(255,255,255,.03));
}

.bgbot-right__section {
  padding: 1rem;
  border-bottom: 1px solid var(--border-2);
}
.bgbot-right__section.hidden { display: none; }

.bgbot-right__heading {
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ds-on-surface-variant);
  margin: 0 0 .75rem;
}

.bgbot-right__game-panel {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.bgbot-right__cover {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--ds-radius-md, 10px);
  display: block;
}

.bgbot-right__game-name {
  font-size: 1.0625rem;
  font-weight: 800;
  color: var(--ds-on-surface);
  font-style: italic;
  line-height: 1.3;
}

.bgbot-right__game-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  font-size: .8125rem;
  color: var(--ds-on-surface-variant);
}

.bgbot-right__meta-item {
  display: inline-flex;
  align-items: center;
  gap: .2rem;
}
.bgbot-right__meta-item .ds-mso { font-size: .9rem; }

.bgbot-right__game-link {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8125rem;
  color: var(--ds-primary);
  text-decoration: none;
  margin-top: .25rem;
}
.bgbot-right__game-link:hover { text-decoration: underline; }
.bgbot-right__game-link .ds-mso { font-size: .875rem; }

/* Seção de preços */
.bgbot-right__prices {
  display: flex;
  flex-direction: column;
  gap: .125rem;
  border-top: 1px solid var(--border-2);
  padding-top: .625rem;
  margin-top: .375rem;
}

.bgbot-right__prices-label {
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ds-on-surface-variant);
  margin: 0 0 .25rem;
}

.bgbot-right__price-row {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .375rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background .12s;
}
.bgbot-right__price-row:hover {
  background: var(--ds-surface-container-high, rgba(255,255,255,.08));
}

.bgbot-right__price-icon {
  font-size: .875rem;
  color: var(--ds-on-surface-variant);
  flex-shrink: 0;
}

.bgbot-right__price-store {
  font-size: .8125rem;
  color: var(--ds-on-surface-variant);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}

.bgbot-right__price-val {
  font-size: .8125rem;
  font-weight: 700;
  color: var(--ds-primary);
  white-space: nowrap;
  flex-shrink: 0;
}

.bgbot-right__empty {
  font-size: .8125rem;
  color: var(--ds-on-surface-variant);
  line-height: 1.5;
  margin: 0;
}

/* Sources */
.bgbot-right__sources {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.bgbot-source-row {
  display: flex;
  align-items: center;
  gap: .625rem;
}

.bgbot-source-icon {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .6875rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.bgbot-source-info {
  flex: 1;
  min-width: 0;
}

.bgbot-source-label {
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ds-on-surface);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.bgbot-source-count {
  font-size: .75rem;
  color: var(--ds-on-surface-variant);
  font-weight: 600;
}

/* Suggestions */
.bgbot-right__suggestions {
  display: flex;
  flex-direction: column;
  gap: .375rem;
}

.bgbot-suggestion-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  padding: .5rem .75rem;
  font-size: .8125rem;
  color: var(--ds-on-surface);
  cursor: pointer;
  text-align: left;
  transition: background .12s, border-color .12s;
  gap: .5rem;
}
.bgbot-suggestion-btn:hover {
  background: var(--ds-surface-container-high, rgba(255,255,255,.06));
  border-color: var(--ds-primary);
}
.bgbot-suggestion-btn .ds-mso { font-size: .875rem; color: var(--ds-on-surface-variant); flex-shrink: 0; }

/* @ mention dropdown (floats over the page) */
.bgbot-mention-dropdown {
  position: fixed;
  z-index: 200;
  background: var(--ds-surface-container-high, #1e1e1e);
  border: 1px solid var(--border-2);
  border-radius: var(--ds-radius-md, 12px);
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  min-width: 240px;
  max-width: 320px;
  overflow: hidden;
}
.bgbot-mention-dropdown.hidden { display: none; }

.bgbot-mention-dropdown__hint {
  padding: .625rem .875rem;
  font-size: .8125rem;
  color: var(--ds-on-surface-variant);
}

.bgbot-mention-option {
  display: flex;
  align-items: center;
  gap: .625rem;
  width: 100%;
  background: transparent;
  border: none;
  padding: .625rem .875rem;
  text-align: left;
  cursor: pointer;
  transition: background .1s;
  color: var(--ds-on-surface);
  font-size: .875rem;
}
.bgbot-mention-option:hover,
.bgbot-mention-option.bgbot-dd-active { background: var(--ds-surface-container-highest, rgba(255,255,255,.1)); }

.bgbot-mention-option__img {
  width: 2rem;
  height: 2rem;
  object-fit: cover;
  border-radius: 4px;
  flex-shrink: 0;
}
.bgbot-mention-option__img--ph {
  background: var(--ds-surface-container-high);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--ds-on-surface-variant);
}

/* "Inserir jogo" — último item do dropdown */
.bgbot-mention-option--new {
  border-top: 1px solid var(--ds-outline-variant);
  color: var(--ds-primary);
  justify-content: space-between;
  margin-top: .25rem;
}
.bgbot-mention-option__icon {
  color: var(--ds-on-surface-variant);
  flex: 0 0 auto;
}

/* Modal de upload de jogo */
.bgbot-upload-modal {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
}
.bgbot-upload-modal.hidden { display: none; }
.bgbot-upload-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
}
.bgbot-upload-modal__box {
  position: relative;
  z-index: 1;
  background: var(--ds-surface-container, #1e1e2e);
  border: 1px solid var(--ds-outline-variant);
  border-radius: 1rem;
  padding: 1.5rem;
  width: min(480px, calc(100vw - 2rem));
  display: grid;
  gap: 1rem;
}
.bgbot-upload-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
}
.bgbot-upload-modal__header h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0;
}
.bgbot-upload-modal__close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ds-on-surface-variant);
  padding: .25rem;
  border-radius: .375rem;
  line-height: 1;
}
.bgbot-upload-modal__close:hover { color: var(--ds-on-surface); }
.bgbot-upload-modal__form {
  display: grid;
  gap: .65rem;
}
body.bgbot-upload-modal-open { overflow: hidden; }

/* @ chip in composer */
.bgbot-at-chip {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--ds-surface-container-high, rgba(255,255,255,.1));
  border: 1px solid var(--border-2);
  border-radius: 6px;
  padding: .2rem .5rem .2rem .3rem;
  font-size: .8125rem;
  font-weight: 600;
  color: var(--ds-on-surface);
  margin: .25rem 0;
}
.bgbot-at-chip__img {
  width: 1.25rem;
  height: 1.25rem;
  object-fit: cover;
  border-radius: 3px;
}
.bgbot-at-chip__at { color: var(--ds-primary); font-weight: 700; }

/* ═══════════════════════════════════════════════════════════════════════ */
/* SCROLLBARS DISCRETAS                                                    */
/* ═══════════════════════════════════════════════════════════════════════ */
.bgbot-chat,
.bgbot-sidebar__list,
.bgbot-right {
  scrollbar-width: thin;
  scrollbar-color: rgba(128, 128, 128, 0.25) transparent;
}

.bgbot-chat::-webkit-scrollbar,
.bgbot-sidebar__list::-webkit-scrollbar,
.bgbot-right::-webkit-scrollbar { width: 4px; }

.bgbot-chat::-webkit-scrollbar-track,
.bgbot-sidebar__list::-webkit-scrollbar-track,
.bgbot-right::-webkit-scrollbar-track { background: transparent; }

.bgbot-chat::-webkit-scrollbar-thumb,
.bgbot-sidebar__list::-webkit-scrollbar-thumb,
.bgbot-right::-webkit-scrollbar-thumb {
  background: rgba(128, 128, 128, 0.25);
  border-radius: 4px;
}

.bgbot-chat::-webkit-scrollbar-thumb:hover,
.bgbot-sidebar__list::-webkit-scrollbar-thumb:hover,
.bgbot-right::-webkit-scrollbar-thumb:hover {
  background: rgba(128, 128, 128, 0.45);
}

/* Light theme */
.theme-light .bgbot-chat,
.theme-light .bgbot-sidebar__list,
.theme-light .bgbot-right {
  scrollbar-color: rgba(0, 0, 0, 0.18) transparent;
}

.theme-light .bgbot-chat::-webkit-scrollbar-thumb,
.theme-light .bgbot-sidebar__list::-webkit-scrollbar-thumb,
.theme-light .bgbot-right::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.18);
}

.theme-light .bgbot-chat::-webkit-scrollbar-thumb:hover,
.theme-light .bgbot-sidebar__list::-webkit-scrollbar-thumb:hover,
.theme-light .bgbot-right::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.32);
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* HAMBURGER TOGGLE (só mobile)                                            */
/* ═══════════════════════════════════════════════════════════════════════ */
.bgbot-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.125rem;
  height: 2.125rem;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--ds-on-surface-variant);
  cursor: pointer;
  flex-shrink: 0;
  transition: background .12s;
}
.bgbot-sidebar-toggle:hover { background: var(--ds-surface-container-high, rgba(255,255,255,.08)); }
.bgbot-sidebar-toggle .ds-mso { font-size: 1.2rem; }

/* BACKDROP */
.bgbot-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity .25s;
}
.bgbot-sidebar-backdrop.bgbot-sidebar-backdrop--visible {
  opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════════════ */
/* RESPONSIVO                                                              */
/* ═══════════════════════════════════════════════════════════════════════ */
@media (max-width: 1100px) {
  .bgbot-layout { grid-template-columns: 220px 1fr 240px; }
}

@media (max-width: 900px) {
  .bgbot-layout {
    grid-template-columns: 200px 1fr;
    /* Tablet/mobile: bottom-nav é fixed; bottom: 0; ~5rem */
    height: calc(100dvh - var(--ds-top-bar-h, 4rem) - var(--ds-bottom-nav-h, 5rem));
  }
  .bgbot-right { display: none; }
}

@media (max-width: 700px) {
  .bgbot-layout {
    display: flex;
    flex-direction: column;
    /* bottom-nav continua fixed; subtrai a mesma altura */
    height: calc(100dvh - var(--ds-top-bar-h, 4rem) - var(--ds-bottom-nav-h, 5rem));
    overflow: hidden;
    border-top: none;
  }

  /* Sidebar vira drawer fixo — oculto por padrão */
  .bgbot-sidebar {
    position: fixed;
    top: var(--ds-top-bar-h, 4rem);
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: none;
  }

  .bgbot-sidebar.bgbot-sidebar--open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
  }

  .bgbot-sidebar-backdrop {
    display: block;
    pointer-events: none;
  }
  .bgbot-sidebar-backdrop.bgbot-sidebar-backdrop--visible {
    pointer-events: auto;
  }

  /* Hamburger aparece no mobile */
  .bgbot-sidebar-toggle { display: inline-flex; }

  /* Right panel oculto */
  .bgbot-right { display: none; }

  /* Center ocupa tudo */
  .bgbot-center {
    height: 100%;
    overflow: hidden;
  }
}
