/* Good Sistema de Gestão como app no celular: instalação, barra inferior, lançamentos rápidos e listas com seleção (complementa o app.css). */
.instalar-app { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 40px; margin: 14px 0 0; padding: 8px 10px; border: 1px dashed rgba(52, 211, 153, .45); border-radius: 10px; background: rgba(14, 159, 110, .1); color: #d1fae5; font: inherit; font-weight: 600; cursor: pointer; text-align: left; }
.instalar-app:hover { background: rgba(14, 159, 110, .2); }
.instalar-app[hidden], .aviso-instalar[hidden], .aviso-instalar.fora { display: none; }
.instalar-app svg { color: #34d399; }
.aviso-instalar { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px 8px 10px 12px; margin-bottom: 14px; box-shadow: var(--shadow); }
.aviso-instalar img { width: 38px; height: 38px; border-radius: 10px; flex: none; }
.aviso-instalar div { flex: 1; min-width: 0; line-height: 1.3; }
.aviso-instalar b { display: block; font-size: 14px; }
.aviso-instalar span { font-size: 12.5px; color: var(--muted); }
.passos-instalar { padding-left: 20px; line-height: 1.8; margin: 0 0 10px; }
.barra-app { display: none; }
@media (max-width: 860px) {
  .barra-app { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: rgba(255, 255, 255, .96); backdrop-filter: saturate(1.4) blur(12px);
    border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); box-shadow: 0 -6px 20px rgba(15, 30, 25, .06); }
  .barra-app a, .barra-app button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px; padding: 4px 2px;
    border: 0; background: none; border-radius: 12px; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .barra-app svg { width: 22px; height: 22px; }
  .barra-app span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .barra-app a.active { color: var(--brand-dark, #047857); }
  .barra-app a.active svg { background: var(--brand-soft, #e3f6ee); border-radius: 99px; padding: 3px 14px; width: 50px; height: 28px; box-sizing: border-box; }
  .content { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
  body.sem-barra .barra-app { display: none; }
  /* Com o menu ou uma janela aberta, o balão do Gudi não fica por cima */
  body:has(.sidebar.open) .gudi, body.com-modal .gudi { display: none; }
  body.sem-barra .content { padding-bottom: 28px; }
  .topbar { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .sidebar { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
}
/* Botão "+" (lançamentos rápidos) no meio da barra inferior */
.barra-app .lancar-btn i { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px; background: var(--brand-strong, #067f5a); color: #fff; font-style: normal; font-size: 30px; font-weight: 400; line-height: 1; box-shadow: 0 6px 18px rgba(6, 127, 90, .35); }
.lancar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.lancar a { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; color: var(--text); font-weight: 600; font-size: 14px; }
.lancar a:hover { border-color: var(--brand); background: var(--brand-soft); }
.lancar svg { width: 22px; height: 22px; color: var(--brand-dark); flex: none; }
/* Listas com seleção no celular: caixinha no canto do cartão e "Selecionar todos" acima */
@media (max-width: 640px) {
  table.t.resp.sel thead { position: static; width: auto; height: auto; overflow: visible; clip: auto; display: block; }
  table.t.resp.sel thead tr { display: flex; padding: 10px 16px; border-bottom: 1px solid var(--line); }
  table.t.resp.sel thead th { display: none; }
  table.t.resp.sel thead th:first-child { display: flex; align-items: center; gap: 10px; width: auto !important; padding: 0; border: 0; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: none; letter-spacing: 0; }
  table.t.resp.sel thead th:first-child::after { content: "Selecionar todos"; }
  table.t.resp.sel tbody tr { position: relative; padding-left: 48px; }
  table.t.resp.sel tbody td:first-child { position: absolute; left: 16px; top: 12px; width: auto; padding: 0; }
  table.t.resp.sel tbody td:nth-child(2) { justify-content: flex-start; text-align: left; font-weight: 700; font-size: 14.5px; padding-bottom: 5px; }
  table.t.resp.sel tbody td:nth-child(2)::before { content: none; }
  table.t.resp.sel input[type=checkbox] { width: 20px; height: 20px; }
}
/* Aberto como app instalado: o topo respeita a barra de status/entalhe */
@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top)); }
  .sidebar { padding-top: env(safe-area-inset-top); }
  .auth { padding-top: env(safe-area-inset-top); }
}
/* Tela de abertura (enquanto o sistema carrega) */
.boot > div { display: grid; justify-items: center; gap: 10px; text-align: center; }
.boot img { border-radius: 18px; box-shadow: 0 10px 30px rgba(14, 159, 110, .3); }
.boot b { color: var(--text); font-family: var(--titulo); font-size: 17px; }
.boot span { font-size: 13.5px; }
/* Sem internet: faixa fixa no topo */
.sem-internet { position: fixed; left: 0; right: 0; top: 0; z-index: 90; padding: calc(8px + env(safe-area-inset-top)) 16px 8px; background: #7c2d12; color: #fff; font-size: 13.5px; font-weight: 600; text-align: center; }
.sem-internet[hidden] { display: none; }
/* Puxar para atualizar (app instalado) */
.app-instalado body { overscroll-behavior-y: contain; }
.puxar { position: fixed; top: calc(70px + env(safe-area-inset-top)); left: 50%; z-index: 45; width: 40px; height: 40px; margin-top: -48px; border-radius: 50%; background: #fff; color: var(--muted); box-shadow: 0 4px 14px rgba(15, 30, 25, .18); display: grid; place-items: center; opacity: 0; transform: translate(-50%, 0); pointer-events: none; transition: opacity .15s; }
.puxar svg { width: 20px; height: 20px; }
.puxar.pronto, .puxar.girando { color: var(--brand-dark); }
.puxar.girando svg { animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }
@media (max-width: 640px) {
  /* Formulários: "Voltar" discreto à esquerda */
  .page-head > a.btn.ghost { flex: 0 0 auto; padding-left: 0; padding-right: 8px; }
  /* Itens da venda/OS/orçamento em cartões: descrição em cima, quantidade, unitário e desconto lado a lado */
  .table-wrap:has(> table.t.itens) { overflow: visible; }
  table.t.itens thead { display: none; }
  table.t.itens, table.t.itens tbody { display: block; }
  table.t.itens tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  table.t.itens td { display: block; width: auto !important; padding: 0; border: 0; text-align: left; }
  table.t.itens td:first-child { grid-column: 1 / -1; font-weight: 600; }
  table.t.itens td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 3px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
  table.t.itens td[data-total] { grid-column: 1 / 3; align-self: center; font-weight: 700; font-size: 15px; }
  table.t.itens td:has(> [data-del]) { text-align: right; align-self: end; }
  table.t.itens td.vazio { grid-column: 1 / -1; text-align: center; }
}

