/* Lumin Reader: the Notebook (PB-U5; design 10 and 11, build plan 6.8).
   Copyright (C) 2026 B7 Collective LLC. Licensed under AGPL-3.0-only.
   Every book (the Notebook tab), this book (the reader's panel, in the paper's own colors), Recently deleted, the
   look-back card, the Export sheet and the printed commonplace book. Uses the app's tokens; the reader's panel maps them
   to the paper (--pcard, --ink, --pmuted, --prule). Every target is at least 44 px. */

.nb-page, .nbr, .nb-lb, #layer .nb-selbar, .nb-dsheet, .nb-pop {
  --nb-card: var(--card); --nb-soft: color-mix(in srgb, var(--ink) 6%, var(--card)); --nb-muted: var(--muted); --nb-line: var(--line);
}

/* ---- Highlight color dots and rules ---- */
.nb-dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; background: rgb(var(--hl-y, 242 181 68)); }
.nb-dot.c-g { background: rgb(var(--hl-g, 120 170 110)); } .nb-dot.c-b { background: rgb(var(--hl-b, 104 152 214)); } .nb-dot.c-p { background: rgb(var(--hl-p, 222 122 152)); }
.nb-dot.c-u { background: transparent; box-shadow: inset 0 -3px 0 var(--teal, #1F6F78); border-radius: 2px; }

/* ---- The page ---- */
.nb-page { gap: var(--s4); }
.nb-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3) var(--s4); }
.nb-head .page-head { flex: 1 1 200px; min-width: 0; }
.nb-hacts { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.nb-hacts .btn { margin-bottom: 3px; }
.nb-pmore { width: 44px; height: 44px; }
.nb-searchwrap { display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s4); min-height: 52px; border-radius: var(--r-pill); background: var(--card); color: var(--muted);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset, 0 3px 0 var(--lip); }
.nb-searchwrap:focus-within { box-shadow: 0 0 0 2px var(--link), 0 3px 0 var(--lip); }
.nb-page .nb-search { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--ink); font-size: var(--t-m); min-height: 48px; outline: none; padding: 0; box-shadow: none; }
.nb-search::-webkit-search-cancel-button { cursor: pointer; }
.nb-mid { display: flex; flex-direction: column; gap: var(--s3); min-width: 0; }
.nb-types { display: flex; gap: var(--s2); overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; scroll-padding-inline: 8px; }
.nb-types::-webkit-scrollbar { display: none; }
.nb-type { flex-shrink: 0; font-weight: 700; }
.nb-type[aria-checked="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.nb-n { font-weight: 400; opacity: .82; font-variant-numeric: tabular-nums; }
.nb-type .nb-n { margin-left: 2px; }
.nb-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.nb-viewsw .segctl button { padding: 0 14px; min-height: 40px; }
.nb-viewmenu { display: none; }
.nb-drops { display: flex; flex-wrap: wrap; gap: var(--s2); }
.nb-dropw { display: inline-flex; align-items: center; gap: 2px; }
.nb-drop { font-weight: 700; max-width: 220px; }
.nb-drop[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.nb-drop { overflow: hidden; text-overflow: ellipsis; }
.nb-dropx { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); display: inline-grid; place-items: center; border-radius: 50%; }
.nb-side { display: none; }
.nb-dpane { display: none; }
.nb-empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s4); padding: var(--s6) var(--s4); color: var(--muted); }
.nb-empty p { max-width: 42ch; color: var(--ink); }
.nb-empty[hidden] { display: none; }
.nb-list[hidden] { display: none; }

/* ---- The virtual list ---- */
.nb-vlist { position: relative; contain: layout; }
.nb-vlist > .nb-vrow { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }

/* ---- Cards ---- */
.nb-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 10px 26px; border-radius: var(--r-l); background: var(--nb-card); color: var(--ink);
  box-shadow: 0 1px 0 rgba(255,255,255,.55) inset, 0 2px 0 var(--lip), 0 12px 22px -18px rgba(24,33,43,.4); cursor: pointer; outline: none; text-align: left; }
