.dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  grid-template-rows: auto 1fr auto;
}

.editorShell {
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 360px;
  max-height: min(560px, calc(100vh - 200px));
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: var(--color-overlay-dark-3);
  overflow: hidden;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--stroke);
  background: var(--color-panel-2);
}

.toolbarGroup {
  display: flex;
  gap: 2px;
}

.toolbarSep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: var(--stroke-2);
}

.toolBtn {
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: transparent;
  color: var(--text1);
  cursor: pointer;
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
}

.toolBtn:hover:not(:disabled) {
  background: var(--panel);
  color: var(--text0);
}

.toolBtnActive {
  border-color: var(--accent-border);
  background: var(--accent-fill-soft);
  color: var(--accent2);
}

.toolBtn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toolIcon {
  display: block;
}

.editorContent {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px;
}

.editorContent :global(.tiptap) {
  min-height: 280px;
  outline: none;
  color: var(--text0);
  font-size: var(--text-md);
  line-height: 1.55;
  word-break: break-word;
}

.editorContent :global(.tiptap p.is-editor-empty:first-child::before) {
  color: var(--text2);
  content: attr(data-placeholder);
  float: left;
  height: 0;
  pointer-events: none;
}

/* Shared rich-text look (editor + inspector preview) */
.prose :global(p) {
  margin: 0 0 0.65em;
}

.prose :global(p:last-child) {
  margin-bottom: 0;
}

.prose :global(h2),
.prose :global(h3) {
  margin: 0.85em 0 0.4em;
  font-weight: 800;
  color: var(--text0);
  line-height: 1.3;
}

.prose :global(h2) {
  font-size: 1.2em;
}

.prose :global(h3) {
  font-size: 1.08em;
}

.prose :global(ul),
.prose :global(ol) {
  margin: 0 0 0.65em;
  padding-left: 1.35em;
}

.prose :global(li) {
  margin: 0.15em 0;
}

.prose :global(strong) {
  font-weight: 800;
  color: var(--text0);
}

.prose :global(em) {
  font-style: italic;
}

.prose :global(u) {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose :global(a) {
  color: var(--accent2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose :global(blockquote) {
  margin: 0 0 0.65em;
  padding: 0.35em 0 0.35em 0.85em;
  border-left: 3px solid var(--accent-border);
  color: var(--text1);
}

.prose :global(code) {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--color-overlay-dark-4);
  color: var(--text0);
}

.prose :global(pre) {
  margin: 0 0 0.65em;
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--stroke);
  background: var(--color-overlay-dark-5);
  overflow-x: auto;
}

.prose :global(pre code) {
  padding: 0;
  background: transparent;
}
