/* =====================================================================
   Estoque PI — Pannemix Teresina
   Paleta da identidade Pannemix; tipografia Barlow (sinalização industrial)
   ===================================================================== */
:root {
  --navy: #1F3B57;
  --navy-2: #2A4C6E;
  --navy-3: #163049;
  --laranja: #E07A28;
  --laranja-claro: #FBEBDD;
  --gelo: #EEF3F6;
  --gelo-2: #E3EAEF;
  --tinta: #1B2733;
  --aco: #5B6770;
  --aco-claro: #8C9AA8;
  --linha: #DCE2E6;
  --linha-forte: #B7C2CB;
  --branco: #FFFFFF;
  --vermelho: #B44335;
  --vermelho-claro: #F6E1DE;
  --verde: #3E8E5A;
  --verde-claro: #DFF0E4;
  --azul: #4C86A8;
  --azul-claro: #E1EDF4;

  --f-ui: "Barlow", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --f-num: "Barlow Semi Condensed", "Barlow", "Segoe UI", system-ui, sans-serif;

  --raio: 6px;
  --raio-g: 10px;
  --sombra: 0 1px 2px rgba(22, 48, 73, .08), 0 4px 16px rgba(22, 48, 73, .08);
  --trilho: 232px;
  --topo: 56px;
  --barra-mobile: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--f-ui); font-size: 15px; line-height: 1.45;
  color: var(--tinta); background: var(--gelo);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--navy-2); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
.num, td.n, th.n { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--laranja); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Casca ---------------------------------------------------- */
.casca { display: grid; grid-template-columns: var(--trilho) 1fr; min-height: 100vh; }
.trilho {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--navy); color: #CFDAE4; display: flex; flex-direction: column;
  padding: calc(16px + var(--safe-t)) 12px 16px;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; color: #fff; text-decoration: none; }
