.editorwrap {
  position: relative;
}

.editor {
  min-height: 1.7em;
  outline: none;
}

.editor [data-callout] {
  margin: 12px 0;
  padding: 0.75rem 0.875rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
}

.editor [data-callout="note"] {
  background-color: color-mix(in srgb, #3b82f6 8%, transparent);
  border: 1px solid color-mix(in srgb, #3b82f6 22%, transparent);
}

.editor [data-callout="tip"] {
  background-color: var(--color-success-bg);
  border: 1px solid color-mix(in srgb, var(--color-success-text) 30%, transparent);
}

.editor [data-callout="important"] {
  background-color: color-mix(in srgb, #7c3aed 8%, transparent);
  border: 1px solid color-mix(in srgb, #7c3aed 22%, transparent);
}

.editor [data-callout="warning"] {
  background-color: color-mix(in srgb, #d97706 8%, transparent);
  border: 1px solid color-mix(in srgb, #d97706 22%, transparent);
}

.editor [data-callout="caution"] {
  background-color: var(--color-danger-bg);
  border: 1px solid color-mix(in srgb, var(--color-danger-text) 30%, transparent);
}

.callout-type-picker {
  display: flex;
  gap: 6px;
  margin-bottom: 0.5rem;
}

.callout-type-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.45;
  transition: opacity 0.12s ease, border-color 0.12s ease;
}

.callout-type-btn:hover {
  opacity: 0.75;
}

.callout-type-btn--active {
  opacity: 1;
  border-color: var(--color-text);
}

.callout-type-btn--note { background-color: #3b82f6; }
.callout-type-btn--tip { background-color: var(--color-success-text); }
.callout-type-btn--important { background-color: #7c3aed; }
.callout-type-btn--warning { background-color: #d97706; }
.callout-type-btn--caution { background-color: var(--color-danger-text); }

.checklist-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-right: 8px;
  flex-shrink: 0;
  border: 1.5px solid var(--color-border);
  border-radius: 4px;
  color: transparent;
  cursor: pointer;
  vertical-align: -3px;
}

.checklist-box[data-checked="true"] {
  background-color: var(--color-map-green);
  border-color: var(--color-map-green);
  color: #ffffff;
}

.editor ul[data-checklist] {
  padding-left: 0;
}

.editor ul[data-checklist] > li {
  list-style: none;
}

.editor table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  font-size: 0.875rem;
}

.editor th,
.editor td {
  border: 1px solid var(--color-border);
  padding: 0.4375rem 0.6875rem;
  text-align: left;
  min-width: 72px;
}

.editor th {
  background-color: var(--color-bg);
  font-weight: 600;
}

.editor__placeholder {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  font-size: 0.9375rem;
  line-height: 1.7;
  color: color-mix(in srgb, var(--color-text-muted) 55%, transparent);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.editor__placeholder[hidden] {
  display: none;
}

.editor__placeholder::before {
  content: "/";
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--color-brand);
  margin-right: 4px;
}

.editor__placeholder--plain::before {
  content: none;
  margin-right: 0;
}

/* Floating selection toolbar */
.seltoolbar[hidden] {
  display: none;
}

.seltoolbar {
  position: absolute;
  z-index: 25;
  display: flex;
  gap: 2px;
  padding: 4px;
  border-radius: var(--radius-sm);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
}

.seltoolbar__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
}

.seltoolbar__btn:hover {
  background-color: var(--color-bg);
  color: var(--color-text);
}

.seltoolbar__btn--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
}

.seltoolbar__divider {
  width: 1px;
  margin: 4px 2px;
  background-color: var(--color-border);
}

/* Slash command menu */
.slashmenu {
  position: absolute;
  z-index: 20;
  width: 260px;
  max-height: 320px;
  overflow-y: auto;
  padding: 6px;
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
}

.slashmenu__hd {
  padding: 6px 8px 8px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.slashmenu__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 8px 9px;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: left;
}

.slashmenu__item[hidden] {
  display: none;
}

.slashmenu__item:hover,
.slashmenu__item--active {
  background-color: var(--color-bg);
}

.slashmenu__icon {
  width: 30px;
  height: 30px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background-color: var(--color-bg);
  border: 1px solid var(--color-border);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--color-text-muted);
}

.slashmenu__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.slashmenu__label {
  font-size: 0.84375rem;
  font-weight: 600;
  color: var(--color-text);
}

.slashmenu__hint {
  font-size: 0.71875rem;
  color: var(--color-text-muted);
}
