:root {
  --alteditor-lite-dialog-width: 42rem;
  --alteditor-lite-spacing: 1rem;
  --alteditor-lite-border-radius: 0.5rem;
  --alteditor-lite-error-color: #b42318;
  --alteditor-lite-error-text-color: #fff;
  --alteditor-lite-overlay-color: rgb(0 0 0 / 45%);
  --alteditor-lite-surface-color: Canvas;
  --alteditor-lite-text-color: CanvasText;
  --alteditor-lite-border-color: rgb(127 127 127 / 40%);
  --alteditor-lite-focus-color: Highlight;
  --alteditor-lite-primary-color: #005a9e;
  --alteditor-lite-primary-text-color: #fff;
  --alteditor-lite-option-active-color: Highlight;
  --alteditor-lite-option-active-text-color: HighlightText;
  --alteditor-lite-popup-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 20%);
  --alteditor-lite-search-select-max-height: 16rem;
  --alteditor-lite-font-family: inherit;
  --alteditor-lite-font-size: 1rem;
  --alteditor-lite-control-min-height: 2.5rem;
  --alteditor-lite-focus-width: 2px;
  --alteditor-lite-focus-offset: 2px;
}

@supports (color: color-mix(in srgb, CanvasText 25%, transparent)) {
  :root {
    --alteditor-lite-border-color: color-mix(in srgb, CanvasText 25%, transparent);
  }
}

.alteditor-lite-dialog {
  box-sizing: border-box;
  width: min(
    calc(100% - (2 * var(--alteditor-lite-spacing))),
    var(--alteditor-lite-dialog-width)
  );
  max-width: none;
  max-height: var(--alteditor-lite-dialog-max-height, calc(100vh - 2rem));
  padding: 0;
  overflow: hidden;
  color: var(--alteditor-lite-text-color);
  font-family: var(--alteditor-lite-font-family);
  font-size: var(--alteditor-lite-font-size);
  color-scheme: light dark;
  background: var(--alteditor-lite-surface-color);
  border: 1px solid var(--alteditor-lite-border-color);
  border-radius: var(--alteditor-lite-border-radius);
}

@supports (height: 100dvh) {
  .alteditor-lite-dialog {
    max-height: var(--alteditor-lite-dialog-max-height, calc(100dvh - 2rem));
  }
}

.alteditor-lite-dialog::backdrop {
  background: var(--alteditor-lite-overlay-color);
}

.alteditor-lite-dialog__surface {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  max-height: inherit;
}

.alteditor-lite-dialog__header,
.alteditor-lite-dialog__body,
.alteditor-lite-dialog__errors,
.alteditor-lite-dialog__footer {
  padding: var(--alteditor-lite-spacing);
}

.alteditor-lite-dialog__header {
  border-bottom: 1px solid var(--alteditor-lite-border-color);
}

.alteditor-lite-dialog__title {
  margin: 0;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 650;
}

.alteditor-lite-dialog__body {
  overflow: auto;
}

.alteditor-lite-dialog__errors,
.alteditor-lite-form__submission-error,
.alteditor-lite-field__error {
  color: var(--alteditor-lite-error-color);
}

.alteditor-lite-dialog__errors:empty,
.alteditor-lite-form__submission-error:empty,
.alteditor-lite-field__error:empty {
  display: none;
}

.alteditor-lite-dialog__footer {
  display: flex;
  gap: calc(var(--alteditor-lite-spacing) / 2);
  justify-content: flex-end;
  border-top: 1px solid var(--alteditor-lite-border-color);
}

.alteditor-lite-dialog__button {
  min-height: var(--alteditor-lite-control-min-height);
  padding: 0.5rem 1rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--alteditor-lite-border-color);
  border-radius: calc(var(--alteditor-lite-border-radius) / 1.5);
}

.alteditor-lite-dialog__button--submit {
  color: var(--alteditor-lite-primary-text-color);
  background: var(--alteditor-lite-primary-color);
  border-color: var(--alteditor-lite-primary-color);
}

.alteditor-lite-dialog__button--destructive {
  color: var(--alteditor-lite-danger-text-color, var(--alteditor-lite-error-text-color));
  background: var(--alteditor-lite-danger-color, var(--alteditor-lite-error-color));
  border-color: var(--alteditor-lite-danger-color, var(--alteditor-lite-error-color));
}

