/* v13: numbered compact cards for Tus datos + Estudios */

#paso-formulario .matricula-sec-head__lead {
  font-size: 0.8rem !important;
  color: #64748b;
  margin: 0 0 0.55rem !important;
  max-width: 36rem;
}

/* Numbered compact card headers */
#paso-formulario .matricula-card-v13.matricula-block {
  padding: 0 !important;
  margin-bottom: 0.55rem !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 10px !important;
  background: #fff;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  overflow: hidden;
}
#paso-formulario .matricula-card-v13 .matricula-block__head {
  display: flex;
  align-items: center;
  gap: 0.5rem !important;
  padding: 0.38rem 0.7rem !important;
  margin: 0 !important;
  background: #f1f5f9 !important;
  border-bottom: 1px solid #e2e8f0 !important;
  min-height: 0;
}
#paso-formulario .matricula-card-num {
  flex: 0 0 1.25rem;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #0047ab;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
#paso-formulario .matricula-card-v13 .matricula-block__head-text h3 {
  margin: 0 !important;
  font-size: 0.82rem !important;
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
}
#paso-formulario .matricula-card-desc,
#paso-formulario #matricula-block1-desc {
  display: none !important;
}
#paso-formulario .matricula-card-v13 .matricula-block__body,
#paso-formulario .matricula-card-v13 .matricula-block__body--tight {
  padding: 0.65rem 0.7rem 0.7rem !important;
}

/* Labels + required star */
#paso-formulario .matricula-form-v13 .form-group > label,
#paso-formulario .matricula-form-v13 label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #334155;
  margin-bottom: 0.18rem !important;
}
#paso-formulario .req {
  color: #94a3b8;
  font-weight: 700;
  margin-left: 0.05rem;
}
#paso-formulario .form-group input[type=text],
#paso-formulario .form-group input[type=email],
#paso-formulario .form-group input[type=tel],
#paso-formulario .form-group input[type=number],
#paso-formulario .form-group input[type=date],
#paso-formulario .form-group select,
#paso-formulario .matricula-form-v13 input[type=text],
#paso-formulario .matricula-form-v13 input[type=email],
#paso-formulario .matricula-form-v13 input[type=tel],
#paso-formulario .matricula-form-v13 input[type=number],
#paso-formulario .matricula-form-v13 input[type=date],
#paso-formulario .matricula-form-v13 select {
  height: 40px !important;
  min-height: 40px !important;
  font-size: 15px !important;
  padding: 0 0.65rem !important;
  border-radius: 8px !important;
}

/* Hide leftover helpers; keep only tiny useful ones and errors */
#paso-formulario .form-hint-dinamica:not(.matricula-hint-tiny):not(#edad-marzo-hint):not(#matricula-grado-hint):not(#periodo-grupo-hint) {
  display: none !important;
}
#paso-formulario .matricula-hint-tiny,
#paso-formulario #edad-marzo-hint,
#paso-formulario #matricula-grado-hint {
  display: block;
  font-size: 0.65rem !important;
  line-height: 1.25 !important;
  color: #94a3b8 !important;
  margin: 0.15rem 0 0 !important;
  font-weight: 500;
}
#paso-formulario #periodo-grupo-hint { display: none !important; }
#paso-formulario .matricula-doc-switch__lead,
#paso-formulario .matricula-doc-switch__hint,
#paso-formulario .matricula-doc-box__head,
#paso-formulario .matricula-ext-hint { display: none !important; }

/* Inline errors: short, red, under the field */
#paso-formulario .matricula-field-msg.is-err,
#paso-formulario .matricula-field-err {
  display: block;
  margin: 0.15rem 0 0;
  font-size: 0.68rem !important;
  font-weight: 700;
  color: #b91c1c !important;
  line-height: 1.25;
}
#paso-formulario .matricula-field-msg.is-hint,
#paso-formulario .matricula-field-msg.is-ok,
#paso-formulario #dni-field-msg.is-ok,
#paso-formulario #dni-field-msg.is-hint { display: none !important; }
#paso-formulario .matricula-field-msg:empty { display: none !important; }

/* Document pills stay compact (v12), DNI + Autocompletar one row */
#paso-formulario .matricula-doc-box--plain {
  margin: 0.45rem 0 0 !important;
  padding: 0 !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
