/* Formularios en el móvil: apellidos lado a lado, acciones fijas abajo, secciones plegables y ventanas de alta/edición a pantalla completa
   (cabecera y botones siempre a la vista, solo se desplaza el cuerpo). En pantallas grandes no cambia nada. */

/* Sección plegable (p. ej. «Cambiar contraseña»): la cabecera es el <summary> */
details.form-plegable > summary { list-style: none; cursor: pointer; }
details.form-plegable > summary::-webkit-details-marker { display: none; }
details.form-plegable > summary .form-pleg-flecha { margin-left: auto; color: var(--dsg-muted); transition: transform .2s; }
details.form-plegable[open] > summary .form-pleg-flecha { transform: rotate(180deg); }
details.form-plegable > summary:focus-visible { outline: 2px solid var(--dsg-orange); outline-offset: -2px; }
details.form-plegable .form-pleg-resumen { display: block; font-size: .8rem; font-weight: 400; color: var(--dsg-muted); }

@media (max-width: 767.98px) {
  /* ── Editar usuario ── */
  details.form-plegable > summary { min-height: 52px; }
  .field-row.par { grid-template-columns: 1fr 1fr !important; gap: .75rem !important; }
  .edit-wrapper button[onclick="añadirAcompanante()"] { min-height: 44px; }
  .edit-wrapper .form-actions {
    position: sticky; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 1.7fr; gap: .6rem; margin: .5rem -.85rem 0;
    padding: .7rem .85rem calc(.7rem + env(safe-area-inset-bottom, 0px)); background: var(--dsg-bg); border-top: 1px solid var(--dsg-border); box-shadow: 0 -6px 16px rgba(0, 0, 0, .25);
  }
  /* El botón flotante de incidencias y el de subir se apoyan encima de la barra de acciones fija (si no, tapaban «Guardar cambios») */
  body:has(.edit-wrapper .form-actions) #btn-incidencia, body:has(.edit-wrapper .form-actions) #btn-subir { bottom: calc(var(--nav-movil, 64px) + env(safe-area-inset-bottom, 0px) + 82px); }
  body.con-nav-movil .edit-wrapper .form-actions { bottom: calc(var(--nav-movil, 64px) + env(safe-area-inset-bottom, 0px)); padding-bottom: .7rem; }
  .edit-wrapper .form-actions .btn-save, .edit-wrapper .form-actions .btn-cancel { min-height: 48px; justify-content: center; font-size: .95rem; }
}

@media (max-width: 359.98px) {
  .field-row.par { grid-template-columns: 1fr !important; }
}

/* ── Ventanas de alta/edición: hoja a pantalla completa ── */
@media (max-width: 575.98px) {
  .modal-hoja .modal-dialog { margin: 0; max-width: none; width: 100%; height: 100%; }
  .modal-hoja .modal-content { height: 100%; border-radius: 0 !important; border: 0 !important; }
  .modal-hoja .modal-content > form { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; margin: 0; }
  .modal-hoja .modal-header { flex: 0 0 auto; padding: calc(.75rem + env(safe-area-inset-top, 0px)) 1rem .75rem !important; }
  .modal-hoja .modal-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
  .modal-hoja .btn-close { width: 44px; height: 44px; padding: 0; margin: 0 -.5rem 0 auto; background-size: 1em; flex: 0 0 auto; }
  .modal-hoja .modal-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 1rem !important; }
  .modal-hoja .modal-footer {
    flex: 0 0 auto; flex-wrap: nowrap; gap: .6rem; padding: .7rem 1rem calc(.7rem + env(safe-area-inset-bottom, 0px)) !important; box-shadow: 0 -6px 16px rgba(0, 0, 0, .25);
  }
  .modal-hoja .modal-footer > * { flex: 1 1 0; margin: 0 !important; min-height: 48px !important; justify-content: center; }
  .modal-hoja .modal-footer > [type="submit"] { flex: 1.7 1 0; }
}
