/* ═══════════════════════════════════════════════════════════════════
   App Inbox - estilo dark masculine RR (preto + dourado, Inter).
   2 paineis: sidebar (lista de threads) + reader (mensagens + composer).
   Mobile: stack; sidebar visivel ate selecionar uma thread.
   =================================================================== */

:root {
  --bg:           #0a0a0b;
  --bg-elev:      #15151a;
  --bg-elev-2:    #1c1c22;
  --border:       rgba(255, 255, 255, 0.06);
  --border-2:     rgba(255, 255, 255, 0.10);
  --text:         #ededeb;
  --text-soft:    rgba(237, 237, 235, 0.72);
  --text-dim:     rgba(237, 237, 235, 0.50);
  --gold:         #c9a24f;
  --gold-soft:    rgba(201, 162, 79, 0.14);
  --danger:       #d97c6a;
}

* { box-sizing: border-box; }

/* O atributo HTML `hidden` precisa vencer os display: flex/grid abaixo. */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Layout principal ─────────────────────────────────────────── */

.ib-layout {
  display: grid;
  grid-template-columns: 230px 360px 1fr;  /* rail | lista | leitura */
  height: calc(100vh - 64px);              /* topbar tem ~64px */
  min-height: 600px;
  background: var(--bg);
  position: relative;
}

@media (max-width: 1100px) {
  .ib-layout { grid-template-columns: 320px 1fr; }   /* esconde rail; vira overlay */
}
@media (max-width: 880px) {
  .ib-layout { grid-template-columns: 1fr; }
}

/* ─── Sidebar ─────────────────────────────────────────────────── */

.ib-sidebar {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--bg);
  overflow: hidden;
  min-height: 0;
}

.ib-sidebar-head {
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ib-sidebar-title { margin-bottom: 12px; }

.ib-eyebrow {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 4px;
}

.ib-title {
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
  font-feature-settings: 'tnum' 1;
}

/* mailbox picker: select estilizado pra parecer um titulo clicavel.
   Mantemos o <select> nativo (acessivel e simples) e escondemos o caret
   do browser pra desenhar o nosso. */
.ib-mailbox-picker {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.ib-mailbox-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: transparent;
  border: 0;
  padding: 0 22px 0 0;
  margin: 0;
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  outline: none;
  max-width: 100%;
  font-feature-settings: 'tnum' 1;
}
.ib-mailbox-select:focus-visible {
  color: var(--gold);
}
/* Opcoes do dropdown ficam estilizadas pelo OS, mas tentamos forcar dark
   nos browsers que aceitam (Chrome/Edge respeitam color-scheme do root). */
.ib-mailbox-select option {
  background: var(--bg-elev);
  color: var(--text);
}
.ib-mailbox-caret {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
  transition: color 0.15s;
}
.ib-mailbox-picker:hover .ib-mailbox-caret,
.ib-mailbox-select:focus-visible + .ib-mailbox-caret {
  color: var(--gold);
}

/* search */
.ib-search {
  position: relative;
  margin-bottom: 12px;
}
.ib-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}
.ib-search input {
  width: 100%;
  padding: 9px 12px 9px 34px;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.ib-search input:focus {
  border-color: rgba(201, 162, 79, 0.40);
}
.ib-search input::placeholder { color: var(--text-dim); }

/* tabs */
.ib-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elev);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-2);
}
.ib-tab {
  flex: 1;
  padding: 7px 10px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.ib-tab:hover { color: var(--text); }
.ib-tab.is-active {
  background: var(--gold-soft);
  color: var(--gold);
}

/* lista de threads */
.ib-thread-list {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.ib-thread-row {
  /* Layout em grid: coluna do checkbox (fixa) + coluna do conteudo
     (flexivel). Antes era display:block; o checkbox precisaria flutuar.
     O grid mantem o conteudo alinhado mesmo com checkbox de larguras
     diferentes em navegadores diferentes. */
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: start;
  gap: 4px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.12s;
  position: relative;
}
.ib-thread-row:hover { background: rgba(255, 255, 255, 0.02); }
/* Linha selecionada via checkbox de bulk: fundo dourado fraco + traço
   à esquerda em dourado pleno. Diferente do is-active (linha aberta no
   reader): ambos podem coexistir. */
.ib-thread-row.is-selected {
  background: rgba(201, 162, 79, 0.10);
}
.ib-thread-row.is-selected::after {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  background: var(--gold);
}
.ib-thread-row.is-active {
  background: var(--gold-soft);
  border-left: 2px solid var(--gold);
  padding-left: 16px;
}
.ib-thread-row.is-unread .ib-thread-subj { color: var(--text); font-weight: 700; }
.ib-thread-row.is-unread::before {
  /* O ponto do unread fica na coluna do checkbox, deslocado pra não
     colidir com a caixa de seleção. */
  content: '';
  position: absolute;
  left: 3px;
  top: 22px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold);
}
.ib-thread-row.is-active::before { display: none; }

.ib-thread-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 4px;
  gap: 8px;
}
.ib-thread-from {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.ib-thread-time {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  font-feature-settings: 'tnum' 1;
}
.ib-thread-subj {
  font-size: 13px;
  color: var(--text-soft);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 2px;
}
.ib-thread-snippet {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badge que identifica em qual caixa o e-mail caiu. So aparece quando o
   filtro de caixa esta em "Todas" - se o usuario ja filtrou, o badge
   seria redundante. Cores distintas pra scan rapido. */
.ib-mailbox-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  align-self: center;
  flex-shrink: 0;
  border: 1px solid transparent;
}
.ib-mailbox-badge.is-contato {
  background: rgba(201, 162, 79, 0.14);
  color: #d8b56a;
  border-color: rgba(201, 162, 79, 0.30);
}
.ib-mailbox-badge.is-campanhas {
  background: rgba(120, 144, 220, 0.14);
  color: #98a8e0;
  border-color: rgba(120, 144, 220, 0.30);
}
.ib-mailbox-badge.is-suporte {
  background: rgba(108, 184, 138, 0.14);
  color: #8fcfa9;
  border-color: rgba(108, 184, 138, 0.30);
}

.ib-sidebar-foot {
  flex-shrink: 0;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
}
.ib-load-more {
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.ib-load-more:hover {
  border-color: rgba(201, 162, 79, 0.40);
  color: var(--gold);
}

.ib-empty {
  text-align: center;
  padding: 32px 16px;
  color: var(--text-dim);
}
.ib-empty p { margin: 0 0 4px; color: var(--text-soft); }
.ib-empty small { font-size: 11px; }
.ib-empty code {
  font-family: inherit;
  color: var(--gold);
}

/* ─── Reader (painel direito) ──────────────────────────────────── */

.ib-reader {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: var(--bg);
}

.ib-reader-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: var(--text-dim);
  text-align: center;
}
.ib-reader-empty svg { color: var(--text-dim); margin-bottom: 16px; opacity: 0.5; }
.ib-reader-empty h2 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-soft);
  margin: 0 0 6px;
}
.ib-reader-empty p { margin: 0; font-size: 13px; }

