/* Layout limpo do painel (27/10/2026): cabeçalho enxuto, lateral compacta, métricas retráteis, "Uso do plano" na lateral e a caixa de entrada em destaque.
   Carregado por último: só reorganiza e dá acabamento; nenhuma regra de negócio mora aqui. Paleta e variáveis são as de styles.css. */

/* ---------- 1) Cabeçalho ---------- */
.app-screen .topbar { margin-bottom: 12px; align-items: center; gap: 14px; }
.app-screen .topbar h1 { font-size: clamp(20px, 2vw, 26px); margin-bottom: 2px; }
.app-screen .topbar #organization-name { margin: 0; }
@media (min-width: 769px) { .app-screen .topbar-actions { max-width: none; flex-wrap: wrap; justify-content: flex-end; } }
.app-screen .topbar-actions { display: flex; align-items: center; gap: 8px; }
.menu-wrap { position: relative; }
.menu-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 70; min-width: 230px; display: flex; flex-direction: column; gap: 2px; padding: 6px; border: 1px solid rgba(182, 218, 197, .22); border-radius: 12px; background: #10241b; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.menu-pop-end { left: auto; right: 0; }
.menu-pop[hidden] { display: none; }
.app-screen .menu-pop .button { width: 100%; justify-content: flex-start; border-color: transparent; background: transparent; border-radius: 8px; padding: 9px 12px; text-align: left; }
.app-screen .menu-pop .button:hover:not(:disabled) { background: rgba(116, 226, 177, .1); border-color: transparent; }
.app-screen .menu-trigger[aria-expanded="true"] { border-color: var(--mint); background: rgba(116, 226, 177, .1); }
.app-screen .menu-trigger.cx-alerta { border-color: #f2c36b; color: #ffe0a1; }
.menu-seta { font-size: 11px; opacity: .8; }
.signed-in-email { display: inline-block; max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; vertical-align: bottom; }
.app-screen .topbar-actions .icon-btn { width: 38px; height: 38px; min-width: 38px; padding: 0; justify-content: center; border-radius: 10px; }
.app-screen .topbar-actions .icon-btn .bico { margin: 0; }
@media (max-width: 768px) {
  .menu-pop { left: 0; right: auto; max-width: calc(100vw - 28px); }
  .menu-pop-end { left: auto; right: 0; }
  .signed-in-email { max-width: 120px; }
}

/* ---------- 2) Lateral: conexões compactas ---------- */
.sidebar .account-chips { scrollbar-width: thin; scrollbar-color: rgba(182, 218, 197, .28) transparent; gap: 4px; }
.sidebar .account-chips::-webkit-scrollbar { width: 4px; height: 4px; }
.sidebar .account-chips::-webkit-scrollbar-track { background: transparent; }
.sidebar .account-chips::-webkit-scrollbar-thumb { background: rgba(182, 218, 197, .28); border-radius: 4px; }
.sidebar .account-chips::-webkit-scrollbar-thumb:hover { background: rgba(116, 226, 177, .5); }
.sidebar { scrollbar-width: thin; scrollbar-color: rgba(182, 218, 197, .28) transparent; }
.sidebar::-webkit-scrollbar { width: 4px; } .sidebar::-webkit-scrollbar-thumb { background: rgba(182, 218, 197, .28); border-radius: 4px; }
.sidebar .account-chips .account-chip { display: flex !important; flex-wrap: nowrap; align-items: center; gap: 8px; padding: 6px 8px !important; min-height: 34px; border-radius: 10px !important; position: relative; font-size: 12px; line-height: 1.25; overflow: hidden; }
.sidebar .account-chip .chan-ico, .sidebar .account-chip .account-avatar { width: 18px; height: 18px; flex: none; }
.sidebar .account-chip .account-filter, .sidebar .account-chip .account-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; text-align: left; font-size: 12px; }
.sidebar .account-chip .account-state { grid-column: auto; flex: none; margin-left: auto; font-size: 0; gap: 0; line-height: 0; }
.sidebar .account-chip .account-state::before { margin: 0; }
/* "Desconectar" só aparece quando a pessoa passa o mouse ou foca no cartão (evita clique sem querer e economiza altura) */
.sidebar .account-chip .account-disconnect { display: none; position: absolute; right: 6px; top: 50%; transform: translateY(-50%); flex-basis: auto; margin: 0; padding: 3px 9px; border: 1px solid rgba(240, 195, 110, .45); border-radius: 8px; background: #10241b; font-size:11px; line-height: 1.2; }
.sidebar .account-chip:hover .account-disconnect, .sidebar .account-chip:focus-within .account-disconnect { display: inline-block; }
@media (hover: none) {
  .sidebar .account-chip .account-disconnect { display: inline-block; position: static; transform: none; margin-left: 6px; }
}
@media (max-width: 768px) { .sidebar .account-chip .account-disconnect { display: inline-block; position: static; transform: none; margin-left: 6px; } }

/* ---------- 3) "Uso do plano" compacto na lateral ---------- */
.usage-card.usage-compact { position: relative; display: grid; gap: 6px; margin: 0 0 10px; padding: 10px 12px; border: 1px solid rgba(182, 218, 197, .2); border-radius: 12px; background: #0f2019; }
.usage-compact .usage-head { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.usage-compact .usage-head h2 { margin: 0; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #9db8a8; }
.usage-compact .usage-month { margin-left: auto; font-size: 11px; color: #7fa38e; }
.usage-compact .usage-numbers { margin: 0; font-size: 17px; font-weight: 800; line-height: 1.2; }
.usage-compact .usage-numbers small { display: block; margin-top: 1px; font-size: 11px; font-weight: 600; color: #9db8a8; }
.usage-compact progress.usage-bar { height: 7px; }
.usage-compact .usage-actions { display: grid; gap: 6px; }
.usage-compact .usage-actions .action-button { width: 100%; justify-content: center; text-align: center; padding: 7px 10px; font-size: 11.5px; min-height: 0; }
.usage-info { position: relative; }
.usage-info > summary { list-style: none; cursor: pointer; width: 20px; height: 20px; border: 1px solid rgba(182, 218, 197, .4); border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #9db8a8; user-select: none; }
.usage-info > summary::-webkit-details-marker { display: none; }
.usage-info > summary:hover, .usage-info[open] > summary { color: var(--mint); border-color: var(--mint); }
.usage-info .usage-pop { position: absolute; left: calc(100% + 18px); bottom: -10px; z-index: 80; width: 300px; display: grid; gap: 8px; padding: 12px 14px; border: 1px solid rgba(182, 218, 197, .25); border-radius: 12px; background: #10241b; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); }
.usage-info .usage-pop p { margin: 0; }
.usage-card.usage-aviso { border-color: #f5c451; } .usage-card.usage-limite { border-color: #ff8a65; }
/* quando o cartão volta para a área principal (celular): faixa simples */
.workspace > .usage-card.usage-compact { margin: 0 0 12px; }
.workspace > .usage-card .usage-info .usage-pop { left: auto; right: 0; bottom: auto; top: calc(100% + 8px); max-width: calc(100vw - 48px); }

/* ---------- 3b) Métricas retráteis ---------- */
.results-card .results-toggle { margin-left: auto; padding: 6px 12px; font-size: 12px; min-height: 0; }
.results-card.collapsed { padding: 10px 16px; margin-bottom: 10px; }
.results-card.collapsed #results-grid { display: none; }
.results-card.collapsed .results-head { align-items: center; }
.results-card.collapsed .results-head h2 { font-size: 14px; }
.results-card.collapsed .results-phrase { margin-top: 2px; font-size: 12px; }
.results-card.collapsed #results-period { display: none; }

/* ---------- 4) Caixa de entrada em destaque ---------- */
.app-screen #filters.stat-grid { gap: 10px; margin-bottom: 12px; }
.app-screen .stat-card { min-height: 0; padding: 10px 14px; }
.app-screen .stat-card strong { font-size: 20px; }
@media (min-width: 769px) {
  .app-screen .inbox-layout { height: max(520px, calc(100dvh - 250px)); min-height: 500px; }
}
.empty-detail { display: grid; place-content: center; justify-items: center; text-align: center; gap: 6px; min-height: 100%; margin: auto; color: #9db8a8; }
.empty-detail .empty-icon { margin: 0 0 6px; line-height: 0; }
.empty-detail .empty-svg { width: 76px; height: 76px; color: var(--mint); opacity: .32; }

.menu-wrap.sem-itens .menu-trigger { pointer-events: none; }
.menu-wrap.sem-itens .menu-seta { display: none; }

/* título e botões na mesma linha no computador */
@media (min-width: 769px) {
  .app-screen .topbar > div:first-child { flex: 0 0 auto; min-width: 0; }
  .app-screen .topbar .eyebrow { white-space: nowrap; font-size:11px; margin-bottom: 4px; }
  .app-screen .topbar h1 { white-space: nowrap; }
  .app-screen .topbar-actions { flex: 1 1 auto; gap: 6px; }
  .app-screen .topbar-actions .button-quiet:not(.icon-btn) { padding: 0 12px; }
}

/* Cabeçalho da lista de conversas (28/10/2026): "Excluir todas" e "Marcar como lidas" na mesma linha, com a mesma altura e sem quebrar o texto; o contador fica à direita. */
.app-screen .panel-heading { flex-wrap: wrap; row-gap: 10px; }
.app-screen .panel-heading > div:first-child { flex: 1 1 100%; }
.app-screen .heading-tools { flex: 1 1 100%; flex-wrap: nowrap; justify-content: flex-start; gap: 8px; }
.app-screen .heading-tools .mark-read { white-space: nowrap; flex: 0 0 auto; min-height: 32px; }
.app-screen .heading-tools .result-count { margin-left: auto; }

/* O mascote do Copiloto fica fixo no canto de baixo e cobria os botões Enviar da resposta (28/10/2026): no computador a área de resposta deixa essa faixa livre. */
@media (min-width: 769px) { .app-screen .reply-box { padding-right: 140px; } }

/* Detalhes da conversa (28/10/2026): avisos de IA pausada, encaminhamento e dossiê ficam recolhidos sob a caixa de resposta; a lista de mensagens ocupa o espaço. */
.app-screen .conv-extras { margin: 0; border-top: 1px solid rgba(182, 218, 197, .18); flex: 0 0 auto; }
.app-screen .conv-extras > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 16px; font-size: 12.5px; font-weight: 650; color: #cfe3d7; list-style: none; }
.app-screen .conv-extras > summary::-webkit-details-marker { display: none; }
.app-screen .conv-extras > summary::after { content: "▾"; margin-left: auto; opacity: .7; transition: transform .15s; }
.app-screen .conv-extras[open] > summary::after { transform: rotate(180deg); }
.app-screen .extras-chip { padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line); font-size: 11px; font-weight: 600; color: #a8c4b4; }
.app-screen .extras-chip-alerta { color: #ffd98a; border-color: rgba(255, 200, 100, .5); background: rgba(255, 200, 100, .08); }
.app-screen .conv-extras-corpo { padding: 0 16px 10px; max-height: 38vh; overflow: auto; }
@media (min-width: 769px) { .app-screen .conv-extras > summary, .app-screen .conv-extras-corpo { padding-right: 140px; } }
.msg-audio { display: block; width: min(320px, 100%); height: 38px; margin: 2px 0 6px; }
.msg-media-link { cursor: pointer; }
.viewer-dialog { width: min(980px, 94vw); height: min(88vh, 900px); padding: 0; border: 1px solid var(--line); border-radius: 12px; background: #0b1714; color: #eaf4ef; }
.viewer-dialog::backdrop { background: rgba(0, 0, 0, .7); }
.viewer-dialog[open] { display: flex; flex-direction: column; }
.viewer-bar { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.viewer-body { flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; background: #0f1f19; }
.viewer-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.msg-audio { min-width: 260px; }
/* Agenda de contatos (28/10/2026) */
.app-screen .contact-consent-line { display: flex; align-items: center; gap: 8px; }
.app-screen .contact-consent-line input { width: auto; }
#contacts-dialog .contact-ok { color: #7fe3b2; }
#contacts-dialog .contact-sem { color: #9ab0a3; }
#contact-search { width: 100%; margin: 0 0 8px; }
#contacts-dialog .contact-consent-line { display: flex; flex-direction: row; align-items: center; gap: 10px; font-weight: 500; }
#contacts-dialog .contact-consent-line input[type="checkbox"] { width: 18px; height: 18px; flex: 0 0 auto; margin: 0; }
/* Botões da linha de resposta (28/10/2026): Gravar áudio, Anexar arquivo e Dossiê com o mesmo tamanho, na mesma linha; o painel de detalhes abre sob a linha. */
.app-screen .media-tools { flex-wrap: wrap; gap: 8px; }
.app-screen .media-tools > .pill-button[data-media="record"], .app-screen .media-tools > .pill-button[data-media="attach"], .app-screen .media-tools > .pill-button[data-extras-toggle] { min-width: 150px; justify-content: center; white-space: nowrap; }
.app-screen .media-tools > .pill-button[data-extras-toggle][aria-expanded="true"] { border-color: var(--mint, #74e2b1); color: var(--mint, #74e2b1); }
.app-screen .extras-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; border-radius: 50%; background: #ffd98a; box-shadow: 0 0 0 2px rgba(255, 217, 138, .25); }
.app-screen .conv-extras[hidden] { display: none; }
.app-screen .conv-extras { border-top: 1px solid rgba(182, 218, 197, .18); }
/* Envio de modelo do WhatsApp (28/10/2026) */
#wa-send-dialog .wa-send-para { font-weight: 700; margin: 0 0 4px; }
#wa-send-dialog .wa-send-regra, #wa-send-dialog .wa-send-info { font-size: 13px; color: #b7cdbf; margin: 6px 0; }
#wa-send-dialog .wa-send-previa { margin: 6px 0 10px; padding: 12px 14px; border-left: 3px solid var(--mint, #74e2b1); background: rgba(116, 226, 177, .07); border-radius: 6px; white-space: pre-wrap; }
#wa-send-dialog select { width: 100%; }
/* Atalho "＋ Contato" no topo da lista de conversas: fica à direita do título, e os botões de ação descem para a linha de baixo. */
.app-screen .panel-heading > div:first-child { flex: 1 1 auto; }
.app-screen .new-contact { margin-left: auto; white-space: nowrap; }
/* Estrutura em seções (28/10/2026): menu de seções na lateral (as ferramentas saíram do topo) e abas na lista de conversas (no lugar dos quatro cartões). */
.app-screen .secoes { display: flex; flex-direction: column; gap: 4px; margin: 18px 0 16px; }
.app-screen .secoes .button { width: 100%; justify-content: flex-start; gap: 10px; min-height: 38px; padding: 0 12px; border-color: transparent; background: transparent; color: #cfe3d7; font-weight: 600; }
.app-screen .secoes .button:hover:not(:disabled) { background: rgba(116, 226, 177, .08); border-color: transparent; color: #eaf4ef; }
.app-screen .secoes .button.secao-ativa { background: rgba(116, 226, 177, .14); color: var(--mint, #74e2b1); }
.app-screen .secoes .button.hidden { display: none; }
.app-screen .abas-status { display: grid !important; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; margin: 0 0 10px; padding: 4px; border-radius: 12px; background: rgba(0, 0, 0, .28); border: 1px solid var(--line); }
.app-screen .abas-status .stat-card { display: flex; align-items: center; justify-content: center; min-height: 0; padding: 7px 4px; border: 0; border-radius: 9px; background: transparent; box-shadow: none; color: #b7cdbf; }
.app-screen .abas-status .stat-card .stat-icon { display: none; }
.app-screen .abas-status .stat-card > div { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.app-screen .abas-status .stat-card p { margin: 0; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-screen .abas-status .stat-card strong { font-size: 11.5px; }
.app-screen .abas-status .stat-card.active { background: rgba(116, 226, 177, .18); color: var(--mint, #74e2b1); }
.app-screen .abas-status .stat-card-highlight:not(.active) strong { color: #ffd98a; }
.app-screen .secoes .bl { font-style: normal; }
.app-screen .abas-status { grid-template-columns: .85fr .8fr 1.35fr 1.1fr; }
.app-screen .abas-status .stat-card p, .app-screen .abas-status .stat-card strong { font-size: 11px; }

/* Celular (28/10/2026): o cabeçalho da lista tem mais botões (☰ Menu, Sair) e precisa quebrar linha; itens do menu de seções com altura de toque. */
@media (max-width: 768px) {
  .app-screen .heading-tools { flex-wrap: wrap; row-gap: 8px; }
  .app-screen .secoes .button { min-height: 44px; }
  .app-screen .new-contact { min-height: 36px; }
  .app-screen .abas-status { margin: 0 14px 10px; }
}

/* ---------- Todas as lojas (04/11/2026) ---------- */
.rede-filtros { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin: 8px 0 14px; }
.rede-filtros label { display: grid; gap: 4px; font-size: 12px; color: #9db8a8; }
.rede-filtros input, .rede-filtros select { min-width: 160px; }
.rede-resumo { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.rede-numero { display: grid; gap: 2px; min-width: 120px; padding: 10px 14px; border: 1px solid rgba(182, 218, 197, .2); border-radius: 12px; background: #0f2019; }
.rede-numero strong { font-size: 22px; line-height: 1.1; }
.rede-numero span { font-size: 12px; color: #9db8a8; }
.rede-lojas { overflow-x: auto; margin: 0 0 16px; }
.rede-tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.rede-tabela th, .rede-tabela td { padding: 8px 10px; text-align: left; border-bottom: 1px solid rgba(182, 218, 197, .14); white-space: nowrap; }
.rede-tabela th { font-size: 11px; font-weight: 700; color: #9db8a8; text-transform: uppercase; letter-spacing: .04em; }
.rede-link { border: 0; background: none; padding: 0; color: var(--mint, #74e2b1); font: inherit; font-weight: 700; cursor: pointer; text-align: left; }
.rede-link:hover { text-decoration: underline; }
.rede-alerta { color: #f5c451; font-weight: 700; }
.rede-aviso { color: #ff8a65; }
.rede-conversas { display: grid; gap: 6px; }
.rede-conversa { display: grid; grid-template-columns: 170px 1fr auto; gap: 12px; align-items: center; width: 100%; padding: 10px 12px; border: 1px solid rgba(182, 218, 197, .16); border-radius: 10px; background: #0f2019; color: inherit; text-align: left; cursor: pointer; font: inherit; }
.rede-conversa:hover { border-color: var(--mint, #74e2b1); }
.rede-loja-tag { font-size: 11px; font-weight: 700; color: var(--mint, #74e2b1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rede-conv-corpo { display: grid; gap: 2px; min-width: 0; }
.rede-conv-corpo strong, .rede-conv-corpo span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rede-conv-corpo span { font-size: 12px; color: #9db8a8; }
.rede-conv-meta { display: grid; gap: 2px; justify-items: end; font-size: 11px; color: #9db8a8; }
.rede-conv-meta em { font-style: normal; color: #f5c451; }
@media (max-width: 760px) { .rede-conversa { grid-template-columns: 1fr; } .rede-conv-meta { justify-items: start; } }

.rede-item { display: grid; gap: 6px; }
.rede-msgs { display: grid; gap: 6px; margin: 0 0 6px 12px; padding: 10px 12px; border-left: 2px solid rgba(116, 226, 177, .35); }
.rede-msgs.hidden { display: none; }
.rede-msg { display: grid; gap: 2px; padding: 6px 10px; border-radius: 8px; background: #0b1a14; max-width: 92%; }
.rede-msg small { font-size: 11px; color: #9db8a8; }
.rede-msg span { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; white-space: pre-wrap; }
.rede-msg-cliente { justify-self: start; }
.rede-msg-ia { justify-self: end; background: #103024; }
.rede-msg-equipe { justify-self: end; background: #1b2b12; }