.alteditor-lite-dialog__button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.alteditor-lite-form,
.alteditor-lite-form__layout {
  display: grid;
  gap: var(--alteditor-lite-spacing);
}

.alteditor-lite-batch-field {
  display: grid;
  gap: calc(var(--alteditor-lite-spacing) / 2);
}

.alteditor-lite-batch-field__state {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.25rem calc(var(--alteditor-lite-spacing) / 2);
  align-items: center;
}

.alteditor-lite-batch-field__label {
  font-weight: 600;
}

.alteditor-lite-batch-field__state-text {
  grid-column: 1;
  margin: 0;
  font-size: 0.875rem;
  opacity: 0.75;
}

.alteditor-lite-batch-field__action {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 2.25rem;
  padding: 0.375rem 0.75rem;
  color: inherit;
  font: inherit;
  cursor: pointer;
  background: transparent;
  border: 1px solid var(--alteditor-lite-border-color);
  border-radius: calc(var(--alteditor-lite-border-radius) / 1.5);
}

.alteditor-lite-batch-field > .alteditor-lite-batch-field__action {
  grid-column: 1;
  grid-row: auto;
  justify-self: start;
}

.alteditor-lite-batch-field__action:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.alteditor-lite-form__slot--hidden {
  display: none;
}

.alteditor-lite-remove-confirmation {
  display: grid;
  gap: calc(var(--alteditor-lite-spacing) / 2);
}

.alteditor-lite-remove-confirmation > * {
  margin: 0;
}

.alteditor-lite-remove-confirmation__warning {
  font-weight: 600;
}

.alteditor-lite-form[aria-busy='true'] {
  opacity: 0.75;
}

.alteditor-lite-field {
  display: grid;
  gap: calc(var(--alteditor-lite-spacing) / 2);
}

.alteditor-lite-field__label {
  font-weight: 600;
}

.alteditor-lite-radio {
  box-sizing: border-box;
  display: grid;
  gap: 0.375rem;
  width: 100%;
}

.alteditor-lite-field__control {
  box-sizing: border-box;
  color: var(--alteditor-lite-control-text-color, var(--alteditor-lite-text-color));
  font: inherit;
}

.alteditor-lite-field__control:not([type='checkbox']) {
  width: 100%;
  min-height: var(--alteditor-lite-control-min-height);
  padding: 0.5rem;
  background: var(
    --alteditor-lite-control-background-color,
    var(--alteditor-lite-surface-color)
  );
  border: 1px solid
    var(--alteditor-lite-control-border-color, var(--alteditor-lite-border-color));
  border-radius: calc(var(--alteditor-lite-border-radius) / 1.5);
}

.alteditor-lite-checkbox {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(2.5rem, auto);
  gap: calc(var(--alteditor-lite-spacing) / 2);
  align-items: center;
  width: 100%;
  padding: 0;
  cursor: pointer;
}

.alteditor-lite-checkbox > .alteditor-lite-field__control {
  grid-column: 1;
  grid-row: 2;
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  min-height: 0;
  padding: 0;
  margin: 0;
  accent-color: var(--alteditor-lite-primary-color);
}

.alteditor-lite-checkbox > .alteditor-lite-field__label {
  grid-column: 1;
  grid-row: 1;
}

input[type='file'].alteditor-lite-field__control {
  padding: 0;
}

input[type='file'].alteditor-lite-field__control::file-selector-button {
  min-height: calc(var(--alteditor-lite-control-min-height) - 2px);
  padding: 0.5rem;
  margin-inline-end: 0.5rem;
  color: var(--alteditor-lite-control-text-color, var(--alteditor-lite-text-color));
  font: inherit;
  cursor: pointer;
  background: var(
    --alteditor-lite-control-background-color,
    var(--alteditor-lite-surface-color)
  );
  border: 0;
  border-inline-end: 1px solid
    var(--alteditor-lite-control-border-color, var(--alteditor-lite-border-color));
}

input[type='file'].alteditor-lite-field__control:disabled::file-selector-button {
  cursor: not-allowed;
}

.alteditor-lite-field__control[aria-invalid='true'] {
  border-color: var(--alteditor-lite-error-color);
  box-shadow: 0 0 0 1px var(--alteditor-lite-error-color);
}

