*{box-sizing:border-box}body{margin:0;color:#292a29;background:#faf9f6;font:15px -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}button,input,textarea,select{font:inherit}button{cursor:pointer;border:0;background:transparent;color:inherit;border-radius:8px;padding:9px 12px}button:hover{background:#ece8df}button:focus-visible,input:focus-visible,textarea:focus-visible{outline:2px solid #bc8c20;outline-offset:2px}[hidden]{display:none!important}.primary{background:#f2c44b!important;color:#3a2d0a;font-weight:600;padding:12px 17px}.brandmark{font-size:44px;background:#f2c44b;color:#5b4210;width:76px;height:76px;display:grid;place-items:center;border-radius:21px}.brandmark.small{font-size:26px;width:40px;height:40px;border-radius:12px}#app{display:flex;height:100dvh}aside{width:290px;flex-shrink:0;background:#f2efe8;border-right:1px solid #e6e2d9;display:flex;flex-direction:column;padding:26px 20px}aside header{display:flex;align-items:center;gap:12px;margin-bottom:32px}aside strong{font-size:23px;letter-spacing:-1px}.badge{font-size:9px;letter-spacing:1px;background:#e7e1d5;padding:4px 6px;border-radius:4px;color:#817765}#search{border:1px solid #dfd9cf;background:#fcfbf8;padding:11px;border-radius:9px;width:100%;margin:20px 0 15px}nav{display:grid;gap:4px}nav button{text-align:left}nav .selected{background:#e7e2d8}nav span{float:right}.eyebrow{font-size:10px;letter-spacing:1.7px;font-weight:600;color:#8a8174;margin:27px 0 13px}#noteList{overflow:auto;flex:1}.noteitem{width:100%;text-align:left;padding:16px 13px;display:block;border-bottom:1px solid #e4dfd5;border-radius:9px}.noteitem.active{background:#fffdf8;box-shadow:0 2px 6px #44331409;border-color:transparent}.noteitem strong{font-size:14px;display:block;letter-spacing:0}.noteitem p{font-size:12px;color:#929087;margin:7px 0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.noteitem small{font-size:10px;color:#a39888}footer{padding-top:18px;font-size:11px;color:#888478;display:flex;align-items:center;gap:6px}footer button{margin-left:auto}.serverdot{width:6px;height:6px;background:#77a386;border-radius:50%}main{flex:1;min-width:0;overflow:auto;position:relative}.topbar{position:sticky;top:0;z-index:3;background:#faf9f6ed;backdrop-filter:blur(12px);display:flex;align-items:center;gap:8px;border-bottom:1px solid #e9e5dd;padding:15px 28px;min-height:66px;font-size:12px}#status{margin-left:auto;color:#78907a;font-size:11px}#breadcrumb{color:#898379}#menu{display:none}#empty{min-height:80%;display:flex;align-items:center;justify-content:center;flex-direction:column;text-align:center}h1{font-weight:600;letter-spacing:-1.3px;font-size:34px;margin:10px 0}#empty p{line-height:1.8;color:#8a847a}#empty .primary{margin:16px 0}.hint{font-size:11px;color:#9b9588}.notehead,#textPanel,#inkPanel{max-width:1000px;margin:auto;padding:0 56px}.notehead{padding-top:22px}#title{font-size:36px;font-weight:650;letter-spacing:-1px;border:0;background:transparent;width:100%;outline:none;padding:7px 0 24px}.tabs{display:flex;gap:8px;align-items:center;border-bottom:1px solid #e6e1d6;padding-bottom:14px}.tabs button{font-size:13px;padding:9px 18px}.tabs .active{background:#eee7d8;color:#7e6019}#layers{margin-left:auto;color:#a09a8d;font-size:11px}.formatbar{display:flex;align-items:center;gap:12px;margin-top:19px;color:#a19b8e;font-size:10px;letter-spacing:1px}#text{width:100%;min-height:55vh;resize:vertical;border:none;background:transparent;padding:24px 0;line-height:1.9;font-size:16px;color:#464640;outline:none}#preview{min-height:55vh;line-height:1.85;white-space:pre-wrap;padding-top:18px}#attachments{padding-bottom:32px;display:grid;gap:12px}#attachments img{max-width:100%;max-height:600px;object-fit:contain;border-radius:8px}#attachments a{color:#92711f}.tools{display:flex;flex-wrap:wrap;align-items:center;gap:4px;padding:18px 0 10px;font-size:12px}.tools .active{background:#eadfbf}.divider{border-left:1px solid #ddd4c3;height:22px;margin:0 6px}.color{font-size:22px;padding:2px 7px;border:1px solid transparent}.color.chosen{border-color:#998c70}.color[data-color="#242424"]{color:#242424}.color[data-color="#b64434"]{color:#b64434}.color[data-color="#3465a4"]{color:#3465a4}.color[data-color="#38815c"]{color:#38815c}.color[data-color="#e5ac28"]{color:#e5ac28}select{border:1px solid #ded8cb;background:#faf8f3;border-radius:6px;padding:5px}.paperOptions{display:flex;justify-content:space-between;gap:14px;font-size:10px;color:#928c80;padding:8px 0 16px}#paper{margin-bottom:40px;background-color:white;background-image:radial-gradient(#d5d2cb .8px,transparent .8px);background-size:22px 22px;border:1px solid #e4dfd5;border-radius:8px;box-shadow:0 5px 22px #2c231008}canvas{width:100%;aspect-ratio:5/7;display:block;touch-action:none;user-select:none;-webkit-user-select:none}canvas.finger{touch-action:none}#toast{position:fixed;bottom:24px;left:50%;transform:translateX(-50%);background:#403b31;color:white;padding:16px 22px;border-radius:12px;max-width:90%;z-index:20}#login{height:100dvh;display:grid;place-items:center}#loginForm{max-width:440px;padding:32px;width:100%}#loginForm h1{font-size:30px}#loginForm p{line-height:1.6;color:#8a8174}#loginForm label{display:block;margin:20px 0 12px;color:#797467;font-size:12px}#loginForm input{display:block;width:100%;padding:12px;background:white;border:1px solid #ddd5c6;border-radius:8px;margin-top:8px}#loginForm .primary{width:100%}#loginError{color:#ad4030!important}@media(max-width:1050px){aside{width:240px;padding:20px 14px}.notehead,#textPanel,#inkPanel{padding-left:28px;padding-right:28px}#layers{display:none}.topbar{padding:12px 18px}}@media(max-width:760px){aside{display:none;position:fixed;inset:0 auto 0 0;width:280px;z-index:10;box-shadow:10px 0 30px #0002}aside.open{display:flex}#menu{display:block}#breadcrumb{display:none}.topbar{gap:2px;padding:12px 9px}.topbar button{font-size:11px;padding:8px}#title{font-size:29px}.notehead,#textPanel,#inkPanel{padding-left:18px;padding-right:18px}.paperOptions span{display:none}#empty{padding:24px}h1{font-size:28px}}
.aiBar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:22px;padding:10px 12px;background:#f2eee5;border-radius:10px;font-size:12px}.aiBar span{margin-right:auto;font-size:10px;color:#94876c}button:disabled{opacity:.45;cursor:wait}dialog{border:1px solid #e1d8c5;border-radius:18px;max-width:750px;width:90%;padding:28px;box-shadow:0 15px 80px #0003}dialog::backdrop{background:#24242466}dialog textarea{width:100%;min-height:40vh;padding:16px;line-height:1.7;border:1px solid #e3dece;border-radius:10px;margin:16px 0}dialog p{color:#867e6e;font-size:13px}dialog>div{text-align:right}
.comparison{display:grid;grid-template-columns:1fr 1fr;gap:14px;text-align:left!important;margin:16px 0}.comparison canvas{width:100%;height:auto;border:1px solid #e1d9ca;background:white}.comparison small{color:#94876c;font-size:10px;letter-spacing:1px}#inkDialog{max-width:1000px}

/* Keep Safari selection and callouts away from the ink surface. */
#paper,#paper canvas{-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;-webkit-tap-highlight-color:transparent;touch-action:none}

/* One document surface: ink stays visible while typing, text while drawing. */
#textPanel .formatbar{margin-top:0}#textPanel .aiBar{margin-top:10px}#inkPanel .tools{padding-top:10px}
#paper{position:relative;overflow:hidden;background-color:#fffdf9;background-image:none;margin-bottom:12px;min-height:300px}
#pageText{position:absolute;inset:0 auto auto 0;width:1000px;transform-origin:top left;z-index:1;-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}
#paper #text,#paper #preview{width:1000px;margin:0;padding:40px;min-height:1400px;font-size:25px;line-height:1.65;border:0;border-radius:0;background:transparent;resize:none;overflow:hidden;-webkit-user-select:text;user-select:text;-webkit-touch-callout:default;outline:none}
#paper #preview{white-space:pre-wrap}#paper #canvas{position:absolute;left:0;top:0;z-index:2;aspect-ratio:auto}
#paper.typing #canvas{pointer-events:none}#paper.drawing #pageText{pointer-events:none;-webkit-user-select:none;user-select:none}#paper.drawing #text{-webkit-user-select:none;user-select:none}
#extendPage{margin-bottom:35px;color:#92711f}.paperOptions{padding-bottom:10px}#attachments:empty{display:none}#attachments{padding-bottom:10px}

.tabs{flex-wrap:wrap}.tabs button{padding:9px 12px}#convertControls{display:flex;align-items:center;gap:14px;flex-wrap:wrap;padding:12px;background:#f4edda;border-radius:9px;margin:8px 0}#convertControls span{flex:1;font-size:12px;color:#7e6019}#transcriptionText{width:100%;min-height:260px;padding:14px;border:1px solid #ded8cb;border-radius:8px;font:inherit;font-size:16px;line-height:1.6}

/* Familiar note controls, with more room for the document on a tablet. */
.formatbar{flex-wrap:wrap;gap:4px;letter-spacing:0;font-size:13px;padding:8px 0}.formatbar button{min-height:40px}.formatbar #previewBtn{margin-left:auto;color:#92711f}
#editor:not(.drawingMode) .tools,#editor:not(.drawingMode) .paperOptions{display:none}
.checkline{display:flex;align-items:flex-start;gap:16px;min-height:42px;cursor:pointer}.checkline input{appearance:none;-webkit-appearance:none;flex-shrink:0;width:27px;height:27px;border:2px solid #bc8c20;border-radius:50%;margin:7px 0 0;cursor:pointer}.checkline input:checked{background:#eabb3e}.checkline input:checked:after{content:'✓';display:block;color:#fff;text-align:center;font-size:22px;line-height:23px}.checkline.done span{text-decoration:line-through;color:#928c80}
#preview a{color:#957015}#preview code{background:#f1eadb;padding:2px 5px;border-radius:4px;font-size:.9em}#preview h1,#preview h2,#preview h3{margin:10px 0;font-size:1.3em;line-height:1.4}
@media(max-width:1050px){aside header{margin-bottom:18px}.notehead{padding-top:8px}#title{padding-bottom:15px}.aiBar{padding:4px 8px}.tabs{gap:2px}.tabs button{min-height:42px}}
@media(max-width:600px){.formatbar button{padding:8px}dialog{max-height:85dvh;overflow:auto;padding:18px}}
#paper.typing{touch-action:pan-y;-webkit-user-select:text;user-select:text;-webkit-touch-callout:default}

/* Preserve the contrast of typed text under translucent highlights. */
#paper #canvas{mix-blend-mode:multiply}
.noteRow{display:flex;align-items:flex-start;min-width:0}.noteRow .noteitem{min-width:0;flex:1}.treeToggle{padding:15px 3px;min-width:22px;color:#987220}
#pageFamily{display:flex;flex-wrap:wrap;gap:8px;padding-bottom:8px}#pageFamily:empty{display:none}#pageFamily a,.noteLink{color:#9a7117;text-decoration:none;border-bottom:1px solid #d7c58e}#pageFamily a{padding:7px 10px;border-radius:7px;background:#f2ecdd;font-size:12px}
.chapter{margin:8px 0}.chapterTitle{cursor:pointer;color:#302e27;font-weight:650;line-height:1.5;white-space:normal;min-height:44px;padding:5px 0}.chapterTitle::marker{color:#b18a2b}.chapterTitle.level1{font-size:1.4em}.chapterTitle.level2{font-size:1.2em}.chapterTitle.level3{font-size:1.05em}.chapterBody{padding-left:12px}.chapterBody:empty{min-height:12px}
#outlineHint{font-size:12px;color:#8a7954;padding:9px 0}#outlineHint button{color:#957015}
#structureDialog>label{display:block;font-size:13px;margin:12px 0 6px}#structureTitle{width:100%;padding:12px;border:1px solid #d8ccac;border-radius:8px}#linkChoices{display:grid;max-height:220px;overflow:auto;gap:3px;margin:12px 0;text-align:left}#linkChoices button{text-align:left;padding:12px;background:#f7f3e9}.structureActions{display:flex;flex-wrap:wrap;gap:6px;justify-content:flex-end}
.folderHeading{display:flex;align-items:center;gap:4px;margin-top:18px;color:#8a8174;font-size:10px;letter-spacing:1px}.folderHeading span{margin-right:auto}.folderHeading button{font-size:20px;padding:2px 7px;min-width:32px}#folderTree{max-height:230px;overflow:auto;flex-shrink:0}.folderRow{display:flex;align-items:center;min-width:0}.folderPick{font-size:12px;text-align:left;width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:9px 8px}.folderPick.selected{background:#e7e2d8;color:#6e5114}.folderToggle{padding:7px 2px;min-width:18px}.folderToggle:disabled{cursor:default;opacity:.4}#folderMindmap{font-size:11px;text-align:left;color:#92711f}#folderTree+.eyebrow{margin-top:15px}
#folderDialog label,#moveDialog label{display:grid;gap:7px;margin:16px 0;font-size:13px}#folderDialog input,#folderDialog select,#moveDialog select{width:100%;padding:12px;border:1px solid #dbd2bc;border-radius:8px}#folderError{color:#ad4030}#folderDelete{color:#ad4030}
#mapDialog{width:96vw;max-width:1500px;height:90dvh;max-height:96dvh;padding:20px;overflow:hidden}#mapDialog[open]{display:flex;flex-direction:column}#mapDialog header{display:flex;align-items:flex-start;gap:10px}#mapDialog header>div{flex:1;min-width:0}#mapDialog h2{font-size:20px;margin:0 0 8px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}#mapDialog p{margin:6px 0 12px}#mapClose{font-size:20px}.mapToolbar{display:flex;flex-wrap:wrap;align-items:center;gap:5px;font-size:12px;text-align:left!important;margin-bottom:10px}#mapStage{flex:1;min-height:200px;overflow:hidden;border:1px solid #e2d8c2;border-radius:12px;background:#fffdf8;text-align:left!important}#mapStage svg{display:block;touch-action:none;user-select:none;-webkit-user-select:none}#mapStage [data-map-node]{cursor:pointer}#mapStage [data-map-node]:focus-visible rect{stroke:#9a6c10;stroke-width:3}#mapStatus{font-size:11px!important;color:#8e836e;flex-shrink:0}
@media(max-width:760px){#mapDialog{padding:12px}#mapDialog h2{font-size:17px}.mapToolbar button{padding:8px}#folderTree{max-height:190px}.tabs #moveNote{max-width:180px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}}
#searchStatus{font-size:11px;color:#806d42;margin:0 0 12px}#backlinks{font-size:12px;margin:2px 0 12px;color:#806620}#backlinks summary{cursor:pointer;padding:8px 0}#backlinkList{display:flex;gap:8px;flex-wrap:wrap}#backlinkList a{color:#806620;padding:8px;border-radius:6px;background:#f4efdf;text-decoration:none}
#trashHint{padding:12px;border-radius:9px;background:#f8ecd4;color:#7b5c26;font-size:13px}#resolveConflict{background:#f6dfb3;color:#694716}.topbar{flex-wrap:wrap}.topbar button{white-space:nowrap}
#historyDialog,#conflictDialog{width:min(1100px,94vw);max-width:1100px;max-height:92dvh;overflow:auto}#historyDialog label{display:grid;gap:8px;text-align:left;font-size:13px}#revisionSelect{width:100%;padding:10px}.snapshotGrid{display:grid;grid-template-columns:1fr 1fr;gap:18px;margin:18px 0;text-align:left!important}.snapshot{min-width:0;background:#faf7f0;padding:14px;border-radius:10px}.snapshot h3{margin:0 0 10px;font-size:14px}.snapshot strong{display:block;overflow-wrap:anywhere}.snapshot p{font-size:12px;overflow-wrap:anywhere}.snapshot textarea{width:100%;min-height:0;height:220px;resize:vertical;border:1px solid #ded6c6;border-radius:7px;padding:12px;font:inherit;font-size:14px;background:white}.snapshot canvas{width:100%;max-height:280px;object-fit:contain;background:white;border:1px solid #eee3cf}.recoveryActions{display:flex;justify-content:flex-end;gap:8px;flex-wrap:wrap}#historyError,#conflictError{color:#a24b2e}
@media(max-width:700px){.snapshotGrid{grid-template-columns:1fr}.snapshot textarea{height:160px}.topbar{gap:4px}.topbar button{font-size:12px;padding:7px}}
.noteDragGrip{flex-shrink:0;align-self:center;font-size:22px;padding:12px 6px;color:#a0957b;cursor:grab;touch-action:none;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none}.noteDragging,.noteDragging *{cursor:grabbing!important}.folderPick.dropTarget{background:#f5d775!important;outline:2px solid #b88a1c;outline-offset:-2px}.noteDragging .folderPick{box-shadow:inset 0 0 0 1px #d9ca9c}.noteDragGhost{position:fixed;z-index:100;pointer-events:none;max-width:240px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:12px 16px;border-radius:10px;background:#f2c44b;color:#392d13;box-shadow:0 5px 20px #0003;font-size:14px}

.folderHeading #toggleFolders{margin-right:auto;text-align:left;font-size:11px;letter-spacing:1px;min-height:44px;padding:8px 3px;flex:1}
