:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --brand: #2563eb;
  --brand-2: #0ea5e9;
  --danger: #b00020;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
}

.form-banner-wrap {
  max-width: 100%;
  margin: 0 auto 16px;
  line-height: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}

.form-banner-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 165px;
  object-fit: contain;
  object-position: center top;
  border-radius: 12px;
}

@media (min-width: 480px) {
  .form-banner-img {
    max-height: 195px;
  }
}

@media (min-width: 768px) {
  .form-banner-img {
    max-height: 230px;
  }
}

.hero {
  color: #0f172a;
  text-align: center;
  margin-bottom: 16px;
  background: #ffffff;
  border-radius: 14px;
  padding: 12px 14px;
  border: 1px solid #e2e8f0;
}

.hero-links {
  margin: 10px 0 0;
  font-size: 0.95rem;
}

.hero-links__a {
  color: var(--brand);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hero-links__a:hover,
.hero-links__a:focus-visible {
  color: #1d4ed8;
  outline: none;
}

.form-consulta h3 {
  margin-top: 0;
}

.consulta-privacy {
  margin-top: 0;
}

.form-back-link {
  margin: 16px 0 0;
  text-align: center;
}

.form-back-link a {
  color: var(--brand);
  font-weight: 600;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.08);
  margin-bottom: 16px;
  border: 1px solid #e2e8f0;
}

.small-card {
  max-width: 440px;
  margin: 40px auto;
}

h1,
h2,
h3,
h4 {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
}

input,
textarea,
select,
button {
  width: 100%;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  padding: 10px;
  font: inherit;
  margin-top: 5px;
}

textarea {
  min-height: 78px;
}

.input-curp {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  letter-spacing: 0.04em;
}

button,
.button-link {
  border: 0;
  background: linear-gradient(90deg, var(--brand), #06b6d4, var(--brand-2));
  color: white;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  padding: 10px 14px;
  border-radius: 10px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.colonia-field {
  position: relative;
  grid-column: 1 / -1;
  max-width: 100%;
}

.colonia-hint {
  display: block;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--muted);
  margin: 4px 0 6px;
}

.colonia-suggest {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 2px;
  max-height: 220px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 4px 0;
}

.colonia-opt {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
  cursor: pointer;
}

.colonia-opt:hover,
.colonia-opt:focus-visible {
  background: #eff6ff;
  outline: none;
}

.colonia-opt__name {
  flex: 1;
  min-width: 0;
  word-wrap: break-word;
}

.colonia-opt__cp {
  flex-shrink: 0;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

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

.stat-card {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.stat-card--highlight {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.stat-card--total {
  background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
  border-color: transparent;
  color: #fff;
}

.stat-card__num {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: inherit;
}

.stat-card__label {
  font-size: 0.8rem;
  font-weight: 600;
  color: inherit;
  opacity: 0.85;
}

.stat-card--total .stat-card__num,
.stat-card--total .stat-card__label {
  color: #fff;
  opacity: 1;
}

.table-muted {
  color: var(--muted);
  font-size: 0.9em;
}

.inline-options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}

.inline-options label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-weight: 500;
}

.inline-options input {
  width: auto;
  margin: 0;
}

.minor-block {
  border: 1px dashed #d1d5db;
  border-radius: 10px;
  padding: 10px;
  margin: 10px 0;
}

.alert {
  color: #fff;
  background: var(--danger);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 12px;
}

.notice {
  margin: 12px 0;
  color: var(--muted);
}

.hidden {
  display: none;
}

/*
  Importante: .modal-overlay usa display:flex más abajo.
  Con la misma especificidad gana la última regla, así que .hidden NO ocultaba el popup.
*/
.modal-overlay.hidden {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

html.modal-open,
body.modal-open {
  overflow: hidden;
  height: 100%;
}

/* El <main> va después del modal en el DOM y puede robar clics; lo desactivamos mientras el modal está activo */
body.modal-open #pageMain {
  pointer-events: none;
  user-select: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2147483000;
  isolation: isolate;
  box-sizing: border-box;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right))
    max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
  background: rgba(15, 23, 42, 0.45);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
}

.modal-dialog {
  flex: 0 0 auto;
  width: 100%;
  max-width: 640px;
  margin: 24px auto;
  text-align: left;
}

.modal-popup {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 640px;
  max-height: min(88vh, calc(100vh - 48px));
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 16px;
  padding: 22px;
  padding-top: 52px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
  border: 1px solid #e2e8f0;
  pointer-events: auto;
}

