/* Portal no celular com "jeito de aplicativo" (20/10/2026, opção 2 escolhida pelo Thiago: "Atualize o formato de visualização por celular,
   está muito ruim, precisa ser mais fluido"; prévia em previas-portal/2026-10-19-portal-celular.html).
   Só no celular (até 680px) e só na janela principal: o base.html marca <html class="cel-app"> quando a página não está dentro de uma
   gaveta (iframe). No computador e no tablet nada muda.
   - Barra fixa embaixo (base.html, .cel-barra): Painel, Central OS, Digisac, CHAT+ e Mais (folha com todos os módulos — static/js/celular_app.js).
   - Barra de cima enxuta (logo + foto), que some ao rolar para baixo e volta ao subir; os módulos saem dela (estão embaixo).
   - Painel de controle (visão Caixas): cada módulo vira um cartão com o número; tocando abre a lista (sanfona). Número grande vira "11,3 mil".
   - Letreiro, botão do CHAT+ e rodapés fixos sobem para não ficar atrás da barra. */
.cel-barra,.cel-mais,.cel-seta{display:none}

@media (max-width:680px){
  html.cel-app{--topo-ocupa:54px;--cel-barra:calc(62px + env(safe-area-inset-bottom))}

  /* ---------- barra de cima ---------- */
  html.cel-app .topbar.tf{position:sticky;top:0;margin:0;border-radius:0 0 16px 16px;height:54px;flex-wrap:nowrap;padding:0 10px 0 12px;gap:8px;row-gap:0;
    align-items:center;transition:transform .25s ease;z-index:42}
  html.cel-app body.cel-esconde .topbar.tf{transform:translateY(-115%)}
  html.cel-app .topbar.tf .tf-modulos{display:none}
  html.cel-app .topbar.tf .tf-marca{border-right:0;padding:0;height:40px}
  html.cel-app .topbar.tf .tf-marca img{height:22px}
  html.cel-app .topbar.tf .tf-marca span{display:inline;font-size:15px}
  html.cel-app .topbar.tf .tf-marca.on::after{display:none}
  html.cel-app .topbar.tf .tf-fechar{display:none}
  html.cel-app .tf-eu summary{padding:3px;gap:0}
  html.cel-app .tf-eu-txt,html.cel-app .tf-eu summary .ph-caret-down{display:none}
  html.cel-app .tf-av{width:34px;height:34px}

  /* ---------- barra de baixo ---------- */
  html.cel-app .cel-barra{position:fixed;left:0;right:0;bottom:0;z-index:42;display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);height:var(--cel-barra);
    padding-bottom:env(safe-area-inset-bottom);box-sizing:border-box;background:var(--card);border-top:1px solid var(--line);box-shadow:0 -6px 18px rgba(10,25,45,.08)}
  html.cel-app .cel-barra a,html.cel-app .cel-barra button{all:unset;box-sizing:border-box;display:flex;flex-direction:column;align-items:center;justify-content:center;
    gap:2px;min-width:0;font-size:11px;font-weight:600;color:var(--mut);position:relative;cursor:pointer;-webkit-tap-highlight-color:transparent;white-space:nowrap}
  html.cel-app .cel-barra .ph{font-size:24px}
  html.cel-app .cel-barra .ico-fax{width:24px;height:24px;background:currentColor}
  html.cel-app .cel-barra .on{color:var(--brand)}
  html.cel-app .cel-barra .on::before{content:"";position:absolute;top:0;left:28%;right:28%;height:3px;border-radius:0 0 3px 3px;background:var(--acento)}
  html.cel-app .cel-barra a:focus-visible,html.cel-app .cel-barra button:focus-visible{outline:2px solid var(--brand);outline-offset:-4px;border-radius:10px}
  html.cel-app .cel-qt{position:absolute;top:7px;left:calc(50% + 5px);min-width:17px;height:17px;padding:0 5px;border-radius:9px;background:#d64545;color:#fff;
    font-size:10.5px;font-weight:700;display:grid;place-items:center;box-sizing:border-box}
  html.cel-app .cel-qt[hidden]{display:none}
  html.cel-app body{padding-bottom:var(--cel-barra)}

  /* folha "Mais": todos os módulos */
  html.cel-app .cel-mais{position:fixed;inset:0;z-index:60;background:rgba(10,20,35,.42);display:flex;align-items:flex-end}
  html.cel-app .cel-mais[hidden]{display:none}
  html.cel-app .cel-mais-caixa{width:100%;background:var(--card);border-radius:20px 20px 0 0;padding:10px 12px calc(16px + env(safe-area-inset-bottom));
    box-shadow:0 -10px 30px rgba(10,25,45,.25)}
  html.cel-app .cel-mais-caixa::before{content:"";display:block;width:42px;height:5px;border-radius:3px;background:var(--line);margin:0 auto 12px}
  html.cel-app .cel-mais-grade{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:6px}
  html.cel-app .cel-mais-grade a{display:flex;flex-direction:column;align-items:center;gap:6px;padding:12px 2px;border-radius:14px;color:var(--ink);
    text-decoration:none;font-size:12px;font-weight:600;text-align:center;position:relative}
  html.cel-app .cel-mais-grade a:active,html.cel-app .cel-mais-grade a.on{background:var(--chip)}
  html.cel-app .cel-mais-grade .ph{font-size:25px;color:var(--brand)}
  html.cel-app .cel-mais-grade .cel-qt{top:6px;left:calc(50% + 8px)}

  /* o que é fixo embaixo sobe acima da barra */
  html.cel-app .chatmais-fab{display:none !important}
  html.cel-app .fax-painel.min{bottom:calc(var(--cel-barra) + 8px) !important}
  html.cel-app .pr-rodape{bottom:var(--cel-barra)}
  html.cel-app .mg-aviso{bottom:calc(var(--cel-barra) + 12px)}
  html.cel-app .lt-faixa{bottom:var(--cel-barra);height:36px}
  html.cel-app body.lt-com-faixa{padding-bottom:calc(var(--cel-barra) + 36px)}
  html.cel-app .lt-selo{padding:0 20px 0 10px;font-size:11px;gap:6px}
  html.cel-app .lt-item{font-size:14px}
  html.cel-app .lt-sep{padding:0 16px}
  html.cel-app .lt-prox{width:40px}
  /* telas de altura cheia descontam a barra de baixo */
  html.cel-app .wrap.cheio{height:calc(100dvh - var(--topo-ocupa) - var(--cel-barra))}

  /* ---------- Painel de controle (visão Caixas) ---------- */
  html.cel-app .co-cab.cx-linha{flex-direction:column;align-items:stretch;gap:10px;margin:4px 0 12px}
  html.cel-app .cx-linha .cx-saud{flex-direction:column;align-items:flex-start;gap:2px}
  html.cel-app .cx-linha h1{font-size:23px}
  html.cel-app .cx-linha .co-sub{white-space:normal;font-size:13px}
  html.cel-app .cx-linha .co-acoes{margin-left:0;display:flex;align-items:center;justify-content:space-between;gap:8px}
  html.cel-app .cx-linha .co-visao a{height:36px}
  html.cel-app .cx-linha .co-bt{height:38px;padding:0 14px}
  html.cel-app .cx-tela .cx-kpis{display:none}               /* os números ficam no cabeçalho de cada cartão */
  html.cel-app .cx-tela .cx-grade{gap:12px;margin-bottom:12px}
  html.cel-app .cx-tela .cx-mod{padding:12px 14px}
  html.cel-app .cx-tela .cx-num{display:block;margin-left:auto}
  html.cel-app .cx-tela .cx-cab{cursor:pointer;align-items:center}
  html.cel-app .cx-mod.cel-fechada > :not(.cx-cab){display:none}
  html.cel-app .cel-seta{display:inline-block;flex:none;margin-left:8px;color:var(--mut);font-size:18px;transition:transform .2s}
  html.cel-app .cx-mod:not(.cel-fechada) .cel-seta{transform:rotate(180deg)}
  /* aberto: a lista com a altura que tem (sem a barra de arrastar), no máximo 4 itens por parte */
  html.cel-app .cx-tela .cx-split{height:auto;flex:none;display:block}
  html.cel-app .cx-tela .cx-painel{overflow:visible}
  html.cel-app .cx-tela .cx-cima{flex:none;margin-bottom:6px}
  html.cel-app .cx-tela .cx-rola{overflow:visible;max-height:none}
  html.cel-app .cx-tela .cx-barra{display:none}
  html.cel-app .cx-tela .cx-lista{max-height:none;overflow:visible;flex:none}
  html.cel-app .cx-tela .cx-rola > .cx-ln:nth-of-type(n+5),html.cel-app .cx-tela .cx-lista > .cx-ln:nth-of-type(n+5){display:none}
  html.cel-app .cx-tela .cx-ln{padding:9px 4px;font-size:14.5px}
  html.cel-app .cx-tela .cx-abrir{display:block;padding-top:10px}
}
@media (max-width:680px) and (prefers-reduced-motion:reduce){
  html.cel-app .topbar.tf,html.cel-app .cel-seta{transition:none}
}
