/* =====================================================================
   mobile.css - Aparência do SISCOM FARMA no celular.
   Carregado DEPOIS do estilo da versão web (/web/css/estilo.css): usa as
   mesmas cores (variáveis) e só ajusta tamanho de toque, layout e janelas.
   ===================================================================== */

:root {
  --nav-altura: 62px;                                  /* menu de baixo */
  --topo-altura: 54px;                                 /* barra de cima */
  --seguro-baixo: env(safe-area-inset-bottom, 0px);    /* barra de gestos do iPhone/Android */
}

html { -webkit-text-size-adjust: 100%; }
body { font-size: 16px; background: var(--fundo); overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-size: 16px; min-height: 44px; }   /* 16px: o iPhone não dá zoom ao tocar */
button { min-height: 44px; touch-action: manipulation; }          /* área de toque confortável, sem atraso de duplo toque */
button.pequeno { min-height: 36px; }
input[type="checkbox"] { min-height: 0; width: 1.3em; height: 1.3em; }

/* ---------- Login ---------- */
.tela-login { padding: 24px 16px calc(24px + var(--seguro-baixo)); }
.login-cartao { max-width: 420px; }
.logo-login { width: 64px; height: 64px; margin: 0 auto .2em; border-radius: 16px; background: var(--primaria) url("../icones/icone.svg") center/100% no-repeat; }
.login-cartao h1 { text-align: center; margin: 0; }
.login-cartao > .sutil:first-of-type { text-align: center; margin: 0; }

/* ---------- Estrutura ---------- */
.m-app { min-height: 100vh; min-height: 100dvh; }
.m-topo {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: .4em;
  min-height: calc(var(--topo-altura) + env(safe-area-inset-top, 0px));
  padding: env(safe-area-inset-top, 0px) 12px 0;
  background: var(--primaria); color: #fff;
}
.m-titulos { min-width: 0; flex: 1; }
.m-titulo { font-weight: 700; font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-farmacia { font-size: .78rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.m-icone { background: none; border: 0; color: inherit; padding: 0; width: 44px; margin-left: -8px; }
.m-icone svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

.m-conteudo { padding: 16px 16px calc(var(--nav-altura) + var(--seguro-baixo) + 24px); min-width: 0; }
.m-conteudo > .faixa-alerta { margin-bottom: 1em; }

.m-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; height: calc(var(--nav-altura) + var(--seguro-baixo)); padding-bottom: var(--seguro-baixo);
  background: var(--cartao); border-top: 1px solid var(--borda); box-shadow: 0 -2px 10px rgba(0,0,0,.05);
}
.m-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--sutil); text-decoration: none; font-size: .72rem; font-weight: 600; }
.m-nav a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-nav a.ativo { color: var(--primaria); }
.m-nav a.ativo svg { stroke-width: 2.4; }

/* Telas reaproveitadas da versão web: o título já aparece na barra de cima */
#conteudo h1 { display: none; }                        /* o título já está na barra verde de cima */
.m-conteudo .cabecalho:has(> h1:only-child) { display: none; }
.m-conteudo .barra { flex-direction: column; align-items: stretch; }   /* filtros um embaixo do outro */
.m-conteudo .barra > * { width: 100% !important; min-width: 0 !important; flex: none !important; margin: 0 !important; }
.m-conteudo .cabecalho > button { flex: 1 1 auto; white-space: normal; }
.m-conteudo .grade { grid-template-columns: 1fr; }
.m-conteudo .duas-colunas { grid-template-columns: 1fr; }
.m-conteudo .cartoes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6em; }
.m-conteudo .indicador .valor { font-size: 1.25rem; }
.m-conteudo .pdv, .m-conteudo .relatorios, .m-conteudo .perfis-layout, .m-conteudo .empresa-layout { grid-template-columns: minmax(0, 1fr); }
.m-conteudo .pagamento { position: static; }
.m-conteudo td.quebra { min-width: 160px; }
.m-conteudo .tabela-caixa { -webkit-overflow-scrolling: touch; }
.m-conteudo .paginacao { justify-content: center; }
.m-conteudo kbd { display: none; }                   /* teclas F2/F4 não existem no celular */

