/* Calculadora de NF-e — Grupo Casa do Pão (site). Mesmo visual do programa do Windows (menu lateral, cartões). */
:root {
  --vinho: #8E2433; --vinho-esc: #6E1A27; --vinho-3: #5A1420; --vermelho: #B0333F;
  --dourado: #E0A526; --amarelo: #F6C20B; --marrom: #6B5323; --marrom-esc: #46361A;
  --fundo: #F5F1EA; --card: #FFFFFF; --borda: #E8DFCF; --borda-forte: #D9CCB4;
  --texto: #2B2218; --sub: #7A6B55; --erro-bg: #FBE3E5; --erro-tx: #A0192B;
  --manual-bg: #FFF4CC; --ok-tx: #2E7D32; --ok-bg: #E6F4E7; --azul-bg: #E3F0FA; --azul-tx: #1F5F8B;
  --creme: #FBF4E4; --raio: 14px; --lateral: 236px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--fundo); color: var(--texto);
  font-family: "Segoe UI", "Noto Sans", Roboto, system-ui, -apple-system, sans-serif; font-size: 14px;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--vinho); }
svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------ login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 20% 0%, #A8303F 0%, var(--vinho) 35%, var(--vinho-3) 100%); }
.login-card { width: 100%; max-width: 400px; background: var(--card); border-radius: 20px; padding: 28px 26px 24px;
  box-shadow: 0 24px 60px rgba(40, 6, 12, .35); }
.login-marca { text-align: center; margin-bottom: 18px; }
.login-marca img { height: 96px; }
.login-marca h1 { margin: 10px 0 2px; font-size: 22px; font-weight: 800; }
.login-marca .t2 { font-size: 11px; font-weight: 800; letter-spacing: 2px; color: var(--vinho); }
.login .bt { width: 100%; margin-top: 18px; padding: 13px; font-size: 16px; }
.login .erro-msg { margin-top: 12px; }
.login-rodape { text-align: center; color: var(--sub); font-size: 12px; margin-top: 16px; }
.manter { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--sub); }

