/* ════════════════════════════════════════════════════════════════════════
   Thamyris Imóveis — Painel
   Identidade WhatsApp: teal-escuro de marca (sidebar/ações) + verde-vivo
   como realce (presença/conexão). Superfícies brancas, tabelas densas legíveis.
   Layout: sidebar vertical fixa à esquerda + área de conteúdo à direita.
   Inter em todos os papéis (display = Inter 700 tight; aposenta Fraunces aqui).
   ════════════════════════════════════════════════════════════════════════ */

:root {
  /* Marca — identidade WhatsApp */
  --brand-deep: #075E54;      /* teal escuro: sidebar (âncora de marca) */
  --brand: #128C7E;           /* teal médio: ações, foco, item ativo (texto branco AA) */
  --brand-accent: #25D366;    /* verde-vivo: SÓ realces (dot conectado, indicador ativo) */
  --brand-soft: rgba(18, 140, 126, 0.10);  /* fundo suave de hover/seleção */

  /* Superfícies claras */
  --bg: #F4F7F6;              /* fundo geral (branco com toque verde frio) */
  --surface: #FFFFFF;         /* cards/inputs */
  --surface-soft: #F6F8F7;    /* th, zebra, log */
  --border: #E7ECEA;
  --border-strong: #D6DEDB;

  /* Texto */
  --text: #0F1F1C;            /* quase-preto esverdeado */
  --text-secondary: #4A5A56;
  --muted: #6B7A75;
  --on-brand: #EAF6F2;        /* texto sobre superfícies de marca (sidebar/botão) */
  --on-brand-dim: rgba(234, 246, 242, 0.62);

  /* Estados (badges/funil) */
  --destructive: #C0392B;
  --red: #C0392B;
  --indigo: #5A5FC7;
  --amber: #B8862B;
  --amber-bright: #9A7B1E;
  --positive: #0E7C5A;        /* verde positivo alinhado à marca */
  --success: #0E7C5A;
  --green: #0E7C5A;
  --warn: #B8862B;
  --danger: #C0392B;

  --radius: 10px;
  --radius-card: 14px;
  --font: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Inter', system-ui, sans-serif;
  --transition: 0.15s ease;
  --sidebar-w: 248px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: light; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--brand-deep); }

/* ── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--surface-soft); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #9fb0ab; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) var(--surface-soft); }

/* ── Layout: sidebar + conteúdo ───────────────────────────────────────────── */
#app { display: flex; flex-direction: row; min-height: 100vh; }

/* header re-estilizado como SIDEBAR vertical (tags header/nav preservadas p/ o JS) */
header {
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--brand-deep);
  color: var(--on-brand);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  gap: 4px;
  z-index: 50;
}

header h1 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #FFFFFF;
  padding: 4px 10px 2px;
  order: 1;
}
header .header-descriptor {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--on-brand-dim);
  padding: 0 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
  margin-bottom: 10px;
  order: 2;
}

/* Nav empilhada (itens verticais, ícone + label) */
nav { display: flex; flex-direction: column; gap: 2px; order: 3; }
nav button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px 10px 14px;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  background: transparent;
  color: var(--on-brand-dim);
  transition: background var(--transition), color var(--transition);
}
nav button svg { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; opacity: 0.9; }
nav button:hover { background: rgba(255,255,255,0.07); color: #FFFFFF; }
nav button.active {
  background: rgba(255,255,255,0.12);
  color: #FFFFFF;
  font-weight: 600;
}
nav button.active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 20px;
  border-radius: 0 3px 3px 0;
  background: var(--brand-accent);
}
nav button.active svg { opacity: 1; stroke: var(--brand-accent); }

/* Rodapé da sidebar (status + user + sair empurrados p/ baixo) */
#badge-status {
  order: 4;
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--on-brand-dim);
}
#badge-status::before {
  content: "";
  width: 9px; height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
  background: rgba(234,246,242,0.4);
  transition: background var(--transition), box-shadow var(--transition);
}
#badge-status::after { content: "verificando…"; }
#badge-status.connected::before {
  background: var(--brand-accent);
  box-shadow: 0 0 0 3px rgba(37,211,102,0.28);
  animation: pulse-presence 2.4s ease-in-out infinite;
}
#badge-status.connected::after { content: "conectado"; }
#badge-status.qr_needed::before { background: var(--amber); box-shadow: 0 0 0 3px rgba(184,134,43,0.28); }
#badge-status.qr_needed::after { content: "escaneie o QR"; }
#badge-status.disconnected::before { background: var(--destructive); box-shadow: 0 0 0 3px rgba(192,57,43,0.28); }
#badge-status.disconnected::after { content: "desconectado"; }

