/* ============================================================================
   Sorteios Alfa Mare — folha de estilo única (site público + administração).
   Tokens iguais aos da landing de Envio de Equipamento: IBM Plex Sans, azul
   #0241A0, cartões de borda clara. Mobile-first: o layout de coluna única é o
   padrão, e só a partir de 860px vira duas colunas.
   ========================================================================== */

:root {
  --brand: #0241a0;
  --brand-2: #0053ae;
  --ink: #132538;
  --text: #33404f;
  --muted: #5b6b7c;
  --bg: #ffffff;
  --bg-alt: #f5f8fb;
  --border: #cdd9e6;
  --ok: #1e8449;
  --ok-bg: #eaf6ee;
  --erro: #c0392b;
  --erro-bg: #fdecea;
  --aviso: #b7791f;
  --aviso-bg: #fdf6e3;
  --raio: 6px;
  --raio-card: 16px;
  --sombra: 0 20px 40px -24px rgba(2, 65, 160, 0.35);
}

* { box-sizing: border-box; }

/* O atributo hidden só esconde pela folha do navegador, que perde para
   qualquer display definido aqui (foi o que deixava o placeholder da imagem
   aparecendo junto com a foto do produto). Esta regra faz hidden valer sempre. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

h1, h2, h3 { font-family: inherit; color: var(--ink); margin: 0; line-height: 1.2; }

a { color: var(--brand); }

.container { max-width: 1140px; margin: 0 auto; padding: 0 20px; }
.container-estreito { max-width: 640px; margin: 0 auto; padding: 0 20px; }

.kicker {
  font-family: 'IBM Plex Mono', ui-monospace, monospace;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 12px;
  color: var(--brand);
  font-weight: 500;
  display: inline-block;
}

.oculto { display: none !important; }
.somente-leitores {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------------ botões */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; font-size: 16px;
  /* 48px de altura mínima: alvo confortável para o dedo no tablet do estande */
  min-height: 48px; padding: 12px 24px;
  border-radius: var(--raio); border: 1px solid transparent;
  cursor: pointer; text-decoration: none; text-align: center;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.btn-primario { background: var(--brand); color: #fff; }
.btn-primario:hover:not(:disabled) { background: var(--brand-2); }
.btn-contorno { background: #fff; color: var(--brand); border-color: var(--border); }
.btn-contorno:hover:not(:disabled) { background: var(--bg-alt); }
.btn-perigo { background: #fff; color: var(--erro); border-color: #e8b9b3; }
.btn-perigo:hover:not(:disabled) { background: var(--erro-bg); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-bloco { width: 100%; }
.btn-pequeno { min-height: 38px; padding: 6px 14px; font-size: 14px; }

/* ------------------------------------------------------------------ campos */

.campo { margin-bottom: 18px; }
.campo > label,
.rotulo { display: block; font-weight: 600; font-size: 15px; color: var(--ink); margin-bottom: 6px; }
.campo .obrigatorio { color: var(--erro); margin-left: 2px; }
.ajuda { display: block; color: var(--muted); font-size: 13px; margin-top: 5px; }

input[type=text], input[type=email], input[type=tel], input[type=url],
input[type=password], input[type=search], select, textarea {
  width: 100%;
  /* 16px evita o zoom automático do Safari no iPhone ao focar o campo */
  font: inherit; font-size: 16px;
  min-height: 48px; padding: 11px 13px;
  color: var(--text); background: #fff;
  border: 1px solid var(--border); border-radius: var(--raio);
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(2, 65, 160, .15);
}
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--erro); }
.erro-campo { display: block; color: var(--erro); font-size: 13px; margin-top: 5px; }

.marcador {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--raio);
  background: var(--bg-alt); cursor: pointer; margin-bottom: 12px;
}
.marcador:has(input:focus-visible) { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(2, 65, 160, .15); }
.marcador input { width: 22px; height: 22px; min-height: 0; margin: 1px 0 0; flex: 0 0 auto; accent-color: var(--brand); }
.marcador span { font-size: 14.5px; line-height: 1.45; }

/* -------------------------------------------------------------- cabeçalho */

.topo { background: #fff; border-bottom: 1px solid var(--border); }
.topo-interno {
  max-width: 1140px; margin: 0 auto; padding: 12px 20px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topo-logo img { height: 38px; width: auto; display: block; }
.topo-evento { display: flex; align-items: center; gap: 12px; }
.topo-evento-rotulo {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; text-transform: uppercase;
  letter-spacing: 1px; font-size: 10.5px; color: var(--muted); font-weight: 500;
  line-height: 1.25; max-width: 110px; text-align: right;
}
.topo-evento img { max-height: 40px; max-width: 130px; width: auto; object-fit: contain; display: block; }

/* ------------------------------------------------------------------- hero */

.hero { background: radial-gradient(120% 100% at 85% 0%, #f2f6fb 0%, #ffffff 55%); padding: 32px 0 8px; }
.hero-grid { display: grid; grid-template-columns: 1fr; gap: 24px; align-items: center; }
.hero h1 { font-size: clamp(26px, 6vw, 40px); font-weight: 700; color: var(--brand); margin: 10px 0 12px; }
.hero-sub { font-size: clamp(15px, 2vw, 18px); color: var(--muted); margin: 0; }
.hero-descricao { margin: 14px 0 0; font-size: 15.5px; }

.cartao-produto {
  background: #fff; border: 1px solid var(--border); border-radius: var(--raio-card);
  padding: 16px; box-shadow: var(--sombra);
}
.cartao-produto img { width: 100%; height: auto; max-height: 340px; object-fit: contain; display: block; border-radius: 10px; }
.cartao-produto .vazio {
  border: 1px dashed var(--border); border-radius: 10px; min-height: 180px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 14px; text-align: center; padding: 20px;
}
.cartao-produto figcaption { margin-top: 12px; font-size: 14px; color: var(--muted); }

/* ---------------------------------------------------------------- seções */

.secao { padding: 40px 0; }
.secao-alt { background: var(--bg-alt); border-top: 1px solid var(--border); }
.secao h2 { font-size: clamp(21px, 3vw, 27px); font-weight: 700; margin: 8px 0 6px; }

.cartao {
  background: #fff; border: 1px solid var(--border); border-radius: var(--raio-card);
  padding: 22px;
}

/* --------------------------------------------------------------- QR Code */

/* O bloco do QR é o centro da mesa do estande: cabeçalho grande, código
   grande, tudo centralizado — precisa ser lido de pé, a um braço de distância. */
.qr-bloco { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
/* Seletor com a classe do pai de propósito: sem isso a regra genérica
   ".secao h2" ganha por especificidade e o título encolhe. */
.qr-bloco .qr-titulo {
  font-size: clamp(26px, 6.5vw, 40px); font-weight: 700; color: var(--ink);
  margin: 6px 0 0; max-width: 22ch; line-height: 1.15;
}
.qr-texto { font-size: clamp(15px, 2.2vw, 19px); color: var(--muted); margin: 0; max-width: 46ch; }
.qr-caixa {
  background: #fff; border: 1px solid var(--border); border-radius: var(--raio-card);
  padding: 18px; display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--sombra);
}
/* O canvas nasce com o tamanho pedido à biblioteca; aqui só o ajustamos para
   não estourar a tela em aparelhos estreitos. */
.qr-caixa canvas, .qr-caixa img {
  display: block; width: min(300px, 72vw); height: auto; image-rendering: pixelated;
}
.qr-endereco {
  font-family: 'IBM Plex Mono', ui-monospace, monospace; font-size: 13px;
  color: var(--muted); word-break: break-all; margin-top: 10px;
}

/* ---------------------------------------------------------------- avisos */

.aviso { border-radius: var(--raio); padding: 13px 15px; font-size: 14.5px; margin: 0 0 16px; }
.aviso-ok { background: var(--ok-bg); color: #14602f; border: 1px solid #b7dfc4; }
.aviso-erro { background: var(--erro-bg); color: #8e2b20; border: 1px solid #f0c2bb; }
.aviso-atencao { background: var(--aviso-bg); color: #7a5410; border: 1px solid #ecd9a5; }

/* ------------------------------------------------------------- sucesso */

.sucesso { text-align: center; padding: 22px 0; }
.sucesso-marca {
  width: 64px; height: 64px; border-radius: 50%; background: var(--ok-bg);
  color: var(--ok); display: inline-flex; align-items: center; justify-content: center;
  font-size: 34px; margin-bottom: 14px;
}

/* ---------------------------------------------------------------- rodapé */

.rodape {
  border-top: 1px solid var(--border); padding: 24px 0; margin-top: 8px;
  color: var(--muted); font-size: 13.5px; text-align: center; background: #fff;
}
.rodape a { color: var(--muted); }

/* ============================== administração ============================ */

.admin-topo { background: var(--ink); border-bottom: none; }
.admin-topo .topo-interno { flex-wrap: wrap; }
.admin-topo .topo-logo img { height: 30px; filter: brightness(0) invert(1); }
.admin-menu { display: flex; gap: 4px; flex-wrap: wrap; }
.admin-menu a {
  color: #c6d4e4; text-decoration: none; font-size: 14.5px; font-weight: 500;
  padding: 8px 13px; border-radius: var(--raio);
}
.admin-menu a:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.admin-menu a.ativo { background: var(--brand); color: #fff; }
.admin-usuario { display: flex; align-items: center; gap: 12px; color: #93a8bf; font-size: 13.5px; }
.admin-usuario button {
  background: none; border: 1px solid #33475f; color: #c6d4e4;
  border-radius: var(--raio); padding: 6px 12px; cursor: pointer; font: inherit; font-size: 13.5px;
}
.admin-usuario button:hover { background: rgba(255, 255, 255, .08); }

.admin-corpo { background: var(--bg-alt); min-height: calc(100vh - 62px); padding: 26px 0 60px; }
.admin-cabecalho {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 20px;
}
.admin-cabecalho h1 { font-size: 26px; }
.admin-cabecalho p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }

.filtros { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 18px; }
.filtros .campo { margin: 0; flex: 1 1 200px; }
.filtros .campo label { font-size: 13px; }

/* tabela: rola na horizontal dentro do próprio cartão, a página nunca rola */
.tabela-envolucro { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--raio-card); background: #fff; }
table.tabela { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 900px; }
table.tabela th, table.tabela td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: top; }
table.tabela th {
  background: var(--bg-alt); font-weight: 600; color: var(--ink); white-space: nowrap;
  font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em;
  position: sticky; top: 0; z-index: 1;
}
table.tabela tr:last-child td { border-bottom: none; }
table.tabela tbody tr:hover { background: #fafcfe; }

.etiqueta {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 9px;
  border-radius: 100px; white-space: nowrap;
}
.etiqueta-ok { background: var(--ok-bg); color: #14602f; }
.etiqueta-erro { background: var(--erro-bg); color: #8e2b20; }
.etiqueta-neutra { background: #eef2f7; color: var(--muted); }
.etiqueta-atencao { background: var(--aviso-bg); color: #7a5410; }

.cartoes { display: grid; grid-template-columns: 1fr; gap: 16px; }
.cartao-sorteio { background: #fff; border: 1px solid var(--border); border-radius: var(--raio-card); padding: 18px; }
.cartao-sorteio.inativo { opacity: .78; }
.cartao-sorteio h3 { font-size: 18px; margin-bottom: 2px; }
.cartao-sorteio .evento { color: var(--muted); font-size: 14px; }
.cartao-sorteio .numeros { display: flex; gap: 22px; margin: 14px 0; flex-wrap: wrap; }
.cartao-sorteio .numeros b { display: block; font-size: 22px; color: var(--ink); line-height: 1.2; }
.cartao-sorteio .numeros span { font-size: 12.5px; color: var(--muted); }
.cartao-sorteio .acoes { display: flex; gap: 8px; flex-wrap: wrap; }

.vazio-estado {
  background: #fff; border: 1px dashed var(--border); border-radius: var(--raio-card);
  padding: 40px 24px; text-align: center; color: var(--muted);
}

/* --------------------------------------------------------------- diálogo */

dialog.painel {
  border: none; border-radius: var(--raio-card); padding: 0;
  width: min(680px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  color: var(--text); box-shadow: 0 30px 60px -20px rgba(19, 37, 56, .4);
}
dialog.painel::backdrop { background: rgba(19, 37, 56, .45); }
.painel-topo {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.painel-topo h2 { font-size: 19px; }
.painel-fechar { background: none; border: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.painel-corpo { padding: 22px; overflow-y: auto; }
.painel-rodape {
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
  padding: 16px 22px; border-top: 1px solid var(--border); background: var(--bg-alt);
  position: sticky; bottom: 0;
}

.pre-imagem {
  display: flex; align-items: center; gap: 14px; margin-top: 10px; flex-wrap: wrap;
}
.pre-imagem img {
  max-height: 70px; max-width: 150px; border: 1px solid var(--border);
  border-radius: var(--raio); background: #fff; padding: 4px; object-fit: contain;
}

.login-tela {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg-alt); padding: 24px;
}
.login-caixa { width: min(420px, 100%); background: #fff; border: 1px solid var(--border); border-radius: var(--raio-card); padding: 32px; }
.login-caixa img { height: 40px; margin-bottom: 22px; }

/* ------------------------------------------------------------ telas largas */

@media (min-width: 860px) {
  .hero { padding: 52px 0 20px; }
  .hero-grid { grid-template-columns: 1.05fr .95fr; gap: 44px; }
  .secao { padding: 56px 0; }
  .cartao { padding: 32px; }
  .duas-colunas { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
  .duas-colunas .largura-total { grid-column: 1 / -1; }
  .cartoes { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
}

@media (max-width: 520px) {
  .topo-evento-rotulo { display: none; }
  .topo-logo img { height: 32px; }
  .admin-cabecalho .btn { width: 100%; }
}

@media print {
  .topo, .rodape, .btn, .admin-topo { display: none !important; }
}
