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

/* Visual "Arejado" (estilo D do comparador): blocos flutuantes sobre fundo em degradê suave. */
:root {
  --brand: #0b6bb5; --brand-forte: #075289; --brand2: #22b3a5; --btn-texto: #fff;
  --fundo: linear-gradient(140deg, #dcebf7 0%, #eef2fb 45%, #e6f4f1 100%);
  --bg: #e9f0f8; --card: rgba(255,255,255,.82); --card-solido: #fff; --card2: #eef3f9; --input: #f1f5fa;
  --chat-bg: rgba(255,255,255,.66);
  --texto: #18263a; --titulo: #0f1c2e; --suave: #687b90;
  --borda: rgba(24,38,58,.08); --borda-forte: rgba(24,38,58,.16);
  --ok: #11865e; --alerta: #b45a09; --erro: #dc2626; --roxo: #6a3fc8;
  --bolha-in: #fff; --bolha-out: linear-gradient(135deg, #0b6bb5, #1a8fd6); --bolha-out-tx: #fff;
  --sombra: 0 2px 8px rgba(24,38,58,.07);
  --sombra-lg: 0 18px 45px rgba(24,38,58,.18);
  --av-s: 75%; --av-l: 88%; --av-tx: 32%;
  --r: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --brand: #5bb1f2; --brand-forte: #3b9be6; --brand2: #2bc4b4; --btn-texto: #04162e;
  --fundo: linear-gradient(140deg, #0c1626 0%, #111a2c 50%, #0c1d1e 100%);
  --bg: #0e1828; --card: rgba(22,32,50,.85); --card-solido: #172338; --card2: #1e2b44; --input: #1b2740;
  --chat-bg: rgba(18,27,43,.75);
  --texto: #e3eaf3; --titulo: #f3f7fc; --suave: #8f9fb3;
  --borda: rgba(255,255,255,.07); --borda-forte: rgba(255,255,255,.14);
  --ok: #46d39b; --alerta: #f3ad55; --roxo: #bba6f7;
  --bolha-in: #22304a; --bolha-out: linear-gradient(135deg, #2580c9, #3aa0e6); --bolha-out-tx: #fff;
  --sombra: 0 2px 8px rgba(0,0,0,.25);
  --av-s: 40%; --av-l: 30%; --av-tx: 85%;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #5bb1f2; --brand-forte: #3b9be6; --brand2: #2bc4b4; --btn-texto: #04162e;
    --fundo: linear-gradient(140deg, #0c1626 0%, #111a2c 50%, #0c1d1e 100%);
    --bg: #0e1828; --card: rgba(22,32,50,.85); --card-solido: #172338; --card2: #1e2b44; --input: #1b2740;
    --chat-bg: rgba(18,27,43,.75);
    --texto: #e3eaf3; --titulo: #f3f7fc; --suave: #8f9fb3;
    --borda: rgba(255,255,255,.07); --borda-forte: rgba(255,255,255,.14);
    --ok: #46d39b; --alerta: #f3ad55; --roxo: #bba6f7;
    --bolha-in: #22304a; --bolha-out: linear-gradient(135deg, #2580c9, #3aa0e6); --bolha-out-tx: #fff;
    --sombra: 0 2px 8px rgba(0,0,0,.25);
    --av-s: 40%; --av-l: 30%; --av-tx: 85%;
    color-scheme: dark;
  }
}

html, body { height: 100%; }
body { font: 14px/1.45 "DM Sans", system-ui, sans-serif; background: var(--fundo), var(--bg); color: var(--texto); }
[hidden] { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: -4px; }
h1, h2 { font-family: Outfit, "DM Sans", sans-serif; font-weight: 600; color: var(--titulo); }
h1 { font-size: 1.35rem; }
h2 { font-size: 1rem; margin-bottom: 8px; }
small { color: var(--suave); }
.suave { color: var(--suave); font-size: .88rem; margin-bottom: 10px; }
.mt { margin-top: 18px; }
.erro { color: var(--erro); font-size: .88rem; }

input, textarea, select {
  font: inherit; color: var(--texto); background: var(--input);
  border: 1px solid var(--borda-forte); border-radius: 12px; padding: 9px 12px; width: 100%;
}
textarea { resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 12px; }
label > input, label > textarea, label > select { margin-top: 5px; font-weight: 400; }
label small { font-weight: 400; }

.btn { font: inherit; font-weight: 600; border: 0; border-radius: 12px; padding: 9px 16px; cursor: pointer; white-space: nowrap; }
.btn-pri { background: var(--brand); color: var(--btn-texto); box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-pri:hover { background: var(--brand-forte); }
.btn-sec { background: var(--card2); color: var(--texto); border: 1px solid transparent; }
.btn-sec:hover { border-color: var(--borda-forte); }
.btn-perigo { background: transparent; color: var(--erro); border: 1px solid color-mix(in srgb, var(--erro) 40%, transparent); }
.btn-p { padding: 6px 11px; font-size: .84rem; }
.btn:disabled { opacity: .55; cursor: default; }
.btn-icone { text-decoration: none; background: none; border: 0; cursor: pointer; font-size: 1.05rem; padding: 6px; border-radius: 8px; color: var(--texto); }
.btn-icone:hover { background: var(--card2); }

/* ---------- Login ---------- */
.tela-centro { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.cartao-login { width: 100%; max-width: 380px; background: var(--card-solido); border: 1px solid var(--borda); border-radius: 16px; padding: 28px; box-shadow: var(--sombra-lg); }
.cartao-login.largo { max-width: 460px; }
.cartao-login .btn { width: 100%; margin-top: 6px; }
.marca { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }
.marca strong { display: block; font-family: Outfit, sans-serif; font-size: 1.1rem; color: var(--titulo); }
.marca-icone { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), var(--brand2)); font-size: 1.2rem; flex: none; }
.cli-lista { max-height: 50vh; overflow: auto; margin: 10px 0; display: grid; gap: 6px; }
.cli-lista button { text-align: left; font: inherit; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; background: var(--card2); color: var(--texto); cursor: pointer; }
.cli-lista button:hover { border-color: var(--brand); }

/* ---------- Estrutura ---------- */
.app { display: grid; grid-template-columns: 212px 1fr; gap: 12px; padding: 12px; height: 100vh; height: 100dvh; }
.nav { background: var(--card); backdrop-filter: blur(10px); border-radius: var(--r); display: flex; flex-direction: column; padding: 16px 12px; gap: 2px; min-height: 0; }
.nav-topo { display: flex; gap: 10px; align-items: center; padding: 4px 6px 14px; }
.nav-cliente { min-width: 0; }
.nav-cliente strong { display: block; color: var(--titulo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wa-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .76rem; }
.wa-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--suave); }
.wa-pill.on::before { background: var(--ok); }
.wa-pill.off::before { background: var(--erro); }
.nav-grupo { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--suave); padding: 14px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 10px; width: 100%; font: inherit; font-weight: 500; text-align: left; padding: 9px 12px; border: 0; border-radius: 12px; background: none; color: var(--texto); cursor: pointer; }
.nav-item:hover { background: color-mix(in srgb, var(--brand) 8%, transparent); }
.nav-item.ativo { background: var(--brand); color: var(--btn-texto); font-weight: 600; box-shadow: 0 6px 16px color-mix(in srgb, var(--brand) 35%, transparent); }
.nav-item.ativo .badge { background: var(--btn-texto); color: var(--brand); }
.badge { margin-left: auto; background: #ef5b5b; color: #fff; border-radius: 99px; font-size: .72rem; font-weight: 700; line-height: 1; min-width: 20px; height: 20px; padding: 0 6px; display: inline-flex; align-items: center; justify-content: center; }
.nav-rodape { margin-top: auto; background: var(--input); border-radius: 12px; padding: 8px; }
.eu { padding: 0 6px 6px; }
.eu strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-acoes { display: flex; gap: 2px; }
body:not(.gerente) .so-gerente { display: none !important; }
body:not(.suporte) .so-suporte { display: none !important; }
body.suporte .so-equipe { display: none !important; }

.conteudo { min-width: 0; min-height: 0; overflow: auto; }
.view { padding: 22px 26px; max-width: 1100px; }
#view-conversas { padding: 0; max-width: none; height: 100%; }
.view-topo { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.view-topo p { color: var(--suave); margin-top: 3px; }
.cartao { background: var(--card); backdrop-filter: blur(10px); border-radius: var(--r); padding: 20px; box-shadow: var(--sombra); }
.busca { max-width: 420px; margin-bottom: 14px; }

/* ---------- Conversas ---------- */
.conv { display: grid; grid-template-columns: 330px 1fr; gap: 12px; height: 100%; min-height: 0; }
.conv-lista { border-radius: var(--r); overflow: hidden; backdrop-filter: blur(10px); background: var(--card); display: flex; flex-direction: column; min-height: 0; }
.conv-topo { display: flex; gap: 8px; padding: 14px 14px 10px; }
.abas { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.aba { font: inherit; font-size: .8rem; font-weight: 600; border: 0; background: var(--card2); color: var(--suave); border-radius: 99px; padding: 4px 10px; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.aba.ativa { background: var(--titulo); color: var(--bg); }
.aba b { font-weight: 700; font-size: .7rem; line-height: 1; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; display: inline-flex; align-items: center; justify-content: center; background: var(--brand); color: #fff; margin-right: -4px; }
.aba.ativa b { background: var(--bg); color: var(--titulo); }
.lista { overflow-y: auto; flex: 1; min-height: 0; padding: 0 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.item { display: grid; grid-template-columns: 42px 1fr auto; gap: 10px; padding: 10px; border-radius: 14px; cursor: pointer; }
.item:hover { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.item.sel { background: var(--card-solido); box-shadow: 0 4px 14px rgba(24,38,58,.08); }
.avatar { --h: 205; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; flex: none; background: hsl(var(--h) var(--av-s) var(--av-l)); color: hsl(var(--h) 60% var(--av-tx)); }
.item-meio { min-width: 0; }
.item-meio strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--titulo); font-family: Outfit, sans-serif; font-weight: 600; font-size: .98rem; }
.item-meio .ult { color: var(--suave); font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-dir { text-align: right; font-size: .74rem; color: var(--suave); display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.item-dir .badge { margin: 0; }
.tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.tag { font-size: .7rem; font-weight: 600; padding: 1px 8px; border-radius: 99px; background: var(--card2); color: var(--suave); }
.tag.bot { color: var(--roxo); background: color-mix(in srgb, var(--roxo) 14%, transparent); }
.tag.fila { color: var(--alerta); background: color-mix(in srgb, var(--alerta) 14%, transparent); }
.tag.atendendo { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.lista-vazia { padding: 30px 16px; text-align: center; color: var(--suave); }

.chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--chat-bg); border-radius: var(--r); overflow: hidden; backdrop-filter: blur(10px); }
.chat-vazio { margin: auto; text-align: center; color: var(--suave); }
.chat-vazio div { font-size: 2.6rem; margin-bottom: 6px; }
.chat-cheio { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-topo { display: flex; align-items: center; gap: 12px; padding: 14px 18px; flex-wrap: wrap; }
.chat-topo .avatar { flex: none; }
.chat-quem { min-width: 0; flex: 1; }
.chat-quem strong { display: block; color: var(--titulo); font-family: Outfit, sans-serif; font-weight: 600; font-size: 1.1rem; }
.chat-acoes .btn-sec { background: var(--card2); }
.chat-acoes { display: flex; gap: 6px; flex-wrap: wrap; }
.voltar { display: none; }
.msgs { flex: 1; overflow-y: auto; padding: 8px 5% 12px; display: flex; flex-direction: column; gap: 6px; min-height: 0; }
.bolha { max-width: min(72%, 560px); padding: 9px 14px 7px; border-radius: 18px; box-shadow: var(--sombra); white-space: pre-wrap; overflow-wrap: anywhere; }
.bolha.entrada { background: var(--bolha-in); align-self: flex-start; border-bottom-left-radius: 6px; }
.bolha.saida { background: var(--bolha-out); color: var(--bolha-out-tx); align-self: flex-end; border-bottom-right-radius: 6px; }
.bolha .meta { display: block; text-align: right; font-size: .7rem; color: var(--suave); margin-top: 2px; }
.bolha.saida .meta { color: inherit; opacity: .75; }
.bolha.saida a { color: inherit; }
.dia { align-self: center; font-size: .74rem; font-weight: 600; color: var(--suave); background: var(--card-solido); padding: 3px 12px; border-radius: 99px; margin: 6px 0; }
.compor { display: flex; gap: 8px; margin: 4px 14px 14px; padding: 8px 8px 8px 10px; background: var(--card-solido); border-radius: 16px; box-shadow: 0 6px 20px rgba(24,38,58,.09); align-items: flex-end; }
.compor textarea { resize: none; max-height: 140px; background: transparent; border: 0; padding: 9px 4px; }
.compor textarea:focus { box-shadow: none; }
.compor:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent), 0 6px 20px rgba(24,38,58,.09); }
.compor-aviso { margin: 4px 14px 14px; padding: 12px 16px; background: var(--card-solido); border-radius: 16px; color: var(--suave); font-size: .86rem; }

/* ---------- Tabelas ---------- */
.tabela-wrap { overflow-x: auto; background: var(--card); backdrop-filter: blur(10px); border-radius: var(--r); box-shadow: var(--sombra); }
.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--borda); vertical-align: middle; }
.tabela th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--suave); background: transparent; }
.tabela tr:last-child td { border-bottom: 0; }
.tabela td.acoes { text-align: right; white-space: nowrap; }
.tabela .inativo { opacity: .5; }

/* ---------- Departamentos ---------- */
.linha-form { display: flex; gap: 8px; max-width: 520px; margin-bottom: 14px; }
.dp-lista { display: grid; gap: 8px; max-width: 720px; }
.dp { display: flex; align-items: center; gap: 10px; background: var(--card); border-radius: 14px; padding: 10px 12px; box-shadow: var(--sombra); }
.dp .num { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--card2); font-weight: 700; flex: none; }
.dp .dp-nome { flex: 1; min-width: 0; }
.dp.inativo { opacity: .55; }