/* thread aberta */
.ib-thread {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.ib-thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.ib-back {
  display: none;
  background: transparent;
  border: 1px solid var(--border-2);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  cursor: pointer;
}
.ib-back:hover { color: var(--gold); border-color: rgba(201, 162, 79, 0.40); }
@media (max-width: 880px) {
  .ib-back { display: inline-flex; }
}

.ib-thread-meta {
  flex: 1;
  min-width: 0;
}
.ib-thread-subject {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-thread-participants {
  font-size: 12px;
  color: var(--text-dim);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ib-thread-actions { display: flex; gap: 8px; flex-shrink: 0; }
.ib-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  color: var(--text-soft);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.ib-action:hover { color: var(--gold); border-color: rgba(201, 162, 79, 0.40); }
.ib-action-danger:hover { color: var(--danger); border-color: rgba(217, 124, 106, 0.40); }
@media (max-width: 600px) {
  .ib-action span { display: none; }
}

/* corpo da thread: messages | resizer | composer (split vertical).
   Default 50/50 (--composer-w: 50%). Quando o usuario arrasta a barra
   o JS sobrescreve com valor em px (persiste em localStorage). */
/* Corpo da thread: mensagens em coluna unica + CTA bar embaixo.
   Antes era um grid lado a lado com resizer arrastavel; refatorado em
   2026-05-27 pra modelo Suporte: thread em largura cheia, resposta
   abre em modal (advanced-editor) via botao da CTA bar. */
.ib-thread-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Resizer e estados de arrastar viraram dead-code apos o refactor;
   o seletor abaixo evita warnings caso o CSS antigo encoste no DOM
   removido. */
.ib-resizer { display: none; }
.ib-resizer::before {
  /* area de hit maior que o visual (12px), pra facilitar o agarrar */
  content: '';
  position: absolute;
  inset: 0 -3px;
}
.ib-resizer:hover,
.ib-resizer:focus-visible,
.ib-thread-body.is-resizing .ib-resizer {
  background: rgba(201, 162, 79, 0.20);
  outline: none;
}
.ib-resizer-grip {
  width: 2px;
  height: 38px;
  background: var(--border-2);
  border-radius: 1px;
  transition: background 0.15s;
}
.ib-resizer:hover .ib-resizer-grip,
.ib-resizer:focus-visible .ib-resizer-grip,
.ib-thread-body.is-resizing .ib-resizer-grip {
  background: var(--gold);
}

/* Lista de mensagens: largura cheia, ocupa o espaco disponivel ate a
   CTA bar inferior. Sem border-right (era separador do composer
   removido). Inner wrapper centraliza com max-width pra leitura
   confortavel (~880px, mesmo padrao do Suporte). */
.ib-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 32px 28px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.ib-messages > * {
  width: 100%;
  max-width: 880px;
  margin-left: auto;
  margin-right: auto;
}

.ib-message {
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-radius: 12px;
  padding: 18px 22px 20px;
  flex-shrink: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  position: relative;
}
/* Acento dourado lateral sutil pra dar profundidade. */
.ib-message::before {
  content: '';
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 2px;
  background: linear-gradient(180deg,
    rgba(201, 162, 79, 0.0) 0%,
    rgba(201, 162, 79, 0.35) 40%,
    rgba(201, 162, 79, 0.0) 100%);
  border-radius: 0 2px 2px 0;
}

/* TODOS os cards crescem pro tamanho exato do conteudo. O auto-resize
   do JS (ver iframe.contentDocument.body.scrollHeight) ajusta a altura
   pra match o body do email -- sem scrollbar interno. */

.ib-msg-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

/* Avatar circular: aceita <img> (perfil do time, via window.RR.team)
   OU <span> com iniciais como fallback. Mesma estrutura do .sup-msg-
   avatar do Suporte (overflow:hidden + grid pra centralizar). */
.ib-msg-avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(135deg, rgba(201, 162, 79, 0.18), rgba(201, 162, 79, 0.06));
  border: 1px solid rgba(201, 162, 79, 0.28);
  display: inline-grid;
  place-items: center;
}
.ib-msg-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ib-msg-avatar-initials {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--gold);
}

/* Outbound (resposta da equipe): destaca com borda dourada + leve
   gradiente, igual ao .sup-msg.is-outbound. Forca tons claros no
   conteudo pra HTML de e-mail (que vem com cores escuras de email
   light theme) renderizar legivel no painel dark. */
.ib-message.is-outbound {
  border-color: rgba(201, 162, 79, 0.30);
  background: linear-gradient(180deg, rgba(201,162,79,0.05), rgba(201,162,79,0.01));
}
.ib-message.is-outbound .ib-msg-content,
.ib-message.is-outbound .ib-msg-content *:not(iframe):not(a) {
  color: rgba(237, 237, 235, 0.92) !important;
  background: transparent !important;
  border-color: rgba(201, 162, 79, 0.30) !important;
}
.ib-message.is-outbound .ib-msg-content a {
  color: var(--gold) !important;
}
.ib-message.is-outbound .ib-msg-content strong,
.ib-message.is-outbound .ib-msg-content b {
  color: var(--text) !important;
}

.ib-msg-identity {
  flex: 1;
  min-width: 0;
}
.ib-msg-from {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ib-msg-email {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ib-msg-time {
  font-size: 11px;
  color: var(--text-dim);
  flex-shrink: 0;
  font-feature-settings: 'tnum' 1;
  letter-spacing: 0.02em;
}

.ib-msg-direction {
  display: inline-block;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--gold-soft);
  color: var(--gold);
}

.ib-msg-content {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
}

.ib-msg-body {
  font-size: 14px;
  color: var(--text);
  line-height: 1.65;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.ib-msg-body p { margin: 0 0 12px; }
.ib-msg-body a { color: var(--gold); }

/* Iframe que renderiza HTML do e-mail.
   Agora o conteudo do iframe roda em LIGHT theme (fundo branco, texto
   escuro), igual ao Gmail/Outlook fazem em modo dark: respeita o que o
   remetente projetou em vez de tentar forcar dark e estourar contraste
   quando o e-mail traz `color:#000` inline.
   Pra suavizar o branco dentro do painel escuro, o iframe vira um card:
   bg branco, cantos arredondados e sombra discreta. */
.ib-msg-iframe {
  width: 100%;
  border: 0;
  background: #ffffff;
  display: block;
  height: 60px;
  transition: height 0.15s ease-out;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Mensagem outbound (nossa resposta): tinge o cardao em dourado claro. */
.ib-message.is-outbound {
  background: linear-gradient(180deg,
    rgba(201, 162, 79, 0.06) 0%,
    rgba(201, 162, 79, 0.02) 100%);
  border-color: rgba(201, 162, 79, 0.20);
}
.ib-message.is-outbound::before {
  background: linear-gradient(180deg,
    rgba(201, 162, 79, 0.0) 0%,
    rgba(201, 162, 79, 0.55) 40%,
    rgba(201, 162, 79, 0.0) 100%);
}

.ib-msg-attachments {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ib-attach {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 6px;
  font-size: 12px;
  color: var(--text-soft);
  text-decoration: none;
  transition: border-color 0.15s, color 0.15s;
}
.ib-attach:hover { color: var(--gold); border-color: rgba(201, 162, 79, 0.40); }
.ib-attach-size { color: var(--text-dim); font-size: 11px; }

/* ─── CTA bar inferior (substituiu o composer aside) ─────────────
   Mesmo padrao do .sup-reply-cta do app Suporte: barra discreta
   centralizada com botao primario dourado. Resposta abre em modal
   (advanced-editor) e nao mais inline na tela. */
.ib-reply-cta {
  border-top: 1px solid var(--border);
  padding: 16px 32px 22px;
  background: var(--bg-elev);
  flex-shrink: 0;
}
.ib-reply-inner {
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}
.ib-reply-meta {
  font-size: 12.5px;
  color: var(--text-dim);
}
.ib-reply-meta strong { color: var(--text-soft); font-weight: 600; }
.ib-reply-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.ib-reply-open {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  background: var(--gold);
  color: var(--bg);
  border: 0;
  border-radius: 9px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
}
.ib-reply-open:hover { background: #dfb66a; }
.ib-reply-open:disabled { opacity: 0.5; cursor: not-allowed; }

/* Botao secundario: "Resposta rápida" (ghost dourado). Mesmo estilo
   do .sup-reply-quick. */
.ib-reply-quick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  background: rgba(201,162,79,0.10);
  border: 1px solid rgba(201,162,79,0.40);
  color: var(--gold);
  border-radius: 9px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.18s, opacity 0.18s;
}
.ib-reply-quick:hover { background: rgba(201,162,79,0.18); }
.ib-reply-quick:disabled { opacity: 0.5; cursor: not-allowed; }
.ib-reply-status {
  font-size: 12px;
  color: var(--text-dim);
}
.ib-reply-status.is-busy { color: var(--gold); }
.ib-reply-status.is-ok { color: #7dc88a; }
.ib-reply-status.is-err { color: var(--danger); }

/* ─── Mobile: alterna sidebar/reader ───────────────────────────── */

@media (max-width: 880px) {
  .ib-layout.is-reading .ib-sidebar { display: none; }
  .ib-layout:not(.is-reading) .ib-reader { display: none; }
}

/* Empilha messages + composer quando nao tiver largura pra side-by-side. */
@media (max-width: 1200px) {
  .ib-thread-body {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .ib-messages { border-right: 0; border-bottom: 1px solid var(--border); }
  .ib-composer {
    overflow-y: visible;
    border-top: 0;
  }
  .ib-composer-body { min-height: 120px; }
  .ib-resizer { display: none; }
}

/* ─── Scrollbar (sidebar e messages) ───────────────────────────── */

.ib-thread-list::-webkit-scrollbar,
.ib-messages::-webkit-scrollbar { width: 8px; }
.ib-thread-list::-webkit-scrollbar-track,
.ib-messages::-webkit-scrollbar-track { background: transparent; }
.ib-thread-list::-webkit-scrollbar-thumb,
.ib-messages::-webkit-scrollbar-thumb {
  background: rgba(201, 162, 79, 0.20);
  border-radius: 4px;
}
.ib-thread-list::-webkit-scrollbar-thumb:hover,
.ib-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 162, 79, 0.40);
}

/* ═══════════════════════════════════════════════════════════════════
   MINI-MODAL DE CONFIRMACAO (usado pelo Excluir e-mail)
   ═══════════════════════════════════════════════════════════════════ */
.ib-mini-modal {
  position: fixed; inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.18s ease;
}
.ib-mini-modal.is-open { opacity: 1; }

.ib-mini-overlay {
  position: absolute; inset: 0;
  background: rgba(5, 5, 7, 0.72);
  backdrop-filter: blur(4px);
}

.ib-mini-frame {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: #0a0a0b;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 22px 24px 20px;
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  transform: translateY(8px);
  transition: transform 0.18s ease;
}
.ib-mini-modal.is-open .ib-mini-frame { transform: translateY(0); }

.ib-mini-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.ib-mini-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.012em;
  color: #ededeb;
}
.ib-mini-close {
  background: transparent; border: 0;
  width: 28px; height: 28px;
  border-radius: 6px;
  display: grid; place-items: center;
  color: rgba(237, 237, 235, 0.48);
  cursor: pointer;
}
.ib-mini-close:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #ededeb;
}

.ib-mini-text {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(237, 237, 235, 0.72);
  margin-bottom: 14px;
}
.ib-mini-text strong { color: #ededeb; }

/* Textarea do mini-modal (resposta rápida). Mesmo padrao do
   .sup-mini-textarea: ocupa a largura cheia, altura confortavel pra
   escrever 5-10 linhas, foco com borda dourada. */
.ib-mini-textarea {
  width: 100%;
  min-height: 160px;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
}
.ib-mini-textarea:focus { border-color: rgba(201, 162, 79, 0.45); }
.ib-mini-textarea:disabled { opacity: 0.6; cursor: progress; }

.ib-mini-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}
.ib-mini-cancel {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(237, 237, 235, 0.72);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.ib-mini-cancel:hover {
  border-color: rgba(255, 255, 255, 0.20);
  color: #ededeb;
}
.ib-mini-confirm {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s;
}
.ib-mini-confirm.is-danger {
  background: #d97c7c;
  color: #fff;
}
.ib-mini-confirm.is-danger:hover { background: #e08f80; }
.ib-mini-confirm:disabled { opacity: 0.5; cursor: not-allowed; }

/* ─── Checkbox de seleção em massa ──────────────────────────────────
   Coluna fixa de 28px no grid do .ib-thread-row. O alvo de clique inclui
   a label inteira pra ser confortável tocar no mobile. O input fica com
   accent-color dourado pra combinar com o tema. */
.ib-thread-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  margin-top: -2px;
  cursor: pointer;
}
.ib-thread-check input {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--gold);
  /* Resetando appearance evita o checkbox cinza padrão do Chrome em
     fundo escuro. accent-color cobre Firefox/Chromium modernos; o
     fallback custom abaixo cuida do resto. */
}
.ib-thread-main { min-width: 0; }

/* ─── Barra de ações em massa ───────────────────────────────────────
   Aparece entre as tabs e a lista quando há ≥1 thread selecionada.
   Sticky pra continuar visível enquanto o usuário rola a lista. Os
   botões são injetados por JS de acordo com a aba ativa. */
.ib-bulkbar {
  /* flex-wrap permite que a linha quebre quando a sidebar é estreita
     demais para selall + ações + cancelar caberem juntos (caso comum:
     "Marcar como lida" + "Arquivar" + "Lixeira" colidiam com o contador
     em larguras < ~460px). Com wrap, o contador fica no topo e as ações
     descem pra segunda linha sem sobreposição. */
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(201, 162, 79, 0.08);
  border-top: 1px solid rgba(201, 162, 79, 0.18);
  border-bottom: 1px solid rgba(201, 162, 79, 0.18);
  position: sticky;
  top: 0;
  z-index: 5;
  font-size: 13px;
}
.ib-bulkbar[hidden] { display: none; }

.ib-bulkbar-selall {
  /* flex:0 0 auto fixa no tamanho do conteúdo. margin-right:auto empurra
     ações + cancelar pra direita quando há espaço, e cai naturalmente
     quando flex-wrap quebra a linha. */
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  flex: 0 0 auto;
  margin-right: auto;
}
.ib-bulkbar-selall input {
  width: 15px;
  height: 15px;
  accent-color: var(--gold);
  cursor: pointer;
}
.ib-bulkbar-count {
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ib-bulkbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ib-bulkbar-btn {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  white-space: nowrap;
}
.ib-bulkbar-btn:hover {
  background: rgba(201, 162, 79, 0.14);
  border-color: rgba(201, 162, 79, 0.4);
}
.ib-bulkbar-btn.is-danger {
  color: #e08f80;
  border-color: rgba(217, 124, 124, 0.3);
}
.ib-bulkbar-btn.is-danger:hover {
  background: rgba(217, 124, 124, 0.14);
  border-color: rgba(217, 124, 124, 0.55);
  color: #f1a59a;
}
.ib-bulkbar-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ib-bulkbar-cancel {
  background: transparent;
  border: 1px solid transparent;
  color: rgba(237, 237, 235, 0.6);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.ib-bulkbar-cancel:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

/* No mobile a bulkbar respira menos: padding menor e botões podem
   empilhar. Mantém usável em telas estreitas. */
@media (max-width: 720px) {
  .ib-bulkbar {
    padding: 8px 12px;
    gap: 8px;
  }
  .ib-bulkbar-btn {
    padding: 6px 10px;
    font-size: 11.5px;
  }
}

/* ─── Barra da Lixeira ────────────────────────────────────────────
   Aparece só quando a aba "Lixeira" está ativa. Mostra o botão de
   esvaziar a lixeira inteira, a retenção atual (X dias) e um gear pra
   abrir as configurações. */
.ib-trash-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(217, 124, 124, 0.07);
  border-top: 1px solid rgba(217, 124, 124, 0.20);
  border-bottom: 1px solid rgba(217, 124, 124, 0.20);
  font-size: 12.5px;
}
.ib-trash-bar[hidden] { display: none; }

.ib-trash-empty {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(217, 124, 124, 0.10);
  color: #e2868c;
  border: 1px solid rgba(217, 124, 124, 0.45);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.ib-trash-empty:hover {
  background: rgba(217, 124, 124, 0.20);
  border-color: rgba(217, 124, 124, 0.65);
  color: #f0a3a3;
}
.ib-trash-empty:disabled { opacity: 0.5; cursor: not-allowed; }

.ib-trash-retention {
  flex: 1;
  color: rgba(237, 237, 235, 0.62);
  font-size: 11.5px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ib-trash-settings {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(237, 237, 235, 0.62);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  flex-shrink: 0;
}
.ib-trash-settings:hover {
  background: rgba(201, 162, 79, 0.10);
  border-color: rgba(201, 162, 79, 0.40);
  color: var(--gold);
}

/* Campo "Dias de retenção" no modal de settings. */
.ib-settings-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 14px 0 4px;
  font-size: 13px;
  color: var(--text);
}
.ib-settings-field input {
  width: 90px;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}
.ib-settings-field input:focus {
  outline: none;
  border-color: rgba(201, 162, 79, 0.55);
  background: rgba(201, 162, 79, 0.05);
}
.ib-mini-hint {
  font-size: 11.5px;
  color: rgba(237, 237, 235, 0.5);
  margin: 0 0 14px;
}

/* Variante do botão de confirmação do mini-modal para ações não
   destrutivas (Salvar configuração). */
.ib-mini-confirm.ib-mini-confirm-primary {
  background: linear-gradient(135deg, rgba(201, 162, 79, 0.22), rgba(201, 162, 79, 0.12));
  border: 1px solid rgba(201, 162, 79, 0.55);
  color: var(--gold);
}
.ib-mini-confirm.ib-mini-confirm-primary:hover {
  background: linear-gradient(135deg, rgba(201, 162, 79, 0.35), rgba(201, 162, 79, 0.22));
  border-color: rgba(201, 162, 79, 0.85);
  color: #e0bd6e;
}

/* ═══════════════════════════════════════════════════════════════════
   v2: rail de pastas, composer, organizacao, toasts, popover, skeleton
   =================================================================== */

/* ─── Rail de pastas (coluna 1) ─────────────────────────────────── */
.ib-rail {
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: #0d0d10;
  padding: 16px 12px 12px;
  overflow-y: auto;
  min-height: 0;
  gap: 4px;
}
.ib-compose-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 11px 14px;
  margin-bottom: 14px;
  border: 1px solid rgba(201, 162, 79, 0.55);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(201, 162, 79, 0.22), rgba(201, 162, 79, 0.10));
  color: var(--gold);
  font: inherit;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.ib-compose-btn:hover {
  background: linear-gradient(135deg, rgba(201, 162, 79, 0.34), rgba(201, 162, 79, 0.18));
  border-color: rgba(201, 162, 79, 0.85);
}
.ib-compose-btn:active { transform: translateY(1px); }

.ib-rail-folders { display: flex; flex-direction: column; gap: 2px; }
.ib-rail-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s, color 0.12s;
}
.ib-rail-item svg { flex-shrink: 0; color: var(--text-dim); transition: color 0.12s; }
.ib-rail-item:hover { background: var(--bg-elev); color: var(--text); }
.ib-rail-item:hover svg { color: var(--text-soft); }
.ib-rail-item.is-active {
  background: var(--gold-soft);
  color: var(--gold);
  font-weight: 700;
}
.ib-rail-item.is-active svg { color: var(--gold); }
.ib-rail-label {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ib-rail-badge {
  flex-shrink: 0;
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--bg-elev-2);
  color: var(--text-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.ib-rail-badge.is-unread {
  background: var(--gold);
  color: #1a1206;
}

.ib-rail-section { margin-top: 16px; }
.ib-rail-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  margin-bottom: 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.ib-label-add {
  display: inline-flex;
  border: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 5px;
}
.ib-label-add:hover { color: var(--gold); background: var(--bg-elev); }
.ib-rail-labels { display: flex; flex-direction: column; gap: 2px; }
.ib-rail-empty-labels {
  padding: 4px 10px;
  font-size: 11.5px;
  color: var(--text-dim);
  margin: 0;
}
.ib-label-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}
.ib-rail-foot { margin-top: auto; padding-top: 10px; }
.ib-rail-settings {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.ib-rail-settings:hover { background: var(--bg-elev); color: var(--text); }

/* botao de hamburguer (so mobile/tablet) */
.ib-sidebar-titlebar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.ib-rail-toggle {
  display: none;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  cursor: pointer;
  padding: 2px;
}
.ib-folder-title {
  font-size: 16px;
  font-weight: 800;
  margin: 0;
  color: var(--text);
}

/* search clear */
.ib-search { display: flex; }
.ib-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 5px;
}
.ib-search-clear:hover { color: var(--text); background: var(--bg-elev-2); }

/* ─── Agrupamento por data ──────────────────────────────────────── */
.ib-date-group {
  padding: 10px 18px 4px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 1;
}

/* ─── Marcadores na linha (estrela/snooze/labels) ───────────────── */
.ib-row-star { color: var(--gold); font-size: 12px; margin-right: 2px; }
.ib-row-snooze { font-size: 11px; margin-right: 2px; opacity: 0.8; }
.ib-thread-snippet .ib-label-dot { margin-right: 4px; vertical-align: middle; }

/* ─── Acoes da thread (icones) ──────────────────────────────────── */
.ib-action.ib-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border-2);
  border-radius: 8px;
  background: var(--bg-elev);
  color: var(--text-soft);
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.ib-action.ib-icon:hover { background: var(--bg-elev-2); color: var(--text); border-color: var(--border-2); }
.ib-action.ib-icon.ib-action-danger:hover { color: var(--danger); border-color: rgba(217, 124, 106, 0.4); }
.ib-action.ib-icon#ib-star.is-on { color: var(--gold); border-color: rgba(201, 162, 79, 0.5); background: var(--gold-soft); }
.ib-action.ib-icon#ib-star.is-on svg { fill: var(--gold); }

/* menu "mais" */
.ib-more-wrap { position: relative; }
.ib-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 220px;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  padding: 6px;
  z-index: 40;
}
.ib-more-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}
.ib-more-menu button:hover { background: var(--bg-elev-2); color: var(--text); }
.ib-more-menu button.is-danger { color: var(--danger); }
.ib-more-sep { height: 1px; background: var(--border); margin: 5px 4px; }

/* chips de label na thread aberta */
.ib-thread-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ib-thread-label-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid var(--border-2);
  border-radius: 20px;
  font-size: 11px;
  color: var(--text-soft);
}
.ib-thread-label-chip button {
  border: 0; background: transparent; color: var(--text-dim);
  cursor: pointer; font-size: 14px; line-height: 1; padding: 0 0 0 2px;
}
.ib-thread-label-chip button:hover { color: var(--danger); }