@keyframes pulse-presence {
  0%, 100% { box-shadow: 0 0 0 3px rgba(37,211,102,0.28); }
  50% { box-shadow: 0 0 0 6px rgba(37,211,102,0.06); }
}

#user-indicator {
  order: 5;
  font-size: 12px;
  font-weight: 600;
  color: var(--on-brand) !important;
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-sair {
  order: 6;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--on-brand);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 12px;
  margin-top: 6px;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  transition: background var(--transition);
}
.btn-sair:hover { background: rgba(255,255,255,0.13); }

/* Área de conteúdo */
main { flex: 1; min-width: 0; padding: 32px 36px; }

/* ── Tabs ───────────────────────────────────────────────────────────────── */
.tab { display: none; }
.tab.active { display: block; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ── Cards ──────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15,31,28,0.04), 0 8px 24px rgba(15,31,28,0.05);
}
.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
}
.card-header h2 { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.card-header .hint { font-size: 12px; color: var(--muted); }
.ml-auto { margin-left: auto; }

/* Wrapper de tabela p/ scroll horizontal no mobile (não estoura o layout) */
.table-wrap { width: 100%; overflow-x: auto; }

/* ── Tabelas ────────────────────────────────────────────────────────────── */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 24px; text-align: left; border-bottom: 1px solid var(--border); }
th {
  font-family: var(--font);
  font-weight: 600;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--surface-soft);
  white-space: nowrap;
}
td { color: var(--text-secondary); font-size: 13px; font-variant-numeric: tabular-nums; }
td:first-child { color: var(--text); font-weight: 500; }
td.cell-editavel { cursor: text; }
td.cell-editavel:hover { background: var(--brand-soft); box-shadow: inset 0 0 0 1px rgba(18,140,126,0.30); }
td.cell-editavel input { padding: 5px 8px; font-size: 13px; min-width: 140px; }
tbody tr:nth-child(even) td { background: rgba(15,31,28,0.015); }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover td { background: var(--brand-soft); }

/* ── Badges ─────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* verde/positivo — ativo, fechamento, entrega_chaves, pos_venda, realizada, enviado */
.badge.ativo, .badge.fechamento, .badge.entrega_chaves, .badge.pos_venda, .badge.realizada, .badge.enviado {
  background: rgba(14, 124, 90, 0.12);
  color: var(--positive);
  border-color: rgba(14, 124, 90, 0.32);
}

/* indigo/progresso — vendido, visita_agendada, imoveis_enviados, documentacao, confirmada */
.badge.vendido, .badge.visita_agendada, .badge.imoveis_enviados, .badge.documentacao, .badge.confirmada {
  background: rgba(90, 95, 199, 0.12);
  color: var(--indigo);
  border-color: rgba(90, 95, 199, 0.32);
}

/* âmbar/em-andamento — perfil_mapeado, primeiro_contato, desatualizado, agendada, bloqueado */
.badge.perfil_mapeado, .badge.primeiro_contato, .badge.desatualizado, .badge.agendada, .badge.bloqueado {
  background: rgba(184, 134, 43, 0.13);
  color: var(--amber);
  border-color: rgba(184, 134, 43, 0.32);
}

/* âmbar-bright/destaque — proposta */
.badge.proposta {
  background: rgba(154, 123, 30, 0.13);
  color: var(--amber-bright);
  border-color: rgba(154, 123, 30, 0.35);
}

/* vermelho/negativo — perdido, no_show, falhou */
.badge.perdido, .badge.no_show, .badge.falhou {
  background: rgba(192, 57, 43, 0.12);
  color: var(--destructive);
  border-color: rgba(192, 57, 43, 0.32);
}

/* muted/neutro — inativo, novo_lead, cancelada */
.badge.inativo, .badge.novo_lead, .badge.cancelada {
  background: rgba(107, 122, 117, 0.10);
  color: var(--muted);
  border-color: rgba(107, 122, 117, 0.28);
}

