/* =========================================================================
   B4 Atende: tema escuro azul-marinho (padrão visual B4)
   - b4-btn-std (primary|ghost|danger|success) com ícone SVG 15x15 + texto
   - b4-action-chip (is-primary|is-danger|is-success|is-warning)
   - Breakpoints: celular ≤600px · conversa em tela cheia ≤760px · tablet ≤1024px
   ========================================================================= */
:root {
  --azul-900: #0a1221;
  --azul-850: #0d1729;
  --azul-800: #111c31;
  --azul-750: #15223a;
  --azul-700: #1a2a46;
  --azul-600: #233656;
  --azul-marca: #1f5f8b;
  --primario: #2f86d6;
  --primario-claro: #5aa6ec;
  --primario-suave: rgba(47, 134, 214, .16);
  --sucesso: #22c55e;
  --perigo: #ef4444;
  --alerta: #f59e0b;

  --fundo: var(--azul-900);
  --superficie: var(--azul-800);
  --superficie-2: var(--azul-750);
  --superficie-3: var(--azul-700);
  --borda: #22324d;
  --borda-forte: #2c4064;
  --texto: #e7eef8;
  --texto-2: #94a4bd;
  --texto-3: #64748f;

  --bolha-in: #1a2740;
  --bolha-central: linear-gradient(135deg, #1f5f8b 0%, #23709f 100%);
  --bolha-celular: #24365a;
  --chat-fundo: #0b1424;

  --sombra: 0 10px 30px rgba(0, 0, 0, .35);
  --sombra-leve: 0 2px 8px rgba(0, 0, 0, .25);
  --raio: 14px;
  --rail: 78px;
  --barra-mobile: 62px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font: 15px/1.45 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--primario-claro); }
button, input, select, textarea { font: inherit; color: inherit; }
.is-hidden { display: none !important; }
svg.ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--azul-600); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::selection { background: rgba(47, 134, 214, .45); }

