/* GERADO por montar-frontend.js a partir de frontend/js/pacotes.js (grupo "fim"). NÃO EDITE: edite os css/ originais. */
/* ── botao-ajuda.css ── */
/* ══════════════════════════════════════════════════════
   Botão de ajuda do canto (js/botao-ajuda.js) · BKon OS
   Só para o CLIENTE logado. Cobalto da marca, ícone branco, 56 px.
   Computador: painel ancorado no botão (popover). Celular (html.bk-app): folha de baixo,
   e o botão fica ACIMA da barra de abas.
   Tokens do portal.css / ds.css; sem gradiente, sem animação em loop.
══════════════════════════════════════════════════════ */

:root {
  --bka-tam: 56px;
  --bka-margem: 24px;
  --bka-base: calc(var(--bka-margem) + env(safe-area-inset-bottom, 0px));
  --bka-direita: calc(var(--bka-margem) + env(safe-area-inset-right, 0px));
}

/* ── Botão ─────────────────────────────────────────── */
.bka-btn {
  position: fixed; right: var(--bka-direita); bottom: var(--bka-base); z-index: 80;
  width: var(--bka-tam); height: var(--bka-tam); border-radius: 50%;
  display: inline-grid; place-items: center; padding: 0; border: 0; cursor: pointer;
  background: #3C53DD; color: #fff;
  box-shadow: 0 2px 6px rgba(11, 17, 32, 0.18), 0 8px 20px rgba(11, 17, 32, 0.16);
  transition: background-color 120ms var(--easing), transform 160ms var(--easing-out), opacity 160ms var(--easing-out), visibility 0s linear 0s;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
[data-theme="dark"] .bka-btn { box-shadow: 0 2px 6px rgba(0, 0, 0, 0.40), 0 8px 22px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255, 255, 255, 0.06); }
@media (hover: hover) { .bka-btn:hover { background: #2F44C4; } }
.bka-btn:active { transform: scale(0.96); background: #283AA6; }
.bka-btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 3px; }
.bka-btn svg { grid-area: 1 / 1; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: opacity 140ms var(--easing-out), transform 160ms var(--easing-out); }
.bka-btn .bka-ic-fechar { opacity: 0; transform: rotate(-45deg) scale(0.8); }
.bka-btn[aria-expanded="true"] .bka-ic-abrir { opacity: 0; transform: rotate(45deg) scale(0.8); }
.bka-btn[aria-expanded="true"] .bka-ic-fechar { opacity: 1; transform: none; }
.bka-btn.is-oculto { opacity: 0; transform: scale(0.85); visibility: hidden; pointer-events: none; transition: opacity 120ms var(--easing), transform 120ms var(--easing), visibility 0s linear 120ms; }
.bka-btn[hidden] { display: none; }

/* Espaço no fim da página para o botão não tampar o último botão de salvar/enviar */
html.bka-on .main-content { padding-bottom: calc(var(--bka-tam) + var(--bka-margem) * 2 + 8px); }
/* O aviso (toast) sobe para não nascer embaixo do botão */
html.bka-on .toast { bottom: calc(var(--bka-base) + var(--bka-tam) + 12px); }

/* ── Painel ────────────────────────────────────────── */
.bka-painel {
  position: fixed; z-index: 85;
  right: var(--bka-direita); bottom: calc(var(--bka-base) + var(--bka-tam) + 12px);
  width: 372px; max-width: calc(100vw - 32px);
  max-height: min(600px, calc(100dvh - var(--bka-tam) - var(--bka-margem) * 2 - 28px));
  display: flex; flex-direction: column;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-strong); border-radius: var(--ds-r-xl, 16px);
  box-shadow: var(--ds-pop-shadow);
  transform-origin: calc(100% - 28px) calc(100% + 40px);
  animation: bka-entra 180ms var(--easing-out) both;
  overflow: hidden;
}
.bka-painel[hidden] { display: none; }
@keyframes bka-entra { from { opacity: 0; transform: translateY(8px) scale(0.97); } to { opacity: 1; transform: none; } }

.bka-fundo { display: none; }

.bka-topo { display: flex; align-items: center; gap: var(--ds-s2, 8px); padding: 14px 12px 10px 18px; border-bottom: 1px solid var(--border); flex: none; }
.bka-topo--com-voltar { padding-left: 8px; }
/* eram style="" no js/botao-ajuda.js: o widget roda em site de fora, que pode ter CSP sem 'unsafe-inline' */
.bka-topo__texto { flex: 1; min-width: 0; }
.bka-item__titulo.bka-item__titulo--quebra { white-space: normal; }
.form-help.bka-sem-margem { margin: 0; }
.bka-titulo { flex: 1; min-width: 0; margin: 0; font: 600 16px/1.3 var(--font-ui); letter-spacing: -0.01em; color: var(--text-primary); }
.bka-sub { margin: 2px 0 0; font: 400 var(--ds-fs-small, 13px)/1.4 var(--font-ui); color: var(--text-muted); }
.bka-icbtn { flex: none; width: 36px; height: 36px; display: inline-grid; place-items: center; border: 0; border-radius: var(--ds-r-md, 8px); background: transparent; color: var(--text-secondary); cursor: pointer; }
.bka-icbtn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .bka-icbtn:hover { background: var(--ds-hover); color: var(--text-primary); } }
.bka-icbtn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