/* ── Botões ─────────────────────────────────────────────────────────────── */
.btn {
  padding: 9px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface);
  color: var(--text);
  transition: background var(--transition), border-color var(--transition), color var(--transition), transform var(--transition);
}
.btn:hover { background: var(--surface-soft); border-color: #c4d0cc; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #FFFFFF;
  font-weight: 600;
}
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }

.btn-danger {
  background: transparent;
  border-color: rgba(192, 57, 43, 0.45);
  color: var(--destructive);
}
.btn-danger:hover { background: rgba(192, 57, 43, 0.10); border-color: var(--destructive); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ── Formulários ────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}
label .req { color: var(--destructive); }

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--transition), box-shadow var(--transition);
}
textarea { resize: vertical; min-height: 72px; }
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(18, 140, 126, 0.18);
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7A75' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  flex-shrink: 0;
  accent-color: var(--brand);
  cursor: pointer;
}
.checkbox-row span {
  font-size: 12.5px;
  font-weight: 400;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0;
  line-height: 1.5;
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ── Modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 30, 27, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-backdrop.open { display: flex; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 0;
  min-width: 360px;
  max-width: 540px;
  width: 100%;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(7, 30, 27, 0.22);
  animation: modalIn 0.18s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.modal-header h3 { font-family: var(--font-display); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; }
.modal-close {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: color var(--transition), background var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--surface-soft); }

.modal form { padding: 20px 22px; }
.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ── Toast ──────────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--brand-deep);
  border: 1px solid var(--brand);
  color: #FFFFFF;
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(7, 30, 27, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  z-index: 200;
}
#toast.show { opacity: 1; transform: none; }

/* ── Login (USER-01) ───────────────────────────────────────────────────── */
.login-error {
  color: var(--destructive);
  font-size: 14px;
  margin-top: 8px;
  min-height: 1px;
}
.login-error:not(:empty) {
  padding: 8px 10px;
  background: rgba(192, 57, 43, 0.08);
  border: 1px solid rgba(192, 57, 43, 0.35);
  border-radius: var(--radius);
}

/* ── Badges semânticos: Usuários (USER-02) ─────────────────────────────── */
.badge.papel-admin {
  background: rgba(90, 95, 199, 0.12);
  color: var(--indigo);
  border-color: rgba(90, 95, 199, 0.32);
}
.badge.papel-membro {
  background: rgba(107, 122, 117, 0.10);
  color: var(--muted);
  border-color: rgba(107, 122, 117, 0.28);
}
.badge.user-ativo {
  background: rgba(14, 124, 90, 0.12);
  color: var(--positive);
  border-color: rgba(14, 124, 90, 0.32);
}
.badge.user-pendente {
  background: rgba(184, 134, 43, 0.13);
  color: var(--amber);
  border-color: rgba(184, 134, 43, 0.32);
}
.badge.user-desativado {
  background: rgba(192, 57, 43, 0.12);
  color: var(--destructive);
  border-color: rgba(192, 57, 43, 0.32);
}

/* ── Operação (log de disparos) ─────────────────────────────────────────── */
#log-disparos {
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
}
.log-entry {
  padding: 8px 24px;
  border-bottom: 1px solid rgba(231, 236, 234, 0.8);
  font-size: 14px;
  font-family: var(--font);
  color: var(--muted);
  line-height: 1.6;
}
.log-entry:last-child { border-bottom: none; }
.log-entry.enviado { color: var(--positive); }
.log-entry.bloqueado { color: var(--amber); }
.log-entry.falhou { color: var(--destructive); }
.log-entry.entrada { color: var(--text); }
.log-entry.saida { color: var(--brand); }

/* ── Inbox de conversas (2 colunas) ─────────────────────────────────────── */
.inbox { display: flex; flex-direction: column; height: calc(100vh - 64px); }