/* ─── Rascunhos: botao de excluir na linha ──────────────────────── */
.ib-draft-row { position: relative; }
.ib-draft-del {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  opacity: 0;
  transition: opacity 0.12s, color 0.12s;
}
.ib-thread-row:hover .ib-draft-del { opacity: 1; }
.ib-draft-del:hover { color: var(--danger); background: var(--bg-elev-2); }

/* ─── Skeleton de loading ───────────────────────────────────────── */
.ib-skel-row { padding: 12px 18px; border-bottom: 1px solid var(--border); }
.ib-skel-line {
  height: 9px;
  border-radius: 5px;
  margin-bottom: 7px;
  background: linear-gradient(90deg, var(--bg-elev) 25%, var(--bg-elev-2) 37%, var(--bg-elev) 63%);
  background-size: 400% 100%;
  animation: ib-shimmer 1.3s ease infinite;
}
.ib-skel-line.w40 { width: 40%; } .ib-skel-line.w60 { width: 60%; } .ib-skel-line.w90 { width: 90%; }
@keyframes ib-shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ─── Composer unificado ────────────────────────────────────────── */
.ib-composer-modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.18s;
}
.ib-composer-modal.is-open { opacity: 1; }
.ib-composer-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(2px); }
.ib-composer-frame {
  position: relative;
  width: min(760px, 94vw);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elev);
  border: 1px solid var(--border-2);
  border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  transform: translateY(10px);
  transition: transform 0.18s;
  overflow: hidden;
}
.ib-composer-modal.is-open .ib-composer-frame { transform: translateY(0); }
.ib-composer-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.ib-composer-title { font-size: 15px; font-weight: 700; margin: 0; color: var(--text); flex: 1; }
.ib-composer-savestate { font-size: 11.5px; color: var(--text-dim); }
.ib-composer-close { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; padding: 4px; }
.ib-composer-close:hover { color: var(--text); }

