/* ======================================================================================================================
   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):not(.rodape-seg) { 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; }
}

/* ======================================================================================================================
   Celular mais denso (29/10/2026, Chefe: "pouca informação na mesma tela, tem que ficar rolando"). Mesma cara, menos
   espaço morto: capa de cada tela mais baixa (texto de apoio numa linha só), cartões em duas colunas com o rótulo em
   cima do valor, recepção em linhas de uma consulta só, início sem cortar à direita e números menores.
   ====================================================================================================================== */
@media (max-width: 999.98px) {
  main#tela { padding-inline: 12px; }
  #tela > :not(.cab):has(~ .cab), #tela > :not(.cab):has(~ div > .cab:first-child) { margin: 0 -12px !important; padding-inline: 12px !important; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) { margin: 0 -12px 12px; padding: 2px 14px 14px; border-radius: 0 0 20px 20px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) h1 { font-size: 1.3rem; margin-bottom: 2px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) p { font-size: .8rem; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) :is(.ferr, .acoes, .acoes-pac) { margin-top: 10px; margin-inline: -14px; padding-inline: 14px; gap: 6px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .btn, :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) :is(input, select) { min-height: 38px; padding-block: 6px; }
  :is(#tela > .cab, #tela > div:not(.cx):not(.pront2) > .cab:first-child) .dia-nav { margin-top: 10px; }
  .dia-nav .btn, .dia-nav input[type="date"], .dia-nav .ag-vista button { min-height: 38px; }
  header.top .wrap { min-height: 52px; padding-block: 6px; }
  .ab-ico, .ab-avatar { width: 40px; height: 40px; }
  header.top .avaliar { margin-bottom: 4px; }
  header.top .avaliar select { min-height: 32px; font-size: .85rem; }

  .cx-p { padding: 12px; gap: 8px; }
  .cx h2 { font-size: 1rem; }
  .cards { gap: 8px; }
  .card { padding: 10px 12px; }
  .cards .card b { font-size: 1.12rem; }
  .cards .card :is(small, p, span) { font-size: .76rem; }

  /* início: nada cortado à direita; agenda do dia em linhas baixas */
  .fx-home { gap: 12px; padding-top: 0; }
  .fx-home-topo h1 { font-size: 1.55rem; }
  .fx-home-topo p { font-size: .86rem; margin-top: 2px; }
  .fx-home-grade { grid-template-columns: minmax(0, 1fr) !important; gap: 12px; }
  .fx-hoje, .fx-home-lado, .fx-card { min-width: 0; }
  .fx-home-busca input { min-height: 44px; font-size: 16px; }
  .fx-dia::before { left: 46px; }
  .fx-dia-i { grid-template-columns: 40px minmax(0, 1fr); gap: 12px; margin-bottom: 6px; }
  .fx-dia-i::after { left: 41px; width: 10px; height: 10px; }
  .fx-dia-i time { font-size: .92rem; }
  .fx-dia-c { padding: 8px 10px; gap: 8px; min-width: 0; }
  .fx-dia-c .fx-ini { display: none; }
  .fx-dia-c .fx-pac-t { flex: 1; min-width: 0; }
  .fx-dia-c .fx-pac-t b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .92rem; }
  .fx-dia-c .fx-pac-t small { font-size: .76rem; }
  .fx-dia-c .btn { flex: none; min-height: 34px; padding: 4px 10px; font-size: .8rem; }
  .fx-card { padding: 12px; }
  .fx-pv-l { padding: 8px 10px; font-size: .9rem; }
}

