/* Designz Docs and Notes */
:root {
  --paper: #f4f1ea;
  --paper2: #ebe6da;
  --paper3: #e2dccd;
  --card: #fbf9f4;
  --ink: #151515;
  --ink2: #4a463f;
  --mute: #8a8478;
  --line: #ddd6c8;
  --red: #ff4a1c;
  --blue: #2f5bea;
  --sun: #ffc531;
  --green: #3d9a5b;
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'Instrument Sans', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body.write { background: var(--paper2); color: var(--ink); font: 14px/1.45 var(--sans); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
kbd { font: 500 11px var(--mono); padding: 2px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; background: #fff; white-space: nowrap; }
[hidden] { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--ink); background: none; font-weight: 600; text-decoration: none; white-space: nowrap; }
.btn.primary { background: var(--ink); color: var(--paper); box-shadow: 2px 2px 0 var(--red); }
.btn.primary:hover { background: #000; }
.btn.ghost:hover { background: var(--paper2); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.text { height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; padding: 0 12px; outline: none; width: 100%; }
.text:focus { border-color: var(--ink); }
.text.area { height: auto; padding: 10px 12px; resize: vertical; }
.w-dim { color: var(--mute); font-size: 13px; }
.av-btn, .av { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--sun); border: 1.5px solid var(--ink); font: 700 12px var(--mono); }

/* ---------- Top bar ---------- */
.w-top { position: relative; z-index: 20; display: flex; align-items: center; gap: 14px; padding: 8px 16px 4px; background: var(--paper); }
.w-brand { font: 700 24px/1 var(--serif); letter-spacing: -0.04em; text-decoration: none; color: var(--ink); padding: 4px 6px; border-radius: 8px; }
.w-brand span { color: var(--red); }
.w-brand:hover { background: var(--paper2); }
.w-head { flex: 1; min-width: 0; }
.w-titlebar { display: flex; align-items: center; gap: 10px; }
.w-name { min-width: 120px; max-width: 520px; width: 26ch; field-sizing: content; font: 600 18px var(--sans); border: 1px solid transparent; background: none; border-radius: 6px; padding: 2px 6px; outline: none; text-overflow: ellipsis; }
.w-name:hover { border-color: var(--line); }
.w-name:focus { border-color: var(--ink); background: #fff; }
.w-saved { font-size: 12px; color: var(--mute); white-space: nowrap; }
.w-menus { display: flex; gap: 0; margin-left: 2px; }
.w-menu { border: 0; background: none; padding: 3px 8px; border-radius: 6px; font-size: 14px; color: var(--ink2); }
.w-menu:hover, .w-menu.open { background: var(--paper2); color: var(--ink); }
.w-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Toolbar ---------- */
.w-toolbar { position: relative; z-index: 15; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; margin: 4px 12px 0; padding: 4px 8px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; }
.tb { display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 5px; border: 0; border-radius: 7px; background: none; color: var(--ink2); font-size: 15px; line-height: 1; }
.tb:hover { background: var(--paper2); color: var(--ink); }
.tb.on { background: var(--ink); color: var(--paper); }
.tb.tx { font-size: 13px; padding: 0 9px; white-space: nowrap; }
.tb.danger { color: #b8320f; }
.tb b { font-weight: 800; font-family: var(--serif); font-size: 16px; }
.tb i { font-family: var(--serif); font-size: 16px; }
.tb u, .tb s { font-size: 15px; font-weight: 600; }
.tb-sep { width: 1px; height: 20px; background: var(--line); margin: 0 5px; }
.tb-select { height: 30px; border: 1px solid transparent; border-radius: 7px; background: none; padding: 0 6px; color: var(--ink); font-size: 13px; cursor: pointer; }
.tb-select:hover { border-color: var(--line); background: #fff; }
.tb-select.style { width: 118px; }
.tb-select.font { width: 132px; }
.tb-select.spacing { width: 86px; }
.tb-size { display: inline-flex; align-items: center; }
.tb-size input { width: 40px; height: 26px; text-align: center; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 13px; outline: none; }
.tb-size input::-webkit-calendar-picker-indicator { display: none !important; }
.tb-size input:focus { border-color: var(--ink); }
.tb-size .tb { min-width: 24px; }
.tb-a { display: flex; flex-direction: column; align-items: center; font: 700 16px/1 var(--serif); gap: 1px; }
.tb-a i, .tb-hl i { display: block; width: 16px; height: 3px; border-radius: 2px; background: var(--ink); }
.tb-hl { display: flex; flex-direction: column; align-items: center; gap: 0; }
.tb-hl svg { width: 16px; height: 16px; }
.tb-hl i { background: #ffd84a; }

/* ---------- Find bar ---------- */
.w-find { position: relative; z-index: 14; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin: 6px 12px 0; padding: 6px 8px; background: #fff; border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); }
.w-find input:not([type]) { height: 30px; border: 1px solid var(--line); border-radius: 7px; padding: 0 10px; outline: none; width: 200px; }
.w-find input:focus { border-color: var(--ink); }
.w-find label { display: flex; align-items: center; gap: 4px; margin-left: 4px; }
::highlight(dz-find) { background-color: #ffe27a; color: inherit; }
::highlight(dz-find-now) { background-color: #ff9a6b; color: #000; }

/* ---------- Body ---------- */
body.docs { display: flex; flex-direction: column; }
body.docs .w-body { position: relative; display: flex; flex: 1; min-height: 0; }
.w-outline { width: 230px; flex: none; padding: 16px 10px 16px 16px; overflow: auto; }
.no-outline .w-outline { display: none; }
.w-side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.w-side-head b { font: 600 13px var(--sans); color: var(--ink2); text-transform: uppercase; letter-spacing: 0.08em; }
.w-hint { margin: 4px 0; font-size: 12px; }
.ol-item { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 5px 8px; border-radius: 6px; color: var(--ink2); font-size: 13px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ol-item:hover { background: var(--paper3); color: var(--ink); }
.ol-item.lv1 { font-weight: 700; color: var(--ink); }
.ol-item.lv2 { font-weight: 600; }
.ol-item.lv3 { padding-left: 20px; }
.ol-item.lv4 { padding-left: 32px; font-size: 12px; }
.w-scroll { flex: 1; min-width: 0; overflow: auto; padding: 22px 24px 80px; }
.w-canvas { display: flex; align-items: flex-start; justify-content: center; gap: 18px; min-width: min-content; margin: 0 auto; }

/* ---------- The page ---------- */
.sheet { position: relative; flex: none; width: var(--pw, 816px); min-height: var(--ph, 1056px); padding: var(--m, 96px); background: #fff; border: 1px solid #d6cfc0; box-shadow: 0 1px 0 #d6cfc0, 0 14px 30px -18px rgba(21, 21, 21, 0.35); }
.page { min-height: calc(var(--ph, 1056px) - 2 * var(--m, 96px)); outline: none; caret-color: var(--red); }
.guides { position: absolute; inset: 0; pointer-events: none; }
.guide { position: absolute; left: 0; right: 0; border-top: 1.5px dashed #d8d0c0; }
.guide span { position: absolute; right: 8px; top: -9px; padding: 0 6px; background: #fff; color: #b3ab9b; font: 500 10px var(--mono); }
.no-guides .guides { display: none; }

/* Document typography */
.doc-content { font: 11pt/1.6 Inter, Arial, sans-serif; color: #1b1a17; word-wrap: break-word; overflow-wrap: anywhere; tab-size: 4; white-space: pre-wrap; }
.doc-content > :first-child { margin-top: 0; }
.doc-content p { margin: 0 0 0.75em; }
.doc-content h1 { font: 700 26pt/1.15 Fraunces, Georgia, serif; letter-spacing: -0.02em; margin: 0.4em 0 0.4em; }
.doc-content h2 { font: 700 18pt/1.25 Fraunces, Georgia, serif; letter-spacing: -0.01em; margin: 1.1em 0 0.35em; }
.doc-content h3 { font: 700 14pt/1.3 Inter, Arial, sans-serif; margin: 1em 0 0.3em; }
.doc-content h4 { font: 700 12pt/1.35 Inter, Arial, sans-serif; margin: 0.9em 0 0.25em; color: #3a3731; }
.doc-content blockquote { margin: 0.8em 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--ink); color: #4a463f; font-style: italic; }
.doc-content pre { font: 10pt/1.5 var(--mono); background: #f4f0e7; border: 1px solid #e6dfd1; border-radius: 6px; padding: 10px 12px; margin: 0.6em 0 1em; white-space: pre-wrap; }
.doc-content code { font: 0.92em var(--mono); background: #f1ede4; border-radius: 4px; padding: 1px 4px; }
.doc-content pre code { background: none; padding: 0; }
.doc-content a { color: #1f4fd8; text-decoration: underline; text-underline-offset: 2px; }
.doc-content ul, .doc-content ol { margin: 0 0 0.75em; padding-left: 1.6em; }
.doc-content li { margin: 0.15em 0; }
.doc-content li > p { margin: 0; }
.doc-content ul ul { list-style: circle; }
.doc-content ul ul ul { list-style: square; }
.doc-content ol ol { list-style: lower-alpha; }
.doc-content ol ol ol { list-style: lower-roman; }
.doc-content ul.checklist { list-style: none; padding-left: 0.1em; }
.doc-content ul.checklist > li { position: relative; padding-left: 1.75em; }
.doc-content ul.checklist > li::before { content: ''; position: absolute; left: 0.1em; top: 0.3em; width: 0.95em; height: 0.95em; border: 1.5px solid #4a463f; border-radius: 3px; background: #fff; cursor: pointer; }
.doc-content ul.checklist > li[data-checked="true"]::before { background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 85% no-repeat; border-color: var(--ink); }
.doc-content ul.checklist > li[data-checked="true"] { color: #9a9385; text-decoration: line-through; text-decoration-color: #b8b0a0; }
.doc-content hr { border: 0; border-top: 1.5px solid #cfc8ba; margin: 1.2em 0; }
.doc-content hr.page-break { position: relative; border-top: 1.5px dashed #b9b09e; margin: 1.6em 0; overflow: visible; }
.doc-content hr.page-break::after { content: 'Page break'; position: absolute; left: 50%; top: -0.75em; transform: translateX(-50%); background: #fff; padding: 0 8px; font: 500 9px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #9a9385; }
.doc-content table { width: 100%; border-collapse: collapse; margin: 0.6em 0 1em; table-layout: fixed; }
.doc-content td, .doc-content th { border: 1px solid #c9c1b2; padding: 6px 8px; vertical-align: top; text-align: left; min-width: 30px; }
.doc-content th { background: #f1ece2; font-weight: 600; }
.doc-content td > p:last-child, .doc-content th > p:last-child { margin: 0; }
.doc-content img { max-width: 100%; height: auto; vertical-align: bottom; border-radius: 2px; cursor: default; }
.doc-content img.img-left { float: left; margin: 0.2em 1.2em 0.6em 0; }
.doc-content img.img-right { float: right; margin: 0.2em 0 0.6em 1.2em; }
.doc-content img.img-center { display: block; margin: 0.4em auto 0.8em; }
.doc-content::after { content: ''; display: block; clear: both; }
.doc-content nav.toc { display: block; margin: 0.6em 0 1.2em; padding: 12px 16px; border: 1px solid #e0d9ca; border-radius: 8px; background: #fbf9f4; user-select: none; }
.doc-content nav.toc .toc-title { font-weight: 700; margin: 0 0 6px; font-family: Fraunces, Georgia, serif; font-size: 13pt; }
.doc-content nav.toc a { display: block; color: #1b1a17; text-decoration: none; padding: 2px 0; cursor: pointer; }
.doc-content nav.toc a:hover { color: #1f4fd8; text-decoration: underline; }
.doc-content nav.toc a[data-level="2"] { padding-left: 1.2em; }
.doc-content nav.toc a[data-level="3"] { padding-left: 2.4em; font-size: 0.95em; }
.doc-content nav.toc .toc-empty { color: #9a9385; margin: 0; }
.doc-content .cmt { background: rgba(255, 197, 49, 0.35); border-bottom: 2px solid #e8a900; cursor: pointer; }
.doc-content .cmt.active { background: rgba(255, 166, 0, 0.55); }
.doc-content .cmt.cmt-done { background: none; border: 0; cursor: text; }
.page > p:only-child:has(> br:only-child)::before { content: 'Start writing, or type # and a space for a heading.'; color: #b3ab9b; float: left; pointer-events: none; }

/* Selected picture */
.img-sel { position: absolute; outline: 2px solid var(--blue); outline-offset: 1px; pointer-events: none; z-index: 2; }
.img-handle { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 3px; background: #fff; border: 2px solid var(--blue); cursor: nwse-resize; pointer-events: auto; }

/* Floating bar */
.float-bar { position: fixed; z-index: 40; display: flex; align-items: center; gap: 2px; padding: 4px; background: #fff; border: 1.5px solid var(--ink); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); max-width: calc(100vw - 16px); flex-wrap: wrap; }
.float-bar .tb.on { background: var(--ink); color: #fff; }
.fb-label { font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); padding: 0 6px; }
.fb-link { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #1f4fd8; padding: 0 8px; font-size: 13px; }

/* ---------- Comments ---------- */
.w-comments { position: relative; width: 270px; flex: none; }
.cmt-head { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px; }
.cmt-head b { font: 600 13px var(--sans); color: var(--ink2); text-transform: uppercase; letter-spacing: 0.08em; }
.cmt-card { position: absolute; left: 0; right: 0; padding: 10px 12px; background: #fff; border: 1px solid #d6cfc0; border-radius: 12px; box-shadow: 0 6px 16px -10px rgba(21, 21, 21, 0.3); transition: top 0.15s, transform 0.15s; cursor: pointer; font-size: 13px; }
.cmt-card.active { border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); transform: translateX(-6px); cursor: default; }
.cmt-card.done { opacity: 0.7; }
.cc-head { display: flex; align-items: center; gap: 8px; }
.cc-head .av { width: 28px; height: 28px; font-size: 11px; }
.cc-who { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.cc-who small { color: var(--mute); font-size: 11px; }
.cc-done:hover { background: #e3f3e8; color: var(--green); }
.cc-text { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.cmt-card textarea { width: 100%; margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 8px; resize: vertical; outline: none; font-size: 13px; }
.cmt-card textarea:focus { border-color: var(--ink); }
.cc-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }
.cc-reply { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--paper2); }
.cc-reply small { color: var(--mute); font-size: 11px; }
.cc-reply p { margin: 2px 0 0; white-space: pre-wrap; }
.cc-input { display: none; width: 100%; margin-top: 8px; height: 30px; border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; outline: none; font-size: 13px; }
.cmt-card.active .cc-input { display: block; }
.cc-input:focus { border-color: var(--ink); }
.cc-orphan { margin: 6px 0 0; font-size: 12px; color: var(--mute); font-style: italic; }

/* ---------- Status bar ---------- */
.w-status { display: flex; align-items: center; gap: 14px; height: 30px; padding: 0 12px; background: var(--paper); border-top: 1px solid var(--line); font-size: 12px; color: var(--ink2); flex: none; }
.w-status .grow { flex: 1; }
.w-status .tb { display: inline-flex; align-items: center; justify-content: center; flex: none; height: 24px; min-width: 24px; font-size: 14px; }
.w-status > span { white-space: nowrap; }
.w-status .tb.tx { font: 500 12px var(--mono); }

/* Focus mode */
.focus-mode .w-top, .focus-mode .w-toolbar, .focus-mode .w-outline, .focus-mode .w-comments { display: none !important; }
.focus-mode .w-scroll { padding-top: 40px; }

/* ---------- Menus, popovers, modals, toasts ---------- */
.pop { position: fixed; z-index: 200; min-width: 200px; max-height: calc(100vh - 20px); overflow: auto; padding: 6px; border-radius: 12px; background: var(--card); border: 1px solid var(--ink); box-shadow: 4px 4px 0 var(--ink); }
.pop button { display: flex; align-items: center; gap: 4px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 10px 7px 4px; border-radius: 7px; font-size: 14px; }
.pop button:hover:not(:disabled) { background: var(--paper2); }
.pop button:disabled { opacity: 0.45; cursor: default; }
.pop button.danger { color: #b8320f; }
.pm-check { width: 18px; flex: none; text-align: center; font-size: 12px; }
.pm-label { flex: 1; }
.pop kbd { margin-left: 18px; background: none; border: 0; color: var(--mute); padding: 0; }
.pop hr { border: 0; border-top: 1px solid var(--line); margin: 5px 4px; }
.pop-label { margin: 6px 8px 4px; font: 600 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--mute); }
.color-pop { width: 252px; }
.swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; padding: 2px 8px 6px; }
.swatches button { width: 26px; height: 26px; padding: 0; border-radius: 50%; border: 1px solid rgba(21, 21, 21, 0.25); }
.swatches button:hover { transform: scale(1.15); background-color: inherit; }
.pop-row { display: flex; justify-content: space-between; padding: 4px; border-top: 1px solid var(--line); margin-top: 4px; }
.pop-row .tb { width: auto; }
.pop-row label { position: relative; cursor: pointer; }
.pop-row input[type=color] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.table-pop { min-width: 0; }
.tgrid { display: grid; grid-template-columns: repeat(8, 20px); gap: 3px; padding: 6px; }
.tgrid i { width: 20px; height: 20px; border: 1px solid var(--line); border-radius: 3px; background: #fff; cursor: pointer; }
.tgrid i.on { background: var(--sun); border-color: var(--ink); }
.modal { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 20px; background: rgba(21, 21, 21, 0.35); opacity: 0; transition: opacity 0.15s; }
.modal.in { opacity: 1; }
.m-card { width: min(460px, 100%); max-height: calc(100vh - 40px); overflow: auto; background: var(--card); border-radius: 18px; border: 1.5px solid var(--ink); box-shadow: 8px 8px 0 var(--ink); }
.m-card.wide { width: min(620px, 100%); }
.m-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px 4px; }
.m-head h3 { margin: 0; font: 600 22px var(--serif); letter-spacing: -0.02em; }
.x { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--mute); }
.m-body { padding: 10px 20px 16px; }
.m-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 20px 20px; flex-wrap: wrap; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink2); }
.wc { width: 100%; border-collapse: collapse; }
.wc td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.wc td:last-child { text-align: right; font-weight: 600; }
.symbols { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; }
.symbols button { height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 18px; }
.symbols button:hover { border-color: var(--ink); background: var(--sun); }
#toasts { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 400; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; max-width: min(560px, calc(100vw - 32px)); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--paper); opacity: 0; transform: translateY(8px); transition: all 0.2s; }
.toast.in { opacity: 1; transform: none; }
.toast button { border: 0; background: var(--sun); color: var(--ink); border-radius: 8px; padding: 4px 10px; font-weight: 600; }

/* ---------- Small screens ---------- */
@media (max-width: 1100px) {
  .w-outline { display: none; }
  .w-comments { width: 230px; }
}
@media (max-width: 760px) {
  .w-top { flex-wrap: wrap; gap: 6px; padding: 6px 10px 2px; }
  .w-head { order: 3; flex-basis: 100%; }
  .w-actions { margin-left: auto; }
  .w-actions #commentBtn { display: none; }
  .w-name { width: 100%; }
  .w-toolbar { flex-wrap: nowrap; overflow-x: auto; margin: 4px 8px 0; }
  .w-scroll { padding: 12px 8px 60px; }
  .w-canvas { flex-direction: column; align-items: center; }
  .w-comments { width: 100%; max-width: 420px; }
  .cmt-card { position: relative; top: auto !important; margin-bottom: 8px; transform: none !important; }
  .w-find input:not([type]) { width: 140px; }
}

/* ---------- Printing and PDF ---------- */
@media print {
  html, body { height: auto; overflow: visible !important; background: #fff !important; }
  body.docs { display: block; }
  .w-top, .w-toolbar, .w-find, .w-outline, .w-comments, .w-status, .float-bar, #toasts, #modalRoot, .guides, .img-sel, .pop { display: none !important; }
  .w-body, .w-scroll, .w-canvas { display: block !important; overflow: visible !important; padding: 0 !important; margin: 0 !important; height: auto !important; zoom: 1 !important; }
  .sheet { width: auto !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; box-shadow: none !important; }
  .page { min-height: 0 !important; }
  .doc-content .cmt { background: none !important; border: 0 !important; }
  .doc-content hr.page-break { break-after: page; page-break-after: always; border: 0; margin: 0; }
  .doc-content hr.page-break::after { display: none; }
  .doc-content h1, .doc-content h2, .doc-content h3, .doc-content h4 { break-after: avoid; }
  .doc-content tr, .doc-content img { break-inside: avoid; }
  .page:empty::before, .page > p:only-child::before { display: none; }
  .page { caret-color: transparent; }
}

/* ======================= Notes ======================= */
body.notes { background: var(--paper); }
.n-app { display: grid; grid-template-columns: 228px 340px 1fr; height: 100vh; }
.n-side { display: flex; flex-direction: column; gap: 12px; padding: 18px 12px; border-right: 1px solid var(--line); overflow: auto; }
.n-side .w-brand { font-size: 26px; align-self: flex-start; }
.n-new { display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px; border-radius: 999px; border: 0; background: var(--ink); color: var(--paper); font-weight: 600; box-shadow: 3px 3px 0 var(--red); transition: transform 0.12s, box-shadow 0.12s; }
.n-new span { font-size: 19px; line-height: 1; }
.n-new:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--red); }
.n-new:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--red); }
.n-nav { display: flex; flex-direction: column; gap: 1px; }
.n-nav button { display: flex; align-items: center; gap: 10px; width: 100%; border: 0; background: none; padding: 7px 10px; border-radius: 9px; text-align: left; color: var(--ink2); font-weight: 500; }
.n-nav button span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n-nav button em { font: 500 12px var(--mono); font-style: normal; color: var(--mute); }
.n-nav button:hover { background: var(--paper2); color: var(--ink); }
.n-nav button.on { background: var(--card); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); }
.n-nav button.on svg { color: var(--red); }
.n-hash { flex: none !important; width: 17px; text-align: center; font: 600 15px var(--mono); color: var(--mute); }
.n-tags-head { margin: 8px 10px -6px; font: 600 12px var(--sans); text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); }
.n-tip { margin: 4px 10px; font-size: 12px; line-height: 1.45; }
.n-side-foot { margin-top: auto; padding: 0 10px; display: flex; flex-direction: column; gap: 6px; }
.n-side-foot p { margin: 0; font-size: 12px; }
.n-side-foot a { font-size: 12px; text-decoration: none; }
.n-side-foot a:hover { color: var(--ink); }

.n-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--paper2); }
.n-list-head { display: flex; align-items: center; gap: 6px; padding: 14px 12px 6px; }
.n-menu { display: none; }
.n-search { flex: 1; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); color: var(--mute); }
.n-search:focus-within { border-color: var(--ink); }
.n-search input { flex: 1; min-width: 0; border: 0; outline: none; background: none; color: var(--ink); }
.n-list .tb-select { width: 104px; }
.n-list-title { margin: 6px 16px 8px; font: 600 20px var(--serif); letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n-items { flex: 1; overflow: auto; padding: 0 10px 30px; display: flex; flex-direction: column; gap: 8px; }
.n-item { display: flex; flex-direction: column; gap: 4px; width: 100%; text-align: left; padding: 11px 13px; border-radius: 12px; border: 1px solid var(--line); background: var(--tint, #fff); transition: transform 0.12s, box-shadow 0.12s; }
.n-item:hover { border-color: var(--ink2); }
.n-item.on { border: 1.5px solid var(--ink); box-shadow: 3px 3px 0 var(--ink); transform: translate(-1px, -1px); }
.n-item-top { display: flex; align-items: center; gap: 6px; }
.n-item-top b { flex: 1; min-width: 0; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.n-pin { flex: none; color: var(--red); }
.n-prev { font-size: 13px; color: var(--ink2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.n-prev i { color: var(--mute); }
.n-item mark { background: #ffe27a; color: inherit; border-radius: 2px; }
.n-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--mute); }
.n-prog { width: 42px; height: 5px; border-radius: 3px; background: rgba(21, 21, 21, 0.1); overflow: hidden; }
.n-prog i { display: block; height: 100%; background: var(--green); }
.n-tag { font: 500 11px var(--mono); color: var(--ink2); }
.n-none { text-align: center; padding: 40px 16px; color: var(--mute); }

.n-editor { position: relative; min-width: 0; overflow: auto; background: var(--paper); }
.n-empty { display: grid; place-content: center; justify-items: center; text-align: center; height: 100%; padding: 30px; color: var(--mute); }
.n-empty svg { width: 120px; height: 80px; color: var(--red); }
.n-empty h3 { font: 600 24px var(--serif); color: var(--ink); margin: 8px 0 4px; }
.n-empty p { margin: 0; max-width: 340px; }
.n-sheet { max-width: 780px; min-height: calc(100% - 40px); margin: 20px auto; padding: 14px 34px 40px; background: var(--tint, #fff); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 14px 30px -22px rgba(21, 21, 21, 0.4); display: flex; flex-direction: column; }
.n-ed-top { display: flex; align-items: center; gap: 4px; min-height: 40px; }
.n-ed-top .grow { flex: 1; }
.n-ed-top .w-saved { margin-right: 6px; }
.n-back { display: none; }
.n-dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid rgba(21, 21, 21, 0.45); vertical-align: middle; }
.n-colors .n-dot { margin-right: 8px; }
.n-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.n-chip { display: inline-flex; align-items: center; gap: 2px; height: 26px; padding: 0 4px 0 9px; border-radius: 999px; background: rgba(21, 21, 21, 0.07); font: 500 12px var(--mono); }
.n-chip button { border: 0; background: none; width: 20px; height: 20px; border-radius: 50%; color: var(--mute); font-size: 14px; line-height: 1; }
.n-chip button:hover { background: rgba(21, 21, 21, 0.1); color: var(--ink); }
.n-addtag { width: 116px; height: 26px; border: 1px dashed var(--line); border-radius: 999px; background: none; padding: 0 10px; font: 500 12px var(--mono); outline: none; }
.n-addtag:focus { border-style: solid; border-color: var(--ink); background: #fff; width: 140px; }
.n-title { border: 0; background: none; outline: none; font: 700 30px/1.15 var(--serif); letter-spacing: -0.02em; padding: 10px 0 6px; width: 100%; }
.n-title::placeholder { color: #c4bcac; }
.n-tools { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; flex-wrap: wrap; gap: 2px; padding: 4px 0 8px; margin-bottom: 4px; border-bottom: 1px solid rgba(21, 21, 21, 0.08); background: var(--tint, #fff); }
.n-tools .tb.tx { display: inline-flex; gap: 6px; font-size: 13px; }
.n-tools .dictate.on { background: var(--red); color: #fff; }
.n-body { flex: 1; outline: none; min-height: 240px; padding-top: 8px; font-size: 11.5pt; line-height: 1.6; caret-color: var(--red); white-space: pre-wrap; }
.n-body h2 { font-size: 16pt; margin-top: 0.8em; }
.n-body h1 { font-size: 20pt; }
.n-body > p:only-child:has(> br:only-child)::before { content: 'Write something. Type [] and a space for a checklist.'; color: #b3ab9b; float: left; pointer-events: none; }
.n-foot { margin: 20px 0 0; font-size: 12px; }

@media (max-width: 1100px) {
  .n-app { grid-template-columns: 200px 290px 1fr; }
  .n-sheet { margin: 12px; padding: 12px 22px 30px; }
}
@media (max-width: 860px) {
  .n-app { grid-template-columns: 300px 1fr; }
  .n-side { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 250px; background: var(--paper); transform: translateX(-100%); transition: transform 0.2s; }
  body.side-open .n-side { transform: none; box-shadow: 20px 0 50px rgba(0, 0, 0, 0.15); }
  .n-menu { display: inline-grid; }
}
@media (max-width: 640px) {
  .n-app { grid-template-columns: 1fr; }
  .n-editor { display: none; }
  body.show-editor .n-list { display: none; }
  body.show-editor .n-editor { display: block; }
  .n-back { display: inline-grid; }
  .n-sheet { margin: 0; border-radius: 0; border: 0; min-height: 100%; padding: 8px 16px 30px; }
  .n-title { font-size: 24px; }
  .n-list .tb-select { width: 90px; }
}