.ib-composer-fields { padding: 6px 18px 0; }
.ib-cf-row {
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
}
.ib-cf-label { width: 54px; flex-shrink: 0; font-size: 12px; color: var(--text-dim); }
.ib-cf-input, .ib-cf-from {
  flex: 1; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 13.5px; outline: none;
}
.ib-cf-from { cursor: pointer; }
.ib-cf-from option { background: var(--bg-elev); color: var(--text); }
.ib-cf-cctoggle {
  border: 0; background: transparent; color: var(--text-dim);
  cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; padding: 2px 6px;
}
.ib-cf-cctoggle:hover { color: var(--gold); }

.ib-composer-toolbar {
  display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
}
.ib-composer-toolbar button {
  min-width: 30px; height: 28px; padding: 0 8px;
  border: 0; border-radius: 6px; background: transparent;
  color: var(--text-soft); font: inherit; font-size: 13px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 5px;
}
.ib-composer-toolbar button:hover { background: var(--bg-elev-2); color: var(--text); }
.ib-composer-toolbar-sep { width: 1px; height: 18px; background: var(--border-2); margin: 0 6px; }

.ib-composer-body {
  flex: 1; min-height: 200px; max-height: 44vh; overflow-y: auto;
  padding: 16px 18px; color: var(--text); font-size: 14px; line-height: 1.6; outline: none;
}
.ib-composer-body:empty::before { content: attr(data-placeholder); color: var(--text-dim); }
.ib-composer-body a { color: var(--gold); }

