/* OrdenGO modal-frame, adapted to native dialog and GIRA's design tokens.
   This is the shared sizing contract; module styles must not size the inner form
   independently of the frame. Only the body scrolls, never the action footer. */
dialog.modal-frame:not(#searchDialog) {
  --modal-height: min(88dvh, 820px);
  --modal-padding: 24px;
  max-height: var(--modal-height);
  overflow: hidden;
}
dialog.modal-frame:not(#searchDialog)[open] {
  display: flex;
  flex-direction: column;
}
dialog.modal-frame:not(#searchDialog) form.modal-form,
dialog.modal-frame:not(#searchDialog) .modal-form-host > form.modal-form,
dialog.modal-frame:not(#searchDialog) .modal-form-host {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  max-height: none;
  width: 100%;
  padding: 0;
  overflow: hidden;
}
dialog.modal-frame:not(#searchDialog) .modal-body {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  align-content: start;
  padding-bottom: 20px;
}
dialog.modal-frame:not(#searchDialog) .modal-fields {
  padding: 0 var(--modal-padding) 20px;
}
dialog.modal-frame:not(#searchDialog) .modal-body .two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
dialog.modal-frame:not(#searchDialog) .modal-body label {
  min-width: 0;
  overflow-wrap: anywhere;
}
dialog.modal-frame:not(#searchDialog) .modal-body input:not([type="checkbox"]):not([type="radio"]),
dialog.modal-frame:not(#searchDialog) .modal-body select,
dialog.modal-frame:not(#searchDialog) .modal-body textarea {
  min-width: 0;
  max-width: 100%;
  width: 100%;
}
dialog.modal-frame:not(#searchDialog) .modal-fields > .form-help {
  margin: 16px 0 12px;
}
dialog.modal-frame:not(#searchDialog) .dialog-head,
dialog.modal-frame:not(#searchDialog) .client-dialog-tabs,
dialog.modal-frame:not(#searchDialog) .modal-form > footer {
  position: static;
  flex: 0 0 auto;
}
dialog.modal-frame:not(#searchDialog) .dialog-head {
  gap: 12px;
}
dialog.modal-frame:not(#searchDialog) .dialog-head > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
dialog.modal-frame:not(#searchDialog) .dialog-head > button {
  flex: 0 0 auto;
}
dialog.modal-frame:not(#searchDialog) .modal-form > footer {
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 12px var(--modal-padding) calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}
dialog.modal-frame:not(#searchDialog) .modal-form > footer button {
  min-height: 40px;
  white-space: normal;
}
dialog.modal-frame:not(#searchDialog).confirm-dialog {
  overflow: auto;
}
dialog.modal-frame:not(#searchDialog).confirm-dialog > form {
  flex: 0 0 auto;
  max-height: none;
  overflow: visible;
}
dialog.modal-frame.asset-drawer:not(#searchDialog) {
  --modal-height: 100dvh;
  max-height: var(--modal-height);
}
@media (max-width: 640px) {
  dialog.modal-frame:not(#searchDialog) {
    --modal-height: calc(100dvh - 12px);
    --modal-padding: 18px;
    max-height: var(--modal-height);
  }
  dialog.modal-frame.asset-drawer:not(#searchDialog) {
    --modal-height: 100dvh;
  }
  dialog.modal-frame:not(#searchDialog) .modal-form > footer {
    padding-top: 14px;
    padding-bottom: calc(14px + env(safe-area-inset-bottom));
  }
  dialog.modal-frame:not(#searchDialog) .modal-body .two {
    grid-template-columns: minmax(0, 1fr);
  }
}