.inbox-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.inbox-filters { display: flex; gap: 6px; }
.conv-filtro {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.conv-filtro:hover { background: var(--surface-soft); }
.conv-filtro.active { background: var(--brand); border-color: var(--brand); color: #FFFFFF; }
.conv-count {
  background: rgba(255,255,255,0.25);
  color: inherit;
  border-radius: 999px;
  padding: 0 7px;
  font-size: 11px;
  line-height: 18px;
  min-width: 18px;
  text-align: center;
}
.conv-filtro:not(.active) .conv-count { background: var(--brand-soft); color: var(--brand); }

.inbox-search {
  position: relative;
  margin-left: auto;
  display: flex;
  align-items: center;
  min-width: 220px;
}
.inbox-search svg { position: absolute; left: 11px; width: 16px; height: 16px; stroke: var(--muted); pointer-events: none; }
.inbox-search input { padding-left: 34px; }

.inbox-body { display: flex; flex: 1; min-height: 0; }

/* Coluna esquerda: lista */
.inbox-list {
  width: 340px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  background: var(--surface);
}
.inbox-list-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }

.conv-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  position: relative;
  transition: background var(--transition);
}
.conv-item:hover { background: var(--surface-soft); }
.conv-item.active { background: var(--brand-soft); }
.conv-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--brand-accent);
}
.conv-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.conv-item.aguardando .conv-avatar { background: rgba(184,134,43,0.16); color: var(--amber); }
.conv-main { min-width: 0; }
.conv-row1 { display: flex; align-items: baseline; gap: 8px; }
.conv-nome { font-weight: 600; color: var(--text); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-quando { margin-left: auto; font-size: 11px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }
.conv-preview { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 3px 0 6px; }
.conv-tags { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.conv-origem {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 7px;
}

/* Coluna direita: detalhe */
.inbox-detail { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.inbox-empty {
  margin: auto;
  text-align: center;
  color: var(--muted);
  padding: 40px;
  max-width: 340px;
}
.inbox-empty svg { width: 56px; height: 56px; stroke: var(--border-strong); margin-bottom: 14px; }
.inbox-empty h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; color: var(--text-secondary); letter-spacing: -0.02em; }
.inbox-empty p { font-size: 13px; margin-top: 4px; }

.inbox-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.inbox-detail-header .conv-avatar { width: 42px; height: 42px; }
.inbox-detail-id .nome { font-weight: 700; font-size: 15px; color: var(--text); }
.inbox-detail-id .sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.inbox-detail-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.inbox-back { display: none; }

.inbox-thread {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.inbox-thread-note {
  margin: auto;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  max-width: 360px;
  line-height: 1.6;
}
.inbox-thread-note svg { width: 32px; height: 32px; stroke: var(--border-strong); margin-bottom: 8px; }

.inbox-composer {
  display: flex;
  gap: 10px;
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.inbox-composer input {
  flex: 1;
  background: var(--surface-soft);
}
.inbox-composer input:disabled, .btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  #app { flex-direction: column; }
  header {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 14px;
    gap: 8px;
  }
  header h1 { order: 1; padding: 0 4px; font-size: 15px; }
  header .header-descriptor { display: none; }
  nav {
    order: 4;
    flex-direction: row;
    flex-wrap: nowrap;
    width: 100%;
    gap: 4px;
    overflow-x: auto;
    padding-bottom: 2px;
  }
  nav button { width: auto; white-space: nowrap; padding: 8px 12px; }
  nav button.active::before {
    left: 12px; right: 12px; top: auto; bottom: 0;
    transform: none;
    width: auto; height: 3px;
    border-radius: 3px 3px 0 0;
  }
  #badge-status { order: 2; margin-top: 0; margin-left: auto; padding: 4px 8px; }
  #user-indicator { order: 3; padding: 4px 8px; }
  .btn-sair { order: 3; margin-top: 0; padding: 7px 12px; }
  main { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }

  /* Inbox: 1 coluna. A lista ocupa a largura; ao abrir uma conversa,
     o detalhe cobre a lista (classe .detail-open no .inbox-body). */
  .inbox { height: auto; min-height: calc(100vh - 120px); }
  .inbox-toolbar { flex-wrap: wrap; }
  .inbox-search { order: 3; width: 100%; min-width: 0; margin-left: 0; }
  .inbox-body { flex-direction: column; }
  .inbox-list { width: 100%; border-right: none; }
  .inbox-detail { display: none; }
  .inbox-body.detail-open .inbox-list { display: none; }
  .inbox-body.detail-open .inbox-detail { display: flex; }
  .inbox-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--brand);
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    margin-right: 4px;
  }
}

@media (max-width: 480px) {
  .form-row { grid-template-columns: 1fr; }
  #user-indicator { display: none; }
}

/* ── Acessibilidade ─────────────────────────────────────────────────────── */
:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 2px; }
nav button:focus-visible, .btn:focus-visible { outline-offset: 1px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
