:root {
  --fundo: #f4f6fa;
  --cartao: #ffffff;
  --texto: #1c2430;
  --suave: #64748b;
  --borda: #dde3ec;
  --primaria: #0f766e;
  --primaria-escura: #0b5b55;
  --perigo: #b42318;
  --ok-fundo: #e7f6ef;
  --erro-fundo: #fdecea;
}
* { box-sizing: border-box; }
body { margin: 0; font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--texto); background: var(--fundo); }
h1 { font-size: 1.4rem; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
a { color: var(--primaria); }
input, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=file]), textarea {
  width: 100%; padding: .6rem .7rem; border: 1px solid var(--borda); border-radius: 8px; background: #fff;
}
button, .botao {
  display: inline-block; padding: .6rem 1.1rem; border: 0; border-radius: 8px; background: var(--primaria);
  color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; text-align: center;
}
button:hover, .botao:hover { background: var(--primaria-escura); }
button:disabled { background: #94a3b8; cursor: default; }
button.perigo { background: transparent; color: var(--perigo); border: 1px solid currentColor; padding: .35rem .7rem; }
button.link { background: none; color: var(--suave); font-weight: 400; padding: .3rem; }
button.secundario { background: transparent; color: var(--primaria); border: 1px solid currentColor; }
button.secundario:hover { background: var(--ok-fundo); }
.qr { width: 280px; max-width: 100%; padding: .6rem; background: #fff; border-radius: 8px; }
.qr svg { display: block; width: 100%; height: auto; }
.sub { color: var(--suave); font-size: .9rem; }
.erro { color: var(--perigo); }
label { display: block; font-size: .9rem; color: var(--suave); }
label.check { display: flex; gap: .5rem; align-items: flex-start; color: var(--texto); }
label.check input { margin-top: .25rem; }

/* ---------- Portal ---------- */
.portal { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, #0f766e, #134e4a); }
.cartao { width: 100%; max-width: 440px; background: var(--cartao); border-radius: 16px; padding: 1.5rem; box-shadow: 0 10px 30px rgb(0 0 0 / .2); text-align: center; }
.cartao .local { margin: 0 0 1rem; font-weight: 700; color: var(--primaria); letter-spacing: .02em; }
.cartao form { display: grid; gap: .9rem; text-align: left; margin-top: 1rem; }
.cartao form button { width: 100%; padding: .8rem; }
.cartao .botao { width: 100%; margin-top: 1rem; }
.cartao > button { width: 100%; padding: .8rem; margin-top: .5rem; }
.ok-icone { width: 64px; height: 64px; margin: .5rem auto 1rem; border-radius: 50%; background: var(--ok-fundo); color: var(--primaria); font-size: 2rem; line-height: 64px; font-weight: 700; }
.barra { height: 6px; background: rgb(255 255 255 / .18); border-radius: 99px; overflow: hidden; }
.barra div { height: 100%; width: 0; background: #2dd4bf; transition: width 1s linear; }

/* Anúncio em tela cheia */
.tela-anuncio { height: 100vh; height: 100dvh; display: flex; flex-direction: column; background: #000; color: #fff; overflow: hidden; }
.tela-anuncio .topo { display: flex; gap: .75rem; align-items: center; padding: .5rem 12px; font-size: .85rem; background: rgb(255 255 255 / .06); }
.tela-anuncio .topo strong { color: #5eead4; margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tela-anuncio .topo span { color: #cbd5e1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tela-anuncio .palco { flex: 1; min-height: 0; display: grid; place-items: center; position: relative; overflow: hidden; }
/* fundo: o próprio anúncio ampliado e desfocado, preenchendo as sobras da tela */
.tela-anuncio .palco::before { content: ""; position: absolute; inset: -40px; background: var(--fundo-img, none) center / cover no-repeat; filter: blur(28px) brightness(.55); }
.tela-anuncio .palco img, .tela-anuncio .palco video { position: relative; width: 100%; height: 100%; object-fit: contain; display: block; }
.tela-anuncio .palco .carregando { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: #fff; opacity: .8; z-index: 1; animation: pisca 1.2s ease-in-out infinite; }
@keyframes pisca { 50% { opacity: .35; } }
.tela-anuncio .base { display: grid; gap: .6rem; padding: .6rem 12px calc(.75rem + env(safe-area-inset-bottom)); }
.tela-anuncio .base button { width: 100%; padding: .85rem; font-size: 1.05rem; }
.tela-anuncio .base button:disabled { background: #334155; color: #cbd5e1; }
.tela-anuncio .erro { margin: 0; color: #fca5a5; text-align: center; }
.tela-anuncio .erro:empty { display: none; }

/* ---------- Admin ---------- */
.admin header { display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; align-items: center; padding: .8rem 16px; background: #0f172a; color: #fff; }
.admin nav { display: flex; flex-wrap: wrap; gap: .25rem; }
.admin nav a { color: #cbd5e1; text-decoration: none; padding: .35rem .7rem; border-radius: 6px; }
.admin nav a.ativo, .admin nav a:hover { background: #1e293b; color: #fff; }
.admin main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 16px; }
.aviso { padding: .7rem 1rem; border-radius: 8px; }
.aviso.ok { background: var(--ok-fundo); }
.aviso.erro { background: var(--erro-fundo); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 1rem; }
.card { background: var(--cartao); border: 1px solid var(--borda); border-radius: 10px; padding: 1rem; }
.card span { display: block; color: var(--suave); font-size: .85rem; }
.card b { font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.bloco { background: var(--cartao); border: 1px solid var(--borda); border-radius: 10px; padding: 1rem; margin-bottom: 1rem; }
.pilha { display: grid; gap: 1rem; max-width: 640px; }
.pilha button { justify-self: start; }
.linha { display: flex; flex-wrap: wrap; gap: .6rem; align-items: end; margin-bottom: 1rem; }
.linha input:not([type=checkbox]):not([type=file]) { width: auto; min-width: 0; flex: 1 1 160px; }
.linha label input { width: 6rem !important; flex: none !important; }
td .linha { margin: 0; }
table { width: 100%; border-collapse: collapse; background: var(--cartao); border: 1px solid var(--borda); border-radius: 10px; overflow: hidden; display: block; overflow-x: auto; }
th, td { padding: .6rem .75rem; border-bottom: 1px solid var(--borda); text-align: left; vertical-align: middle; font-size: .92rem; }
th { background: #f8fafc; color: var(--suave); font-weight: 600; }
tr.inativo { opacity: .55; }
td.mini img, td.mini video { width: 110px; height: 62px; object-fit: cover; border-radius: 6px; background: #0b1220; display: block; }

.dica { font-size: .9rem; background: var(--ok-fundo); padding: .6rem .8rem; border-radius: 8px; margin: .8rem 0; text-align: left; }
