/* Eduzix TipTap / ProseMirror writing surface */
.ProseMirror {
  position: relative;
  word-wrap: break-word;
  white-space: pre-wrap;
  -webkit-font-variant-ligatures: none;
  font-variant-ligatures: none;
  outline: none;
}
.ProseMirror pre { white-space: pre-wrap; }
.ProseMirror li { position: relative; }
.ProseMirror-hideselection *::selection { background: transparent; }
.ProseMirror-selectednode { outline: 2px solid #1b7a64; }
.ProseMirror-gapcursor { display: none; pointer-events: none; position: absolute; }
.ProseMirror-gapcursor:after {
  content: "";
  display: block;
  position: absolute;
  top: -2px;
  width: 20px;
  border-top: 1px solid var(--ink);
  animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink { to { visibility: hidden; } }
.ProseMirror-focused .ProseMirror-gapcursor { display: block; }
.tableWrapper { overflow-x: auto; margin: 0.6em 0; }
.ProseMirror table { border-collapse: collapse; table-layout: auto; width: 100%; }
.ProseMirror td, .ProseMirror th {
  border: 1px solid #c9c1b0;
  min-width: 48px;
  padding: 6px 8px;
  vertical-align: top;
}
.ProseMirror th { background: #f4efe6; font-weight: 650; }
.ProseMirror .column-resize-handle {
  position: absolute; right: -2px; top: 0; bottom: 0; width: 4px;
  background: #1b7a64; pointer-events: none;
}
.ProseMirror.resize-cursor { cursor: ew-resize; }

.rte-wrap {
  border: 1px solid var(--line-2);
  background: var(--white);
  border-radius: 14px;
  overflow: hidden;
  margin: 0 0 4px;
  position: relative;
  max-width: 100%;
  display: flex;
  flex-direction: column;
}
.rte-wrap:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(27, 122, 100, 0.12);
}
.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 12px;
  background: #f7f3ea;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 4;
  flex: 0 0 auto;
}
.rte-btn, .rte-select {
  border: 0;
  background: transparent;
  color: var(--ink);
  border-radius: 8px;
  min-width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.rte-select {
  font-weight: 600;
  max-width: 132px;
  background: #fff;
  border: 1px solid var(--line);
}
.rte-btn:hover { background: #efe8d8; }
.rte-btn.on { background: var(--ink); color: #f4efe6; }
.rte-btn[disabled] { opacity: 0.4; cursor: default; }
.rte-btn-italic { font-style: italic; font-family: var(--serif); }
.rte-btn-underline { text-decoration: underline; }
.rte-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.rte-sep {
  width: 1px;
  background: var(--line-2);
  margin: 6px 8px;
  align-self: stretch;
}
.rte-color {
  width: 32px; height: 32px; padding: 0; border: 0; background: transparent; cursor: pointer;
}
.rte-workspace {
  background: #e6e4df;
  overflow-x: auto;
  overflow-y: scroll;
  flex: 1 1 auto;
  min-height: 220px;
  max-height: min(78dvh, calc(100dvh - 180px));
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  scrollbar-width: auto;
  scrollbar-color: #9a9488 #e6e4df;
}
.rte-workspace::-webkit-scrollbar { width: 12px; height: 12px; }
.rte-workspace::-webkit-scrollbar-thumb {
  background: #9a9488;
  border-radius: 8px;
  border: 2px solid #e6e4df;
}
.rte-workspace::-webkit-scrollbar-track { background: #ddd9d1; }
.rte-canvas {
  position: relative;
  width: var(--rte-page-w, 816px);
  max-width: 100%;
  margin: 20px auto 36px;
  min-height: var(--rte-page-h, 1056px);
}
.rte-sheets {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 0;
}
.rte-sheet {
  position: absolute;
  left: 0;
  width: 100%;
  height: var(--rte-page-h, 1056px);
  background: #fff;
  box-shadow: 0 1px 2px rgba(40, 32, 18, 0.16), 0 10px 28px rgba(40, 32, 18, 0.1);
  border-radius: 0;
}
.rte-sheet-head, .rte-sheet-foot {
  position: absolute;
  left: var(--rte-page-m, 72px);
  right: var(--rte-page-m, 72px);
  font-size: 11px;
  color: #7a7468;
  text-align: center;
  letter-spacing: 0.04em;
}
.rte-sheet-head { top: 18px; }
.rte-sheet-foot { bottom: 16px; }
.rte-sheet-mark {
  position: absolute;
  inset: 28% 8%;
  text-align: center;
  font-size: 64px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(28, 24, 18, 0.07);
  transform: rotate(-24deg);
}
.rte-surface {
  min-height: 140px;
  padding: 12px 14px 16px;
  background: var(--white);
  position: relative;
  z-index: 1;
}
.rte-tall .rte-surface { min-height: 280px; }
.rte-compact .rte-workspace { max-height: 240px; min-height: 96px; }
.rte-compact .rte-canvas { width: auto; margin: 8px; min-height: 0; }
.rte-compact .rte-sheets { display: none; }
.rte-compact .rte-surface {
  min-height: 96px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(40, 32, 18, 0.08);
}
.rte-paged .rte-surface {
  width: 100%;
  min-height: var(--rte-page-h, 1056px);
  padding: var(--rte-page-m, 72px);
  box-sizing: border-box;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.rte-studio .rte-workspace { max-height: min(82dvh, calc(100dvh - 160px)); }
.rte-status { flex: 0 0 auto; }

/* Editor lab: fill the content pane. Sidebar + Eduzix header stay put; only the gray canvas scrolls. */
body[data-page="editor"] .content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  max-width: none;
  padding-bottom: 12px;
}
body[data-page="editor"] .editor-intro {
  flex: 0 0 auto;
  margin-bottom: 6px;
}
.editor-honest {
  font-size: 13px;
  color: var(--sage);
  margin: 0 0 4px;
}
.editor-honest summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--ink-3);
}
.editor-honest p.muted { margin: 8px 0 0; }
body[data-page="editor"] .editor-intro h1 { margin: 0.15em 0 0.25em; }
body[data-page="editor"] .editor-app {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}
body[data-page="editor"] .editor-app > div:first-child {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body[data-page="editor"] .editor-studio-form {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
body[data-page="editor"] .rte-wrap {
  flex: 1 1 auto;
  min-height: 240px;
  margin-bottom: 0;
}
body[data-page="editor"] .rte-workspace {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: none;
}
body[data-page="editor"] .editor-app > div:last-child {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 1099px) {
  body[data-page="editor"] .content {
    overflow: hidden;
    padding: 10px 10px 8px;
  }
  body[data-page="editor"] .editor-app {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    grid-template-columns: none;
  }
  body[data-page="editor"] .editor-app > div:first-child {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  body[data-page="editor"] .editor-studio-form {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
  }
  body[data-page="editor"] .rte-wrap {
    flex: 1 1 auto;
    min-height: 0;
  }
  body[data-page="editor"] .rte-workspace {
    max-height: none;
    min-height: 160px;
  }
  body[data-page="editor"] .editor-app > div:last-child {
    flex: 0 0 auto;
    max-height: 22vh;
    overflow-y: auto;
  }
}
.rte-surface .rte-doc,
.rte-surface.ProseMirror {
  outline: none;
  min-height: inherit;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
}
.rte-surface.rte-empty::before,
.ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  color: var(--sage);
  pointer-events: none;
  float: left;
  height: 0;
}
.rte-source {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  border: 0 !important;
  min-height: 0 !important;
  opacity: 0 !important;
}
.rte-htmlview {
  display: none;
  width: 100%;
  min-height: 240px;
  border: 0;
  padding: 12px 14px;
  font-family: var(--mono);
  font-size: 13px;
  background: #1d2421;
  color: #e8efe8;
}
.rte-wrap.rte-source-on .rte-htmlview { display: block; }
.rte-wrap.rte-source-on .rte-surface,
.rte-wrap.rte-source-on .rte-page,
.rte-wrap.rte-source-on .rte-workspace { display: none; }

.rte-doc p, .ProseMirror p { margin: 0 0 0.7em; }
.rte-doc h1, .rte-doc h2, .rte-doc h3, .rte-doc h4, .rte-doc h5, .rte-doc h6,
.ProseMirror h1, .ProseMirror h2, .ProseMirror h3, .ProseMirror h4, .ProseMirror h5, .ProseMirror h6 {
  font-family: var(--serif);
  font-weight: 650;
  line-height: 1.25;
  margin: 1em 0 0.45em;
}
.ProseMirror h1 { font-size: 1.55em; }
.ProseMirror h2 { font-size: 1.28em; }
.ProseMirror h3 { font-size: 1.12em; }
.ProseMirror ul, .ProseMirror ol { margin: 0 0 0.8em 1.3em; padding: 0; }
.ProseMirror li { margin: 0.2em 0; }
.ProseMirror blockquote {
  margin: 0.6em 0 0.8em;
  padding: 0.15em 0 0.15em 0.9em;
  border-left: 3px solid var(--paper-2);
  color: var(--ink-3);
}
.ProseMirror pre, .ProseMirror code { font-family: var(--mono); font-size: 0.88em; }
.ProseMirror pre {
  background: #1e2420;
  color: #e7eee8;
  border-radius: 10px;
  padding: 10px 12px;
  overflow: auto;
}
.ProseMirror a { color: var(--teal-2); }
.ProseMirror hr { border: 0; border-top: 1px solid var(--line-2); margin: 1em 0; }
.ProseMirror hr.rte-page-break {
  border: 0;
  height: var(--rte-break-h, 176px);
  margin: 0 calc(-1 * var(--rte-page-m, 72px));
  background: transparent;
  page-break-after: always;
  break-after: page;
}
.ProseMirror img { max-width: 100%; height: auto; }
.ProseMirror img.ProseMirror-selectednode { outline: 2px solid #1b7a64; }
.ProseMirror figure { margin: 0.8em 0; }
.ProseMirror figcaption { font-size: 0.9em; color: var(--ink-3); text-align: center; }
.ProseMirror ul[data-type="taskList"] { list-style: none; margin-left: 0.2em; }
.ProseMirror ul[data-type="taskList"] li { display: flex; gap: 8px; }
.ProseMirror ul[data-type="taskList"] li input { margin-top: 0.35em; }
.ProseMirror mark { background: #ffe08a; padding: 0 0.12em; }
.ProseMirror .rte-mention { color: #1b7a64; font-weight: 650; }
.ProseMirror .rte-comment { background: #fff3bf; border-bottom: 2px solid #e0b400; }
.ProseMirror ins.rte-ins, .ProseMirror .rte-ins { background: #d8f3e2; text-decoration: none; }
.ProseMirror del.rte-del, .ProseMirror .rte-del { background: #f8d4cc; text-decoration: line-through; }
.ProseMirror .rte-columns { display: grid; gap: 1.2em; margin: 0.8em 0; }
.ProseMirror .rte-columns[data-cols="2"] { grid-template-columns: 1fr 1fr; }
.ProseMirror .rte-columns[data-cols="3"] { grid-template-columns: 1fr 1fr 1fr; }
.ProseMirror iframe, .ProseMirror video { max-width: 100%; border: 0; border-radius: 10px; }
.ProseMirror .rte-file {
  display: inline-flex; gap: 8px; align-items: center;
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  text-decoration: none; color: var(--ink);
}

.rte-status {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 6px 12px; font-size: 12px; color: var(--ink-3);
  border-top: 1px solid var(--line); background: #faf7f0;
}
.rte-bubble, .rte-ctx, .rte-slash, .rte-mention-menu {
  position: absolute; z-index: 20;
  background: #fff; border: 1px solid var(--line);
  border-radius: 10px; box-shadow: 0 10px 30px rgba(40,32,18,.14);
  padding: 4px; display: none;
}
.rte-bubble.on, .rte-ctx.on, .rte-slash.on, .rte-mention-menu.on { display: flex; flex-wrap: wrap; gap: 2px; }
.rte-slash, .rte-mention-menu, .rte-ctx { flex-direction: column; min-width: 220px; max-height: 280px; overflow: auto; }
.rte-slash button, .rte-mention-menu button, .rte-ctx button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 8px 10px; cursor: pointer; font-size: 13px; border-radius: 8px;
}
.rte-slash button:hover, .rte-mention-menu button:hover, .rte-ctx button:hover,
.rte-slash button.on { background: #f4efe6; }
.rte-dialog {
  position: absolute; inset: 0; background: rgba(28,24,18,.35);
  display: none; align-items: flex-start; justify-content: center; z-index: 30; padding: 40px 16px;
}
.rte-dialog.on { display: flex; }
.rte-dialog-card {
  background: #fff; border-radius: 14px; padding: 16px; max-width: 520px; width: 100%;
  box-shadow: 0 16px 40px rgba(20,16,10,.2);
}
.rte-dialog-card h3 { margin: 0 0 10px; font-family: var(--serif); }
.rte-dialog-card .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rte-chargrid, .rte-emogrid {
  display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; max-height: 240px; overflow: auto;
}
.rte-chargrid button, .rte-emogrid button {
  border: 1px solid var(--line); background: #fff; border-radius: 8px; height: 32px; cursor: pointer;
}
.rte-tablegrid { display: grid; grid-template-columns: repeat(10, 16px); gap: 3px; padding: 8px; }
.rte-tablegrid i { width: 16px; height: 16px; border: 1px solid #c9c1b0; display: block; }
.rte-tablegrid i.on { background: #1b7a64; border-color: #1b7a64; }

.rte-wrap.rte-full {
  position: fixed; inset: 8px; z-index: 80; margin: 0; border-radius: 12px;
  display: flex; flex-direction: column; background: #e6e4df;
}
.rte-wrap.rte-full .rte-workspace { flex: 1; max-height: none; }
.rte-wrap.rte-dark { background: #161a18; color: #e8efe8; }
.rte-wrap.rte-dark .rte-toolbar, .rte-wrap.rte-dark .rte-status { background: #1e2421; border-color: #2c3530; color: #d7e0d8; }
.rte-wrap.rte-dark .rte-workspace { background: #121614; scrollbar-color: #4a524c #121614; }
.rte-wrap.rte-dark .rte-sheet { background: #1a201d; }
.rte-wrap.rte-dark .rte-surface, .rte-wrap.rte-dark .rte-paged .rte-surface { color: #e8efe8; }
.rte-wrap.rte-dark .rte-btn { color: #e8efe8; }
.rte-wrap.rte-dark .rte-btn:hover { background: #2a332e; }
.rte-wrap.rte-readonly .rte-toolbar { display: none; }
.rte-wrap.rte-painter-on { cursor: copy; }
.rte-wrap.rte-painter-on .rte-surface { cursor: copy; }
.ProseMirror .rte-math {
  font-family: "Cambria Math", "Times New Roman", serif;
  font-style: italic;
  padding: 0 0.15em;
  background: #f4efe6;
  border-radius: 4px;
}
.rte-proof-item { padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.rte-pagechrome { position: relative; }
.rte-header, .rte-footer { text-align: center; font-size: 12px; color: var(--ink-3); padding: 4px 12px; }
.rte-watermark {
  position: absolute; inset: 20% 0 auto; text-align: center;
  font-size: 64px; font-weight: 700; letter-spacing: 0.2em;
  color: rgba(28,24,18,0.08); transform: rotate(-24deg); pointer-events: none;
}
.editor-app { display: grid; gap: 16px; align-items: start; }
@media (min-width: 1100px) {
  .editor-app { grid-template-columns: minmax(0, 1fr) 260px; }
}

.prose { white-space: normal; font-family: var(--serif); line-height: 1.65; }
.prose p { margin: 0 0 0.75em; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: var(--serif); font-weight: 650; line-height: 1.25; margin: 1em 0 0.4em; }
.prose ul, .prose ol { margin: 0 0 0.8em 1.3em; }
.prose blockquote { margin: 0.6em 0; padding-left: 0.9em; border-left: 3px solid var(--paper-2); }
.prose a { color: var(--teal-2); }
.prose table { border-collapse: collapse; width: 100%; margin: 0.6em 0; }
.prose td, .prose th { border: 1px solid #c9c1b0; padding: 6px 8px; }
.prose img { max-width: 100%; }
.paper-page:has(.prose) { white-space: normal; }
.paper-page .prose { font-size: inherit; }

.hljs-keyword, .hljs-selector-tag { color: #7dd3a0; }
.hljs-string { color: #e7c07b; }
.hljs-comment { color: #8a948c; font-style: italic; }
.hljs-number { color: #d4a5ff; }
.hljs-function, .hljs-title { color: #9cdcfe; }

body[data-lite="1"] .rte-toolbar { gap: 4px; padding: 8px; }
body[data-lite="1"] .rte-btn { min-width: 32px; height: 32px; padding: 4px 8px; }
body[data-lite="1"] .rte-studio .rte-page { padding: 8px; }
@media (max-width: 768px) {
  .rte-btn { min-width: 40px; min-height: 40px; height: 40px; padding: 8px 12px; }
  .rte-studio .rte-surface { padding: 20px 14px; min-height: 420px; }
  .rte-select { max-width: 120px; }
  .rte-toolbar { max-width: 100%; gap: 8px; padding: 10px 12px; }
  .ProseMirror .rte-columns[data-cols="2"],
  .ProseMirror .rte-columns[data-cols="3"] { grid-template-columns: 1fr; }
}
@media print {
  .rte-toolbar, .rte-status, .rte-bubble, .rte-dialog, .rail, .top, .rte-ctx { display: none !important; }
  .rte-wrap, .rte-studio .rte-surface { box-shadow: none; border: 0; }
  .rte-page-break { page-break-after: always; }
}

/* Eduzix office chrome — paged/studio only. Compact/lite stay a small toolbar. Not Microsoft Word. */
.rte-office {
  border-radius: 0;
  border-color: #8a8a8a;
  background: #f0f0f0;
}
.rte-office:focus-within {
  border-color: #2b579a;
  box-shadow: none;
}
.rte-titlebar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px 0 8px;
  background: #2b579a;
  color: #fff;
  user-select: none;
}
.rte-qat { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.rte-doctitle {
  flex: 1 1 auto;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rte-title-right { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.rte-signin {
  color: #fff;
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 2px;
}
.rte-signin:hover { background: rgba(255,255,255,0.12); color: #fff; }
.rte-titlebar .rte-rbtn {
  color: #fff;
  min-width: 36px;
  min-height: 28px;
  height: 28px;
  padding: 4px 10px;
  border-radius: 2px;
  font-weight: 600;
  font-size: 13px;
}
.rte-titlebar .rte-rbtn:hover { background: rgba(255,255,255,0.14); }

.rte-office .rte-toolbar.rte-ribbon {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0;
  background: #f3f2f1;
  border-bottom: 1px solid #d0d0d0;
  position: relative;
  top: auto;
  z-index: 6;
  flex: 0 0 auto;
}
.rte-tabs {
  display: flex;
  align-items: stretch;
  gap: 0;
  background: #fff;
  border-bottom: 1px solid #d0d0d0;
  overflow-x: auto;
  scrollbar-width: none;
}
.rte-tabs::-webkit-scrollbar { display: none; }
.rte-tab {
  border: 0;
  background: transparent;
  color: #252423;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.04em;
  padding: 10px 16px 8px;
  cursor: pointer;
  white-space: nowrap;
}
.rte-tab:hover { background: #f3f2f1; }
.rte-tab.on {
  background: #f3f2f1;
  border-bottom: 2px solid #2b579a;
  margin-bottom: -1px;
}
.rte-tab-file {
  background: #2b579a;
  color: #fff;
  font-weight: 700;
}
.rte-tab-file:hover { background: #234a84; color: #fff; }
.rte-tab-file.on { background: #2b579a; color: #fff; border-bottom-color: #2b579a; }
.rte-ribbon-body {
  min-height: 92px;
  padding: 4px 6px 2px;
  overflow-x: auto;
}
.rte-ribbon-panel { display: none; align-items: stretch; gap: 0; min-height: 86px; }
.rte-ribbon-panel.on { display: flex; }
.rte-group {
  display: flex;
  flex-direction: column;
  padding: 2px 8px 0;
  border-right: 1px solid #e1dfdd;
  min-width: 0;
}
.rte-group-tools { display: flex; align-items: flex-start; gap: 2px; flex: 1 1 auto; }
.rte-group-label {
  font-size: 10px;
  color: #605e5c;
  text-align: center;
  padding: 2px 0 3px;
  letter-spacing: 0.02em;
}
.rte-stack { display: flex; flex-direction: column; gap: 1px; }
.rte-font-row { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.rte-rbtn {
  border: 0;
  background: transparent;
  color: #252423;
  border-radius: 2px;
  min-width: 26px;
  height: 24px;
  padding: 0 7px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rte-rbtn:hover { background: #e1dfdd; }
.rte-rbtn.on { background: #c5e0f7; color: #252423; }
.rte-rbtn-lg {
  min-width: 52px;
  height: 52px;
  flex-direction: column;
  font-size: 13px;
}
.rte-office .rte-select {
  height: 22px;
  min-width: 0;
  max-width: 148px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  border: 1px solid #8a8886;
}
.rte-select-font { max-width: 148px; width: 148px; }
.rte-select-size { max-width: 52px; width: 52px; }
.rte-office .rte-color { width: 22px; height: 22px; }
.rte-styles {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  max-width: min(420px, 36vw);
  padding: 2px 0;
}
.rte-style {
  border: 1px solid #c8c6c4;
  background: #fff;
  min-width: 64px;
  height: 58px;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 10px;
  color: #323130;
}
.rte-style:hover { border-color: #2b579a; background: #deecf9; }
.rte-style-preview {
  font-family: "Times New Roman", Times, serif;
  font-size: 13px;
  line-height: 1.1;
  color: #201f1e;
}
.rte-honest {
  max-width: 280px;
  font-size: 12px;
  color: #605e5c;
  padding: 8px 6px;
  line-height: 1.4;
}

.rte-ruler {
  position: relative;
  background: #f3f2f1;
  color: #605e5c;
  flex: 0 0 auto;
  overflow: hidden;
  font-size: 9px;
  user-select: none;
}
.rte-ruler-h {
  height: 20px;
  border-bottom: 1px solid #d0d0d0;
  margin-left: 20px;
}
.rte-ruler-v {
  width: 20px;
  border-right: 1px solid #d0d0d0;
  flex: 0 0 20px;
  align-self: stretch;
}
.rte-ruler i {
  position: absolute;
  background: #8a8886;
  display: block;
}
.rte-ruler-h i { width: 1px; height: 4px; top: 16px; }
.rte-ruler-h i.rte-tick-in { height: 10px; top: 10px; }
.rte-ruler-h i.half { height: 7px; top: 13px; }
.rte-ruler-v i { height: 1px; width: 4px; left: 16px; }
.rte-ruler-v i.rte-tick-in { width: 10px; left: 10px; }
.rte-ruler-v i.half { width: 7px; left: 13px; }
.rte-tick-n {
  position: absolute;
  font-weight: 600;
  color: #605e5c;
  pointer-events: none;
}
.rte-ruler-h .rte-tick-n { top: 1px; transform: translateX(-50%); }
.rte-ruler-v .rte-tick-n { left: 1px; transform: translateY(-50%); }
.rte-indent-l, .rte-indent-r {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 7px solid #2b579a;
  top: 2px !important;
}
.rte-indent-r { border-top: 0; border-bottom: 7px solid #2b579a; top: 10px !important; }

.rte-stage {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  background: #f0f0f0;
}
.rte-office .rte-workspace {
  background: #f0f0f0;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  scrollbar-color: #a19f9d #f0f0f0;
}
.rte-office .rte-workspace::-webkit-scrollbar-track { background: #e6e6e6; }
.rte-office .rte-workspace::-webkit-scrollbar-thumb {
  background: #a19f9d;
  border: 2px solid #f0f0f0;
}
.rte-zoom-host {
  margin: 18px auto 40px;
  position: relative;
}
.rte-office .rte-canvas {
  margin: 0 auto;
  background: transparent;
}
.rte-office .rte-sheet {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.rte-office .rte-surface .rte-doc,
.rte-office .rte-surface.ProseMirror {
  font-family: "Times New Roman", Times, "Liberation Serif", serif;
  font-size: 16px;
  line-height: 1.15;
  color: #000;
}

.rte-office .rte-status.rte-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: nowrap;
  height: 32px;
  min-height: 32px;
  padding: 0 12px;
  background: #2b579a;
  color: #fff;
  border-top: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.rte-sb-left, .rte-sb-right { display: flex; align-items: center; gap: 10px; }
.rte-statusbar .rte-rbtn {
  color: #fff;
  height: 26px;
  min-height: 26px;
  min-width: 32px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 650;
}
.rte-statusbar .rte-rbtn:hover { background: rgba(255,255,255,0.14); }
.rte-statusbar .rte-rbtn.on { background: rgba(255,255,255,0.22); color: #fff; }
.rte-zoom-range {
  width: 88px;
  height: 16px;
  accent-color: #fff;
  cursor: pointer;
}
.rte-zoom-val {
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 40px;
  cursor: pointer;
}

.rte-office.rte-marks .ProseMirror p::after {
  content: "¶";
  color: #a19f9d;
  margin-left: 4px;
  font-size: 12px;
}
.rte-office.rte-borders-on .ProseMirror p,
.rte-office.rte-borders-on .ProseMirror h1,
.rte-office.rte-borders-on .ProseMirror h2,
.rte-office.rte-borders-on .ProseMirror h3 {
  outline: 1px solid #c8c6c4;
}
.rte-office.rte-web .rte-sheets { display: none; }
.rte-office.rte-web .rte-canvas,
.rte-office.rte-web .rte-zoom-host { width: auto; max-width: 900px; min-height: 0; }
.rte-office.rte-web .rte-surface {
  background: #fff;
  padding: 24px 28px;
  min-height: 480px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.rte-office.rte-read .rte-ribbon-body { display: none; }
.rte-office.rte-read .rte-ruler { display: none; }
.rte-office.rte-read .rte-surface { max-width: 720px; margin: 0 auto; }

.rte-wrap.rte-source-on .rte-stage,
.rte-wrap.rte-source-on .rte-ruler,
.rte-wrap.rte-source-on .rte-titlebar { display: none; }
.rte-office.rte-source-on .rte-htmlview { display: block; flex: 1 1 auto; }

body[data-page="editor"] .rte-office { min-height: 0; }
body[data-page="editor"] .rte-office .rte-stage {
  flex: 1 1 auto;
  min-height: 0;
}
body[data-page="editor"] .rte-office .rte-workspace {
  max-height: none;
  min-height: 160px;
}

.rte-office.rte-full {
  inset: 0;
  border-radius: 0;
  background: #f0f0f0;
}
.rte-office.rte-full .rte-stage { flex: 1 1 auto; }
.rte-office.rte-dark .rte-titlebar,
.rte-office.rte-dark .rte-statusbar { background: #1b365c; }
.rte-office.rte-dark .rte-ribbon { background: #252423; }
.rte-office.rte-dark .rte-workspace,
.rte-office.rte-dark .rte-stage { background: #201f1e; }

.rte-compact .rte-titlebar,
.rte-compact .rte-ribbon,
.rte-compact .rte-ruler,
.rte-compact .rte-statusbar { display: none; }

@media (max-width: 768px) {
  /* Same office editor as desktop. Ribbon scrolls sideways; it is not a second compact editor. */
  .rte-office {
    border-radius: 0;
    min-height: 0;
  }
  .rte-office .rte-ribbon-body {
    min-height: 112px;
    max-height: none;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
  }
  .rte-ribbon-panel.on {
    flex-wrap: nowrap;
    min-height: 96px;
    align-items: stretch;
  }
  .rte-group {
    border-right: 1px solid #e1dfdd;
    border-bottom: 0;
    padding: 4px 12px 0;
    flex: 0 0 auto;
  }
  .rte-styles { max-width: min(420px, 70vw); }
  .rte-ruler-v { display: block; }
  .rte-ruler-h { margin-left: 20px; height: 20px; }
  .rte-tab { padding: 10px 16px 8px; font-size: 13px; }
  .rte-doctitle { font-size: 13px; }
  .rte-titlebar .rte-signin,
  .rte-titlebar [data-cmd="chromeMin"],
  .rte-titlebar [data-cmd="chromeClose"] { display: none; }
  .rte-office .rte-status.rte-statusbar {
    flex-wrap: nowrap;
    height: 32px;
    min-height: 32px;
    padding: 0 12px;
    gap: 10px;
    overflow-x: auto;
  }
  .rte-zoom-range { width: 88px; }
  .rte-rbtn-lg { min-width: 64px; min-height: 64px; height: 64px; font-size: 14px; }
  .rte-office .rte-workspace { min-height: 180px; }
  .rte-zoom-host { margin: 18px auto 40px; }
  .rte-dialog { padding: 40px 16px; align-items: flex-start; }
  .rte-dialog-card { max-width: 520px; border-radius: 14px; }
  .rte-narrow .rte-honest { max-width: 280px; }
}
@media print {
  .rte-titlebar, .rte-ribbon, .rte-ruler, .rte-statusbar, .rte-stage .rte-ruler-v { display: none !important; }
  .rte-office, .rte-office .rte-workspace { background: #fff; overflow: visible; }
  .rte-office .rte-sheet { box-shadow: none; }
}

/* Classic Visual/Text chrome — not WordPress, not Microsoft Word */
.rte-classic {
  border: 1px solid #ddd;
  border-radius: 2px;
  background: #fff;
  box-shadow: none;
}
.rte-classic:focus-within {
  border-color: #8c8f94;
  box-shadow: 0 0 0 1px #8c8f94;
}
.rte-classic-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px 0;
  background: #f0f0f1;
  border-bottom: 0;
}
.rte-add-media {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #c3c4c7;
  background: #f6f7f7;
  color: #2c3338;
  border-radius: 3px;
  min-height: 36px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.rte-add-media:hover { background: #fff; }
.rte-view-tabs {
  display: flex;
  margin-left: auto;
}
.rte-view {
  border: 1px solid #c3c4c7;
  border-bottom: 0;
  background: #dcdcde;
  color: #2c3338;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px 3px 0 0;
  margin-left: 4px;
}
.rte-view.on {
  background: #f6f7f7;
  border-color: #c3c4c7;
  position: relative;
  z-index: 1;
}
.rte-classic-bar {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 0;
  padding: 0;
  background: #f6f7f7;
  border-bottom: 1px solid #dcdcde;
  position: sticky;
  top: 0;
  z-index: 4;
}
.rte-classic-rows {
  display: flex;
  flex-direction: column;
  width: 100%;
}
.rte-classic-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-top: 1px solid #dcdcde;
}
.rte-classic-bar .rte-btn,
.rte-classic-bar .rte-select {
  border: 1px solid transparent;
  background: transparent;
  color: #2c3338;
  border-radius: 2px;
  min-width: 32px;
  min-height: 32px;
  height: 32px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 700;
}
.rte-classic-bar .rte-btn:hover { background: #fff; border-color: #c3c4c7; }
.rte-classic-bar .rte-btn.on { background: #fff; border-color: #8c8f94; }
.rte-classic-bar .rte-select {
  font-weight: 600;
  max-width: 168px;
  background: #fff;
  border: 1px solid #8c8f94;
  min-height: 32px;
  height: 32px;
}
.rte-classic.rte-compact .rte-classic-bar .rte-btn,
.rte-classic.rte-compact .rte-add-media {
  min-height: 36px;
  height: 36px;
  padding: 10px 12px;
}
.rte-classic .rte-workspace {
  background: #fff;
  padding: 12px 16px 24px;
}
.rte-classic .rte-surface,
.rte-classic .ProseMirror {
  min-height: 220px;
  font-size: 16px;
  line-height: 1.7;
  color: #1d2327;
}
.rte-classic .rte-status { display: none; }
.rte-kitchen-off .rte-classic-row2 { display: none; }
.rte-classic.rte-source-on .rte-htmlview {
  display: block;
  min-height: 220px;
  width: 100%;
  border: 0;
  padding: 16px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 13px;
}
@media (max-width: 768px) {
  /* Same classic editor as desktop. Toolbar wraps; it is not a second compact editor. */
  .rte-classic .rte-classic-bar { overflow-x: auto; }
  .rte-classic-chrome { flex-wrap: wrap; }
}

/* ── Academic ribbon ────────────────────────────────────────────────────
   Grouped tab ribbon replacing the old two-row toolbar. Groups are labelled
   underneath (Word convention) so a dense strip of glyph buttons is still
   legible; controls wrap rather than scroll horizontally, because a
   half-visible References group is worse than a two-line one. */
.rte-ribbon{border-bottom:1px solid var(--rte-line,#ddd8d2);background:var(--rte-bar,#faf9f7)}
.rte-ribbon-tabs{display:flex;align-items:stretch;gap:2px;padding:0 8px;border-bottom:1px solid var(--rte-line,#ddd8d2)}
.rte-ribbon-tab{appearance:none;background:none;border:0;border-bottom:2px solid transparent;
  padding:8px 14px;font-size:13px;font-weight:500;color:#5a5450;cursor:pointer;white-space:nowrap}
.rte-ribbon-tab:hover{background:rgba(0,0,0,.04)}
.rte-ribbon-tab.on{color:#1c1916;border-bottom-color:#2f7d73;background:#fff}
.rte-ribbon-tab:focus-visible{outline:2px solid #2f7d73;outline-offset:-2px}
.rte-ribbon-spacer{flex:1}
.rte-ribbon-collapse{appearance:none;background:none;border:0;padding:8px 10px;cursor:pointer;color:#5a5450}

.rte-ribbon-panes{padding:6px 8px}
.rte-ribbon-pane{display:none}
.rte-ribbon-pane.on{display:flex;flex-wrap:wrap;align-items:flex-start;gap:4px}
.rte-ribbon-group{display:flex;flex-direction:column;gap:4px;padding:4px 10px 2px;
  border-right:1px solid var(--rte-line,#e5e1db);min-width:0}
.rte-ribbon-group:last-child{border-right:0}
.rte-ribbon-controls{display:flex;flex-wrap:wrap;align-items:center;gap:2px}
.rte-ribbon-label{font-size:10.5px;color:#8a837d;text-align:center;letter-spacing:.02em;
  text-transform:uppercase;user-select:none}

.rte-ribbon .rte-select{height:28px;font-size:12.5px;max-width:150px}
.rte-ribbon .rte-font{min-width:130px}
.rte-ribbon .rte-size,.rte-ribbon .rte-lh{min-width:84px}
.rte-ribbon .rte-btn{min-width:28px;height:28px;font-size:13px;line-height:1}
.rte-ribbon .rte-color{width:28px;height:28px;padding:0;border:1px solid var(--rte-line,#ddd8d2);
  border-radius:4px;background:none;cursor:pointer}

/* Collapsed state reuses the existing kitchen toggle. */
.rte-kitchen-off .rte-ribbon-panes{display:none}

@media (max-width:820px){
  .rte-ribbon-group{border-right:0;padding:4px 6px}
  .rte-ribbon-label{display:none}
  .rte-ribbon-tab{padding:8px 10px;font-size:12.5px}
}
@media (prefers-color-scheme:dark){
  .rte-ribbon-tab.on{background:#1f1d1b;color:#f2efea}
  .rte-ribbon-label{color:#9a938d}
}
