/* ===== Ultrasystem no celular (até 760px). No computador nada aqui se aplica. ===== */
.bottom-nav { display: none; }

@media (max-width: 760px) {
  html, body { -webkit-text-size-adjust: 100%; }
  body { overscroll-behavior-y: none; }
  /* iPhone dá zoom em campo com letra < 16px */
  input, select, textarea { font-size: 16px; }
  kbd { display: none !important; }

  /* ---------- estrutura: topo compacto + barra de navegação embaixo ---------- */
  .main { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; top: 0; z-index: 30; background: var(--bg); padding: 10px 12px 8px; gap: 8px; flex-wrap: nowrap;
    border-bottom: 1px solid var(--border); box-shadow: 0 2px 10px rgba(11,37,69,.04); }
  .topbar h1 { font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .menu-toggle { display: none !important; }
  #page-actions { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 58%; gap: 6px; }
  #page-actions::-webkit-scrollbar { display: none; }
  #page-actions .btn { padding: 7px 10px; font-size: 13px; }
  .page { padding: 12px 12px 24px; }

  .bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -4px 18px rgba(11,37,69,.08);
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); }
  .bottom-nav a, .bottom-nav button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 54px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600; background: none; border: 0; border-radius: 10px; font-family: inherit; }
  .bottom-nav .on { color: var(--primary); background: var(--primary-soft); }
  .bottom-nav .sell { color: #fff; background: linear-gradient(135deg, var(--primary) 0%, var(--navy) 100%); margin: 0 4px; box-shadow: 0 6px 16px rgba(11,37,69,.25); }
  .shell.focus .bottom-nav { display: none; }
  .side { width: 82vw; max-width: 300px; box-shadow: 8px 0 30px rgba(0,0,0,.25); }
  .side-backdrop { position: fixed; inset: 0; background: rgba(15,25,38,.4); z-index: 39; }

  /* ---------- tabelas viram cartões ---------- */
  .table-wrap { border: 0; background: transparent; overflow: visible; }
  .table-wrap table.t, .table-wrap table.t tbody { display: block; }
  .table-wrap table.t thead { display: none; }
  .table-wrap table.t tr { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 8px 12px; margin-bottom: 8px; box-shadow: 0 1px 3px rgba(11,37,69,.04); }
  .table-wrap table.t tr.click:active { background: var(--primary-soft); }
  .table-wrap table.t tr.click:hover td { background: none; }
  .table-wrap table.t td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; border: 0; text-align: right; min-height: 26px; }
  .table-wrap table.t td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; text-align: left; flex: none; }
  .table-wrap table.t td[data-label=""]::before { content: none; }
  .table-wrap table.t td[data-label=""] { justify-content: flex-end; }
  .table-wrap table.t td:first-child { font-size: 15px; justify-content: space-between; border-bottom: 1px solid var(--border); padding-bottom: 7px; margin-bottom: 3px; }
  .table-wrap table.t td:empty, .table-wrap table.t td.vazio { display: none; }
  .table-wrap .empty { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }

  /* ---------- janelas viram "folhas" que sobem de baixo ---------- */
  .overlay { padding: 0; place-items: end stretch; }
  .modal, .modal.wide, .modal.xwide { width: 100%; max-height: 94vh; border-radius: 18px 18px 0 0; animation: subir .22s ease both; }
  .modal header { padding: 14px 16px 0; }
  .modal .body { padding: 12px 16px; }
  .modal footer { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); gap: 6px; }
  .modal footer .btn { flex: 1 1 calc(50% - 6px); justify-content: center; padding: 11px 8px; white-space: normal; text-align: center; }
  .modal footer .btn.primary { flex-basis: 100%; order: -1; font-size: 16px; }
  @keyframes subir { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }

  /* ---------- outros ---------- */
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs button { white-space: nowrap; padding: 9px 12px; }
  .row { gap: 8px; }
  .btn { padding: 9px 12px; }
  #toasts { left: 12px; right: 12px; bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  /* =================== CAIXA (PDV) no celular =================== */
  .cx { height: 100dvh; }
  .cx-head { padding: 8px 10px; gap: 8px; }
  .cx-head .store { font-size: 15px; }
  .cx-head .meta { font-size: 12px; gap: 8px; }
  .cx-head #clock, .cx-head .sound-toggle { display: none; }
  .cx-head label.meta { width: 100%; justify-content: space-between; }
  .cx-head label.meta select { flex: 1; max-width: 70%; padding: 6px 8px; }
  .cx-body { padding: 8px 10px; gap: 8px; }
  .cx-entry { grid-template-columns: 64px 1fr; gap: 8px; }
  .cx-entry .lbl { display: none; }
  .cx-entry input { font-size: 20px; padding: 10px 12px; border-radius: 10px; }
  .cx-entry .results, .results { left: 0 !important; right: 0; max-height: 55vh; }
  .results .it { grid-template-columns: 1fr auto; gap: 4px 10px; padding: 10px 12px; }
  .results .it > div:nth-child(2) { grid-row: 2; grid-column: 1; }
  .results .it > div:nth-child(3) { grid-row: 1 / 3; grid-column: 2; font-size: 16px; }

  /* itens da venda em cartões */
  .cx-list { border-radius: 12px; }
  .cx-list table.t, .cx-list table.t tbody { display: block; }
  .cx-list table.t thead { display: none; }
  .cx-list table.t tr { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "prod rm" "qtd total" "preco desc"; gap: 4px 8px;
    padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .cx-list table.t td { padding: 0; border: 0; font-size: 14px; display: block; text-align: left; }
  .cx-list table.t td:nth-child(1) { display: none; }
  .cx-list table.t td:nth-child(2) { grid-area: prod; }
  .cx-list table.t td:nth-child(3) { grid-area: qtd; }
  .cx-list table.t td:nth-child(4) { grid-area: preco; }
  .cx-list table.t td:nth-child(5) { grid-area: desc; text-align: right; }
  .cx-list table.t td:nth-child(6) { grid-area: total; text-align: right; align-self: center; font-size: 17px; }
  .cx-list table.t td:nth-child(7) { grid-area: rm; }
  .cx-list .qty-ctl .btn { min-width: 38px; min-height: 36px; justify-content: center; font-size: 18px; }
  .cx-list .qty-ctl input { width: 52px; text-align: center; padding: 7px 4px; }
  .cx-list .empty { padding: 34px 16px; }

  /* rodapé: cliente, ações em faixa que rola de lado e o botão de pagar sempre visível */
  .cx-foot { grid-template-columns: 1fr; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .cx-sum { display: none; }
  .cx-cust { font-size: 13px; }
  .cx-tools { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; padding-bottom: 2px; }
  .cx-tools::-webkit-scrollbar { display: none; }
  .tool { flex: 0 0 auto; min-width: 74px; max-width: none; padding: 8px 10px; font-size: 12px; }
  .paybtn { min-height: 62px; flex-direction: row; gap: 14px; border-radius: 12px; }
  .paybtn .l { font-size: 12px; }
  .paybtn .v { font-size: 26px; }
  .paybtn .k { display: none; }
}

/* telas bem estreitas */
@media (max-width: 380px) {
  .bottom-nav a, .bottom-nav button { font-size: 10px; }
  .cx-entry { grid-template-columns: 56px 1fr; }
}

/* botões do topo: no celular fica o principal + "⋯" com os outros */
@media (max-width: 760px) {
  #page-actions .btn.cel-oculto { display: none; }
  #page-actions .btn.cel-mais { font-size: 20px; padding: 4px 12px; line-height: 1; }
  #page-actions { max-width: none; overflow: visible; }
  .acoes-folha .btn { width: 100%; justify-content: flex-start; padding: 13px 14px; font-size: 16px; margin-bottom: 8px; }
}
@media (max-width: 760px) {
  .cx-list tr.last td { background: none; }
  .cx-list table.t tr.last { background: #f2f6fc; }
}
