:root {
  --bg: #14121a;
  --bg-card: #1f1c29;
  --bg-input: #211d2c;
  --border: #3a3448;
  --accent: #e8a355;
  --text: #f2ede4;
  --text-muted: #a9a2b8;
  --error: #e0645a;
  --success: #7fc98f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: 24px;
}

.card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  margin: auto;
  text-align: center;
}

.card.wide {
  max-width: 880px;
  text-align: left;
}

h1 {
  font-size: 1.6rem;
  margin-bottom: 8px;
}

p.subtitle {
  color: var(--text-muted);
  margin-bottom: 24px;
}

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: left;
}

label {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%23a9a2b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 11px 7px;
  padding-right: 36px;
  cursor: pointer;
}

select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button {
  margin-top: 8px;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: var(--accent);
  color: #1a1620;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.botao-principal {
  display: inline-block;
  margin-top: 8px;
  padding: 14px 20px;
  border-radius: 8px;
  background: var(--accent);
  color: #1a1620;
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  text-align: center;
}

/* Página inicial — fundo branco, cara da banda (as demais telas ficam no tema escuro) */
body.pagina-inicial {
  background: #ffffff;
  color: #14121a;
}

body.pagina-inicial .card {
  background: #ffffff;
}

.logo-banda {
  width: 220px;
  max-width: 65vw;
  margin-bottom: 8px;
}

.link-equipe {
  margin-top: 28px;
  font-size: 0.85rem;
}

.link-equipe a {
  color: #8a8378;
}

button.secundario {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.erro {
  color: var(--error);
  font-size: 0.9rem;
  min-height: 1.2em;
}

.oculto {
  display: none !important;
}

/* Seletor de músicas (checkboxes agrupados) */
.musicas-cabecalho {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.contador-musicas {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.contador-musicas.cheio {
  color: var(--accent);
}

.grupo-musicas {
  border: none;
  margin: 0 0 14px;
  padding: 0;
}

.grupo-musicas legend {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0 0 6px;
}

.opcao-musica {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
}

.opcao-musica:hover {
  background: var(--bg-input);
}

.opcao-musica input {
  width: auto;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.opcao-musica input:disabled {
  opacity: 0.4;
}

.opcao-musica:has(input:disabled) span {
  opacity: 0.4;
}

/* Carteirinha do fã */
#qrcode {
  display: inline-block;
  padding: 16px;
  background: #fff;
  border-radius: 12px;
  margin: 16px 0;
}

.fan-code {
  font-family: "Courier New", monospace;
  font-size: 1.1rem;
  letter-spacing: 1px;
  color: var(--accent);
}

.tag-lista {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 12px 0;
}

.tag {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
}

.compartilhar {
  margin-top: 16px;
  padding: 12px;
  background: var(--bg-input);
  border-radius: 8px;
  font-size: 0.85rem;
  word-break: break-all;
}

/* Scanner */
#leitor {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
}

.resultado-scan {
  margin-top: 16px;
  padding: 16px;
  border-radius: 10px;
  font-weight: 600;
}

.resultado-scan.sucesso {
  background: rgba(127, 201, 143, 0.15);
  color: var(--success);
}

.resultado-scan.duplicado {
  background: rgba(232, 163, 85, 0.15);
  color: var(--accent);
}

.resultado-scan.erro {
  background: rgba(224, 100, 90, 0.15);
  color: var(--error);
}

.manual-fallback {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.manual-fallback form {
  flex-direction: row;
  gap: 8px;
}

.manual-fallback input {
  flex: 1;
}

.manual-fallback button {
  margin-top: 0;
  white-space: nowrap;
}

/* Toggle switch (ex: VIP) */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.toggle-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 2px;
  top: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--accent);
  border-color: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(18px);
  background: #1a1620;
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Admin */
.admin-topo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.admin-topo .quem {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.nav-admin {
  font-size: 0.9rem;
}

.nav-admin a {
  color: var(--text);
  text-decoration: none;
}

.nav-admin a:hover {
  text-decoration: underline;
}

.nav-admin a.ativo {
  color: var(--error);
  font-weight: 600;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-tile {
  background: var(--bg-input);
  border-radius: 12px;
  padding: 18px;
}

.stat-tile .valor {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-tile .rotulo {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.stat-tile-link {
  text-decoration: none;
  color: inherit;
  display: block;
  max-width: 220px;
}

.stat-tile-link .stat-tile {
  cursor: pointer;
  transition: background 0.15s, transform 0.15s;
}

.stat-tile-link:hover .stat-tile {
  background: #2a2438;
  transform: translateY(-1px);
}

.filtros {
  display: flex;
  gap: 24px;
  align-items: flex-end;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.filtros select {
  width: auto;
  min-width: 220px;
}

.filtro-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-direction: row;
  margin-bottom: 2px;
}

.input-com-botao {
  display: flex;
  gap: 8px;
}

.input-com-botao input {
  flex: 1;
}

.input-com-botao button {
  margin-top: 0;
  white-space: nowrap;
}

.radio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}

.radio-group label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0;
  cursor: pointer;
}

.radio-group input {
  width: auto;
}

.checklist-fas {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 14px;
}

.checklist-fas label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  color: var(--text);
  font-size: 0.9rem;
  margin-bottom: 0;
  cursor: pointer;
}

.checklist-fas label:hover {
  background: var(--bg-input);
  border-radius: 6px;
}

.checklist-fas input {
  width: auto;
}

.checklist-fas .cidade {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.resumo-envio {
  margin-bottom: 14px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.resumo-envio strong {
  color: var(--accent);
}

.painel {
  margin-bottom: 28px;
}

.painel h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.flash {
  position: fixed;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  z-index: 999;
}

.flash.ativo {
  animation: flash-anim 0.4s ease-out;
}

@keyframes flash-anim {
  0% { opacity: 0; }
  15% { opacity: 1; }
  100% { opacity: 0; }
}
