.data-export-modal {
  position: fixed;
  inset: 0;
  z-index: 1700;
  display: grid;
  place-items: center;
  padding: 24px;
}

.data-export-modal[hidden] {
  display: none;
}

.data-export-modal__backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(15, 23, 42, .58);
  backdrop-filter: blur(3px);
}

.data-export-dialog {
  position: relative;
  width: min(760px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #dce5ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(15, 23, 42, .24);
}

.data-export-dialog > .data-export-dialog__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px 28px 21px;
  border-bottom: 1px solid #dce5ee;
  background: #fff;
  color: #17324d;
}

.data-export-dialog__eyebrow {
  margin: 0 0 5px;
  color: #0877c9;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.data-export-dialog h2 {
  margin: 0;
  color: #17324d;
  font-size: clamp(24px, 2vw, 32px);
}

.data-export-dialog__subtitle {
  margin: 7px 0 0;
  color: #64748b;
}

.data-export-dialog__close {
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 1px solid #0877c9;
  border-radius: 50%;
  background: #0877c9;
  color: #fff;
  font-size: 24px;
  line-height: 1;
}

.data-export-dialog__close:hover:not(:disabled) {
  border-color: #0668af;
  background: #0668af;
  color: #fff;
}

.data-export-dialog__body {
  min-height: 0;
  padding: 20px 28px;
  overflow: auto;
}

.data-export-dialog__tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.data-export-dialog__selection-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.data-export-dialog__scope {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  margin-left: auto;
  color: #24415c;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.data-export-dialog__scope input {
  width: 17px;
  height: 17px;
  accent-color: #0877c9;
}

.data-export-dialog__selection-actions button {
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid #cbd8e5;
  border-radius: 9px;
  background: #f8fafc;
  color: #24415c;
  font-weight: 700;
}

.data-export-dialog__count {
  color: #64748b;
  font-size: 13px;
  font-weight: 700;
}

.data-export-dialog__record-count {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid #cfe2f5;
  border-radius: 10px;
  background: #f2f8fe;
  color: #174f7e;
  font-size: 14px;
  font-weight: 700;
}

.data-export-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.data-export-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  color: #334155;
  cursor: pointer;
}

.data-export-field:has(input:checked) {
  border-color: #82bce8;
  background: #f0f8ff;
  color: #075f9f;
}

.data-export-field input {
  width: 17px;
  height: 17px;
  accent-color: #0877c9;
}

.data-export-preview {
  margin-top: 18px;
  padding: 13px;
  border: 1px solid #dce5ee;
  border-radius: 12px;
  background: #f8fafc;
}

.data-export-preview__table {
  overflow: auto;
  border: 1px solid #dce5ee;
  border-radius: 9px;
  background: #fff;
}

.data-export-preview table {width: 100%;border-collapse: collapse;font-size: 12px}
.data-export-preview th,.data-export-preview td {max-width: 240px;padding: 9px 10px;border-bottom: 1px solid #e7edf3;text-align: left;white-space: nowrap;overflow: hidden;text-overflow: ellipsis}
.data-export-preview th {position: sticky;top: 0;background: #eef5fb;color: #24415c;font-weight: 700}
.data-export-preview p {margin: 10px 2px 0;color: #64748b;font-size: 12px}

.data-export-dialog__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 18px 28px;
  border-top: 1px solid #e7edf3;
  background: #f8fafc;
}

.data-export-dialog__footer button {
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 10px;
}

.data-export-dialog__state,
.data-export-dialog__progress {
  margin: 0 auto 0 0;
  color: #b42318;
  font-size: 13px;
}

.data-export-dialog__progress {
  color: #0877c9;
}

@media (max-width: 640px) {
  .data-export-modal {
    align-items: end;
    padding: 0;
  }

  .data-export-dialog {
    max-height: 92vh;
    border-radius: 18px 18px 0 0;
  }

  .data-export-fields {
    grid-template-columns: 1fr;
  }

  .data-export-dialog__header,
  .data-export-dialog__body,
  .data-export-dialog__footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .data-export-dialog__tools {
    align-items: flex-start;
    flex-direction: column;
  }

  .data-export-dialog__scope {
    margin-left: 0;
  }
}
