.crm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.32);
}

.client-card-backdrop {
  padding: 0;
}

.crm-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: min(860px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.24);
}

.crm-dialog-head,
.crm-dialog-actions {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.crm-dialog-head h2,
.crm-form-section h3 {
  margin: 0;
}

.crm-dialog-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  border-bottom: 0;
}

.crm-dialog-actions.split {
  justify-content: space-between;
}

.crm-dialog-actions.split > div {
  display: flex;
  gap: 10px;
}

.crm-dialog-body {
  min-height: 0;
  display: grid;
  gap: 16px;
  overflow: auto;
  padding: 20px;
}

.crm-dialog-body .crm-detail-panel {
  padding: 0;
}

.crm-nested-backdrop {
  position: fixed;
  inset: 0;
  z-index: 320;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.28);
}

.crm-edit-dialog {
  width: min(680px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.25);
}

.crm-form-section {
  display: grid;
  gap: 12px;
}

.crm-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.crm-form-grid input,
.crm-form-grid select {
  min-height: 42px;
  border-radius: 8px;
  padding: 8px 10px;
}

.crm-form-grid select {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.crm-consent-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.crm-consent-options label {
  min-height: 38px;
  display: flex;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--ink);
  font-weight: 900;
}

.crm-consent-options input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--primary);
}

@media (max-width: 760px) {
  .crm-dialog-backdrop {
    padding: 10px;
  }

  .crm-dialog {
    max-height: calc(100vh - 20px);
  }

  .crm-form-grid {
    grid-template-columns: 1fr;
  }
}
