/* Scoped document typography: editing, authorized previews, detail, and history. */
.document-editor-page { max-width: 1060px; }
.document-form-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.document-body-field { min-width: 0; }
.document-body-field [hidden], .document-editor [hidden] { display: none !important; }
.document-editor { border: 1px solid #65494b; border-radius: var(--radius); background: #170f11; overflow: hidden; }
.document-toolbar { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.document-toolbar label { min-width: 0; margin: 0; flex: 1 1 126px; color: var(--ink); font-size: 11px; }
/* Native formatting menus inherit the shared single-select appearance in site.css. */
.document-toolbar select { margin-top: 5px; }
.document-toolbar-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.document-toolbar button, .document-link-panel button { min-height: 44px; padding: 9px 11px; background: var(--surface); border: 1px solid #765c58; border-radius: var(--radius); color: var(--ink); font-size: 12px; }
.document-toolbar button:hover, .document-link-panel button:hover { color: var(--gold-light); border-color: var(--gold); }
.document-toolbar button[aria-pressed="true"] { background: var(--gold); color: #231413; border-color: var(--gold-light); }
.document-editor button:disabled, .document-editor input:disabled { opacity: .5; cursor: not-allowed; }
.document-editor :focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }
.document-editor .ql-container { font: inherit; }
.document-editor .ql-editor { min-height: 340px; max-height: 70vh; padding: 28px; font: 16px/1.75 var(--sans); color: var(--ink); overflow-wrap: anywhere; }
.document-editor .ql-editor:focus-visible { outline-offset: -3px; }
.document-editor .ql-editor.ql-blank::before { left: 28px; right: 28px; color: var(--muted); font-style: normal; }
.document-editor .ql-editor[contenteditable="false"] { background: var(--surface); user-select: text; }
.document-editor-help { padding: 12px 16px; margin: 0; border-top: 1px solid var(--line); }
.document-link-panel { padding: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.document-link-panel input { max-width: 100%; }
.document-link-panel .field-help { margin-block: 7px 12px; }
.document-link-error, .document-editor-status { color: var(--danger); font-size: 13px; margin-block: 12px 0; }
.document-link-error:empty, .document-editor-status:empty { display: none; }
.document-readonly-preview { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); }
.document-body { overflow-wrap: anywhere; line-height: 1.75; font-family: var(--sans); }
.document-body p, .document-editor .ql-editor p { margin: 0 0 1em; }
.document-body h2, .document-editor .ql-editor h2 { font-size: 1.8em; }
.document-body h3, .document-editor .ql-editor h3 { font-size: 1.45em; }
.document-body h4, .document-editor .ql-editor h4 { font-size: 1.2em; }
.document-body h2, .document-body h3, .document-body h4,
.document-editor .ql-editor h2, .document-editor .ql-editor h3, .document-editor .ql-editor h4 { font-family: var(--serif); line-height: 1.3; margin: 1.15em 0 .6em; color: var(--ink); }
.document-body > :first-child, .document-editor .ql-editor > :first-child { margin-top: 0; }
.document-body a, .document-editor .ql-editor a { color: var(--gold-light); text-decoration: underline; text-underline-offset: .18em; }
.document-body ul, .document-body ol { padding-left: 1.8em; margin: .5em 0 1em; }
.document-body li { margin-bottom: .35em; }
.document-body li > ul, .document-body li > ol { margin-bottom: 0; }
.document-body blockquote, .document-editor .ql-editor blockquote { border-left: 3px solid var(--gold-dim); padding-left: 1em; margin: 1em 0; color: var(--muted); }
.document-body .ql-font-serif, .document-editor .ql-editor .ql-font-serif { font-family: var(--serif); }
.document-body .ql-font-monospace, .document-editor .ql-editor .ql-font-monospace { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.document-body .ql-size-small, .document-editor .ql-editor .ql-size-small { font-size: .75em; }
.document-body .ql-size-large, .document-editor .ql-editor .ql-size-large { font-size: 1.5em; }
.document-body .ql-size-huge, .document-editor .ql-editor .ql-size-huge { font-size: 2.5em; }
.document-body .ql-align-center, .document-editor .ql-editor .ql-align-center { text-align: center; }
.document-body .ql-align-right, .document-editor .ql-editor .ql-align-right { text-align: right; }
.document-body .ql-align-justify, .document-editor .ql-editor .ql-align-justify { text-align: justify; }
.document-body .ql-indent-1 { padding-left: 3em; }
.document-body .ql-indent-2 { padding-left: 6em; }
.document-body .ql-indent-3 { padding-left: 9em; }
.document-body .ql-indent-4 { padding-left: 12em; }
.document-body .ql-indent-5 { padding-left: 15em; }
.document-body .ql-indent-6 { padding-left: 18em; }
.document-body .ql-indent-7 { padding-left: 21em; }
.document-body .ql-indent-8 { padding-left: 24em; }
@media (max-width: 600px) {
  .document-toolbar { gap: 9px; padding: 10px; }
  .document-toolbar label { flex-basis: 115px; }
  .document-toolbar-buttons { gap: 5px; }
  .document-editor .ql-editor { min-height: 290px; padding: 18px; }
  .document-editor .ql-editor.ql-blank::before { left: 18px; right: 18px; }
  .document-readonly-preview { padding: 16px; }
}
@media (forced-colors: active) {
  .document-toolbar button[aria-pressed="true"] { outline: 2px solid Highlight; }
}

/* Shared editor fields retain independent toolbars and avoid oversized short notes. */
.longform-field { margin-top: .5rem; }
.longform-field .ql-editor { min-height: 180px; }
.longform-field .document-toolbar { gap: 8px; }
.longform-field [hidden] { display: none !important; }
.longform-field .document-readonly-preview { margin-top: 12px; }

/* Only the small controls wrapper changes height, never the document itself. */
.ui-collapse { min-width: 0; }
