.user-profiles-root {
  min-width: 0;
  padding: 1rem;
  color: var(--text);
}

.user-profiles-root h2 {
  margin: 0 0 0.85rem;
}

.user-profiles-root .profile-query,
.user-profiles-root .profile-controls,
.user-profiles-root .profile-pagination,
.user-profiles-root .profile-form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.user-profiles-root .profile-query {
  align-items: flex-end;
  margin-bottom: 0.85rem;
}

.user-profiles-root .profile-query label {
  width: min(320px, 100%);
  min-width: 180px;
}

.user-profiles-root .profile-query input {
  min-width: 0;
}

.user-profiles-root .profile-status,
.user-profiles-root .profile-form-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  min-height: 1.4rem;
  margin: 0.55rem 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.user-profiles-root .profile-status.error,
.user-profiles-root .profile-form-status.error {
  color: var(--warn);
}

.user-profiles-root .profile-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.user-profiles-root .profile-table {
  min-width: 1180px;
}

.user-profiles-root .profile-table th {
  background: var(--panel-strong);
  white-space: nowrap;
}

.user-profiles-root .profile-table td {
  max-width: 220px;
  overflow-wrap: anywhere;
}

.user-profiles-root .profile-avatar {
  display: block;
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: var(--radius);
  background: var(--panel-soft);
}

.user-profiles-root .profile-empty {
  padding: 1.4rem;
  color: var(--muted);
  text-align: center;
}

.user-profiles-root .profile-pagination {
  justify-content: flex-end;
  margin-top: 0.85rem;
  color: var(--muted);
}

.user-profiles-root .profile-page-size {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
}

.user-profiles-root .profile-page-size select {
  width: auto;
}

.user-profiles-root .profile-form {
  display: grid;
  gap: 0.85rem;
}

.user-profiles-root .profile-form-grid,
.user-profiles-root .profile-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.user-profiles-root .profile-field,
.user-profiles-root .profile-work-grid label {
  min-width: 0;
}

.user-profiles-root .profile-field input,
.user-profiles-root .profile-field select,
.user-profiles-root .profile-work-grid input {
  min-width: 0;
}

.user-profiles-root .profile-version {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.user-profiles-root .position-selector {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.user-profiles-root .position-selected-summary,
.user-profiles-root .position-directory-status {
  margin-bottom: 0.55rem;
  overflow-wrap: anywhere;
  color: var(--muted);
}

.user-profiles-root .position-directory-status.error {
  color: var(--warn);
}

.user-profiles-root .position-directory-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.55rem;
}

.user-profiles-root .position-directory-controls input {
  width: min(240px, 100%);
}

.user-profiles-root .position-checkbox-list {
  display: grid;
  gap: 0.45rem;
  max-height: 220px;
  overflow-y: auto;
}

.user-profiles-root .position-checkbox-list .position-checkbox {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.user-profiles-root .position-checkbox input {
  width: auto;
  flex: 0 0 auto;
}

.user-profiles-root .position-checkbox span {
  overflow-wrap: anywhere;
}

.user-profiles-root .profile-draft-preview,
.user-profiles-root .profile-avatar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.user-profiles-root .profile-draft-preview {
  min-height: 40px;
}

.user-profiles-root .profile-avatar-controls {
  justify-content: flex-start;
}

.user-profiles-root .profile-form-actions {
  justify-content: flex-end;
}

.user-profiles-root .profile-dialog {
  width: min(720px, calc(100vw - 2rem));
  max-height: 90vh;
  overflow: auto;
  color: var(--text);
}

.user-profiles-root .profile-dialog::backdrop {
  background: rgba(4, 10, 16, 0.72);
}

.user-profiles-root .profile-dialog .modal-header {
  align-items: flex-start;
}

.user-profiles-root .profile-dialog .modal-header h2 {
  overflow-wrap: anywhere;
}

.user-profiles-root button:focus-visible,
.user-profiles-root input:focus-visible,
.user-profiles-root select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.user-profiles-root button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

@media (max-width: 600px) {
  .user-profiles-root {
    padding: 0.75rem;
  }

  .user-profiles-root .profile-query label,
  .user-profiles-root .profile-form-grid,
  .user-profiles-root .profile-work-grid {
    width: 100%;
    grid-template-columns: minmax(0, 1fr);
  }

  .user-profiles-root .profile-pagination,
  .user-profiles-root .profile-form-actions {
    justify-content: flex-start;
  }

  .user-profiles-root .profile-dialog {
    width: calc(100vw - 1rem);
    padding: 0.85rem;
  }
}