/* ---------------- Botões ---------------- */
.b4-btn-std {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, box-shadow .15s;
}
.b4-btn-std:active { transform: translateY(1px); }
.b4-btn-std svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.b4-btn-std.primary { background: linear-gradient(135deg, var(--primario) 0%, var(--azul-marca) 100%); color: #fff; box-shadow: 0 6px 18px rgba(47, 134, 214, .28); }
.b4-btn-std.primary:hover { box-shadow: 0 8px 24px rgba(47, 134, 214, .42); }
.b4-btn-std.success { background: var(--sucesso); color: #06240f; }
.b4-btn-std.danger { background: var(--perigo); color: #fff; box-shadow: 0 6px 18px rgba(239, 68, 68, .25); }
.b4-btn-std.ghost { background: var(--superficie-2); color: var(--texto); border-color: var(--borda); }
.b4-btn-std.ghost:hover { background: var(--superficie-3); border-color: var(--borda-forte); }
.b4-btn-std.ghost.texto-perigo { color: #fca5a5; }
.b4-btn-std.is-small { min-height: 36px; padding: 0 13px; font-size: 13px; border-radius: 9px; }
.b4-btn-std.is-block { width: 100%; }
.b4-btn-std.is-icon-only { width: 42px; padding: 0; }
.b4-btn-std:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }

.b4-action-chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 13px;
  border-radius: 999px; border: 1px solid var(--borda); background: var(--superficie-2);
  font-size: 13px; font-weight: 600; color: var(--texto-2); cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: all .15s;
}
.b4-action-chip:hover { color: var(--texto); border-color: var(--borda-forte); }
.b4-action-chip svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.b4-action-chip .contador { font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--superficie-3); color: var(--texto); }
.b4-action-chip.is-ativo { background: var(--primario-suave); color: var(--primario-claro); border-color: rgba(47, 134, 214, .45); }
.b4-action-chip.is-ativo .contador { background: var(--primario); color: #fff; }
.b4-action-chip.is-primary { color: var(--primario-claro); }
.b4-action-chip.is-danger { color: #fca5a5; }
.b4-action-chip.is-success { color: #86efac; }
.b4-action-chip.is-warning { color: #fcd34d; }

/* ---------------- Formulários ---------------- */
.campo { display: grid; gap: 7px; margin-bottom: 16px; }
.campo label { font-size: 13px; font-weight: 600; color: var(--texto-2); }
.entrada {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: 10px;
  border: 1px solid var(--borda); background: var(--azul-850); outline: none; transition: border-color .15s, box-shadow .15s;
}
.entrada::placeholder { color: var(--texto-3); }
.entrada:focus { border-color: var(--primario); box-shadow: 0 0 0 4px var(--primario-suave); }
select.entrada { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a4bd' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 16px; padding-right: 38px; }
.entrada-icone { position: relative; }
.entrada-icone svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; stroke: var(--texto-3); fill: none; stroke-width: 2; pointer-events: none; }
.entrada-icone .entrada { padding-left: 40px; }
.ajuda { font-size: 12.5px; color: var(--texto-3); }
.alerta { padding: 11px 14px; border-radius: 10px; font-size: 14px; margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alerta.erro { background: rgba(239, 68, 68, .12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }

/* =========================================================================
   Estrutura: menu lateral (rail) + conteúdo · no celular vira barra inferior
   ========================================================================= */
.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100dvh; }
.rail {
  position: sticky; top: 0; height: 100dvh; z-index: 30;
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 0;
  background: linear-gradient(180deg, var(--azul-850) 0%, #0b1527 100%); border-right: 1px solid var(--borda);
}
.rail-logo {
  width: 46px; height: 46px; border-radius: 14px; margin-bottom: 14px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--primario) 0%, var(--azul-marca) 100%); color: #fff; font-weight: 800; font-size: 15px;
  box-shadow: 0 8px 22px rgba(47, 134, 214, .35); text-decoration: none; letter-spacing: .5px;
}
.rail-link {
  position: relative; width: 60px; padding: 9px 0 7px; border-radius: 12px; display: grid; justify-items: center; gap: 4px;
  color: var(--texto-3); text-decoration: none; font-size: 11px; font-weight: 600; border: 0; background: none; cursor: pointer;
  transition: color .15s, background .15s;
}
.rail-link svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rail-link:hover { color: var(--texto); background: var(--superficie-2); }
.rail-link.ativo { color: var(--primario-claro); background: var(--primario-suave); }
.rail-link.ativo::before { content: ""; position: absolute; left: -9px; top: 12px; bottom: 12px; width: 3px; border-radius: 3px; background: var(--primario); }
.rail-link .badge { position: absolute; top: 3px; right: 8px; }
.rail-espaco { flex: 1; }
.rail-conta { position: relative; }
.rail-avatar { width: 40px; height: 40px; font-size: 14px; }

.menu-conta {
  position: absolute; left: calc(100% + 12px); bottom: 0; width: 230px; padding: 8px;
  background: var(--superficie); border: 1px solid var(--borda); border-radius: 14px; box-shadow: var(--sombra); z-index: 40;
}
.menu-conta .quem { padding: 8px 10px 10px; border-bottom: 1px solid var(--borda); margin-bottom: 6px; }
.menu-conta .quem strong { display: block; font-size: 14px; }
.menu-conta .quem span { font-size: 12px; color: var(--texto-3); }
.menu-conta a, .menu-conta button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; border: 0; background: none;
  color: var(--texto); text-decoration: none; font-size: 14px; cursor: pointer; text-align: left;
}
.menu-conta a:hover, .menu-conta button:hover { background: var(--superficie-2); }
.menu-conta .sair { color: #fca5a5; }
.menu-conta form { margin: 0; }

.app-main { min-width: 0; display: flex; flex-direction: column; }

.faixa-conexao {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 80;
  display: flex; align-items: center; gap: 10px; padding: 9px 16px; border-radius: 999px;
  background: rgba(245, 158, 11, .15); border: 1px solid rgba(245, 158, 11, .4); color: #fcd34d; font-size: 13px; font-weight: 600;
  backdrop-filter: blur(8px); box-shadow: var(--sombra-leve);
}
.girando { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ---------------- Páginas comuns ---------------- */
.pagina { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 28px 48px; }
.pagina-cab { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.pagina-cab h1 { margin: 0; font-size: 26px; letter-spacing: -.3px; }
.pagina-cab p { margin: 4px 0 0; color: var(--texto-2); font-size: 14.5px; }
.cartao { background: var(--superficie); border: 1px solid var(--borda); border-radius: var(--raio); box-shadow: var(--sombra-leve); }
.vazio { text-align: center; color: var(--texto-2); padding: 48px 20px; }
.vazio .ilustracao { width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; background: var(--primario-suave); color: var(--primario-claro); }
.vazio .ilustracao svg { width: 36px; height: 36px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.vazio h3 { margin: 0 0 6px; color: var(--texto); font-size: 17px; }
.vazio p { margin: 0 auto; max-width: 360px; font-size: 14px; }

/* ---------------- Status ---------------- */
.status-chip { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; padding: 4px 11px; border-radius: 999px; }
.status-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 25%, transparent); }
.status-chip.conectado { color: #4ade80; background: rgba(34, 197, 94, .12); }
.status-chip.conectado::before { animation: pulsa 2s infinite; }
.status-chip.aguardando_qr, .status-chip.conectando { color: #fbbf24; background: rgba(245, 158, 11, .12); }
.status-chip.desconectado, .status-chip.removido { color: #f87171; background: rgba(239, 68, 68, .12); }
@keyframes pulsa { 50% { box-shadow: 0 0 0 6px transparent; } }

/* ---------------- Números ---------------- */
.resumo-numeros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.resumo-item { padding: 16px 18px; display: flex; align-items: center; gap: 14px; }
.resumo-item .ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; }
.resumo-item .ic svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 2; }
.resumo-item strong { display: block; font-size: 22px; line-height: 1.1; }
.resumo-item span { font-size: 12.5px; color: var(--texto-2); }
.ic.azul { background: var(--primario-suave); color: var(--primario-claro); }
.ic.verde { background: rgba(34, 197, 94, .14); color: #4ade80; }
.ic.vermelho { background: rgba(239, 68, 68, .14); color: #f87171; }

.numeros-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.numero-card { overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
.numero-card:hover { border-color: var(--borda-forte); transform: translateY(-2px); }
.numero-capa { height: 6px; background: linear-gradient(90deg, var(--azul-marca), var(--primario)); }
.numero-card.desconectado .numero-capa, .numero-card.removido .numero-capa { background: linear-gradient(90deg, #7f1d1d, var(--perigo)); }
.numero-card.aguardando_qr .numero-capa, .numero-card.conectando .numero-capa { background: linear-gradient(90deg, #78350f, var(--alerta)); }
.numero-corpo { padding: 18px; display: grid; gap: 14px; }
.numero-topo { display: flex; gap: 14px; align-items: center; }
.numero-topo .info { min-width: 0; flex: 1; }
.numero-topo strong { display: block; font-size: 16.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.numero-topo span { color: var(--texto-2); font-size: 13.5px; }
.numero-acoes { display: flex; gap: 8px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--borda); }

/* ---------------- Avatar ---------------- */
.avatar {
  width: 46px; height: 46px; border-radius: 50%; flex: none; overflow: hidden; position: relative;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; color: #fff; background: var(--azul-600);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.p { width: 40px; height: 40px; font-size: 14px; }
.avatar.g { width: 54px; height: 54px; font-size: 18px; }

/* ---------------- Modal ---------------- */
.modal-fundo {
  position: fixed; inset: 0; z-index: 90; background: rgba(3, 7, 15, .72); backdrop-filter: blur(4px);
  display: grid; place-items: center; padding: 16px; animation: aparece .15s ease-out;
}
.modal {
  width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow: auto; padding: 26px;
  background: var(--superficie); border: 1px solid var(--borda-forte); border-radius: 18px; box-shadow: var(--sombra);
  animation: sobeModal .2s cubic-bezier(.2, .9, .3, 1.2);
}
.modal h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.2px; }
.modal .sub { margin: 0 0 18px; color: var(--texto-2); font-size: 14px; }
.modal-acoes { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; flex-wrap: wrap; }
.modal-icone { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 16px; }
.modal-icone svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.modal-icone.perigo { background: rgba(239, 68, 68, .14); color: #f87171; }
.modal-icone.alerta { background: rgba(245, 158, 11, .14); color: #fbbf24; }
.modal-icone.info { background: var(--primario-suave); color: var(--primario-claro); }
.modal-icone.sucesso { background: rgba(34, 197, 94, .14); color: #4ade80; }
.modal.dialogo { max-width: 420px; }
.modal.dialogo p { margin: 0; color: var(--texto-2); line-height: 1.55; }
@keyframes aparece { from { opacity: 0; } }
@keyframes sobeModal { from { transform: translateY(14px) scale(.98); opacity: 0; } }

.qr-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: center; }
.qr-caixa { position: relative; display: grid; place-items: center; aspect-ratio: 1; background: #fff; border-radius: 16px; padding: 12px; box-shadow: 0 0 0 6px var(--primario-suave); }
.qr-caixa img { width: 100%; height: 100%; image-rendering: pixelated; }
.qr-caixa .carregando { color: #475569; display: grid; justify-items: center; gap: 10px; font-size: 13px; }
.qr-caixa .carregando .girando { width: 26px; height: 26px; border-width: 3px; color: var(--azul-marca); }
.qr-passos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; counter-reset: passo; }
.qr-passos li { display: flex; gap: 12px; font-size: 14px; color: var(--texto-2); counter-increment: passo; line-height: 1.4; }
.qr-passos li::before { content: counter(passo); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; background: var(--primario-suave); color: var(--primario-claro); }
.qr-passos strong { color: var(--texto); }
.qr-rodape { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 16px; font-size: 13px; color: var(--texto-3); }

/* ---------------- Notificação (sucesso) ---------------- */
.toasts { position: fixed; z-index: 95; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(92vw, 380px); }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 12px; font-size: 14px;
  background: var(--superficie-2); border: 1px solid var(--borda-forte); box-shadow: var(--sombra); animation: entra .25s ease-out;
}
.toast .ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: rgba(34, 197, 94, .16); color: #4ade80; }
.toast .ic svg { width: 15px; height: 15px; stroke: currentColor; fill: none; stroke-width: 2.5; }
.toast.saindo { animation: sai .2s ease-in forwards; }
@keyframes entra { from { transform: translateX(20px); opacity: 0; } }
@keyframes sai { to { transform: translateX(20px); opacity: 0; } }

/* ---------------- Login ---------------- */
.login-pagina { min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-hero {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: radial-gradient(1200px 600px at -10% -10%, rgba(47, 134, 214, .35), transparent 60%), radial-gradient(800px 500px at 110% 110%, rgba(31, 95, 139, .45), transparent 60%), var(--azul-850);
  border-right: 1px solid var(--borda);
}
.login-hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -1px; margin: 0 0 14px; max-width: 460px; }
.login-hero h1 span { background: linear-gradient(90deg, var(--primario-claro), #9cd0ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-hero p { color: var(--texto-2); font-size: 16px; max-width: 420px; margin: 0; }
.login-recursos { display: grid; gap: 14px; margin-top: 32px; }
.login-recursos div { display: flex; gap: 12px; align-items: center; color: var(--texto-2); font-size: 14.5px; }
.login-recursos .ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primario-suave); color: var(--primario-claro); flex: none; }
.login-recursos .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; }
.marca { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 19px; color: var(--texto); text-decoration: none; }
.marca .selo { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, var(--primario), var(--azul-marca)); color: #fff; font-size: 14px; box-shadow: 0 8px 22px rgba(47, 134, 214, .35); }
.login-lado { display: grid; place-items: center; padding: 24px; }
.login-cartao { width: 100%; max-width: 400px; padding: 34px 30px; }
.login-cartao h2 { margin: 0 0 6px; font-size: 24px; }
.login-cartao .sub { margin: 0 0 26px; color: var(--texto-2); font-size: 14.5px; }
.login-cartao .marca { display: none; margin-bottom: 24px; }
.login-rodape { color: var(--texto-3); font-size: 12.5px; }

/* =========================================================================
   Atendimento
   ========================================================================= */
body.tela-atendimento { overflow: hidden; }
.atd { display: grid; grid-template-columns: 380px 1fr; height: 100dvh; }
.atd-lista { display: flex; flex-direction: column; min-height: 0; background: var(--superficie); border-right: 1px solid var(--borda); }
.atd-lista-cab { padding: 18px 16px 12px; display: grid; gap: 12px; }
.atd-titulo { display: flex; align-items: center; justify-content: space-between; }
.atd-titulo h1 { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.atd-abas { display: flex; flex-wrap: wrap; gap: 6px; }
.atd-abas::-webkit-scrollbar { display: none; }
.atd-itens { list-style: none; margin: 0; padding: 4px 8px 12px; overflow-y: auto; flex: 1; overscroll-behavior: contain; }
.atd-item {
  display: flex; gap: 12px; padding: 11px 10px; cursor: pointer; border-radius: 12px; align-items: center; min-height: 70px;
  transition: background .12s; margin-bottom: 2px;
}
.atd-item:hover { background: var(--superficie-2); }
.atd-item.ativo { background: var(--superficie-3); box-shadow: inset 3px 0 0 var(--primario); }
.atd-item .meio { min-width: 0; flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.atd-item .linha1, .atd-item .linha2 { display: flex; align-items: center; gap: 8px; }
.atd-item .nome { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.atd-item .hora { font-size: 11.5px; color: var(--texto-3); flex: none; }
.atd-item .previa { font-size: 13.5px; color: var(--texto-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; display: flex; align-items: center; gap: 4px; }
.atd-item .previa { min-width: 0; }
.atd-item .previa > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.atd-item .previa svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; flex: none; }
.atd-item.nao-lida .hora { color: var(--primario-claro); font-weight: 700; }
.atd-item.nao-lida .nome { color: #fff; }
.atd-item.nao-lida .previa { color: var(--texto); }
.badge { min-width: 21px; height: 21px; padding: 0 6px; border-radius: 999px; background: var(--primario); color: #fff; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; flex: none; box-shadow: 0 2px 8px rgba(47, 134, 214, .4); }
.etiqueta { font-size: 10.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--superficie-3); color: var(--texto-2); flex: none; text-transform: uppercase; letter-spacing: .3px; }
.etiqueta.aguardando { color: #fbbf24; background: rgba(245, 158, 11, .12); }
.atd-carregando { padding: 30px; display: grid; justify-items: center; color: var(--texto-3); }

.atd-conversa {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background-color: var(--chat-fundo);
  background-image: radial-gradient(rgba(90, 166, 236, .06) 1px, transparent 1px);
  background-size: 22px 22px;
}
.atd-vazio { margin: auto; text-align: center; color: var(--texto-2); padding: 24px; max-width: 380px; }
.atd-vazio .ilustracao { width: 96px; height: 96px; margin: 0 auto 18px; border-radius: 28px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(47, 134, 214, .22), rgba(31, 95, 139, .12)); color: var(--primario-claro); border: 1px solid rgba(47, 134, 214, .25); }
.atd-vazio .ilustracao svg { width: 44px; height: 44px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.atd-vazio h2 { margin: 0 0 8px; color: var(--texto); font-size: 20px; }
.atd-vazio p { margin: 0; font-size: 14px; }

.conv-cab { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: rgba(17, 28, 49, .92); backdrop-filter: blur(10px); border-bottom: 1px solid var(--borda); min-height: 68px; }
.conv-cab .info { min-width: 0; flex: 1; }
.conv-cab .info strong { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-cab .info span { font-size: 12.5px; color: var(--texto-2); }
.conv-cab .acoes { display: flex; gap: 8px; align-items: center; }
.btn-redondo.btn-voltar { display: none; }

.conv-mensagens { flex: 1; overflow-y: auto; padding: 18px 5% 10px; display: flex; flex-direction: column; gap: 3px; overscroll-behavior: contain; }
.dia-sep { align-self: center; margin: 14px 0 8px; font-size: 11.5px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: var(--superficie-2); color: var(--texto-2); border: 1px solid var(--borda); text-transform: uppercase; letter-spacing: .4px; }
.bolha {
  position: relative; max-width: min(72%, 580px); padding: 8px 11px 6px; border-radius: 14px 14px 14px 4px;
  background: var(--bolha-in); align-self: flex-start; word-wrap: break-word; overflow-wrap: anywhere;
  box-shadow: var(--sombra-leve); margin-top: 4px; animation: bolhaEntra .18s ease-out;
}
.bolha.out { align-self: flex-end; background: var(--bolha-central); border-radius: 14px 14px 4px 14px; }
.bolha.out.celular { background: var(--bolha-celular); border: 1px solid #33507f; }
@keyframes bolhaEntra { from { transform: translateY(6px); opacity: 0; } }
.bolha .origem { font-size: 11.5px; font-weight: 700; margin-bottom: 3px; display: flex; gap: 6px; align-items: center; color: #bfe0ff; }
.bolha.celular .origem { color: #9fc3f5; }
.bolha .origem svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; }
.bolha .texto { white-space: pre-wrap; line-height: 1.45; }
.bolha .texto a { color: #9cd0ff; }
.bolha .meta { display: flex; justify-content: flex-end; align-items: center; gap: 5px; font-size: 11px; color: rgba(231, 238, 248, .55); margin-top: 3px; }
.bolha .meta .via { margin-right: auto; padding-right: 10px; }
.bolha .tick svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.bolha .tick.lida { color: #5ad1ff; }
.bolha .tick.erro { color: #fca5a5; }
.bolha.apagada .texto { font-style: italic; color: var(--texto-3); }
.bolha.erro { box-shadow: 0 0 0 1px rgba(239, 68, 68, .6); }
.bolha .erro-txt { font-size: 12px; color: #fca5a5; margin-top: 5px; display: flex; gap: 6px; align-items: center; }
.bolha .citacao { border-left: 3px solid var(--primario-claro); background: rgba(0, 0, 0, .22); border-radius: 8px; padding: 5px 9px; margin-bottom: 5px; font-size: 13px; color: rgba(231, 238, 248, .75); max-height: 62px; overflow: hidden; }
.bolha .remetente { font-size: 12px; font-weight: 700; color: #7cc4ff; margin-bottom: 2px; }
.bolha .citacao b { display: block; font-size: 11.5px; color: var(--primario-claro); margin-bottom: 1px; }
.bolha .tick-caixa { display: inline-flex; }
/* Botão do menu da mensagem (aparece ao passar o mouse; no celular use toque longo) */
.bolha .btn-menu-msg {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 8px; border: 0;
  background: rgba(10, 18, 33, .55); color: var(--texto); cursor: pointer; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s; backdrop-filter: blur(4px);
}
.bolha:hover .btn-menu-msg, .bolha:focus-within .btn-menu-msg { opacity: 1; }
.bolha .btn-menu-msg svg { width: 15px; height: 15px; }
.menu-msg {
  position: fixed; z-index: 85; min-width: 200px; padding: 6px; border-radius: 12px;
  background: var(--superficie); border: 1px solid var(--borda-forte); box-shadow: var(--sombra); animation: aparece .12s;
}
.menu-msg button {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: 8px;
  background: none; color: var(--texto); font-size: 14px; cursor: pointer; text-align: left;
}
.menu-msg button:hover { background: var(--superficie-2); }
.menu-msg button svg { width: 17px; height: 17px; color: var(--texto-2); }
.menu-msg button.perigo, .menu-msg button.perigo svg { color: #f87171; }

/* Player de áudio no estilo WhatsApp */
.audio-player { display: flex; align-items: center; gap: 10px; min-width: min(280px, 62vw); padding: 2px 0; }
.audio-player .ap-play {
  width: 38px; height: 38px; border-radius: 50%; border: 0; flex: none; cursor: pointer; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); color: #fff; transition: background .15s, transform .1s;
}
.audio-player .ap-play:hover { background: rgba(255, 255, 255, .22); }
.audio-player .ap-play:active { transform: scale(.94); }
.audio-player .ap-play svg { width: 16px; height: 16px; fill: currentColor; stroke: none; }
.audio-player .ap-barra {
  --progresso: 0%; flex: 1; height: 4px; appearance: none; -webkit-appearance: none; border-radius: 4px; cursor: pointer; background:
  linear-gradient(90deg, #7cc4ff var(--progresso), rgba(255, 255, 255, .22) var(--progresso));
}
.audio-player .ap-barra::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%; background: #9cd0ff; box-shadow: 0 0 0 3px rgba(124, 196, 255, .25); }
.audio-player .ap-barra::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: #9cd0ff; }
.audio-player .ap-tempo { font-size: 11.5px; color: rgba(231, 238, 248, .7); min-width: 34px; font-variant-numeric: tabular-nums; }
.audio-player .ap-vel {
  min-width: 36px; height: 24px; padding: 0 6px; border-radius: 999px; border: 0; cursor: pointer; flex: none;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: 11.5px; font-weight: 700;
}
.audio-player.tocando .ap-play { background: var(--primario); }

/* Arrastar arquivo para a conversa */
.atd-conversa.soltando { position: relative; }
.atd-conversa.soltando::after {
  content: "Solte o arquivo para anexar"; position: absolute; inset: 12px; z-index: 5; border-radius: 16px; display: grid; place-items: center;
  border: 2px dashed var(--primario); background: rgba(10, 18, 33, .82); color: var(--primario-claro); font-weight: 700; font-size: 16px;
}
.bolha.reacao { background: transparent; box-shadow: none; border: 0; padding: 0 4px; }
.bolha.reacao .texto { font-size: 22px; }
.midia-img { display: block; max-width: 100%; max-height: 340px; border-radius: 10px; cursor: zoom-in; margin-bottom: 2px; }
.midia-video { display: block; max-width: 100%; max-height: 340px; border-radius: 10px; }
.midia-audio { width: min(290px, 62vw); height: 40px; }
.midia-doc { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(0, 0, 0, .22); text-decoration: none; color: inherit; min-width: 200px; }
.midia-doc .ic { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); flex: none; }
.midia-carregando { font-size: 13px; color: rgba(231, 238, 248, .6); display: flex; align-items: center; gap: 8px; padding: 6px 0; }

.conv-resposta, .conv-anexo {
  display: flex; align-items: center; gap: 10px; margin: 0 14px; padding: 10px 12px; border-radius: 12px 12px 0 0;
  background: var(--superficie-2); border: 1px solid var(--borda); border-bottom: 0; font-size: 13px;
}
.conv-resposta .txt { flex: 1; min-width: 0; border-left: 3px solid var(--primario); padding-left: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texto-2); }
.conv-resposta .txt b { display: block; color: var(--primario-claro); font-size: 12px; }
.conv-anexo .nome { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-anexo .ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--primario-suave); color: var(--primario-claro); flex: none; }
.conv-anexo .ic svg { width: 17px; height: 17px; }

.rodape-conversa { padding: 10px 14px calc(12px + env(safe-area-inset-bottom)); background: rgba(13, 23, 41, .95); border-top: 1px solid var(--borda); }
.compositor { display: flex; align-items: flex-end; gap: 6px; padding: 5px; background: var(--superficie-2); border: 1px solid var(--borda); border-radius: 26px; transition: border-color .15s, box-shadow .15s; }
.compositor:focus-within { border-color: var(--borda-forte); box-shadow: 0 0 0 4px rgba(47, 134, 214, .1); }
.compositor textarea { flex: 1; resize: none; min-height: 42px; max-height: 150px; padding: 10px 6px; border: 0; background: transparent; outline: none; line-height: 1.4; }
.compositor textarea::placeholder { color: var(--texto-3); }
.btn-redondo {
  width: 42px; height: 42px; border-radius: 50%; border: 0; flex: none; cursor: pointer;
  display: grid; place-items: center; background: transparent; color: var(--texto-2); transition: background .15s, color .15s, transform .1s;
}
.btn-redondo:hover { background: var(--superficie-3); color: var(--texto); }
.btn-redondo:active { transform: scale(.94); }
.btn-redondo svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-redondo.principal { background: linear-gradient(135deg, var(--primario), var(--azul-marca)); color: #fff; box-shadow: 0 4px 14px rgba(47, 134, 214, .4); }
.btn-redondo.principal:hover { color: #fff; }
.btn-redondo.perigo { color: #f87171; }
.gravando { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 42px; padding: 0 8px; color: #f87171; font-weight: 700; font-variant-numeric: tabular-nums; }
.gravando .ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--perigo); animation: pisca 1s infinite; box-shadow: 0 0 0 4px rgba(239, 68, 68, .2); }
.gravando .onda { flex: 1; height: 22px; background: repeating-linear-gradient(90deg, rgba(248, 113, 113, .5) 0 3px, transparent 3px 7px); mask: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); opacity: .7; animation: onda 1.2s linear infinite; }
@keyframes pisca { 50% { opacity: .25; } }
@keyframes onda { to { background-position: 28px 0; } }
.responder-por { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--texto-3); margin-top: 8px; padding: 0 6px; }
.responder-por svg { width: 14px; height: 14px; stroke: currentColor; fill: none; stroke-width: 2; }
.responder-por select { min-height: 30px; padding: 2px 28px 2px 10px; border-radius: 8px; border: 1px solid var(--borda); background: var(--superficie-2); color: var(--texto); max-width: 220px; font-size: 12.5px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a4bd' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 14px; }
.aviso-desconectado { display: flex; gap: 10px; align-items: center; margin: 0 14px 8px; padding: 10px 12px; font-size: 13px; border-radius: 10px; background: rgba(239, 68, 68, .12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, .3); }
.aviso-desconectado svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; flex: none; }

.visualizador { position: fixed; inset: 0; z-index: 100; background: rgba(3, 7, 15, .94); display: grid; place-items: center; cursor: zoom-out; padding: 16px; animation: aparece .15s; }
.visualizador img { max-width: 100%; max-height: 100%; border-radius: 8px; }

/* ---------------- Tablet ---------------- */
@media (max-width: 1024px) {
  .atd { grid-template-columns: 330px 1fr; }
  .conv-mensagens { padding: 14px 3% 8px; }
  .bolha { max-width: 82%; }
  .login-pagina { grid-template-columns: 1fr 1fr; }
  .login-hero { padding: 36px; }
  .login-hero h1 { font-size: 32px; }
}

/* ---------------- Conversa em tela cheia (celular / tablet estreito) ---------------- */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: calc(var(--barra-mobile) + env(safe-area-inset-bottom));
    flex-direction: row; justify-content: space-around; padding: 4px 8px env(safe-area-inset-bottom); border-right: 0; border-top: 1px solid var(--borda);
    background: rgba(13, 23, 41, .97); backdrop-filter: blur(10px);
  }
  .rail-logo, .rail-espaco { display: none; }
  .rail-link { width: auto; flex: 1; max-width: 110px; }
  .rail-link.ativo::before { left: 30%; right: 30%; top: -5px; bottom: auto; width: auto; height: 3px; }
  .rail-conta { flex: 1; max-width: 110px; display: grid; justify-items: center; }
  .rail-avatar { width: 28px; height: 28px; font-size: 11px; }
  .menu-conta { left: auto; right: 0; bottom: calc(100% + 10px); }
  .app-main { padding-bottom: calc(var(--barra-mobile) + env(safe-area-inset-bottom)); }
  .atd { grid-template-columns: 1fr; height: calc(100dvh - var(--barra-mobile) - env(safe-area-inset-bottom)); }
  .atd-conversa { display: none; }
  body.com-conversa .rail { display: none; }
  body.com-conversa .app-main { padding-bottom: 0; }
  body.com-conversa .atd { height: 100dvh; }
  body.com-conversa .atd-lista { display: none; }
  body.com-conversa .atd-conversa { display: flex; }
  .btn-redondo.btn-voltar { display: grid; margin-left: -6px; }
  .bolha { max-width: 88%; }
  .bolha .btn-menu-msg { display: none; }
  .conv-mensagens { padding: 12px 10px 8px; }
  .responder-por .rotulo { display: none; }
  .login-pagina { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .login-cartao .marca { display: flex; }
  .toasts { right: 50%; transform: translateX(50%); bottom: calc(var(--barra-mobile) + 14px); }
}
@media (max-width: 600px) {
  .pagina { padding: 18px 14px 28px; }
  .pagina-cab h1 { font-size: 22px; }
  .pagina-cab .b4-btn-std { width: 100%; }
  .resumo-numeros { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .resumo-item { padding: 12px; flex-direction: column; align-items: flex-start; gap: 8px; }
  .resumo-item .ic { width: 34px; height: 34px; }
  .numeros-grade { grid-template-columns: 1fr; }
  .modal { padding: 22px 18px; border-radius: 18px 18px 0 0; max-height: 92dvh; }
  .modal-fundo { align-items: end; padding: 0; }
  .modal-acoes .b4-btn-std { flex: 1; }
  .qr-layout { grid-template-columns: 1fr; }
  .qr-caixa { max-width: 260px; margin: 0 auto; width: 100%; }
  .conv-cab .acoes .b4-btn-std span { display: none; }
  .conv-cab .acoes .b4-btn-std { width: 40px; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
