@layer lf-components {
:where(body.dashboard-client-flat-theme :is(
  .dashboard-client-edit-modal,
  .billing-invoice-modal,
  .plans-create-modal,
  .dashboard-agenda-modal,
  .patient-appointment-modal,
  .insurance-ai-actions-modal,
  .client-form-modal:not([aria-hidden="true"])
) ) {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  place-items: center;
  padding: var(--lf-space-5);
}

:where(body.dashboard-client-flat-theme :is(
  .dashboard-client-edit-modal[hidden],
  .billing-invoice-modal[hidden],
  .plans-create-modal[hidden],
  .dashboard-agenda-modal[hidden],
  .patient-appointment-modal[hidden],
  .insurance-ai-actions-modal[hidden],
  .client-form-modal[aria-hidden="true"]
) ) {
  display: none !important;
}

:where(body.dashboard-client-flat-theme :is(
  .dashboard-client-edit-backdrop,
  .billing-invoice-backdrop,
  .plans-create-backdrop,
  .dashboard-agenda-backdrop,
  .patient-appointment-modal__backdrop,
  .insurance-ai-actions-modal__backdrop
) ) {
  position: absolute;
  inset: 0;
  background: rgba(var(--lf-rgb-text), 0.38);
  backdrop-filter: blur(10px) saturate(1.05);
}

:where(body.dashboard-client-flat-theme :is(
  .dashboard-client-edit-dialog,
  .dashboard-client-edit-dialog--create,
  .billing-invoice-card,
  .plans-create-dialog,
  .dashboard-agenda-dialog,
  .patient-appointment-modal__dialog,
  .insurance-ai-actions-modal__dialog,
  .client-form-modal .modal-card
) ) {
  position: relative;
  width: min(620px, calc(100vw - 32px));
  max-height: min(760px, calc(100vh - 32px));
  overflow: auto;
  border: 1px solid var(--lf-color-border);
  border-radius: var(--lf-radius-xl);
  background: var(--lf-color-surface);
  color: var(--lf-color-text);
  box-shadow: var(--lf-shadow-lift);
}

:where(body.dashboard-client-flat-theme :is(
  .dashboard-client-edit-header,
  .billing-invoice-header,
  .plans-create-header,
  .patient-appointment-modal__header,
  .insurance-ai-actions-modal__dialog header
) ) {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--lf-space-4);
  padding-bottom: var(--lf-space-4);
  border-bottom: 1px solid var(--lf-color-border);
}

:where(body.dashboard-client-flat-theme :is(
  .dashboard-client-edit-close,
  .billing-invoice-close,
  .plans-create-close,
  .patient-appointment-modal__close
) ) {
  width: 38px;
  min-width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--lf-color-border);
  border-radius: var(--lf-radius-pill);
  background: var(--lf-color-surface-muted);
  color: var(--lf-color-text);
  box-shadow: none;
}
}