[data-theme="dark"] .nb-card { box-shadow: 0 2px 0 var(--lip), 0 12px 22px -18px rgba(0,0,0,.7); }
.nb-card::before { content: ""; position: absolute; left: 11px; top: 16px; bottom: 16px; width: 3px; border-radius: 2px; background: var(--nb-rule, var(--nb-line)); }
.nb-card.c-y { --nb-rule: rgb(var(--hl-y, 242 181 68)); } .nb-card.c-g { --nb-rule: rgb(var(--hl-g, 120 170 110)); } .nb-card.c-b { --nb-rule: rgb(var(--hl-b, 104 152 214)); }
.nb-card.c-p { --nb-rule: rgb(var(--hl-p, 222 122 152)); } .nb-card.c-u { --nb-rule: var(--teal, #1F6F78); }
.nb-card.k-bm { --nb-rule: var(--berry, #B4527A); } .nb-card.k-word { --nb-rule: var(--teal, #1F6F78); } .nb-card.k-bn { --nb-rule: var(--navy, #24304A); }
[data-theme="dark"] .nb-card.k-bn { --nb-rule: #9DB9F0; }
.nb-card:focus-visible { box-shadow: 0 0 0 3px var(--link), 0 2px 0 var(--lip); }
.nb-card.open { box-shadow: 0 0 0 2px var(--ink), 0 2px 0 var(--lip); }
.nb-card.picked { box-shadow: 0 0 0 3px var(--teal, #1F6F78), 0 2px 0 var(--lip); background: color-mix(in srgb, var(--teal, #1F6F78) 7%, var(--nb-card)); }
.nb-pass { margin: 0; font-family: var(--serif); font-size: calc(17.5px * var(--scale, 1)); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nb-pass.muted2 { color: var(--nb-muted); font-size: calc(16px * var(--scale, 1)); -webkit-line-clamp: 2; }
.nb-note { padding: 10px 14px; border-radius: 14px; background: var(--nb-soft); font-size: calc(16px * var(--scale, 1)); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.nb-note.big { -webkit-line-clamp: 8; }
.nb-kicker { margin: 0; display: flex; align-items: center; gap: 6px; font-size: calc(14px * var(--scale, 1)); color: var(--nb-muted); }
.nb-kicker.bm .icon { color: var(--berry, #B4527A); }
[data-theme="dark"] .nb-kicker.bm .icon { color: #F0A6C4; }
.nb-kicker b { color: var(--ink); }
.nb-orph, .nb-flag { margin: 0; font-size: calc(14px * var(--scale, 1)); color: var(--nb-muted); display: flex; align-items: center; gap: 6px; }
.nb-flag { color: var(--ink); font-weight: 700; }
.nb-foot { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; }
.nb-bk { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.nb-bk b { font-size: calc(15px * var(--scale, 1)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-bk span { font-size: calc(13px * var(--scale, 1)); color: var(--nb-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-cn { display: inline-flex; align-items: center; gap: 6px; font-size: calc(13px * var(--scale, 1)); font-weight: 700; color: var(--nb-muted); flex-shrink: 0; max-width: 40%; }
.nb-cn > :last-child:not(.nb-dot) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nb-more { width: 44px; height: 44px; flex-shrink: 0; border: 0; border-radius: 50%; background: none; color: var(--nb-muted); display: inline-grid; place-items: center; margin-right: -8px; }
.nb-more:hover { background: var(--nb-soft); color: var(--ink); }
.nb-tags { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 6px; }
.nb-tag { display: inline-flex; align-items: center; gap: 2px; font-size: calc(13px * var(--scale, 1)); font-weight: 700; padding: 2px 8px; border-radius: 8px; color: var(--teal, #1F6F78); background: color-mix(in srgb, var(--teal, #1F6F78) 13%, transparent); border: 0; }
button.nb-tag, .nb-tag.big { min-height: 36px; padding: 0 10px; }
.nb-tag[aria-pressed="true"] { background: var(--teal, #1F6F78); color: #fff; }
[data-theme="dark"] .nb-tag[aria-pressed="true"] { color: #10161D; }
.nb-hit { background: rgb(var(--hl-y, 242 181 68) / .45); color: inherit; border-radius: 3px; padding: 0 1px; }
.nb-check { position: absolute; top: 12px; right: 12px; width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--nb-muted); display: inline-grid; place-items: center; background: var(--nb-card); z-index: 1; }
.nb-card.picked .nb-check { background: var(--teal, #1F6F78); border-color: var(--teal, #1F6F78); color: #fff; }
.nb-card .nb-check ~ .nb-pass, .nb-card .nb-check ~ .nb-wtop, .nb-card .nb-check ~ .nb-kicker { padding-right: 34px; }
/* words */
.nb-wtop { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.nb-word { font-family: var(--serif); font-size: calc(23px * var(--scale, 1)); line-height: 1.15; overflow-wrap: anywhere; }
.nb-word.big { font-size: calc(32px * var(--scale, 1)); }
.nb-pos { font-family: var(--serif); color: var(--nb-muted); }
.nb-invocab { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; font-size: calc(13px * var(--scale, 1)); font-weight: 700; color: var(--good, #1D6B55); }
.nb-mean { margin: 0; font-size: calc(16px * var(--scale, 1)); line-height: 1.45; }
.nb-sent { margin: 0; font-family: var(--serif); font-style: italic; color: var(--nb-muted); font-size: calc(15px * var(--scale, 1)); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* Quotes view: large serif cards in the book's cover hue */
.nb-qrow { display: grid; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); gap: 12px; align-items: start; }
.nb-card.quote { background: hsl(var(--hue, 30) 42% 90%); padding: 22px 22px 10px 30px; min-height: 200px; }
[data-theme="dark"] .nb-card.quote { background: hsl(var(--hue, 30) 24% 19%); }
.nb-card.quote .nb-pass { font-size: calc(21px * var(--scale, 1)); line-height: 1.4; -webkit-line-clamp: 9; }
.nb-card.quote .nb-pass::before { content: "“"; } .nb-card.quote .nb-pass::after { content: "”"; }
.nb-card.quote .nb-bk span, .nb-card.quote .nb-cn, .nb-card.quote .nb-more { color: var(--ink); }
.nb-card.quote .nb-note { background: color-mix(in srgb, var(--ink) 7%, transparent); }
/* By book */
.nb-group { display: flex; align-items: center; gap: 4px; padding: 6px 12px 6px 6px; border-radius: var(--r-l); background: var(--nb-card); box-shadow: 0 2px 0 var(--lip); }
.nb-gbtn { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px; min-height: 64px; border: 0; border-radius: 16px; background: none; color: var(--ink); text-align: left; }
.nb-gbtn:hover { background: var(--nb-soft); }
.nb-gt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.nb-gt b { font-family: var(--serif); font-weight: 400; font-size: calc(19px * var(--scale, 1)); line-height: 1.2; overflow-wrap: anywhere; }
.nb-gt span { font-size: calc(13px * var(--scale, 1)); color: var(--nb-muted); }
.nb-gbtn > .icon:last-child { color: var(--nb-muted); flex-shrink: 0; transition: transform var(--d2) var(--ease); }
.nb-group.open .nb-gbtn > .icon:last-child { transform: rotate(180deg); }
.nb-parth { margin: 0; padding: 14px 6px 2px; display: flex; justify-content: space-between; gap: 12px; font-size: calc(12px * var(--scale, 1)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nb-muted); }
.nb-parth span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-pn { letter-spacing: 0; font-variant-numeric: tabular-nums; }
/* covers */
.nb-cov { --w: 30px; position: relative; width: var(--w); aspect-ratio: 2 / 3; flex-shrink: 0; border-radius: 4px; overflow: hidden; background: hsl(var(--hue, 30) 30% 46%); box-shadow: 0 1px 3px rgba(0,0,0,.2); display: inline-grid; place-items: center; color: var(--nb-muted); }
.nb-cov.empty { background: var(--nb-soft); box-shadow: none; }
.nb-cov img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---- Menus (popovers) ---- */
.nb-pop { padding: 6px; }
.nb-menu { display: flex; flex-direction: column; gap: 2px; }
.nb-mi { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: none; color: var(--ink); text-align: left; font-weight: 700; font-size: var(--t-s); width: 100%; }
.nb-mi:hover, .nb-mi:focus-visible { background: var(--nb-soft); }
.nb-mi .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; }
.nb-mi[aria-checked="true"] { background: var(--nb-soft); }
.nb-mi[aria-checked="true"] .grow { font-weight: 700; }
.nb-mi.danger { color: var(--bad); }
.nb-mi .icon { flex-shrink: 0; color: var(--nb-muted); }
.nb-mi.danger .icon { color: var(--bad); }
.nb-mcolors { display: flex; gap: 4px; padding: 4px 6px; }
.nb-cdot { width: 44px; height: 44px; border-radius: 50%; border: 0; background: none; display: inline-grid; place-items: center; position: relative; color: var(--teal, #1F6F78); font-weight: 700; text-decoration: underline; text-decoration-thickness: 3px; }
.nb-cdot::before { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: rgb(var(--hl-y, 242 181 68)); }
.nb-cdot.c-g::before { background: rgb(var(--hl-g, 120 170 110)); } .nb-cdot.c-b::before { background: rgb(var(--hl-b, 104 152 214)); } .nb-cdot.c-p::before { background: rgb(var(--hl-p, 222 122 152)); }
.nb-cdot.c-u::before { background: var(--nb-soft); }
.nb-cdot > * { position: relative; }
.nb-cdot[aria-pressed="true"]::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; box-shadow: 0 0 0 2px var(--ink); }

/* ---- Detail (wide pane and phone sheet) ---- */
.nb-detail { display: flex; flex-direction: column; gap: var(--s4); min-width: 0; }
.nb-dhead { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.nb-dttl { flex: 1 1 160px; min-width: 0; }
.nb-dttl h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: calc(24px * var(--scale, 1)); line-height: 1.2; overflow-wrap: anywhere; }
.nb-dplace { font-size: var(--t-xs); color: var(--nb-muted); }
.nb-open { margin-left: auto; }
.nb-ctx { margin: 0; padding: var(--s4); border-radius: var(--r-m); background: color-mix(in srgb, var(--accent) 6%, var(--nb-card)); font-family: var(--serif); font-size: calc(18px * var(--scale, 1)); line-height: 1.6; overflow-wrap: anywhere;
  box-shadow: inset 0 0 0 1px var(--nb-line); max-height: 52vh; overflow: auto; }
.nb-ctx p { margin: 0 0 .7em; } .nb-ctx p:last-child { margin: 0; }
.nb-dim { color: var(--nb-muted); }
.nb-v { font-family: var(--sans); font-size: .62em; font-weight: 700; color: var(--nb-muted); margin-right: .25em; vertical-align: super; line-height: 0; }
.nb-here { background: rgb(var(--hl-y, 242 181 68) / var(--hl-a, .4)); color: inherit; border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; padding: 1px 0; }
.nb-here.c-g { background: rgb(var(--hl-g) / var(--hl-a, .4)); } .nb-here.c-b { background: rgb(var(--hl-b) / var(--hl-a, .4)); } .nb-here.c-p { background: rgb(var(--hl-p) / var(--hl-a, .4)); }
.nb-here.c-u { background: none; text-decoration: underline; text-decoration-color: var(--teal, #1F6F78); text-decoration-thickness: 2px; text-underline-offset: 4px; }
.nb-sec { display: flex; flex-direction: column; gap: var(--s2); }
.nb-lbl { margin: 0; font-family: var(--sans); font-size: var(--label, 12px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--nb-muted); }
.nb-ta { width: 100%; min-height: 96px; max-height: 40vh; resize: vertical; border-radius: var(--r-m); border: 1px solid var(--nb-line); background: var(--nb-soft); color: var(--ink); padding: 12px 14px; font-family: var(--sans); font-size: 17px; line-height: 1.45; }
.nb-ta:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--teal, #1F6F78); border-color: transparent; }
.nb-notefoot { display: flex; justify-content: space-between; gap: var(--s3); min-height: 20px; font-size: var(--t-xs); }
.nb-saved { display: inline-flex; align-items: center; gap: 4px; color: var(--good, #1D6B55); font-weight: 700; }
.nb-count { color: var(--nb-muted); font-variant-numeric: tabular-nums; }
.nb-just { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: center; font-size: var(--t-xs); color: var(--nb-muted); }
.nb-just b { color: var(--ink); }
.nb-just span { grid-column: 1 / -1; }
.nb-conflict { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s4); border-radius: var(--r-m); box-shadow: inset 0 0 0 2px var(--accent); }
.nb-cleared { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); font-size: var(--t-s); color: var(--nb-muted); }
.nb-colors { display: flex; flex-wrap: wrap; gap: var(--s2); }
.nb-cchip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--nb-line); background: var(--nb-card); color: var(--ink); font-weight: 700; font-size: var(--t-s); }
.nb-cchip[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); border-color: transparent; }
.nb-u { font-weight: 700; text-decoration: underline; text-decoration-color: var(--teal, #1F6F78); text-decoration-thickness: 2px; }
.nb-tagrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.nb-tagx { width: 32px; height: 32px; margin-right: -8px; border: 0; background: none; color: inherit; display: inline-grid; place-items: center; border-radius: 50%; }
.nb-tagin { min-height: 40px; width: 140px; border-radius: 10px; border: 1px dashed var(--nb-line); background: none; color: var(--ink); padding: 0 10px; font-size: 16px; }
.nb-acts { display: flex; flex-wrap: wrap; gap: var(--s2); }
.nb-acts .btn { white-space: nowrap; }
.nb-prov { margin: 0; font-size: var(--t-xs); color: var(--nb-muted); }
.nb-dword { display: flex; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.nb-dsheet { gap: var(--s4); }
.nb-dempty { padding: var(--s6) var(--s4); color: var(--nb-muted); text-align: center; }

/* ---- Select many ---- */
#layer .nb-selbar { position: fixed; z-index: 18; left: max(8px, calc(50% - 380px)); right: max(8px, calc(50% - 380px)); bottom: calc(84px + var(--safe-bottom)); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 6px 8px 6px 16px; border-radius: 22px; background: var(--bar-ink, #1B232C); color: var(--bar-text, #F4F1EA); box-shadow: var(--float); }
#layer .nb-selbar[hidden] { display: none; }
.nb-sbn { font-weight: 700; font-size: var(--t-s); flex: 1 0 auto; }
.nb-sbacts { display: flex; flex-wrap: wrap; gap: 2px; }
.nb-sb { min-width: 48px; min-height: 52px; padding: 2px 8px; border: 0; border-radius: 14px; background: none; color: inherit; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 13px; font-weight: 700; }
.nb-sb:disabled { color: var(--bar-muted, #AEB6BF); opacity: .6; }
.nb-sb:hover:not(:disabled) { background: rgba(255,255,255,.08); }
.nb-sb.danger:not(:disabled) { color: #F5A08C; }
.nb-sb.done { flex-direction: row; padding: 0 14px; background: rgba(255,255,255,.12); }
.nb-sb:focus-visible { outline: 2px solid #8FD3DA; outline-offset: 1px; }
@media (min-width: 900px) { #layer .nb-selbar { bottom: calc(16px + var(--safe-bottom)); } }
/* the toast sits above the bar while selecting */

/* ---- Look back (Read home and the Notebook) ---- */
.nb-lb { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 14px 20px; border-radius: var(--r-l); color: #F4F1EA;
  background: linear-gradient(150deg, #22313B, #1A252D 70%); box-shadow: 0 2px 0 #0D1418, 0 18px 30px -20px rgba(10,14,20,.6); }
.nb-lb::after { content: "“"; position: absolute; right: 64px; top: -14px; font-family: var(--serif); font-size: 140px; line-height: 1; color: #F4F1EA; opacity: .1; pointer-events: none; }
.nb-lbtop { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.nb-lbk { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #C9D1D6; }
.nb-lbmore { width: 44px; height: 44px; margin: -8px -8px -8px 0; border: 0; border-radius: 50%; background: none; color: #C9D1D6; display: inline-grid; place-items: center; position: relative; z-index: 1; }
.nb-lbmore:hover { background: rgba(255,255,255,.08); }
.nb-lbq { margin: 0; font-family: var(--serif); font-size: calc(21px * var(--scale, 1)); line-height: 1.4; overflow-wrap: anywhere; }
.nb-lbn { margin: 0; font-size: calc(15px * var(--scale, 1)); color: #DCE2E6; padding-left: 12px; box-shadow: inset 2px 0 0 #F2B544; white-space: pre-wrap; }
.nb-lbfoot { display: flex; align-items: center; gap: 10px; min-height: 44px; flex-wrap: wrap; }
.nb-lbwhere { flex: 1 1 140px; min-width: 0; font-size: calc(14px * var(--scale, 1)); color: #C9D1D6; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nb-lbopen { color: #F2B544; font-weight: 700; text-decoration: none; min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
.nb-lbopen:hover { text-decoration: underline; }
.nb-lb a:focus-visible, .nb-lb button:focus-visible { outline: 2px solid #8FD3DA; outline-offset: 2px; }
.nb-lb-slot:empty { display: none; }
.nb-lb-slot { margin-bottom: 12px; }

/* ---- Export sheet ---- */
.nb-fmts { display: flex; flex-direction: column; gap: var(--s2); }
.nb-fmt { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 56px; padding: 10px 16px; border-radius: var(--r-m); border: 1px solid var(--line); background: var(--card); color: var(--ink); text-align: left; }
.nb-fmt[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); border-color: transparent; }
.nb-fn { font-weight: 700; }
.nb-fh { font-size: var(--t-xs); color: var(--muted); }
.nb-namerow { display: flex; align-items: center; gap: var(--s2); min-height: 44px; }
.nb-namerow[hidden] { display: none; }
.nb-namerow input { width: 22px; height: 22px; }

/* ---- Recently deleted ---- */
.nb-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 700; text-decoration: none; align-self: flex-start; }
.nb-dtools { display: flex; justify-content: flex-end; }
.nb-dtools:empty { display: none; }
.nb-dlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s3); }
.nb-ditem { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 16px 16px 12px 26px; border-radius: var(--r-l); background: var(--card); box-shadow: 0 2px 0 var(--lip); }
.nb-ditem::before { content: ""; position: absolute; left: 11px; top: 16px; bottom: 16px; width: 3px; border-radius: 2px; background: var(--line); }
.nb-ditem.c-y::before { background: rgb(var(--hl-y)); } .nb-ditem.c-g::before { background: rgb(var(--hl-g)); } .nb-ditem.c-b::before { background: rgb(var(--hl-b)); } .nb-ditem.c-p::before { background: rgb(var(--hl-p)); } .nb-ditem.c-u::before { background: var(--teal); }
.nb-dk { margin: 0; font-size: var(--t-xs); color: var(--muted); }
.nb-dk b { color: var(--ink); }
.nb-dtext { margin: 0; font-size: calc(17px * var(--scale, 1)); line-height: 1.45; overflow-wrap: anywhere; white-space: pre-wrap; }
.nb-dtext.serif { font-family: var(--serif); }
.nb-dbook { margin: 0; display: flex; align-items: center; gap: 8px; font-size: var(--t-xs); color: var(--muted); }
.nb-dnone { padding: var(--s6) var(--s4); text-align: center; color: var(--muted); }
.nb-deleted .nb-note { --nb-soft: color-mix(in srgb, var(--ink) 6%, var(--card)); }

/* ---- Under 320 px: the view switch becomes a menu, Export and Select move into More ---- */
@media (max-width: 319.98px) {
  .nb-viewsw { display: none; }
  .nb-viewmenu { display: inline-flex; font-weight: 700; }
  .nb-expbtn, .nb-selbtn { display: none; }
  .nb-hacts { margin-left: auto; }
  .nb-card { padding: 14px 12px 8px 22px; }
  .nb-card::before { left: 9px; }
  .nb-cn { max-width: 34%; }
  .nb-drop { max-width: 160px; padding: 0 12px; }
  #layer .nb-selbar { padding-left: 10px; }
  .nb-sb { min-width: 44px; padding: 2px 4px; font-size: 12px; }
}

/* ---- Wide screens (1024 and up): three panes ---- */
@media (min-width: 1024px) {
  .nb-page { max-width: 1480px; }
  .nb-layout { display: grid; grid-template-columns: 236px minmax(380px, 460px) minmax(0, 1fr); gap: var(--s5); align-items: start;
    position: sticky; top: 8px; height: calc(100dvh - 24px); }
  .nb-side { display: flex; flex-direction: column; gap: var(--s4); padding: var(--s4) var(--s3); border-radius: var(--r-l); background: var(--card); box-shadow: 0 2px 0 var(--lip); max-height: 100%; overflow: auto; overscroll-behavior: contain; }
  .nb-mid { height: 100%; min-height: 0; }
  .nb-types, .nb-drops { display: none; }
  .nb-listpane { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; padding: 2px 6px 24px 2px; margin-right: -6px; }
  .nb-dpane { display: block; max-height: 100%; overflow: auto; overscroll-behavior: contain; padding: var(--s5); border-radius: 26px; background: var(--card); box-shadow: 0 2px 0 var(--lip); }
  .nb-dpane .nb-ctx { max-height: none; }
  .nb-ssec { display: flex; flex-direction: column; gap: 2px; }
  .nb-side .nb-slbl { margin: 0 0 4px 8px; font-family: var(--sans); font-size: var(--label, 12px); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
  .nb-srow { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 8px; border: 0; border-radius: 10px; background: none; color: var(--ink); text-align: left; text-decoration: none; font-size: var(--t-s); width: 100%; }
  .nb-srow .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nb-srow:hover { background: var(--nb-soft); }
  .nb-srow[aria-pressed="true"] { background: var(--nb-soft); font-weight: 700; }
  .nb-box { width: 20px; height: 20px; border-radius: 5px; border: 2px solid var(--muted); display: inline-grid; place-items: center; flex-shrink: 0; }
  .nb-srow[aria-pressed="true"] .nb-box { background: var(--ink); border-color: var(--ink); color: var(--bg); }
  .nb-stags { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px; }
  .nb-sall { margin-left: 8px; font-weight: 700; }
  .nb-trash { color: var(--ink); }
  .nb-qrow { --cols: 1 !important; }
}
@media (min-width: 1280px) {
  .nb-layout { grid-template-columns: 236px minmax(400px, 480px) minmax(0, 1fr); }
}

/* ---- The reader's Notebook panel (this book), in the paper's colors ---- */
.nbr { --nb-card: color-mix(in srgb, var(--ink) 4%, var(--pcard, #FFFDF8)); --nb-soft: color-mix(in srgb, var(--ink) 7%, var(--pcard, #FFFDF8)); --nb-muted: var(--pmuted, #57606B); --nb-line: var(--prule, #D5CFC6);
  position: absolute; z-index: 24; left: 0; right: 0; top: calc(44px + var(--safe-top)); bottom: 0; display: flex; flex-direction: column; overflow: hidden;
  background: var(--pcard, #FFFDF8); color: var(--ink); border-radius: 26px 26px 0 0; box-shadow: var(--float, 0 10px 30px rgb(0 0 0 / .18)), 0 0 0 1px var(--pline2, rgb(0 0 0 / .06)); font-family: var(--sans);
  padding-bottom: var(--safe-bottom); animation: nbrIn 220ms var(--ease) both; }
.reader[data-mode="scroll"] .nbr { position: fixed; }
@keyframes nbrIn { from { transform: translateY(24px); opacity: 0; } }
.nbr-head { display: flex; align-items: center; gap: 12px; padding: 16px 10px 8px 18px; flex-shrink: 0; }
.nbr-ttl { flex: 1; min-width: 0; }
.nbr-ttl h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: calc(24px * var(--cscale, 1)); line-height: 1.15; }
.nbr-ttl p { margin: 2px 0 0; font-size: calc(14px * var(--cscale, 1)); color: var(--pmuted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nbr-x { width: 44px; height: 44px; flex-shrink: 0; display: inline-grid; place-items: center; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); }
.nbr-filters { flex-shrink: 0; display: flex; flex-direction: column; gap: 6px; padding: 4px 0 10px; border-bottom: 1px solid var(--prule); }
.nbr-types, .nbr-colors { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 16px; }
.nbr-types::-webkit-scrollbar, .nbr-colors::-webkit-scrollbar { display: none; }
.nbr-chip { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; border-radius: 22px; border: 1px solid var(--prule); background: transparent; color: var(--ink); font-family: var(--sans); font-weight: 700; font-size: calc(15px * var(--cscale, 1)); white-space: nowrap; }
.nbr-chip[aria-checked="true"] { background: var(--ink); color: var(--paper, #F7F3EA); border-color: var(--ink); }
.nbr-cl { flex-shrink: 0; align-self: center; font-size: calc(13px * var(--cscale, 1)); font-weight: 700; color: var(--pmuted); padding-right: 2px; }
.nbr-c { flex-shrink: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; min-width: 44px; justify-content: center; padding: 0 10px; border: 0; border-radius: 22px; background: none; color: var(--ink); font-weight: 700; font-size: calc(14px * var(--cscale, 1)); white-space: nowrap; }
.nbr-c[aria-checked="true"] { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.nbr-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 12px 20px; }
.nbr-empty { margin: 20px 8px; color: var(--pmuted); font-size: calc(16px * var(--cscale, 1)); line-height: 1.45; }
.nbr-empty[hidden] { display: none; }
.nbr .nb-card { box-shadow: none; background: var(--nb-card); }
.nbr .nb-card:focus-visible { box-shadow: 0 0 0 2px var(--sel-edge, #1F6F78); }
.nbr .nb-pass { font-size: calc(16.5px * var(--cscale, 1)); }
.nbr .nb-note { background: var(--pcard, #FFFDF8); box-shadow: inset 0 0 0 1px var(--prule); }
.nbr .nb-tag { color: var(--sel-edge, #1F6F78); }
.reader[data-paper="night"] .nbr .nb-tag, .reader[data-paper="dusk"] .nbr .nb-tag { color: #8FD3DA; }
.nbr-foot { flex-shrink: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 20px; border-top: 1px solid var(--prule); color: var(--sel-edge, #1F6F78); font-weight: 700; text-decoration: none; }
.reader[data-paper="night"] .nbr-foot, .reader[data-paper="dusk"] .nbr-foot { color: #8FD3DA; }
.nbr-foot .grow { flex: 1; }
.nbr button:focus-visible, .nbr a:focus-visible { outline: 2px solid var(--link, #1F6F78); outline-offset: 2px; }
.reader[data-paper="night"] .nbr button:focus-visible, .reader[data-paper="dusk"] .nbr button:focus-visible { outline-color: #8FD3DA; }
@media (min-width: 760px) {
  .nbr { left: auto; right: 16px; width: 420px; top: calc(14px + var(--safe-top)); bottom: calc(14px + var(--safe-bottom)); border-radius: 22px; padding-bottom: 0; animation-name: nbrInSide; }
  @keyframes nbrInSide { from { transform: translateX(16px); opacity: 0; } }
}
@media (max-height: 520px) and (max-width: 759px) { .nbr { top: calc(8px + var(--safe-top)); } }

/* ---- Motion: none under reduced motion or Calm ---- */
@media (prefers-reduced-motion: reduce) { .nbr { animation: none; } .nb-gbtn > .icon:last-child { transition: none; } }
html.calm .nbr { animation: none; } html.calm .nb-gbtn > .icon:last-child { transition: none; }

/* ---- Your commonplace book (print, and the downloaded page) ---- */
#nb-print { display: none; }
.nbp { font-family: "Literata", Georgia, serif; color: #1B1B1B; background: #fff; max-width: 720px; margin: 0 auto; padding: 32px 24px; line-height: 1.55; }
.nbp-cover { text-align: center; padding: 64px 0 40px; border-bottom: 2px solid #F2B544; margin-bottom: 32px; }
.nbp-kicker { margin: 0; font-family: "Atkinson Hyperlegible", sans-serif; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; font-size: 12px; color: #57606B; }
.nbp-cover h1 { font-weight: 400; font-size: 40px; margin: 12px 0 8px; }
.nbp-who, .nbp-date { margin: 4px 0; font-family: "Atkinson Hyperlegible", sans-serif; color: #3E4852; }
.nbp-book { margin-top: 40px; }
.nbp-bh { display: flex; gap: 18px; align-items: flex-start; margin-bottom: 18px; }
.nbp-cov { width: 72px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 4px; flex-shrink: 0; }
.nbp-bh h2 { font-weight: 400; font-size: 28px; margin: 0 0 6px; line-height: 1.2; }
.nbp-meta { margin: 0; font-family: "Atkinson Hyperlegible", sans-serif; font-size: 12px; color: #3E4852; }
.nbp-bn { margin: 16px 0 24px; padding: 14px 18px; border-left: 3px solid #24304A; background: #F6F4EF; }
.nbp-bn h3, .nbp-part { font-family: "Atkinson Hyperlegible", sans-serif; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: #3E4852; margin: 24px 0 10px; }
.nbp-bn h3 { margin-top: 0; }
.nbp-q { margin: 0 0 22px; padding-left: 16px; border-left: 3px solid #D5CFC6; break-inside: avoid; }
.nbp-q.c-marigold { border-color: #F2B544; } .nbp-q.c-sage { border-color: #78AA6E; } .nbp-q.c-sky { border-color: #6898D6; } .nbp-q.c-rose { border-color: #DE7A98; } .nbp-q.c-underline { border-color: #1F6F78; }
.nbp-q blockquote { margin: 0; font-size: 16px; }
.nbp-q blockquote p { margin: 0 0 .6em; }
.nbp-note { margin: 8px 0 0; font-family: "Atkinson Hyperlegible", sans-serif; font-size: 14px; background: #F6F4EF; padding: 8px 12px; border-radius: 6px; }
.nbp-note p { margin: 0 0 .4em; } .nbp-note p:last-child { margin: 0; }
.nbp-q figcaption { margin-top: 6px; font-family: "Atkinson Hyperlegible", sans-serif; font-size: 12px; color: #3E4852; }
.nbp-small { font-family: "Atkinson Hyperlegible", sans-serif; font-size: 12px; color: #3E4852; margin: 4px 0 0; }
.nbp-bm { margin: 0; font-size: 15px; color: #3E4852; }
.nbp-word { margin: 0 0 6px; font-size: 15px; }
.nbp-foot { margin-top: 48px; padding-top: 12px; border-top: 1px solid #D5CFC6; font-family: "Atkinson Hyperlegible", sans-serif; font-size: 11px; color: #57606B; text-align: center; }
body.nbp-doc { background: #fff; margin: 0; }
@media print {
  html.nb-printing body > :not(#nb-print) { display: none !important; }
  html.nb-printing #nb-print { display: block; }
  html.nb-printing, html.nb-printing body { background: #fff !important; }
  .nbp { padding: 0; max-width: none; }
  .nbp-cover { break-after: page; padding-top: 30vh; border: 0; }
  .nbp-book + .nbp-book { break-before: page; }
  @page { margin: 18mm 16mm; }
}
/* The reader's panel on the narrowest screens: no cover, a smaller title that never breaks inside a word */
@media (max-width: 339.98px) {
  .nbr-head { padding-left: 14px; gap: 8px; }
  .nbr-head > .nb-cov { display: none; }
  .nbr-ttl h2 { font-size: calc(21px * var(--cscale, 1)); overflow-wrap: normal; word-break: keep-all; }
  .nbr-foot { padding: 0 14px; font-size: 15px; }
  .nbr-scroll { padding-inline: 8px; }
  .nbr .nb-card { padding-right: 12px; }
}
