/* Contato com Madruga — mesmo sistema visual "professional" do painel (claro/escuro). */
:root {
  --bg: #f0f2f5; --card: #ffffff; --panel: #f5f6f6; --line: #d1d7db; --line2: #e9edef;
  --txt: #111b21; --mut: #667781; --acc: #00a884; --acc2: #008f72; --acc-suave: #e7f8f3; --acc-txt: #fff;
  --ok: #16805c; --err: #d93a4a; --warn: #9a650b; --warn-bg: #fff7e6; --err-bg: #fff2f2; --ok-bg: #effaf5;
  --bolha-eu: #d9fdd3; --bolha-eu-txt: #111b21; --bolha-ele: #ffffff; --bolha-ele-txt: #111b21;
  --chat-bg: #efeae2; --chat-papel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M30 40h40a8 8 0 0 1 8 8v20a8 8 0 0 1-8 8H48l-12 10v-10h-6a8 8 0 0 1-8-8V48a8 8 0 0 1 8-8z'/%3E%3Cpath d='M190 50c-6-10-22-6-20 6 2 9 20 20 20 20s18-11 20-20c2-12-14-16-20-6z'/%3E%3Cpath d='M120 120l6 12 13 2-9 9 2 13-12-6-12 6 2-13-9-9 13-2z'/%3E%3Cpath d='M40 170a8 8 0 0 1 8-8h6l4 10-5 4a40 40 0 0 0 18 18l4-5 10 4v6a8 8 0 0 1-8 8c-22 0-37-15-37-37z'/%3E%3Cpath d='M170 190h50l-6-14a6 6 0 0 0-5-4h-28a6 6 0 0 0-5 4zM166 190v12h58v-12M176 202v6M214 202v6'/%3E%3Ccircle cx='220' cy='130' r='14'/%3E%3Cpath d='M220 122v8l6 4M100 230l10-10 10 10 10-10'/%3E%3Ccircle cx='110' cy='40' r='4'/%3E%3Ccircle cx='20' cy='120' r='3'/%3E%3Ccircle cx='240' cy='245' r='3'/%3E%3C/svg%3E"); --chat-papel-op: .06;
  --sis-bg: #ffffff; --sis-txt: #54656f; --dia-bg: #ffffff; --dia-txt: #54656f; --aviso-bg: #ffeecd; --aviso-txt: #54656f;
  --meta: #667781; --meta-eu: #667781; --tique-lido: #53bdeb; --cit-bg: rgba(11,20,26,.05); --cit-cor-minha: #06a77d; --cit-cor-dele: #027eb5;
  --mut-msg: #667781; --reac-bg: #ffffff; --menu-bg: #ffffff; --compositor-bg: #f0f2f5; --caixa-bg: #ffffff; --icone: #54656f;
  --audio-cor: #00a884; --link: #027eb5; --txt-msg-forte: #111b21; --seta-fundo: #fff;
  --sombra: 0 2px 6px rgba(11,20,26,.04), 0 14px 38px rgba(11,20,26,.035);
  --fonte: "Segoe UI", Inter, ui-sans-serif, system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --app-h: 100dvh;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #111b21; --card: #202c33; --panel: #2a3942; --line: #313d45; --line2: #222d34;
  --txt: #e9edef; --mut: #8696a0; --acc: #00a884; --acc2: #06cf9c; --acc-suave: #103529; --acc-txt: #111b21;
  --ok: #70d3aa; --err: #f15c6d; --warn: #f2c477; --warn-bg: #322a1d; --err-bg: #44232d; --ok-bg: #123a32;
  --bolha-eu: #005c4b; --bolha-eu-txt: #e9edef; --bolha-ele: #202c33; --bolha-ele-txt: #e9edef;
  --chat-bg: #0b141a; --chat-papel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M30 40h40a8 8 0 0 1 8 8v20a8 8 0 0 1-8 8H48l-12 10v-10h-6a8 8 0 0 1-8-8V48a8 8 0 0 1 8-8z'/%3E%3Cpath d='M190 50c-6-10-22-6-20 6 2 9 20 20 20 20s18-11 20-20c2-12-14-16-20-6z'/%3E%3Cpath d='M120 120l6 12 13 2-9 9 2 13-12-6-12 6 2-13-9-9 13-2z'/%3E%3Cpath d='M40 170a8 8 0 0 1 8-8h6l4 10-5 4a40 40 0 0 0 18 18l4-5 10 4v6a8 8 0 0 1-8 8c-22 0-37-15-37-37z'/%3E%3Cpath d='M170 190h50l-6-14a6 6 0 0 0-5-4h-28a6 6 0 0 0-5 4zM166 190v12h58v-12M176 202v6M214 202v6'/%3E%3Ccircle cx='220' cy='130' r='14'/%3E%3Cpath d='M220 122v8l6 4M100 230l10-10 10 10 10-10'/%3E%3Ccircle cx='110' cy='40' r='4'/%3E%3Ccircle cx='20' cy='120' r='3'/%3E%3Ccircle cx='240' cy='245' r='3'/%3E%3C/svg%3E"); --chat-papel-op: .045;
  --sis-bg: #182229; --sis-txt: #8696a0; --dia-bg: #182229; --dia-txt: #8696a0; --aviso-bg: #182229; --aviso-txt: #ffd279;
  --meta: rgba(233,237,239,.6); --meta-eu: rgba(233,237,239,.6); --tique-lido: #53bdeb; --cit-bg: rgba(0,0,0,.2); --cit-cor-minha: #06cf9c; --cit-cor-dele: #53bdeb;
  --mut-msg: rgba(233,237,239,.6); --reac-bg: #202c33; --menu-bg: #233138; --compositor-bg: #202c33; --caixa-bg: #2a3942; --icone: #8696a0;
  --audio-cor: #53bdeb; --link: #53bdeb; --txt-msg-forte: #e9edef; --seta-fundo: #202c33;
  --sombra: 0 10px 30px rgba(0,0,0,.15);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--txt); font-family: var(--fonte); font-size: 15px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
