/* Management-only book setup and native optional disclosures. */
.book-editor {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  overflow: hidden;
  background: #f1f5f9;
  color: #1e293b;
}
.book-editor.hidden { display: none; }
.book-editor *, .book-editor *::before, .book-editor *::after { box-sizing: border-box; }
.book-editor .book-editor-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1240px;
  height: 100%;
  min-height: 0;
  margin: 0 auto;
  padding: 0 28px;
  background: #f1f5f9;
}
.book-editor-header { display: flex; align-items: flex-start; justify-content: space-between; flex-shrink: 0; gap: 24px; padding: 24px 0 18px; }
.book-editor .book-editor-eyebrow { margin: 0 0 5px; color: #9a3412; font-size: 11px; font-weight: 700; letter-spacing: .08em; line-height: 1.5; text-transform: uppercase; }
.book-editor-header h1 { margin: 0; color: #0f172a; font-size: 28px; font-weight: 750; line-height: 1.25; }
.book-editor-intro { margin: 7px 0 0; color: #64748b; font-size: 14px; line-height: 1.5; }
.book-editor button { cursor: pointer; }
.book-editor button:disabled { cursor: wait; }
.book-editor :focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.book-editor-back { flex-shrink: 0; min-height: 42px; padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; color: #334155; font-size: 13px; font-weight: 600; }
.book-editor-back:hover { border-color: #ea580c; color: #9a3412; }
.book-editor #book-form { display: flex; flex-direction: column; flex: 1 1 auto; gap: 0; min-height: 0; }
.book-editor #book-form > * { margin-top: 0; min-width: 0; }
.book-editor-sections { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; padding: 3px 8px 24px 3px; scroll-padding-block: 18px; }
.book-editor .book-editor-section { min-width: 0; margin: 0 0 20px; padding: 22px; border: 1px solid #dbe2ea; border-radius: 12px; background: white; box-shadow: 0 2px 4px #0f172a04; scroll-margin-block: 18px; }
.book-editor .book-editor-section:last-child { margin-bottom: 0; }
.book-editor-section-heading { margin-bottom: 20px; }
.book-editor-section h2 { margin: 0 0 5px; font-size: 20px; line-height: 1.35; font-weight: 700; color: #0f172a; }
.book-editor-section-heading > p:last-child { margin: 0; font-size: 13px; line-height: 1.6; color: #64748b; }
.book-editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px 24px; }
.book-editor-grid > * { min-width: 0; }
.book-editor-wide { grid-column: 1 / -1; }
.book-editor-stack { display: flex; flex-direction: column; gap: 20px; }
.book-editor-stack > * { margin-top: 0; min-width: 0; }
.book-editor-help { margin: 7px 0 0; color: #64748b; font-size: 12px; line-height: 1.55; }
.book-editor input:not([type=checkbox]):not([type=radio]):not([type=color]):not([type=hidden]), .book-editor textarea, .book-editor select { max-width: 100%; }
.book-editor-section fieldset { min-width: 0; }
.book-editor-section fieldset legend { max-width: 100%; }
.book-editor #reader-appearance-editor, .book-editor #multimedia-editor { padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.book-editor .ra-heading-row, .book-editor .mm-heading-row { align-items: flex-start; }
.book-editor-footer { flex-shrink: 0; padding: 16px 3px max(16px, env(safe-area-inset-bottom)); border-top: 1px solid #d6dee8; background: #f1f5f9; }
.book-editor-footer-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.book-editor-save-help { max-width: 500px; margin: 0; color: #64748b; font-size: 12px; line-height: 1.5; }
.book-editor-actions { display: flex; flex-shrink: 0; gap: 10px; }
.book-editor-actions button, .book-editor-scope-actions > button { min-height: 44px; padding: 10px 20px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 14px; font-weight: 600; line-height: 1.4; }
.book-editor-cancel { background: white; color: #334155; }
.book-editor-cancel:hover { background: #f8fafc; border-color: #94a3b8; }
.book-editor .book-editor-save { background: #c2410c; border-color: #c2410c; color: white; }
.book-editor .book-editor-save:hover:not(:disabled) { background: #9a3412; border-color: #9a3412; }
.book-editor #book-save-error { max-height: 20vh; overflow-y: auto; margin: 0 0 12px; }
@media (max-width: 800px) {
  .book-editor .book-editor-content { padding: 0 18px; }
  .book-editor-header { padding-top: 18px; gap: 16px; }
  .book-editor-intro { max-width: 480px; }
  .book-editor-save-help { max-width: 350px; }
}
@media (max-width: 640px) {
  .book-editor .book-editor-content { padding: 0 12px; }
  .book-editor-header { align-items: center; padding: 12px 0; gap: 12px; }
  .book-editor-header h1 { font-size: 22px; }
  .book-editor-header .book-editor-eyebrow, .book-editor-intro { display: none; }
  .book-editor-back { min-height: 40px; padding: 7px 9px; font-size: 12px; }
  .book-editor-sections { padding: 3px 3px 16px; }
  .book-editor .book-editor-section { padding: 16px; margin-bottom: 14px; }
  .book-editor-section h2 { font-size: 19px; }
  .book-editor-grid { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .book-editor-section-heading { margin-bottom: 18px; }
  .book-editor-footer { padding-top: 10px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .book-editor-footer-row { align-items: stretch; gap: 10px; }
  .book-editor-footer-row > .book-editor-save-help { display: none; }
  .book-editor-actions { width: 100%; }
  .book-editor-actions button, .book-editor-scope-actions > button { flex: 1; min-width: 0; padding: 10px 12px; }
  .book-editor #book-save-error { margin-bottom: 10px; }
}
@media (max-height: 500px) and (min-width: 641px) {
  .book-editor-header { padding: 10px 0; align-items: center; }
  .book-editor-header h1 { font-size: 22px; }
  .book-editor-header .book-editor-eyebrow, .book-editor-intro { display: none; }
  .book-editor-footer { padding-top: 8px; padding-bottom: 8px; }
}

/* Essentials are always open; optional work is grouped below in native details. */
.book-editor-essentials-columns { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 24px; margin-top: 24px; }
.book-editor-essentials-columns > * { min-width: 0; }
.book-editor-essentials-save { margin-top: 24px; padding-top: 18px; border-top: 1px solid #e2e8f0; }
.book-editor-scope-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.book-editor-scope-actions > button { flex-shrink: 0; }
.book-editor-additional-heading { padding: 4px 2px 0; }
.book-editor-disclosure { margin: 0 0 12px; border: 1px solid #dbe2ea; border-radius: 12px; background: white; scroll-margin-block: 18px; }
.book-editor-disclosure > summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 78px; padding: 18px 22px; border-radius: 12px; cursor: pointer; list-style: none; }
.book-editor-disclosure > summary::-webkit-details-marker { display: none; }
.book-editor-disclosure > summary::after { content: "+"; flex-shrink: 0; color: #9a3412; font-size: 24px; font-weight: 500; line-height: 1; }
.book-editor-disclosure[open] > summary::after { content: "−"; }
.book-editor-disclosure > summary:hover { background: #fffaf5; }
.book-editor-disclosure[open] > summary { border-bottom: 1px solid #e2e8f0; border-radius: 12px 12px 0 0; }
.book-editor-disclosure > summary h2 { margin: 0; color: #0f172a; font-size: 17px; line-height: 1.4; font-weight: 700; }
.book-editor-disclosure > summary h2 span { display: block; margin-top: 4px; color: #64748b; font-size: 12px; font-weight: 400; line-height: 1.5; }
.book-editor-disclosure-content { padding: 20px 22px; }
.book-editor-settings-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.book-editor-visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.book-editor #ra-toggle, .book-editor #ra-apply, .book-editor #mm-save { display: none !important; }
#book-essentials-status, #book-additional-status { margin: 0; font-size: 13px; line-height: 1.5; }
#book-essentials-status:not(:empty) { margin-top: 8px; }
#book-additional-status:not(:empty) { max-height: 22vh; overflow-y: auto; margin-bottom: 10px; }
#book-essentials-status[data-error="true"], #book-additional-status[data-error="true"] { color: #9f1239; }
.book-editor #book-save-error { max-height: none; }
@media (max-width: 640px) {
  .book-editor-essentials-columns { grid-template-columns: minmax(0, 1fr); gap: 20px; margin-top: 20px; }
  .book-editor-disclosure > summary { padding: 15px 16px; gap: 12px; }
  .book-editor-disclosure > summary h2 { font-size: 16px; }
  .book-editor-disclosure-content { padding: 16px; }
  .book-editor-scope-actions { flex-direction: column; align-items: stretch; gap: 12px; }
  .book-editor-scope-actions > button { width: 100%; }
  .book-editor-actions .book-editor-cancel { flex: 0 1 auto; }
  .book-editor-actions .book-editor-save { flex: 1 1 auto; }
}
