.cmp-adjust-trigger,
.cmp-adjust-popover,
.cmp-adjust-dialog {
  --cmp-adjust-paper: var(--nov05-editor-paper, #e9e9e5);
  --cmp-adjust-ink: var(--nov05-editor-ink, #20211e);
  --cmp-adjust-line: var(--nov05-editor-line, #b9bbb4);
  --cmp-adjust-field: var(--nov05-editor-bg, #d8dbd3);
  --cmp-adjust-focus: var(--nov05-editor-accent, #20211e);
  --cmp-adjust-radius: var(--ref-r-2, 6px);
  color: var(--cmp-adjust-ink);
  font: 13px/1.4 var(--ref-f-ui, system-ui, sans-serif);
}

.cmp-adjust-trigger,
.cmp-adjust-popover button,
.cmp-adjust-dialog button {
  box-sizing: border-box;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.cmp-adjust-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  padding: 4px 9px;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: var(--cmp-adjust-radius);
  background: transparent;
  text-align: start;
}

.cmp-adjust-trigger::after,
.cmp-adjust-flyout-trigger::after {
  content: '';
  flex: none;
  width: 6px;
  height: 6px;
  margin: 0 4px 3px 8px;
  border-inline-end: 1px solid currentColor;
  border-block-end: 1px solid currentColor;
  transform: rotate(45deg);
}

.cmp-adjust-flyout-trigger::after { margin: 0 4px 0 8px; transform: rotate(135deg); }

.cmp-adjust-trigger:is(:hover, [aria-expanded="true"]),
.cmp-adjust-popover button:is(:hover, [aria-expanded="true"]):not(:disabled),
.cmp-adjust-dialog button:hover:not(:disabled) {
  background: var(--cmp-adjust-field);
}

.cmp-adjust-trigger:focus-visible,
.cmp-adjust-popover button:focus-visible,
.cmp-adjust-dialog :is(button, input, select, summary):focus-visible {
  outline: 2px solid var(--cmp-adjust-focus);
  outline-offset: -2px;
}

.cmp-adjust-popover,
.cmp-adjust-dialog {
  position: fixed;
  box-sizing: border-box;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: var(--cmp-adjust-radius);
  background: var(--cmp-adjust-paper);
  box-shadow: 0 10px 28px rgb(0 0 0 / .16);
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.cmp-adjust-popover {
  inset: auto;
  margin: 0;
  width: min(224px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px);
  padding: 4px;
  overflow: auto;
}

.cmp-adjust-popover button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: calc(var(--cmp-adjust-radius) - 2px);
  background: transparent;
  text-align: start;
}

.cmp-adjust-popover button:disabled,
.cmp-adjust-dialog button:disabled {
  opacity: .46;
  cursor: default;
}

.cmp-adjust-popover kbd {
  margin-inline-start: 8px;
  font: 11px/1.3 var(--ref-f-ui, system-ui, sans-serif);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.cmp-adjust-popover hr {
  margin: 4px 3px;
  border: 0;
  border-top: 1px solid var(--cmp-adjust-line);
}

.cmp-adjust-dialog {
  inset: 0 16px 0 auto;
  width: min(406px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: auto 0;
  padding: 0;
  overflow: hidden;
}

.cmp-adjust-dialog::backdrop { background: transparent; }

.cmp-adjust-form {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 34px);
  margin: 0;
}

.cmp-adjust-header {
  padding: 12px 15px;
  border-bottom: 1px solid var(--cmp-adjust-line);
}

.cmp-adjust-header h2 {
  margin: 0;
  color: inherit;
  font: 600 15px/1.4 var(--ref-f-ui, system-ui, sans-serif);
}

.cmp-adjust-dialog-body {
  min-height: 0;
  padding: 10px 15px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.cmp-adjust-dialog-body:empty { display: none; }

.cmp-adjust-field,
.cmp-adjust-select,
.cmp-adjust-curve-coords label {
  display: grid;
  grid-template-columns: minmax(67px, .42fr) minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 34px;
}

.cmp-adjust-field-label { overflow-wrap: anywhere; }

.cmp-adjust-numeric {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(52px, 64px);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cmp-adjust-dialog input,
.cmp-adjust-dialog select {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  color: inherit;
  font: inherit;
  font-variant-numeric: tabular-nums;
  accent-color: var(--cmp-adjust-focus);
}

.cmp-adjust-dialog :is(input[type="number"], select) {
  width: 100%;
  min-height: 28px;
  padding: 3px 5px;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: calc(var(--cmp-adjust-radius) - 2px);
  background: var(--cmp-adjust-paper);
}

.cmp-adjust-dialog input[type="color"] {
  width: 44px;
  height: 28px;
  padding: 2px 3px;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: calc(var(--cmp-adjust-radius) - 2px);
  background: var(--cmp-adjust-paper);
}

.cmp-adjust-dialog input[type="range"] {
  appearance: none;
  display: block;
  width: 100%;
  min-height: 26px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.cmp-adjust-dialog input[type="range"]::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: var(--cmp-adjust-track, color-mix(in srgb, var(--cmp-adjust-ink) 22%, var(--cmp-adjust-paper)));
}

.cmp-adjust-dialog input[type="range"]::-moz-range-track {
  height: 5px;
  border-radius: 3px;
  background: var(--cmp-adjust-track, color-mix(in srgb, var(--cmp-adjust-ink) 22%, var(--cmp-adjust-paper)));
}

.cmp-adjust-dialog input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -4.5px;
  border: 1px solid var(--cmp-adjust-ink);
  border-radius: 50%;
  background: var(--cmp-adjust-paper);
}

.cmp-adjust-dialog input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: 1px solid var(--cmp-adjust-ink);
  border-radius: 50%;
  background: var(--cmp-adjust-paper);
}

.cmp-adjust-check {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  white-space: nowrap;
  cursor: pointer;
}

.cmp-adjust-check input { margin: 0; }
.cmp-adjust-dialog [hidden] { display: none; }

.cmp-adjust-ramp {
  height: 12px;
  margin-block: 4px 7px;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: 3px;
}

.cmp-adjust-levels {
  min-width: 0;
  margin: 4px 0 8px;
  padding: 4px 0 0;
  border: 0;
  border-top: 1px solid var(--cmp-adjust-line);
}

.cmp-adjust-levels legend { padding: 0 6px 0 0; }

.cmp-adjust-section + .cmp-adjust-section { border-top: 1px solid var(--cmp-adjust-line); }

.cmp-adjust-section summary {
  min-height: 30px;
  padding-block: 5px;
  box-sizing: border-box;
  cursor: pointer;
}

.cmp-adjust-curve-graph {
  box-sizing: border-box;
  display: block;
  width: 100%;
  max-height: 34dvh;
  margin-block: 6px 4px;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: var(--cmp-adjust-radius);
  background: var(--cmp-adjust-paper);
  touch-action: none;
  cursor: crosshair;
}

.cmp-adjust-curve-coords {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.cmp-adjust-curve-coords label { grid-template-columns: auto minmax(0, 1fr); }

.cmp-adjust-curve-actions,
.cmp-adjust-footer {
  display: flex;
  align-items: center;
  justify-content: end;
  gap: 6px;
}

.cmp-adjust-curve-actions { padding-top: 4px; }

.cmp-adjust-footer {
  flex: none;
  padding: 8px 15px;
  border-top: 1px solid var(--cmp-adjust-line);
}

.cmp-adjust-footer > label { margin-inline-end: auto; }

.cmp-adjust-dialog button {
  min-height: 31px;
  padding: 3px 10px;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: calc(var(--cmp-adjust-radius) - 2px);
  background: transparent;
  white-space: nowrap;
}

.cmp-adjust-dialog .cmp-adjust-primary:not(:disabled) {
  border-color: var(--cmp-adjust-ink);
  background: var(--cmp-adjust-ink);
  color: var(--cmp-adjust-paper);
}

.cmp-adjust-status:not(:empty) {
  padding: 0 15px 8px;
  overflow-wrap: anywhere;
}

@media (pointer: coarse) {
  .cmp-adjust-popover button { min-height: 36px; }
  .cmp-adjust-dialog input[type="range"] { min-height: 34px; }
}

@media (max-width: 560px) {
  .cmp-adjust-dialog {
    inset-inline-end: 8px;
    width: min(406px, calc(100vw - 16px));
  }
}

@media (max-height: 540px) {
  .cmp-adjust-dialog { inset-block: auto 8px; margin-block: 0; }
}

.cmp-adjust-histogram {
  display: block;
  width: 100%;
  height: 72px;
  box-sizing: border-box;
  margin-block: 6px;
  border: 1px solid var(--cmp-adjust-line);
  border-radius: calc(var(--cmp-adjust-radius) - 2px);
}

.cmp-adjust-popover button.cmp-adjust-flyout-back { display: none; }

@media (max-width: 470px) {
  .cmp-adjust-popover button.cmp-adjust-flyout-back { display: flex; }
}
