body.modal-shell-open {
  overflow: hidden;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: hidden;
  box-sizing: border-box;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* Native child dialogs join the browser top layer above their native parent. */
dialog.modal-overlay::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

dialog.modal-overlay {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
}

.modal-shell {
  width: min(720px, calc(100vw - 48px));
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.modal-shell--sm {
  width: min(420px, calc(100vw - 48px));
}

.modal-shell--md {
  width: min(720px, calc(100vw - 48px));
}

.modal-shell--lg {
  width: min(920px, calc(100vw - 48px));
}

.modal-shell--xl {
  width: min(1180px, calc(100vw - 48px));
}

.modal-shell--full {
  width: calc(100vw - 48px);
}

.modal-card {
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5eaf2;
  border-radius: 14px;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.14);
}

.modal-header,
.modal-shell-header {
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #fff;
  border-bottom: 1px solid #e5eaf2;
}

.modal-header h2,
.modal-shell-header h2 {
  margin: 0;
  color: #10284f;
  font-size: 18px;
  line-height: 1.25;
}

.modal-header p,
.modal-shell-header p {
  margin: 4px 0 0;
  color: #6c7c92;
  font-size: 12px;
  line-height: 1.45;
}

.modal-body,
.modal-shell-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px 16px;
}

.modal-body > *:first-child,
.modal-shell-body > *:first-child {
  margin-top: 0;
}

.modal-body > *:last-child,
.modal-shell-body > *:last-child {
  margin-bottom: 0;
}

.modal-footer,
.modal-shell-footer {
  position: sticky;
  bottom: 0;
  z-index: 10;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  background: #fff;
  border-top: 1px solid #e5eaf2;
}

.modal-close-btn {
    width: 40px;
    height: 40px;
    border: 1px solid #dbe3ef;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
    background: #fff;
    color: #0f2344;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
  }

.modal-close-btn-icon {
    display: block;
    font-size: 22px;
    line-height: 1;
    font-weight: 500;
  }

.modal-close-btn:hover {
  background: #f8fbff;
}

.modal-shell .modal-section {
  margin-bottom: 12px;
}

.modal-shell .modal-grid {
  display: grid;
  gap: 10px;
}

.modal-shell .info-card {
  border: 1px solid #e7ecf3;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fff;
}

.modal-shell [data-modal-scroll-container],
.modal-shell .modal-body-scroll,
.modal-shell .member-view-body,
.modal-shell .payment-details-modal-body,
.modal-shell .payment-child-modal-body,
.modal-shell .lead-details-modal-body,
.modal-shell .lead-followup-modal-body,
.modal-shell .project-account-dialog-body {
  max-height: none !important;
  min-height: 0 !important;
  overflow: visible !important;
  padding: 0 !important;
}

.modal-shell .dialog-actions,
.modal-shell .lead-followup-modal-foot {
  margin-top: 12px;
}

@media (max-width: 768px) {
  .modal-overlay {
    padding: 12px;
  }

  .modal-shell,
  .modal-shell--sm,
  .modal-shell--md,
  .modal-shell--lg,
  .modal-shell--xl,
  .modal-shell--full {
    width: calc(100vw - 24px);
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
  }

  .modal-header,
  .modal-shell-header,
  .modal-body,
  .modal-shell-body,
  .modal-footer,
  .modal-shell-footer {
    padding-left: 12px;
    padding-right: 12px;
  }
}
