:root {
  --stout: #1e1612;
  --malte: #2b201a;
  --malte-2: #392b22;
  --linha: #4d3a2e;
  --espuma: #fff3d6;
  --muted: #bba68f;
  --chope: #f2a71b;
  --chope-esc: #c97a0c;
  --lupulo: #8cc063;
  --tinto: #ee6a45;
  --pop: cubic-bezier(0.175, 0.885, 0.32, 1.275);
  --suave: cubic-bezier(0.2, 0, 0, 1);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--stout); }
body {
  margin: 0; min-height: 100dvh; background: var(--stout); color: var(--espuma);
  font: 16px/1.45 'Figtree Variable', system-ui, sans-serif; -webkit-font-smoothing: antialiased;
  padding-top: var(--safe-t);
}
h1, h2, h3, .display { font-family: 'Bricolage Grotesque Variable', 'Figtree Variable', sans-serif; letter-spacing: -0.01em; line-height: 1.1; margin: 0; }
h1 { font-size: 2rem; font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 700; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--chope); }
button, input, select { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.hidden { display: none !important; }
:focus-visible { outline: 3px solid var(--chope); outline-offset: 2px; }

.wrap { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(160px + var(--safe-b)); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }

/* botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  border: 0; border-radius: 999px; padding: 14px 22px; font-weight: 700; cursor: pointer;
  background: var(--chope); color: #2a1a05; min-height: 48px;
  transition: transform 160ms var(--pop), background 120ms, opacity 120ms;
}
.btn:active { transform: scale(0.96); }
.btn.block { width: 100%; }
.btn.ghost { background: transparent; color: var(--espuma); box-shadow: inset 0 0 0 2px var(--linha); }
.btn.hop { background: var(--lupulo); color: #14250a; }
.btn.danger { background: transparent; color: var(--tinto); box-shadow: inset 0 0 0 2px #6b3523; }
.btn.small { min-height: 38px; padding: 8px 16px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.iconbtn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--malte); display: grid; place-items: center; cursor: pointer; color: var(--espuma); transition: transform 160ms var(--pop); }
.iconbtn:active { transform: scale(0.9); }

/* formulários */
label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; }
.field { display: block; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select {
  width: 100%; background: var(--malte); border: 2px solid var(--linha); border-radius: 12px; padding: 12px 14px; min-height: 48px;
}
input:focus { border-color: var(--chope); outline: none; }
input[type=datetime-local] { color-scheme: dark; }
.err { color: var(--tinto); font-weight: 600; min-height: 1.3em; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* cartões e superfícies */
.card { background: var(--malte); border-radius: 20px; padding: 16px; }
.card.flat { background: transparent; box-shadow: inset 0 0 0 2px var(--linha); }
.photo-pick { position: relative; border-radius: 20px; overflow: hidden; background: var(--malte); aspect-ratio: 16/9; display: grid; place-items: center; cursor: pointer; box-shadow: inset 0 0 0 2px var(--linha); }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick span { position: relative; color: var(--muted); font-weight: 600; text-align: center; padding: 8px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background: var(--malte-2); display: grid; place-items: center; color: var(--muted); flex: none; overflow: hidden; font-weight: 700; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* login */
.login { min-height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: 24px 20px calc(24px + var(--safe-b)); max-width: 440px; margin: 0 auto; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.brand img { width: 64px; height: 64px; border-radius: 16px; }
.brand h1 { font-size: 2.4rem; }
.tabs2 { display: grid; grid-template-columns: 1fr 1fr; background: var(--malte); border-radius: 999px; padding: 4px; margin-bottom: 16px; }
.tabs2 button { border: 0; background: transparent; padding: 10px; border-radius: 999px; font-weight: 700; color: var(--muted); cursor: pointer; transition: background 160ms var(--suave), color 160ms; }
.tabs2 button.on { background: var(--chope); color: #2a1a05; }
.or { text-align: center; color: var(--muted); margin: 18px 0 12px; font-size: 0.9rem; }

/* topo */
.top { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.top h1 { font-size: 1.6rem; }

/* eventos na home */
.ev { display: flex; gap: 14px; align-items: center; padding: 12px; background: var(--malte); border-radius: 20px; text-decoration: none; color: inherit; transition: transform 160ms var(--suave); }
.ev:active { transform: scale(0.98); }
.ev .thumb { width: 64px; height: 64px; border-radius: 14px; background: var(--malte-2); object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 1.4rem; flex: none; overflow: hidden; }
.ev .thumb img { width: 100%; height: 100%; object-fit: cover; }
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: 999px; padding: 3px 10px; font-size: 0.78rem; font-weight: 700; background: var(--malte-2); color: var(--muted); }
.pill.live { background: #2d3d1d; color: var(--lupulo); }
.pill.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--lupulo); animation: blink 1.6s ease-in-out infinite; }
.pill.wait { background: #44331a; color: var(--chope); }
@keyframes blink { 50% { opacity: 0.25; } }

/* capa do evento */
.cover { position: relative; margin: -16px -16px 0; height: 190px; background: var(--malte-2); overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, var(--stout) 6%, transparent 65%); }
.cover .back { position: absolute; top: 12px; left: 12px; z-index: 2; background: rgba(30, 22, 18, 0.7); }
.cover .more { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(30, 22, 18, 0.7); }
.evhead { margin-top: -34px; position: relative; z-index: 1; }

.banner { border-radius: 14px; padding: 12px 14px; font-weight: 600; background: #44331a; color: var(--chope); }
.banner.bad { background: #4a2417; color: var(--tinto); }

/* abas do evento (barra fixa em baixo, alcance do polegar) */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--malte); display: grid; grid-template-columns: repeat(3, 1fr); padding-bottom: var(--safe-b); box-shadow: 0 -1px 0 var(--linha); }
.nav button { border: 0; background: transparent; color: var(--muted); padding: 10px 4px 9px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-weight: 600; font-size: 0.78rem; cursor: pointer; }
.nav button i { font-size: 1.15rem; transition: transform 200ms var(--pop); }
.nav button.on { color: var(--chope); }
.nav button.on i { transform: translateY(-2px) scale(1.12); }

/* botão principal flutuante */
.fabtn { position: fixed; z-index: 21; right: 16px; bottom: calc(76px + var(--safe-b)); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); padding: 16px 24px; font-size: 1.05rem; }

/* participante: o copo que enche */
.person { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--malte); border-radius: 20px; }
.person.me { box-shadow: inset 0 0 0 2px var(--chope); }
.person .name { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.person .count { font-family: 'Bricolage Grotesque Variable', sans-serif; font-weight: 800; font-size: 1.7rem; line-height: 1; text-align: right; }
.person .count small { display: block; font-family: 'Figtree Variable', sans-serif; font-size: 0.78rem; font-weight: 600; color: var(--muted); margin-top: 3px; }
.person.left { opacity: 0.6; }
.glass { position: relative; width: 34px; height: 48px; flex: none; border-radius: 4px 4px 9px 9px; background: #54402f; overflow: hidden; clip-path: polygon(0 0, 100% 0, 92% 100%, 8% 100%); }
.glass .beer { position: absolute; left: 0; right: 0; bottom: 0; height: var(--lvl, 0%); background: linear-gradient(to top, var(--chope-esc), var(--chope)); transition: height 700ms var(--pop); }
.glass .beer::before { content: ''; position: absolute; left: 0; right: 0; top: -5px; height: 7px; background: var(--espuma); border-radius: 50% 50% 0 0 / 100% 100% 0 0; opacity: var(--foam, 0); transition: opacity 400ms; }
.glass .bub { position: absolute; bottom: 4px; width: 3px; height: 3px; border-radius: 50%; background: rgba(255, 243, 214, 0.7); opacity: 0; animation: rise 3.2s ease-in infinite; }
.glass .bub:nth-child(2) { left: 9px; animation-delay: 0.4s; }
.glass .bub:nth-child(3) { left: 20px; animation-delay: 1.5s; }
.glass .bub:nth-child(4) { left: 26px; animation-delay: 2.3s; }
@keyframes rise { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 0.9; } 100% { transform: translateY(-34px); opacity: 0; } }
.glass.empty .bub { display: none; }
.bump { animation: bump 520ms var(--pop); }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.35); color: var(--chope); } 100% { transform: scale(1); } }

