/* Identidade Hanyhub: roxo claro (lilás). Fundos e cabeçalho lilás; roxo médio nos botões para manter contraste. */
:root {
  --bg: #f7f3fd; --card: #fff; --text: #2a2140; --muted: #6b6185; --line: #e6ddf5;
  --primary: #7c5cc4; --primary-dark: #6345a8; --primary-soft: #f1eafc; --danger: #c0352b; --ok: #1f8a4c;
  --lilas: #ebe2fb; --lilas-texto: #3e2a72;
  --radius: 12px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0 0 .6rem; line-height: 1.2; }
h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.muted { color: var(--muted); font-size: .9em; }

header { background: var(--lilas); color: var(--lilas-texto); border-bottom: 1px solid #ddd0f5; padding: .6rem 1rem; display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; position: sticky; top: 0; z-index: 2; }
.marca { font-weight: 800; font-size: 1.25rem; letter-spacing: .2px; color: var(--lilas-texto); display: inline-flex; align-items: center; gap: .4rem; }
.marca img { height: 28px; width: auto; }
.marca .nome span { color: var(--primary); }
header .quem { margin-left: auto; text-align: right; font-size: .88rem; }
header .quem .muted { color: var(--muted); }
nav { display: flex; gap: .2rem; flex-wrap: wrap; }
nav a { padding: .4rem .65rem; border-radius: 8px; color: var(--lilas-texto); text-decoration: none; white-space: nowrap; }
nav a:hover { background: #ddd0f5; }
nav a[aria-current="page"] { background: var(--primary); color: #fff; font-weight: 600; }
.contador { display: inline-block; min-width: 1.3em; padding: 0 .35em; border-radius: 99px; background: var(--danger); color: #fff; font-size: .75rem; text-align: center; font-weight: 700; }
main { max-width: 1180px; margin: 0 auto; padding: 1rem; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.btn { border: 1px solid var(--line); background: var(--card); color: var(--text); padding: .5rem .9rem; border-radius: 8px; cursor: pointer; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #efc4c0; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.claro { background: #fff; color: var(--primary-dark); border-color: #d6c7f2; padding: .2rem .6rem; }
:focus-visible { outline: 3px solid #b79cf0; outline-offset: 1px; }
.acoes { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.entre { justify-content: space-between; }

label { display: block; font-size: .86rem; color: var(--muted); margin-bottom: .2rem; }
input, select, textarea { width: 100%; padding: .5rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); }
textarea { min-height: 64px; resize: vertical; }
.acoes select, .acoes input[type=search] { width: auto; }
.campo { margin-bottom: .75rem; }
.grade { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .4rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
td.num, th.num { text-align: right; white-space: nowrap; }
input.qtd { width: 90px; text-align: right; }
.tabela { overflow-x: auto; }
.linha { cursor: pointer; }
.linha:hover { background: #faf7fe; }
tfoot th { font-size: .95rem; color: var(--text); text-transform: none; }

.badge { display: inline-block; padding: .15rem .55rem; border-radius: 99px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: #eef0f3; color: #3b4352; }
.s-enviado { background: #fff4d6; color: #8a5a00; }
.s-aprovado, .s-confirmado { background: #e3edff; color: #1f4fbf; }
.s-repassado, .s-faturado { background: #ece4ff; color: #5b37b5; }
.s-em_entrega, .s-despachado { background: #ffe9dc; color: #a24a10; }
.s-entregue, .s-recebido { background: #dcf3e3; color: #1f7a43; }
.s-recusado, .s-cancelado { background: #fde3e1; color: #a32a20; }

.cartoes { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.cartao { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; text-align: left; cursor: pointer; display: flex; flex-direction: column; gap: .15rem; }
.cartao:hover { border-color: var(--primary); }
.cartao strong { font-size: 1.6rem; color: var(--primary-dark); }
.cartao.estatico { cursor: default; }
.cartao.estatico:hover { border-color: var(--line); }

/* catálogo em cards */
.catalogo-grade { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem; }
.produto-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; background: #fff; }
.produto-card img, .sem-foto { width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-bottom: 1px solid var(--line); }
.sem-foto { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: .85rem; background: var(--primary-soft); }
.pc-corpo { padding: .7rem .8rem .8rem; display: flex; flex-direction: column; gap: .45rem; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; font-size: .85rem; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: .2rem .65rem; cursor: pointer; color: var(--text); font-size: .85rem; }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.produto-card input.qtd { width: 70px; }
img.miniatura { width: 40px; height: 30px; object-fit: contain; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.resumo-carrinho { background: var(--primary-soft); border: 1px solid #d6c7f2; border-radius: var(--radius); padding: .8rem 1rem; }
.total { font-weight: 700; font-size: 1.1rem; }
.fabrica-bloco { border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: .8rem; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 .9rem 1.3rem; border-left: 2px solid var(--line); margin-left: .4rem; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); }
.timeline li:last-child { border-left-color: transparent; }

.login { max-width: 420px; margin: 8vh auto; }
.login h1 { font-size: 1.25rem; margin-top: .4rem; }
.login a { color: var(--primary-dark); }
.login a.btn { text-decoration: none; }
.login a.btn.primary { color: #fff; }
/* página inicial: escolha do acesso */
.escolha { max-width: 640px; text-align: center; }
.acessos { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin: 1.2rem 0; }
.acesso-card { display: flex; flex-direction: column; gap: .4rem; padding: 1.4rem 1.2rem; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card); text-decoration: none; color: var(--text); text-align: left; }
.acesso-card strong { font-size: 1.2rem; color: var(--lilas-texto); }
.acesso-card.destaque { border-left: 6px solid var(--primary); }
.acesso-card:hover { border-color: var(--primary); background: var(--primary-soft); }
.interno { font-size: .85rem; }
.login.largo { max-width: 680px; }
.novo-cadastro { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--primary-soft); border-radius: 8px; padding: .6rem .8rem; margin: .8rem 0; }
.s-pendente { background: #fff4d6; color: #8a5a00; }
.s-ativo { background: #dcf3e3; color: #1f7a43; }
.s-bloqueado { background: #fde3e1; color: #a32a20; }
.s-aviso-enviado { background: #dcf3e3; color: #1f7a43; }
.s-aviso-gravado { background: #f1eafc; color: #4b2e8a; }
.s-aviso-falhou { background: #fde3e1; color: #a32a20; }
/* campo-armadilha para robôs: fora da tela, ignorado por leitores de tela */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.btn.whats { color: #1f7a43; border-color: #b6e2c4; text-decoration: none; }
button.link { background: none; border: 0; color: var(--primary-dark); text-decoration: underline; cursor: pointer; padding: 0; font-size: .9rem; }
.demo button { background: none; border: 0; color: var(--primary-dark); cursor: pointer; padding: .1rem 0; text-decoration: underline; }
.erro { color: var(--danger); font-size: .9rem; min-height: 1.2em; }
.pos { color: var(--ok); }
.neg { color: var(--danger); font-weight: 600; }
tr.alerta td { background: #fff6f4; }
.avisos { background: #fff8e1; border: 1px solid #f3dc9a; border-radius: 8px; padding: .5rem .8rem; color: #7a5300; }

#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: .6rem 1rem; border-radius: 8px; max-width: 90vw; z-index: 10; }
#toast.erro { background: var(--danger); color: #fff; }

@media print {
  header, .nao-imprimir, #toast { display: none !important; }
  body { background: #fff; }
  main { max-width: none; padding: 0; }
  .card { border: 0; padding: .3rem 0; }
}
@media (max-width: 640px) {
  header .quem { margin-left: 0; text-align: left; width: 100%; }
  .esconde-mobile { display: none; }
  main { padding: .6rem; }
}

/* ---------- Hanyhub 2 (Node) ---------- */
.titulo { font-size: 1.35rem; margin: .2rem 0 .8rem; }
.duas { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 1rem; }
.duas > .card, .duas > div > .card { margin-bottom: 1rem; }
.filtros { padding: .6rem .8rem; }
.filtros input[type=search] { max-width: 280px; }
label.inline { display: inline-flex; gap: .35rem; align-items: center; color: var(--text); font-size: .9rem; margin: 0 .4rem .3rem 0; }
label.inline input[type=checkbox], label.inline input[type=radio] { width: auto; }
.senha-caixa { position: relative; display: block; }
.senha-caixa input { padding-right: 5.2rem; }
.ver-senha { position: absolute; right: .3rem; top: 50%; transform: translateY(-50%); border: 0; background: none; color: var(--primary-dark);
  font-size: .82rem; font-weight: 600; padding: .3rem .5rem; cursor: pointer; border-radius: 6px; }
.ver-senha:hover, .ver-senha:focus-visible { background: var(--primary-soft); }
label.inline input[type=date], label.inline select { width: auto; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .8rem .2rem; margin: 0 0 .9rem; }
legend { font-weight: 600; padding: 0 .3rem; color: var(--lilas-texto); }
.abas { margin-bottom: .8rem; }
a.chip { text-decoration: none; }
.estreito { max-width: 420px; }
.inativo td, .produto-card.inativo { opacity: .55; }
.caixa { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 3px; }
.add-item select { flex: 1 1 260px; width: auto; }
.preco-in { width: 92px; text-align: right; padding: .3rem .4rem; }
.preco-in.invalido { border-color: var(--danger); background: #fff6f4; }
.barra-salvar { position: sticky; bottom: 0; background: #fff; padding: .6rem 0; border-top: 1px solid var(--line); }
.margem { color: var(--ok); font-size: .82em; white-space: nowrap; }
.margem.neg { color: var(--danger); }
small { font-size: .8em; }
.preco { font-size: 1.25rem; font-weight: 700; color: var(--primary-dark); }
.produto-card h3 { font-size: 1rem; margin: 0; }
.produto-card.kit { border-color: #d6c7f2; }
table.compacta { font-size: .88rem; }
table.compacta th, table.compacta td { padding: .2rem .3rem; text-transform: none; letter-spacing: 0; }
.badge.promo { background: #ffe3f1; color: #a3195b; }
.badge.portal { background: var(--lilas); color: var(--lilas-texto); }
.s-recebido { background: #fff4d6; color: #8a5a00; }
.s-separacao { background: #ece4ff; color: #5b37b5; }
.s-pronto { background: #ffe9dc; color: #a24a10; }
.s-recusado { background: #fde3e1; color: #a32a20; }
.p-pago { background: #dcf3e3; color: #1f7a43; }
.p-parcial { background: #fff4d6; color: #8a5a00; }
.p-pendente { background: #fde3e1; color: #a32a20; }
.erro-box { background: #fde3e1; border-color: #f2b8b2; color: #a32a20; }
.ok-box { background: #e9f8ee; border: 1px solid #b6e2c4; border-radius: 8px; padding: .8rem 1rem; }
.alertas { margin-bottom: .8rem; }
.kpi strong { font-size: 1.35rem; }
.grade.info { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: .8rem; }
.totais { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; justify-content: flex-end; margin: .8rem 0; }
.totais div { display: flex; flex-direction: column; align-items: flex-end; }
.totais span { color: var(--muted); font-size: .82rem; }
dl.dados { display: grid; grid-template-columns: max-content 1fr; gap: .3rem .9rem; margin: 0; }
dl.dados dt { color: var(--muted); font-size: .88rem; }
dl.dados dd { margin: 0; }
.mini-kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem; margin-bottom: .8rem; }
.mini-kpis div { background: var(--primary-soft); border-radius: 8px; padding: .5rem .7rem; display: flex; flex-direction: column; }
.mini-kpis strong { font-size: 1.1rem; color: var(--primary-dark); }
.barra-h { background: var(--primary-soft); border-radius: 99px; height: 8px; min-width: 80px; overflow: hidden; }
.barra-h span { display: block; height: 100%; background: var(--primary); }
.grafico { width: 100%; height: auto; display: block; }
.grafico .barra { fill: var(--primary); }
.grafico .barra:hover { fill: var(--primary-dark); }
.grafico .linha-anterior { fill: none; stroke: #e0a83b; stroke-width: 2; stroke-dasharray: 5 3; }
.grafico .grade-linha { stroke: var(--line); stroke-width: 1; }
.grafico .eixo { fill: var(--muted); font-size: 11px; }
.legenda { display: flex; gap: 1rem; font-size: .85rem; color: var(--muted); margin-top: .3rem; }
.legenda i { display: inline-block; width: 14px; height: 4px; vertical-align: middle; margin-right: .35rem; border-radius: 2px; }
.cor-atual { background: var(--primary); height: 10px !important; }
.cor-anterior { background: #e0a83b; }
.etapas { display: flex; list-style: none; padding: 0; margin: .8rem 0 1rem; gap: .3rem; flex-wrap: wrap; counter-reset: etapa; }
.etapas li { flex: 1 1 110px; text-align: center; padding: .45rem .3rem; border-radius: 8px; background: #f1eef6; color: var(--muted); font-size: .85rem; counter-increment: etapa; }
.etapas li::before { content: counter(etapa) ". "; }
.etapas li.feito { background: #dcf3e3; color: #1f7a43; }
.etapas li.atual { background: var(--primary); color: #fff; font-weight: 600; }
.foto-campo { display: flex; gap: .8rem; align-items: center; }
.foto-campo .previa { width: 120px; height: 90px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; aspect-ratio: auto; }
dialog#modal { border: 0; border-radius: var(--radius); padding: 1.2rem 1.3rem; width: min(560px, 94vw); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(42, 33, 64, .3); }
dialog#modal.largo { width: min(900px, 96vw); }
dialog#modal::backdrop { background: rgba(42, 33, 64, .45); }
dialog .fechar { position: sticky; top: 0; float: right; background: none; border: 0; font-size: 1.6rem; line-height: 1; cursor: pointer; color: var(--muted); }
.separacao table td, .separacao table th { padding: .45rem .4rem; }
@media (max-width: 640px) {
  .duas { grid-template-columns: 1fr; }
  nav { width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .totais { justify-content: flex-start; }
  .totais div { align-items: flex-start; }
  .filtros input[type=search] { max-width: none; }
}
@media print {
  .separacao .caixa { border-color: #000; }
  dialog#modal { display: none; }
}
/* botão para instalar como app (ícone na tela do celular) */
#instalar { position: fixed; right: 1rem; bottom: 1rem; z-index: 5; border-radius: 999px; box-shadow: 0 4px 14px rgba(60, 30, 120, .25); }
#instalar[hidden] { display: none; }
@media print { #instalar { display: none; } }
/* telas de entrada: mascote + logo */
.marca-entrada { display: flex; align-items: flex-end; justify-content: center; gap: .75rem; margin-bottom: .5rem; }
.marca-entrada .mascote { height: 120px; width: auto; }
.marca-entrada .logo { width: 170px; height: auto; }
@media (max-width: 380px) { .marca-entrada .mascote { height: 96px; } .marca-entrada .logo { width: 140px; } }
/* crédito discreto do criador do app */
.creditos { text-align: center; font-size: .75rem; color: var(--muted); padding: 1.5rem 1rem 5rem; }
.creditos a { color: var(--muted); }
.creditos a:hover { color: var(--primary-dark); }