.alteditor-lite-field--validating {
  cursor: progress;
}

textarea.alteditor-lite-field__control {
  min-height: 6rem;
  resize: vertical;
}

.alteditor-lite-field__description {
  font-size: 0.875rem;
  opacity: 0.75;
}

.alteditor-lite-radio__option {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  min-height: 2rem;
  cursor: pointer;
}

.alteditor-lite-radio__option > input {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  margin: 0;
  accent-color: var(--alteditor-lite-primary-color);
}

.alteditor-lite-radio__option:has(> input:disabled) {
  cursor: not-allowed;
  opacity: 0.65;
}

.alteditor-lite-search-select {
  position: relative;
  display: grid;
  min-width: 0;
}

.alteditor-lite-search-select > .alteditor-lite-field__control {
  padding-inline-end: 2.75rem;
}

.alteditor-lite-search-select__clear {
  position: absolute;
  inset-block-start: 0.375rem;
  inset-inline-end: 0.375rem;
  display: grid;
  width: 1.75rem;
  min-width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  color: inherit;
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: calc(var(--alteditor-lite-border-radius) / 2);
  place-items: center;
}

.alteditor-lite-search-select__clear[hidden] {
  display: none;
}

.alteditor-lite-search-select__clear:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.alteditor-lite-search-select__listbox {
  position: absolute;
  z-index: 1;
  inset-block-start: calc(100% + 0.25rem);
  inset-inline: 0;
  box-sizing: border-box;
  max-height: min(
    var(--alteditor-lite-search-select-max-height),
    var(
      --alteditor-lite-search-select-available-height,
      var(--alteditor-lite-search-select-max-height)
    )
  );
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--alteditor-lite-text-color);
  background: var(--alteditor-lite-surface-color);
  border: 1px solid var(--alteditor-lite-border-color);
  border-radius: calc(var(--alteditor-lite-border-radius) / 1.5);
  box-shadow: var(--alteditor-lite-popup-shadow);
}

.alteditor-lite-search-select__listbox--above {
  inset-block: auto calc(100% + 0.25rem);
}

.alteditor-lite-search-select__listbox[hidden] {
  display: none;
}

.alteditor-lite-search-select__option,
.alteditor-lite-search-select__no-results,
.alteditor-lite-search-select__feedback {
  min-height: 2.25rem;
  padding: 0.5rem 0.625rem;
  overflow-wrap: anywhere;
}

.alteditor-lite-search-select__option {
  cursor: pointer;
}

.alteditor-lite-search-select__option:hover,
.alteditor-lite-search-select__option--active {
  color: var(--alteditor-lite-option-active-text-color);
  background: var(--alteditor-lite-option-active-color);
}

.alteditor-lite-search-select__option[aria-disabled='true'] {
  color: inherit;
  cursor: not-allowed;
  background: transparent;
  opacity: 0.5;
}

.alteditor-lite-search-select__no-results {
  opacity: 0.75;
}

.alteditor-lite-search-select__feedback {
  opacity: 0.8;
}

.alteditor-lite-search-select__feedback--error,
.alteditor-lite-search-select--error > .alteditor-lite-field__control {
  color: var(--alteditor-lite-error-color);
}

.alteditor-lite-search-select__listbox[aria-busy='true'] {
  cursor: progress;
}

table[class~='dataTable'] tbody td.alteditor-lite-cell--editing {
  position: relative;
  padding-block: 0;
  padding-inline: 0;
  outline: 0;
}

table[class~='dataTable'] tbody td.alteditor-lite-cell--editing::after {
  position: absolute;
  z-index: 3;
  inset: 0;
  box-sizing: border-box;
  pointer-events: none;
  content: '';
  border: var(--alteditor-lite-focus-width) solid var(--alteditor-lite-focus-color);
}

.alteditor-lite-inline {
  box-sizing: border-box;
  display: flex;
  min-height: 2rem;
  width: 100%;
  min-width: 0;
  color: var(--alteditor-lite-text-color);
  font-family: var(--alteditor-lite-font-family);
  font-size: var(--alteditor-lite-font-size);
  color-scheme: light dark;
  align-items: center;
}

.alteditor-lite-inline__control,
.alteditor-lite-inline .alteditor-lite-field,
.alteditor-lite-inline .alteditor-lite-search-select {
  min-width: 0;
  width: 100%;
}

