/* Shared author interface. Every surface and state inherits the active template. */
.tellingPreferencesLayout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 2rem; max-width: 76rem; align-items: start; }
.tellingPreferenceFields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tellingPreferenceFields .form-label { font-size: .85rem; }
.tellingPreferenceFields .small { font-size: .75rem; }
.tellingPreferencePreview { position: sticky; top: 6rem; min-width: 0; }
.tellingWritingPreview { border: 1px solid var(--tellingBorder); border-radius: .6rem; overflow: hidden; background: var(--tellingWritingBackground, var(--tellingSurface)); }
.tellingWritingPreviewText { box-sizing: border-box; width: 100%; max-width: var(--tellingWritingWidth, 78ch); margin-inline: auto; padding: 1.25rem; color: var(--tellingWritingText, var(--tellingText)); font: var(--tellingWritingSize, 1.13rem)/var(--tellingWritingLine, 1.85) var(--tellingWritingFont, Georgia); overflow-wrap: anywhere; }
.tellingWritingPreviewText p { margin-bottom: var(--tellingWritingGap, .8em); color: inherit; font-family: inherit; font-size: inherit; line-height: inherit; }
@media (max-width: 991.98px) { .tellingPreferencesLayout { grid-template-columns: minmax(0, 1fr); gap: 1rem; } .tellingPreferencePreview { position: static; } }
@media (max-width: 575.98px) { .tellingPreferenceFields { grid-template-columns: minmax(0, 1fr); } }
.tellingApp {
    --tellingSurface: var(--surface-card, var(--bs-body-bg));
    --tellingSubtle: var(--surface-subtle, var(--bs-tertiary-bg));
    --tellingBorder: var(--border-default, var(--bs-border-color));
    --tellingText: var(--content-primary, var(--bs-body-color));
    --tellingMuted: var(--content-secondary, var(--bs-secondary-color));
    color: var(--tellingText);
    width: 100%;
    max-width: 1600px;
    min-width: 0;
    margin-inline: auto;
    padding: 1rem 0 2rem;
    font-size: .925rem;
}
.tellingApp [hidden] { display: none !important; }
.tellingApp :is(h1, h2, h3, h4, p) { overflow-wrap: anywhere; }
.tellingApp h1 { font-size: clamp(1.4rem, 2vw, 1.8rem); line-height: 1.3; letter-spacing: -.025em; margin: 0; }
.tellingApp h2.h4 { font-size: 1.2rem; }
.tellingApp .btn { min-height: 34px; border-radius: .4rem; width: auto; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 0; }
.tellingApp .btn-sm { min-height: 32px; }
.tellingApp :is(a, button, input, select, textarea, summary, [contenteditable]):focus-visible { outline: 3px solid var(--focus-ring-color, var(--bs-primary)); outline-offset: 3px; }
.tellingApp .form-label { font-weight: 600; font-size: .83rem; margin-bottom: .35rem; }
.tellingApp .form-text { font-size: .8rem; }
.tellingApp :is(.card, .tellingPanel) { background: var(--tellingSurface); color: var(--tellingText); border: 1px solid var(--tellingBorder); border-radius: .55rem; box-shadow: none; }
.tellingApp .card > :is(.card-header, .card-footer) { background: var(--tellingSurface); border-color: var(--tellingBorder); padding: .75rem 1rem; }
.tellingApp .card-body { padding: 1rem; }
.tellingApp .card-header .nav { margin: -.35rem -.5rem -.75rem; }
.tellingApp .nav-tabs { gap: .15rem; border-color: var(--tellingBorder); flex-wrap: wrap; }
.tellingApp .nav-tabs .nav-link { border: 0; border-bottom: 2px solid transparent; border-radius: 0; color: var(--tellingMuted); font-size: .84rem; padding: .7rem .85rem; background: transparent; }
.tellingApp .nav-tabs .nav-link.active { color: var(--interactive-selected-text, var(--bs-primary)); border-bottom-color: var(--interactive-primary, var(--bs-primary)); font-weight: 600; }
.tellingApp .nav-tabs .nav-link:hover { background: var(--tellingSubtle); color: var(--tellingText); }
.tellingApp .table { --bs-table-bg: var(--tellingSurface); --bs-table-color: var(--tellingText); font-size: .875rem; }
.tellingApp .alert { padding: .7rem 1rem; font-size: .875rem; }
.tellingApp .mb-5 { margin-bottom: 1.5rem !important; }
.tellingApp .mb-4 { margin-bottom: 1rem !important; }
.tellingApp .shadow-sm, .tellingApp .shadow-lg { box-shadow: none !important; }
.tellingWorkspaceNav { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; padding: .6rem 0 .9rem; margin-bottom: 1.15rem; border-bottom: 1px solid var(--tellingBorder); }
.tellingWorkspaceNav a { text-decoration: none; color: var(--tellingMuted); font-size: .82rem; }
.tellingWorkspaceHome { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; font-weight: 600; }
.tellingWorkspaceBook { border-inline-start: 1px solid var(--tellingBorder); padding-inline-start: 1rem; max-width: 20rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: .85rem; }
.tellingWorkspaceLinks { display: flex; flex-wrap: wrap; gap: .2rem; margin-left: auto; }
.tellingWorkspaceLinks a { padding: .45rem .6rem; border-radius: .35rem; }
.tellingWorkspaceLinks a:hover { background: var(--tellingSubtle); color: var(--tellingText); }
.tellingWorkspaceNav a[aria-current="page"] { color: var(--interactive-selected-text, var(--bs-primary)); background: var(--interactive-selected-surface, var(--bs-primary-bg-subtle)); }
.tellingPageHeader { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; }
.tellingPageHeader p { font-size: .85rem; margin-top: .4rem; }
.tellingEyebrow { color: var(--tellingMuted); font-size: .8rem; margin-bottom: .35rem; }
.tellingPanel { padding: 1.4rem; }
.tellingWelcome, .tellingNarrow { max-width: 760px; }
.tellingWelcome { padding-top: 2rem; }
.tellingFilterBar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: end; margin-bottom: 1rem; }
.tellingFilterBar > div:first-child { flex: 1; min-width: 12rem; max-width: 28rem; }
.tellingFilterBar > span { padding-bottom: .5rem; margin-left: auto; }
.tellingBookList { display: grid; gap: .65rem; }
.tellingBookRow { display: flex; align-items: center; gap: 1.15rem; background: var(--tellingSurface); border: 1px solid var(--tellingBorder); border-radius: .55rem; padding: 1rem; }
.tellingBookCover { display: flex; align-items: center; justify-content: center; width: 54px; height: 76px; flex-shrink: 0; background: var(--tellingSubtle); color: var(--tellingMuted); border: 1px solid var(--tellingBorder); border-radius: .25rem; overflow: hidden; text-decoration: none; }
.tellingBookCover img { width: 100%; height: 100%; object-fit: cover; }
.tellingBookInfo { flex: 1; min-width: 0; }
.tellingBookInfo h2 { font-size: 1.08rem; margin-bottom: .5rem; }
.tellingBookInfo h2 a { color: var(--tellingText); text-decoration: none; }
.tellingBookInfo h2 a:hover { color: var(--content-link, var(--bs-link-color)); }
.tellingBookMetadata { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .8rem; color: var(--tellingMuted); }
.tellingBookActions { display: flex; gap: .5rem; }
.tellingEmptyState { border: 1px dashed var(--tellingBorder); border-radius: .55rem; padding: 2.5rem 1rem; text-align: center; background: var(--tellingSurface); }
.tellingEmptyState > i { color: var(--tellingMuted); margin-bottom: 1rem; font-size: 1.5rem; }
.tellingChapterLink { display: inline-flex; align-items: center; padding: .5rem .7rem; border: 1px solid var(--tellingBorder); border-radius: .35rem; color: var(--tellingText); background: var(--tellingSurface); text-decoration: none; font-size: .85rem; }
.tellingChapterLink:hover { background: var(--interactive-selected-surface, var(--bs-primary-bg-subtle)); border-color: var(--interactive-selected-border, var(--bs-primary)); }
.tellingApp .telling-structure-summary-item { padding: .65rem .85rem; border-radius: .4rem; background: var(--tellingSubtle); box-shadow: none; }
.tellingApp .telling-structure-summary-item strong { font-size: 1.15rem; }
.tellingApp .telling-book-tabs { border: 1px solid var(--tellingBorder); border-radius: .55rem; box-shadow: none; }
.tellingApp .telling-book-tabs > .card-header { background: var(--tellingSurface); }
.tellingApp .telling-entity-card, .tellingApp .telling-entity-form { border: 1px solid var(--tellingBorder); border-radius: .45rem; box-shadow: none; }
.tellingApp .telling-entity-toggle { color: var(--tellingText); }
.tellingApp .telling-entity-card:hover { transform: none; box-shadow: none; }
.tellingApp .telling-ideas-grid { grid-template-columns: 1fr; gap: 1rem; }
.tellingApp .telling-ideas-postits { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: .85rem; }
.tellingApp .telling-ideas-postit { background: var(--tellingSurface); border: 1px solid var(--tellingBorder); box-shadow: none; transform: none; }
.tellingApp .telling-ideas-board > .card-header, .tellingApp .telling-ideas-new-chapter { background: var(--tellingSubtle); }
.tellingApp .telling-ideas-part-form { max-width: none; }
.tellingApp .telling-ideas-synopsis-editor { min-height: 100px; background: var(--tellingSurface); color: var(--tellingText); }
.tellingApp .telling-export-summary-card { padding: .75rem 1rem; border-radius: .45rem; box-shadow: none; background: var(--tellingSubtle); }
.tellingApp .telling-export-summary-value { font-size: 1rem; }
.tellingApp .telling-export-header { padding: 0; background: transparent; border: 0; }
.tellingApp .telling-book-hero { background: var(--tellingSurface); border: 1px solid var(--tellingBorder); border-radius: .55rem; padding: 1.25rem; }
.tellingApp .telling-book-hero::after { content: none; }
.tellingApp .telling-book-cover { width: 110px; height: 165px; border-radius: .3rem; }
.tellingApp .telling-book-stats { padding: .75rem; background: var(--tellingSubtle); box-shadow: none; border-radius: .4rem; }
.tellingApp .telling-book-stats .display-6 { font-size: 1.4rem; }
/* The chapter occupies the main column; reference tabs never push the manuscript down. */
.tellingApp .chapter-editor-header { padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.tellingApp .chapter-editor-header h1 { font-size: 1.25rem; }
.tellingApp .chapter-editor-header p { font-size: .8rem; }
.tellingApp .chapter-editor-header .btn { font-size: .8rem; padding: .4rem .6rem; }
.tellingChapterJump { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: .75rem; }
.tellingChapterJump select { width: auto; max-width: min(100%, 32rem); }
.tellingChapterJump > span { margin-left: auto; }
.tellingApp .chapter-editor-layout { display: flex; gap: 1rem; align-items: flex-start; }
.tellingApp .chapter-editor-main { flex: 1; min-width: 0; }
.tellingApp .chapter-editor-aside { flex: 0 0 320px; width: 320px; max-height: calc(100dvh - 9rem); overflow-y: auto; position: sticky; top: 1rem; }
.tellingApp .chapter-editor-sidebar { gap: 0; background: var(--tellingSurface); border: 1px solid var(--tellingBorder); border-radius: .55rem; }
.tellingApp .tellingReferenceTabs { padding: .4rem .4rem 0; }
.tellingApp .tellingReferenceTabs .nav-link { padding: .55rem .6rem; font-size: .78rem; }
.tellingApp .tellingReferenceContent > .card { border: 0; box-shadow: none; margin-bottom: 0 !important; }
.tellingApp .tellingReferenceContent > .card > .card-header { display: none; }
.tellingApp #chapterWritingCard { border: 1px solid var(--tellingBorder); box-shadow: none; border-radius: .55rem; overflow: visible; }
.tellingApp #chapterWritingCard > .card-header { padding: .65rem 1rem; border-radius: .55rem .55rem 0 0; font-size: .8rem; }
.tellingApp #chapterWritingCard > .card-body { padding: .8rem; background: var(--tellingSurface); border-radius: 0 0 .55rem .55rem; }
.tellingApp #chapterWritingCard label[for="chapter-contentSurface"], .tellingApp #chapterWritingCard label[for="chapter-content"] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tellingApp #chapter-title { color: var(--tellingText); font: 600 1.35rem/1.5 Georgia, 'Times New Roman', serif; border: 0; border-bottom: 1px solid var(--tellingBorder); padding: .3rem .5rem .65rem; background: transparent; border-radius: 0; }
.tellingApp .fcmsEditorRoot { padding: 0 !important; border: 1px solid var(--tellingBorder) !important; border-radius: .4rem !important; margin: 0 !important; color: var(--tellingText); background: var(--tellingSurface); min-width: 0; }
.tellingApp .fcmsEditorToolbar { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .4rem !important; padding: .45rem; margin: 0 !important; background: var(--tellingSubtle); border-bottom: 1px solid var(--tellingBorder); border-radius: .4rem .4rem 0 0; }
.tellingEditorGroup { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem; padding-inline-end: .4rem; border-inline-end: 1px solid var(--tellingBorder); }
.tellingEditorGroup:last-child { border: 0; }
.tellingApp .fcmsEditorToolbar .btn { border-color: transparent; color: var(--tellingText); min-width: 32px; min-height: 32px; padding: .3rem .45rem; font-size: .8rem; }
.tellingApp .fcmsEditorToolbar .btn:hover { background: var(--interactive-selected-surface, var(--bs-primary-bg-subtle)); color: var(--interactive-selected-text, var(--bs-primary)); }
.tellingApp .fcmsEditorToolbar .btn[aria-pressed="true"] { background: var(--interactive-selected-surface, var(--bs-primary-bg-subtle)); color: var(--interactive-selected-text, var(--bs-primary)); border-color: var(--interactive-selected-border, var(--bs-primary)); }
.tellingApp .fcmsEditorToolbar .form-select { min-height: 32px; max-width: 11rem; font-size: .75rem; padding: .3rem 1.8rem .3rem .45rem; border-color: var(--tellingBorder); }
.tellingApp .tellingEditorMore { display: none; }
.tellingChapterJump .form-select { padding: .35rem 2rem .35rem .65rem; }
.tellingApp.tellingEnhancedBook #book-editor-main-tabs { display: none; }
.tellingApp .fcmsEditorSurface { padding: 0 !important; border: 0 !important; background: var(--tellingSurface); }
.tellingApp .fcmsEditorContent { box-sizing: border-box; color: var(--tellingText); background: var(--tellingSurface); line-height: 1.6; padding: .9rem !important; overflow-wrap: anywhere; }
.tellingApp .fcmsEditorContent img { max-width: 100%; height: auto; }
.tellingApp .fcmsEditorContent table { max-width: 100%; }
.tellingApp .fcmsEditorContent p { margin-bottom: .8em; }
.tellingApp .tellingManuscriptEditor .fcmsEditorContent { max-width: var(--tellingWritingWidth, 78ch) !important; margin-inline: auto; padding: 2rem clamp(1rem, 3vw, 3rem) 4rem !important; font: var(--tellingWritingSize, 1.13rem)/var(--tellingWritingLine, 1.85) var(--tellingWritingFont, Georgia); min-height: 52vh; background: var(--tellingWritingBackground, var(--tellingSurface)); color: var(--tellingWritingText, var(--tellingText)); caret-color: currentColor; }
.tellingApp .tellingManuscriptEditor .fcmsEditorSurface { background: var(--tellingWritingBackground, var(--tellingSurface)); }
.tellingApp .tellingManuscriptEditor .fcmsEditorContent p { margin-bottom: var(--tellingWritingGap, .8em); }
.tellingApp .tellingManuscriptEditor .fcmsEditorContent :where(p, blockquote, li) { font-family: inherit; font-size: inherit; line-height: inherit; }
.tellingApp .tellingManuscriptEditor .fcmsEditorContent :where(p, span, em, strong, b, i, u, s, blockquote, li, h1, h2, h3, h4, h5, h6) { color: inherit; }
.tellingApp .tellingManuscriptEditor .fcmsEditorToolbar { position: sticky; top: var(--tellingHeaderInset, 0px); z-index: 10; }
.tellingApp .tellingPageBreak { border-top: 1px dashed var(--tellingBorder); margin-block: 2rem; }
.tellingEditorSearch { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem; border-bottom: 1px solid var(--tellingBorder); background: var(--tellingSubtle); }
.tellingEditorSearch input { flex: 1; min-width: 10rem; }
.tellingEditorDialog { width: min(30rem, calc(100vw - 2rem)); padding: 1.4rem; color: var(--tellingText); background: var(--surface-elevated, var(--bs-body-bg)); border: 1px solid var(--tellingBorder); border-radius: .55rem; }
.tellingEditorDialog::backdrop { background: var(--surface-overlay, rgba(0, 0, 0, .5)); }
.tellingEditorDialog h2 { font-size: 1.1rem; }
.tellingEditorDialog .form-control { width: 100%; }
.tellingApp .chapter-editor-toolbar { z-index: 1030; background: var(--tellingSurface); box-shadow: var(--shadow-sm, none); }
.tellingApp .chapter-editor-toolbar > .container { max-width: 1600px; padding: .65rem 1rem; }
.tellingHistory { border: 1px solid var(--tellingBorder); border-radius: .5rem; padding: .85rem 1rem; background: var(--tellingSurface); }
.tellingHistory > summary { cursor: pointer; font-weight: 600; font-size: .875rem; }
.tellingApp.tellingFocusMode > .tellingWorkspaceNav, .tellingApp.tellingFocusMode > .chapter-editor-header, .tellingApp.tellingFocusMode > .tellingChapterJump, .tellingApp.tellingFocusMode .chapter-editor-aside, .tellingApp.tellingFocusMode > .tellingHistory { display: none !important; }
.tellingApp.tellingFocusMode .chapter-editor-main { max-width: 1050px; margin-inline: auto; }
.tellingApp .telling-chapter-content { max-width: 74ch; margin-inline: auto; font: 1.12rem/1.85 Georgia, 'Times New Roman', serif; }
@media (max-width: 1199.98px) {
    .tellingWorkspaceLinks { flex-basis: 100%; margin: 0; }
    .tellingApp .chapter-editor-aside { flex-basis: 290px; width: 290px; }
}
@media (max-width: 991.98px) {
    .tellingApp .chapter-editor-layout { flex-direction: column; }
    .tellingApp .chapter-editor-aside { position: static; width: 100%; flex-basis: auto; max-height: none; }
    .tellingApp .chapter-editor-main { width: 100%; }
    .tellingApp .chapter-editor-layout:has(#chapterToolsPanel.show) .chapter-editor-aside { order: -1; }
    .tellingApp .tellingReferenceContent { max-height: 320px; overflow-y: auto; }
    .tellingApp .chapter-editor-status-indicator [data-status-timestamp] { display: none; }
}
@media (max-width: 575.98px) {
    .tellingApp { padding-top: .6rem; }
    .tellingPageHeader { align-items: flex-start; flex-wrap: wrap; }
    .tellingWorkspaceBook { max-width: 11rem; }
    .tellingWorkspaceLinks a { font-size: .78rem; padding: .4rem .5rem; }
    .tellingWorkspaceLinks { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: .35rem; }
    .tellingWorkspaceLinks a { white-space: nowrap; flex-shrink: 0; }
    .tellingApp #backToStructureButton, .tellingApp #tellingPartChaptersButton, .tellingChapterJump > span { display: none; }
    .tellingBookRow { flex-wrap: wrap; gap: .75rem; padding: .8rem; }
    .tellingBookInfo { flex-basis: calc(100% - 80px); }
    .tellingBookActions { margin-left: auto; }
    .tellingApp .card-body { padding: .8rem; }
    .tellingExportSummary { --bs-gutter-x: .5rem; }
    .tellingExportSummary > div { width: 33.333%; }
    .tellingApp .telling-export-summary-card { padding: .65rem; align-items: flex-start; }
    .tellingApp .telling-export-summary-icon { display: none; }
    .tellingApp .telling-export-summary-value { font-size: .85rem; }
    .tellingApp .emotion-board-scrollable { --emotion-label-width: 80px !important; --emotion-column-width: 200px !important; }
    .tellingApp .emotion-board-header-offset { width: 80px !important; }
    .tellingApp .emotion-emotion-label { overflow-wrap: anywhere; padding-inline-end: .4rem; }
    .tellingApp .nav-tabs .nav-link { padding: .65rem .55rem; }
    .tellingApp .fcmsEditorToolbar { gap: .2rem !important; }
    .tellingApp .fcmsEditorToolbar .btn { min-width: 36px; min-height: 36px; }
    .tellingApp .fcmsEditorToolbar .form-select { max-width: 9rem; min-height: 36px; }
    .tellingApp .tellingManuscriptEditor .tellingEditorMore { display: inline-flex; }
    .tellingApp .tellingManuscriptEditor:not(.tellingShowAdvanced) .tellingAdvancedGroup { display: none; }
    .tellingApp .tellingManuscriptEditor .fcmsEditorToolbar { position: static; }
    .tellingApp .tellingManuscriptEditor .fcmsEditorContent { padding: 1.2rem .65rem 3rem !important; }
    .tellingApp .chapter-editor-toolbar .btn { font-size: .75rem; padding: .35rem .5rem; }
    .tellingApp .chapter-editor-toolbar .order-2 { flex-grow: 0 !important; }
    .tellingApp .chapter-editor-toolbar .order-1 { flex: 1; }
    .tellingApp .chapter-editor-toolbar .order-3 { width: 100%; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { .tellingApp *, .tellingApp *::before, .tellingApp *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media print { .tellingPageBreak { break-after: page; } }