.bka-corpo { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 8px; }
.bka-corpo:focus { outline: none; }

/* Lista de opções */
.bka-opcoes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bka-opcao {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 10px;
  border: 0; border-radius: var(--ds-r-lg, 12px); background: transparent; color: var(--text-primary);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: background-color 120ms var(--easing);
}
@media (hover: hover) { .bka-opcao:hover { background: var(--ds-hover); } }
.bka-opcao:active { background: var(--ds-hover); }
.bka-opcao:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.bka-opcao__ic { flex: none; width: 36px; height: 36px; border-radius: 10px; display: inline-grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.bka-opcao__ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bka-opcao__txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.bka-opcao__titulo { font: 600 var(--ds-fs-body, 14px)/1.3 var(--font-ui); color: var(--text-primary); }
.bka-opcao__desc { font: 400 var(--ds-fs-label, 12px)/1.4 var(--font-ui); color: var(--text-muted); }
.bka-opcao__fim { flex: none; color: var(--text-muted); display: inline-flex; align-items: center; gap: 6px; }
.bka-opcao__fim svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bka-conta { min-width: 20px; height: 20px; padding: 0 6px; box-sizing: border-box; border-radius: 999px; background: var(--danger); color: #fff; font: 600 11px/20px var(--font-ui); text-align: center; font-variant-numeric: tabular-nums; }
[data-theme="dark"] .bka-conta { color: #0B1120; }

/* Lista de chamados e de artigos */
.bka-itens { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.bka-item { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 10px 12px; border: 0; border-radius: var(--ds-r-md, 8px); background: transparent; color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; }
@media (hover: hover) { .bka-item:hover { background: var(--ds-hover); } }
.bka-item:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.bka-item__linha { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.bka-item__num { flex: none; font: 500 var(--ds-fs-label, 12px)/1.3 var(--font-ui); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.bka-item__titulo { flex: 1; min-width: 0; font: 600 var(--ds-fs-small, 13px)/1.35 var(--font-ui); color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bka-item__selos { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.bka-item__desc { font: 400 var(--ds-fs-label, 12px)/1.45 var(--font-ui); color: var(--text-muted); }
.bka-rodape { padding: 8px 4px 4px; display: flex; justify-content: center; }
.bka-link { border: 0; background: none; padding: 8px 10px; border-radius: var(--ds-r-md, 8px); color: var(--accent-text); font: 600 var(--ds-fs-small, 13px)/1.2 var(--font-ui); cursor: pointer; text-decoration: none; }
@media (hover: hover) { .bka-link:hover { background: var(--accent-soft); } }
.bka-link:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

/* Formulário */
.bka-form { display: flex; flex-direction: column; gap: 14px; padding: 8px 10px 4px; }
.bka-form .form-group { margin: 0; }
.bka-form textarea { min-height: 104px; resize: vertical; }
.bka-form input[type="file"] { padding-top: 8px; }
.bka-acoes { display: flex; justify-content: flex-end; gap: 8px; padding-top: 2px; }
.bka-acoes .btn { min-height: var(--ds-h-md, 36px); }
.bka-erro { margin: 0; padding: 10px 12px; border-radius: var(--ds-r-md, 8px); background: var(--danger-soft); color: var(--text-primary); font: 500 var(--ds-fs-small, 13px)/1.45 var(--font-ui); }
.bka-erro[hidden] { display: none; }

/* Escolha do tipo de pedido */
.bka-escolhas { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; }
.bka-escolhas legend { padding: 0; margin: 0 0 6px; font: 500 var(--ds-fs-small, 13px)/1.3 var(--font-ui); color: var(--text-primary); }
.bka-escolha { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--ds-r-md, 8px); cursor: pointer; font: 500 var(--ds-fs-small, 13px)/1.3 var(--font-ui); color: var(--text-primary); }
.bka-escolha input { accent-color: #3C53DD; width: 16px; height: 16px; margin: 0; }
.bka-escolha:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.bka-escolha:has(input:focus-visible) { outline: 2px solid var(--focus-ring); outline-offset: 1px; }

/* Confirmação */
.bka-ok { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px 12px 8px; }
.bka-ok__ic { width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--success-soft); color: var(--success); }
.bka-ok__ic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bka-ok h3 { margin: 0; font: 600 18px/1.3 var(--font-ui); letter-spacing: -0.01em; color: var(--text-primary); }
.bka-ok p { margin: 0; font: 400 var(--ds-fs-body, 14px)/1.5 var(--font-ui); color: var(--text-secondary); }
.bka-ok .bka-acoes { width: 100%; justify-content: flex-start; flex-wrap: wrap; padding-top: 6px; }

.bka-vazio { padding: 20px 12px; text-align: center; font: 400 var(--ds-fs-small, 13px)/1.5 var(--font-ui); color: var(--text-muted); }
.bka-vazio .btn { margin-top: 10px; }
.bka-carregando { display: flex; flex-direction: column; gap: 8px; padding: 10px; }
.bka-carregando span { display: block; height: 44px; border-radius: var(--ds-r-md, 8px); background: var(--bg-raised); }

/* ── Chat (Conversar com a gente) ──────────────────── */
.bka-painel--chat { height: min(600px, calc(100dvh - var(--bka-tam) - var(--bka-margem) * 2 - 28px)); width: 392px; }
.bka-painel--chat .bka-corpo { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.bka-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.bka-chat__lista { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 10px; }
.bka-chat__dica { margin: 0 0 10px; font: 500 var(--ds-fs-small, 13px)/1.45 var(--font-ui); color: var(--text-secondary); }
.bka-chat__abertura { margin-top: auto; }
.bka-setores { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.bka-setor { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 52px; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--ds-r-lg, 12px); background: var(--bg-card); color: var(--text-primary); font: inherit; text-align: left; cursor: pointer; transition: border-color 120ms var(--easing), background-color 120ms var(--easing); }
@media (hover: hover) { .bka-setor:hover { border-color: var(--accent-border); background: var(--ds-hover); } }
.bka-setor:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.bka-setor.is-on { border-color: var(--accent); background: var(--accent-soft); }
.bka-setor__nome { font: 600 var(--ds-fs-small, 13px)/1.3 var(--font-ui); }
.bka-setor__desc { font: 400 11.5px/1.35 var(--font-ui); color: var(--text-muted); }

.bka-msg { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; max-width: 86%; }
.bka-msg--minha { align-self: flex-end; align-items: flex-end; }
.bka-msg__balao { padding: 9px 12px; border-radius: 14px 14px 14px 4px; background: var(--bg-raised); color: var(--text-primary); font: 400 var(--ds-fs-body, 14px)/1.45 var(--font-ui); overflow-wrap: anywhere; }
.bka-msg__balao p { margin: 0; }
.bka-msg--minha .bka-msg__balao { border-radius: 14px 14px 4px 14px; background: #3C53DD; color: #fff; }
.bka-msg--auto .bka-msg__balao { background: transparent; border: 1px dashed var(--border-strong); color: var(--text-secondary); }
.bka-msg__meta { font: 400 11px/1.3 var(--font-ui); color: var(--text-muted); padding: 0 4px; }
.bka-msg__anexo { display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; color: inherit; font-weight: 500; text-decoration: underline; text-underline-offset: 2px; }
.bka-msg__anexo svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }

.bka-chat__compositor { flex: none; border-top: 1px solid var(--border); padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 6px; background: var(--bg-card); }
.bka-chat__linha { display: flex; align-items: flex-end; gap: 6px; }
.bka-chat__texto { flex: 1; min-width: 0; min-height: 40px; max-height: 120px; resize: none; padding: 9px 12px; border: 1px solid var(--input-border); border-radius: 20px; background: var(--bg-raised); color: var(--text-primary); font: 400 var(--ds-fs-body, 14px)/1.4 var(--font-ui); }
.bka-chat__texto::placeholder { color: var(--text-placeholder); }
.bka-chat__texto:focus { outline: none; border-color: var(--focus-ring); box-shadow: 0 0 0 3px var(--accent-soft); }
.bka-chat__enviar { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; background: #3C53DD; color: #fff; cursor: pointer; }
.bka-chat__enviar svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) { .bka-chat__enviar:hover { background: #2F44C4; } }
.bka-chat__enviar:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.bka-chat__enviar:disabled { opacity: 0.6; cursor: progress; }
.bka-chat__linha .bka-icbtn { width: 40px; height: 40px; }
.bka-chat__anexo { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 4px 4px 10px; border-radius: var(--ds-r-md, 8px); background: var(--bg-subtle); font: 500 var(--ds-fs-label, 12px)/1.3 var(--font-ui); color: var(--text-secondary); }
.bka-chat__anexo[hidden] { display: none; }
.bka-chat__anexo span { display: inline-flex; align-items: center; gap: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bka-chat__anexo span svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; flex: none; }
.bka-chat__anexo .bka-icbtn { width: 28px; height: 28px; }
.bka-chat__fim { flex: none; border-top: 1px solid var(--border); padding: 12px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.bka-chat__fim p { margin: 0; font: 500 var(--ds-fs-small, 13px)/1.4 var(--font-ui); color: var(--text-secondary); }

/* ── Ajuda para esta tela (024): até 3 artigos da tela atual, antes das opções ── */
.bka-contexto { margin: 0 0 8px; padding: 4px 0 8px; border-bottom: 1px solid var(--border); }
.bka-contexto__titulo { margin: 4px 10px 4px; font: 600 var(--ds-fs-label, 12px)/1.3 var(--font-ui); letter-spacing: 0.02em; text-transform: uppercase; color: var(--text-muted); }
.bka-itens--contexto .bka-item__desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Nota de um clique na conversa encerrada (024) ── */
.bka-nota { flex: 1 1 100%; display: flex; flex-direction: column; gap: 8px; }
.bka-nota__titulo { margin: 0; font: 600 var(--ds-fs-small, 13px)/1.4 var(--font-ui); color: var(--text-primary); }
.bka-nota__escala { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.bka-nota__btn {
  min-height: 44px; border: 1px solid var(--border-strong); border-radius: var(--ds-r-md, 8px);
  background: var(--bg-card); color: var(--text-primary); font: 600 15px/1 var(--font-ui); font-variant-numeric: tabular-nums;
  cursor: pointer; touch-action: manipulation; transition: background-color 120ms var(--easing), border-color 120ms var(--easing);
}
@media (hover: hover) { .bka-nota__btn:hover { background: var(--ds-hover); border-color: #3C53DD; } }
.bka-nota__btn:active { background: var(--ds-hover); }
.bka-nota__btn:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.bka-nota__btn:disabled { opacity: 0.55; cursor: default; }
.bka-nota__legenda { display: flex; justify-content: space-between; font: 400 var(--ds-fs-label, 12px)/1.3 var(--font-ui); color: var(--text-muted); }
.bka-nota__ok { flex: 1 1 100%; margin: 0; font: 600 var(--ds-fs-small, 13px)/1.4 var(--font-ui); color: var(--text-primary); }
.bka-nota__ok:focus { outline: none; }
.bka-chat__nota { flex: none; border-top: 1px solid var(--border); padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px; }
.bka-chat__nota[hidden] { display: none; }

/* ── Celular (modo app): botão acima da barra de abas, painel vira folha de baixo ── */
html.bk-app {
  --bka-margem: 16px;
  --bka-base: calc(var(--bk-tab-h, 58px) + var(--bk-safe-bottom, 0px) + 16px);
}
html.bk-app.bka-on .main-content { padding-bottom: calc(var(--bk-tab-h, 58px) + var(--bk-safe-bottom, 0px) + var(--bka-tam) + 40px); }
html.bk-app.bka-on .toast { bottom: calc(var(--bka-base) + var(--bka-tam) + 12px); }
/* teclado aberto ou camada (modal, gaveta) aberta: o botão sai do caminho */
html.bk-app.bk-kb .bka-btn, html.bk-app.bk-camada .bka-btn { opacity: 0; visibility: hidden; pointer-events: none; }

html.bk-app .bka-fundo { display: block; position: fixed; inset: 0; z-index: 1150; background: var(--ds-overlay); animation: bka-fade 160ms var(--easing-out) both; }
.bka-fundo[hidden] { display: none !important; }
@keyframes bka-fade { from { opacity: 0; } to { opacity: 1; } }
html.bk-app .bka-painel {
  left: 0; right: 0; bottom: 0; z-index: 1160; width: auto; max-width: none;
  max-height: calc(100dvh - var(--bk-safe-top, 0px) - 40px);
  border-radius: 20px 20px 0 0; border-bottom: 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  transform-origin: 50% 100%;
  animation: bka-sobe 240ms cubic-bezier(0.32, 0.72, 0, 1) both;
}
html.bk-app .bka-painel::before { content: ''; display: block; width: 36px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 8px auto 0; flex: none; }
html.bk-app .bka-topo { padding-top: 8px; }
html.bk-app .bka-opcao { min-height: 60px; }
html.bk-app .bka-form input, html.bk-app .bka-form select, html.bk-app .bka-form textarea, html.bk-app .bka-chat__texto { font-size: 16px; } /* sem zoom no iPhone */
html.bk-app .bka-painel--chat { height: calc(100dvh - var(--bk-safe-top, 0px) - 40px); width: auto; }
html.bk-app .bka-chat__compositor { padding-bottom: 10px; }
@keyframes bka-sobe { from { transform: translateY(100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  .bka-btn, .bka-btn svg, .bka-opcao { transition: none; }
  .bka-painel, html.bk-app .bka-painel, .bka-fundo { animation: none; }
}

/* ── Widget e chat (030): contador no botão, aviso de resposta nova, links e artigo no painel ── */
.bka-btn__conta {
  position: absolute; top: -2px; right: -2px; min-width: 20px; height: 20px; padding: 0 5px; box-sizing: border-box;
  border-radius: 999px; background: var(--danger); color: #fff; border: 2px solid var(--bg-card);
  font: 700 11px/16px var(--font-ui); text-align: center; font-variant-numeric: tabular-nums; pointer-events: none;
}
.bka-btn__conta[hidden] { display: none; }
.bka-aviso {
  position: fixed; z-index: 82; right: var(--bka-direita); bottom: calc(var(--bka-base) + var(--bka-tam) + 12px);
  max-width: min(300px, calc(100vw - 32px)); display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  padding: 10px 14px; border: 1px solid var(--border-strong); border-radius: 14px 14px 4px 14px;
  background: var(--bg-card); color: var(--text-primary); box-shadow: var(--ds-pop-shadow);
  font: inherit; text-align: left; cursor: pointer; animation: bka-entra 180ms var(--easing-out) both;
}
.bka-aviso[hidden] { display: none; }
.bka-aviso__t { font: 600 var(--ds-fs-small, 13px)/1.35 var(--font-ui); }
.bka-aviso__l { font: 400 var(--ds-fs-label, 12px)/1.35 var(--font-ui); color: var(--text-muted); }
@media (hover: hover) { .bka-aviso:hover { border-color: var(--accent-border); } }
.bka-aviso:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.bka-msg__link { color: inherit; text-decoration: underline; text-underline-offset: 2px; overflow-wrap: anywhere; }
.bka-msg--minha .bka-msg__link { color: #fff; }
.bka-wpp2 { margin: 10px 10px 4px; font: 400 var(--ds-fs-label, 12px)/1.45 var(--font-ui); color: var(--text-muted); }
.bka-wpp2__link { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.bka-art { padding: 6px 10px 4px; font: 400 var(--ds-fs-body, 14px)/1.55 var(--font-ui); color: var(--text-primary); }
.bka-art__titulo { margin: 4px 0 10px; font: 600 17px/1.3 var(--font-ui); letter-spacing: -0.01em; }
.bka-art__h { margin: 14px 0 6px; font: 600 15px/1.35 var(--font-ui); }
.bka-art__h4 { margin: 12px 0 4px; font: 600 14px/1.35 var(--font-ui); }
.bka-art p { margin: 0 0 10px; color: var(--text-secondary); }
.bka-art ol, .bka-art ul { margin: 0 0 10px; padding-left: 22px; color: var(--text-secondary); }
.bka-art li { margin: 0 0 4px; }
.bka-art a { color: var(--accent-text); }
.bka-art__fim { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 10px 6px; padding: 12px 0 4px; border-top: 1px solid var(--border); }
.bka-art__fim p { margin: 0; font: 500 var(--ds-fs-small, 13px)/1.4 var(--font-ui); color: var(--text-secondary); }
@media (prefers-reduced-motion: reduce) { .bka-aviso { animation: none; } }

/* ── app-mobile.css ── */
/* BKon OS, modo app no celular.
   Tudo aqui só vale com html.bk-app (até 900px de largura, ou instalado em aparelho de toque).
   A classe é posta por js/app-mobile.js. Em tela larga nada muda.
   Usa só os tokens da marca v2 (portal.css): --bg-card, --bg-primary, --accent*, --text-*, --border*. */

html {
  --bk-appbar-h: 52px;
  --bk-tab-h: 58px;
  --bk-safe-top: env(safe-area-inset-top, 0px);
  --bk-safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Peças do app ficam ocultas fora do modo app */
.bk-appbar, .bk-tabbar, .bk-sheet, .bk-ptr, .bk-update, .bk-offline-bar, .bk-offline-full, .bk-ios-dica, .bk-chip-instalar { display: none; }

/* ── Base nativa ───────────────────────────────────── */
html.bk-app {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior-y: none;          /* mata o puxar-para-recarregar do navegador */
  scroll-behavior: auto;
}
html.bk-app body {
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}
html.bk-app :is(a, button, [role="button"], [role="tab"], input, select, textarea, label, summary, .btn) {
  touch-action: manipulation;           /* sem atraso de 300ms nem zoom por toque duplo */
}
html.bk-app :is(button, .btn, [role="button"], .bk-tab, .bk-sheet__item) {
  -webkit-user-select: none;
  user-select: none;
}
html.bk-app :is(button, a.btn, [role="button"]):active {
  transform: scale(0.97);
  filter: brightness(0.94);
  transition-duration: 60ms;
}

/* ── Alvos de toque de 44px e campos sem zoom ──────── */
html.bk-app :is(.btn, button.btn, a.btn) { min-height: 44px; }
html.bk-app .modal__close, html.bk-app .fin-close { min-width: 44px; min-height: 44px; }
html.bk-app :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]):not([type="color"]), select, textarea) {
  font-size: 16px !important;           /* abaixo de 16px o iPhone dá zoom ao focar */
  min-height: 44px;
}
html.bk-app textarea { min-height: 88px; }
html.bk-app :is(input[type="checkbox"], input[type="radio"]) { width: 22px; height: 22px; }

/* ── Esconde o menu antigo e reorganiza o shell ───── */
html.bk-app .topbar,
html.bk-app .sidebar,
html.bk-app .sidebar-overlay { display: none !important; }
html.bk-app .app-shell { grid-template-columns: minmax(0, 1fr); }
html.bk-app .main-content {
  grid-column: 1;
  min-height: 100dvh;
  padding: calc(var(--bk-appbar-h) + var(--bk-safe-top) + 14px) 14px calc(var(--bk-tab-h) + var(--bk-safe-bottom) + 24px);
  overflow-y: visible;
}
html.bk-app.bk-kb .main-content { padding-bottom: 24px; }
html.bk-app .toast { right: 12px; left: 12px; max-width: none; bottom: calc(var(--bk-tab-h) + var(--bk-safe-bottom) + 12px); }
html.bk-app .chat-shell { height: calc(100dvh - var(--bk-appbar-h) - var(--bk-safe-top) - var(--bk-tab-h) - var(--bk-safe-bottom) - 28px); min-height: 360px; }

/* ── Cabeçalho do app ──────────────────────────────── */
html.bk-app.bk-logado .bk-appbar {
  display: flex; align-items: center; gap: 8px;
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  height: calc(var(--bk-appbar-h) + var(--bk-safe-top));
  padding: var(--bk-safe-top) 8px 0;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.bk-appbar__lado { width: 44px; height: 44px; flex: none; display: flex; align-items: center; justify-content: center; }
.bk-appbar__voltar, .bk-appbar__perfil {
  width: 44px; height: 44px; border: 0; background: transparent; color: var(--text-primary);
  border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
}
.bk-appbar__voltar svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.bk-appbar__marca { width: 28px; height: 28px; border-radius: 8px; display: block; }
.bk-appbar__titulo {
  flex: 1; min-width: 0; margin: 0; text-align: left;
  font-family: var(--font-display); font-size: 18px; font-weight: 700; letter-spacing: -0.02em;
  color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bk-appbar__perfil .client-avatar { width: 34px; height: 34px; font-size: 12px; }
.bk-appbar__perfil:active { background: var(--bg-raised); }

/* ── Barra de abas ─────────────────────────────────── */
html.bk-app.bk-logado .bk-tabbar {
  display: flex; align-items: stretch; justify-content: space-around;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  height: calc(var(--bk-tab-h) + var(--bk-safe-bottom));
  padding: 0 4px var(--bk-safe-bottom);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}
html.bk-app.bk-kb .bk-tabbar { display: none; }
.bk-tab {
  flex: 1 1 0; min-width: 0; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  border: 0; background: transparent; color: var(--text-muted);
  font-family: var(--font-ui); font-size: 11px; font-weight: 500; letter-spacing: 0.01em;
  padding: 4px 2px 2px; cursor: pointer;
}
.bk-tab__icone {
  position: relative; width: 56px; height: 30px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  transition: background-color 160ms var(--easing-out);
}
.bk-tab svg { width: 24px; height: 24px; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.bk-tab__rotulo { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-tab[aria-current="page"] { color: var(--accent-text); font-weight: 600; }
.bk-tab[aria-current="page"] .bk-tab__icone { background: var(--accent-soft); }
.bk-tab:active .bk-tab__icone { background: var(--bg-raised); }
.bk-badge {
  position: absolute; top: -3px; right: 6px; min-width: 18px; height: 18px; padding: 0 5px; box-sizing: border-box;
  border-radius: 9px; background: var(--accent); color: #fff; border: 2px solid var(--bg-card);
  font: 600 10px/14px var(--font-ui); text-align: center; pointer-events: none;
}
.bk-badge[hidden] { display: none; }

/* ── Folha (Mais) e modais em folha ────────────────── */
html.bk-app .bk-sheet { position: fixed; inset: 0; z-index: 1200; display: none; }
html.bk-app .bk-sheet.is-open { display: block; }
.bk-sheet__fundo { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); animation: bkFade 160ms ease-out both; }
.bk-sheet__painel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--bg-card); border-top: 1px solid var(--border-strong);
  border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
  animation: bkSheetUp 260ms var(--easing-out) both;
  padding-bottom: var(--bk-safe-bottom);
}
.bk-sheet__alca, html.bk-app :is(.modal, .fin-modal, .client-drawer__panel, .crm-drawer__painel, .sp-gaveta__painel)::before {
  content: ''; display: block; flex: none; width: 40px; height: 5px; border-radius: 3px;
  background: var(--border-strong); margin: 8px auto 6px;
}
html.bk-app .modal::before, html.bk-app .fin-modal::before { margin: -10px auto 10px; }
html.bk-app .fin-modal::before { margin: 8px auto 0; }
.bk-sheet__corpo { overflow-y: auto; overscroll-behavior: contain; padding: 4px 16px 16px; }
.bk-sheet__eu { display: flex; align-items: center; gap: 12px; padding: 8px 4px 14px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.bk-sheet__eu-nome { font-weight: 600; font-size: 15px; color: var(--text-primary); overflow-wrap: anywhere; }
.bk-sheet__eu-sub { font-size: 13px; color: var(--text-muted); overflow-wrap: anywhere; }
.bk-sheet__grupo { margin: 10px 0 2px; padding: 0 4px; font: 500 11px/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.bk-sheet__item {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 48px; padding: 8px 8px;
  border: 0; border-radius: 12px; background: transparent; cursor: pointer; text-align: left;
  font: 500 15px/1.2 var(--font-ui); color: var(--text-primary);
}
.bk-sheet__item:active { background: var(--bg-raised); transform: none; filter: none; }
.bk-sheet__item svg { width: 22px; height: 22px; flex: none; stroke: currentColor; stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; color: var(--text-secondary); }
.bk-sheet__item .sp-nav-conta { margin-left: auto; }
.bk-sheet__item--perigo, .bk-sheet__item--perigo svg { color: var(--danger); }
.bk-sheet__rodape { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }

html.bk-app .modal-overlay, html.bk-app .fin-overlay { align-items: flex-end; justify-content: center; padding: 0; }
html.bk-app .modal-overlay { animation: bkFade 160ms ease-out both; }
html.bk-app :is(.modal, .fin-modal) {
  max-width: none !important; width: 100%; max-height: 92dvh;
  border-radius: 20px 20px 0 0; border-bottom: 0;
  overflow-y: auto; overscroll-behavior: contain;
  padding-bottom: calc(20px + var(--bk-safe-bottom));
  animation: bkSheetUp 260ms var(--easing-out) both;
}
html.bk-app .fin-modal { padding-bottom: 0; }
html.bk-app .fin-modal__acoes { padding-bottom: calc(14px + var(--bk-safe-bottom)); }
html.bk-app .modal__header { position: sticky; top: 0; background: var(--bg-card); z-index: 1; }

/* Gavetas laterais viram folha que sobe */
html.bk-app .client-drawer { align-items: flex-end; justify-content: center; }
html.bk-app .client-drawer__panel {
  width: 100%; height: 92dvh; border-left: 0; border-radius: 20px 20px 0 0;
  animation: bkSheetUp 260ms var(--easing-out) both;
}
html.bk-app :is(.crm-drawer__painel, .sp-gaveta__painel) {
  top: auto; left: 0; right: 0; width: 100%; height: 92dvh; border-left: 0; border-radius: 20px 20px 0 0;
  animation: bkSheetUp 260ms var(--easing-out) both;
}
html.bk-app :is(.crm-drawer__painel, .sp-gaveta__painel, .client-drawer__panel) { padding-bottom: var(--bk-safe-bottom); }

@keyframes bkSheetUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes bkFade { from { opacity: 0; } to { opacity: 1; } }

/* ── Puxar para atualizar ──────────────────────────── */
html.bk-app.bk-logado .bk-ptr {
  display: flex; position: fixed; left: 50%; z-index: 55; pointer-events: none;
  top: calc(var(--bk-appbar-h) + var(--bk-safe-top) + 6px);
  width: 40px; height: 40px; margin-left: -20px; border-radius: 50%;
  align-items: center; justify-content: center;
  background: var(--bg-card); border: 1px solid var(--border-strong); box-shadow: var(--shadow-card-hover);
  color: var(--accent-text); opacity: 0; transform: translateY(-60px);
}
.bk-ptr svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 2.2; fill: none; stroke-linecap: round; }
.bk-ptr.is-ativo { transition: none; }
.bk-ptr.is-solto { transition: transform 220ms var(--easing-out), opacity 220ms; }
.bk-ptr.is-girando svg { animation: bkGira 700ms linear infinite; }
@keyframes bkGira { to { transform: rotate(360deg); } }

/* ── Transição entre telas ─────────────────────────── */
html.bk-app .page.bk-ent-frente { animation: bkEntraFrente 240ms var(--easing-out) backwards; }
html.bk-app .page.bk-ent-volta  { animation: bkEntraVolta 240ms var(--easing-out) backwards; }
html.bk-app .page.bk-ent-aba    { animation: bkEntraAba 200ms var(--easing-out) backwards; }
@keyframes bkEntraFrente { from { opacity: 0; transform: translateX(22px); } to { opacity: 1; transform: none; } }
@keyframes bkEntraVolta  { from { opacity: 0; transform: translateX(-22px); } to { opacity: 1; transform: none; } }
@keyframes bkEntraAba    { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Avisos: nova versão, offline, instalar ────────── */
.bk-update, .bk-offline-bar { z-index: 1300; }
html.bk-app .bk-update.is-visivel, .bk-update.is-visivel {
  display: flex; align-items: center; gap: 12px; position: fixed; left: 12px; right: 12px; z-index: 1300;
  bottom: calc(var(--bk-tab-h) + var(--bk-safe-bottom) + 12px);
  padding: 12px 14px; border-radius: 14px; border: 1px solid var(--accent-border);
  background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-card-hover);
  font: 500 14px/1.3 var(--font-ui);
}
html:not(.bk-app) .bk-update.is-visivel { left: auto; right: 20px; bottom: 20px; max-width: 360px; }
html:not(.bk-logado) .bk-update.is-visivel { bottom: calc(var(--bk-safe-bottom) + 12px); }
.bk-update button { margin-left: auto; flex: none; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font: 600 14px var(--font-ui); cursor: pointer; }

.bk-offline-bar.is-visivel {
  display: block; position: fixed; left: 0; right: 0; z-index: 1300; text-align: center;
  top: calc(var(--bk-appbar-h) + var(--bk-safe-top));
  padding: 6px 12px; background: var(--warning, #B54708); color: #fff; font: 500 13px/1.3 var(--font-ui);
}
html:not(.bk-logado) .bk-offline-bar.is-visivel { top: 0; padding-top: calc(6px + var(--bk-safe-top)); }

.bk-offline-full.is-visivel {
  display: flex; position: fixed; inset: 0; z-index: 2000; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: calc(24px + var(--bk-safe-top)) 24px calc(24px + var(--bk-safe-bottom));
  background: var(--bg-primary); color: var(--text-primary);
}
.bk-offline-full__icone { width: 60px; height: 60px; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--accent-text); }
.bk-offline-full__icone svg { width: 28px; height: 28px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; }
.bk-offline-full h2 { font-family: var(--font-display); font-size: 22px; margin: 18px 0 8px; }
.bk-offline-full p { margin: 0 0 24px; color: var(--text-secondary); line-height: 1.5; max-width: 300px; }
.bk-offline-full button { min-height: 48px; padding: 0 28px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font: 600 16px var(--font-ui); cursor: pointer; }

.bk-chip-instalar.is-visivel {
  display: flex; align-items: center; gap: 8px; position: fixed; left: 50%; transform: translateX(-50%); z-index: 70;
  bottom: calc(var(--bk-safe-bottom) + 14px); min-height: 44px; padding: 0 8px 0 16px;
  border-radius: 22px; border: 1px solid var(--border-strong); background: var(--bg-card); color: var(--text-primary);
  box-shadow: var(--shadow-card-hover); font: 500 14px var(--font-ui); white-space: nowrap;
}
.bk-chip-instalar button { border: 0; background: transparent; color: inherit; font: inherit; cursor: pointer; min-height: 44px; }
.bk-chip-instalar__ok { color: var(--accent-text); font-weight: 600; }
.bk-chip-instalar__x { width: 36px; color: var(--text-muted); font-size: 18px; }
html.bk-logado .bk-chip-instalar { display: none !important; }

.bk-ios-dica.is-visivel {
  display: block; position: fixed; left: 12px; right: 12px; z-index: 1100;
  bottom: calc(var(--bk-tab-h) + var(--bk-safe-bottom) + 12px); padding: 14px 16px; border-radius: 14px;
  background: var(--bg-card); border: 1px solid var(--accent-border); box-shadow: var(--shadow-card-hover);
  font: 400 14px/1.45 var(--font-ui); color: var(--text-secondary);
}
.bk-ios-dica strong { color: var(--text-primary); }
.bk-ios-dica svg { width: 16px; height: 16px; vertical-align: -3px; stroke: var(--accent-text); stroke-width: 2; fill: none; }
.bk-ios-dica button { display: block; margin: 10px 0 0 auto; min-height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); font: 600 14px var(--font-ui); cursor: pointer; }

/* Safe area no login (notch e barra de gestos) */
html.bk-app .screen--login { padding-top: var(--bk-safe-top); padding-bottom: var(--bk-safe-bottom); min-height: 100dvh; }

@media (prefers-reduced-motion: reduce) {
  html.bk-app .page.bk-ent-frente, html.bk-app .page.bk-ent-volta, html.bk-app .page.bk-ent-aba,
  .bk-sheet__painel, .bk-sheet__fundo, html.bk-app :is(.modal, .fin-modal, .client-drawer__panel, .crm-drawer__painel, .sp-gaveta__painel),
  html.bk-app .modal-overlay { animation: none !important; }
  .bk-tab__icone, .bk-ptr.is-solto { transition: none; }
  html.bk-app :is(button, a.btn, [role="button"]):active { transform: none; }
}