#paso-formulario .matricula-dni-row {
  display: flex;
  align-items: stretch;
  gap: 0.4rem;
}
#paso-formulario .matricula-dni-row .matricula-input-shell {
  flex: 1 1 auto;
  min-width: 0;
  position: relative;
}
#paso-formulario .matricula-dni-row .matricula-reniec-btn,
#paso-formulario .matricula-dni-group__btn {
  flex: 0 0 auto;
  height: 40px !important;
  min-height: 40px !important;
  padding: 0 0.8rem !important;
  border-radius: 8px !important;
  font-size: 0.78rem !important;
  font-weight: 700;
  white-space: nowrap;
}
#paso-formulario .matricula-input-counter {
  font-size: 0.62rem;
}

/* Celular: prefix + number + WhatsApp checkbox inline */
#paso-formulario .matricula-celular-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.75rem;
}
#paso-formulario .matricula-celular-row .matricula-phone-row {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  flex: 1 1 16rem;
  min-width: 0;
}
#paso-formulario .matricula-phone-row select {
  width: 118px;
  flex: 0 0 118px;
  max-width: 118px;
  height: 40px !important;
  min-height: 40px !important;
  font-size: 14px !important;
}
#paso-formulario .matricula-phone-row input {
  flex: 1 1 auto;
  min-width: 0;
}
#paso-formulario .matricula-same-phone {
  display: inline-flex !important;
  align-items: center;
  gap: 0.35rem;
  margin: 0 !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  color: #475569;
  white-space: nowrap;
  cursor: pointer;
}
#paso-formulario .matricula-same-phone input {
  width: 1rem;
  height: 1rem;
  min-height: 0 !important;
  margin: 0;
  accent-color: #0047ab;
}

/* Pills for grado / último grado */
#paso-formulario .matricula-pills,
#paso-formulario .matricula-grupo-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin: 0 0 0.15rem;
}
#paso-formulario .matricula-pills-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  width: 100%;
  margin-bottom: 0.25rem;
}
#paso-formulario .matricula-pills-legend {
  flex: 0 0 4.6rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #64748b;
}
#paso-formulario .matricula-pill,
#paso-formulario .matricula-grupo-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0.25rem 0.7rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 999px;
  background: #fff;
  color: #0f172a;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  line-height: 1.1;
  box-shadow: none;
}
#paso-formulario .matricula-grupo-chip {
  flex-direction: column;
  align-items: flex-start;
  border-radius: 10px;
  min-height: 40px;
  padding: 0.3rem 0.65rem;
}
#paso-formulario .matricula-grupo-chip__kicker { font-size: 0.58rem; }
#paso-formulario .matricula-grupo-chip__title { font-size: 0.75rem; }
#paso-formulario .matricula-pill:hover,
#paso-formulario .matricula-grupo-chip:hover {
  border-color: #0047ab;
  color: #0047ab;
}
#paso-formulario .matricula-pill.is-active,
#paso-formulario .matricula-grupo-chip.is-active {
  background: #0047ab;
  border-color: #0047ab;
  color: #fff;
}
#paso-formulario .matricula-pill.is-active,
#paso-formulario .matricula-grupo-chip.is-active .matricula-grupo-chip__kicker,
#paso-formulario .matricula-grupo-chip.is-active .matricula-grupo-chip__title {
  color: #fff;
}

/* Hide native selects that are synced to pills, keep them accessible/submittable */
#paso-formulario .matricula-select-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 0 !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  opacity: 0 !important;
}

/* Field grids already 3/2/1 from v12; tighten gaps */
#paso-formulario .matricula-field-grid {
  gap: 0.45rem 0.65rem !important;
  margin-bottom: 0.4rem !important;
}

/* Confirm step: compact docs */
#paso-formulario #matricula-docs-opt {
  margin-top: 0.6rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
}
#paso-formulario #matricula-docs-opt h3 {
  font-size: 0.82rem !important;
  margin: 0 0 0.2rem !important;
}
#paso-formulario .matricula-docs-opt__lead {
  font-size: 0.7rem !important;
  margin: 0 0 0.45rem !important;
  color: #64748b;
}
#paso-formulario .matricula-docs-grid {
  gap: 0.5rem !important;
}
#paso-formulario .matricula-doc-card {
  padding: 0.5rem 0.6rem !important;
  border-radius: 8px !important;
}
#paso-formulario .matricula-doc-card label { font-size: 13px !important; font-weight: 600; }
#paso-formulario .matricula-doc-card small { font-size: 0.65rem !important; color: #94a3b8; }
#paso-formulario #matricula-resumen h3 { font-size: 0.82rem !important; }

