*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #1a56db;
  --primary-dark: #1341b5;
  --success: #057a55;
  --success-bg: #def7ec;
  --success-border: #84e1bc;
  --error: #c81e1e;
  --error-bg: #fde8e8;
  --error-border: #f98080;
  --text: #111827;
  --muted: #6b7280;
  --border: #d1d5db;
  --bg: #f3f4f6;
  --white: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  padding: 1rem 1rem 3rem;
}

.container {
  max-width: 460px;
  margin: 0 auto;
}

/* ── Header ── */
.header {
  text-align: center;
  padding: 1.5rem 0 1.25rem;
}

h1 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text);
}

.grupo-badge {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .3rem 1rem;
  border-radius: 999px;
  margin-top: .5rem;
}

/* ── Card / Form ── */
form {
  background: var(--white);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.form-group { margin-bottom: 1rem; }
.form-group:last-of-type { margin-bottom: 0; }

label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .35rem;
}

input[type="text"],
input[type="tel"],
select {
  width: 100%;
  padding: .65rem .8rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 1rem;
  color: var(--text);
  background: var(--white);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .15s, box-shadow .15s;
}

input[type="text"]:focus,
input[type="tel"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

input.invalid { border-color: var(--error); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.25rem;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0 1rem;
}

/* ── Checkbox ── */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  line-height: 1.4;
}

.checkbox-label input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: .1rem;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ── Visitor section ── */
.visita-section {
  background: #eff6ff;
  border: 1.5px solid #bfdbfe;
  border-radius: 8px;
  padding: 1rem;
  margin-top: .75rem;
}

.visita-titulo {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--primary);
  margin-bottom: .75rem;
}

/* ── Submit ── */
#submit-btn {
  width: 100%;
  padding: .8rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-top: 1.25rem;
  transition: background .15s, opacity .15s;
}

#submit-btn:hover:not(:disabled) { background: var(--primary-dark); }
#submit-btn:disabled { opacity: .6; cursor: not-allowed; }

/* ── Form error ── */
.form-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1.5px solid var(--error-border);
  border-radius: 8px;
  padding: .75rem 1rem;
  font-size: .875rem;
  margin-top: 1rem;
}

/* ── Success screen ── */
.success-screen {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  box-shadow: var(--shadow);
  text-align: center;
  margin-top: 1rem;
}

.success-icon {
  width: 64px;
  height: 64px;
  background: var(--success);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 700;
  margin: 0 auto 1rem;
}

.success-screen h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--success);
  margin-bottom: .4rem;
}

.success-screen > p {
  color: var(--muted);
  font-size: .95rem;
  margin-bottom: 1.5rem;
}

.codigo-card {
  background: var(--success-bg);
  border: 2px solid var(--success-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.codigo-label {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--success);
  margin-bottom: .4rem;
}

.codigo-value {
  font-size: 2.2rem;
  font-weight: 900;
  letter-spacing: .2em;
  color: var(--success);
  font-family: 'Courier New', 'Lucida Console', monospace;
  margin-bottom: .75rem;
}

.copy-btn {
  background: var(--success);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: .4rem 1.1rem;
  font-size: .875rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s;
}

.copy-btn:hover { opacity: .85; }

.registro-info {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.8;
  margin-top: .5rem;
}

/* ── Error screen (invalid QR) ── */
.error-screen {
  text-align: center;
  padding: 4rem 1rem;
}

.error-icon {
  font-size: 3.5rem;
  color: var(--error);
  margin-bottom: 1rem;
}

.error-screen h2 { font-size: 1.3rem; margin-bottom: .5rem; }
.error-screen p { color: var(--muted); font-size: .95rem; }

.hidden { display: none !important; }