.ib-composer-attachments { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 18px; }
.ib-composer-attachments:not(:empty) { padding: 10px 18px; border-top: 1px solid var(--border); }
.ib-cf-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 8px; border: 1px solid var(--border-2); border-radius: 8px;
  background: var(--bg-elev-2); font-size: 12px; color: var(--text-soft);
}
.ib-cf-chip-size { color: var(--text-dim); font-size: 11px; }
.ib-cf-chip button { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; font-size: 15px; line-height: 1; }
.ib-cf-chip button:hover { color: var(--danger); }

.ib-composer-foot {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.ib-cf-send {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 18px; border: 1px solid rgba(201, 162, 79, 0.55); border-radius: 9px;
  background: linear-gradient(135deg, rgba(201, 162, 79, 0.24), rgba(201, 162, 79, 0.12));
  color: var(--gold); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.ib-cf-send:hover { background: linear-gradient(135deg, rgba(201, 162, 79, 0.38), rgba(201, 162, 79, 0.2)); }
.ib-cf-send:disabled { opacity: 0.5; cursor: default; }
.ib-cf-savedraft, .ib-cf-discard {
  border: 1px solid var(--border-2); border-radius: 8px; background: var(--bg-elev);
  color: var(--text-soft); font: inherit; font-size: 12.5px; padding: 8px 14px; cursor: pointer;
}
.ib-cf-savedraft:hover { color: var(--text); border-color: var(--border-2); }
.ib-cf-discard { margin-left: auto; }
.ib-cf-discard:hover { color: var(--danger); border-color: rgba(217, 124, 106, 0.4); }
.ib-cf-status { font-size: 12px; color: var(--text-dim); }

/* ─── Configuracoes (assinatura + blocklist) ────────────────────── */
.ib-settings-frame { width: min(520px, 94vw); max-height: 90vh; overflow-y: auto; }
.ib-settings-section { margin-bottom: 18px; }
.ib-settings-section h4 {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 8px;
}
.ib-settings-textarea {
  width: 100%; min-height: 90px; resize: vertical;
  background: var(--bg); border: 1px solid var(--border-2); border-radius: 8px;
  color: var(--text); font: inherit; font-size: 13px; padding: 10px 12px; outline: none;
}
.ib-settings-textarea:focus { border-color: rgba(201, 162, 79, 0.55); }
.ib-blocklist { display: flex; flex-direction: column; gap: 6px; }
.ib-block-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 12.5px;
}
.ib-block-row button {
  border: 0; background: transparent; color: var(--gold); cursor: pointer; font: inherit; font-size: 12px; font-weight: 600;
}
.ib-block-row button:hover { text-decoration: underline; }

/* ─── Popover (snooze/labels) ───────────────────────────────────── */
.ib-popover {
  position: fixed; z-index: 210; min-width: 200px;
  background: var(--bg-elev); border: 1px solid var(--border-2); border-radius: 10px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.55); padding: 6px;
  opacity: 0; transform: translateY(-4px); transition: opacity 0.12s, transform 0.12s;
}
.ib-popover.is-open { opacity: 1; transform: translateY(0); }
.ib-pop-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-soft); font: inherit; font-size: 13px; cursor: pointer; text-align: left;
}
.ib-pop-item:hover { background: var(--bg-elev-2); color: var(--text); }
.ib-pop-item.is-danger { color: var(--danger); }
.ib-pop-check { width: 14px; flex-shrink: 0; color: var(--gold); font-size: 12px; }

/* ─── Toasts ────────────────────────────────────────────────────── */
.ib-toasts {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.ib-toast {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 10px;
  background: var(--bg-elev-2); border: 1px solid var(--border-2);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); color: var(--text);
  font-size: 13px; pointer-events: auto;
  opacity: 0; transform: translateY(10px); transition: opacity 0.2s, transform 0.2s;
  max-width: 90vw;
}
.ib-toast.is-in { opacity: 1; transform: translateY(0); }
.ib-toast.is-ok { border-color: rgba(127, 192, 138, 0.4); }
.ib-toast.is-err { border-color: rgba(217, 124, 106, 0.5); }
.ib-toast-action {
  border: 0; background: transparent; color: var(--gold); cursor: pointer;
  font: inherit; font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.ib-toast-action:hover { text-decoration: underline; }

/* ─── Responsivo do rail ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .ib-rail {
    position: absolute; top: 0; bottom: 0; left: 0; width: 250px; z-index: 60;
    transform: translateX(-100%); transition: transform 0.2s;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.45);
  }
  .ib-layout.rail-open .ib-rail { transform: translateX(0); }
  .ib-layout.rail-open::after {
    content: ''; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); z-index: 55;
  }
  .ib-rail-toggle { display: inline-flex; }
}