/* Age alert compact */
#paso-formulario .matricula-edad-alerta {
  margin-top: 0.4rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.75rem;
}

@media (max-width: 639px) {
  #paso-formulario .matricula-dni-row { flex-wrap: wrap; }
  #paso-formulario .matricula-dni-row .matricula-reniec-btn { width: 100%; }
  #paso-formulario .matricula-same-phone { white-space: normal; }
  #paso-formulario .matricula-pills-legend { flex-basis: 100%; margin-bottom: 0.1rem; }
  #paso-formulario .matricula-phone-row select {
    width: 102px;
    flex-basis: 102px;
    max-width: 102px;
  }
}

/* ===== v13b: close blank gaps, fill rows, collapse empty/hidden ===== */

/* Uniform 14px section / card gap; drop stacked card margins */
#paso-formulario .matricula-form-main {
  gap: 14px !important;
}
#paso-formulario .matricula-card-v13.matricula-block {
  margin-bottom: 0 !important;
}
#paso-formulario .matricula-field-grid {
  margin-bottom: 14px !important;
}
#paso-formulario .matricula-field-grid:last-child,
#paso-formulario .form-group:last-child {
  margin-bottom: 0 !important;
}
#paso-formulario .form-group {
  margin-bottom: 0 !important;
}
#paso-formulario .matricula-ultimo-grado-group {
  margin-top: 14px !important;
}

/* Consistent card body padding 12–14px */
#paso-formulario .matricula-card-v13 .matricula-block__body,
#paso-formulario .matricula-card-v13 .matricula-block__body--tight {
  padding: 12px 14px !important;
}
#paso-formulario .matricula-card-v13 .matricula-block__head {
  padding: 10px 14px !important;
}

/* Shrink oversized white shell + section air around the form */
#paso-formulario.formulario-matricula-dinamica,
.matricula-page #paso-formulario.formulario-matricula-dinamica {
  padding-top: 1rem !important;
  padding-bottom: 1.15rem !important;
}
#paso-formulario .form-matricula-organizada.form-dinamica,
#paso-formulario form.form-matricula-organizada {
  padding: 0.85rem 0.9rem !important;
}
@media (min-width: 768px) {
  #paso-formulario .form-matricula-organizada.form-dinamica,
  #paso-formulario form.form-matricula-organizada {
    padding: 1rem 1.15rem !important;
  }
}

/* Use more of the desktop width; keep fields from stretching into empty right space */
@media (min-width: 900px) {
  .matricula-page .form-container-dinamica,
  .matricula-page .container-planes-tight,
  #paso-formulario .form-container-dinamica {
    max-width: 1040px !important;
  }
}

/* DNI + Autocompletar: compact left-aligned row, not a stretched empty bar.
   Keep a min-width so the input cannot collapse next to Autocompletar on tablet. */
@media (min-width: 640px) {
  #paso-formulario .matricula-dni-row {
    justify-content: flex-start;
    width: 100%;
    max-width: 32rem;
  }
  #paso-formulario .matricula-dni-row .matricula-input-shell {
    flex: 1 1 220px !important;
    width: auto !important;
    min-width: 180px !important;
    max-width: 280px;
  }
  #paso-formulario .matricula-dni-row .matricula-reniec-btn,
  #paso-formulario .matricula-dni-row .matricula-dni-group__btn {
    flex: 0 0 auto !important;
    width: auto !important;
    max-width: none !important;
  }
}
@media (min-width: 900px) {
  #paso-formulario .matricula-dni-row .matricula-input-shell {
    flex: 0 0 260px !important;
    width: 260px !important;
    max-width: 280px;
  }
}

/* Fill incomplete grid rows (tablet 2-col of a 3-col grid, leftover last item) */
@media (min-width: 640px) {
  #paso-formulario .matricula-field-grid--3 > .form-group:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}
@media (min-width: 900px) {
  #paso-formulario .matricula-field-grid--3 > .form-group:last-child:nth-child(odd) {
    grid-column: auto;
  }
  /* 3-col with exactly 2 items still fills the row */
  #paso-formulario .matricula-field-grid--3 > .form-group:last-child:nth-child(2) {
    grid-column: 2 / -1;
  }
}

/* Contacto: celular | correo; WhatsApp (when shown) full width under them */
#paso-formulario .matricula-contact-grid {
  align-items: start;
}
#paso-formulario .matricula-contact-grid #wrap-whatsapp-estudiante {
  grid-column: 1 / -1;
}