button.modal-close-x {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 20;
  width: 44px;
  max-width: 44px;
  height: 44px;
  padding: 0;
  margin: 0;
  border: none;
  border-radius: 999px;
  background: #f1f5f9;
  color: #334155;
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

button.modal-close-x:hover {
  background: #e2e8f0;
}

.modal-primary-btn {
  min-height: 48px;
}

.modal-terms-block {
  margin-top: 16px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.modal-terms-heading {
  margin: 0 0 10px;
  font-size: 1rem;
}

.modal-terms-list {
  margin: 0;
  padding-left: 1.15rem;
}

.modal-terms-note {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: #64748b;
}

.modal-shows-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.modal-popup .modal-shows-title {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

.modal-popup .shows-grid h4 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.modal-popup .shows-grid ul {
  margin: 0;
  padding-left: 1.15rem;
}

.modal-poster {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  object-position: center;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  margin: 8px 0 10px;
}

.form-locked {
  filter: blur(2px);
  pointer-events: none;
  user-select: none;
}

.shows-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  padding: 8px;
  font-size: 14px;
}

/* ——— Boleto (página dedicada) ——— */
.page-boleto {
  margin: 0;
  min-height: 100vh;
  font-family: Outfit, system-ui, sans-serif;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(236, 72, 153, 0.35) 0, transparent 55%),
    radial-gradient(ellipse 80% 50% at 100% 50%, rgba(250, 204, 21, 0.2) 0, transparent 45%),
    linear-gradient(165deg, #fdf2f8 0%, #f8fafc 40%, #ecfeff 100%);
  color: #0f172a;
}

.boleto-wrap {
  max-width: 440px;
  margin: 0 auto;
  padding: 28px 16px 40px;
}

.boleto-card {
  position: relative;
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 24px 48px rgba(190, 24, 93, 0.15);
  border: 1px solid rgba(244, 114, 182, 0.35);
}

.boleto-card__stripe {
  height: 8px;
  background: repeating-linear-gradient(
    -45deg,
    #db2777,
    #db2777 10px,
    #fbbf24 10px,
    #fbbf24 20px,
    #0ea5e9 20px,
    #0ea5e9 30px
  );
}

.boleto-card__header {
  text-align: center;
  padding: 22px 20px 12px;
  background: linear-gradient(180deg, rgba(253, 242, 248, 0.9) 0%, #fff 100%);
}

.boleto-card__kicker {
  margin: 0 0 4px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #be185d;
}

.boleto-card__title {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.15;
  color: #831843;
  letter-spacing: -0.02em;
}

.boleto-card__year {
  margin: 6px 0 0;
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #db2777, #f59e0b);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.boleto-card__meta {
  margin: 12px 0 0;
  font-size: 0.85rem;
  color: #64748b;
}

.boleto-card__perforation {
  display: flex;
  justify-content: space-between;
  padding: 0 12px;
  margin: 4px 0;
}

.boleto-card__perforation span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e2e8f0;
}

.boleto-card__body {
  padding: 8px 20px 20px;
}

.boleto-folio {
  text-align: center;
  padding: 14px 12px;
  margin-bottom: 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #fdf4ff 0%, #fff1f2 100%);
  border: 2px dashed rgba(219, 39, 119, 0.45);
}

.boleto-folio__label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #9d174d;
  margin-bottom: 6px;
}

.boleto-folio__value {
  font-family: ui-monospace, 'Cascadia Code', monospace;
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
  word-break: break-all;
}

.boleto-dl {
  margin: 0 0 18px;
}

.boleto-dl__row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}

.boleto-dl__row:last-of-type {
  border-bottom: 0;
}

.boleto-dl dt {
  margin: 0;
  font-weight: 600;
  color: #64748b;
}

.boleto-dl dd {
  margin: 0;
  font-weight: 600;
  color: #0f172a;
  text-align: right;
}

.boleto-minors {
  margin-bottom: 18px;
  padding: 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.boleto-minors__title {
  margin: 0 0 10px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #475569;
}

.boleto-minors__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.boleto-minors__list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid #e2e8f0;
  font-size: 0.95rem;
}

.boleto-minors__list li:last-child {
  border-bottom: 0;
}

.boleto-minors__name {
  font-weight: 600;
}

.boleto-minors__age {
  font-size: 0.85rem;
  color: #64748b;
  white-space: nowrap;
}

.boleto-qr {
  text-align: center;
  margin-top: 8px;
}

.boleto-qr__label {
  margin: 0 0 8px;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #0e7490;
}

.boleto-qr__frame {
  display: inline-block;
  padding: 12px;
  border-radius: 16px;
  background: #fff;
  border: 2px solid #a5f3fc;
  box-shadow: 0 8px 24px rgba(14, 116, 144, 0.12);
}

.boleto-qr__frame img {
  display: block;
  width: 180px;
  height: 180px;
}

.boleto-qr__hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  color: #64748b;
}

.boleto-card__footer {
  padding: 14px 20px 18px;
  text-align: center;
  font-size: 0.75rem;
  color: #94a3b8;
  background: #fafafa;
  border-top: 1px solid #f1f5f9;
}

.boleto-card__footer p {
  margin: 0;
}

.boleto-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 22px;
}

.boleto-btn {
  display: block;
  width: 100%;
  padding: 14px 18px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.boleto-btn--primary {
  color: #fff;
  background: linear-gradient(135deg, #db2777 0%, #e11d48 50%, #f59e0b 100%);
  box-shadow: 0 8px 24px rgba(219, 39, 119, 0.35);
}

.boleto-btn--primary:hover {
  transform: translateY(-1px);
}

.boleto-btn--ghost {
  color: #831843;
  background: #fff;
  border: 2px solid rgba(219, 39, 119, 0.35);
}

@media print {
  body.page-boleto {
    background: #fff;
    min-height: auto;
  }

  .boleto-actions {
    display: none !important;
  }

  .boleto-wrap {
    padding: 0;
    max-width: none;
  }

  .boleto-card {
    box-shadow: none;
    border: 1px solid #e2e8f0;
  }
}
