/* Documents share the existing workbench and save together as one note. */
.notebook-tab-rail{flex:0 0 126px;min-height:0;display:flex;flex-direction:column;gap:8px;padding:10px 8px;background:var(--surface);border-right:1px solid var(--border);overflow:hidden}
.notebook-tab-list{display:flex;flex-direction:column;gap:5px;overflow:auto;min-height:0;flex:1;padding:2px}
.notebook-tab-rail button{border:1px solid transparent;border-radius:8px;background:transparent;color:var(--text-muted);padding:10px 8px;cursor:pointer;min-height:38px}
.notebook-tab-list button{display:flex;align-items:center;gap:7px;text-align:left;width:100%;font-size:12px;line-height:1.35}
.notebook-tab-list button svg{flex-shrink:0}
.notebook-tab-list button span{overflow-wrap:anywhere}
.notebook-tab-list button[aria-selected=true]{color:var(--primary);background:var(--surface-alt);border-color:var(--border);font-weight:700}
.notebook-tab-rail button:hover{background:var(--surface-alt);color:var(--text)}
.notebook-tab-rail button:focus-visible{outline:2px solid var(--primary);outline-offset:1px}
.notebook-add-tab{align-self:flex-start}
.notebook-workspace{flex:1;min-width:0;min-height:0;display:grid;gap:5px;background:var(--border);padding:0;position:relative}
.notebook-workspace[data-panes="1"]{grid-template-columns:minmax(0,1fr);grid-template-rows:minmax(0,1fr)}
.notebook-workspace[data-panes="2"]{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:minmax(0,1fr)}
.notebook-workspace[data-panes="3"],.notebook-workspace[data-panes="4"]{grid-template-columns:repeat(2,minmax(0,1fr));grid-template-rows:repeat(2,minmax(0,1fr))}
.notebook-workspace.tab-drop-ready{outline:3px solid var(--primary);outline-offset:-3px}
.notebook-display-pane{min-width:0;min-height:0;display:flex;flex-direction:column;background:var(--surface-alt);overflow:hidden}
.notebook-display-pane>header{display:flex;align-items:center;justify-content:space-between;gap:6px;padding:5px 8px;border-bottom:1px solid var(--border);background:var(--surface);min-height:34px}
.notebook-display-pane>header[hidden]{display:none}
.notebook-display-pane.is-active>header{box-shadow:inset 0 -2px var(--primary)}
.notebook-display-pane>header button{background:transparent;border:0;color:var(--text-muted);cursor:pointer;padding:4px;font-size:12px}
.notebook-display-pane>header .notebook-focus-pane{font-weight:700;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left}
.notebook-display-pane.is-active>header .notebook-focus-pane{color:var(--primary)}
.notebook-pane-content,.notebook-live-editor{display:flex;flex:1;min-height:0;min-width:0;overflow:hidden;position:relative}
.notebook-live-editor>[hidden]{display:none!important}
.notebook-reference-scroller{flex:1;overflow:auto;overscroll-behavior:contain;padding:0;min-width:0;min-height:0}
.notebook-reference-page{background:#fcfbf7;box-shadow:var(--shadow-md);flex-shrink:0;border-radius:3px;overflow:hidden;position:relative;cursor:inherit;touch-action:none}
.notebook-reference-page canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:contain}
.notebook-infinite-host{position:relative;flex:1;overflow:hidden;min-height:0;min-width:0;background:#fcfbf7}
.notebook-infinite-surface{position:absolute;inset:0;width:100%;height:100%;touch-action:none;outline:none}
.notebook-canvas-active:not(.notebook-split-active) .notebook-thumbs{display:none!important}
.notebook-transfer-ghost{position:fixed;width:165px;max-height:210px;z-index:10050;pointer-events:none;opacity:.65;filter:drop-shadow(0 8px 14px #0004);border:2px solid var(--primary);border-radius:5px;background:var(--surface);overflow:hidden}
.notebook-transfer-ghost img{display:block;width:100%;max-height:210px;object-fit:contain}
.notebook-transfer-notice{position:fixed;top:90px;left:50%;transform:translateX(-50%);z-index:10051;max-width:calc(100vw - 30px);padding:10px 18px;border:1px solid var(--border);border-radius:10px;box-shadow:var(--shadow-sm);background:var(--surface);color:var(--text);pointer-events:none;font-size:14px}
.notebook-transferring,.notebook-transferring *{cursor:grabbing!important;user-select:none!important}
@media(max-width:700px){.notebook-tab-rail{flex-basis:66px;padding:7px 3px}.notebook-tab-list button{flex-direction:column;font-size:10px;padding:7px 3px;gap:3px}.notebook-tab-list button span{max-height:2.7em;overflow:hidden}.notebook-display-pane>header{padding:4px}.notebook-transfer-notice{top:130px;font-size:12px}}

.notebook-canvas-eraser{position:absolute;width:28px;height:28px;border:1.5px solid rgba(120,130,150,.9);border-radius:50%;transform:translate(-50%,-50%);pointer-events:none}
.notebook-workspace-notice{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);z-index:20;max-width:min(460px,90%);padding:14px 20px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);box-shadow:var(--shadow-md);pointer-events:none;text-align:center}

.notebook-split-active .notebook-thumbs,.notebook-split-active .notebook-pages-toggle{display:none!important}

/* Small anchored menus keep the notebook visible and usable. */
.notebook-popover{position:fixed;z-index:10060;width:max-content;min-width:190px;max-width:min(300px,calc(100vw - 16px));max-height:calc(100vh - 16px);overflow:auto;padding:6px;border:1px solid var(--border);border-radius:10px;background:var(--surface);color:var(--text);box-shadow:var(--shadow-md)}
.notebook-popover .action-list{display:flex;flex-direction:column;gap:2px}
.notebook-popover .action-list>button{display:flex;align-items:center;gap:9px;min-height:36px;padding:9px 10px;border:0;border-radius:6px;background:transparent;color:var(--text);box-shadow:none;text-align:left;font:inherit;font-size:13px;cursor:pointer}
.notebook-popover .action-list>button:hover,.notebook-popover .action-list>button:focus-visible{background:var(--surface-alt);outline:1px solid var(--border)}
.notebook-popover button:disabled{opacity:.45;cursor:default}
.notebook-popover button svg{flex:none}
.notebook-popover button span{min-width:0;overflow-wrap:anywhere}
.notebook-popover button small{display:block;font-size:11px;color:var(--text-muted);margin-top:3px}
.notebook-popover-label{font-size:12px;color:var(--text-muted);padding:6px 10px}
.notebook-tab-rename{display:grid;gap:10px;padding:6px;width:245px;max-width:100%}
.notebook-tab-rename .field{margin:0}

.notebook-page-selected { outline: 2px solid var(--primary); outline-offset: 3px; }
.notebook-delete-page { position: absolute; top: 8px; right: 8px; z-index: 8; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 7px; color: var(--danger); background: var(--surface); box-shadow: 0 2px 7px #0002; cursor: pointer; }
.notebook-page-image-selection[data-mode="crop"] { outline: 2px solid #256b78; }

.notebook-append-page { display: flex; gap: 8px; align-items: center; justify-content: center; margin: 4px auto 32px; }
.notebook-page-reordering { position: relative; z-index: 10; cursor: grabbing; box-shadow: 0 6px 24px #0003; }
.notebook-page.page-insert-before::before, .notebook-page.page-insert-after::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: var(--primary); z-index: 11; pointer-events: none; }
.notebook-page.page-insert-before::before { top: 0; }
.notebook-page.page-insert-after::after { bottom: 0; }