/* pedidos pendentes */
.req { display: flex; gap: 12px; align-items: stretch; background: #3a2c15; border-radius: 20px; padding: 10px; animation: enter 320ms var(--suave); }
.req img { width: 92px; height: 92px; border-radius: 14px; object-fit: cover; cursor: zoom-in; flex: none; }
.req .body { display: flex; flex-direction: column; justify-content: space-between; gap: 8px; flex: 1; min-width: 0; }
@keyframes enter { from { transform: translateY(10px); opacity: 0; } }

/* ranking */
.podium { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--malte); border-radius: 20px; }
.podium .pos { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-family: 'Bricolage Grotesque Variable', sans-serif; font-weight: 800; background: var(--malte-2); flex: none; }
.podium.p1 .pos { background: var(--chope); color: #2a1a05; }
.podium.p2 .pos { background: #d9cdb8; color: #2a2118; }
.podium.p3 .pos { background: #b9784a; color: #25140a; }
.bar { height: 8px; border-radius: 99px; background: var(--malte-2); margin-top: 8px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--chope); border-radius: 99px; transition: width 700ms var(--suave); }

/* relatório */
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.totals .card { text-align: center; }
.totals .n { font-family: 'Bricolage Grotesque Variable', sans-serif; font-weight: 800; font-size: 2.1rem; line-height: 1; color: var(--chope); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 6px 14px; font-size: 0.93rem; margin-top: 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; }
.trend { font-weight: 700; }
.trend.acelerando { color: var(--tinto); }
.trend.desacelerando { color: #7fb7e6; }
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; font-family: 'Figtree Variable', sans-serif; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 10px; font-size: 0.85rem; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; }

/* histórico */
.hist { background: var(--malte); border-radius: 20px; overflow: hidden; }
.hist summary { list-style: none; display: flex; gap: 14px; align-items: center; padding: 14px; cursor: pointer; }
.hist summary::-webkit-details-marker { display: none; }
.hist .chev { transition: transform 200ms var(--suave); color: var(--muted); }
.hist[open] .chev { transform: rotate(180deg); }
.hist .inner { padding: 0 14px 16px; }
.pics { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.pics figure { margin: 0; }
.pics img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; cursor: zoom-in; }
.pics figcaption { font-size: 0.82rem; color: var(--muted); margin-top: 4px; }
.tl { list-style: none; margin: 0; padding: 0 0 0 18px; border-left: 2px solid var(--linha); }
.tl li { position: relative; display: flex; gap: 12px; align-items: center; padding: 8px 0 8px 14px; }
.tl li::before { content: ''; position: absolute; left: -25px; top: 50%; width: 12px; height: 12px; margin-top: -6px; border-radius: 50%; background: var(--chope); box-shadow: 0 0 0 4px var(--stout); }
.tl img { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; cursor: zoom-in; }

/* modal */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgba(10, 6, 4, 0.72); display: flex; align-items: flex-end; justify-content: center; animation: fade 200ms; }
.sheet { width: 100%; max-width: 560px; background: var(--malte); border-radius: 26px 26px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); max-height: 92dvh; overflow: auto; animation: up 320ms var(--suave); }
.sheet .preview { width: 100%; max-height: 52dvh; object-fit: cover; border-radius: 18px; margin: 14px 0; }
.sheet .actions { display: grid; gap: 10px; margin-top: 14px; }
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(10, 6, 4, 0.94); display: grid; place-items: center; padding: 12px; animation: fade 160ms; }
.lightbox img { max-height: 92dvh; border-radius: 12px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.menu { position: absolute; right: 12px; top: 62px; z-index: 5; background: var(--malte); border-radius: 16px; padding: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); min-width: 210px; }
.menu button { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; padding: 12px; border-radius: 10px; font-weight: 600; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--malte-2); }

#toast { position: fixed; left: 50%; bottom: calc(150px + var(--safe-b)); transform: translate(-50%, 20px); z-index: 80; background: var(--espuma); color: #2a1a05; padding: 12px 18px; border-radius: 999px; font-weight: 700; opacity: 0; pointer-events: none; transition: transform 260ms var(--pop), opacity 200ms; max-width: 90vw; text-align: center; }
#toast.on { opacity: 1; transform: translate(-50%, 0); }
#toast.bad { background: var(--tinto); color: #2a0d05; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; background: var(--chope); color: #2a1a05; font-weight: 800; display: grid; place-items: center; font-size: 0.85rem; }

.empty-state { text-align: center; padding: 28px 12px; color: var(--muted); }
.empty-state i { font-size: 2rem; margin-bottom: 10px; color: var(--linha); }
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}