/* ---------- Janelas: ocupam a tela de baixo para cima ---------- */
.modal-fundo { padding: 0; place-items: end center; z-index: 30; }
.modal, .modal-largo { max-width: 640px; width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 16px 16px 0 0; animation: subir .18s ease-out; }
.modal-corpo { padding: 1em 1em calc(1em + var(--seguro-baixo)); }
.modal .fechar { min-width: 44px; }
.modal .acoes button { flex: 1 1 auto; }
@keyframes subir { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
@media (min-width: 700px) { .modal-fundo { place-items: center; padding: 16px; } .modal, .modal-largo { border-radius: var(--raio); } }

/* Avisos rápidos acima do menu de baixo */
.aviso { left: 16px; right: 16px; bottom: calc(var(--nav-altura) + var(--seguro-baixo) + 12px); text-align: center; z-index: 40; max-width: none; box-shadow: 0 4px 14px rgba(0,0,0,.18); }

/* ---------- Componentes do celular ---------- */
.m-lista { display: flex; flex-direction: column; gap: .5em; }
.m-item { display: flex; gap: .8em; align-items: center; padding: .8em .9em; background: var(--cartao); border: 1px solid var(--borda); border-radius: var(--raio); text-align: left; width: 100%; font: inherit; color: inherit; }
button.m-item { white-space: normal; justify-content: flex-start; min-height: 56px; }
button.m-item:active { background: #f0f7f6; }
.m-item .m-meio { flex: 1; min-width: 0; }
.m-item .m-nome { font-weight: 600; overflow-wrap: anywhere; }
.m-item .m-det { font-size: .85rem; color: var(--sutil); overflow-wrap: anywhere; }
.m-item .m-valor { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

.m-secao { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--sutil); font-weight: 700; margin: 1.4em 0 .5em; }
.m-secao:first-child { margin-top: 0; }

.m-atalhos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6em; }
.m-atalho { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: .6em; min-height: 92px; padding: .9em; white-space: normal; text-align: left; border-radius: 12px; font-weight: 650; text-decoration: none; background: var(--cartao); border: 1px solid var(--borda); color: var(--texto); }
.m-atalho svg { width: 28px; height: 28px; fill: none; stroke: var(--primaria); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-atalho.destaque { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.m-atalho.destaque svg { stroke: #fff; }

.m-indicadores { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6em; margin-bottom: 1em; }
.m-indicadores .cartao { padding: .8em .9em; }
.m-indicadores .rotulo { font-size: .8rem; color: var(--sutil); }
.m-indicadores .valor { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; }

.m-busca { display: flex; gap: .5em; }
.m-busca input { flex: 1; font-size: 1.05rem; }
.m-busca .m-ler { flex: none; width: 52px; padding: 0; background: var(--primaria); border-color: var(--primaria); color: #fff; }
.m-busca .m-ler svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }

.m-qtd { display: inline-flex; align-items: center; border: 1px solid var(--borda); border-radius: 99px; overflow: hidden; flex: none; }
.m-qtd button { border: 0; border-radius: 0; width: 40px; min-height: 40px; padding: 0; font-size: 1.25rem; font-weight: 700; background: #f4f6f8; }
.m-qtd span { min-width: 2.2em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.m-remover { border: 0; background: none; color: var(--perigo); width: 40px; padding: 0; font-size: 1.4rem; }

/* Barra fixa com o total (acima do menu de baixo) */
.m-rodape-fixo {
  position: fixed; left: 0; right: 0; bottom: calc(var(--nav-altura) + var(--seguro-baixo)); z-index: 4;
  display: flex; align-items: center; gap: .8em; padding: .6em 16px;
  background: var(--cartao); border-top: 1px solid var(--borda); box-shadow: 0 -4px 12px rgba(0,0,0,.06);
}
.m-rodape-fixo .m-total { flex: 1; min-width: 0; }
.m-rodape-fixo .m-total small { display: block; color: var(--sutil); font-size: .8rem; }
.m-rodape-fixo .m-total strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
.m-rodape-fixo button { flex: none; min-width: 42%; }
.m-com-rodape { padding-bottom: 80px; }

.m-chips { display: flex; flex-wrap: wrap; gap: .5em; }
.m-chips button { flex: 1 1 auto; border-radius: 99px; }
.m-chips button.ativo { background: var(--primaria); border-color: var(--primaria); color: #fff; }
.m-total-grande { font-size: 2.2rem; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; margin: .2em 0; }
.m-troco { font-size: 1.4rem; font-weight: 700; text-align: center; padding: .6em; border-radius: var(--raio); background: #ecfdf3; color: #085d3a; }
.m-form { display: flex; flex-direction: column; gap: .9em; }
.m-botoes { display: flex; flex-direction: column; gap: .6em; }
.m-botoes button, .m-botoes a.botao-link { width: 100%; text-align: center; }
.m-vazio { text-align: center; color: var(--sutil); padding: 2em 1em; }
.m-check { display: flex; align-items: center; gap: .7em; padding: .8em .9em; border: 1px solid var(--borda); border-radius: var(--raio); background: var(--cartao); font-weight: 600; }
.m-ok { text-align: center; padding: 1em 0 .4em; }
.m-ok .m-circulo { width: 72px; height: 72px; margin: 0 auto .6em; border-radius: 50%; background: #dcfae6; display: grid; place-items: center; }
.m-ok .m-circulo svg { width: 40px; height: 40px; fill: none; stroke: #067647; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Leitor de código de barras ---------- */
.m-leitor { position: fixed; inset: 0; z-index: 50; background: #000; display: flex; flex-direction: column; }
.m-leitor video { flex: 1; width: 100%; min-height: 0; object-fit: cover; }
.m-leitor .m-mira { position: absolute; left: 10%; right: 10%; top: 38%; height: 22%; border: 3px solid rgba(255,255,255,.9); border-radius: 12px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); pointer-events: none; }
.m-leitor .m-mira::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; border-top: 2px solid #f04438; }
.m-leitor .m-leitor-barra { display: flex; gap: .6em; align-items: center; padding: 12px 16px calc(12px + var(--seguro-baixo)); background: #111; color: #fff; }
.m-leitor .m-leitor-barra span { flex: 1; font-size: .9rem; }
.m-leitor .m-leitor-barra button { flex: none; }

/* Comprovante na tela */
.m-comprovante { background: #fff; border: 1px dashed var(--borda); border-radius: var(--raio); padding: .8em; font: 13px/1.4 ui-monospace, "Courier New", monospace; white-space: pre-wrap; overflow-x: auto; }