body { overflow: hidden; overscroll-behavior: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button, a, label, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: var(--acc); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--acc) 35%, transparent); outline-offset: 1px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── botões / campos ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 8px 14px; border-radius: 8px; border: 1px solid transparent; background: var(--acc); color: var(--acc-txt); font-weight: 650; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--acc2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sec { background: var(--card); color: var(--txt); border-color: var(--line); }
.btn.sec:hover { background: var(--acc-suave); color: var(--acc); border-color: color-mix(in srgb, var(--acc) 40%, var(--line)); }
.btn.perigo { background: var(--err); color: #fff; }
.btn.peq { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn.icone { width: 40px; padding: 0; }
.campo { display: grid; gap: 5px; margin-bottom: 12px; }
.campo > span { font-size: 12.5px; font-weight: 650; color: var(--mut); }
.campo small { color: var(--mut); font-size: 12px; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
  width: 100%; min-height: 40px; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--txt);
}
html[data-theme="dark"] :is(input:not([type="checkbox"]):not([type="radio"]), select, textarea) { background: #2a3942; border-color: #3b4a54; }
textarea { resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: var(--acc); outline: 3px solid color-mix(in srgb, var(--acc) 16%, transparent); outline-offset: 0; }
.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 560px) { .grade2 { grid-template-columns: 1fr; } }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 650; background: var(--panel); border: 1px solid var(--line); color: var(--mut); white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--ok-bg); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.chip.err { color: var(--err); background: var(--err-bg); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.chip.warn { color: var(--warn); background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.chip.acc { color: var(--acc); background: var(--acc-suave); border-color: color-mix(in srgb, var(--acc) 35%, transparent); }
.selo { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--acc); color: var(--acc-txt); font-size: 11.5px; font-weight: 750; display: inline-grid; place-items: center; }
.selo[hidden] { display: none; }
.alerta { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; border: 1px solid var(--line); background: var(--panel); }
.alerta.warn { background: var(--warn-bg); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.alerta.err { background: var(--err-bg); color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, transparent); }
.alerta.ok { background: var(--ok-bg); color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.mut { color: var(--mut); }
.vazio-msg { color: var(--mut); text-align: center; padding: 28px 16px; font-size: 14px; }

/* ── estrutura ── */
/* fixo na área visível: com o teclado aberto o iOS encolhe o visualViewport e a caixa acompanha */
.app { position: fixed; left: 0; right: 0; top: var(--app-top, 0px); height: var(--app-h); display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.topo { display: flex; align-items: center; gap: 10px; padding: 10px clamp(12px, 2.5vw, 24px); padding-top: max(10px, env(safe-area-inset-top)); background: var(--card); border-bottom: 1px solid var(--line); min-width: 0; }
.marca { display: inline-flex; align-items: center; font-weight: 750; letter-spacing: -.03em; font-size: 17px; color: var(--txt); text-decoration: none; white-space: nowrap; }
.marca::before { content: ""; width: 24px; height: 24px; margin-right: 9px; border-radius: 7px; background: linear-gradient(145deg, #4774e0, #224ba9); flex: none; }
html[data-theme="dark"] .marca::before { background: linear-gradient(145deg, #779cf4, #426bd2); }
.marca b { color: var(--acc); font-weight: 750; }
.topo .titulo { font-weight: 650; color: var(--mut); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo .esp { flex: 1; }
.topo .acoes { display: flex; gap: 8px; align-items: center; }
.corpo { display: grid; grid-template-columns: minmax(270px, 340px) 1fr; min-height: 0; }
.lado { border-right: 1px solid var(--line); background: var(--card); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.principal { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: var(--bg); }
.vista { display: none; flex: 1; min-height: 0; flex-direction: column; }
.vista.ativa { display: flex; }
.rolavel { overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.conteudo { padding: clamp(14px, 2.5vw, 26px); max-width: 860px; width: 100%; margin: 0 auto; }
.conteudo h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -.02em; }
.conteudo h3 { margin: 22px 0 8px; font-size: 15px; }
.cartao { background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sombra); padding: 16px; margin-bottom: 14px; }
.cabeca-vista { display: flex; align-items: center; gap: 10px; padding: 8px 14px; background: var(--compositor-bg); border-bottom: 1px solid var(--line); min-height: 56px; }
.cabeca-vista .nome { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cabeca-vista .sub { font-size: 12.5px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cabeca-vista .txt { min-width: 0; flex: 1; }
.voltar { display: none; }

/* lista lateral */
.lado-topo { padding: 14px 14px 10px; border-bottom: 1px solid var(--line2); display: grid; gap: 10px; }
.lado-topo h1 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.abas { display: flex; flex-wrap: wrap; gap: 4px; }
.aba { flex: none; border: 1px solid transparent; background: transparent; padding: 6px 10px; border-radius: 8px; font-size: 13px; font-weight: 650; color: var(--mut); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.aba:hover { color: var(--txt); background: var(--panel); }
.aba.ativa { color: var(--acc); background: var(--acc-suave); border-color: color-mix(in srgb, var(--acc) 30%, transparent); }
.filtros { display: flex; gap: 6px; flex-wrap: wrap; }
.filtro { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; cursor: pointer; color: var(--mut); }
.filtro.ativa { color: var(--acc); border-color: color-mix(in srgb, var(--acc) 45%, var(--line)); background: var(--acc-suave); }
.lista { flex: 1; min-height: 0; }
.item { display: flex; gap: 11px; align-items: center; width: 100%; padding: 11px 14px; border: 0; border-bottom: 1px solid var(--line2); background: transparent; text-align: left; cursor: pointer; color: var(--txt); min-height: 64px; }
.item:hover { background: var(--panel); }
.item.ativo { background: var(--panel); }
.item .av { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 750; font-size: 15px; background: var(--acc-suave); color: var(--acc); text-transform: uppercase; }
.item.ativo .av { background: var(--card); }
.item .meio { flex: 1; min-width: 0; }
.item .l1 { display: flex; gap: 8px; align-items: baseline; }
.item .n { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.item .h { font-size: 12px; color: var(--mut); flex: none; }
.item .l2 { display: flex; gap: 6px; align-items: center; margin-top: 2px; font-size: 12.5px; color: var(--mut); min-width: 0; }
.item .l2 .t { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.item.nao-lida .n, .item.nao-lida .h { color: var(--txt); }
.item.nao-lida .h { color: var(--acc); font-weight: 700; }
.item .on { width: 10px; height: 10px; border-radius: 50%; background: var(--acc); border: 2px solid var(--card); position: absolute; right: 0; bottom: 1px; }
.item .av { position: relative; }
.lado-rodape { padding: 10px 14px; padding-bottom: max(10px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line2); font-size: 12.5px; color: var(--mut); }

/* ── chat (visual do WhatsApp) ── */
.chat { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; background: var(--chat-bg); }
.chat::before { content: ""; position: absolute; inset: 0; background-image: var(--chat-papel); background-size: 260px; opacity: var(--chat-papel-op); pointer-events: none; }
.chat > * { position: relative; }
.faixa { display: flex; gap: 8px; align-items: center; justify-content: center; padding: 6px 12px; font-size: 12px; color: var(--mut); background: var(--panel); border-bottom: 1px solid var(--line2); text-align: center; }
.faixa.conexao { color: var(--warn); background: var(--warn-bg); }
.faixa.conexao.err { color: var(--err); background: var(--err-bg); }
.faixa[hidden] { display: none; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 10px clamp(12px, 5vw, 64px) 10px; display: flex; flex-direction: column; gap: 2px; }
.msgs .sistema, .msgs .dia { align-self: center; margin: 8px 0 6px; font-size: 12.5px; color: var(--sis-txt); background: var(--sis-bg); padding: 5px 12px; border-radius: 8px; box-shadow: 0 1px .5px rgba(11,20,26,.13); text-align: center; max-width: 92%; }
.msgs .dia { text-transform: uppercase; font-size: 12px; letter-spacing: .02em; color: var(--dia-txt); background: var(--dia-bg); }
.msgs .sistema.aviso { display: inline-flex; gap: 6px; align-items: center; color: var(--aviso-txt); background: var(--aviso-bg); }
.msgs .sistema .ic svg { width: 14px; height: 14px; }
.nao-lidas { align-self: stretch; margin: 10px -64px 8px; padding: 6px; text-align: center; font-size: 12.5px; font-weight: 600; color: var(--dia-txt); background: color-mix(in srgb, var(--card) 70%, transparent); text-transform: uppercase; }
.ic { display: inline-grid; place-items: center; line-height: 0; }
.ic svg { width: 20px; height: 20px; }

.msg { max-width: min(78%, 620px); display: flex; flex-direction: column; position: relative; touch-action: pan-y; transition: transform .15s; }
.msg.eu { align-self: flex-end; align-items: flex-end; }
.msg.ele { align-self: flex-start; align-items: flex-start; }
.msg.cauda { margin-top: 8px; }
.msg.reagiu-espaco, .msg:has(.reac:not([hidden])) { margin-bottom: 14px; }
.bolha { position: relative; padding: 6px 8px 8px 9px; border-radius: 7.5px; white-space: pre-wrap; overflow-wrap: anywhere; word-break: break-word; font-size: 14.5px; line-height: 1.38; box-shadow: 0 1px .5px rgba(11,20,26,.13); min-width: 64px; }
.msg.eu .bolha { background: var(--bolha-eu); color: var(--bolha-eu-txt); }
.msg.ele .bolha { background: var(--bolha-ele); color: var(--bolha-ele-txt); }
/* "rabinho" só na primeira bolha do grupo */
.msg.cauda.eu .bolha { border-top-right-radius: 0; }
.msg.cauda.ele .bolha { border-top-left-radius: 0; }
.msg.cauda.eu .bolha::before, .msg.cauda.ele .bolha::before { content: ""; position: absolute; top: 0; width: 8px; height: 13px; }
.msg.cauda.eu .bolha::before { right: -8px; background: var(--bolha-eu); clip-path: polygon(0 0, 100% 0, 0 100%); }
.msg.cauda.ele .bolha::before { left: -8px; background: var(--bolha-ele); clip-path: polygon(0 0, 100% 0, 100% 100%); }
.msg-txt a { color: var(--link); text-decoration: underline; }
.msg-txt em, .msg-txt s, .msg-txt strong { white-space: pre-wrap; }
/* hora + tiques dentro da bolha, à direita, sem quebrar o texto */
.meta { float: right; display: inline-flex; gap: 4px; align-items: center; margin: 7px 0 -6px 10px; font-size: 11px; line-height: 15px; color: var(--meta); white-space: nowrap; position: relative; top: 3px; user-select: none; }
.msg.eu .meta { color: var(--meta-eu); }
.meta .editada { font-style: italic; }
.meta .exp { display: inline-flex; gap: 2px; align-items: center; color: var(--meta); opacity: .95; }
.msg.eu .meta .exp { color: var(--meta-eu); }
.meta .exp .ic svg { width: 12px; height: 12px; }
.meta .tk { display: inline-flex; color: var(--meta-eu); }
.meta .tk svg { height: 11px; width: auto; }
.meta .tk.lida { color: var(--tique-lido); }
.meta .tk-env svg { width: 13px; height: 13px; }
.meta .tk-erro { color: var(--err); }
.meta .tk-erro svg { width: 14px; height: 14px; }
.cit-box[hidden] { display: none; }
.cit { display: grid; gap: 1px; width: 100%; text-align: left; border: 0; margin: 0 0 5px; padding: 5px 8px 6px 10px; border-radius: 6px; background: var(--cit-bg); color: inherit; font: inherit; font-size: 13px; line-height: 1.3; cursor: pointer; position: relative; overflow: hidden; min-width: 0; }
.cit::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--cit-cor-dele); }
.cit.minha::before { background: var(--cit-cor-minha); }
.cit strong { color: var(--cit-cor-dele); font-size: 12.8px; }
.cit.minha strong { color: var(--cit-cor-minha); }
.cit span { color: var(--mut-msg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.msg.eu .cit span { color: var(--meta-eu); }
.bolha[data-tipo="apagada"] .msg-txt { display: inline-flex; gap: 6px; align-items: center; color: var(--mut-msg); }
.msg.eu .bolha[data-tipo="apagada"] .msg-txt { color: var(--meta-eu); }
.bolha[data-tipo="apagada"] .msg-txt .ic svg { width: 16px; height: 16px; }
.seta-menu { position: absolute; top: 2px; right: 2px; width: 26px; height: 22px; border: 0; border-radius: 0 7px 0 12px; display: grid; place-items: center; cursor: pointer; opacity: 0; color: var(--meta); background: linear-gradient(to left, var(--seta-fundo) 60%, transparent); transition: opacity .12s; }
.msg.eu .seta-menu { background: linear-gradient(to left, var(--bolha-eu) 60%, transparent); color: var(--meta-eu); }
.msg.ele .seta-menu { background: linear-gradient(to left, var(--bolha-ele) 60%, transparent); }
.seta-menu .ic svg { width: 18px; height: 18px; }
.msg:hover .seta-menu, .msg.em-menu .seta-menu, .seta-menu:focus-visible { opacity: 1; }
.msg.em-menu .bolha { filter: brightness(.94); }
.msg.pisca .bolha { animation: pisca-msg 1.4s ease; }
@keyframes pisca-msg { 0%, 60% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 55%, transparent); } 100% { box-shadow: 0 1px .5px rgba(11,20,26,.13); } }
.msg.vai-responder::after { content: "↩"; position: absolute; left: -30px; top: 50%; transform: translateY(-50%); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--card); color: var(--mut); font-size: 14px; box-shadow: var(--sombra); }
.reac { position: absolute; bottom: -14px; z-index: 1; }
.msg.eu .reac, .msg.ele .reac { left: 10px; }
.reac[hidden] { display: none; }
.reac-btn { display: inline-flex; gap: 2px; align-items: center; border: 2px solid var(--chat-bg); background: var(--reac-bg); border-radius: 999px; padding: 1px 6px; font-size: 14px; line-height: 20px; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.15); color: var(--txt); }
.reac-btn .n { font-size: 11px; color: var(--mut); }
.falha { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--err); margin: 3px 4px 0; }
.falha[hidden] { display: none; }
.msg.falhou .bolha { opacity: .75; }
.msg.enviando .bolha { opacity: .85; }
.reenviar { border: 0; background: none; color: var(--err); text-decoration: underline; cursor: pointer; padding: 0; font-size: 11.5px; }
.descer { position: absolute; right: 16px; bottom: calc(var(--composer-h, 62px) + 14px); width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--card); color: var(--mut); box-shadow: 0 1px 4px rgba(11,20,26,.25); cursor: pointer; z-index: 3; display: grid; place-items: center; }
.descer[hidden] { display: none; }
.descer .selo { position: absolute; top: -6px; right: -4px; background: var(--acc); color: var(--acc-txt); }
.descer .selo[hidden] { display: none; }
/* menu da mensagem */
.menu-msg { position: fixed; z-index: 1500; min-width: 200px; background: var(--menu-bg); color: var(--txt); border-radius: 14px; box-shadow: 0 6px 24px rgba(11,20,26,.28); padding: 6px 0; animation: surge .12s ease-out; }
.menu-msg[hidden] { display: none; }
@keyframes surge { from { opacity: 0; transform: scale(.96); } }
.reacoes-op { display: flex; gap: 2px; padding: 4px 8px 8px; border-bottom: 1px solid var(--line2); margin-bottom: 4px; }
.reacoes-op .em { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; font-size: 22px; cursor: pointer; transition: transform .1s; }
.reacoes-op .em:hover { transform: scale(1.2); background: var(--panel); }
.reacoes-op .em.minha { background: var(--acc-suave); }
.menu-msg .op { display: flex; gap: 14px; align-items: center; width: 100%; border: 0; background: none; padding: 10px 18px; font-size: 14.5px; cursor: pointer; color: var(--txt); text-align: left; }
.menu-msg .op:hover, .menu-msg .op:focus-visible { background: var(--panel); outline: none; }
.menu-msg .op .ic { color: var(--mut); }
.menu-msg .op .ic svg { width: 19px; height: 19px; }
.menu-msg .op.perigo, .menu-msg .op.perigo .ic { color: var(--err); }
.toast { position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2500; background: #323739; color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 4px 18px rgba(0,0,0,.3); transition: opacity .3s; max-width: calc(100vw - 32px); }
.toast.sai { opacity: 0; }
dialog.escolha { width: min(420px, calc(100vw - 32px)) !important; height: auto !important; max-height: none !important; margin: auto !important; border-radius: 14px !important; border: 0 !important; }
.escolha .dlg-corpo { padding: 22px 24px 8px; }
.escolha-tit { font-size: 16px; font-weight: 500; margin: 0 0 6px; }
.escolha-ops { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; padding: 10px 18px 18px; }
.escolha-ops .btn { min-width: 180px; border-radius: 999px; }
.btn.perigo-txt { background: transparent; color: var(--acc); border: 1px solid var(--line); }
.btn.perigo-txt.forte { background: var(--acc); color: var(--acc-txt); border-color: transparent; }

/* compositor */
.composer { background: var(--compositor-bg); padding: 6px clamp(8px, 2vw, 16px); padding-bottom: max(6px, env(safe-area-inset-bottom)); display: grid; gap: 6px; border-top: 1px solid var(--line2); }
.composer .atalhos { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.composer .atalhos::-webkit-scrollbar { display: none; }
.chip-atalho { flex: none; border: 1px solid var(--line); background: var(--card); color: var(--acc); border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 600; cursor: pointer; }
.composer .linha { display: flex; gap: 6px; align-items: flex-end; }
.pilula { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 2px; background: var(--caixa-bg); border-radius: 24px; padding: 2px 6px; box-shadow: 0 1px .5px rgba(11,20,26,.08); }
.pilula textarea { flex: 1; min-height: 42px; max-height: 140px; resize: none; border: 0 !important; outline: 0 !important; background: transparent !important; padding: 11px 4px; line-height: 1.35; font-size: 16px; /* 16px: o iOS não dá zoom no foco */ border-radius: 0; box-shadow: none; }
.plano { width: 40px; height: 42px; flex: none; border: 0; background: transparent; color: var(--icone); border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.plano:hover { color: var(--txt); }
.plano.ativo { color: var(--acc); }
.plano .ic svg { width: 22px; height: 22px; }
.redondo { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: var(--acc); color: var(--acc-txt); box-shadow: 0 1px 2px rgba(11,20,26,.2); }
.redondo:hover { background: var(--acc2); }
.redondo .ic svg { width: 22px; height: 22px; }
.barra-cit { display: flex; align-items: center; gap: 4px; background: var(--card); border-radius: 10px; padding: 4px; }
.barra-cit[hidden] { display: none; }
.barra-cit .cit { margin: 0; cursor: default; flex: 1; }
.barra-cit .cit.edicao::before { background: var(--acc); }
.barra-cit .cit.edicao strong { color: var(--acc); }
.painel-emoji { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); max-height: 220px; overflow-y: auto; background: var(--card); border-radius: 12px; padding: 6px; }
.painel-emoji[hidden] { display: none; }
.painel-emoji .em { border: 0; background: transparent; font-size: 24px; height: 42px; border-radius: 8px; cursor: pointer; }
.painel-emoji .em:hover { background: var(--panel); }
/* áudio: tocador na bolha */
.bolha[data-tipo="audio"] { padding: 6px 8px 8px; white-space: normal; }
.audio { display: flex; align-items: center; gap: 8px; min-width: min(250px, 62vw); }
.audio .play { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: transparent; color: var(--icone); }
.audio .play svg { width: 26px; height: 26px; }
.audio .play:disabled { opacity: .6; cursor: progress; }
.trilha-box { flex: 1; display: grid; gap: 4px; padding-top: 12px; }
.audio .trilha { height: 4px; border-radius: 999px; background: color-mix(in srgb, var(--meta) 45%, transparent); cursor: pointer; position: relative; }
.audio .prog { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--audio-cor); border-radius: 999px; }
.audio .ponto { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: var(--audio-cor); }
.audio .tempo-audio { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--meta); }
.msg.eu .audio .tempo-audio { color: var(--meta-eu); }
.av-audio { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--acc); color: #fff; }
.msg.ele .av-audio { background: #7a8a94; }
.av-audio .ic svg { width: 20px; height: 20px; }
.baixar-audio { display: block; margin-top: 6px; font-size: 12px; color: inherit; text-decoration: underline; }
/* ligação no chat */
.bolha[data-tipo="chamada"] { white-space: normal; }
.chamada-box { display: flex; align-items: center; gap: 10px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 2px 4px 2px 0; text-align: left; min-width: 190px; }
.ic-chamada { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--cit-bg); color: var(--txt-msg-forte); }
.ic-chamada svg { width: 20px; height: 20px; }
.ic-chamada.perdida { color: var(--err); }
.chamada-txt { display: grid; }
.chamada-txt strong { font-weight: 500; }
.chamada-txt > span { display: inline-flex; align-items: center; gap: 3px; font-size: 12.5px; color: var(--mut-msg); }
.msg.eu .chamada-txt > span { color: var(--meta-eu); }
.seta-ch svg { width: 13px; height: 13px; }
.seta-ch { color: var(--acc); }
.seta-ch.perdida { color: var(--err); }
/* anexos: foto e arquivo */
.bolha[data-tipo="imagem"], .bolha[data-tipo="arquivo"] { padding: 3px 3px 6px; white-space: normal; }
.bolha[data-tipo="imagem"] .cit-box, .bolha[data-tipo="arquivo"] .cit-box { padding: 3px 3px 0; }
.foto-btn { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 6px; overflow: hidden; }
.foto { display: block; max-width: min(300px, 66vw); max-height: 340px; min-width: 140px; min-height: 90px; object-fit: cover; background: color-mix(in srgb, currentColor 10%, transparent); }
.foto-erro { display: block; padding: 18px; font-size: 13px; opacity: .8; }
.legenda { display: block; padding: 6px 6px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.legenda[hidden] { display: none; }
.bolha[data-tipo="imagem"] .meta, .bolha[data-tipo="arquivo"] .meta { margin-right: 4px; }
.doc { display: flex; align-items: center; gap: 10px; padding: 10px 8px; min-width: min(260px, 64vw); background: var(--cit-bg); border-radius: 6px; }
.doc-ic { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border-radius: 8px; background: color-mix(in srgb, currentColor 12%, transparent); }
.doc-ic svg { width: 22px; height: 22px; }
.doc-txt { flex: 1; min-width: 0; display: grid; }
.doc-nome { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-info { font-size: 12px; opacity: .75; }
.doc-baixar { flex: none; font-size: 13px; font-weight: 700; color: inherit; text-decoration: underline; padding: 6px; }
.previa-anexo { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--card); }
.previa-anexo img, .previa-anexo .doc-ic { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; flex: none; }
.previa-anexo .previa-txt { flex: 1; min-width: 0; display: grid; font-size: 13px; }
.previa-anexo .previa-txt strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.previa-anexo .previa-txt span { color: var(--mut); }
.chat.soltando::after { content: "Solte para anexar"; position: absolute; inset: 8px; display: grid; place-items: center; border: 2px dashed var(--acc); border-radius: 16px; background: color-mix(in srgb, var(--bg) 85%, transparent); color: var(--acc); font-weight: 700; z-index: 5; pointer-events: none; }
.visor { position: fixed; inset: 0; z-index: 2000; background: rgba(5,8,15,.92); display: grid; grid-template-rows: auto 1fr; padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom)); }
.visor-barra { display: flex; justify-content: flex-end; gap: 8px; }
.visor img { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; align-self: center; justify-self: center; min-height: 0; }
/* gravação */
.barra-grav { display: flex; align-items: center; gap: 10px; min-height: 46px; background: var(--caixa-bg); border-radius: 24px; padding: 0 0 0 4px; }
.barra-grav .ponto-grav { width: 10px; height: 10px; border-radius: 50%; background: var(--err); flex: none; animation: pisca 1s steps(2) infinite; }
.barra-grav .tempo-grav { font-weight: 600; font-variant-numeric: tabular-nums; }
.barra-grav .dica-grav { flex: 1; color: var(--mut); font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes pisca { 50% { opacity: .25; } }
.aviso-grav { font-size: 12.5px; color: var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 6px 10px; }
.carregando { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 30px; color: var(--mut); font-size: 14px; }
.carregando::before { content: ""; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--acc); animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* cabeçalho da conversa: status e botões de ligar */
.cabeca-vista .sub.online { color: var(--acc); }
.cabeca-vista .sub.atividade { color: var(--acc); font-style: italic; }
.botoes-lig { display: flex; gap: 2px; }
.botoes-lig .plano .ic svg { width: 21px; height: 21px; }

/* ── tela de ligação ── */
.ligacao { position: fixed; inset: 0; z-index: 3000; background: radial-gradient(circle at 50% 30%, #1f3a3a, #0b141a 70%); color: #e9edef; display: grid; grid-template-rows: auto 1fr auto; padding: max(14px, env(safe-area-inset-top)) 16px max(22px, env(safe-area-inset-bottom)); overflow: hidden; }
.ligacao[hidden] { display: none; }
.lig-remoto { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.ligacao.video.tem-video .lig-remoto { inset: 0; width: 100%; height: 100%; opacity: 1; object-fit: cover; background: #000; }
.lig-local { position: absolute; right: 14px; top: max(64px, calc(env(safe-area-inset-top) + 54px)); width: 104px; height: 148px; object-fit: cover; border-radius: 12px; background: #000; box-shadow: 0 4px 16px rgba(0,0,0,.4); transform: scaleX(-1); z-index: 2; }
.lig-local.traseira { transform: none; }
.lig-local.off { opacity: .25; }
.lig-local[hidden] { display: none; }
.lig-topo { display: flex; justify-content: flex-start; z-index: 2; }
.plano-lig { width: 44px; height: 44px; border: 0; background: rgba(255,255,255,.08); color: #e9edef; border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.plano-lig svg { width: 20px; height: 20px; }
.lig-info { align-self: start; margin-top: 8vh; display: grid; justify-items: center; gap: 10px; text-align: center; z-index: 1; }
.ligacao.video.tem-video .lig-info { margin-top: 0; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.ligacao.video.tem-video .lig-av { display: none; }
.lig-av { width: 112px; height: 112px; border-radius: 50%; display: grid; place-items: center; font-size: 46px; font-weight: 600; background: #2a3942; color: #d1d7db; margin-bottom: 8px; }
.ligacao[data-modo="chamando"] .lig-av, .ligacao[data-modo="recebendo"] .lig-av { animation: pulsa 1.6s ease-in-out infinite; }
@keyframes pulsa { 0%, 100% { box-shadow: 0 0 0 0 rgba(0,168,132,.45); } 50% { box-shadow: 0 0 0 22px rgba(0,168,132,0); } }
.lig-nome { font-size: 24px; font-weight: 500; }
.lig-status { font-size: 15px; color: #aebac1; font-variant-numeric: tabular-nums; }
.lig-ctrl { display: flex; justify-content: center; gap: clamp(14px, 6vw, 34px); z-index: 2; padding: 14px; border-radius: 22px; background: rgba(17,27,33,.55); justify-self: center; }
.lig-btn { width: 58px; height: 58px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgba(255,255,255,.14); color: #fff; }
.lig-btn svg { width: 24px; height: 24px; }
.lig-btn.off { background: #e9edef; color: #111b21; }
.lig-btn.verde { background: #00a884; }
.lig-btn.vermelho { background: #ea0038; }
.lig-btn.girado svg { transform: rotate(135deg); }
.ligacao[data-modo="recebendo"] .lig-btn { width: 64px; height: 64px; }
.lig-mini { display: none; }
/* minimizada: vira uma faixa verde no topo, a conversa continua usável */
.ligacao.mini { inset: auto 0 auto 0; top: 0; height: auto; padding: 0; background: none; display: block; }
.ligacao.mini > :not(.lig-mini):not(.lig-remoto) { display: none !important; }
.ligacao.mini .lig-remoto { position: absolute; width: 1px; height: 1px; opacity: 0; }
.ligacao.mini .lig-mini { display: block; width: 100%; border: 0; background: #00a884; color: #fff; font-weight: 600; font-size: 13.5px; padding: max(8px, env(safe-area-inset-top)) 12px 8px; cursor: pointer; text-align: center; }

/* ── diálogo ── */
dialog.dlg { border: 1px solid var(--line); border-radius: 16px; padding: 0; width: min(620px, calc(100vw - 32px)); max-height: calc(var(--app-h) - 32px); background: var(--card); color: var(--txt); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
dialog.dlg::backdrop { background: rgba(8,14,26,.55); }
dialog.dlg[open] { display: flex; flex-direction: column; }
.dlg-cab { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line2); }
.dlg-cab h2 { margin: 0; font-size: 17px; flex: 1; }
.dlg-corpo { padding: 16px; overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; flex: 1; }
.dlg-rodape { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line2); }

/* comunicado */
.comunicado { width: min(640px, calc(100vw - 24px)); }
.comunicado .dlg-cab { border-top: 4px solid var(--acc); border-radius: 16px 16px 0 0; }
.texto-com { font-size: 14.5px; line-height: 1.6; }
.texto-com p { margin: 0 0 12px; }
.texto-com h3 { font-size: 13px; letter-spacing: .06em; margin: 18px 0 10px; color: var(--acc); }
.texto-com strong { color: var(--txt); }

/* histórico (linha do tempo) */
.tempo { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tempo li { display: grid; grid-template-columns: 110px 1fr; gap: 10px; font-size: 13px; padding-bottom: 8px; border-bottom: 1px dashed var(--line2); }
.tempo li .q { color: var(--mut); }
@media (max-width: 560px) { .tempo li { grid-template-columns: 1fr; gap: 2px; } }
.tabela { width: 100%; border-collapse: collapse; font-size: 13px; }
.tabela th, .tabela td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.tabela th { color: var(--mut); font-weight: 650; font-size: 12px; }
.rolagem-x { overflow-x: auto; }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; font-size: 14px; margin: 0; }
.dl dt { color: var(--mut); }
.dl dd { margin: 0; overflow-wrap: anywhere; white-space: pre-wrap; }
.acoes-linha { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ── celular: uma tela por vez, chat em tela cheia ── */
@media (max-width: 820px) {
  body { font-size: 15px; }
  .corpo { grid-template-columns: 1fr; }
  .lado { border-right: 0; }
  .app[data-tela="lista"] .principal { display: none; }
  .app[data-tela="painel"] .lado { display: none; }
  .app[data-tela="painel"] { grid-template-rows: 1fr; }
  .app[data-tela="painel"] .topo { display: none; }
  .voltar { display: inline-flex; }
  .cabeca-vista { padding-top: max(10px, env(safe-area-inset-top)); }
  .msg { max-width: 86%; }
  .topo .titulo { display: none; }
  .tema-txt { display: none; }
  .composer .dica { display: none; }
  dialog.dlg { width: 100vw; max-width: 100vw; height: var(--app-h); max-height: var(--app-h); margin: 0; border-radius: 0; border: 0; }
  .comunicado { height: auto !important; max-height: calc(var(--app-h) - 24px) !important; width: calc(100vw - 24px) !important; margin: auto !important; border-radius: 16px !important; }
  .dlg-cab { padding-top: max(14px, env(safe-area-inset-top)); }
}
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