.alteditor-lite-inline-hover-target {
  position: relative;
}

.alteditor-lite-inline-hover__trigger {
  position: absolute;
  z-index: 2;
  inset-block-start: 50%;
  inset-inline-end: 0.25rem;
  display: inline-grid;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.2rem;
  color: var(--alteditor-lite-primary-color);
  cursor: pointer;
  background: transparent;
  border: 0;
  box-shadow: none;
  opacity: 0.65;
  transform: translateY(-50%);
  place-items: center;
}

.alteditor-lite-inline-hover__trigger:hover,
.alteditor-lite-inline-hover__trigger:focus-visible {
  opacity: 1;
}

.alteditor-lite-inline-hover__trigger svg,
.alteditor-lite-inline__action svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.alteditor-lite-inline--actions {
  flex-wrap: wrap;
  gap: 0.25rem;
}

.alteditor-lite-inline--actions .alteditor-lite-inline__control {
  flex: 1 1 4rem;
}

.alteditor-lite-inline--actions
  .alteditor-lite-inline__control:has(
    .alteditor-lite-field__control:is(
      [type='date'],
      [type='datetime-local'],
      [type='month'],
      [type='time'],
      [type='week']
    )
  ) {
  flex-basis: 11rem;
}

.alteditor-lite-inline__actions {
  box-sizing: border-box;
  display: inline-flex;
  flex: 0 1 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 100%;
  gap: 0.125rem;
  margin-inline-start: auto;
  padding-block: 0.25rem;
  padding-inline-end: 0.25rem;
}

.alteditor-lite-inline--actions:has(.alteditor-lite-search-select),
.alteditor-lite-inline--actions:has(.alteditor-lite-search-select)
  .alteditor-lite-inline__actions {
  flex-wrap: nowrap;
}

.alteditor-lite-inline__action {
  display: inline-grid;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0.25rem;
  color: var(--alteditor-lite-control-text-color, var(--alteditor-lite-text-color));
  cursor: pointer;
  background: var(
    --alteditor-lite-control-background-color,
    var(--alteditor-lite-surface-color)
  );
  border: 1px solid
    var(--alteditor-lite-control-border-color, var(--alteditor-lite-border-color));
  border-radius: calc(var(--alteditor-lite-border-radius) / 2);
  place-items: center;
}

.alteditor-lite-inline__action--submit {
  color: var(--alteditor-lite-primary-text-color);
  background: var(--alteditor-lite-primary-color);
  border-color: var(--alteditor-lite-primary-color);
}

.alteditor-lite-inline__action:disabled {
  cursor: progress;
  opacity: 0.65;
}

.alteditor-lite-inline--busy {
  cursor: progress;
  opacity: 0.75;
}

.alteditor-lite-inline--invalid {
  outline: 0;
}

table[class~='dataTable']
  tbody
  td.alteditor-lite-cell--editing:has(.alteditor-lite-inline--invalid)::after {
  border-color: var(--alteditor-lite-error-color);
}

table[class~='dataTable']
  tbody
  td.alteditor-lite-cell--editing:has(.alteditor-lite-inline :focus-visible):not(
    :has(.alteditor-lite-inline--invalid)
  )::after {
  border-color: transparent;
}

@media (forced-colors: active) {
  table[class~='dataTable'] tbody td.alteditor-lite-cell--editing::after,
  table[class~='dataTable']
    tbody
    td.alteditor-lite-cell--editing:has(.alteditor-lite-inline--invalid)::after {
    border-color: Highlight;
  }

  .alteditor-lite-inline-hover__trigger,
  .alteditor-lite-inline__action {
    color: ButtonText;
    background: ButtonFace;
    forced-color-adjust: auto;
  }

  .alteditor-lite-inline-hover__trigger {
    outline: 1px solid ButtonText;
    opacity: 1;
  }

  .alteditor-lite-inline__action {
    border-color: ButtonText;
  }
}

.alteditor-lite-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.alteditor-lite-dialog__button:focus-visible,
.alteditor-lite-batch-field__action:focus-visible,
.alteditor-lite-field__control:focus-visible,
.alteditor-lite-radio input:focus-visible,
.alteditor-lite-search-select__clear:focus-visible,
.alteditor-lite-inline-hover__trigger:focus-visible,
.alteditor-lite-inline__action:focus-visible {
  outline: var(--alteditor-lite-focus-width) solid var(--alteditor-lite-focus-color);
  outline-offset: var(--alteditor-lite-focus-offset);
}