/* ---------- ChatBot ---------- */
.bot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.chave { display: flex; gap: 10px; align-items: flex-start; padding: 12px; background: var(--card2); border-radius: 14px; }
.chave input { width: auto; margin-top: 3px; }
.chave small { display: block; font-weight: 400; }
.resp { border: 1px solid var(--borda-forte); border-radius: 14px; padding: 10px; margin-bottom: 10px; display: grid; gap: 6px; }
.resp-topo { display: flex; gap: 6px; }
.previa { background: var(--fundo); border-radius: 14px; padding: 14px; }
.previa .bolha { max-width: 100%; }

/* ---------- WhatsApp ---------- */
.wa-cartao { max-width: 520px; text-align: center; }
.wa-cartao img { width: 260px; max-width: 100%; border-radius: 10px; background: #fff; padding: 8px; margin: 12px auto; display: block; }
.wa-cartao ol { text-align: left; margin: 10px 0 14px 20px; color: var(--suave); }
.wa-estado { font-size: 1.05rem; font-weight: 700; margin-bottom: 6px; }

/* ---------- Modal / toast ---------- */
.modal-fundo { position: fixed; inset: 0; background: rgba(4,12,22,.45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: 100%; max-width: 480px; max-height: 92vh; overflow: auto; background: var(--card-solido); border-radius: 20px; padding: 22px; box-shadow: var(--sombra-lg); }
.modal h2 { font-size: 1.1rem; margin-bottom: 14px; }
.modal-botoes { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; margin: 0; padding: 6px 10px; border: 1px solid var(--borda-forte); border-radius: 99px; cursor: pointer; }
.checks input { width: auto; }
.aviso { font-size: .84rem; background: color-mix(in srgb, var(--alerta) 12%, transparent); color: var(--texto); border-radius: 9px; padding: 9px 11px; margin-bottom: 12px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--titulo); color: var(--bg); padding: 10px 18px; border-radius: 14px; z-index: 60; box-shadow: var(--sombra-lg); max-width: calc(100% - 32px); }
.toast.erro { background: var(--erro); color: #fff; }

/* ---------- Celular ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr auto; gap: 0; padding: 0; }
  .nav { grid-row: 2; flex-direction: row; overflow-x: auto; padding: 6px; border-radius: 0; gap: 2px; }
  .conv { gap: 0; }
  .conv-lista, .chat { border-radius: 0; }
  .nav-item.ativo { box-shadow: none; }
  .nav-item .ico { width: 20px; height: 20px; }
  .nav-rodape { background: none; }
  .nav-topo, .nav-grupo, .eu { display: none; }
  .nav-item { flex-direction: column; gap: 1px; font-size: .7rem; padding: 6px 8px; width: auto; min-width: 64px; align-items: center; position: relative; }
  .nav-item .badge { position: absolute; top: 0; right: 4px; }
  .nav-rodape { margin: 0 0 0 auto; border: 0; padding: 0; display: flex; align-items: center; }
  .view { padding: 16px; }
  .conv { grid-template-columns: 1fr; }
  .conv.com-chat .conv-lista { display: none; }
  .conv:not(.com-chat) .chat { display: none; }
  .voltar { display: inline-block; }
  .msgs { padding: 8px 12px 12px; }
  .bolha { max-width: 88%; }
  .compor, .compor-aviso { margin: 4px 8px 8px; }
  .chat-topo { padding: 10px 12px; }
  .bot-grid { grid-template-columns: 1fr; }
  .chat-acoes .btn { font-size: .78rem; padding: 5px 8px; }
}
.conv-topo input { flex: 1; min-width: 0; }
.conv-topo .btn { flex: none; }
@media (max-width: 860px) {
  .chat-acoes { width: 100%; }
  .chat-acoes .btn { flex: 1; }
  .nav-item { min-width: 58px; font-size: .66rem; }
}

/* ---------- Configurações: horário ---------- */
.dias { display: grid; gap: 6px; margin: 12px 0; }
.dia-linha { display: grid; grid-template-columns: 110px 1fr 1fr; gap: 8px; align-items: center; }
.dia-linha label { margin: 0; display: flex; gap: 8px; align-items: center; font-weight: 600; }
.dia-linha label input { width: auto; margin: 0; }
.dia-linha input[type="time"] { padding: 6px 8px; }
.dia-linha.fechado input[type="time"] { opacity: .35; }
.dias.desligado { opacity: .5; }
.bot-grid > * { min-width: 0; }
.dia-linha > * { min-width: 0; }
@media (max-width: 860px) {
  .dia-linha { grid-template-columns: 92px 1fr 1fr; gap: 6px; }
  .dia-linha input[type="time"] { padding: 6px 4px; }
}

/* ---- Logo do cliente ---- */
.marca-login { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin-bottom: 22px; }
.marca-login strong { font-family: Outfit, sans-serif; font-size: 1.15rem; color: var(--titulo); }
.marca-login small { color: var(--suave); }
.logo-marca { max-width: 200px; max-height: 72px; object-fit: contain; margin-bottom: 6px; }
.logo-nav { width: 40px; height: 40px; object-fit: contain; border-radius: 12px; flex: none; }
.logo-edicao { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.logo-previa { width: 160px; height: 96px; display: grid; place-items: center; border: 1px dashed var(--borda-forte); border-radius: var(--r); background: var(--card2); padding: 10px; }
.logo-previa img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-botoes { display: flex; flex-direction: column; gap: 8px; }
.logo-botoes label.btn { cursor: pointer; text-align: center; }

/* ---------- Arquivos e áudio ---------- */
.chat-cheio { position: relative; }
.compor { align-items: center; }
.compor-ic { color: var(--suave); padding: 8px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.compor-ic:hover { color: var(--brand); }
.compor-mic, .compor-env { flex: none; }
.compor-mic { width: 42px; height: 40px; padding: 0; display: grid; place-items: center; touch-action: none; user-select: none; -webkit-user-select: none; }
.compor-mic.gravando-agora { background: var(--erro); color: #fff; transform: scale(1.12); box-shadow: 0 0 0 6px color-mix(in srgb, var(--erro) 18%, transparent); }
.gravando { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 4px; }
.gravando #grav-lixo { color: var(--erro); }
.grav-ponto { width: 10px; height: 10px; border-radius: 50%; background: var(--erro); animation: piscar 1s infinite; }
.grav-tempo { font-variant-numeric: tabular-nums; font-weight: 600; }
.grav-dica { color: var(--suave); font-size: .85rem; margin-left: auto; margin-right: 8px; }
@keyframes piscar { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .grav-ponto { animation: none; } .compor-mic.gravando-agora { transform: none; } }

.bolha.com-midia { padding: 5px 5px 4px; }
.bolha.com-midia .meta { padding: 0 8px 2px; }
.bolha.midia-audio, .bolha.midia-documento { padding: 8px 10px 5px; }
.bolha.midia-audio .meta, .bolha.midia-documento .meta { padding: 0; }
.bolha.midia-imagem, .bolha.midia-video { max-width: min(352px, 88%); }
.midia-img { display: block; max-width: min(320px, 100%); max-height: 340px; border-radius: 14px; cursor: zoom-in; background: var(--card2); }
.bolha.midia-figurinha { background: transparent !important; box-shadow: none; }
.bolha.midia-figurinha .midia-img { max-width: 150px; background: none; }
.midia-video { display: block; max-width: min(340px, 100%); max-height: 360px; border-radius: 14px; background: #000; }
.legenda { padding: 6px 8px 0; }
.midia-falta { font-style: italic; opacity: .8; }

.audio { display: flex; align-items: center; gap: 10px; width: min(300px, 62vw); }
.audio-play { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; flex: none; background: var(--brand); color: var(--btn-texto); }
.bolha.saida .audio-play { background: rgba(255,255,255,.95); color: var(--brand); }
.audio-meio { flex: 1; min-width: 0; }
.audio-barra { height: 16px; display: flex; align-items: center; cursor: pointer; }
.audio-barra::before { content: none; }
.audio-barra { background: linear-gradient(currentColor, currentColor) center / 100% 4px no-repeat; color: color-mix(in srgb, var(--suave) 35%, transparent); position: relative; border-radius: 99px; }
.bolha.saida .audio-barra { color: rgba(255,255,255,.35); }
.audio-prog { height: 4px; width: 0; border-radius: 99px; background: var(--brand); position: relative; }
.bolha.saida .audio-prog { background: #fff; }
.audio-prog::after { content: ""; position: absolute; right: -6px; top: -4px; width: 12px; height: 12px; border-radius: 50%; background: inherit; }
.audio-info { display: flex; align-items: center; gap: 4px; font-size: .74rem; opacity: .8; font-variant-numeric: tabular-nums; }
.audio-info .ico { width: 13px; height: 13px; }
.audio-vel { border: 0; font: inherit; font-size: .74rem; font-weight: 700; padding: 3px 7px; border-radius: 99px; cursor: pointer; flex: none; background: color-mix(in srgb, var(--suave) 16%, transparent); color: inherit; }
.bolha.saida .audio-vel { background: rgba(255,255,255,.2); }

.doc { display: flex; align-items: center; gap: 10px; width: min(300px, 62vw); padding: 8px; border-radius: 12px; background: color-mix(in srgb, var(--suave) 10%, transparent); color: inherit; text-decoration: none; }
.bolha.saida .doc { background: rgba(255,255,255,.16); }
.doc:hover { background: color-mix(in srgb, var(--suave) 18%, transparent); }
.doc-ic { width: 40px; height: 46px; border-radius: 8px; display: grid; place-items: center; font-size: .66rem; font-weight: 700; letter-spacing: .03em; background: var(--brand); color: var(--btn-texto); flex: none; }
.bolha.saida .doc-ic { background: #fff; color: var(--brand); }
.doc-txt { flex: 1; min-width: 0; }
.doc-txt strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.doc-txt small, .bolha.saida .doc-txt small { color: inherit; opacity: .75; }

.soltar { position: absolute; inset: 10px; z-index: 5; border: 2px dashed var(--brand); border-radius: var(--r); background: color-mix(in srgb, var(--card-solido) 88%, transparent); display: grid; place-items: center; text-align: center; pointer-events: none; }
.soltar div { display: grid; justify-items: center; gap: 4px; }
.soltar .ico { width: 34px; height: 34px; color: var(--brand); }
.soltar strong { font-family: Outfit, sans-serif; font-size: 1.2rem; color: var(--titulo); }

.anexos { display: grid; gap: 8px; margin-bottom: 12px; max-height: 300px; overflow: auto; }
.anexo { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; background: var(--card2); }
.anexo img { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; flex: none; }
.anexo span { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.anexo small { display: block; font-weight: 400; }

.visor { position: fixed; inset: 0; z-index: 70; background: rgba(4,10,20,.88); display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 20px; gap: 12px; }
.visor img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; min-height: 0; }
.visor-acoes { display: flex; gap: 8px; }

/* ---------- Chat interno ---------- */
#view-interno { padding: 0; max-width: none; height: 100%; }
.int-topo { padding: 16px 16px 6px; }
.int-topo h2 { margin-bottom: 2px; }
.int-topo small { font-size: .8rem; }
.int-grupo { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--suave); font-weight: 600; padding: 12px 10px 2px; }
.avatar.sala { font-family: Outfit, sans-serif; font-size: 1.05rem; }
.bolha .autor { display: block; font-size: .76rem; font-weight: 700; margin-bottom: 1px; color: hsl(var(--h, 205) 60% 40%); }
:root[data-theme="dark"] .bolha .autor { color: hsl(var(--h, 205) 70% 72%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bolha .autor { color: hsl(var(--h, 205) 70% 72%); } }
.ico.grande { width: 44px; height: 44px; color: var(--brand); }
