/* App do representante (rep.html) - celular primeiro. Paleta do Sistema web. */
:root {
  --acento: #4D6BFE; --acento-esc: #3A56E0; --acento-claro: #EEF1FF;
  --navy: #1A2D6E; --texto: #2B2F3A; --apagado: #7D8291; --borda: #E2E5EE;
  --fundo: #F2F3F7; --branco: #FFFFFF; --verde: #149C8A; --vermelho: #D62828;
  --amarelo: #E89B22; --sombra: 0 8px 28px rgba(26,45,110,.12); --raio: 14px;
  --abas: 64px; --topo: 56px;
  --seg-baixo: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Inter, "Segoe UI", system-ui, sans-serif; font-size: 15px; color: var(--texto);
       background: var(--fundo); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--acento); }
.oculto { display: none !important; }
.sub { color: var(--apagado); font-size: 13px; }
.centro { text-align: center; }
.erro { color: var(--vermelho); font-size: 13.5px; min-height: 18px; margin: 4px 0 10px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

/* botões e campos */
.btn { border: 1px solid var(--borda); background: var(--branco); border-radius: 10px; padding: 10px 16px;
       cursor: pointer; font-weight: 600; white-space: nowrap; min-height: 44px; }
.btn.pri { background: var(--acento); border-color: var(--acento); color: #fff; }
.btn.pri:active { background: var(--acento-esc); }
.btn.perigo { color: var(--vermelho); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.grande { width: 100%; padding: 13px; font-size: 16px; }
.btn.peq { min-height: 34px; padding: 6px 12px; font-size: 13.5px; }
input[type=text], input[type=password], input[type=search], input[type=email], input[type=tel],
input[type=date], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--borda); border-radius: 10px; padding: 11px 12px; background: var(--branco);
  outline: none; font-size: 16px; /* 16px: o iPhone não dá zoom no campo */ }
textarea { resize: vertical; min-height: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-claro); }
.campo { display: block; margin-bottom: 14px; }
.campo > span { display: block; font-size: 12.5px; color: var(--apagado); margin-bottom: 5px; font-weight: 600; }
.linha2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.linha3 { display: grid; grid-template-columns: 90px 1fr; gap: 10px; }
.chk { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 2px 0 8px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--acento); }

/* login */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center;
  padding: 0 16px 24px; background: linear-gradient(180deg, var(--navy) 0, var(--navy) 260px, var(--fundo) 260px); }
