.rich-body { overflow-wrap:anywhere; }
.rich-body img,.rich-surface img { max-width:100%;height:auto; }
.rich-body img[data-align="center"],.rich-surface img[data-align="center"] { display:block;margin-inline:auto; }
.rich-body img[data-align="right"],.rich-surface img[data-align="right"] { display:block;margin-inline-start:auto; }
.rich-body figure,.rich-surface figure { margin:1em 0; }
.rich-body figcaption,.rich-surface figcaption { font-size:.875em; }
.rich-body table,.rich-surface table { border-collapse:collapse;max-width:100%; }
.rich-body td,.rich-body th,.rich-surface td,.rich-surface th { border:1px solid currentColor;padding:.45em;min-width:2em;position:relative; }
.rich-body iframe,.rich-surface iframe { display:block;max-width:100%;border:0;aspect-ratio:16/9;height:auto; }
.rich-body [data-columns],.rich-surface [data-columns] { display:flex;flex-wrap:wrap;gap:1rem; }
.rich-body [data-column],.rich-surface [data-column] { flex:1 1 14rem;min-width:0; }
.rich-button { display:inline-block;border:1px solid currentColor;padding:.35em .7em;border-radius:.25em; }
.rich-body,.rich-surface { overflow-x:auto; }
.rich-dialog {
  color:#e3ebdf;background:#171f17;border:1px solid #47624c;border-radius:.6rem;
  width:min(68rem,calc(100% - 1.5rem));max-width:none;max-height:calc(100% - 1.5rem);padding:clamp(.8rem,3vw,1.6rem);
  box-sizing:border-box;overflow:auto;color-scheme:dark;
}
.rich-dialog::backdrop { background:#070e0adc; }
.rich-dialog.rich-full { width:100%;height:100%;max-height:100%;margin:0;border-radius:0; }
.rich-dialog h2 { margin-block:0 .4rem; }
.rich-dialog label { display:flex;flex-wrap:wrap;align-items:center;gap:.35rem; }
.rich-dialog button,.rich-dialog select,.rich-dialog input,.rich-dialog textarea {
  font:inherit;color:inherit;background:#202d21;border:1px solid #58745e;border-radius:.25rem;padding:.4rem;
  max-width:100%;box-sizing:border-box;
}
.rich-dialog button:hover,.rich-dialog button:focus-visible { border-color:#b6e9ac; }
.rich-dialog input[type=color] { width:2.1rem;height:2.1rem;padding:.2rem; }
.rich-dialog input[type=number] { width:5.5rem; }
.rich-dialog > label input { flex:1;min-width:7rem; }
.rich-dialog [hidden] { display:none; }
.rich-controls,.rich-settings { display:flex;flex-wrap:wrap;gap:.45rem;align-items:center;margin-block:.65rem; }
.rich-controls > button:last-child { border-color:#a4d598; }
.rich-controls label,.rich-settings label { font-size:.86rem; }
.rich-surface,.rich-dialog textarea,.rich-preview { background:#101610;border:1px solid #47624c;border-radius:.3rem; }
.rich-surface .tiptap,.rich-dialog textarea { min-height:14rem;padding:.9rem;overflow-wrap:anywhere; }
.rich-dialog textarea { width:100%;font:inherit;font-family:monospace; }
.rich-dialog summary { cursor:pointer;margin-top:.75rem; }
.rich-preview { padding:.65rem;margin:.75rem auto;overflow:auto; }
.rich-preview section { box-sizing:border-box; }
.rich-surface .column-resize-handle { position:absolute;right:-2px;top:0;bottom:0;width:4px;background:#a4d598;pointer-events:none; }
.rich-surface .resize-cursor { cursor:col-resize; }
.rich-surface .selectedCell { outline:1px solid #a4d598; }
.rich-surface [data-resize-handle] { border:1px solid #171f17;background:#a4d598;width:10px;height:10px; }
/* Scope controls to the editor so dashboard form labels cannot stretch the toolbar. */
.rich-dialog .rich-controls label,.rich-dialog .ribbon-panel label,.rich-dialog .rich-settings label { width:auto; }
.rich-dialog input { margin:0; }
.editing-ribbon { margin-top:1rem;background:#202a22;border:1px solid #455747;border-radius:8px 8px 0 0; }
.ribbon-switches,.ribbon-panel { display:flex;align-items:center;flex-wrap:wrap; }
.ribbon-switches { padding:0 .35rem;gap:.15rem;border-bottom:1px solid #435247; }
.rich-dialog .ribbon-switches button { background:transparent;border:0;border-radius:0;border-bottom:2px solid transparent;color:#b7c9bb;padding:.6rem .8rem;font-weight:600; }
.rich-dialog .ribbon-switches button[aria-pressed=true] { color:#e5f7e2;border-bottom-color:#abd7a4; }
.ribbon-panel { gap:.28rem;padding:.45rem; }
.rich-dialog .ribbon-panel button,.rich-dialog .ribbon-panel select { font:500 .86rem/1.2 "Segoe UI",sans-serif;min-height:2.15rem; }
.rich-dialog .ribbon-panel button { border:1px solid transparent;background:transparent;padding:.3rem .45rem; }
.rich-dialog .ribbon-panel button:hover,.rich-dialog .ribbon-panel button[aria-pressed=true] { background:#364b39;border-color:#67836c; }
.rich-dialog :focus-visible { outline:2px solid #a7d8ac;outline-offset:2px; }
.rich-dialog .ribbon-panel label:has(select) { font-size:0;gap:0; }
.rich-dialog .ribbon-panel select { padding:.22rem .3rem;background:#172019;border-color:#4d6051; }
.rich-dialog .ribbon-panel label:has(input) { font-size:.84rem; }
.rich-dialog .ribbon-panel button[data-glyph] { font-size:0;width:2.2rem; }
.ribbon-panel button[data-glyph]::before { content:attr(data-glyph);font:600 1.08rem/1 Georgia,serif; }
.ribbon-panel button[data-glyph="I"]::before { font-style:italic; }
.ribbon-panel button[data-glyph="U"]::before { text-decoration:underline; }
.ribbon-panel button[data-glyph="S"]::before { text-decoration:line-through; }
.rich-surface { border-radius:0 0 .4rem .4rem;border-top:0; }
.rich-dialog details>summary { padding:.55rem 0;margin:0;font-weight:600; }
.rich-dialog .rich-settings { display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,12rem),1fr));gap:.65rem; }
.rich-settings label { justify-content:space-between; }
.rich-settings input:not([type=number]) { width:100%; }
.editor-actions { border-top:1px solid #435247;padding-top:.7rem; }
.rich-dialog .publish-block { background:#a8d2a3;color:#122417;font-weight:700;margin-inline-start:auto; }
@media(max-width:600px){
  .rich-dialog { width:calc(100% - .6rem);padding:.7rem; }
  .rich-dialog .ribbon-switches button { padding:.55rem .48rem; }
  .rich-dialog .ribbon-panel { gap:.15rem; }
  .rich-dialog .editor-actions { gap:.35rem; }
}
.rich-surface .ProseMirror-selectednode {outline:2px solid #a4d598;outline-offset:2px} .rich-dialog .image-tools {padding:.45rem;background:#26382a;border-radius:.3rem} .rich-surface img {cursor:pointer}
.rich-surface img {cursor:grab;touch-action:none;-webkit-user-drag:none;user-select:none} .rich-surface.moving-picture,.moving-picture * {cursor:grabbing!important} .rich-dialog .picture-drop-line {position:absolute;pointer-events:none;z-index:5;height:3px;background:#ade5ac;box-shadow:0 0 0 1px #234628;border-radius:3px} .picture-drop-line::before {content:"";position:absolute;left:-3px;top:-2px;width:7px;height:7px;border-radius:50%;background:#ade5ac}

/* The writing canvas scrolls independently so its toolbar stays within reach. */
.writing-box {
  display:flex;flex-direction:column;box-sizing:border-box;
  width:100%;height:clamp(19rem,51dvh,27rem);max-width:100%;
  min-width:min(100%,20rem);min-height:17rem;max-height:80dvh;
  resize:both;overflow:hidden;margin-top:.8rem;padding-bottom:10px;
  border:1px solid #47624c;border-radius:.45rem;background:#202a22;
}
.writing-box .editing-ribbon { margin:0;border:0;border-bottom:1px solid #47624c;border-radius:0;flex:none; }
.writing-box .image-tools { flex:none;margin:0; }
.writing-box .rich-surface,.rich-dialog .writing-box textarea {
  flex:1 1 0;min-height:4rem;overflow:auto;overscroll-behavior:contain;
  scrollbar-gutter:stable;border:0;border-radius:0;resize:none;margin:0;
}
.writing-box .tiptap { min-height:100%;box-sizing:border-box; }
.rich-dialog.rich-full .writing-box { height:65dvh; }
@media(max-width:600px){
  .writing-box { height:clamp(22rem,59dvh,30rem);resize:vertical; }
}

/* Crop adjustments use the original pixels as their coordinate system. */
.rich-surface [data-resize-container]:has(img[data-align=center]) {justify-content:center}
.rich-surface [data-resize-container]:has(img[data-align=right]) {justify-content:flex-end}
.rich-surface [data-resize-wrapper] {max-width:100%}
.rich-body img[data-align=left] {display:block;margin-inline:0 auto}
.image-pins[data-align=center] {margin-inline:auto}
.image-pins[data-align=right] {margin-inline:auto 0}
.rich-surface img[data-crop],.rich-body img[data-crop] {height:auto!important}
.picture-crop-dialog {
  box-sizing:border-box;width:min(46rem,94vw);max-height:92dvh;overflow:auto;
  color:#e3ebdf;background:#172019;border:1px solid #58745e;border-radius:.6rem;padding:1rem;
}
.picture-crop-dialog::backdrop {background:#060c09db}
.picture-crop-dialog h2,.picture-crop-dialog p {margin:0 0 .75rem}
.crop-stage {position:relative;width:fit-content;max-width:100%;margin:1rem auto;overflow:hidden;line-height:0}
.crop-stage>img {display:block;max-width:100%;max-height:55dvh;width:auto;height:auto;user-select:none}
.crop-frame {position:absolute;box-sizing:border-box;border:2px solid white;box-shadow:0 0 0 100vmax #06100bc4;
  cursor:move;touch-action:none;background:linear-gradient(to right,transparent 33%,#fff5 33%,#fff5 33.4%,transparent 33.4%,transparent 66%,#fff5 66%,#fff5 66.4%,transparent 66.4%),linear-gradient(to bottom,transparent 33%,#fff5 33%,#fff5 33.4%,transparent 33.4%,transparent 66%,#fff5 66%,#fff5 66.4%,transparent 66.4%)}
.rich-dialog .crop-handle {position:absolute;width:18px;height:18px;border:2px solid #17361f;background:#cef2c8;border-radius:3px;padding:0;touch-action:none}
.crop-handle[data-edge*=n] {top:-2px}
.crop-handle[data-edge*=s] {bottom:-2px}
.crop-handle[data-edge*=w] {left:-2px}
.crop-handle[data-edge*=e] {right:-2px}
.crop-handle:is([data-edge=n],[data-edge=s]) {left:50%;transform:translateX(-50%);cursor:ns-resize}
.crop-handle:is([data-edge=w],[data-edge=e]) {top:50%;transform:translateY(-50%);cursor:ew-resize}
.crop-handle:is([data-edge=nw],[data-edge=se]) {cursor:nwse-resize}
.crop-handle:is([data-edge=ne],[data-edge=sw]) {cursor:nesw-resize}
.crop-actions {display:flex;gap:.5rem;justify-content:flex-end}
.crop-actions button:first-child {margin-inline-end:auto}

.editor-discussion {width:min(32rem,92vw);max-height:85dvh;overflow:auto;color:#e3ebdf;background:#172019;border:1px solid #58745e}
.rich-dialog .editor-discussion label {display:block;margin:.6rem 0}
.rich-dialog .editor-discussion textarea {display:block;min-height:5rem;height:6rem;margin-top:.35rem;font:inherit}
.editor-discussion select {max-width:100%}
.editor-discussion ul {padding:0;list-style:none}
.editor-discussion li {display:grid;grid-template-columns:1fr auto;gap:.3rem;padding:.5rem 0;border-top:1px solid #435247}
.editor-discussion li strong,.editor-discussion li span {grid-column:1;overflow-wrap:anywhere}
.editor-discussion li button {grid-column:2;grid-row:1/3}