/* Edad hint sits under the 3-col row, not inside the Edad cell */
#paso-formulario #edad-marzo-hint {
  display: block;
  margin: 6px 0 0 !important;
}

/* Collapse empty / hidden helpers, alerts, and nationality blocks so they take no space */
#paso-formulario [hidden],
#paso-formulario .is-hidden,
#paso-formulario #reniec-status:empty,
#paso-formulario #reniec-status[hidden],
#paso-formulario .matricula-field-msg:empty,
#paso-formulario .matricula-field-msg[hidden],
#paso-formulario .matricula-field-err:empty,
#paso-formulario .form-hint-dinamica:empty,
#paso-formulario .form-hint-dinamica[hidden],
#paso-formulario #wrap-whatsapp-estudiante[hidden],
#paso-formulario #wrap-whatsapp-estudiante.is-hidden,
#paso-formulario #wrap-doc-extranjero[hidden],
#paso-formulario #aviso-extranjero-matricula[hidden],
#paso-formulario #matricula-alerta-edad[hidden],
#paso-formulario #matricula-ya-inscrito[hidden],
#paso-formulario #matricula-ubigeo-colegio[hidden] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  border: 0 !important;
  height: auto !important;
}
#paso-formulario #wrap-doc-extranjero[style*="display:none"],
#paso-formulario #wrap-doc-extranjero[style*="display: none"],
#paso-formulario #wrap-doc-peruano[style*="display:none"],
#paso-formulario #wrap-doc-peruano[style*="display: none"],
#paso-formulario #aviso-extranjero-matricula[style*="display:none"],
#paso-formulario #aviso-extranjero-matricula[style*="display: none"],
#paso-formulario #bloque-apoderado[style*="display:none"],
#paso-formulario #bloque-apoderado[style*="display: none"] {
  display: none !important;
  margin: 0 !important;
  padding: 0 !important;
  min-height: 0 !important;
  border: 0 !important;
}

/* Don't let hidden-but-styled alerts keep a reserved box */
#paso-formulario .matricula-reniec-alert:not(.is-visible):empty,
#paso-formulario .matricula-edad-alerta:not(.is-visible)[hidden],
#paso-formulario .matricula-ya-inscrito:not(.is-visible)[hidden] {
  display: none !important;
}

/* In-card nav: tighter, less fake gap before the next page section */
#paso-formulario .matricula-step-nav {
  margin-top: 14px !important;
  padding-top: 12px !important;
}

/* Confirm step: same shell, slightly tighter docs / resumen / legal */
#paso-formulario #matricula-docs-opt,
#paso-formulario #matricula-resumen {
  margin-top: 14px !important;
  margin-bottom: 0 !important;
  padding: 12px 14px !important;
}
#paso-formulario .matricula-form-legal {
  margin-top: 14px !important;
  margin-bottom: 0 !important;
  padding: 0 !important;
}
#paso-formulario .matricula-form-actions {
  margin-top: 14px !important;
  gap: 0.5rem !important;
}

/* Plan step: less section padding, tighter header + grid */
.matricula-page #paso-planes.matricula-sec-planes,
.matricula-page .matricula-sec-planes.planes-dinamica--compact {
  padding: 1rem 0 1.15rem !important;
}
.matricula-page #paso-planes .matricula-sec-head.section-header-dinamica,
.matricula-page #paso-planes .matricula-sec-head {
  margin-bottom: 14px !important;
}
.matricula-page #paso-planes .planes-grid--v2,
.matricula-page #paso-planes .planes-grid {
  gap: 14px !important;
  margin-top: 14px !important;
}
.matricula-page #paso-planes .matricula-planes-footer {
  margin-top: 14px !important;
  padding-top: 12px !important;
}

/* Pale band after the form (garantías + CTA) was reading as a huge blank */
.matricula-page .matricula-garantias {
  padding: 1rem 0 1.15rem !important;
}
.matricula-page .matricula-hub-cta {
  padding: 1.15rem 0 !important;
}

/* Sticky nav: page padding should match the bar, not leave a large empty strip */
@media (max-width: 767px) {
  body.matricula-wizard-active {
    padding-bottom: 3.75rem !important;
  }
  body.matricula-wizard-active .matricula-page,
  .matricula-page {
    padding-bottom: 3.75rem !important;
  }
}