.marca-selo {
  width: 38px; height: 38px; border-radius: 8px; background: var(--laranja); color: var(--navy-3);
  display: grid; place-items: center; font: 700 17px/1 var(--f-num); letter-spacing: .5px; flex: none;
}
.marca-txt { display: flex; flex-direction: column; line-height: 1.1; }
.marca-txt b { font-size: 17px; font-weight: 700; letter-spacing: .2px; }
.marca-txt span { font-size: 12.5px; color: #9FB3C5; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-grupo { font-size: 12px; color: #7F97AD; padding: 16px 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: var(--raio);
  color: #D6E0E8; text-decoration: none; font-weight: 500;
}
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .85; }
.nav a:hover { background: var(--navy-2); color: #fff; }
.nav a.ativo { background: #fff; color: var(--navy); box-shadow: inset 3px 0 0 var(--laranja); }
.nav a.ativo svg { opacity: 1; }
.trilho-rodape { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.trilho-rodape .quem { color: #fff; font-weight: 600; }
.trilho-rodape .papel { color: #9FB3C5; }
.trilho-rodape button { margin-top: 8px; background: none; border: 1px solid rgba(255,255,255,.25); color: #D6E0E8; border-radius: var(--raio); padding: 5px 10px; cursor: pointer; }
.trilho-rodape button:hover { background: var(--navy-2); }

.principal { min-width: 0; display: flex; flex-direction: column; }
.faixa-offline {
  background: var(--laranja-claro); color: #7A3E0E; padding: 8px 20px; font-size: 14px;
  border-bottom: 1px solid #F1C9A6;
}
.pagina { padding: 22px 28px 40px; min-width: 0; }
.cab-pagina { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.cab-pagina h1 { font-size: 27px; font-weight: 700; color: var(--navy); letter-spacing: -.2px; }
.cab-pagina .sub { color: var(--aco); font-size: 14.5px; margin-top: 4px; }
.acoes { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Botões / campos ------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 14px; border-radius: var(--raio); border: 1px solid var(--linha-forte);
  background: var(--branco); color: var(--tinta); font-weight: 600; cursor: pointer; white-space: nowrap;
  text-decoration: none; font-size: 14.5px;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { border-color: var(--aco-claro); background: #F8FAFB; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-pri { background: var(--laranja); border-color: var(--laranja); color: #fff; }
.btn-pri:hover { background: #CB6A1D; border-color: #CB6A1D; }
.btn-azul { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn-azul:hover { background: var(--navy-2); border-color: var(--navy-2); }
.btn-perigo { color: var(--vermelho); border-color: #E4B9B2; }
.btn-perigo:hover { background: var(--vermelho-claro); }
.btn-perigo.cheio { background: var(--vermelho); color: #fff; border-color: var(--vermelho); }
.btn-txt { border-color: transparent; background: transparent; padding: 0 8px; }
.btn-txt:hover { background: var(--gelo-2); border-color: transparent; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13.5px; }
.btn-ico { width: 38px; padding: 0; }

.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo > span { font-size: 13px; font-weight: 600; color: var(--aco); }
.campo small { color: var(--aco); font-size: 12.5px; }
.inp, select.inp, textarea.inp {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--linha-forte); border-radius: var(--raio);
  background: #fff; outline: none;
}
textarea.inp { min-height: 74px; resize: vertical; }
.inp:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(42, 76, 110, .15); }
.inp.num { text-align: right; }
.grade-form { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grade-form .larga { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14.5px; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }

/* ---------- Barra de filtros ------------------------------------------ */
.filtros {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-g); padding: 10px 12px; margin-bottom: 14px;
}
.filtros .inp { min-height: 36px; width: auto; }
.filtros .busca { flex: 1 1 220px; min-width: 160px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--linha-forte); background: #fff; border-radius: 999px; padding: 5px 12px; font-size: 13.5px;
  font-weight: 600; cursor: pointer; color: var(--aco);
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.segmentado { display: inline-flex; border: 1px solid var(--linha-forte); border-radius: var(--raio); overflow: hidden; }
.segmentado button { border: 0; background: #fff; padding: 7px 13px; font-weight: 600; font-size: 13.5px; cursor: pointer; color: var(--aco); }
.segmentado button + button { border-left: 1px solid var(--linha-forte); }
.segmentado button.on { background: var(--navy); color: #fff; }

/* ---------- Resumo do estoque ----------------------------------------- */
.resumo {
  display: flex; gap: 0; background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-g);
  margin-bottom: 14px; overflow: hidden; flex-wrap: wrap;
}
.resumo > button {
  flex: 1 1 150px; text-align: left; border: 0; background: none; padding: 12px 16px; cursor: pointer;
  border-right: 1px solid var(--linha); display: flex; flex-direction: column; gap: 2px;
}
.resumo > button:last-child { border-right: 0; }
.resumo > button:hover { background: #F8FAFB; }
.resumo > button.on { background: var(--azul-claro); }
.resumo b { font: 700 26px/1.05 var(--f-num); color: var(--navy); }
.resumo span { font-size: 13.5px; color: var(--aco); }
.resumo .alerta b { color: var(--vermelho); }
.resumo .envio b { color: var(--laranja); }

/* ---------- Tabelas ---------------------------------------------------- */
.tabela-caixa {
  background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-g);
  overflow: auto; max-height: calc(100vh - 230px); position: relative;
  -webkit-overflow-scrolling: touch;
}
.tabela-caixa.livre { max-height: none; }
table.t { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 14.5px; }
table.t th, table.t td { padding: 7px 10px; border-bottom: 1px solid var(--linha); white-space: nowrap; text-align: left; }
table.t thead th {
  position: sticky; top: 0; z-index: 3; background: var(--gelo-2); color: var(--navy);
  font-weight: 700; font-size: 13px; border-bottom: 1px solid var(--linha-forte); vertical-align: bottom;
}
table.t td.n, table.t th.n { text-align: right; }
table.t tbody tr:hover td { background: #F7FAFC; }
table.t tr.clicavel { cursor: pointer; }
table.t .fixa { position: sticky; left: 0; z-index: 2; background: #fff; }
table.t thead .fixa { z-index: 4; background: var(--gelo-2); }
table.t tbody tr:hover td.fixa { background: #F7FAFC; }
table.t td.prod { font-weight: 600; max-width: 330px; overflow: hidden; text-overflow: ellipsis; }
table.t td.prod .sub { font-weight: 400; color: var(--aco); font-size: 12.5px; }

/* faixa de categoria: a marca registrada da planilha (linhas âmbar) */
tr.cat td {
  background: var(--navy) !important; color: #fff; font-weight: 700; font-size: 13.5px;
  letter-spacing: .3px; padding-top: 6px; padding-bottom: 6px; border-bottom: 0;
}
tr.cat td:first-child { box-shadow: inset 6px 0 0 var(--laranja); padding-left: 16px; }
tr.cat td.fixa { z-index: 2; }
tr.cat .cont { font-weight: 500; color: #A9BDCF; margin-left: 8px; font-size: 12.5px; }

.v-neg { color: var(--vermelho); font-weight: 700; }
td.zerado { background: var(--vermelho-claro) !important; color: var(--vermelho); font-weight: 700; }
td.estoque { font-size: 16.5px; font-weight: 700; }
td.envio-pos { color: #A9530F; font-weight: 700; background: var(--laranja-claro) !important; }
td.envio-neg { color: var(--aco-claro); }
td.fraco { color: var(--aco-claro); }
.tag-fixo {
  display: inline-block; font: 600 10.5px/1 var(--f-ui); color: var(--aco); border: 1px solid var(--linha-forte);
  border-radius: 3px; padding: 2px 4px; margin-left: 6px; vertical-align: 2px;
}
.vazio { padding: 40px 20px; text-align: center; color: var(--aco); }
.vazio b { display: block; color: var(--navy); font-size: 17px; margin-bottom: 6px; }

/* ---------- Grade estilo planilha -------------------------------------- */
table.grade { font-size: 14px; }
table.grade th, table.grade td { padding: 0; border-right: 1px solid var(--linha); }
table.grade td.cel {
  min-width: 64px; width: 64px; height: 32px; text-align: right; padding: 0 8px; cursor: cell;
  font-family: var(--f-num); font-variant-numeric: tabular-nums; position: relative;
}
table.grade td.cel.vazia { color: transparent; }
table.grade td.cel.neg { color: var(--vermelho); }
table.grade td.cel.obs::after {
  content: ""; position: absolute; top: 0; right: 0; border-style: solid; border-width: 0 7px 7px 0;
  border-color: transparent var(--laranja) transparent transparent;
}
table.grade td.cel.sel { box-shadow: inset 0 0 0 2px var(--navy-2); background: #F1F6FA !important; }
table.grade td.cel.salvando { color: var(--aco-claro); }
table.grade td.cel.erro { background: var(--vermelho-claro) !important; }
table.grade td.cel input {
  width: 100%; height: 30px; border: 0; outline: 0; text-align: right; background: #fff;
  font: inherit; padding: 0; color: var(--tinta);
}
table.grade td.prod { padding: 0 10px; min-width: 210px; max-width: 260px; height: 32px; }
table.grade td.est { padding: 0 8px; text-align: right; min-width: 64px; font-weight: 700; left: 230px; }
table.grade thead th.colsaida {
  min-width: 64px; width: 64px; max-width: 64px; height: 178px; padding: 6px 4px; cursor: pointer;
  vertical-align: bottom; background: var(--gelo-2);
}
table.grade thead th.colsaida:hover { background: var(--azul-claro); }
.cabcol { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; }
.cabcol .rot {
  writing-mode: vertical-rl; transform: rotate(180deg); font-size: 12.5px; font-weight: 600; color: var(--tinta);
  max-height: 126px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.1;
}
.cabcol .dt { font: 700 12.5px/1 var(--f-num); color: var(--navy); }
.cabcol .tot { font: 500 11.5px/1 var(--f-num); color: var(--aco); }
.cabcol .tp { font-size: 10px; font-weight: 700; padding: 1px 4px; border-radius: 3px; background: var(--laranja); color: #fff; }
table.grade thead th.fixa, table.grade thead th.est-h { padding: 8px 10px; vertical-align: bottom; }
table.grade thead th.est-h { position: sticky; left: 230px; z-index: 4; text-align: right; }
table.grade td.prod.fixa { min-width: 230px; max-width: 230px; width: 230px; }
table.grade td.est { position: sticky; z-index: 2; background: #fff; border-right: 2px solid var(--linha-forte); }
.ajuda-grade { font-size: 13px; color: var(--aco); margin: -6px 0 10px; }

/* ---------- Lista de cartões (mobile) ---------------------------------- */
.lista { display: flex; flex-direction: column; gap: 8px; }
.item-lista {
  background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-g); padding: 12px 14px;
  display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; cursor: pointer; text-align: left; width: 100%;
}
.item-lista:hover { border-color: var(--linha-forte); }
.item-lista .t1 { font-weight: 700; color: var(--navy); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-lista .t2 { color: var(--aco); font-size: 13.5px; }
.item-lista .lado { text-align: right; font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.item-lista .lado b { font-size: 18px; color: var(--tinta); display: block; }
.dia-lista { font-weight: 700; color: var(--aco); font-size: 13.5px; margin: 10px 2px 0; }

.selo { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 4px; vertical-align: 1px; }
.selo-venda { background: var(--gelo-2); color: var(--navy); }
.selo-bonificacao { background: #EDE3F5; color: #5E3A80; }
.selo-extra { background: var(--laranja-claro); color: #A9530F; }
.selo-acao { background: var(--azul-claro); color: #2C5F80; }
.selo-degustacao { background: #FCF2CF; color: #7B5F06; }
.selo-urgencia { background: var(--vermelho-claro); color: var(--vermelho); }
.selo-outro, .selo-ajuste { background: var(--gelo-2); color: var(--aco); }
.selo-recebimento { background: var(--verde-claro); color: var(--verde); }
.selo-quebra { background: var(--vermelho-claro); color: var(--vermelho); }
.selo-estoque_inicial { background: var(--azul-claro); color: #2C5F80; }
.selo-sim { background: var(--verde-claro); color: var(--verde); }
.selo-nao { background: var(--vermelho-claro); color: var(--vermelho); }
.selo-vazio { background: var(--gelo-2); color: var(--aco); }
.selo-vencido { background: var(--vermelho); color: #fff; }
.selo-perto { background: var(--laranja); color: #fff; }
.selo-ok { background: var(--verde-claro); color: var(--verde); }

/* ---------- Editor (formulário de saída/entrada) ------------------------ */
.editor-cab { display: grid; gap: 12px; grid-template-columns: 150px 1.6fr 1fr 1fr 1fr; align-items: end; }
.editor-cab .larga { grid-column: 1 / -1; }
.lista-prod { border: 1px solid var(--linha); border-radius: var(--raio-g); overflow: hidden; margin-top: 14px; }
.lista-prod .lp-busca { display: flex; gap: 10px; padding: 10px; background: var(--gelo); border-bottom: 1px solid var(--linha); align-items: center; flex-wrap: wrap; }
.lista-prod .lp-busca .inp { flex: 1 1 200px; min-height: 36px; }
.lp-corpo { max-height: 52vh; overflow-y: auto; }
.lp-cab { display: grid; grid-template-columns: 1fr 70px 96px 34px; gap: 8px; padding: 6px 10px 6px 14px; font-size: 12.5px; font-weight: 700; color: var(--aco); background: #fff; border-bottom: 1px solid var(--linha); }
.lp-cab.com-validade { grid-template-columns: 1fr 70px 96px 140px 34px; }
.lp-cab span:not(:first-child) { text-align: right; }
.lp-cat { background: var(--navy); color: #fff; font-weight: 700; font-size: 13px; padding: 6px 14px; box-shadow: inset 6px 0 0 var(--laranja); position: sticky; top: 0; z-index: 1; }
.lp-linha { display: grid; grid-template-columns: 1fr 70px 96px 34px; gap: 8px; align-items: center; padding: 5px 10px 5px 14px; border-bottom: 1px solid var(--linha); }
.lp-linha.com-validade { grid-template-columns: 1fr 70px 96px 140px 34px; }
.lp-linha.preenchida { background: #F4F8FB; }
.lp-linha .nm { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lp-linha .est { text-align: right; font: 500 13px var(--f-num); color: var(--aco); }
.lp-linha .est.v-neg { color: var(--vermelho); }
.lp-linha .inp { min-height: 34px; padding: 4px 8px; }
.lp-linha .obs-ln { grid-column: 1 / -1; }
.lp-linha .btn-obs { width: 34px; min-height: 34px; padding: 0; color: var(--aco-claro); }
.lp-linha .btn-obs.tem { color: var(--laranja); border-color: var(--laranja); }
.lp-rodape { display: flex; justify-content: space-between; padding: 10px 14px; background: var(--gelo); font-size: 14px; color: var(--aco); }
.lp-rodape b { color: var(--tinta); font-family: var(--f-num); }

/* ---------- Modal ------------------------------------------------------ */
dialog.modal {
  border: 0; padding: 0; border-radius: 12px; width: min(720px, calc(100vw - 32px)); max-height: calc(100vh - 40px);
  box-shadow: 0 20px 60px rgba(22, 48, 73, .3); color: var(--tinta); overflow: hidden;
}
dialog.modal.larga { width: min(1100px, calc(100vw - 32px)); }
dialog.modal.estreita { width: min(440px, calc(100vw - 32px)); }
dialog.modal::backdrop { background: rgba(22, 48, 73, .5); }
dialog.modal[open] { display: flex; flex-direction: column; animation: surge .16s ease-out; }
@keyframes surge { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.modal-cab { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--linha); }
.modal-cab h2 { font-size: 19px; color: var(--navy); }
.modal-corpo { padding: 18px 20px; overflow-y: auto; flex: 1; }
.modal-rodape { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--linha); background: var(--gelo); flex-wrap: wrap; }
.modal-rodape .esq { margin-right: auto; }

/* ---------- Toast ------------------------------------------------------ */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
.toast { background: var(--navy-3); color: #fff; padding: 11px 16px; border-radius: 8px; box-shadow: var(--sombra); font-size: 14.5px; animation: surge .18s ease-out; }
.toast.erro { background: var(--vermelho); }
.toast.ok { background: var(--verde); }

/* ---------- Login ------------------------------------------------------ */
.tela-login {
  min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff;
}
.login-arte {
  background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.login-arte::after {
  content: ""; position: absolute; inset: auto -80px -80px auto; width: 360px; height: 360px; border-radius: 50%;
  border: 46px solid rgba(224, 122, 40, .9); opacity: .9;
}
.login-arte h1 { font-size: 46px; font-weight: 800; letter-spacing: -1px; line-height: 1; max-width: 9em; }
.login-arte p { color: #B9C9D7; max-width: 30em; font-size: 16px; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-form form { width: min(380px, 100%); display: flex; flex-direction: column; gap: 14px; }
.login-form h2 { font-size: 24px; color: var(--navy); }
.login-form .erro { background: var(--vermelho-claro); color: var(--vermelho); padding: 10px 12px; border-radius: var(--raio); font-size: 14.5px; }
.login-form .dica { color: var(--aco); font-size: 14px; }

/* ---------- Diversos --------------------------------------------------- */
.painel-bloco { background: #fff; border: 1px solid var(--linha); border-radius: var(--raio-g); padding: 18px 20px; margin-bottom: 16px; }
.painel-bloco h2 { font-size: 18px; color: var(--navy); margin-bottom: 4px; }
.painel-bloco .sub { color: var(--aco); font-size: 14px; margin-bottom: 14px; }
.abas { display: flex; gap: 4px; border-bottom: 1px solid var(--linha-forte); margin-bottom: 16px; overflow-x: auto; }
.abas button { border: 0; background: none; padding: 9px 14px; font-weight: 600; color: var(--aco); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.abas button.on { color: var(--navy); border-bottom-color: var(--laranja); }
.progresso { height: 10px; background: var(--gelo-2); border-radius: 99px; overflow: hidden; }
.progresso > div { height: 100%; background: var(--laranja); width: 0; transition: width .2s; }
.log { font-size: 13.5px; max-height: 260px; overflow: auto; background: var(--gelo); border-radius: var(--raio); padding: 10px 12px; }
.log div { padding: 2px 0; border-bottom: 1px dashed var(--linha); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.carregando { padding: 50px; text-align: center; color: var(--aco); }
.carregando::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid var(--linha); border-top-color: var(--laranja); animation: gira .8s linear infinite;
}
@keyframes gira { to { transform: rotate(360deg); } }
.texto-envio { width: 100%; min-height: 300px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }
.kpi-linha { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 12px; color: var(--aco); font-size: 14px; }
.kpi-linha b { font: 700 20px var(--f-num); color: var(--navy); margin-right: 4px; }
.so-mobile { display: none; }

/* ---------- Barra inferior (mobile) ------------------------------------ */
.barra-mobile { display: none; }
.folha-mais { display: none; }

@media (max-width: 900px) {
  :root { --trilho: 0px; }
  body { font-size: 15.5px; }
  .casca { grid-template-columns: 1fr; }
  .trilho { display: none; }
  .so-mobile { display: initial; }
  .so-desk { display: none !important; }
  .topo-mobile {
    position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff;
    display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-t)) 14px 10px;
  }
  .topo-mobile .marca-selo { width: 32px; height: 32px; font-size: 15px; }
  .topo-mobile b { font-size: 16.5px; }
  .pagina { padding: 14px 12px calc(var(--barra-mobile) + 24px + var(--safe-b)); }
  .cab-pagina h1 { font-size: 23px; }
  .barra-mobile {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    background: #fff; border-top: 1px solid var(--linha); padding-bottom: var(--safe-b); height: calc(var(--barra-mobile) + var(--safe-b));
  }
  .barra-mobile a, .barra-mobile button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11.5px; font-weight: 600; color: var(--aco); text-decoration: none; border: 0; background: none;
  }
  .barra-mobile svg { width: 22px; height: 22px; }
  .barra-mobile .ativo { color: var(--navy); }
  .barra-mobile .ativo svg { color: var(--laranja); }
  .folha-mais.aberta {
    display: block; position: fixed; inset: 0; z-index: 40; background: rgba(22, 48, 73, .45);
  }
  .folha-mais .folha {
    position: absolute; left: 0; right: 0; bottom: 0; background: #fff; border-radius: 16px 16px 0 0;
    padding: 12px 12px calc(16px + var(--safe-b)); max-height: 80vh; overflow-y: auto;
  }
  .folha-mais .nav a { color: var(--tinta); padding: 13px 12px; font-size: 16px; }
  .folha-mais .nav a.ativo { background: var(--gelo); box-shadow: inset 3px 0 0 var(--laranja); color: var(--navy); }
  .folha-mais .nav-grupo { color: var(--aco); }
  .tabela-caixa { max-height: calc(100vh - 250px); border-radius: var(--raio); }
  table.t th, table.t td { padding: 7px 8px; }
  table.t td.prod { max-width: 170px; white-space: normal; line-height: 1.2; }
  .editor-cab { grid-template-columns: 1fr 1fr; }
  .editor-cab .cli { grid-column: 1 / -1; }
  .lp-linha, .lp-linha.com-validade, .lp-cab, .lp-cab.com-validade { grid-template-columns: 1fr 52px 78px 34px; }
  .lp-cab.com-validade span:nth-child(4) { display: none; }
  .lp-linha.com-validade .val { grid-column: 1 / 4; }
  .lp-corpo { max-height: none; }
  dialog.modal, dialog.modal.larga, dialog.modal.estreita {
    width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; margin: 0;
  }
  .modal-cab { padding-top: calc(12px + var(--safe-t)); }
  .modal-rodape { padding-bottom: calc(12px + var(--safe-b)); }
  .tela-login { grid-template-columns: 1fr; }
  .login-arte { padding: calc(28px + var(--safe-t)) 24px 28px; min-height: 0; }
  .login-arte h1 { font-size: 32px; }
  .login-arte::after { width: 200px; height: 200px; border-width: 28px; inset: auto -60px -60px auto; }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--barra-mobile) + 14px + var(--safe-b)); max-width: none; }
  .resumo > button { flex-basis: 50%; border-bottom: 1px solid var(--linha); }
  table.grade td.prod.fixa { min-width: 150px; max-width: 150px; width: 150px; white-space: normal; line-height: 1.15; font-size: 13px; }
  table.grade td.est, table.grade thead th.est-h { left: 150px; }
}
@media (min-width: 901px) { .topo-mobile { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media print {
  .trilho, .barra-mobile, .topo-mobile, .filtros, .acoes, .faixa-offline, .toasts, .resumo { display: none !important; }
  .casca { display: block; }
  .pagina { padding: 0; }
  .tabela-caixa { max-height: none; overflow: visible; border: 0; }
  table.t thead th { position: static; }
  table.t .fixa { position: static; }
  body { background: #fff; font-size: 11px; }
  tr.cat td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* toque no celular: sem estado de hover preso no menu "Mais" */
@media (max-width: 900px) {
  .folha-mais .nav a:hover { background: transparent; color: var(--tinta); }
  .folha-mais .nav a.ativo:hover { background: var(--gelo); color: var(--navy); }
}
