/* The editor shares one 48px header; the library keeps its existing navigation. */
body:not(.editor-open) #toolbar{display:none}
body.editor-open #titlebar{height:48px;padding:0 10px;background:#294c7f;border:0;gap:0}
body.editor-open #titlebar>:not(#toolbar){display:none!important}
body.editor-open #layout{height:calc(100dvh - 48px)}
body.editor-open #toolbar{display:flex;align-items:center;gap:9px;padding:0;min-height:48px;height:48px;overflow:visible;background:transparent;border:0;width:100%;color:#f2f5fa}
.editor-header-left,.editor-header-actions{display:flex;align-items:center;gap:6px;flex:0 0 auto;min-width:0}.editor-header-left{flex:0 1 auto}
#toolbar button{display:grid;place-items:center;width:36px;min-width:36px;height:36px;min-height:36px;padding:7px;border-radius:9px;flex-shrink:0}
#toolbar svg{display:block;width:23px;height:23px}#toolbar button:hover{background:#ffffff14}
#toolbar #editor-header-details{display:flex;align-items:center;gap:5px;min-width:0}
#toolbar #editor-document-title{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;width:auto;max-width:240px;min-width:50px;padding:4px 5px;font-size:14px;font-weight:600}
#toolbar #app-version{display:block;width:auto;min-width:0;height:26px;min-height:26px;font-size:9px;padding:3px 5px;border-radius:6px;color:#d7e8ff}
#toolbar #tools{flex:0 0 auto;display:flex;gap:5px;overflow:visible;border:0;padding:0;min-width:0}
#toolbar #tools .tool{width:36px;flex:0 0 36px;min-width:36px;height:36px;padding:7px}
#toolbar .tool.active{background:#e3edffb0;color:#204363;box-shadow:none}
#toolbar #editor-extra-tools{font-size:21px;width:30px;min-width:30px;background:#ffffff0d}
#toolbar .editor-header-actions{margin-left:auto;gap:6px}
#toolbar #read-only-toggle{border:0;font-size:0;color:inherit}#toolbar #read-only-toggle.mode-reading{background:#ffffff26}
#reading-indicator{display:none;font-size:11px;color:#dce8ff}body.editor-reading #reading-indicator{display:inline}
.editor-menu{position:fixed;z-index:22;background:var(--panel);border:1px solid var(--border);border-radius:12px;padding:12px;box-shadow:0 12px 35px #0006;width:250px;max-width:calc(100vw - 16px);max-height:calc(100dvh - 64px);overflow:auto}
.editor-menu h2{font-size:12px;font-weight:500;color:var(--muted);margin:4px 8px 10px}.editor-menu>button{display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:10px;font-size:13px;min-height:42px}
.editor-menu .tool svg{width:23px;height:23px;flex:0 0 23px}.editor-menu .tool[aria-pressed=true]{background:#1683ff24;color:#85bcff}
.editor-menu .editor-tool-label,.editor-menu-label{font-size:13px}.editor-menu #save span:first-child{display:none}
.editor-menu .editor-direction-label{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:7px 10px;font-size:13px;border-block:1px solid var(--border);margin-block:7px}
.editor-menu #scroll-direction{max-width:115px;min-height:36px;font-size:12px}
#editor-document-menu,#editor-tabs-menu{width:300px}#editor-tabs-menu #tabs{display:flex;flex-direction:column;gap:4px;height:auto;overflow:auto;align-items:stretch}
#editor-tabs-menu #tabs button{display:flex;align-items:center;justify-content:space-between;max-width:none;background:transparent;color:var(--text);border:0;border-radius:7px;font-size:13px;width:100%;text-align:left}#editor-tabs-menu #tabs button.active{background:var(--hover)}#editor-tabs-menu #tabs button>span:first-child{overflow:hidden;text-overflow:ellipsis}
.editor-document-info{display:grid;grid-template-columns:80px 1fr;gap:13px 10px;padding:8px;font-size:12px}.editor-document-info dt{color:var(--muted)}.editor-document-info dd{margin:0;overflow-wrap:anywhere}
#editor-rename-dialog{width:380px;max-width:calc(100vw - 24px)}#editor-rename-dialog h2{font-size:22px}#editor-rename-dialog label{display:grid;gap:10px;font-size:13px}#editor-rename-input{width:100%;min-height:42px}.editor-rename-message{font-size:12px;line-height:1.6;color:#efb667}.editor-rename-message:empty{display:none}
#editor-properties-dialog{width:430px;max-width:calc(100vw - 24px);max-height:85dvh;overflow:auto;padding:24px}
#editor-properties-dialog h2{font-size:21px;margin:0 0 18px}#editor-properties-dialog>button{display:block;margin:16px 0 0 auto}
#editor-properties-dialog #properties{display:flex;flex-wrap:wrap;align-items:center;gap:16px!important;overflow:visible;border:0;padding:0!important;min-height:0!important;background:transparent}
#editor-properties-dialog #tool-hint{display:none}#editor-properties-dialog #selection-actions{display:flex;flex-wrap:wrap;white-space:normal}#editor-properties-dialog #swatches{display:flex}
body.editor-open #document-area{position:relative;background:var(--canvas)}
body.editor-open #viewport{margin-bottom:48px}
#document-area .editor-history{position:absolute;z-index:8;left:8px;top:8px;display:flex;align-items:center;padding:2px;border:.6px solid #595454a3;background:#1e1b1b3f;border-radius:16px;box-shadow:0 8px 24px #0001;gap:0}
.editor-history button{min-height:40px;height:40px;width:42px;padding:5px;font-size:22px;color:#ddd}
body.editor-open #writing-rail{align-self:center;width:45.1px;flex-basis:45.1px;height:max-content;max-height:calc(100% - 72px);margin:8px 8px 8px 7.5px;padding:10px 2px;background:#1e1b1b;border:.6px solid #595454a3;border-radius:16px;overflow:auto}
body.editor-open #writing-rail button{width:36px;min-height:36px;height:36px;padding:7px;border-radius:12px}
body.editor-open .rail-tools{border:0;padding-bottom:4px;gap:4px}body.editor-open .quick-widths{border:0;padding:8px 0 3px}body.editor-open .quick-colors{padding-top:6px;gap:3px}body.editor-open .quick-color-dot{width:21px;height:21px}
body.editor-open #statusbar{position:absolute;z-index:7;bottom:12px;left:72px;right:14px;min-height:36px;height:auto;padding:0;background:transparent;border:0;pointer-events:none;gap:10px}
#statusbar>div{background:#242424d9;border:1px solid #ffffff12;border-radius:20px;padding:2px 5px;pointer-events:auto}#statusbar #document-status{background:#1e1e1c9c;padding:5px 8px;border-radius:8px;font-size:10px;pointer-events:none}
#statusbar #page-number,#statusbar #zoom{background:transparent;border:0}#statusbar #page-number{width:40px}#statusbar #zoom{width:105px}#statusbar #zoom-value{font-size:10px}
body.editor-open #page-stack{padding-bottom:28px}body.editor-open #editor.page-fit #page-stack{padding-block:20px}
body.editor-open #search-panel{top:8px;right:14px;z-index:12}
body.editor-reading #tools,body.editor-reading #insert-image,body.editor-reading #insert-page,body.editor-reading #editor-extra-tools,body.editor-reading #editing-actions,body.editor-reading #editor-properties-toggle,body.editor-reading #properties,body.editor-reading #more,body.editor-reading #editor-insert-page,body.editor-reading #editor-insert-image{display:none!important}
body.light .editor-menu{background:white}body.light.editor-open #writing-rail{background:#f5f5f2;border-color:#ddd}body.light.editor-open #statusbar>div{background:#ffffffdf;border-color:#ccc;color:#333}body.light #statusbar #document-status{background:#ffffffb0}body.light #document-area .editor-history{background:#ffffffe0;border-color:#ddd}body.light .editor-history button{color:#555}
@media(max-width:1024px){#toolbar #editor-document-title{max-width:150px}body.editor-open #toolbar{gap:6px}.editor-header-left,.editor-header-actions{gap:4px}#toolbar .editor-header-actions{gap:4px}#toolbar #tools{gap:3px}}
@media(max-width:850px){#toolbar #editor-document-title{max-width:100px}#toolbar #app-version{font-size:8px;padding:2px 4px}body.editor-open #titlebar{padding:0 7px}#toolbar #editor-header-details{gap:3px}.editor-header-left{gap:2px}#statusbar #document-status{display:none}}
@media(max-width:600px){#toolbar #sidebar-toggle,#toolbar #search-toggle,#toolbar #insert-image,#toolbar #insert-page{display:none}#toolbar #editor-document-title{max-width:70px;min-width:35px;font-size:12px}#toolbar #app-version{font-size:8px}body.editor-open #toolbar{gap:3px}#toolbar button,#toolbar #tools .tool{min-width:31px;width:31px;flex-basis:31px;padding:6px}#toolbar #editor-extra-tools{width:27px;min-width:27px}.editor-header-left,.editor-header-actions{gap:2px}body.editor-open #statusbar{left:62px;right:8px;bottom:8px;gap:6px}#statusbar #bookmark,#statusbar #zoom-value{display:none}#statusbar #zoom{width:83px}#statusbar button{min-width:25px;width:25px;padding:3px;min-height:31px}#statusbar>div{gap:0;padding:1px 3px}#reading-indicator{display:none!important}body.editor-open #writing-rail{margin-left:5px;margin-right:5px}}