.login-topo { color: #fff; text-align: center; padding: 48px 0 26px; }
.login-logo { width: 64px; height: 64px; border-radius: 18px; background: #fff; color: var(--navy); margin: 0 auto 12px;
  display: grid; place-items: center; font-weight: 800; font-size: 30px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-topo h1 { margin: 0; font-size: 26px; letter-spacing: .02em; }
.login-topo p { margin: 4px 0 0; color: #C8D1F0; }
.login-cartao { width: 100%; max-width: 400px; background: var(--branco); border-radius: 18px; box-shadow: var(--sombra);
  padding: 24px 20px; }
.login-cartao h2 { margin: 0 0 16px; font-size: 19px; color: var(--navy); }
.senha-caixa { position: relative; display: block; }
.senha-caixa input { padding-right: 56px; }
.ver-senha { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none;
  color: var(--acento); font-weight: 600; font-size: 13px; padding: 8px; cursor: pointer; }
.login-rodape { color: var(--apagado); font-size: 12px; margin-top: 18px; }

/* casco */
#telaApp { padding-top: var(--topo); padding-bottom: calc(var(--abas) + var(--seg-baixo)); min-height: 100vh; }
.topo { position: fixed; top: 0; left: 0; right: 0; height: var(--topo); z-index: 20; background: var(--navy); color: #fff;
  display: flex; align-items: center; gap: 10px; padding: 0 14px; }
.topo-tit { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topo-tit b { font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-tit small { color: #C8D1F0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo-btn { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 10px;
  padding: 7px 12px; font-weight: 600; font-size: 14px; cursor: pointer; }
#vista { padding: 12px 12px 20px; max-width: 980px; margin: 0 auto; }

.abas { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--abas) + var(--seg-baixo)); padding-bottom: var(--seg-baixo);
  background: var(--branco); border-top: 1px solid var(--borda); }
.abas a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; text-decoration: none;
  color: var(--apagado); font-size: 11.5px; font-weight: 600; }
.abas a.ativo { color: var(--acento); }
.ic { width: 24px; height: 24px; display: block; background: currentColor;
  -webkit-mask: var(--m) center / contain no-repeat; mask: var(--m) center / contain no-repeat; }
.ic-lista { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E"); }
.ic-mais { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 8v8M8 12h8'/%3E%3C/svg%3E"); }
.ic-clientes { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M2 21c0-4 3-6 7-6s7 2 7 6M16 4a4 4 0 0 1 0 8M22 21c0-3-2-5-4-5.6'/%3E%3C/svg%3E"); }
.ic-conta { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7'/%3E%3C/svg%3E"); }

/* blocos */
.cartao { background: var(--branco); border-radius: var(--raio); padding: 14px; margin-bottom: 10px;
  box-shadow: 0 1px 2px rgba(26,45,110,.06); }
.cartao h3 { margin: 0 0 8px; font-size: 15px; color: var(--navy); }
.vazio { text-align: center; color: var(--apagado); padding: 36px 16px; }
.vazio b { display: block; color: var(--texto); font-size: 16px; margin-bottom: 4px; }
.busca { display: flex; gap: 8px; margin-bottom: 10px; }
.busca input { flex: 1; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 6px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; border: 1px solid var(--borda); background: var(--branco); border-radius: 999px; padding: 7px 13px;
  font-size: 13.5px; font-weight: 600; color: var(--texto); cursor: pointer; }
.chip.ativo { background: var(--navy); border-color: var(--navy); color: #fff; }
.aviso-box { background: #FFF6E5; border: 1px solid #F5D9A6; color: #7A4E00; border-radius: 12px; padding: 10px 12px;
  font-size: 13.5px; margin-bottom: 10px; }

/* lista de pedidos / clientes */
.item-lista { display: flex; gap: 12px; align-items: center; background: var(--branco); border-radius: var(--raio);
  padding: 12px 14px; margin-bottom: 8px; cursor: pointer; box-shadow: 0 1px 2px rgba(26,45,110,.06); }
.item-lista:active { background: #F7F8FC; }
.item-lista .meio { flex: 1; min-width: 0; }
.item-lista .meio b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-lista .dir { text-align: right; flex: none; }
.etapa { display: inline-block; border-radius: 999px; padding: 2px 9px; font-size: 11.5px; font-weight: 700; color: #fff;
  white-space: nowrap; }
.tag { display: inline-block; border-radius: 6px; padding: 1px 6px; font-size: 11px; font-weight: 700; background: var(--acento-claro);
  color: var(--acento-esc); margin-left: 4px; vertical-align: middle; }

/* catálogo */
.grade-prod { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 640px) { .grade-prod { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 900px) { .grade-prod { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.prod { background: var(--branco); border-radius: var(--raio); overflow: hidden; cursor: pointer; display: flex;
  flex-direction: column; box-shadow: 0 1px 2px rgba(26,45,110,.06); position: relative; }
.prod .foto { aspect-ratio: 1 / 1; background: #F7F8FB; display: grid; place-items: center; position: relative; }
.esgotado { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-12deg); z-index: 1;
  color: var(--vermelho); border: 3px solid var(--vermelho); background: rgba(255,255,255,.86); border-radius: 8px;
  padding: 4px 12px; font-weight: 800; font-size: 17px; letter-spacing: .08em; white-space: nowrap; pointer-events: none; }
.pd-foto .esgotado { font-size: 26px; padding: 6px 18px; border-width: 4px; }
.seg { display: inline-flex; background: #E6E8F0; border-radius: 10px; padding: 3px; margin-bottom: 10px; }
.seg button { border: 0; background: none; padding: 7px 16px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--apagado); cursor: pointer; }
.seg button.ativo { background: var(--branco); color: var(--navy); box-shadow: 0 1px 3px rgba(26,45,110,.15); }
.prod .foto img { width: 100%; height: 100%; object-fit: contain; }
.prod .foto .sem { color: #C3C7D3; font-size: 12px; }
.prod .info { padding: 9px 10px 11px; display: flex; flex-direction: column; gap: 3px; flex: 1; }
.prod .ref { font-size: 11.5px; color: var(--apagado); font-weight: 600; }
.prod .desc { font-size: 13.5px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.prod .preco { font-weight: 800; color: var(--navy); margin-top: auto; padding-top: 4px; }
.prod .no-carr { position: absolute; top: 8px; right: 8px; background: var(--acento); color: #fff; border-radius: 999px;
  font-size: 12px; font-weight: 700; padding: 2px 8px; }
.disp { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--apagado); }
.disp::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--verde); }
.disp.pouco::before { background: var(--amarelo); }
.disp.sem::before { background: var(--vermelho); }
.mais { display: block; margin: 14px auto 4px; }

/* barra do carrinho */
.barra-carrinho { position: fixed; left: 10px; right: 10px; bottom: calc(var(--abas) + var(--seg-baixo) + 10px); z-index: 19;
  background: var(--navy); color: #fff; border-radius: 16px; padding: 10px 10px 10px 16px; display: flex; align-items: center;
  gap: 12px; box-shadow: 0 10px 30px rgba(26,45,110,.35); max-width: 960px; margin: 0 auto; }
.barra-carrinho > div { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barra-carrinho small { color: #C8D1F0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-total { font-size: 16px; }
body.com-carrinho #vista { padding-bottom: 96px; }

/* folha (painel que sobe de baixo) */
.folha-fundo { position: fixed; inset: 0; z-index: 40; background: rgba(17,24,39,.45); display: flex; align-items: flex-end;
  justify-content: center; animation: aparece .15s ease-out; }
.folha { background: var(--fundo); width: 100%; max-width: 680px; max-height: 92vh; max-height: 92dvh; border-radius: 20px 20px 0 0;
  display: flex; flex-direction: column; animation: sobe .2s ease-out; }
.folha-cab { display: flex; align-items: center; gap: 10px; padding: 14px 16px 10px; background: var(--branco);
  border-radius: 20px 20px 0 0; border-bottom: 1px solid var(--borda); }
.folha-cab b { flex: 1; font-size: 16.5px; color: var(--navy); }
.folha-x { border: 0; background: var(--fundo); width: 36px; height: 36px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.folha-corpo { overflow-y: auto; padding: 14px 14px 18px; -webkit-overflow-scrolling: touch; }
.folha-pe { padding: 10px 14px calc(12px + var(--seg-baixo)); background: var(--branco); border-top: 1px solid var(--borda);
  display: flex; gap: 10px; }
.folha-pe .btn { flex: 1; }
@media (min-width: 700px) { .folha-fundo { align-items: center; } .folha { border-radius: 20px; } .folha-cab { border-radius: 20px 20px 0 0; } }
@keyframes sobe { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes aparece { from { opacity: 0; } to { opacity: 1; } }

/* produto (folha) */
.pd-foto { background: var(--branco); border-radius: var(--raio); aspect-ratio: 4 / 3; display: grid; place-items: center; position: relative;
  margin-bottom: 12px; overflow: hidden; }
.pd-foto img { width: 100%; height: 100%; object-fit: contain; }
.pd-preco { font-size: 22px; font-weight: 800; color: var(--navy); }
.qtd { display: flex; align-items: stretch; gap: 0; }
.qtd button { width: 52px; border: 1px solid var(--borda); background: var(--branco); font-size: 22px; font-weight: 700;
  cursor: pointer; color: var(--navy); }
.qtd button:first-child { border-radius: 10px 0 0 10px; }
.qtd button:last-child { border-radius: 0 10px 10px 0; }
.qtd input { border-radius: 0; text-align: center; border-left: 0; border-right: 0; font-weight: 700; }

/* carrinho */
.it-carr { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--borda); }
.it-carr:last-child { border-bottom: 0; }
.it-carr img { width: 52px; height: 52px; object-fit: contain; border-radius: 8px; background: #F7F8FB; flex: none; }
.it-carr .meio { flex: 1; min-width: 0; }
.it-carr .meio b { font-size: 13.5px; display: block; }
.it-carr .qtd button { width: 36px; font-size: 18px; }
.it-carr .qtd input { width: 54px; padding: 6px 4px; font-size: 15px; }
.totais .linha { display: flex; justify-content: space-between; padding: 4px 0; }
.totais .linha.forte { font-size: 18px; font-weight: 800; color: var(--navy); border-top: 1px solid var(--borda); margin-top: 6px; padding-top: 10px; }

/* detalhe do pedido */
.det-linha { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding: 4px 0; }
.det-linha span:first-child { color: var(--apagado); }
.det-it { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--borda); font-size: 13.5px; }
.det-it:last-child { border-bottom: 0; }
.det-it .meio { flex: 1; min-width: 0; }
.det-it.canc { color: var(--apagado); text-decoration: line-through; }

/* conta */
.conta-cab { display: flex; gap: 14px; align-items: center; }
.avatar { width: 52px; height: 52px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 20px; flex: none; }
.lista-simples { margin: 0; padding: 0; list-style: none; }
.lista-simples li { padding: 7px 0; border-bottom: 1px solid var(--borda); font-size: 14px; }
.lista-simples li:last-child { border-bottom: 0; }
.qr-2fa { display: grid; place-items: center; margin: 8px 0; }
.qr-2fa svg { width: 190px; height: 190px; }

/* toast e carregando */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--abas) + var(--seg-baixo) + 18px); z-index: 60;
  background: #111827; color: #fff; border-radius: 12px; padding: 11px 16px; font-size: 14px; max-width: calc(100% - 32px);
  box-shadow: var(--sombra); }
.toast.erro { background: var(--vermelho); }
.carregando { position: fixed; inset: 0; z-index: 70; background: rgba(242,243,247,.55); display: grid; place-items: center; }
.giro { width: 36px; height: 36px; border: 4px solid var(--acento-claro); border-top-color: var(--acento); border-radius: 50%;
  animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }
/* esgotado sem foto: só o selo (o "sem foto" ficaria por baixo) */
.foto:has(.esgotado) .sem, .pd-foto:has(.esgotado) .sem { visibility: hidden; }
