:root {
  --red-900: #4a0808;
  --red-800: #7a0f0f;
  --red-700: #a41414;
  --red-600: #c81a1a;
  --red-500: #e2231b;
  --red-400: #ff4433;
  --yellow-500: #ffd400;
  --yellow-400: #ffe14d;
  --yellow-100: #fff6cc;
  --ink: #1a0e0e;
  --green-500: #16a34a;
  --gray-50: #f7f8fb;
  --gray-100: #eef0f6;
  --gray-300: #cbd0dd;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 14px;
  --shadow: 0 4px 18px rgba(122, 15, 15, 0.08);
  --shadow-lg: 0 14px 34px rgba(122, 15, 15, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }

@keyframes entrarBaixo {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes correr {
  0%   { transform: translateY(0) rotate(-4deg); }
  25%  { transform: translateY(-3px) rotate(3deg); }
  50%  { transform: translateY(0) rotate(-2deg); }
  75%  { transform: translateY(-2px) rotate(4deg); }
  100% { transform: translateY(0) rotate(-4deg); }
}

@keyframes pulsarBadge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 212, 0, 0.55); }
  50% { box-shadow: 0 0 0 6px rgba(255, 212, 0, 0); }
}

@keyframes brilhoFaixa {
  0% { background-position: 0 0; }
  100% { background-position: 40px 0; }
}

@keyframes girarMedalha {
  0%, 100% { transform: rotate(0deg) scale(1); }
  50% { transform: rotate(-8deg) scale(1.15); }
}

/* --- Topo --- */
.topbar {
  background: linear-gradient(120deg, var(--red-800), var(--red-500) 70%, var(--red-600));
  color: #fff;
  border-bottom: 4px solid var(--yellow-500);
  position: relative;
  animation: entrarBaixo 0.4s ease both;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--ink) 0 10px, var(--yellow-500) 10px 20px);
  opacity: 0.9;
}

.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 38px; width: auto; display: block; filter: drop-shadow(0 2px 3px rgba(0,0,0,0.25)); }

.brand-text .titulo {
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.brand-text .subtitulo {
  font-size: 0.75rem;
  color: var(--yellow-100);
  opacity: 0.9;
}

.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.nav-links a {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
  transition: background 0.18s ease, transform 0.18s ease;
}

.nav-links a:hover { background: rgba(255, 255, 255, 0.14); transform: translateY(-1px); }
.nav-links a.ativo { background: var(--yellow-500); color: var(--ink); }

.nav-user { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; color: #ffe9e9; }

.btn-sair {
  padding: 7px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.25);
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}
.btn-sair:hover { background: rgba(0, 0, 0, 0.36); transform: translateY(-1px); }

.container { max-width: 1080px; margin: 0 auto; padding: 28px 20px 60px; }

.page-title { font-size: 1.6rem; font-weight: 800; color: var(--ink); margin: 0 0 4px; letter-spacing: -0.3px; }
.page-subtitle { color: var(--gray-500); margin: 0 0 24px; font-size: 0.95rem; }

.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  border: 1px solid var(--gray-100);
  animation: entrarBaixo 0.45s ease both;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.card:hover { box-shadow: var(--shadow-lg); }

.container > .card:nth-of-type(1) { animation-delay: 0.03s; }
.container > .card:nth-of-type(2) { animation-delay: 0.1s; }
.container > .card:nth-of-type(3) { animation-delay: 0.17s; }
.container > .card:nth-of-type(4) { animation-delay: 0.24s; }
.container > .card:nth-of-type(5) { animation-delay: 0.31s; }

.card-title { font-weight: 800; font-size: 1.05rem; margin: 0 0 14px; color: var(--ink); }

/* --- Barra de progresso "pista de corrida" --- */
.progresso-wrap { display: flex; align-items: center; gap: 14px; }

.pista {
  flex: 1;
  position: relative;
  height: 24px;
  background: var(--gray-100);
  background-image: repeating-linear-gradient(90deg, var(--gray-300) 0 2px, transparent 2px 22px);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--gray-300);
}

.pista-preenchida {
  height: 100%;
  width: 0;
  background: repeating-linear-gradient(
    45deg, var(--red-500) 0 14px, var(--red-600) 14px 28px
  );
  background-size: 40px 40px;
  border-radius: 999px 0 0 999px;
  transition: width 1.3s cubic-bezier(0.22, 0.9, 0.3, 1);
  position: relative;
  animation: brilhoFaixa 1.4s linear infinite;
}

.pista-runner {
  position: absolute;
  right: -10px;
  top: -9px;
  font-size: 1.25rem;
  display: inline-block;
  animation: correr 0.55s ease-in-out infinite;
  filter: drop-shadow(0 2px 2px rgba(0,0,0,0.35));
}

.progresso-numero { font-weight: 800; color: var(--ink); white-space: nowrap; font-size: 1.15rem; }

.pista.pista-mini { height: 14px; }
.pista.pista-mini .pista-runner { font-size: 0.9rem; top: -6px; right: -6px; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin: 16px 0 4px;
}

