/* =====================================================================
   SISTEMA NO CELULAR (até 760px). Carregado por último no sistema.html:
   só ajusta aparência e toque; nenhuma função muda.
   ===================================================================== */
@media screen and (max-width:760px){

  /* ---------- topo compacto: logo e usuário numa linha, abas em pílulas ---------- */
  header.top{position:sticky!important;top:0;z-index:30;transition:transform .25s ease;will-change:transform}
  header.top.recolhido{transform:translateY(calc(-1 * var(--topo-recolhe, 0px)))}
  header.top .top-in{padding:8px 12px 0!important}
  header.top .brand{display:flex!important;flex-wrap:wrap;align-items:center;gap:2px 10px;padding:0!important;margin:0!important}
  header.top .brand .logo.rt-logo{width:112px!important;height:auto!important;margin:0!important;order:0!important}
  header.top .brand .rt-lab{display:none!important}
  header.top .brand span.sub{order:1!important;flex:1 1 0;min-width:0;margin:0!important;font-size:11px!important;line-height:1.3!important;text-align:right!important;
    white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  header.top .userbar{order:2;flex:1 1 100%;display:flex!important;align-items:center;gap:6px!important;margin:6px 0 0!important;padding:0!important;border:0!important}
  header.top .userbar .who{flex:1;min-width:0;text-align:left!important;line-height:1.2}
  header.top .userbar .who strong{font-size:13px!important;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;display:block}
  header.top .userbar .who small{font-size:11px!important}
  header.top .userbar .btn{min-height:34px!important;padding:4px 12px!important;font-size:13px!important}
  nav.tabs{display:flex!important;flex-wrap:nowrap!important;gap:6px!important;margin:8px -12px 0!important;padding:0 12px 8px!important;border-top:0!important;
    overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;scrollbar-width:none}
  nav.tabs::-webkit-scrollbar{display:none}
  nav.tabs button{flex:none!important;scroll-snap-align:start;min-height:38px!important;padding:0 14px!important;margin:0!important;border-radius:999px!important;
    border:1px solid var(--line,#223049)!important;white-space:nowrap!important;font-size:13.5px!important;line-height:1!important;box-shadow:none!important}
  nav.tabs button[aria-current="page"]{background:var(--accent,#FF7A2B)!important;border-color:var(--accent,#FF7A2B)!important;color:#fff!important}
  nav.tabs::before{display:none!important}

  /* ---------- conteúdo ---------- */
  main{padding:16px 12px calc(84px + env(safe-area-inset-bottom,0px))!important;width:100%!important;margin-left:0!important}
  .labhead h2,section.blk>h2,.bar h2{font-size:22px!important}
  .labhead-flex{flex-direction:column;align-items:stretch!important;gap:12px}
  .labhead-flex>*{flex:0 0 auto!important;width:100%;min-width:0!important}
  .labhead-flex .acts,.labhead .acts{display:grid!important;grid-template-columns:1fr 1fr;gap:8px;width:100%}
  .labhead-flex .acts .btn,.labhead .acts .btn{width:100%;min-height:44px;white-space:normal;line-height:1.2;padding:8px 10px;justify-content:center;text-align:center}
  .labkpis,.stats{grid-template-columns:1fr 1fr!important;gap:10px!important}
  .labkpis .kpi .v,.stat .v{font-size:26px!important}
  .labkpis .kpi,.stat{padding:14px!important}
  .panel,.info,.empty{padding:16px!important}
  .acts{flex-wrap:wrap}
  .optactions{display:flex;flex-wrap:wrap;gap:8px}
  .optactions .btn{flex:1 1 auto}

  /* tabelas: rolam de lado dentro da própria caixa, com o dedo */
  .tw,.grid-wrap{overflow-x:auto!important;-webkit-overflow-scrolling:touch;max-width:100%}
  th,td{padding:10px 12px!important}

  /* ---------- campos e botões: tamanho de toque e sem zoom automático no iPhone ---------- */
  input,select,textarea{font-size:16px!important;min-height:44px}
  input[type=checkbox],input[type=radio]{min-height:0;width:20px;height:20px}
  .btn{min-height:42px}
  .btn.sm{min-height:36px}
  .field{min-width:0}
  .grid2,.ensform,.caform,.shform{grid-template-columns:1fr!important}

  /* ---------- janelas: sobem de baixo e ocupam a tela ---------- */
  .overlay{padding:0!important;align-items:flex-end!important}
  .overlay>.sheet,.overlay>.sheet.wide{width:100%!important;max-width:100%!important;margin:0!important;border-radius:20px 20px 0 0!important;
    max-height:94dvh;overflow-y:auto;-webkit-overflow-scrolling:touch;padding:14px 14px calc(18px + env(safe-area-inset-bottom,0px))!important;
    animation:rt-sobe-janela .25s ease-out}
  .overlay>.sheet h2{font-size:19px!important}
  .winhead{position:sticky;top:-14px;z-index:5;margin:-14px -14px 12px!important;padding:14px!important;background:inherit;border-bottom:1px solid var(--line,#223049)}
  .winhead h2{font-size:17px!important;min-width:0;overflow:hidden;text-overflow:ellipsis}
  .sheet .actions{position:sticky;bottom:calc(-18px - env(safe-area-inset-bottom,0px));margin:16px -14px calc(-18px - env(safe-area-inset-bottom,0px));padding:12px 14px calc(12px + env(safe-area-inset-bottom,0px));
    background:inherit;border-top:1px solid var(--line,#223049);display:flex;gap:8px}
  .sheet .actions .btn{flex:1}

  /* ---------- botão de tema: um círculo pequeno no canto, sem cobrir o conteúdo ---------- */
  #tema-btn{width:44px!important;height:44px!important;padding:0!important;right:12px!important;left:auto!important;bottom:calc(14px + env(safe-area-inset-bottom,0px))!important;border-radius:50%!important;font-size:18px!important;opacity:.92}
  #tema-btn span{display:none}
  body:has(.overlay) #tema-btn,body:has(.overlay) #tema-menu{display:none!important}
  #tema-menu{right:12px!important;left:auto!important;bottom:calc(66px + env(safe-area-inset-bottom,0px))!important}
  #toast{bottom:calc(72px + env(safe-area-inset-bottom,0px))!important;max-width:calc(100% - 24px)}

  /* login */
  .login{padding:22px!important;margin:8px 0}
}
@keyframes rt-sobe-janela{from{transform:translateY(24px);opacity:.6}to{transform:none;opacity:1}}
@media (prefers-reduced-motion:reduce){header.top{transition:none!important}.overlay>.sheet{animation:none!important}}
