[hidden]{display:none!important}
/* "Quiet Paper" tokens. The old names (--bg, --paper, --ink, --muted, --line, --th, --sel) are aliases so older rules keep working. */
:root{
  --chrome:#fbfbfe;--bg-0:#f4f5fb;--bg-1:#eceffa;--surface:#fff;--surface-2:#f7f8fd;
  --text-1:#1b1f2e;--text-2:#545b70;--text-3:#5b6277;
  --border:#e4e7f2;--border-strong:#d5d9e8;
  --accent:#4f5bd5;--accent-ink:#fff;--accent-soft:#eceefd;
  /* the desk behind the note: a soft blue-to-lavender glow in light, plain in dark */
  --desk:radial-gradient(1200px 520px at 15% -10%,#e3e8ff 0,transparent 60%),radial-gradient(900px 520px at 100% 0,#f6e9ff 0,transparent 55%),var(--bg-0);
  --danger:#c8372d;--danger-soft:#fbeceb;
  --focus:0 0 0 2px var(--surface),0 0 0 4px #4f5bd566;
  --sh-1:0 1px 2px #1b1f2e12,0 12px 36px #4f5bd514;--sh-row:0 1px 2px #1b1f2e14,0 0 0 1px #1b1f2e0a;
  --sh-2:0 8px 24px #1f1e1c1f,0 1px 3px #1f1e1c14;
  --sh-tab:0 1px 2px #00000014;
  --r-sm:6px;--r-md:8px;--r-lg:12px;
  --s1:4px;--s2:8px;--s3:12px;--s4:16px;--s5:24px;--s6:40px;
  --ui:"Segoe UI Variable Text","Segoe UI",system-ui,-apple-system,"Helvetica Neue",sans-serif;
  --body:var(--ui);
  --mono:"Cascadia Code","Cascadia Mono",Consolas,ui-monospace,Menlo,monospace;
  --fs-xs:12px;--fs-sm:13px;--fs-ui:14px;--fs-body:16px;
  --ease:cubic-bezier(.2,0,0,1);--t:120ms;
  --hover:#1f1e1c0b;--code:#f2f1ed;--sel-note:var(--surface);
  --bg:var(--bg-0);--paper:var(--surface);--ink:var(--text-1);--muted:var(--text-2);--line:var(--border);
  --th:var(--surface-2);--sel:var(--accent-soft);
  --c-com:#8a8780;--c-str:#2e7d32;--c-num:#b45309;--c-kw:#7c3aed;--c-fn:#1d5fc4;
  --co-note:#2a62c8;--co-tip:#137a47;--co-imp:#6a3fc4;--co-warn:#9a5b00;--co-caut:#c02020;
  color-scheme:light;
}
:root[data-theme="dark"]{
  --desk:var(--bg-0);--chrome:#111214;--bg-0:#18191c;--bg-1:#1d1e21;--surface:#212226;--surface-2:#27282c;
  --text-1:#ebe9e4;--text-2:#a8a59e;--text-3:#8f8c85;
  --border:#2f2f33;--border-strong:#3c3c41;
  --accent:#9aa3f5;--accent-ink:#12152e;--accent-soft:#272b4a;
  --danger:#ff7b72;--danger-soft:#3a2224;
  --sh-1:0 0 0 1px #ffffff0d;--sh-2:0 12px 32px #0008,0 0 0 1px #ffffff12;--sh-tab:var(--sh-1);--sh-row:var(--sh-1);
  --hover:#ffffff0f;--code:#2a2a2e;--sel-note:#262a31;
  --c-com:#8d8a83;--c-str:#8fd18f;--c-num:#f0b56a;--c-kw:#c4a5ff;--c-fn:#8cb8ff;
  --co-note:#7aa5f0;--co-tip:#6fd19a;--co-imp:#b597ff;--co-warn:#f0b56a;--co-caut:#ff7b7b;
  color-scheme:dark;
}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]){
    --desk:var(--bg-0);--chrome:#111214;--bg-0:#18191c;--bg-1:#1d1e21;--surface:#212226;--surface-2:#27282c;
    --text-1:#ebe9e4;--text-2:#a8a59e;--text-3:#8f8c85;
    --border:#2f2f33;--border-strong:#3c3c41;
    --accent:#9aa3f5;--accent-ink:#12152e;--accent-soft:#272b4a;
    --danger:#ff7b72;--danger-soft:#3a2224;
    --sh-1:0 0 0 1px #ffffff0d;--sh-2:0 12px 32px #0008,0 0 0 1px #ffffff12;--sh-tab:var(--sh-1);--sh-row:var(--sh-1);
    --hover:#ffffff0f;--code:#2a2a2e;--sel-note:#262a31;
    --c-com:#8d8a83;--c-str:#8fd18f;--c-num:#f0b56a;--c-kw:#c4a5ff;--c-fn:#8cb8ff;
    --co-note:#7aa5f0;--co-tip:#6fd19a;--co-imp:#b597ff;--co-warn:#f0b56a;--co-caut:#ff7b7b;
    color-scheme:dark;
  }
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;font:var(--fs-ui)/1.5 var(--ui);background:var(--bg-0);color:var(--text-1);display:flex;flex-direction:column;-webkit-font-smoothing:antialiased}
/* buttons are ghosts unless they say otherwise */
button{font:inherit;color:var(--text-2);padding:5px 10px;border:1px solid transparent;background:transparent;border-radius:var(--r-sm);cursor:pointer;white-space:nowrap;display:inline-flex;align-items:center;gap:6px}
button:hover{background:var(--hover);color:var(--text-1)}
button:active{background:var(--border)}
.bar button,.menu button,dialog button,#lockPane button{min-height:32px}
:focus-visible{outline:0;box-shadow:var(--focus)}
input:focus-visible,textarea:focus-visible,select:focus-visible{border-color:var(--accent)}
/* quiet outline: secondary buttons in dialogs, the lock panel and small inline actions */
dialog .row button,#lockPane button,#sortList button,#shareList button,#folderInfo button,#codeBar button,#status .undo,#sortMsg .undo,#openBar button,#focusX,#mathBox button,#history .hbar button{border-color:var(--border-strong);background:var(--surface);color:var(--text-1)}
dialog .row button:hover,#lockPane button:hover,#sortList button:hover,#shareList button:hover,#folderInfo button:hover,#codeBar button:hover,#status .undo:hover,#sortMsg .undo:hover,#openBar button:hover,#focusX:hover,#mathBox button:hover,#history .hbar button:hover{background:var(--hover)}
button.primary,#copyBtn,dialog .row button.primary,#lockPane button.primary,#openBar button.primary{background:var(--accent);border-color:var(--accent);color:var(--accent-ink);font-weight:500}
button.primary:hover,#copyBtn:hover,dialog .row button.primary:hover,#lockPane button.primary:hover,#openBar button.primary:hover{background:var(--accent);color:var(--accent-ink);filter:brightness(1.06)}
#copyBtn{padding:5px 12px}
svg.ic{width:16px;height:16px;fill:none;stroke:currentColor;stroke-width:1.75;stroke-linecap:round;stroke-linejoin:round;flex-shrink:0}
.iconbtn{width:32px;height:32px;min-height:32px;padding:0;justify-content:center;flex:none}
.iconbtn svg.ic{width:18px;height:18px}
.caret{font-size:.75em;opacity:.6}
.bar{display:flex;align-items:center;gap:6px;padding:6px 14px;background:var(--chrome);border-bottom:1px solid var(--border);flex-wrap:wrap}
.top{border-bottom:0;padding:8px 16px;gap:2px;min-height:52px}
.top strong,#appName{font-size:15px;font-weight:600;letter-spacing:-.01em;margin:0 6px 0 4px}
.top #newBtn,.top .dd:has(#copyBtn),.top .dd:has(#saveBtn){margin-left:var(--s3)}
.grow{flex:1}
#status{color:var(--text-3);font-size:var(--fs-xs);margin-left:8px;font-variant-numeric:tabular-nums}
.tools{padding:4px 14px 6px;gap:1px}
.tools button{padding:3px 8px;font-size:var(--fs-sm);color:var(--text-2)}
.tools button:hover{color:var(--text-1)}
.tools button[aria-pressed="true"],.tools button.on{background:var(--accent-soft);color:var(--accent)}
.sep{width:1px;height:16px;background:var(--border);margin:0 8px;flex:none}
.icon{padding:2px 9px}
.dd{position:relative}
.dd.split{display:flex}.dd.split>#saveBtn{border-top-right-radius:0;border-bottom-right-radius:0;padding:5px 10px}.dd.split>#saveMore{border-top-left-radius:0;border-bottom-left-radius:0;border-left:0;min-width:0;padding:5px 7px;font-size:14px;line-height:1}
.menu button:has(kbd){display:flex;align-items:center}.menu kbd{margin-left:auto;padding-left:16px;font:11px var(--mono,ui-monospace,monospace);opacity:.6}
.menu{position:absolute;top:calc(100% + 4px);left:0;z-index:20;background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--sh-2);padding:6px;display:flex;flex-direction:column;min-width:240px}
.menu.right{left:auto;right:0}
.menu button{border:0;text-align:left;border-radius:var(--r-sm);width:100%;justify-content:flex-start;padding:7px 12px;color:var(--text-1)}
/* Sign in: the one button in that menu that does something, so it looks like it */
.menu button.gbtn{display:flex;align-items:center;justify-content:center;gap:10px;margin:8px 0 4px;padding:9px 14px;background:var(--accent);color:var(--accent-ink);font-weight:600;border-radius:999px}
.menu button.gbtn:hover,.menu button.gbtn:focus-visible{background:var(--accent);filter:brightness(1.1)}
.gmark{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#fff;flex-shrink:0}
.gmark svg{width:16px;height:16px;stroke:none}.gmark .gr{fill:#ea4335}.gmark .gb{fill:#4285f4}.gmark .gy{fill:#fbbc05}.gmark .gg{fill:#34a853}

.menu hr.msep,.menu hr{border:0;border-top:1px solid var(--border);margin:4px 6px}
.main{flex:1;display:flex;min-height:0}
#side{width:250px;flex:none;border-right:1px solid var(--border);background:var(--chrome);display:flex;flex-direction:column;min-height:0}
#search{margin:12px;padding:7px 10px 7px 30px;border:1px solid var(--border);border-radius:var(--r-md);background:var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Ccircle cx='7' cy='7' r='4.5' fill='none' stroke='%239a978f' stroke-width='1.6'/%3E%3Cpath d='M10.5 10.5l3 3' stroke='%239a978f' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") 10px 50%/14px no-repeat;color:var(--text-1);font:inherit}
#search::placeholder{color:var(--text-3)}
#folderInfo{padding:0 14px 6px;font-size:var(--fs-xs);color:var(--text-3);overflow-wrap:anywhere}
#folderInfo button{font-size:var(--fs-xs);padding:1px 8px;margin-top:4px}
#list{list-style:none;margin:0;padding:0 8px 10px;overflow-y:auto}
#list li{display:flex;align-items:flex-start;gap:4px;padding:8px 10px;border-radius:var(--r-md);cursor:pointer;margin-bottom:1px}
#list li:hover{background:var(--hover)}
#list li.on{background:var(--sel-note);box-shadow:inset 3px 0 0 var(--accent),var(--sh-row)}
#list .t{flex:1;min-width:0}
#list .n{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:500;color:var(--text-1)}
#list .d{display:block;font-size:var(--fs-xs);color:var(--text-3);font-variant-numeric:tabular-nums}
#list .x{border:0;background:none;color:var(--text-3);padding:0 6px;visibility:hidden}
#list .x:hover{color:var(--text-1)}
#list li:hover .x,#list li.on .x,#list .x.sure{visibility:visible}
#list .x.sure{color:var(--danger);background:var(--danger-soft);font-size:var(--fs-xs)}
.work{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0}
.tabs{display:flex;align-items:center;gap:4px;padding:4px 12px 0;background:transparent;overflow-x:auto;flex:none;scrollbar-width:thin}
.tab{display:flex;align-items:center;flex:none;max-width:210px;padding:5px 4px 5px 12px;border:0;border-radius:8px;background:none;color:var(--text-2);font-size:var(--fs-sm);cursor:pointer;user-select:none}
.tab:hover{background:var(--hover);color:var(--text-1)}
.tab.on{background:var(--surface);box-shadow:var(--sh-tab);color:var(--text-1);font-weight:500}
.tab .n{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.tab .x{border:0;background:none;padding:0 6px;margin-left:4px;color:var(--text-3);font-size:15px;line-height:1.2;opacity:0;border-radius:4px}
/* locked and pinned notes: line icons in the list and tabs (were colour emoji) */
.lk::before,.pin::before{content:"";display:inline-block;width:12px;height:12px;margin-right:6px;vertical-align:-1px;background:currentColor;opacity:.75}
.lk::before{content:"" / "Locked, ";-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E") center/contain no-repeat}
.pin::before{content:"" / "Pinned, ";-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 17v5M9 3h6l-1 6 3 3v2H7v-2l3-3z'/%3E%3C/svg%3E") center/contain no-repeat}
.tab:hover .x,.tab.on .x,.tab .x:focus-visible{opacity:1}
.tab .x:hover{background:var(--hover);color:var(--text-1)}
.tabs .plus{border:0;background:none;padding:2px 10px;font-size:17px;line-height:1.2;color:var(--text-3)}
.work{background:var(--desk)}
#page{flex:1;overflow:auto;padding:24px 16px 40px;background:transparent}
#doc{caret-color:var(--accent)}
#doc{max-width:740px;margin:0 auto;background:var(--surface);padding:48px 64px;min-height:calc(100% - 4px);border-radius:var(--r-lg);box-shadow:var(--sh-1);outline:none;overflow-wrap:break-word;font:var(--fs-body)/1.7 var(--body);color:var(--text-1)}
#doc:focus-visible{box-shadow:var(--sh-1)}
#doc:empty:before{content:attr(data-placeholder);color:var(--text-3)}
#doc *{max-width:100%}
#doc>:first-child{margin-top:0}
#doc h1{font-size:1.7em;font-weight:650;letter-spacing:-.02em;line-height:1.25;margin:1em 0 .4em}
#doc h2{font-size:1.35em;font-weight:600;letter-spacing:-.01em;line-height:1.3;margin:1em 0 .4em}
#doc h3{font-size:1.15em;font-weight:600;line-height:1.35;margin:.9em 0 .3em}
#doc h4,#doc h5,#doc h6{font-size:1.05em;font-weight:600;margin:.8em 0 .3em}
#doc p{margin:.6em 0}
#doc ul,#doc ol{padding-left:1.6em;margin:.5em 0}
#doc li::marker{color:var(--text-3)}
#doc table{border-collapse:collapse;margin:12px 0;display:block;overflow-x:auto;max-width:100%}
#doc th,#doc td{border:1px solid var(--border);padding:6px 12px;text-align:left;vertical-align:top}
#doc th{background:var(--surface-2);font-weight:600}
#doc code{background:var(--code);padding:.1em .35em;border-radius:4px;font-family:var(--mono);font-size:.88em}
#doc pre{background:var(--code);padding:14px 16px;border-radius:var(--r-md);overflow-x:auto;font-size:.88em;line-height:1.6}
#doc pre code{background:none;padding:0;font-size:1em}
#doc blockquote{margin:.8em 0;padding-left:14px;border-left:2px solid var(--border-strong);color:var(--text-2)}
#doc a{color:var(--accent)}
/* FR50 checklists: the box is drawn, not an <input>, so the note's HTML stays plain */
#doc li[data-task]{list-style:none;position:relative}
#doc li[data-task]::before{content:'';position:absolute;left:-1.5em;top:.32em;width:1em;height:1em;border:1.5px solid var(--muted);border-radius:3px;cursor:pointer;box-sizing:border-box}
#doc li[data-task="1"]::before{border-color:var(--accent);background:var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.2 8.4l3 3 6.6-6.8' fill='none' stroke='white' stroke-width='2.2'/%3E%3C/svg%3E") center/85% no-repeat}
#doc li[data-task="1"]{color:var(--muted)}
#doc li[data-task="1"] li:not([data-task="1"]){color:var(--ink)}
/* FR51 callouts and toggles */
#doc blockquote[data-callout]{--co:var(--co-note);color:var(--ink);border-left:3px solid var(--co);background:color-mix(in srgb,var(--co) 8%,transparent);padding:8px 14px;border-radius:0 var(--r-md) var(--r-md) 0}
#doc blockquote[data-callout]::before{display:block;font-size:12px;font-weight:600;letter-spacing:.03em;color:var(--co);content:'ⓘ NOTE'}
#doc blockquote[data-callout="tip"]{--co:var(--co-tip)}
#doc blockquote[data-callout="tip"]::before{content:'✦ TIP'}
#doc blockquote[data-callout="important"]{--co:var(--co-imp)}
#doc blockquote[data-callout="important"]::before{content:'❢ IMPORTANT'}
#doc blockquote[data-callout="warning"]{--co:var(--co-warn)}
#doc blockquote[data-callout="warning"]::before{content:'⚠ WARNING'}
#doc blockquote[data-callout="caution"]{--co:var(--co-caut)}
#doc blockquote[data-callout="caution"]::before{content:'⛔ CAUTION'}
#doc blockquote[data-callout="toggle"]{--co:var(--line);background:none}
#doc blockquote[data-callout="toggle"]::before{content:none}
#doc blockquote[data-fold]>:first-child{position:relative;padding-left:1.3em}
#doc blockquote[data-fold]>:first-child::before{content:'▾';position:absolute;left:0;width:1.2em;color:var(--muted);cursor:pointer}
#doc blockquote[data-fold="closed"]>:first-child::before{content:'▸'}
#doc blockquote[data-fold="closed"]>:not(:first-child){display:none}
/* FR53 math: the TeX shows as code until KaTeX has drawn it */
#doc [data-math]{font-family:var(--mono);cursor:pointer}
#doc p[data-math]{text-align:center;margin:.8em 0}
/* FR52 code colours (CSS Custom Highlight API: no markup in the note) */
::highlight(kp-com){color:var(--c-com)}
::highlight(kp-str){color:var(--c-str)}
::highlight(kp-num){color:var(--c-num)}
::highlight(kp-kw){color:var(--c-kw)}
::highlight(kp-fn){color:var(--c-fn)}
#codeBar{position:absolute;z-index:30;transform:translateX(-100%);display:flex;gap:4px}
#codeBar button{font-size:var(--fs-xs);padding:1px 8px;opacity:.92}
#codeBar .lang{color:var(--muted)}
#codeBar .langIn{width:9em;font:12px var(--mono);padding:1px 6px;border:1px solid var(--accent);border-radius:var(--r-sm);background:var(--paper);color:var(--ink)}
/* FR53 the math box */
#mathBox{position:absolute;z-index:40;width:min(440px,calc(100vw - 16px));background:var(--surface);border:1px solid var(--border);border-radius:10px;box-shadow:var(--sh-2);padding:8px}
#mathBox textarea{width:100%;font:14px var(--mono);border:1px solid var(--border);border-radius:var(--r-sm);padding:6px;background:var(--bg);color:var(--ink);resize:vertical}
#mathBox .prev{min-height:2em;padding:8px 4px;text-align:center;overflow-x:auto}
#mathBox .row{display:flex;gap:6px;align-items:center}
#mathBox .hint{flex:1;font-size:12px;color:var(--muted)}

/* FR57 version history */
#history{padding:0;width:min(900px,calc(100vw - 24px));height:min(620px,calc(100vh - 48px))}
#history[open]{display:flex;flex-direction:column}
#history .hhead{display:flex;align-items:center;gap:10px;padding:10px 14px;border-bottom:1px solid var(--line)}
#history .hhead .x{border:0;background:none;padding:0 6px;font-size:18px;color:var(--muted)}
#history .hhead .d{flex:1;color:var(--muted);font-size:12px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#history .hbody{flex:1;display:flex;min-height:0}
#history .hlist{list-style:none;margin:0;padding:4px;width:230px;flex:none;overflow:auto;border-right:1px solid var(--line)}
#history .hlist li{display:flex;flex-direction:column;padding:6px 10px;border-radius:var(--r-sm);cursor:pointer}
#history .hlist li .d{color:var(--muted);font-size:12px}
#history .hlist li[aria-selected=true]{background:var(--sel)}
#history .hlist li:hover{background:var(--hover)}
#history .hview{flex:1;display:flex;flex-direction:column;min-width:0}
#history .hdoc{flex:1;overflow:auto;padding:8px 20px;line-height:1.5}
#history .hdoc img{max-width:100%}
#history .none{color:var(--muted)}
#history .hbar{padding:10px 14px;border-top:1px solid var(--line);text-align:right}
@media (max-width:720px){#history .hbody{flex-direction:column}#history .hlist{width:auto;max-height:30%;border-right:0;border-bottom:1px solid var(--line)}}
/* FR55 palette */
#palette{margin-top:12vh;padding:0;width:min(560px,calc(100vw - 24px))}
#palIn{width:100%;border:0;border-bottom:1px solid var(--border);padding:14px 16px;font:inherit;font-size:16px;background:transparent;color:var(--ink);outline:0}
#palList{list-style:none;margin:0;padding:6px;max-height:min(55vh,420px);overflow:auto}
#palList li{display:flex;gap:12px;align-items:baseline;padding:7px 12px;border-radius:var(--r-sm);cursor:pointer}
#palList li>span:first-child{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#palList li .d,#palList .none{color:var(--text-3);font-size:var(--fs-xs)}
#palList li[aria-selected=true]{background:var(--sel)}
#palList li:hover{background:var(--hover)}
/* FR55 outline panel */
#info{width:230px;flex:none;border-left:1px solid var(--border);background:var(--chrome);overflow:auto;padding:10px 12px;font-size:var(--fs-sm)}
#info .ihead{display:flex;align-items:center;justify-content:space-between}
#info .x{border:0;background:none;padding:0 6px;font-size:16px;color:var(--muted)}
#outline button{display:block;width:100%;text-align:left;border:0;background:none;padding:4px 6px;white-space:normal;line-height:1.35;border-radius:var(--r-sm);color:var(--text-1)}
#outline button:hover{background:var(--hover)}
#outline .l1{font-weight:600}
#outline .l3{padding-left:18px}
#outline .l4{padding-left:30px;color:var(--muted)}
#outline .none{color:var(--muted)}
/* FR57 folders in the list */
#list li.folder{align-items:center;padding:12px 10px 4px;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.06em;color:var(--text-3);user-select:none}
#list li.folder:hover{background:none;color:var(--text-2)}
#list li.folder .n{font-weight:600;color:inherit}
#list li.folder .c{font-size:11px;font-weight:400}
#list li.in{padding-left:22px}
/* FR54 links and tags */
::highlight(kp-link){color:var(--accent);text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--accent) 45%,transparent)}
::highlight(kp-nolink){color:var(--muted);text-decoration:underline dotted}
::highlight(kp-tag){color:var(--accent);background-color:color-mix(in srgb,var(--accent) 10%,transparent)}
#doc.pointing{cursor:pointer}
/* FR70 find and replace: matches are highlights, so the note's own HTML never changes */
::highlight(kp-find){background-color:color-mix(in srgb,#f5c542 45%,transparent)}
::highlight(kp-findon){background-color:#f5a623;color:#1a1a1a}
#findBar{gap:6px;font-size:var(--fs-sm)}
#findBar input:not([type=checkbox]){padding:5px 8px;border:1px solid var(--border);border-radius:var(--r-md);background:var(--surface);color:var(--text-1);font:inherit;width:14em;max-width:100%}
#findBar.none #findIn{border-color:#d9534f}
#findBar .count{min-width:5.5em;color:var(--text-2);font-variant-numeric:tabular-nums}
#findBar .case{display:inline-flex;align-items:center;gap:4px;color:var(--text-2)}
#findBar .case input{accent-color:var(--accent)}
#findBar .repl{display:inline-flex;gap:6px;flex-wrap:wrap}
#findBar .repl[hidden]{display:none}
#findX{margin-left:auto}
@media (max-width:720px){#findBar input:not([type=checkbox]){width:100%;flex:1 1 10em}}
#slashMenu{position:absolute;top:0;min-width:220px;max-width:300px;max-height:320px;overflow-y:auto;z-index:40}
#slashMenu button[aria-selected=true]{background:var(--sel)}
#linkMenu{position:absolute;top:0;min-width:220px;max-width:340px;z-index:40}
#linkMenu button{display:block;overflow:hidden;text-overflow:ellipsis}
#linkMenu button[aria-selected=true]{background:var(--sel)}
#tagBar{display:flex;flex-wrap:wrap;gap:4px;padding:0 10px 6px}
.chip{font-size:var(--fs-xs);padding:1px 9px;border-radius:999px;color:var(--accent);background:var(--accent-soft);border-color:transparent}
.chip:hover{background:var(--accent-soft);color:var(--accent);filter:brightness(.97)}
.chip.on{background:var(--accent);color:var(--accent-ink)}
#info h4{margin:16px 0 4px;font-size:11px;font-weight:600;color:var(--text-3);text-transform:uppercase;letter-spacing:.06em}
#info .links button{display:block;width:100%;text-align:left;border:0;background:none;padding:3px 6px;white-space:normal;color:var(--accent);border-radius:4px}
#info .links button:hover{background:var(--hover)}
#info .chips{display:flex;flex-wrap:wrap;gap:4px}
#info .none{color:var(--muted);margin:2px 6px}
/* FR55 the word counter */
.work{position:relative}
#count{position:absolute;right:14px;bottom:8px;font-size:var(--fs-xs);color:var(--text-3);font-variant-numeric:tabular-nums;background:color-mix(in srgb,var(--bg) 85%,transparent);padding:0 6px;border-radius:4px;pointer-events:none}
#count:empty{display:none}
@media (max-width:720px){ #count{display:none}
  #codeBar button,#info .x,#history .hhead .x,#focusX{min-height:40px;min-width:40px}
  #focusX{opacity:1}
  #doc li[data-task]::before{width:1.25em;height:1.25em} }
/* FR55 focus mode: only the note (and the status line) are left */
body.focus header.top>:not(#status),body.focus #tools,body.focus #side,body.focus #tabs,body.focus #info{display:none!important}
body.focus header.top{background:transparent;border:0;min-height:30px}
#focusX{position:fixed;top:6px;right:12px;z-index:25;font-size:12px;opacity:.7}
#focusX:hover,#focusX:focus-visible{opacity:1}
@media (max-width:720px){
  #info{position:fixed;top:0;bottom:0;right:0;z-index:30;width:min(280px,85vw);box-shadow:var(--sh-2)}
}

#doc p[data-stamp]{color:var(--text-3);font-size:12.5px;margin:20px 0 4px;padding-top:8px;border-top:1px dashed var(--line);cursor:pointer;user-select:none}
#doc p[data-stamp]:first-child{border-top:0;margin-top:0;padding-top:0}
#doc p[data-stamp]:hover{color:var(--accent)}
#stampMenu,#noteMenu{position:fixed;top:0;left:0;z-index:40}
#noteMenu hr{border:0;border-top:1px solid var(--border);margin:4px 6px}
#noteMenu .danger{color:var(--danger)}
#noteMenu .danger:hover{background:var(--danger-soft);color:var(--danger)}
#list .rename{font:inherit;font-weight:500;width:100%;padding:1px 4px;border:1px solid var(--accent);border-radius:4px;background:var(--surface);color:var(--text-1)}
.menu input{margin:4px;padding:6px 10px;border:1px solid var(--border-strong);border-radius:var(--r-sm);background:var(--surface);color:var(--ink);font:inherit}
.menu .mhead{font-size:var(--fs-xs);font-weight:500;letter-spacing:.02em;color:var(--text-3);padding:6px 12px 4px}
.menu .mnote{font-size:var(--fs-xs);color:var(--text-2);padding:0 12px 6px;max-width:28ch}
.menu .mlink{display:block;padding:7px 12px;border-radius:var(--r-sm);color:var(--accent);text-decoration:none;font-size:var(--fs-sm)}
.menu .mlink:hover{background:var(--hover)}
a#appName{color:inherit;text-decoration:none}
a#appName[href]:hover{color:var(--accent)}
.tbltools{display:inline-flex;align-items:center;gap:1px}
.top #themeBtn{margin-left:var(--s3)}
#acctMenu{min-width:260px}
#acctMenu .mnote{max-width:none}
#intoList{display:flex;flex-direction:column;max-height:50vh;overflow-y:auto}
#intoList button{display:block;overflow:hidden;text-overflow:ellipsis;max-width:320px}
#doc img{height:auto;vertical-align:bottom;border-radius:2px}
#doc.edge,#doc.edge *,body.resizing,body.resizing *{cursor:col-resize!important}
body.resizing{user-select:none}
/* the phone-only Paste button (FR33) */
.phone{display:none}
.sidehead,#moreMenu .phoneonly,#scrim{display:none}
@media (max-width:720px){
  #side{position:fixed;top:0;bottom:0;left:0;z-index:30;box-shadow:var(--sh-2);transform:translateX(-105%);transition:transform .15s}
  body.side-open #side{transform:none}
  #doc{padding:24px 20px;border-radius:0;box-shadow:none;min-height:100%}
  #page{padding:0}
  /* phone: the top bar is one row that scrolls sideways; icon buttons drop their words (still in aria-label) */
  .top{padding:6px 8px;gap:2px;padding-top:calc(6px + env(safe-area-inset-top));flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none}
  .top::-webkit-scrollbar{display:none}
  .top>*{flex:none}
  .top .grow{flex:1 0 0}
  #appName,.top strong{display:none}
  .top .lbl{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
  #copyBtn .lbl,#saveBtn .lbl{position:static;width:auto;height:auto;overflow:visible;clip:auto}
  /* the paste-in, copy-out loop first; the rest after Copy for */
  .top .dd:has(#saveBtn),.top #themeBtn,.top .dd:has(#acctBtn),.top .dd:has(#moreBtn){order:1}
  .top #themeBtn{margin-left:0}
  .tbltools{flex:none}
  /* a fade at the end of the bottom bar says "more this way" (sticky, so its menus are not clipped); the top bar shows a sliver of the next button instead */
  #tools::after{content:"";position:sticky;right:0;flex:none;width:24px;align-self:stretch;pointer-events:none;background:linear-gradient(to right,transparent,var(--chrome));order:2}
  .tab{min-height:40px}.tab .x,#list .x{min-width:36px;min-height:36px;display:inline-flex;align-items:center;justify-content:center}
  .top #newBtn,.top .dd:has(#copyBtn),.top .dd:has(#saveBtn){margin-left:4px}
  .top .iconbtn,.top button:has(.lbl){min-width:40px;height:40px;justify-content:center;position:relative}
  .top .menu{position:fixed;top:calc(54px + env(safe-area-inset-top));left:8px;right:8px;min-width:0;max-height:70vh;overflow-y:auto}
  .tabs{-webkit-mask-image:linear-gradient(to right,transparent,#000 20px,#000 calc(100% - 28px),transparent);mask-image:linear-gradient(to right,transparent,#000 20px,#000 calc(100% - 28px),transparent)}
  /* phone (FR33): formatting bar at the bottom within thumb reach, one row that scrolls sideways, clear of the home bar */
  #tools{order:3;flex-wrap:nowrap;overflow-x:auto;border-bottom:0;border-top:1px solid var(--border);padding:6px 8px calc(6px + env(safe-area-inset-bottom));scrollbar-width:none}
  .main{order:2}
  .bar button,.menu button{min-height:40px;padding:4px 10px}
  .top .iconbtn{width:40px;padding:0}
  .tools .sep{flex:none}
  #fontMenu{position:fixed;top:auto;left:8px;bottom:calc(60px + env(safe-area-inset-bottom))} /* the bar scrolls, so its menu cannot hang inside it */
  #status{position:fixed;left:8px;right:8px;bottom:calc(64px + env(safe-area-inset-bottom));margin:0;text-align:center;pointer-events:none;z-index:25}
  #status:not(:empty){background:var(--surface);border:1px solid var(--border);border-radius:var(--r-md);padding:6px 10px;box-shadow:var(--sh-2);color:var(--text-2)}
  .phone{display:inline-flex}
  /* phone as an app: one top row that fits (Sign in, Save, theme and search move to ⋯ and the drawer), no tab strip */
  .top{overflow-x:visible}
  .top #palBtn,.top #saveBtn,.top #saveMore,.top #themeBtn,.top #acctBtn{display:none}
  #moreMenu .phoneonly{display:block}
  #moreMenu button.phoneonly.gbtn{display:flex;justify-content:center;margin:4px 4px 6px}
  .sidehead{display:flex}
  #tabs{display:none}
  #copyBtn .for{display:none}
  #side{width:min(320px,86vw)}
  .sidehead{align-items:center;gap:6px;padding:calc(10px + env(safe-area-inset-top)) 8px 6px 14px}
  .sidehead b{font-size:var(--fs-lg,17px)}
  .sidehead button{min-height:40px;min-width:40px}
  #sideNew{color:var(--accent);font-weight:600}
  #list li,#list>*{min-height:48px}
  body.side-open #scrim,body:has(#info:not([hidden])) #scrim{display:block}
  #scrim{position:fixed;inset:0;z-index:29;background:rgb(0 0 0 / .4)}
  .top{position:relative;z-index:31}
  #side,#info{top:var(--topH,56px)}
  .sidehead{padding-top:10px}
  body.side-open #menuBtn .ic-menu,#menuBtn .ic-x{display:none}
  body.side-open #menuBtn .ic-x{display:inline}
}
#menuBtn .ic-x{display:none}
@media (min-width:721px){
  body.side-closed #side{display:none}
}
#doc img[data-picked]{outline:2px solid var(--accent);outline-offset:1px}
#doc img{cursor:default}
.tab .rename{font:inherit;width:16em;max-width:50vw;padding:1px 4px;border:1px solid var(--accent);border-radius:4px;background:var(--surface);color:var(--text-1)}
.tab:has(.rename){max-width:none}
#doc img[data-picked]::selection{background:transparent}
#fontMenu .sizes{display:grid;grid-template-columns:repeat(4,1fr);gap:2px}
#fontMenu .sizes button{text-align:center;padding:2px 4px}
#doc tr[data-total] td{font-weight:600;border-top:2px solid var(--muted)}
#doc td[contenteditable="false"]{cursor:default}
/* voice typing (FR58) and auto-sort (FR59) */
#voiceBtn.on,#voiceBtn.on:hover{background:var(--danger);color:var(--surface);border-color:var(--danger)}
#voiceLive{position:fixed;left:50%;transform:translateX(-50%);bottom:calc(18px + env(safe-area-inset-bottom));max-width:min(560px,calc(100vw - 32px));background:var(--surface);color:var(--text-2);border:1px solid var(--border);border-radius:18px;padding:6px 14px;font-style:italic;box-shadow:var(--sh-2);z-index:30}
#status .undo,#sortMsg .undo{pointer-events:auto;margin-left:6px;padding:4px 12px}
#voiceBtn.on{font-weight:600}
#sortList{list-style:none;padding:0;margin:8px 0}
#sortList li{display:flex;align-items:center;gap:8px;justify-content:space-between;padding:6px 0;border-bottom:1px solid var(--border)}
@media (max-width:720px){#voiceLive{bottom:calc(100px + env(safe-area-inset-bottom))}#status .undo{min-height:40px;padding:8px 14px}}
/* v3 dialogs: AI set-up, Ask, Share */
dialog{border:0;border-radius:14px;background:var(--surface);color:var(--text-1);padding:22px 24px;width:min(460px,calc(100vw - 32px));box-shadow:var(--sh-2)}
dialog::backdrop{background:#0f0f1066;backdrop-filter:blur(2px)}
dialog h2{margin:0 0 8px;font-size:17px;font-weight:600;letter-spacing:-.01em}
dialog label{display:flex;flex-direction:column;gap:4px;margin:12px 0;font-size:var(--fs-sm);color:var(--text-2)}
dialog label.check{flex-direction:row;align-items:center;gap:8px;color:var(--text-1)}
dialog input:not([type=checkbox]),dialog select,dialog textarea{font:inherit;color:var(--text-1);background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--r-md);padding:7px 10px;width:100%}
dialog input:not([type=checkbox]):focus,dialog select:focus,dialog textarea:focus,#lockPane input:focus,.menu input:focus,#search:focus,#mathBox textarea:focus{outline:0;border-color:var(--accent);box-shadow:var(--focus)}
dialog input[type=checkbox]{accent-color:var(--accent)}
dialog .row{display:flex;align-items:center;justify-content:flex-end;gap:8px;margin-top:16px;flex-wrap:wrap}
dialog .hint,dialog .msg{font-size:var(--fs-sm);color:var(--text-2);margin:6px 0;overflow-wrap:anywhere}
dialog .msg:empty{display:none}
button.primary:disabled,button:disabled{opacity:.5;cursor:default}
#doc p[data-ai]{color:var(--accent)}
/* v3 sharing: the "Shared by" label, the open-a-shared-link bar, the access list */
.bar.note{font-size:var(--fs-sm);color:var(--text-2);padding:6px 16px}
#openBar{color:var(--ink)}
dialog h3{margin:14px 0 4px;font-size:14px}
#shareList{list-style:none;margin:0;padding:0;font-size:13px}
#shareList li{display:flex;align-items:center;gap:8px;padding:6px 0;border-top:1px solid var(--border)}
#shareList li span{flex:1;overflow-wrap:anywhere}
#doc[contenteditable="false"]{cursor:default}
/* locked notes (FR62): the unlock panel shown in place of a shut note, and the recovery code */
#lockPane{max-width:400px;margin:12vh auto;background:var(--surface);padding:32px;border-radius:14px;box-shadow:var(--sh-1);text-align:center}
#lockPane .lockIcon{width:56px;height:56px;border-radius:50%;background:var(--accent-soft);color:var(--accent);display:flex;align-items:center;justify-content:center;margin:0 auto 12px}
#lockPane .lockIcon svg{width:28px;height:28px}
#lockPane h2{margin:0 0 8px;font-size:18px;font-weight:600;letter-spacing:-.01em}
#lockPane .hint{font-size:var(--fs-sm);color:var(--text-2);margin:6px 0}
#lockPane .row{display:flex;justify-content:center;gap:8px;margin:16px 0 12px;flex-wrap:wrap}
#lockPane input{flex:1;min-width:0;width:100%;font:inherit;color:var(--text-1);background:var(--surface);border:1px solid var(--border-strong);border-radius:var(--r-md);padding:9px 12px}
#lockPane .msg{color:var(--text-1);min-height:1.2em;margin:6px 0}
#lockPane details{margin-top:6px;font-size:var(--fs-ui)}
#lockPane summary{cursor:pointer;color:var(--accent);list-style:none}
#lockPane summary::-webkit-details-marker{display:none}
#lockPane a{color:var(--accent)}
#lockKey,#lockGoogle{margin:6px 0}
.code{font:600 19px/1.5 var(--mono);letter-spacing:.06em;background:var(--surface-2);border:1px dashed var(--border-strong);border-radius:var(--r-md);padding:10px 12px;text-align:center;user-select:all;overflow-wrap:anywhere}
@media (max-width:720px){#lockPane{margin:16px 8px;padding:20px 18px}#lockPane button,#lockPane input{min-height:44px}}
/* motion: quick and quiet, and none at all when the system asks */
button,.tab,.tab .x,#list li,input,textarea,select{transition:background-color var(--t) var(--ease),color var(--t) var(--ease),box-shadow var(--t) var(--ease),border-color var(--t) var(--ease),opacity var(--t) var(--ease)}
.dd>.menu:not([hidden]){animation:pop var(--t) var(--ease)}
@keyframes pop{from{opacity:0;transform:translateY(-4px) scale(.98)}}
@media (prefers-reduced-motion:reduce){*,*::before,*::after{transition:none!important;animation:none!important}}
