.prose-editor *, .prose-editor :before, .prose-editor :after {
  box-sizing: inherit;
}

.prose-editor {
  box-sizing: border-box;
  flex-grow: 1;
  position: relative;
}

.prose-editor, .prose-editor-dialog {
  --_b: var(--prose-editor-background, var(--body-bg, #fff));
  --_f: var(--prose-editor-foreground, var(--body-fg, #333));
  --_r: var(--prose-editor-border-color, var(--border-color, #ccc));
  --_a: var(--prose-editor-active-color, var(--primary, #79aec8));
  --_d: var(--prose-editor-disabled-color, var(--border-color, #ccc));
  --_t: var(--prose-editor-typographic, var(--border-color, #ccc));
}

[data-django-prose-editor] {
  opacity: 0;
}

.prose-editor > textarea {
  display: none !important;
}

.prose-editor .ProseMirror {
  background: var(--_b);
  color: var(--_f);
  border: 1px solid var(--_r);
  border-radius: 4px;
  padding: 0 6px;
}

label:empty:has( + .prose-editor) {
  display: none;
}

.prose-editor-nbsp {
  background: var(--_t);
  box-shadow: 0 2px 0 0 var(--_t), 0 -2px 0 0 var(--_t);
}

.prose-editor-shy {
  background: var(--_t);
  box-shadow: 0 2px 0 1px var(--_t), 0 -2px 0 1px var(--_t);
}

.ProseMirror .figure {
  flex-direction: column;
  max-width: 100%;
  margin: 1.5rem 0;
  display: flex;
  position: relative;
}

.ProseMirror .figure figcaption.figure-caption {
  text-align: center;
  margin-top: .5rem;
  padding: .5rem 0;
  font-size: .9rem;
}

.ProseMirror .figure img {
  max-width: 100%;
  height: auto;
}

.prose-editor-grow-wrap {
  display: grid;
}

.prose-editor-grow-wrap:after {
  content: attr(data-value) " ";
  white-space: pre-wrap;
  visibility: hidden;
}

.prose-editor-grow-wrap > textarea {
  resize: none;
  overflow: hidden;
}

.prose-editor-grow-wrap > textarea, .prose-editor-grow-wrap:after {
  grid-area: 1 / 1 / 2 / 2;
}

.prose-editor p.is-editor-empty:first-child:before {
  opacity: .5;
  content: attr(data-placeholder);
  float: left;
  pointer-events: none;
  height: 0;
}

.prose-editor-dialog {
  background: var(--_b);
  color: var(--_f);
  border: 1px solid var(--_r);
  border-radius: 4px;
  min-width: 300px;
  max-width: min(800px, 90vw);
  padding: 1em;
}

.prose-editor-dialog-title {
  border-bottom: 1px solid var(--_r);
  font-size: 1.25em;
  font-weight: 700;
  margin: 0 !important;
  padding: 0 0 .5em !important;
}

.prose-editor-dialog-field {
  margin: 1em 0;
  padding: 0;
}

.prose-editor-dialog-field:has(input[type="checkbox"]) {
  flex-wrap: wrap;
  gap: 4px;
  display: flex;
}

.prose-editor-dialog-field:has(input[type="radio"]) {
  flex-wrap: wrap;
  gap: 4px;
  display: flex;
}

.prose-editor-dialog label {
  width: auto;
  min-width: 0;
  font-weight: 700;
  display: block;
}

.prose-editor-help {
  margin-left: 4px;
  font-size: 80%;
  font-weight: 400;
}

.prose-editor-dialog select, .prose-editor-dialog textarea, .prose-editor-grow-wrap:after {
  border: 1px solid var(--_r);
  width: 100%;
  font: inherit;
  border-radius: 4px;
  margin-top: .5em;
  margin-bottom: 0;
  padding: .5em;
  transition: border-color .2s, box-shadow .2s;
}

.prose-editor-dialog input:not(:-webkit-any([type="checkbox"], [type="radio"])) {
  border: 1px solid var(--_r);
  width: 100%;
  font: inherit;
  border-radius: 4px;
  margin-top: .5em;
  margin-bottom: 0;
  padding: .5em;
  transition: border-color .2s, box-shadow .2s;
}

.prose-editor-dialog input:not(:-moz-any([type="checkbox"], [type="radio"])) {
  border: 1px solid var(--_r);
  width: 100%;
  font: inherit;
  border-radius: 4px;
  margin-top: .5em;
  margin-bottom: 0;
  padding: .5em;
  transition: border-color .2s, box-shadow .2s;
}

.prose-editor-dialog input:not(:-webkit-any([type="checkbox"], [type="radio"])) {
  border: 1px solid var(--_r);
  width: 100%;
  font: inherit;
  border-radius: 4px;
  margin-top: .5em;
  margin-bottom: 0;
  padding: .5em;
  transition: border-color .2s, box-shadow .2s;
}

.prose-editor-dialog input:not(:-moz-any([type="checkbox"], [type="radio"])) {
  border: 1px solid var(--_r);
  width: 100%;
  font: inherit;
  border-radius: 4px;
  margin-top: .5em;
  margin-bottom: 0;
  padding: .5em;
  transition: border-color .2s, box-shadow .2s;
}

.prose-editor-dialog input:not(:is([type="checkbox"], [type="radio"])) {
  border: 1px solid var(--_r);
  width: 100%;
  font: inherit;
  border-radius: 4px;
  margin-top: .5em;
  margin-bottom: 0;
  padding: .5em;
  transition: border-color .2s, box-shadow .2s;
}

.prose-editor-dialog input:focus, .prose-editor-dialog select:focus, .prose-editor-dialog textarea:focus {
  border-color: var(--_a);
  outline: none;
  box-shadow: 0 0 0 2px rgba(121, 174, 200, .25);
}

.prose-editor-dialog input[type="number"] {
  width: 5em;
}

.prose-editor-dialog button {
  all: unset;
  cursor: pointer;
  background: var(--_b);
  color: var(--_f);
  border: 1px solid var(--_r);
  text-align: center;
  border-radius: 4px;
  margin-top: .5em;
  margin-right: .5em;
  padding: .5em 1em;
  transition: all .25s;
  display: inline-flex;
  position: relative;
}

.prose-editor-dialog button:hover {
  filter: brightness(1.1);
  background-color: rgba(0, 0, 0, .05);
}

.prose-editor-dialog button:active {
  filter: brightness(.95);
}

.prose-editor-dialog button:focus {
  outline: 2px solid var(--_a);
  outline-offset: 2px;
  z-index: 1;
  position: relative;
}

.prose-editor-field-with-picker {
  display: flex;
}

.prose-editor.fullscreen {
  z-index: 9999 !important;
  background: var(--_b) !important;
  flex-direction: column !important;
  width: 100vw !important;
  max-width: none !important;
  height: 100vh !important;
  max-height: none !important;
  margin: 0 !important;
  padding: 20px !important;
  display: flex !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  overflow-y: auto !important;
}

.prose-editor.fullscreen .prose-menubar {
  border-radius: 0 !important;
  width: 100% !important;
  padding: 8px 20px !important;
}

.prose-editor.fullscreen .prose-menubar--floating {
  z-index: 10000 !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
}

.prose-editor.fullscreen .ProseMirror {
  max-height: none !important;
  box-shadow: none !important;
  border: 1px solid var(--_r) !important;
  border-radius: 4px !important;
  flex: 1 !important;
  padding: 1em !important;
  overflow-y: auto !important;
}

:where(.prose-menubar) button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color: unset;
  cursor: pointer;
  background-color: rgba(0, 0, 0, 0);
  border: none;
  margin: 0;
  padding: 0;
}

.prose-menubar:not(:empty) {
  background: var(--_b);
  border-bottom: 1px solid var(--_r);
  box-sizing: border-box;
  z-index: 10;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  padding: 4px;
  font-size: 14px;
  display: inline-flex;
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}

.prose-menubar--floating:not(:empty) {
  border-radius: 4px;
  width: -webkit-max-content;
  width: -moz-max-content;
  width: max-content;
  position: absolute;
  box-shadow: 0 0 3px rgba(0, 0, 0, .3);
}

.prose-editor.disabled .prose-menubar {
  display: none;
}

.prose-menubar__group {
  display: flex;
}

.prose-menubar__button {
  cursor: pointer;
  background: var(--_b);
  min-width: 2em;
  height: 28px;
  color: var(--_f);
  border: 1px solid var(--_r);
  justify-content: center;
  align-items: center;
  padding: 0 .25em;
  transition-property: color, background, border-radius, filter, opacity, transform;
  transition-duration: .25s;
  display: inline-flex;
  position: relative;
}

.prose-menubar__button.hidden {
  display: none !important;
}

.prose-menubar__button--heading:after {
  content: attr(data-level);
  font-family: sans-serif;
  font-size: 12px;
  position: absolute;
  bottom: 5px;
  right: 4px;
}

.prose-menubar__button:not(.hidden) {
  border-top-left-radius: 4px;
  border-bottom-left-radius: 4px;
}

.prose-menubar__button:not(.hidden) ~ .prose-menubar__button:not(.hidden) {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.prose-menubar__button:not(.hidden):not(:has( ~ .prose-menubar__button:not(.hidden))) {
  border-top-right-radius: 4px;
  border-bottom-right-radius: 4px;
}

.prose-menubar__button + .prose-menubar__button {
  border-left: none;
}

.prose-menubar__button.material-icons {
  min-width: auto;
  padding: 0 .125em;
}

.prose-menubar__button:hover {
  filter: brightness(110%);
}

.prose-menubar__button.active {
  background-color: var(--_a);
}

.prose-menubar__button.disabled:not(.active) {
  background: var(--_d);
  filter: brightness();
  cursor: not-allowed;
  opacity: .3;
}

.prose-menubar__dropdown {
  display: block;
  position: relative;
}

.prose-menubar__selected {
  cursor: pointer;
  outline: 1px solid var(--_r);
  border-radius: 4px;
  height: 28px;
  display: block;
  position: relative;
  padding-right: 1rem !important;
}

.prose-menubar__selected:after {
  content: "⏷";
  position: absolute;
  top: 6px;
  right: 4px;
}

.prose-menubar__selected :first-child {
  border: none;
}

.prose-menubar__selected > * {
  pointer-events: none;
}

.prose-menubar__button svg {
  vertical-align: middle;
  width: 20px;
  height: 20px;
  display: inline-block;
}

.prose-menubar__button svg * {
  color: inherit;
}

.prose-menubar__picker:popover-open {
  all: initial;
  position: absolute;
}

.prose-menubar__picker .ProseMirror {
  flex-direction: column !important;
  padding: 0 !important;
  display: flex !important;
}

.prose-menubar__picker .ProseMirror > * {
  cursor: pointer;
  flex: 0 0 2rem !important;
  align-items: center !important;
  margin: 0 !important;
  padding: 4px 8px !important;
  line-height: 1.2 !important;
  display: flex !important;
}

.prose-menubar__picker .ProseMirror > :hover {
  background: var(--_a) !important;
}

.prose-menubar__picker .ProseMirror > .hidden {
  display: none !important;
}

.prose-menubar__picker .ProseMirror button > * {
  margin: 0 !important;
}