/* ------------------------------------------------------------------ estrutura */
.app { display: flex; height: 100%; }
.lateral {
  width: var(--lateral); flex: none; display: flex; flex-direction: column; gap: 4px; padding: 18px 14px 14px;
  background: linear-gradient(180deg, var(--vinho), var(--vinho-3)); color: #fff; overflow-y: auto;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 0 2px 14px; }
.marca-logo { width: 54px; height: 54px; background: #fff; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.marca-logo img { width: 46px; height: 46px; object-fit: contain; }
.marca .t1 { font-size: 16px; font-weight: 800; line-height: 1.15; }
.marca .t2 { font-size: 10px; font-weight: 800; color: var(--amarelo); letter-spacing: .5px; margin-top: 3px; }
.sep { height: 1px; background: rgba(255, 255, 255, .16); margin: 8px 0; }
.nav { display: flex; align-items: center; gap: 12px; width: 100%; background: transparent; color: rgba(255, 255, 255, .88);
  border: 0; border-left: 4px solid transparent; border-radius: 10px; padding: 11px 12px 11px 10px; font-size: 14.5px;
  font-weight: 600; text-align: left; cursor: pointer; text-decoration: none; }
.nav:hover { background: rgba(255, 255, 255, .08); }
.nav.ativo { background: rgba(255, 255, 255, .16); color: #fff; border-left-color: var(--amarelo); }
.nav .ic { width: 20px; height: 20px; }
.nav .badge { margin-left: auto; background: rgba(255, 255, 255, .2); border-radius: 9px; padding: 1px 8px; font-size: 11.5px; font-weight: 700; }
.lateral .espaco { flex: 1; }
.caixa-usuario { background: rgba(0, 0, 0, .2); border-radius: 12px; padding: 12px; display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--amarelo); color: #4A3200; font-weight: 800;
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
.caixa-usuario .nome { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caixa-usuario .papel { font-size: 11.5px; color: rgba(255, 255, 255, .75); }
.link-lateral { background: none; border: 0; color: rgba(255, 255, 255, .85); text-decoration: underline; cursor: pointer; padding: 2px 4px; font-size: 12px; }
.versao { font-size: 11px; color: rgba(255, 255, 255, .55); text-align: center; margin-top: 8px; }

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100%; }
.pagina { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.topo { background: var(--card); border-bottom: 1px solid var(--borda); padding: 16px 26px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.topo .titulos { flex: 1; min-width: 200px; }
.topo h2 { margin: 0; font-size: 23px; font-weight: 800; }
.topo .sub { color: var(--sub); font-size: 12.5px; margin-top: 2px; }
.topo .acoes { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.conteudo { flex: 1; min-height: 0; overflow: auto; padding: 20px 26px; display: flex; flex-direction: column; gap: 14px; }
.barra-inferior { background: var(--card); border-top: 1px solid var(--borda); padding: 10px 26px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rotulo-barra { font-size: 11px; font-weight: 800; color: var(--sub); letter-spacing: 1px; }
.cabecalho-movel { display: none; }

/* ------------------------------------------------------------------ cartões / textos */
.card { background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); }
.card.pad { padding: 16px 18px; }
.titulo-secao { font-size: 16px; font-weight: 800; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.rotulo { color: var(--sub); font-size: 10.5px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.mudo { color: var(--sub); }
.contador { color: var(--vinho); font-weight: 700; }
.chip { display: inline-block; border-radius: 10px; padding: 3px 10px; font-weight: 700; font-size: 12px; white-space: nowrap; }
.chip.ok { background: var(--ok-bg); color: var(--ok-tx); }
.chip.aviso { background: #FFF1D6; color: #8A5A00; }
.chip.off { background: #F1ECE3; color: var(--sub); }
.chip.adm { background: #F6E3E6; color: var(--vinho); }
.banner { background: var(--manual-bg); border: 1px solid #EBCB6B; border-radius: 10px; padding: 8px 12px; color: var(--marrom-esc); }
.banner-erro, .erro-msg { background: var(--erro-bg); border: 1px solid #E8A4AC; border-radius: 10px; padding: 8px 12px; color: var(--erro-tx); font-weight: 600; }
.banner-ok { background: var(--ok-bg); border: 1px solid #A9D5AC; border-radius: 10px; padding: 8px 12px; color: var(--ok-tx); font-weight: 600; }
.vazio { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 20px; gap: 10px; min-height: 340px; }
.vazio img { height: 150px; }
.vazio h3 { margin: 6px 0 0; font-size: 21px; font-weight: 800; }
.vazio p { margin: 0; color: var(--sub); font-size: 14px; max-width: 520px; }
.soltar { outline: 3px dashed var(--dourado); outline-offset: -10px; background: #FFFBEF; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--borda); border-radius: var(--raio); padding: 14px 18px; min-width: 0; }
.kpi .t { font-size: 12px; color: var(--sub); font-weight: 600; }
.kpi .v { font-size: 22px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.dest { background: linear-gradient(135deg, var(--vinho), #A8303F); border: 0; color: #fff; }
.kpi.dest .t { color: rgba(255, 255, 255, .82); }

/* dados da nota */
.info-nota { display: flex; gap: 16px; padding: 12px 18px; align-items: stretch; }
.info-nota .bloco { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.info-nota .vsep { width: 1px; background: #F0E8DA; flex: none; }
.campo-info { border: 1px solid transparent; background: transparent; font-weight: 700; font-size: 14px; padding: 2px 4px; border-radius: 6px; width: 100%; min-width: 0; }
.campo-info:not([readonly]) { border-color: var(--borda-forte); background: #fff; }
.campo-info:focus { outline: none; border: 2px solid var(--dourado); padding: 1px 3px; }
.chave-txt { font-size: 12px; color: var(--sub); padding: 0 4px; word-break: break-all; }

/* ------------------------------------------------------------------ botões */
.bt { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--card); color: var(--texto);
  border: 1px solid var(--borda-forte); border-radius: 9px; padding: 8px 16px; font-weight: 600; min-height: 38px; cursor: pointer;
  white-space: nowrap; text-decoration: none; user-select: none; }
.bt:hover { background: #FFF8E6; border-color: var(--dourado); }
.bt:active { background: #F7E7BC; }
.bt:disabled { color: #B9AE98; background: #F6F2EA; border-color: #E8E0D0; cursor: default; }
.bt.primario { background: var(--vinho); color: #fff; border-color: var(--vinho); }
.bt.primario:hover { background: var(--vermelho); border-color: var(--vermelho); }
.bt.primario:disabled { background: #D2AFB4; color: #FBF1F2; border-color: #D2AFB4; }
.bt.ouro { background: linear-gradient(180deg, #F2BC3A, var(--dourado)); color: #3B2A06; border-color: #D49A1C; font-weight: 800; padding: 10px 22px; font-size: 15px; }
.bt.ouro:hover { background: var(--amarelo); }
.bt.ouro:disabled { background: #F1E3BF; color: #A8977A; border-color: #EADBB2; }
.bt.perigo { color: var(--erro-tx); border-color: #E2B3B9; }
.bt.perigo:hover { background: var(--erro-bg); }
.bt.fantasma { background: transparent; border-color: transparent; }
.bt.fantasma:hover { background: #F6EFE2; border-color: var(--borda); }
.bt.link { background: transparent; border: 0; color: var(--vinho); text-decoration: underline; padding: 4px 6px; min-height: 0; }
.bt.chip-bt { background: transparent; border: 1px solid transparent; border-radius: 15px; padding: 5px 14px; color: var(--sub); font-weight: 700; min-height: 30px; }
.bt.chip-bt.ativo { background: var(--vinho); color: #fff; }
.bt.chip-bt:hover:not(.ativo) { background: #F6EFE2; }
.bt.grande { padding: 11px 26px; font-size: 15px; }
.bt.peq { padding: 5px 12px; font-size: 12.5px; min-height: 30px; }
.bt.icone { padding: 8px; min-width: 38px; }
.bt.quebra { white-space: normal; text-align: center; }
.barra-inferior .bt.doc { min-width: 100px; }
.bt .ic { width: 17px; height: 17px; }
.bt.ouro .ic { width: 19px; height: 19px; }

/* percentual */
.pct { display: inline-flex; align-items: stretch; background: var(--card); border: 1px solid var(--borda-forte); border-radius: 9px; overflow: hidden; height: 40px; }
.pct button { border: 0; background: transparent; color: var(--vinho); font-size: 21px; font-weight: 700; width: 36px; cursor: pointer; }
.pct button:hover { background: #FFF4DA; }
.pct input { width: 92px; border: 0; border-left: 1px solid var(--borda-forte); border-right: 1px solid var(--borda-forte); text-align: center;
  font-size: 17px; font-weight: 800; background: #fff; }
.pct input:focus { outline: none; background: #FFFBEF; }

/* ------------------------------------------------------------------ campos */
.entrada, select.entrada, textarea.entrada { width: 100%; background: #fff; border: 1px solid var(--borda-forte); border-radius: 8px; padding: 8px 10px; min-height: 38px; }
.entrada:focus { outline: none; border: 2px solid var(--dourado); padding: 7px 9px; }
.entrada[readonly] { background: #FBF8F2; }
.busca { position: relative; flex: 1; min-width: 200px; }
.busca .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--sub); }
.busca input { width: 100%; padding: 10px 34px 10px 36px; font-size: 14.5px; background: #FFFDF9; border: 1px solid var(--borda-forte); border-radius: 10px; }
.busca input:focus { outline: none; border: 2px solid var(--dourado); padding: 9px 33px 9px 35px; }
.busca .limpar { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--sub); cursor: pointer; padding: 4px; }
label.campo { display: flex; flex-direction: column; gap: 4px; }
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--vinho); margin: 1px 0 0; flex: none; }
.linha { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.linha .cresce { flex: 1; }
.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.filtros { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex-wrap: wrap; }

/* ------------------------------------------------------------------ tabelas */
.tabela-caixa { background: #fff; border: 1px solid var(--borda); border-radius: var(--raio); overflow: auto; flex: 1; min-height: 220px; }
table.tabela { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13.5px; }
.tabela th { position: sticky; top: 0; z-index: 2; background: #FBF8F3; color: var(--sub); font-weight: 800; font-size: 11.5px; padding: 10px 6px;
  border-bottom: 1px solid var(--borda); text-align: center; white-space: nowrap; user-select: none; }
.tabela th.ord { cursor: pointer; }
.tabela th.ord:hover { background: #F5EEE2; }
.tabela th .seta { color: var(--dourado); margin-left: 3px; }
.tabela td { padding: 6px 7px; border-bottom: 1px solid #F3EEE5; vertical-align: middle; }
.tabela tbody tr:nth-child(even) td { background: #FFFCF7; }
.tabela tbody tr:hover td { background: #FFF6DF; }
.tabela tbody tr.sel td { background: #F8E6B4 !important; }
.tabela .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tabela .cen { text-align: center; white-space: nowrap; }
.tabela .forte { font-weight: 700; color: var(--vinho); }
.tabela .nlin { color: var(--sub); text-align: center; font-size: 12px; width: 34px; background: #FBF8F3 !important; }
.tabela td.edit { cursor: text; }
.tabela td.edit:hover { box-shadow: inset 0 0 0 1px var(--dourado); }
.tabela input.ed { width: 100%; min-width: 60px; border: 2px solid var(--dourado); border-radius: 6px; padding: 3px 5px; font: inherit; background: #fff; }
.tabela tr.erro td { background: var(--erro-bg) !important; }
.tabela tr.desmarcado td:not(.nlin) { color: #9C917D; }
.tabela td.ncm-erro { color: var(--erro-tx); font-weight: 700; }
.tabela td.emb-dest { background: var(--azul-bg) !important; color: var(--azul-tx); font-weight: 700; }
.tabela td.real { background: #FFFAEB !important; color: var(--vinho); font-weight: 700; }
.tabela td.real.manual { background: var(--manual-bg) !important; }
.tabela tr.desmarcado td.real { color: #9C917D; }
.prod-cel { display: flex; align-items: center; gap: 8px; min-width: 220px; }
.prod-cel input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--vinho); flex: none; cursor: pointer; }
.prod-cel .nm { flex: 1; min-width: 0; }
.mini { width: 34px; height: 34px; border-radius: 6px; object-fit: cover; background: #F4EFE6; flex: none; display: block; }
.mini.vazia { background: #F7F2E9; }
.rodape-tabela { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.aviso-ic { color: #C77E00; font-weight: 800; cursor: help; margin-left: 4px; }

/* lista em cartões (celular) */
.lista-cartoes { display: none; }

/* ------------------------------------------------------------------ janelas (diálogos) */
.fundo-modal { position: fixed; inset: 0; background: rgba(43, 20, 12, .45); z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { background: var(--fundo); border-radius: 16px; width: 100%; max-width: 560px; max-height: calc(100% - 20px); display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .3); overflow: hidden; }
.modal.largo { max-width: 860px; }
.modal-topo { background: var(--card); padding: 16px 20px; border-bottom: 1px solid var(--borda); display: flex; align-items: center; gap: 10px; }
.modal-topo h3 { margin: 0; font-size: 19px; font-weight: 800; flex: 1; }
.modal-corpo { padding: 18px 20px; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-rodape { background: var(--card); padding: 12px 20px; border-top: 1px solid var(--borda); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.modal-msg { white-space: pre-line; line-height: 1.45; }
.opcoes-modelo { display: grid; gap: 10px; }
.opcao { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: #fff; border: 1px solid var(--borda); border-radius: 12px; cursor: pointer; }
.opcao:has(input:checked) { border-color: var(--vinho); box-shadow: 0 0 0 1px var(--vinho); }
.opcao input { accent-color: var(--vinho); margin-top: 3px; }
.res-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.res-kpis .kpi { padding: 10px 12px; text-align: center; }
.lista-ign { background: #fff; border: 1px solid var(--borda); border-radius: 10px; max-height: 240px; overflow: auto; }
.lista-ign div { padding: 7px 10px; border-bottom: 1px solid #F3EEE5; display: flex; gap: 10px; justify-content: space-between; }
.lista-ign b { color: var(--erro-tx); font-weight: 600; text-align: right; }

/* editar produto */
.editar { display: grid; grid-template-columns: 1fr 260px; gap: 16px; }
.foto-painel { display: flex; flex-direction: column; gap: 8px; }
.foto-grande { width: 100%; aspect-ratio: 1; background: #fff; border: 1px dashed var(--borda-forte); border-radius: 12px; display: flex; align-items: center;
  justify-content: center; overflow: hidden; color: var(--sub); text-align: center; padding: 8px; font-size: 13px; }
.foto-grande img { width: 100%; height: 100%; object-fit: contain; }
.foto-botoes { display: flex; gap: 6px; flex-wrap: wrap; }
.foto-botoes .bt { flex: 1; }
.hist { background: #fff; border: 1px solid var(--borda); border-radius: 10px; max-height: 200px; overflow: auto; }
.hist table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hist td, .hist th { padding: 5px 8px; border-bottom: 1px solid #F3EEE5; text-align: left; }
.hist th { color: var(--sub); font-size: 11px; background: #FBF8F3; position: sticky; top: 0; }

/* ------------------------------------------------------------------ usuários, backups, configurações */
.lista-linhas > div { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid #F1EBE0; flex-wrap: wrap; }
.lista-linhas > div:last-child { border-bottom: 0; }
.lista-linhas .info { flex: 1; min-width: 180px; }
.lista-linhas .info .n { font-weight: 700; }
.lista-linhas .info .d { color: var(--sub); font-size: 12.5px; }
.cfg-grade { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; align-items: start; }

/* ------------------------------------------------------------------ consulta de preços */
.consulta-topo { display: flex; gap: 10px; align-items: center; }
.bt-scan { white-space: nowrap; background: var(--vinho); color: #fff; border: 0; border-radius: 12px; min-width: 52px; height: 46px; display: flex; align-items: center;
  justify-content: center; gap: 8px; padding: 0 14px; font-weight: 700; cursor: pointer; }
.bt-scan .ic { width: 24px; height: 24px; }
.consulta-topo .busca input { padding-top: 12px; padding-bottom: 12px; font-size: 16px; }
.grade-consulta { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.item-c { background: #fff; border: 1px solid var(--borda); border-radius: 14px; padding: 10px; display: flex; gap: 12px; align-items: center; cursor: pointer; text-align: left; }
.item-c:hover { border-color: var(--dourado); }
.item-c img, .item-c .sem-foto { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; flex: none; background: #F7F2E9; }
.item-c .sem-foto { display: flex; align-items: center; justify-content: center; color: #CDBFA5; }
.item-c .sem-foto .ic { width: 28px; height: 28px; }
.item-c .tx { flex: 1; min-width: 0; }
.item-c .nm { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-c .cd { color: var(--sub); font-size: 12px; margin-top: 2px; }
.item-c .pr { color: var(--vinho); font-weight: 800; font-size: 19px; margin-top: 2px; }
.det-foto { width: 100%; max-height: 52vh; aspect-ratio: 1; background: #fff; border-radius: 14px; border: 1px solid var(--borda); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.det-foto img { width: 100%; height: 100%; object-fit: contain; }
.det-preco { font-size: 34px; font-weight: 800; color: var(--vinho); }
.det-nome { font-size: 19px; font-weight: 800; }
.mais { align-self: center; }

/* leitor de código de barras */
.scanner { position: fixed; inset: 0; background: #000; z-index: 60; display: flex; flex-direction: column; }
.scanner video { flex: 1; width: 100%; min-height: 0; object-fit: cover; }
.scanner .mira { position: absolute; left: 8%; right: 8%; top: 38%; height: 24%; border: 3px solid rgba(246, 194, 11, .95); border-radius: 14px;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, .35); pointer-events: none; }
.scanner .mira::after { content: ""; position: absolute; left: 6%; right: 6%; top: 50%; height: 2px; background: rgba(255, 60, 60, .85); }
.scanner .dica { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: #fff; font-weight: 700; text-shadow: 0 1px 3px #000; padding: 0 16px; }
.scanner .barra { display: flex; justify-content: space-around; padding: 16px 10px calc(18px + env(safe-area-inset-bottom)); background: #000; }
.scanner .barra button { background: rgba(255, 255, 255, .15); color: #fff; border: 0; border-radius: 999px; padding: 12px 22px; font-weight: 700; cursor: pointer; }
.scanner .barra button.on { background: var(--amarelo); color: #33230A; }

/* ------------------------------------------------------------------ avisos (toast) e carregando */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #2B2218; color: #fff; padding: 11px 18px; border-radius: 12px;
  z-index: 80; width: max-content; max-width: min(620px, calc(100% - 32px)); text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); font-weight: 600; }
.carregando { position: fixed; inset: 0; background: rgba(245, 241, 234, .72); z-index: 70; display: flex; align-items: center; justify-content: center; }
.carregando .caixa { background: #fff; border: 1px solid var(--borda); border-radius: 14px; padding: 18px 24px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .12); font-weight: 700; max-width: 90%; }
.giro { width: 26px; height: 26px; border: 3px solid #F1E3BF; border-top-color: var(--vinho); border-radius: 50%; animation: giro .8s linear infinite; flex: none; }
@keyframes giro { to { transform: rotate(360deg); } }
.barra-prog { height: 8px; background: #F1E9DA; border-radius: 4px; overflow: hidden; }
.barra-prog > div { height: 100%; background: var(--dourado); width: 0; transition: width .2s; }

/* ------------------------------------------------------------------ telas médias */
@media (max-width: 1250px) {
  .tabela .opc { display: none; }
}
@media (max-width: 1100px) {
  :root { --lateral: 210px; }
  .kpi .v { font-size: 19px; }
}

/* ------------------------------------------------------------------ celular */
@media (max-width: 860px) {
  body { font-size: 15px; }
  .app { flex-direction: column; }
  .lateral { position: fixed; top: 0; bottom: 0; left: 0; width: 270px; z-index: 50; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 4px 0 30px rgba(0, 0, 0, .3); }
  .app.menu-aberto .lateral { transform: none; }
  .app.menu-aberto::after { content: ""; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 45; }
  .cabecalho-movel { display: flex; align-items: center; gap: 10px; padding: 8px 12px; padding-top: calc(8px + env(safe-area-inset-top));
    background: linear-gradient(90deg, var(--vinho), var(--vinho-3)); color: #fff; flex: none; }
  .cabecalho-movel button { background: transparent; border: 0; color: #fff; padding: 6px; cursor: pointer; display: flex; }
  .cabecalho-movel button .ic { width: 24px; height: 24px; }
  .cabecalho-movel img { width: 32px; height: 32px; background: #fff; border-radius: 8px; padding: 2px; }
  .cabecalho-movel .tt { font-weight: 800; font-size: 16px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .principal { height: auto; flex: 1; min-height: 0; }
  .topo { padding: 10px 16px; gap: 8px; }
  .topo h2 { display: none; }
  .topo .titulos { min-width: 0; }
  .topo .acoes { width: 100%; }
  .topo .acoes:empty { display: none; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); font-size: 14px; }
  .conteudo { padding: 14px 16px; gap: 12px; }
  .barra-inferior { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); gap: 6px; }
  .barra-inferior .rotulo-barra, .barra-inferior > span[style] { display: none; }
  .barra-inferior .bt { flex: 1 1 0; min-width: 0 !important; padding: 7px 2px; font-size: 12.5px; min-height: 36px; }
  .barra-inferior .bt:not(.ouro) .ic { display: none; }
  .barra-inferior .bt.ouro { flex-basis: 100%; padding: 10px; font-size: 15px; }
  .kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 10px 12px; }
  .kpi .v { font-size: 17px; }
  .info-nota { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; padding: 12px 14px; }
  .info-nota .vsep { display: none; }
  .info-nota .bloco.forn { grid-column: 1 / -1; }
  .info-nota .campo-info { max-width: none !important; }
  .info-nota .chip { white-space: normal; }
  #cNum { flex: 1 1 auto; min-width: 0; } #cSerie { flex: 0 0 54px; }
  .grade2, .editar { grid-template-columns: 1fr; }
  .res-kpis { grid-template-columns: 1fr 1fr; }
  .tabela-caixa.vira-cartao { display: none; }
  .lista-cartoes { display: flex; flex-direction: column; gap: 10px; }
  .modal { max-height: 100%; border-radius: 16px; }
  .fundo-modal { padding: 8px; align-items: flex-end; }
  .filtros .busca { flex-basis: 100%; }
  .filtros select { flex: 1; }
  .grade-consulta { grid-template-columns: 1fr; }
  .bt-scan .scan-txt { display: none; }
  .bt-scan { min-width: 56px; }
  .busca { min-width: 0; }
  .cfg-grade { grid-template-columns: 1fr; }
  .vazio img { height: 110px; }
}

/* cartões de produto / item da nota no celular */
.cartao { background: #fff; border: 1px solid var(--borda); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.cartao.erro { border-color: #E8A4AC; background: #FFF8F8; }
.cartao.desmarcado { opacity: .6; }
.cartao .top { display: flex; gap: 10px; align-items: flex-start; }
.cartao .top input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--vinho); margin-top: 2px; flex: none; }
.cartao .nm { font-weight: 700; flex: 1; }
.cartao .meta { color: var(--sub); font-size: 13px; }
.cartao .meta .ncm-erro { color: var(--erro-tx); font-weight: 700; }
.cartao .vals { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.cartao .vals > div { background: #FBF8F3; border-radius: 8px; padding: 6px 8px; }
.cartao .vals .r { font-size: 10.5px; color: var(--sub); font-weight: 700; }
.cartao .vals .v { font-weight: 800; }
.cartao .vals .real { background: #FFFAEB; color: var(--vinho); cursor: pointer; }
.cartao .vals .real.manual { background: var(--manual-bg); }
.cartao .acoes-c { display: flex; gap: 8px; flex-wrap: wrap; }
.cartao .emb { background: var(--azul-bg); color: var(--azul-tx); border-radius: 8px; padding: 4px 8px; font-size: 12.5px; font-weight: 700; }
.prod-cartao { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--borda); border-radius: 12px; padding: 10px; cursor: pointer; }
.prod-cartao img, .prod-cartao .sem-foto { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: #F7F2E9; flex: none; }
.prod-cartao .tx { flex: 1; min-width: 0; }
.prod-cartao .nm { font-weight: 700; }
.prod-cartao .d { color: var(--sub); font-size: 12.5px; }
.prod-cartao .pr { color: var(--vinho); font-weight: 800; white-space: nowrap; }
.prod-cartao.sel { border-color: var(--vinho); background: #FFF6DF; }
