/* ======================================================================================================================
   Praxis no CELULAR (28/10/2026, Chefe: "veja como está frio o layout do Praxis no celular"). A ideia é a capa do
   prontuário: no celular o topo é uma faixa petróleo contínua — barra do app (marca, clínica, lupa, iniciais) e o título
   da tela em letra de nome, em branco — e o conteúdo começa logo abaixo, numa folha clara. Tabelas viram cartões
   (celular.js põe o rótulo de cada coluna), botões com 44px, rodapé de uma linha e o Klug num botão redondo.
   Carregado depois de tema.css. No computador (1000px ou mais) só esconde as peças do celular.
   ====================================================================================================================== */
.ab-marca, .ab-acoes { display: none; }

@media (max-width: 999.98px) {
  :root { --bg: #e8efec; }
  header.top::before { display: none !important; content: none !important; }
  header.top { position: sticky; top: 0; z-index: 20; background: var(--petroleo); color: #fff; padding-top: env(safe-area-inset-top, 0px); border: 0; }
  header.top .wrap { position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: 0 10px; padding: 8px 12px 8px 16px; min-height: 58px; }
  .ab-marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; flex: 1; }
  .ab-marca svg { width: 32px; height: 32px; flex: none; }
  .ab-marca span { display: flex; flex-direction: column; min-width: 0; line-height: 1.1; }
  .ab-marca em { font-family: var(--f-nome); font-style: italic; font-weight: 600; font-size: 1.32rem; color: #8fe0d0; }
  .ab-marca small { font-size: .74rem; color: #a9cbc4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 54vw; }
  .ab-acoes { display: flex; gap: 8px; align-items: center; }
  .ab-ico, .ab-avatar { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; touch-action: manipulation; padding: 0; }
  .ab-ico { background: rgb(255 255 255 / .09); color: #fff; }
  .ab-ico svg { width: 21px; height: 21px; }
  .ab-ico[aria-expanded="true"] { background: #fff; color: var(--petroleo); }
  .ab-avatar { background: var(--ouro); color: var(--ouro-t); font-family: var(--f-tit); font-weight: 800; font-size: .95rem; letter-spacing: .02em; }
  .ab-ico:focus-visible, .ab-avatar:focus-visible { outline: 3px solid var(--ouro); outline-offset: 2px; }
  .ab-avatar[hidden], .ab-ico[hidden] { display: none; }

  /* busca: escondida até tocar na lupa; abre numa linha da própria barra */
  header.top .busca-glob { order: 10; flex: 1 1 100%; max-width: none; margin: 0; display: none; padding: 8px 0 4px; }
  body.ab-busca-aberta header.top .busca-glob:not([hidden]) { display: block; }
  header.top .busca-glob input { border: 0; box-shadow: none; font-size: 16px; min-height: 46px; color: var(--tinta); background-color: #fff; }
  header.top .busca-glob .busca-res, header.top .busca-glob .busca-res * { color: var(--tinta); }
  header.top .busca-glob .busca-res small, header.top .busca-glob .busca-res .mut { color: var(--aco); }
  header.top .busca-glob .busca-res { top: calc(100% + 2px); }

  /* conta: um cartão que desce das iniciais */
  header.top .usuario { display: none !important; }
  body.ab-conta-aberta header.top .usuario:not([hidden]) { display: flex !important; flex-direction: column; align-items: stretch; gap: 6px; position: absolute; right: 12px; top: calc(100% - 2px); min-width: 220px; background: #fff; color: var(--tinta); border-radius: 16px; padding: 12px; box-shadow: var(--sombra); z-index: 40; margin: 0; }
  body.ab-conta-aberta header.top .usuario #usuario-nome { order: -1; font-weight: 700; padding: 2px 4px 8px; border-bottom: 1px solid var(--linha); margin-bottom: 2px; }
  body.ab-conta-aberta header.top .usuario .btn { min-height: 44px; justify-content: flex-start; text-align: left; font-size: .95rem; }
  header.top .papel, header.top .avaliar, header.top .selo-ex { order: 11; flex: 1 1 100%; color: #cfe5e0; margin: 0 0 6px; }

  /* a capa: o cabeçalho de cada tela continua a faixa petróleo, título em letra de nome */
  main#tela { padding-top: 0; padding-bottom: 80px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) { position: relative; display: block; background: var(--petroleo); color: #d7ebe6; margin: 0 -16px 18px; padding: 4px 18px 26px; border-radius: 0 0 26px 26px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) h1 { color: #fff; font-size: 1.6rem; line-height: 1.15; margin: 0 0 4px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) p, :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .mut { color: #b4d4cd; font-size: .86rem; line-height: 1.45; margin: 0; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) a { color: #fff; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .ferr, :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .acoes, :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .acoes-pac { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 8px; margin: 14px -18px 0; padding: 0 18px 2px; scrollbar-width: none; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .ferr::-webkit-scrollbar, :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .acoes::-webkit-scrollbar { display: none; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .btn { flex: none; min-height: 42px; background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .24); color: #fff; border-radius: 999px; padding: 8px 16px; font-size: .88rem; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .btn.pri { background: var(--ouro); border-color: var(--ouro); color: var(--ouro-t); }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .btn:active { background: rgb(255 255 255 / .22); }

  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) input, :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) select { background: rgb(255 255 255 / .1); border: 1px solid rgb(255 255 255 / .24); color: #fff; color-scheme: dark; border-radius: 999px; min-height: 42px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .dia-nav { margin-top: 14px; }

  /* navegação de dias compacta: setas no lugar de "Dia anterior / Dia seguinte" */
  .dia-nav [data-acao="dia-ant"], .dia-nav [data-acao="dia-seg"] { font-size: 0 !important; min-width: 44px; padding: 0 !important; justify-content: center; }
  .dia-nav [data-acao="dia-ant"]::before { content: "‹"; font-size: 1.5rem; line-height: 1; }
  .dia-nav [data-acao="dia-seg"]::before { content: "›"; font-size: 1.5rem; line-height: 1; }
  .dia-nav .ag-vista { flex: 1 1 100%; display: flex; }
  .dia-nav .ag-vista button { flex: 1; min-height: 42px; }
  .dia-nav input[type="date"] { flex: 1; min-width: 0; }

  /* números lado a lado, duas colunas */
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .cards .card b { font-size: 1.35rem; }
  /* abas internas (Finanças, Orçamentos) deslizam em vez de quebrar em duas linhas */
  .fin-abas, .orc-abas, .sub-abas { flex-wrap: nowrap !important; overflow-x: auto; scrollbar-width: none; }
  .fin-abas button { flex: none; }

  /* avisos do topo (notas pendentes, configuração guiada…) viram uma faixa colada na capa */
  #tela > :not(.cab):has(~ .cab), #tela > :not(.cab):has(~ div > .cab:first-child) { margin: 0 -16px !important; border-radius: 0 !important; border-width: 0 0 1px !important; box-shadow: none !important; padding-inline: 16px !important; }
  header.top .avaliar { color: #cfe5e0; font-size: .8rem; }
  header.top .avaliar select { background: #fff; color: var(--tinta); border: 0; border-radius: 999px; min-height: 36px; max-width: none; flex: 1; }

  /* folhas com vida: sombra macia, título petróleo */
  .cx { border-color: transparent; box-shadow: 0 1px 1px rgb(12 58 59 / .05), 0 6px 18px rgb(12 58 59 / .08); }
  .cx h2 { color: var(--petroleo); }
  .dia-nav { gap: 8px; }
  .dia-nav .btn, .dia-nav input[type="date"] { min-height: 42px; }
  .fin-abas button, .fin-nf-filtros button { min-height: 42px; }
  .legenda { gap: 6px 12px; font-size: .76rem; }

  /* Klug: botão redondo, sem cobrir o conteúdo */
  .klug-btn { padding: 0; width: 56px; height: 56px; border-radius: 50%; justify-content: center; font-size: 0; gap: 0; box-shadow: 0 10px 24px rgb(12 58 59 / .35); }
  .klug-btn span { width: 32px; height: 32px; font-size: 1.15rem; }

  /* rodapé: uma linha */
  footer.rodape-px { margin-top: 0; border: 0; background: none; }
  footer.rodape-px .wrap { padding: 0 16px 18px; font-size: .74rem; gap: 2px 10px; }
  footer.rodape-px .wrap > span:nth-child(n+3) { display: none; }
}

/* ---------- tabelas em cartões (celular) ---------- */
@media (max-width: 640px) {
  .cx:has(> table.tc), .tab:has(> table.tc), .cx:has(> .tab > table.tc) { background: none; box-shadow: none; border: 0; padding: 0; overflow: visible; }
  table.tc, table.tc tbody, table.tc tr, table.tc td { display: block; width: auto; }
  table.tc thead { display: none; }
  table.tc { border: 0; background: none; min-width: 0 !important; }
  table.tc tbody tr { display: flex; flex-direction: column; gap: 4px; background: var(--sup); border-radius: 16px; padding: 12px 14px; margin: 0 0 10px; box-shadow: 0 1px 1px rgb(12 58 59 / .05), 0 6px 18px rgb(12 58 59 / .08); border: 0; }
  table.tc td { border: 0 !important; padding: 0 !important; display: flex; gap: 12px; justify-content: space-between; align-items: center; text-align: right; font-size: .92rem; min-width: 0; white-space: normal; }
  table.tc td[data-label]::before { content: attr(data-label); color: var(--aco); font-size: .8rem; text-align: left; flex: none; max-width: 46%; }
  table.tc td.tc-tit { order: -1; display: block; text-align: left; font-family: var(--f-tit); font-weight: 700; font-size: 1.05rem; color: var(--petroleo); margin-bottom: 2px; }
  table.tc td.tc-tit::before { display: none; }
  table.tc td.tc-larga { display: block; text-align: left; }
  table.tc td.tc-vazia, table.tc td[data-label=""]::before { display: none; }
  table.tc td[data-label=""] { justify-content: flex-end; }
  table.tc td .btn, table.tc td > button { min-height: 42px; }
  table.tc td.num { font-variant-numeric: tabular-nums; }
}