.alteditor-lite-inline .alteditor-lite-field__control:not([type='checkbox']) {
  height: 2rem;
  min-height: 2rem;
  padding: 0.05rem 0.15rem;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.alteditor-lite-inline .alteditor-lite-checkbox {
  display: flex;
  gap: 0;
  width: 100%;
  min-height: 2rem;
  padding-block: 0;
  padding-inline: 0.25rem;
}

.alteditor-lite-inline .alteditor-lite-checkbox > .alteditor-lite-field__control {
  width: 1rem;
  height: 1rem;
}

.alteditor-lite-inline
  .alteditor-lite-field__control:not([type='checkbox']):focus-visible {
  outline-width: var(--alteditor-lite-focus-width);
  outline-offset: calc(-1 * var(--alteditor-lite-focus-offset));
}

.alteditor-lite-checkbox:has(> .alteditor-lite-field__control:disabled) {
  cursor: not-allowed;
  opacity: 0.65;
}

.alteditor-lite-inline .alteditor-lite-search-select__clear {
  inset-block-start: 50%;
  transform: translateY(-50%);
}

.alteditor-lite-inline .alteditor-lite-search-select__listbox {
  z-index: 4;
}

@media (pointer: coarse) {
  .alteditor-lite-inline-hover__trigger,
  .alteditor-lite-inline__action {
    width: 2.5rem;
    height: 2.5rem;
  }

  .alteditor-lite-inline-hover__trigger svg,
  .alteditor-lite-inline__action svg {
    width: 1.125rem;
    height: 1.125rem;
  }

  .alteditor-lite-inline {
    min-height: 2.5rem;
  }

  .alteditor-lite-inline .alteditor-lite-field__control:not([type='checkbox']) {
    height: 2.5rem;
    min-height: 2.5rem;
  }

  .alteditor-lite-inline .alteditor-lite-checkbox {
    min-height: 2.5rem;
  }
}

.alteditor-lite-dialog[aria-busy='true'] .alteditor-lite-dialog__button:disabled {
  cursor: progress;
}

@media (prefers-color-scheme: dark) {
  :root {
    --alteditor-lite-error-color: #ffb4ab;
    --alteditor-lite-error-text-color: #410002;
    --alteditor-lite-primary-color: #8ecaff;
    --alteditor-lite-primary-text-color: #001d32;
    --alteditor-lite-popup-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 55%);
  }
}

@media (width <= 30rem) {
  .alteditor-lite-dialog {
    width: calc(100% - 1rem);
    max-height: var(--alteditor-lite-dialog-max-height, calc(100vh - 1rem));
  }

  .alteditor-lite-dialog__header,
  .alteditor-lite-dialog__body,
  .alteditor-lite-dialog__errors,
  .alteditor-lite-dialog__footer {
    padding: 0.75rem;
  }

  .alteditor-lite-dialog__footer {
    flex-wrap: wrap;
  }

  .alteditor-lite-dialog__button {
    flex: 1 1 8rem;
  }

  .alteditor-lite-search-select__listbox {
    max-height: min(
      var(--alteditor-lite-search-select-max-height),
      var(
        --alteditor-lite-search-select-available-height,
        var(--alteditor-lite-search-select-max-height)
      ),
      12rem,
      40vh
    );
  }

  @supports (height: 100dvh) {
    .alteditor-lite-dialog {
      max-height: var(--alteditor-lite-dialog-max-height, calc(100dvh - 1rem));
    }

    .alteditor-lite-search-select__listbox {
      max-height: min(
        var(--alteditor-lite-search-select-max-height),
        var(
          --alteditor-lite-search-select-available-height,
          var(--alteditor-lite-search-select-max-height)
        ),
        12rem,
        40dvh
      );
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .alteditor-lite-dialog,
  .alteditor-lite-dialog *,
  .alteditor-lite-search-select__listbox {
    scroll-behavior: auto;
    transition-duration: 0.01ms;
    animation-duration: 0.01ms;
    animation-iteration-count: 1;
  }
}
