/* App do celular: botão Importar e ajustes para caber na tela pequena. Só acrescenta. */
#app-importar {
  position: fixed; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 2147483000; min-height: 48px; padding: 0 22px; border: 0; border-radius: 999px;
  background: #182947; color: #fff; font: 600 17px/1 system-ui, sans-serif;
  box-shadow: 0 4px 16px rgba(0,0,0,.3); cursor: pointer;
}
#app-importar.app-no-topo { position: static; box-shadow: none; min-height: 44px; font-size: inherit; padding: 0 18px; z-index: auto; }
#app-importar:active { transform: scale(.97); }
#app-aviso {
  position: fixed; left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
  z-index: 2147483000; padding: 12px 16px; border-radius: 12px; background: #182947; color: #fff;
  font: 16px/1.3 system-ui, sans-serif; text-align: center;
}
#app-aviso.erro { background: #9b2226; }
@media (max-width: 640px) {
  body { overflow-x: hidden; }
  img, svg, canvas { max-width: 100%; }
  .botao { min-height: 44px; }
  /* Mesa no celular: tudo numa coluna, nada passa da largura da tela */
  html, body { max-width: 100vw; }
  .mesa-topo, .topo-acoes, .mesa-pedido, .mesa-cartoes, .arte-cartao, .campos, .campo, .faixa-dev, .moldura-dev {
    max-width: 100%; min-width: 0; box-sizing: border-box;
  }
  .mesa-topo, .topo-acoes { flex-wrap: wrap; }
  .campos { grid-template-columns: 1fr !important; }
  .pagina { max-width: 100%; min-width: 0; }
  .mesa-rodape, .acoes-rodape { flex-wrap: wrap; max-width: 100%; }
  .mesa-rodape .nota { min-width: 0 !important; }
  .acoes-rodape > * { flex: 1 1 140px; min-width: 0; }
  .mesa-cartoes, .arte-cartao { grid-template-columns: minmax(0, 1fr) !important; }
  .acoes-rodape .botao, .acoes-rodape button { white-space: normal; }
  #gravar-texto { white-space: normal; }
  .acoes-rodape { flex-wrap: wrap !important; }
  .acoes-rodape #montar-todas { white-space: normal !important; flex: 1 1 140px !important; }
  .acoes-rodape #gravar-mesa { flex: 1 1 140px !important; }
  .campo input, .campo select, .campo textarea { width: 100%; min-width: 0; box-sizing: border-box; }
}

/* Barra de baixo + painel do Google Drive */
#app-barra { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147482000; display: flex; background: #182947;
  padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 8px rgba(0,0,0,.25); }
#app-barra a { flex: 1; text-align: center; padding: 14px 8px; min-height: 44px; box-sizing: border-box; color: #cfd8ea;
  font: 600 16px/1.2 system-ui, sans-serif; text-decoration: none; }
#app-barra a[aria-current="page"] { color: #fff; box-shadow: inset 0 -3px 0 #4da3ff; }
body.app-com-barra { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
body.app-com-barra #app-importar:not(.app-no-topo) { bottom: calc(76px + env(safe-area-inset-bottom)); }
.drv-modo { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0; }
.drv-modo .escolhido { background: #182947; color: #fff; }
.drv-faixa { padding: 10px 12px; border-radius: 10px; background: #fff3cd; color: #5c4400; }
#drv-painel .dtf-campos, #drv-painel .dtf-ajustes { display: grid; grid-template-columns: 1fr; gap: 10px; }
#drv-painel .campo input, #drv-painel .campo select { width: 100%; min-height: 44px; box-sizing: border-box; font-size: 16px; }
#drv-painel .dtf-artes { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; }
#drv-painel .dtf-artes input { width: 84px; min-height: 40px; font-size: 16px; box-sizing: border-box; }
#drv-painel .dtf-artes input[type=text] { width: 130px; }
#drv-painel .dtf-mini { width: 48px; height: 48px; object-fit: contain; background: #eee; border-radius: 6px; }
#drv-painel .dtf-linha-botoes { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
#drv-painel .erro { color: #9b2226; font-weight: 600; }
body.app-com-barra .atz-selo { bottom: calc(60px + env(safe-area-inset-bottom)) !important; }
body.app-com-barra .toasts { bottom: calc(72px + env(safe-area-inset-bottom)); }
/* artes: cada linha vira um cartão (cabe em 390 px) */
#drv-painel .dtf-artes, #drv-painel .dtf-artes tbody { display: block; }
#drv-painel .dtf-artes thead { display: none; }
#drv-painel .dtf-artes tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid #dde3ee; }
#drv-painel .dtf-artes td { display: block; padding: 0; min-width: 0; }
#drv-painel .dtf-artes td:nth-child(2) { grid-column: 2 / 4; }
#drv-painel .dtf-artes input, #drv-painel .dtf-artes input[type=text] { width: 100%; }
#drv-painel .dtf-artes td:nth-child(3)::before { content: "Largura (cm)"; display: block; font-size: 12px; color: #5a6784; }
#drv-painel .dtf-artes td:nth-child(4)::before { content: "Altura (cm)"; display: block; font-size: 12px; color: #5a6784; }
#drv-painel .dtf-artes td:nth-child(5)::before { content: "Quantidade"; display: block; font-size: 12px; color: #5a6784; }
#drv-painel .dtf-artes td:nth-child(3), #drv-painel .dtf-artes td:nth-child(4) { grid-column: auto; }
#drv-painel .dtf-artes td:nth-child(6) { grid-column: 1 / 4; }
