/*
 * Padrão do celular para todas as telas do painel (referência: Parâmetros no celular).
 * Carregado no header.html depois do ttax-legado.css; as regras ficam dentro de @media para não mexer no computador,
 * menos as das abas roláveis (ttax-mobile.js), que também valem quando a tela é estreita no computador.
 */

/* Logo no meio da barra do topo: só no celular. */
.tx-hdr .tx-hdr-logo { display: none; }

/* Abas numa linha só, deslizando para o lado; seta à direita e dica embaixo quando não cabem. */
.tx-abas-rolaveis { display: flex !important; flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; position: relative; }
.tx-abas-rolaveis::-webkit-scrollbar { display: none; }
.tx-abas-rolaveis > li, .tx-abas-rolaveis > button { flex: none; }
.tx-abas-seta { position: sticky; right: 0; flex: none; display: flex; align-items: center; margin-left: auto; padding-left: 18px; background: linear-gradient(to right, rgba(255, 255, 255, 0), #fff 45%); list-style: none; }
.tx-abas-seta[hidden] { display: none !important; }
html body .tx-abas-seta button { width: 28px; height: 28px; border: 1px solid #dfe5ed; border-radius: 50% !important; background: #fff; color: #3a4757; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; padding: 0; box-shadow: 0 1px 3px rgba(15, 23, 42, .12); }
.tx-abas-dica { display: flex; align-items: center; justify-content: center; gap: 6px; font-size: 12px; color: #6b7280; margin: 6px 0 10px; }
.tx-abas-dica[hidden] { display: none !important; }

@media (max-width: 767.98px) {
  /* Barra do topo: menu à esquerda, logo no meio, avatar à direita. */
  .topbar.tx-hdr { position: relative; }
  .tx-hdr .tx-crumb { display: none !important; }
  .tx-hdr .tx-hdr-logo { display: block; margin-right: auto; }
  .tx-hdr .tx-hdr-logo img { height: 32px; width: auto; display: block; }

  /* Ambiente (selo "Envios em homologação"): no celular vira só a bolinha; tocar abre o detalhe. */
  .tx-hdr .tx-apontamento { display: flex !important; margin: 0 4px !important; }
  .tx-hdr .tx-apontamento .nav-link { padding: 8px !important; }
  .tx-hdr #header-apontamento-badge { display: block; width: 12px; height: 12px; padding: 0; font-size: 0; line-height: 0; border-radius: 50% !important; background: #f97316; box-shadow: 0 0 0 4px #ffedd5; }
  .tx-hdr #header-apontamento-badge.badge-danger { background: #dc2626; box-shadow: 0 0 0 4px #fee2e2; }
  .tx-hdr .tx-apontamento .dropdown-menu { min-width: 0 !important; width: min(92vw, 28rem); }

  /* Cabeçalho das telas: título com a ação ao lado e subtítulo curto. */
  .tx-page .title-row { flex-wrap: nowrap; align-items: flex-start; gap: 10px; }
  .tx-page .title-row > div:first-child { flex: 1; min-width: 0; }
  .tx-page .title-row h1 { font-size: 24px; line-height: 1.2; }
  .tx-page .title-row .sub { font-size: 13px; }
  .tx-page .title-row .acoes { flex: none; width: auto !important; margin-left: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
  html body .tx-page .title-row .acoes .tx-btn { height: 38px; padding: 0 12px; font-size: 13px; white-space: nowrap; }

  /* Busca ocupa a linha toda; paginação vai para baixo, à direita. */
  .lista-page .busca-linha { flex-wrap: wrap; }
  .lista-page .busca-linha .search, .lista-page .busca-linha .busca-form { flex: 1 1 100%; max-width: none; }
  .lista-page .busca-linha .tx-pages { margin-left: auto; }

  /* Indicadores em grade de 2, mais baixos. */
  .tx-page .dash-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Ícone das abas (cliente, usuário, documentação): mesmo tamanho e espaço em todas as barras. */
.tx-aba-icone { margin-right: 7px; font-size: 12.5px; opacity: .9; }

/* ===== Listas no celular (ttax-mobile.js): menu "⋮", faixa de indicadores, painel de filtros e cartões ===== */
.tx-kebab, .tx-filtros-linha, .tx-ver-detalhes { display: none; }
.tx-folha[hidden] { display: none !important; }

@media (max-width: 767.98px) {
  /* Topo: título e subtítulo na largura toda, "⋮" à direita do título, ação principal grande embaixo. */
  .lista-page .title-row { position: relative; flex-wrap: wrap; }
  .lista-page .title-row > div:first-child { flex: 1 1 100%; padding-right: 44px; }
  .lista-page .title-row h1 { font-size: 26px; }
  .lista-page .title-row .acoes { flex: 1 1 100%; width: 100% !important; align-items: stretch; }
  html body .lista-page .title-row .acoes .tx-btn-dark, html body .lista-page .title-row .acoes .tx-btn-primary { height: 48px; font-size: 15px; justify-content: center; border-radius: 12px !important; display: flex; align-items: center; }
  html body .lista-page .title-row .acoes .tx-acao-secundaria { display: none !important; }
  .lista-page .tx-kebab { display: block; position: absolute; top: 0; right: 0; }
  html body .tx-kebab-btn { width: 36px; height: 36px; border: 0; background: transparent; color: #0f172a; font-size: 18px; border-radius: 10px !important; }
  .tx-kebab-menu { position: absolute; right: 0; top: 40px; z-index: 40; min-width: 200px; background: #fff; border: 1px solid #e5e9f0; border-radius: 12px; box-shadow: 0 12px 30px rgba(15, 23, 42, .14); padding: 6px; }
  .tx-kebab-menu[hidden] { display: none; }
  html body .tx-kebab-menu button { width: 100%; text-align: left; border: 0; background: transparent; padding: 10px 12px; border-radius: 8px !important; font-size: 14px; font-weight: 600; color: #0f172a; }
  html body .tx-kebab-menu button:hover { background: #f1f5f9; }

  /* Indicadores: uma faixa só, número em cima e rótulo embaixo, com divisórias. */
  .lista-page .dash-kpis { display: grid !important; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none !important; gap: 0 !important; background: #fff; border: 1px solid #e5e9f0; border-radius: 14px; padding: 10px 0; }
  .lista-page .dash-kpis .dash-kpi { border: 0 !important; border-radius: 0; background: transparent; padding: 4px 6px; align-items: center; text-align: center; box-shadow: none !important; }
  .lista-page .dash-kpis .dash-kpi + .dash-kpi { border-left: 1px solid #e5e9f0 !important; }
  .lista-page .dash-kpis .dash-num { order: -1; font-size: 22px; }
  .lista-page .dash-kpis .dash-lbl { font-size: 12px; white-space: normal; line-height: 1.2; }
  .lista-page .dash-kpis .dash-det { display: none; }

  /* Filtros: a paginação de cima sai (fica a de baixo); os chips viram o botão "Filtros". */
  .lista-page .busca-linha .tx-pages { display: none; }
  html body .lista-page .filters { padding: 0; background: transparent; border: 0; box-shadow: none; }
  .lista-page .filters .search input { height: 48px; border-radius: 12px; }
  .lista-page .filters.tx-tem-folha #chips { display: none !important; }
  .lista-page .tx-filtros-linha { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
  html body .tx-filtros-btn { height: 40px; display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border: 1px solid #d5dde8; border-radius: 10px !important; background: #fff; color: #0f172a; font-size: 14px; font-weight: 700; }
  .tx-filtros-qtd { min-width: 20px; height: 20px; border-radius: 999px; background: #1f6fd1; color: #fff; font-size: 11px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
  .tx-filtros-seta { font-size: 11px; color: #64748b; }
  .tx-filtros-limpar { font-size: 13px; font-weight: 700; color: #1f6fd1; }

  /* Painel de filtros por baixo. */
  .tx-folha { position: fixed; inset: 0; z-index: 2000; }
  html body .tx-folha-fundo { position: absolute; inset: 0; border: 0; background: rgba(15, 23, 42, .45); border-radius: 0 !important; }
  .tx-folha-painel { position: absolute; left: 0; right: 0; bottom: 0; max-height: 88vh; display: flex; flex-direction: column; background: #fff; border-radius: 20px 20px 0 0; box-shadow: 0 -10px 30px rgba(15, 23, 42, .2); animation: txFolha .2s ease-out; }
  @keyframes txFolha { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
  .tx-folha-alca { width: 44px; height: 5px; border-radius: 999px; background: #cbd5e1; margin: 10px auto 0; }
  .tx-folha-painel header { display: flex; align-items: flex-start; gap: 12px; padding: 12px 18px 6px; }
  .tx-folha-painel header div { flex: 1; }
  .tx-folha-painel h2 { margin: 0; font-size: 20px; font-weight: 800; color: #0f172a; }
  .tx-folha-painel header p { margin: 2px 0 0; font-size: 13px; color: #64748b; }
  html body .tx-folha-fechar { width: 34px; height: 34px; border: 0; border-radius: 50% !important; background: #f1f5f9; color: #334155; }
  .tx-folha-corpo { overflow-y: auto; padding: 6px 18px 12px; display: flex; flex-direction: column; gap: 16px; }
  .tx-folha-grupo h3 { margin: 0 0 8px; font-size: 14px; font-weight: 800; color: #0f172a; }
  .tx-folha-opcoes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .tx-folha-opcoes.is-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  html body .tx-folha-opcao { min-height: 44px; border: 1px solid #d5dde8; border-radius: 10px !important; background: #fff; color: #0f172a; font-size: 14px; font-weight: 600; padding: 6px 8px; }
  html body .tx-folha-opcao.is-sel { border: 2px solid #1f6fd1; background: #eaf2fd; color: #0b4f91; font-weight: 800; }
  .tx-folha-painel footer { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding: 12px 18px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid #e5e9f0; }
  html body .tx-folha-limpar { height: 48px; border: 1px solid #1f6fd1; background: #fff; color: #1f6fd1; border-radius: 12px !important; font-weight: 800; }
  html body .tx-folha-aplicar { height: 48px; border: 0; background: #1f6fd1; color: #fff; border-radius: 12px !important; font-weight: 800; }
  body.tx-folha-aberta { overflow: hidden; }

  /* Cartões da lista: ícone e nome em cima, campos em duas colunas, "Ver detalhes" no rodapé. */
  html body .lista-page .table-card { background: transparent; border: 0; box-shadow: none; overflow: visible; }
  html body .lista-page .table-card .scroller { overflow: visible; }
  .lista-page .tx-lista-cartoes tbody { grid-template-columns: minmax(0, 1fr) !important; padding: 0 !important; gap: 12px !important; }
  .lista-page .tx-lista-cartoes tr { padding: 16px !important; border-radius: 16px !important; box-shadow: 0 1px 3px rgba(15, 23, 42, .06); }
  .lista-page .tx-lista-cartoes td:first-child .tx-avatar { width: 44px; height: 44px; font-size: 15px; }
  .lista-page .tx-lista-cartoes td:first-child .cell-main { font-size: 16px; font-weight: 800; }
  .lista-page .tx-lista-cartoes td[data-rotulo]::before { text-transform: none !important; letter-spacing: 0 !important; font-weight: 600 !important; font-size: 12px !important; }
  .lista-page .tx-lista-cartoes td.tx-acao { display: flex !important; align-items: center; justify-content: space-between; }
  .lista-page .tx-ver-detalhes { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; color: #1f6fd1; cursor: pointer; }
  .lista-page .tx-ver-detalhes i { font-size: 11px; }
  .lista-page .pager { flex-wrap: wrap; gap: 8px; justify-content: space-between; font-size: 12.5px; }
}
