/* Modal resilience | all form modals across Users and Data Collector.
 * Bootstrap scrollable modal expects .modal-body as a direct flex child of
 * .modal-content. Django templates put a real <form> between them, so restore
 * that missing flex/overflow chain without making the whole page scroll.
 */
.portal-body .modal-dialog-scrollable {
  max-height: calc(100% - var(--bs-modal-margin) * 2);
  max-height: calc(100dvh - var(--bs-modal-margin) * 2);
  min-height: 0;
}
.portal-body .modal-dialog-scrollable .modal-content {
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.portal-body .modal-dialog-scrollable .modal-content > form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.portal-body .modal-dialog-scrollable .modal-header,
.portal-body .modal-dialog-scrollable .modal-footer {
  flex: 0 0 auto;
}
.portal-body .modal-dialog-scrollable .modal-content > form > .modal-body,
.portal-body .modal-dialog-scrollable .modal-content > .modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior-y: contain;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #a3b9c6 transparent;
}
.portal-body .modal-dialog-scrollable .modal-content > form > .modal-body :is(input,select,textarea):focus-visible {
  scroll-margin-block: 16px;
}
/* A failed CSRF check is a security stop, not a reason to bypass checks. */
.portal-origin-notice {
  border: 1px solid #d9aa53;
  border-inline-start: 4px solid #af761d;
  border-radius: 12px;
  padding: 16px 19px;
  margin-bottom: 20px;
  background: #fff8e8;
  color: #613e0b;
  box-shadow: 0 3px 14px rgb(73 50 22 / 5%);
}
.portal-origin-notice strong {display: block; font-size: .95rem; margin-bottom: 7px}
.portal-origin-notice p {margin: 0 0 12px; line-height: 1.9}
.portal-origin-notice a {display: inline-flex; padding: 7px 13px; border: 1px solid #b78b39; border-radius: 9px; color: #633b08; font-weight: 750; text-decoration: none; background: white}
.portal-origin-notice a:focus-visible {outline: 3px solid #a16a1b; outline-offset: 3px}
@media(max-width:575.98px) {
  .portal-body .modal-dialog-scrollable {max-height: calc(100dvh - 16px); margin: 8px}
  .portal-body .modal-dialog-scrollable .modal-content > form > .modal-body,
  .portal-body .modal-dialog-scrollable .modal-content > .modal-body {padding-bottom: 24px}
}
