.cm-rich-editor {
  border: 1px solid var(--shell-border, var(--cm-admin-border, var(--border, #cbd5e1)));
  background: var(--shell-surface-strong, var(--cm-admin-surface, var(--panel-bg, #fff)));
  color: var(--shell-text, var(--cm-admin-text, var(--text, #0b1220)));
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.cm-rich-editor,
.cm-rich-editor * {
  border-radius: 0 !important;
}

.cm-rich-editor__toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  padding: 0.5rem;
  border-bottom: 1px solid var(--shell-border, var(--cm-admin-border, var(--border, #cbd5e1)));
  background: var(--shell-surface-muted, var(--cm-admin-surface-muted, #f8fafc));
}

.cm-rich-editor__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--shell-border-strong, var(--cm-admin-border, #cbd5e1));
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1;
}

.cm-rich-editor__button:hover,
.cm-rich-editor__button:focus-visible {
  border-color: var(--shell-primary, var(--cm-admin-accent, #cb0b0b));
  background: rgba(203, 11, 11, 0.08);
  outline: none;
}

.cm-rich-editor__language {
  min-height: 2rem;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--shell-border-strong, var(--cm-admin-border, #cbd5e1));
  background: var(--shell-surface-strong, var(--cm-admin-surface, #fff));
  color: inherit;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
}

.cm-rich-editor__surface {
  min-height: 10rem;
  padding: 0.85rem 1rem;
  color: inherit;
  line-height: 1.65;
  outline: none;
}

.cm-rich-editor__surface:focus {
  box-shadow: inset 0 0 0 2px rgba(203, 11, 11, 0.24);
}

.cm-rich-editor__surface:empty::before {
  content: attr(data-placeholder);
  color: var(--shell-text-muted, var(--cm-admin-text-muted, var(--muted, #64748b)));
}

.cm-rich-editor__surface p {
  margin: 0 0 0.75rem;
}

.cm-rich-editor__surface h2,
.cm-rich-editor__surface h3,
.cm-rich-editor__surface h4 {
  margin: 0.9rem 0 0.45rem;
  color: inherit;
  font-weight: 800;
  line-height: 1.2;
}

.cm-rich-editor__surface ul,
.cm-rich-editor__surface ol {
  margin: 0.5rem 0 0.8rem 1.25rem;
  padding: 0;
}

.cm-rich-editor__surface table,
.cm-rich-content table {
  width: 100%;
  margin: 0.75rem 0 1rem;
  border-collapse: collapse;
}

.cm-rich-editor__surface th,
.cm-rich-editor__surface td,
.cm-rich-content th,
.cm-rich-content td {
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--shell-border, var(--cm-admin-border, var(--border, #cbd5e1)));
  text-align: left;
  vertical-align: top;
}

.cm-rich-editor__surface th,
.cm-rich-content th {
  background: var(--shell-surface-muted, var(--cm-admin-surface-muted, #f8fafc));
  font-weight: 800;
}

.cm-rich-editor__source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

.cm-rich-editor__source:focus + .cm-rich-editor,
.cm-rich-editor:focus-within {
  border-color: var(--shell-primary, var(--cm-admin-accent, #cb0b0b));
}

.cm-rich-content {
  line-height: 1.7;
}

.cm-rich-content p {
  margin: 0 0 0.85rem;
}

.cm-rich-content h2,
.cm-rich-content h3,
.cm-rich-content h4 {
  margin: 1rem 0 0.45rem;
  font-weight: 800;
  line-height: 1.2;
}

.cm-rich-content ul,
.cm-rich-content ol {
  margin: 0.5rem 0 0.85rem 1.25rem;
}

.cm-rich-content a {
  color: var(--shell-primary, var(--cm-admin-accent, var(--link, #cb0b0b)));
  font-weight: 700;
  text-decoration: underline;
}
