/* Copo Cheio: roxo, espuma e âmbar. */
:root {
  --roxo: #3A1A5E;
  --roxo-2: #4B2577;
  --espuma: #F6F3F9;
  --papel: #FFFFFF;
  --tinta: #1E1626;
  --cinza: #62596B;
  --linha: #DDD6E4;
  --ambar: #F0A81C;
  --ambar-escuro: #A86F00;
  --ganho: #2B7A4B;
  --perda: #B23A24;
  --foco: #F0A81C;

  --f-titulo: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-texto: "Figtree", "Segoe UI", system-ui, -apple-system, sans-serif;

  --r-campo: 10px;
  --r-bloco: 16px;
  --barra-alt: 64px;
  --faixa-alt: 56px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--espuma);
  color: var(--tinta);
  font: 16px/1.5 var(--f-texto);
  font-variant-numeric: tabular-nums;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--f-titulo); line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.3rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--foco); outline-offset: 2px; }
.so-leitor { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.arranque { padding: 3rem 1rem; text-align: center; color: var(--cinza); }
.mudo { color: var(--cinza); }
.peq { font-size: .875rem; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: 0 1rem; border-radius: 999px;
  border: 1.5px solid var(--roxo); background: transparent; color: var(--roxo);
  font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: rgba(58, 26, 94, .06); }
.btn.cheio { background: var(--roxo); color: #fff; }
.btn.cheio:hover { background: var(--roxo-2); }
.btn.ambar { background: var(--ambar); border-color: var(--ambar); color: var(--tinta); }
.btn.perigo { border-color: var(--perda); color: var(--perda); }
.btn.perigo.cheio { background: var(--perda); color: #fff; }
.btn.texto { border-color: transparent; padding: 0 .6rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.bloco { width: 100%; }

.campo { display: grid; gap: .3rem; }
.campo > span { font-size: .875rem; font-weight: 600; color: var(--cinza); }
input[type=text], input[type=password], input[type=date], input[type=search], textarea, select {
  width: 100%; min-height: 44px; padding: .55rem .75rem;
  background: var(--papel); border: 1.5px solid var(--linha); border-radius: var(--r-campo);
}
input:focus, textarea:focus, select:focus { border-color: var(--roxo); outline: none; box-shadow: 0 0 0 3px rgba(240, 168, 28, .45); }
input:disabled, textarea:disabled { background: #F1EDF5; color: var(--cinza); }
input.valor { text-align: right; }
textarea { min-height: 110px; resize: vertical; }

/* ---------- entrada ---------- */
.entrada {
  min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background: var(--roxo);
}
.entrada-cartao {
  width: min(380px, 100%); background: var(--papel); border-radius: 22px; padding: 2rem 1.5rem 1.5rem;
  display: grid; gap: 1rem;
}
.entrada-coluna { width: min(380px, 100%); display: grid; gap: 1.75rem; }
.entrada-logo { margin: 0; }
.entrada-logo img { display: block; width: 100%; height: auto; }
.entrada-sub { font-family: var(--f-titulo); font-weight: 700; font-size: 1.15rem; }
.erro { color: var(--perda); font-weight: 600; font-size: .9rem; }

/* ---------- barra superior ---------- */
.topo {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: calc(env(safe-area-inset-top) + .6rem) 1rem .6rem;
  background: var(--roxo); color: #fff; min-height: var(--barra-alt);
}
.topo .marca { display: flex; align-items: center; gap: .5rem; text-decoration: none; font-family: var(--f-titulo); font-weight: 800; font-size: 1.15rem; }
.topo .marca img { display: block; height: 46px; width: auto; }
.topo .titulo-evento { flex: 1; min-width: 0; }
.topo .titulo-evento strong { display: block; font-family: var(--f-titulo); font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo .titulo-evento small { opacity: .75; font-size: .8rem; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topo .btn { color: #fff; border-color: rgba(255,255,255,.35); min-height: 40px; }
.topo .btn:hover { background: rgba(255,255,255,.08); }
.topo .espaco { flex: 1; }
.voltar { font-size: 1.4rem; line-height: 1; padding: 0 .7rem !important; }

.estado-gravar { font-size: .78rem; opacity: .85; white-space: nowrap; }
.estado-gravar::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin: 0 .4rem 0 .45rem; vertical-align: middle; }
body:not(.com-faixa) #aviso { bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
.estado-gravar.falhou { color: var(--ambar); opacity: 1; font-weight: 600; }

/* ---------- conteúdo ---------- */
.pagina { max-width: 760px; margin: 0 auto; padding: 1.25rem 1rem 2rem; display: grid; gap: 1.25rem; }
.com-faixa .pagina { padding-bottom: calc(var(--faixa-alt) + var(--barra-alt) + 2rem + env(safe-area-inset-bottom)); }
.cabeca { display: flex; align-items: end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.cabeca p { color: var(--cinza); }

.bloco { background: var(--papel); border-radius: var(--r-bloco); padding: 1rem; display: grid; gap: .9rem; }
.bloco > header { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; }
.bloco > header .total { font-family: var(--f-titulo); font-weight: 700; font-size: 1.1rem; }

.grelha-2 { display: grid; gap: .75rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 480px) { .grelha-2 { grid-template-columns: 1fr; } }

/* ---------- lista de eventos ---------- */
.eventos { display: grid; gap: .6rem; list-style: none; margin: 0; padding: 0; }
.evento-item {
  display: grid; grid-template-columns: 1fr auto; gap: .2rem 1rem; align-items: center;
  background: var(--papel); border-radius: 14px; padding: .9rem 1rem; text-decoration: none;
  border-left: 5px solid var(--ambar);
}
.evento-item.fechado { border-left-color: var(--linha); }
.evento-item:hover { background: #FBFAFC; }
.evento-item strong { font-family: var(--f-titulo); font-size: 1.1rem; }
.evento-item .meta { color: var(--cinza); font-size: .875rem; }
.evento-item .res { text-align: right; font-weight: 700; grid-row: span 2; }
.evento-item .res small { display: block; font-weight: 500; color: var(--cinza); font-size: .75rem; }
.etiqueta { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1rem .5rem; border-radius: 999px; background: #ECE6F2; color: var(--cinza); vertical-align: middle; margin-left: .3rem; }
.vazio { text-align: center; padding: 2.5rem 1rem; display: grid; gap: .75rem; justify-items: center; }
.vazio svg { width: 64px; height: 82px; }

.pos { color: var(--ganho); }
.neg { color: var(--perda); }

/* ---------- linhas de bebidas ---------- */
.procura { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.procura input { flex: 1 1 200px; }
.alternar { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 600; cursor: pointer; min-height: 44px; }
.alternar input { width: 20px; height: 20px; accent-color: var(--roxo); }

.produtos { list-style: none; margin: 0; padding: 0; }
.produto {
  display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; align-items: center;
  padding: .7rem 0; border-top: 1px solid var(--linha);
}
.produto:first-child { border-top: 0; }
.produto .nome { font-weight: 600; font-size: .95rem; }
.produto .detalhe { font-size: .8rem; color: var(--cinza); }
.produto .detalhe .sub { color: var(--tinta); font-weight: 600; }
.produto.tem { }
.produto.tem .nome::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ambar); margin-right: .4rem; vertical-align: middle; }
.passos { display: flex; align-items: center; grid-row: span 2; }
.passos button {
  width: 44px; height: 44px; border: 1.5px solid var(--linha); background: var(--papel);
  font-size: 1.3rem; font-weight: 600; cursor: pointer; color: var(--roxo);
}
.passos button:first-child { border-radius: 12px 0 0 12px; }
.passos button:last-child { border-radius: 0 12px 12px 0; }
.passos input {
  width: 56px; height: 44px; min-height: 0; text-align: center; border-radius: 0;
  border-left: 0; border-right: 0; padding: 0 .2rem; font-weight: 700;
}
.passos button:active { background: var(--espuma); }

/* linhas editáveis (produtos extra, equipa, gastos) */
.linhas { display: grid; gap: .75rem; }
.linha-ed {
  display: grid; gap: .5rem; padding: .85rem; border: 1.5px solid var(--linha); border-radius: 14px;
  grid-template-columns: 1fr 1fr 1fr;
}
.linha-ed .larga { grid-column: 1 / -1; display: flex; gap: .5rem; align-items: end; }
.linha-ed .larga .campo { flex: 1; }
.linha-ed .rodape { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; font-size: .875rem; color: var(--cinza); }
.linha-ed .rodape strong { color: var(--tinta); font-size: 1rem; }
.linha-ed.gasto { grid-template-columns: 1fr 130px auto; align-items: end; }
@media (max-width: 420px) { .linha-ed { grid-template-columns: 1fr 1fr; } .linha-ed.gasto { grid-template-columns: 1fr 110px auto; } }
.remover { min-height: 44px; width: 44px; border-radius: 12px; border: 1.5px solid var(--linha); background: var(--papel); color: var(--perda); font-size: 1.2rem; cursor: pointer; flex: none; }

.despesas-lista { display: grid; gap: .1rem; }
.despesa { display: grid; grid-template-columns: 1fr 140px; gap: .75rem; align-items: center; padding: .35rem 0; }
.despesa label { font-weight: 500; }

/* ---------- caixa ---------- */
.caixa-total input { font-family: var(--f-titulo); font-size: 1.6rem; font-weight: 700; min-height: 60px; }
.verificacao { padding: .75rem 1rem; border-radius: 12px; font-weight: 600; display: flex; justify-content: space-between; gap: .75rem; align-items: center; flex-wrap: wrap; }
.verificacao.certo { background: #E3F1E8; color: var(--ganho); }
.verificacao.errado { background: #FBEAD0; color: #7A4B00; }

/* ---------- balanço: o copo ---------- */
.copo-bloco { display: grid; grid-template-columns: 150px 1fr; gap: 1.25rem; align-items: center; }
@media (max-width: 420px) { .copo-bloco { grid-template-columns: 110px 1fr; gap: 1rem; } }
.copo { width: 100%; height: auto; display: block; overflow: visible; }
.copo .liquido { transition: y .8s cubic-bezier(.2,.7,.2,1), height .8s cubic-bezier(.2,.7,.2,1); }
@media (prefers-reduced-motion: reduce) { .copo .liquido { transition: none; } }
.veredito { display: grid; gap: .35rem; }
.veredito .grande { font-family: var(--f-titulo); font-size: clamp(2rem, 8vw, 2.8rem); font-weight: 800; line-height: 1; }
.veredito .frase { font-weight: 600; }

.contas { width: 100%; border-collapse: collapse; }
.contas td { padding: .55rem 0; border-top: 1px solid var(--linha); }
.contas td:last-child { text-align: right; font-weight: 600; white-space: nowrap; }
.contas tr.forte td { font-weight: 800; font-family: var(--f-titulo); font-size: 1.1rem; border-top: 2px solid var(--tinta); }
.contas tr.sub td:first-child { padding-left: 1rem; color: var(--cinza); }
.acoes { display: flex; gap: .6rem; flex-wrap: wrap; }

/* ---------- faixa de totais + navegação ---------- */
.rodape-fixo { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; }
.faixa {
  display: flex; align-items: center; gap: 1rem; justify-content: center;
  height: var(--faixa-alt); padding: 0 1rem; background: var(--papel); border-top: 1px solid var(--linha);
  font-size: .85rem;
}
.faixa div { display: grid; line-height: 1.2; }
.faixa span { color: var(--cinza); font-size: .75rem; }
.faixa b { font-family: var(--f-titulo); font-size: 1.05rem; }
.faixa svg { width: 22px; height: 28px; flex: none; }
.separador { width: 1px; height: 28px; background: var(--linha); }

.navegacao {
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--roxo); padding-bottom: env(safe-area-inset-bottom);
}
.navegacao a {
  display: grid; justify-items: center; align-content: center; gap: 2px; min-height: var(--barra-alt);
  color: rgba(255,255,255,.7); text-decoration: none; font-size: .75rem; font-weight: 600; position: relative;
}
.navegacao a svg { width: 22px; height: 22px; }
.navegacao a[aria-current=page] { color: #fff; }
.navegacao a[aria-current=page]::before {
  content: ""; position: absolute; top: 0; left: 25%; right: 25%; height: 3px; background: var(--ambar); border-radius: 0 0 3px 3px;
}
@media (min-width: 900px) {
  .faixa, .navegacao { max-width: 760px; margin: 0 auto; }
  .faixa { border-left: 1px solid var(--linha); border-right: 1px solid var(--linha); }
  .navegacao { border-radius: 16px 16px 0 0; }
}

.fechado-aviso { background: #ECE6F2; border-radius: 12px; padding: .75rem 1rem; font-weight: 600; display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; }

/* ---------- admin ---------- */
.tabela-produtos { display: grid; gap: .5rem; }
.prod-admin { display: grid; grid-template-columns: 1fr 110px auto; gap: .5rem; align-items: center; padding: .5rem 0; border-top: 1px solid var(--linha); }
.prod-admin:first-child { border-top: 0; }
.prod-admin.inativo input[type=text] { color: var(--cinza); text-decoration: line-through; }
.prod-admin .botoes { display: flex; gap: .25rem; }
.prod-admin .botoes button { width: 40px; min-height: 40px; border-radius: 10px; border: 1.5px solid var(--linha); background: var(--papel); cursor: pointer; }
@media (max-width: 560px) {
  .prod-admin { grid-template-columns: 1fr 88px; padding: .6rem 0; }
  .prod-admin .botoes { grid-column: 1 / -1; justify-content: flex-end; }
  .prod-admin .botoes button { min-height: 36px; width: 40px; }
}

/* ---------- menu, modal, aviso ---------- */
.menu { position: absolute; right: 1rem; top: calc(100% + 4px); background: var(--papel); color: var(--tinta); border-radius: 14px; box-shadow: 0 12px 32px rgba(58, 26, 94,.25); min-width: 220px; padding: .4rem; display: grid; z-index: 40; }
.menu a, .menu button { display: block; text-align: left; padding: .7rem .8rem; border-radius: 10px; text-decoration: none; background: none; border: 0; cursor: pointer; font-weight: 500; width: 100%; }
.menu a:hover, .menu button:hover { background: var(--espuma); }
.menu .quem { padding: .5rem .8rem; font-size: .8rem; color: var(--cinza); border-bottom: 1px solid var(--linha); margin-bottom: .3rem; }

.modal-fundo { position: fixed; inset: 0; background: rgba(24, 10, 40, .55); display: grid; place-items: end center; z-index: 50; padding: 1rem; }
@media (min-width: 600px) { .modal-fundo { place-items: center; } }
.modal { background: var(--papel); border-radius: 20px; padding: 1.4rem; width: min(440px, 100%); display: grid; gap: 1rem; max-height: 90dvh; overflow: auto; }
.modal .acoes { justify-content: flex-end; }

#aviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--faixa-alt) + var(--barra-alt) + 1rem + env(safe-area-inset-bottom)); z-index: 60; pointer-events: none; }
#aviso div { width: max-content; max-width: min(88vw, 460px); border-radius: 18px !important; background: var(--tinta); color: #fff; padding: .7rem 1.1rem; border-radius: 999px; font-weight: 600; font-size: .9rem; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
#aviso div.mau { background: var(--perda); }

/* ---------- impressão ---------- */
#impressao { display: none; }
@media print {
  @page { margin: 16mm 14mm; }
  body { background: #fff; font-size: 11pt; }
  #app, #modal-raiz, #aviso { display: none !important; }
  #impressao { display: block; }
  .rel h1 { font-size: 20pt; }
  .rel .meta { color: #444; margin: 2mm 0 6mm; }
  .rel h2 { font-size: 13pt; margin: 6mm 0 2mm; }
  .rel table { width: 100%; border-collapse: collapse; }
  .rel th, .rel td { text-align: left; padding: 1.4mm 0; border-bottom: .3mm solid #ccc; }
  .rel th:not(:first-child), .rel td:not(:first-child) { text-align: right; }
  .rel tr.total td { font-weight: 700; border-top: .5mm solid #000; border-bottom: 0; }
  .rel .resumo { display: flex; gap: 8mm; margin: 4mm 0; }
  .rel .resumo div { border: .4mm solid #000; padding: 3mm 4mm; flex: 1; }
  .rel .resumo b { display: block; font-size: 15pt; }
  .rel section { break-inside: avoid; }
  .rel .assinaturas { display: flex; gap: 12mm; margin-top: 18mm; }
  .rel .assinaturas div { flex: 1; border-top: .3mm solid #000; padding-top: 1.5mm; font-size: 9pt; }
}
