/* Celular e toque. Princípios: alvos ≥ 44px (Fitts); o que se usa muito fica embaixo, na zona do polegar
   (barra de navegação, controles do Assistente, listas que abrem como folha inferior); o que se usa pouco
   (empresa, perfil) fica no topo; até 5 itens na barra (Hick), o resto em "Mais"; resposta visual imediata ao toque. */
.nav-more { display: none; }
.btn:active, .chip:active, .nav-link:active, .send:active, .fsel-btn:active { transform: scale(.97); }

@media (hover: none) {
  .conv-act { opacity: 1; } /* sem mouse não existe "passar por cima" */
}

@media (max-width: 860px) {
  :root { --tabbar: 66px; }
  .shell { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); height: 100dvh; }

  /* navegação inteira embaixo (polegar): barra com 4 atalhos + "Mais"; o topo da tela fica livre.
     "Mais" abre uma folha com as outras páginas, a empresa e o perfil (coisas de uso raro) */
  .nav { position: fixed; z-index: 35; left: 0; right: 0; bottom: 0; margin: 0; flex-direction: column; gap: 8px;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; box-shadow: 0 -4px 24px rgba(0, 0, 0, .08); }
  .nav-brand, .nav-tenant, .nav-foot, .nav-section { display: none; }
  .nav.more-open { padding-top: 16px; box-shadow: 0 0 0 100vmax rgba(20, 20, 19, .45); max-height: 88dvh; overflow-y: auto; }
  .nav.more-open .nav-tenant { display: block; order: 1; padding: 0 6px; border: 0; }
  .nav.more-open .nav-foot { display: block; order: 2; padding: 0 2px; border: 0; }
  .nav.more-open .nav-links { order: 3; }
  .nav-user { padding: 10px 12px; min-height: 52px; background: var(--surface-2); border-radius: 18px; }
  .menu { position: fixed; top: auto; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 40; border-radius: 24px; padding: 8px; box-shadow: 0 0 0 100vmax rgba(20, 20, 19, .45); }
  .menu button { padding: 14px 16px; font-size: 16px; }

  .nav-links { flex-direction: row; flex-wrap: nowrap; gap: 4px; padding: 0; overflow: visible; }
  .nav-link { order: var(--o); flex: 1 1 0; min-width: 0; min-height: 52px; flex-direction: column; justify-content: center; gap: 3px; padding: 6px 4px; font-size: 11px; border-radius: 18px; }
  .nav-link span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav-link.extra { display: none; }
  .nav-more { display: flex; order: 10; border: 0; background: none; color: var(--nav-text); font: inherit; font-size: 11px; cursor: pointer; }
  .nav.more-open .nav-links { flex-wrap: wrap; }
  .nav.more-open .extra { display: flex; order: -1; flex: 1 1 calc(50% - 4px); flex-direction: row; justify-content: flex-start; gap: 10px; min-height: 52px; padding: 12px 14px; font-size: 14px; background: var(--surface-2); }
  .main { padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }

  .topbar { padding: 16px 16px 8px; } .topbar h1 { font-size: 26px; } .topbar-right { display: none; }
  .view { padding: 8px 16px 24px; } .view.flush, .main.bare .view.flush { padding: 0; }

  /* alvos de toque ≥ 44px; campos com 16px (o iPhone não dá zoom ao focar) */
  .btn { height: 44px; } .btn-sm { height: 40px; padding: 0 14px; } .chip { min-height: 40px; padding: 8px 14px; }
  .fsel-btn { height: 44px; } td .fsel-btn { height: 40px; } .tab { padding: 10px 16px; } .icon { height: 36px; padding: 0 14px; }
  .fb { padding: 8px; font-size: 14px; } .conv-act { padding: 10px 12px; }
  input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], select, textarea { height: 44px; font-size: 16px; }
  textarea, .composer textarea { height: auto; font-size: 16px; }

  /* listas e menus abrem como folha inferior, ao alcance do polegar */
  .fsel-list { left: 8px !important; right: 8px; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)); min-width: 0 !important; max-height: 60dvh; border-radius: 24px; padding: 8px; box-shadow: 0 0 0 100vmax rgba(20, 20, 19, .45); }
  .fsel-list button { padding: 14px 16px; font-size: 16px; }
  .conv-pop { top: auto !important; left: 8px; right: 8px !important; bottom: calc(8px + env(safe-area-inset-bottom)); width: auto; max-height: 70dvh; box-shadow: 0 0 0 100vmax rgba(20, 20, 19, .45); }
  .drawer { inset: auto 0 0 0; width: 100%; max-height: 92dvh; border-radius: 28px 28px 0 0; }
  .toasts { left: 16px; right: 16px; bottom: calc(var(--tabbar) + 16px + env(safe-area-inset-bottom)); } .toast { max-width: none; }

  /* Assistente: base, conversas e nova conversa no topo; conversa no meio; campo de pergunta embaixo (polegar) */
  .chat-page { --pad: 12px; }
  .messages { order: 1; padding: 80px 12px 16px; gap: 22px; }
  .chat-bar { padding: 10px 12px 14px; } .chat-bar .lbl { display: none; } #newChat { width: 44px; padding: 0; justify-content: center; }
  .insights { grid-template-columns: minmax(0, 1fr) !important; gap: 6px; }
  .insight { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; padding: 10px 14px; }
  .insight span { flex: 1; } .insight b { font-size: 16px; } .insight em { flex-basis: 100%; text-align: right; }
  .composer { order: 3; padding: 8px 12px 10px; } .composer .hint { display: none; }
  .chat-page.fresh .starters { order: 4; padding: 12px; }
  .msg-user { max-width: 88%; }
  .card { border-radius: 24px; } .card-head { padding: 16px 16px 4px; } .card-body { padding: 6px 12px 12px; }
  .card-body canvas { height: 240px !important; } .insights { padding: 6px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calc { margin: 0 12px 12px; }
  .dash-bar { padding: 8px 16px; } .dash-year { flex: 1 1 100%; } .dash-year input { flex: 1; width: auto; } .dash-grid { padding: 6px 12px 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; } .kpi { padding: 14px 16px; border-radius: 22px; }
  .kpi .k-value { font-size: 24px; overflow-wrap: anywhere; } .tabs { display: flex; } .panel-head { padding: 16px 18px 10px; } .panel-body { padding: 6px 18px 18px; }
  .login-card { padding: 28px 22px; border-radius: 32px; }
  .empty-state { padding: 32px 8px; }
}