@media (max-width: 640px) {
  /* cartões de tabela: duas colunas, rótulo pequeno em cima do valor */
  table.tc tbody tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 12px; padding: 10px 12px; margin-bottom: 8px; border-radius: 12px; }
  table.tc td { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: 0; text-align: left; font-size: .86rem; line-height: 1.3; }
  table.tc td[data-label]::before { font-size: .68rem; max-width: none; letter-spacing: .01em; }
  table.tc td.tc-tit { grid-column: 1 / -1; font-size: .98rem; margin: 0; }
  table.tc td.tc-larga { grid-column: 1 / -1; }
  table.tc td[data-label=""] { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
  table.tc td .btn, table.tc td > button { min-height: 36px; }
  table.tc td .pill { font-size: .74rem; }

  /* recepção: uma consulta por linha — hora, nome e "Chegou"; embaixo situação, cobrança e profissional */
  table.tc.rc-tab tbody tr { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: center; column-gap: 10px; row-gap: 2px; padding: 8px 12px; }
  table.tc.rc-tab tbody tr::after { content: ""; order: 3; flex-basis: 100%; height: 0; }
  table.tc.rc-tab td::before { display: none; }
  table.tc.rc-tab td { display: block; flex-direction: row; font-size: .8rem; }
  table.tc.rc-tab td.rc-h { order: 0; width: 42px; font-family: var(--f-tit); font-weight: 700; font-size: .95rem; color: var(--petroleo); }
  table.tc.rc-tab td.rc-n { order: 1; flex: 1 1 0; min-width: 0; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  table.tc.rc-tab td.rc-b { order: 2; grid-column: auto; }
  table.tc.rc-tab td.rc-b.tc-vazia { display: none; }
  table.tc.rc-tab td.rc-b .btn { min-height: 34px; padding: 4px 12px; }
  table.tc.rc-tab :is(td.rc-s, td.rc-c, td.rc-m) { order: 4; color: var(--aco); }
  table.tc.rc-tab td.rc-c { order: 5; }
  table.tc.rc-tab td.rc-m { order: 6; }
  table.tc.rc-tab td.rc-m.rc-1 { display: none; }
  table.tc.rc-tab td.rc-s { margin-left: 52px; }
  table.tc.rc-tab td.rc-c::before { display: inline; content: "Cobrar: "; font-size: inherit; color: inherit; }
  table.tc.rc-tab td.rc-m::before { display: inline; content: "· "; font-size: inherit; color: inherit; }
  table.tc.rc-tab td.rc-c { color: var(--tinta); font-weight: 600; }
  table.tc.rc-tab td.tc-larga { flex-basis: 100%; }
}

/* ======================================================================================================================
   Semana em lista no celular (29/10/2026, imagem aprovada pelo Chefe). No computador continua a grade.
   ====================================================================================================================== */
.ag-lista { display: none; }
@media (max-width: 760px) {
  .ag-so-pc { display: none; }
  .ag-lista { display: block; }
  .al-tot { font-size: .8rem; color: var(--aco); margin: 2px 2px 8px; }
  .al-tira { display: flex; gap: 6px; margin-bottom: 10px; }
  .al-dia { flex: 1 1 0; min-width: 0; background: var(--sup); border: 0; border-radius: 10px; padding: 5px 0 6px; text-align: center; font-size: .68rem; color: var(--aco); cursor: pointer; touch-action: manipulation; box-shadow: 0 1px 1px rgb(12 58 59 / .05); }
  .al-dia b { display: block; font-family: var(--f-tit); font-weight: 700; font-size: 1rem; color: var(--tinta); line-height: 1.2; }
  .al-dia i { display: block; font-style: normal; font-size: .6rem; font-weight: 600; color: var(--ok); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; }
  .al-dia.off { opacity: .45; background: transparent; box-shadow: none; }
  .al-dia.hoje { outline: 2px solid var(--ouro); }
  .al-cx { background: var(--sup); border-radius: 14px; margin-bottom: 10px; overflow: hidden; box-shadow: 0 1px 1px rgb(12 58 59 / .05), 0 6px 18px rgb(12 58 59 / .08); scroll-margin-top: 80px; }
  .al-cx header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; padding: 9px 12px; background: #f4f8f6; border-bottom: 1px solid var(--linha); }
  .al-cx header b { font-family: var(--f-tit); font-size: .95rem; color: var(--petroleo); }
  .al-cx header span { font-size: .74rem; color: var(--aco); }
  .al-cx header em { margin-left: auto; font-style: normal; font-size: .72rem; font-weight: 600; color: var(--ok); }
  .al-l { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 12px; border: 0; border-bottom: 1px solid #eef2f0; background: none; text-align: left; font: inherit; font-size: .86rem; color: var(--tinta); cursor: pointer; touch-action: manipulation; }
  .al-l:last-child { border-bottom: 0; }
  .al-l:active { background: #f1f6f4; }
  .al-st { flex: none; width: 4px; align-self: stretch; border-radius: 3px; background: #e3ebe8; }
  .al-st.ok { background: var(--ok); } .al-st.at { background: var(--at); } .al-st.mal { background: var(--mal); }
  .al-l[style*="--cor-med"] .al-st:not(.ok):not(.at):not(.mal) { background: var(--cor-med); }
  .al-l time { flex: none; width: 42px; font-family: var(--f-tit); font-weight: 700; font-size: .86rem; color: var(--petroleo); font-variant-numeric: tabular-nums; }
  .al-n { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
  .al-n small { font-weight: 400; font-size: .72rem; color: var(--aco); }
  .al-ic { flex: none; display: flex; gap: 3px; }
  .al-livre .al-n { font-weight: 500; font-style: italic; color: var(--aco); }
  .al-mais { flex: none; font-size: .72rem; font-weight: 600; color: var(--petroleo); border: 1px solid var(--linha); border-radius: 999px; padding: 3px 10px; }
  .al-bq .al-n { font-weight: 400; color: var(--aco); white-space: normal; }
  .al-bq .al-n b { color: var(--tinta); font-weight: 600; }
  .al-fila .al-n { white-space: normal; overflow: visible; }
}
