.document-page { max-width: 1040px; margin: 0 auto; padding: 40px 24px 80px; }
.document-back, .document-nav a, .document-text-button { color: var(--always-red); text-underline-offset: 4px; }
.document-back { display: inline-block; }
.document-nav { display: flex; flex-wrap: wrap; gap: 12px 28px; margin: 28px 0; }
.document-nav a { padding: 8px 0; }
.document-nav [aria-current="page"] { font-weight: 700; border-bottom: 2px solid var(--always-red); }
.document-paper { background: var(--bg-primary); padding: clamp(24px, 5vw, 56px); border: 1px solid var(--border-light); border-radius: 12px; }
.document-paper h1, .document-heading h1 { font-size: clamp(26px, 3vw, 38px); line-height: 1.2; margin: 0 0 16px; text-wrap: balance; }
.document-meta, .document-hint, .document-history time, .version-author { color: var(--text-secondary); }
.document-meta { margin: 0 0 24px; }
.document-body { max-width: 72ch; font-size: 17px; line-height: 1.8; overflow-wrap: anywhere; }
.document-body p { margin: 0 0 1em; }
.document-body h2 { font-size: 25px; margin: 1.8em 0 .7em; line-height: 1.3; }
.document-body h3 { font-size: 20px; margin: 1.5em 0 .6em; }
.document-body ul, .document-body ol { padding-left: 1.8em; margin-bottom: 1em; }
.document-body a { color: var(--always-red); text-decoration: underline; text-underline-offset: 3px; }
.document-body blockquote { margin: 24px 0; padding: 16px 24px; background: var(--bg-accent); }
.document-empty { padding: 32px 0; max-width: 60ch; }
.document-empty h2 { font-size: 22px; }
.document-admin { max-width: 1400px; margin: 0 auto; }
.document-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 24px; flex-wrap: wrap; }
.document-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 32px; align-items: start; }
.document-edit { min-width: 0; }
.document-edit h2, .document-history h2 { font-size: 20px; margin: 0 0 12px; }
.document-edit > p { margin-bottom: 16px; }
.document-edit label { display: block; font-weight: 600; margin: 24px 0 8px; }
.document-edit textarea { width: 100%; border: 1px solid var(--border-medium); border-radius: 6px; padding: 12px; resize: vertical; font: inherit; color: inherit; background: var(--bg-primary); }
.document-edit textarea::placeholder { color: var(--text-secondary); }
#document-toolbar { border-radius: 8px 8px 0 0; background: var(--bg-primary); }
#document-toolbar button { width: 36px; height: 36px; }
#document-editor { background: var(--bg-primary); border-radius: 0 0 8px 8px; font: inherit; }
#document-editor .ql-editor { min-height: 360px; font-size: 16px; line-height: 1.7; }
.document-history { border-left: 1px solid var(--border-light); padding-left: 24px; overflow-wrap: anywhere; }
.version-list { list-style: none; margin: 0; padding: 0; max-height: 680px; overflow-y: auto; }
.version-list li { padding: 20px 0; border-bottom: 1px solid var(--border-light); }
.version-heading { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
.version-current { color: var(--warm-red); background: #fcecef; border-radius: 4px; padding: 2px 8px; font-size: 12px; }
.version-list p { margin: 10px 0; }
.version-author, .document-history time { font-size: 12px; }
.document-text-button { background: none; border: none; font: inherit; text-decoration: underline; padding: 10px 0; cursor: pointer; text-align: left; }
.document-admin button:disabled { opacity: .55; cursor: wait; }
#document-status { min-height: 24px; color: var(--warm-red); }
#version-preview { margin-top: 32px; scroll-margin-top: 100px; }
#version-preview[hidden] { display: none; }
.document-admin :focus-visible, .document-page :focus-visible, .documents-intro :focus-visible { outline: 2px solid var(--always-red); outline-offset: 4px; }
.document-admin ::selection, .document-page ::selection { background: #f9d5dc; color: var(--warm-red); }
.document-admin { caret-color: var(--always-red); }
.version-list { scrollbar-color: var(--border-medium) transparent; scrollbar-width: thin; }
.ql-snow .ql-tooltip::before { content: 'Enlace:'; }
.ql-snow .ql-tooltip[data-mode=link]::before { content: 'Dirección:'; }
.ql-snow .ql-tooltip a.ql-action::after { content: 'Editar'; }
.ql-snow .ql-tooltip.ql-editing a.ql-action::after { content: 'Guardar'; }
.ql-snow .ql-tooltip a.ql-remove::before { content: 'Quitar'; }
.documents-intro { padding: 64px 24px; background: var(--bg-primary); }
.documents-intro-inner { max-width: 1100px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
.documents-intro h2 { font-size: clamp(26px, 3vw, 36px); line-height: 1.2; margin: 0 0 16px; text-wrap: balance; }
.documents-intro p { color: var(--text-secondary); font-size: 16px; line-height: 1.7; max-width: 55ch; }
.documents-intro ul { list-style: none; padding: 0; margin: 0; }
.documents-intro li { border-bottom: 1px solid var(--border-light); }
.documents-intro li a { color: var(--text-primary); display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 20px 0; font-size: 18px; font-weight: 600; }
.documents-intro li a:hover { color: var(--always-red); }
.documents-intro svg { color: var(--always-red); flex-shrink: 0; width: 20px; }
@media (max-width: 1050px) { .document-workspace { grid-template-columns: 1fr; } .document-history { border-left: 0; border-top: 1px solid var(--border-light); padding: 24px 0 0; } }
@media (max-width: 600px) {
    .document-page { padding: 24px 16px 48px; }
    .document-paper { padding: 24px 20px; }
    .document-nav { gap: 8px 16px; }
    .documents-intro-inner { grid-template-columns: 1fr; gap: 20px; }
    .documents-intro { padding: 40px 24px; }
    .document-heading { gap: 0; margin-bottom: 24px; }
    #document-editor .ql-editor { min-height: 300px; }
    .document-edit .ql-tooltip { left: 0 !important; max-width: 100%; white-space: normal; }
}
/* Public header is fixed by the shared layout. */
.document-page { margin-top: var(--header-height); }
.document-admin .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
@media (max-width: 767px) {
    .document-admin { padding-top: 64px; padding-inline: 8px; }
}