.stat-box {
  background: linear-gradient(160deg, var(--gray-50), #fff);
  border: 1px solid var(--gray-100);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  transition: transform 0.2s ease;
}
.stat-box:hover { transform: translateY(-2px); }

.stat-box .numero { font-size: 1.7rem; font-weight: 800; color: var(--red-600); }
.stat-box .rotulo { font-size: 0.78rem; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.4px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.92rem;
  border: none;
  cursor: pointer;
  text-align: center;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }

.btn-primario { background: var(--yellow-500); color: var(--ink); box-shadow: 0 4px 0 #b89600; }
.btn-primario:hover { background: var(--yellow-400); transform: translateY(-2px); box-shadow: 0 6px 0 #b89600; }

.btn-secundario { background: var(--red-600); color: #fff; box-shadow: 0 4px 0 var(--red-800); }
.btn-secundario:hover { background: var(--red-500); transform: translateY(-2px); }

.btn-outline { background: #fff; color: var(--ink); border: 1px solid var(--gray-300); }
.btn-outline:hover { background: var(--gray-50); transform: translateY(-1px); }

.btn-perigo { background: #fff; color: var(--red-600); border: 1px solid #f3c6c6; }
.btn-perigo:hover { background: #fef2f2; transform: translateY(-1px); }

.btn-sucesso { background: var(--green-500); color: #fff; box-shadow: 0 4px 0 #0f7a37; }
.btn-sucesso:hover { background: #17b850; transform: translateY(-2px); }

.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 0.8rem; border-radius: 8px; box-shadow: none !important; }

form .campo { margin-bottom: 16px; }
form label { display: block; font-weight: 700; font-size: 0.85rem; color: var(--gray-700); margin-bottom: 6px; }
form input[type="text"],
form input[type="password"],
form input[type="file"],
form select,
form textarea {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--gray-300);
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
form input:focus, form select:focus, form textarea:focus {
  outline: none;
  border-color: var(--red-500);
  box-shadow: 0 0 0 3px rgba(226, 35, 27, 0.14);
}
.erro-lista { color: var(--red-600); font-size: 0.82rem; margin: 4px 0 0; font-weight: 600; }

.badge {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge-pendente { background: var(--yellow-100); color: #8a6d00; animation: pulsarBadge 1.8s ease-in-out infinite; }
.badge-validado { background: #dcfce7; color: #166534; }
.badge-rejeitado { background: #fee2e2; color: #991b1b; }

.tabela { width: 100%; border-collapse: collapse; }
.tabela th, .tabela td { padding: 12px 10px; text-align: left; border-bottom: 1px solid var(--gray-100); font-size: 0.9rem; }
.tabela th { color: var(--gray-500); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.4px; }
.tabela tr { transition: background 0.15s ease; }
.tabela tbody tr:hover { background: var(--gray-50); }
.tabela tr:last-child td { border-bottom: none; }

.posicao { font-weight: 800; color: var(--ink); width: 34px; display: inline-block; font-size: 1.1rem; }
.posicao.top1, .posicao.top2, .posicao.top3 { display: inline-block; animation: girarMedalha 2.4s ease-in-out infinite; }

.mensagens { max-width: 1080px; margin: 16px auto 0; padding: 0 20px; }
.msg { padding: 12px 16px; border-radius: 10px; margin-bottom: 10px; font-size: 0.9rem; font-weight: 700; animation: entrarBaixo 0.3s ease both; }
.msg-success { background: #dcfce7; color: #166534; }
.msg-error { background: #fee2e2; color: #991b1b; }
.msg-warning { background: var(--yellow-100); color: #8a6d00; }
.msg-info { background: #dbeafe; color: #1e40af; }

.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 15% 15%, rgba(255, 212, 0, 0.14), transparent 40%),
    radial-gradient(circle at top, var(--red-700), var(--red-900) 75%);
  padding: 20px;
}

.auth-card {
  background:
    radial-gradient(circle at 20% -10%, rgba(255, 212, 0, 0.22), transparent 45%),
    linear-gradient(165deg, var(--red-500), var(--red-700) 60%, var(--red-800));
  border-radius: 18px;
  padding: 36px 32px;
  max-width: 380px;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: entrarBaixo 0.5s cubic-bezier(0.22, 0.9, 0.3, 1) both;
}

.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo { height: 58px; width: auto; margin: 0 auto 12px; display: block; filter: drop-shadow(0 3px 6px rgba(0,0,0,0.35)); }
.auth-brand .titulo { font-size: 1.3rem; font-weight: 800; color: #fff; text-transform: uppercase; letter-spacing: 0.5px; }
.auth-brand .subtitulo { color: var(--yellow-100); font-size: 0.85rem; opacity: 0.9; }

.auth-card form label { color: rgba(255, 255, 255, 0.92); }
.auth-card form input {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.5);
}
.auth-card form input:focus {
  border-color: var(--yellow-500);
  box-shadow: 0 0 0 3px rgba(255, 212, 0, 0.35);
}
.auth-card .erro-lista { color: var(--yellow-400); }

.auth-links { text-align: center; margin-top: 16px; font-size: 0.85rem; color: rgba(255, 255, 255, 0.8); }
.auth-links a { color: var(--yellow-400); font-weight: 800; }

.foto-preview { max-width: 240px; border-radius: 10px; border: 1px solid var(--gray-100); margin-top: 10px; display: block; }

.vazio { text-align: center; color: var(--gray-500); padding: 30px 10px; font-size: 0.9rem; }

.acoes-linha { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .tabela { display: block; overflow-x: auto; white-space: nowrap; }
}

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