@layer theme, legacy, base, components, utilities;
@layer legacy {
/* Shell resets (--nf-* tokens) and the in-note editing controls (--note-* tokens in reading.css). Every shell button, field and select is a ui component (components/ui/, Tailwind on the tokens), so there is no
   base look for a bare control here; a control inside the note or the editor draws itself. Page layout stays in notes.css. The inventory is docs/02-design/components.md. */
.notefriends-brand button, .notefriends-brand input, .notefriends-brand select, .notefriends-brand textarea { font: inherit; color: inherit; }
/* NF-142: a heading focused by the app (a new page starts there) is a landmark, not a control: no ring. */
.notefriends-brand :is(h2, h3)[tabindex="-1"]:focus-visible { outline: none; }
.notefriends-brand :is(button,textarea,input,select,summary,a):focus-visible,
.notefriends-brand .workspace:focus-visible { outline: var(--nf-focus); outline-offset: 2px; }
.notefriends-brand .action-icon { width: 20px; height: 20px; flex: none; }
/* Dark: the icon files are drawn in a fixed dark ink; this filter (components/app/icon-ink.ts) repaints them in the text colour. Doodles are coloured art and a page's own symbols follow its Look. */
:root[data-scheme="dark"] .notefriends-brand img[src*="brand/icons/"]:not([src*="/doodle-"]):not(:where(.reading-surface *)) { filter: url(#nf-icon-ink); }
.notefriends-brand .skip { background: var(--nf-pencil); color: var(--nf-sheet); }
}
/* Equal-specificity pair: this was written before .link-row input and lost to it, so it stays first. */
.link-row { display: flex; gap: 8px; margin-top: 12px; }
.link-row input { flex: 1; min-width: 0; }
.link-row { flex-wrap: wrap; align-items: center; }
.link-row label { font-size: 13px; font-weight: 500; color: var(--nf-pencil-muted); }
.people-list { list-style: none; margin: 8px 0 0; padding: 0; }
.people-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-top: 1px solid var(--nf-line); padding: 6px 0; }
.people-list li > span { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.people-list select { flex: 0 1 140px; }
/* NF-071: the project People panel sits in the narrow sidebar, so its fields and buttons stack. */

/* ===== In-note editing controls (--note-* tokens) ===== */
/* NF-106: editing the rendered note in place. Outlines and placeholders take no space, so entering edit mode moves nothing. */
#preview [data-edit] { cursor: text; }
/* PC-063: an open text unit is the read text plus a caret: no outline, border or tint. Keyboard focus on a unit that is not open keeps its ring. */
#preview [data-edit][data-editing], #preview [data-pending][data-editing] { outline: none; caret-color: var(--note-accent); }
#preview [data-edit]:focus-visible:not([data-editing]), #preview [data-pending]:focus-visible:not([data-editing]) { outline: 2px solid var(--note-accent); }
#preview [data-pending] { cursor: text; }
#preview [data-pending]:empty::before { content: attr(data-placeholder); color: var(--note-muted); pointer-events: none; }
#preview .nf-edit[data-editing]:empty::after { content: '\200b'; }
#preview li[data-pending] { list-style-position: outside; }
#preview .task-list > li[data-pending] { list-style: none; margin: 0; padding: 9px 0 9px 32px; }
#preview li[data-pending] { box-sizing: border-box; }
@media print { [data-pending] { display: none !important; } }
/* NF-108: table editing. The menu button and the cell outline take no layout space until used. */
.nf-table-edit { position: relative; }
/* NF-125: secondary tools are invisible (not removed, no layout change) until the block is hovered, holds focus or has its menu open; touch has no hover, so focus or a tap on the block reveals them. */
.nf-table-tools { position: absolute; right: 0; bottom: 100%; z-index: 2; opacity: 0; }
.nf-table-edit:hover .nf-table-tools, .nf-table-edit:focus-within .nf-table-tools, .nf-table-tools:has(.nf-table-menu:not([hidden])) { opacity: 1; }
#preview .nf-table-more { display: grid; place-items: center; width: 36px; height: 36px; min-height: 36px; padding: 0; border: 1px solid var(--note-line); border-radius: 6px; background: var(--note-paper); color: var(--note-muted); cursor: pointer; }
.nf-table-more:hover, .nf-table-more[aria-expanded=true] { color: var(--note-ink); border-color: var(--note-accent); }
.nf-table-more:focus-visible, .nf-table-menu button:focus-visible, #preview [data-cell][tabindex]:focus-visible { outline: 2px solid var(--note-accent); outline-offset: 2px; }
.nf-table-menu { position: absolute; right: 0; top: calc(100% + 4px); width: max-content; max-width: min(22rem, calc(100vw - 64px)); box-sizing: border-box; padding: 10px 12px; border: 1px solid var(--note-line); border-radius: 6px; background: var(--note-paper); color: var(--note-ink); box-shadow: 0 6px 20px var(--nf-shade); font: 400 .85rem/1.3 var(--note-font); }
.nf-table-menu[hidden] { display: none; }
.nf-table-target { margin: 0 0 6px; color: var(--note-muted); font-size: .8rem; }
.nf-table-group { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.nf-table-label { flex: 0 0 100%; color: var(--note-muted); font-size: .75rem; letter-spacing: .02em; text-transform: uppercase; }
#preview .nf-table-menu button { min-height: 36px; padding: 4px 10px; border: 1px solid var(--note-line); border-radius: 6px; background: transparent; color: inherit; font: inherit; cursor: pointer; }
.nf-table-menu button:hover:not(:disabled) { border-color: var(--note-accent); }
.nf-table-menu button[aria-pressed=true] { background: var(--note-marker); color: var(--note-marker-ink, var(--note-ink)); font-weight: 600; }
.nf-table-menu button:disabled { opacity: .4; cursor: default; }
#preview [data-cell] { cursor: text; }
#preview [data-cell][data-editing] { outline: 2px solid var(--note-accent); outline-offset: -2px; caret-color: var(--note-accent); background: color-mix(in srgb, var(--note-accent) 8%, transparent); }
@media print { .nf-table-tools { display: none !important; } }
/* NF-107: block gutter, menus, shaped new blocks and keyboard access. */
.reading-surface { position: relative; }
.nf-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nf-gutter { position: absolute; z-index: 5; display: flex; gap: 2px; }
.notefriends-brand .nf-gutter button.nf-gutter-button { box-sizing: border-box; min-width: 26px; height: 28px; padding: 0 4px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--note-muted); font: 600 14px/1 system-ui, sans-serif; letter-spacing: -.12em; cursor: pointer; }
.notefriends-brand .nf-gutter button.nf-gutter-add { letter-spacing: 0; font-size: 18px; }
.notefriends-brand .nf-gutter button.nf-gutter-button:hover, .notefriends-brand .nf-gutter button.nf-gutter-button[aria-expanded=true] { background: var(--note-line); color: var(--note-ink); }
.notefriends-brand .nf-gutter button.nf-gutter-button:focus-visible { outline: 2px solid var(--note-accent); outline-offset: 1px; color: var(--note-ink); }
.notefriends-brand .nf-gutter[data-compact=true] button.nf-gutter-add { display: none; }
.notefriends-brand .nf-gutter[data-compact=true] button.nf-gutter-button { min-width: 24px; width: 24px; height: 32px; padding: 0; }
@media (hover: none) { .notefriends-brand .nf-gutter button.nf-gutter-button { border-color: var(--note-line); background: var(--note-paper); } }
@media (prefers-reduced-motion: no-preference) { .notefriends-brand .nf-gutter button.nf-gutter-button { transition: background .12s, color .12s; } }
/* A new block that has taken a shape ("# ", "- ", "> " ...) looks like what it will become. */
#preview [data-pending][data-shape] { position: relative; }
#preview [data-pending][data-shape^=heading] { font-family: var(--note-heading); font-weight: var(--note-heading-weight); line-height: 1.2; }
#preview [data-pending][data-shape=heading1] { font-size: var(--note-h1); }
#preview [data-pending][data-shape=heading2] { font-size: 1.85em; }
#preview [data-pending][data-shape=heading3] { font-size: 1.4em; }
#preview [data-pending][data-shape=bulleted], #preview [data-pending][data-shape=numbered], #preview [data-pending][data-shape=checklist] { padding-left: 1.5em; }
#preview [data-pending][data-shape=bulleted]::after { content: '\2022'; position: absolute; left: .4em; top: 0; }
#preview [data-pending][data-shape=numbered]::after { content: attr(data-prefix); position: absolute; left: 0; top: 0; color: var(--note-muted); }
#preview [data-pending][data-shape=checklist]::after { content: ''; position: absolute; left: .1em; top: .55em; width: .85em; height: .85em; border: 1.5px solid var(--note-muted); border-radius: 3px; }
#preview [data-pending][data-shape=quote] { padding-left: 1em; border-left: 3px solid var(--note-accent); color: var(--note-muted); font-style: italic; }
@media print { .nf-gutter { display: none !important; } }
/* NF-022: board editing. Status button, menu, add-card button and title outline; none exist in the reading view or in print. */
#preview .nf-card-title[tabindex] { cursor: text; border-radius: 3px; }
#preview .nf-card-title[tabindex]:hover { background: color-mix(in srgb, var(--note-accent) 8%, transparent); }
#preview .nf-card-title:focus-visible, #preview .nf-status-btn:focus-visible, #preview .nf-add-card:focus-visible, #preview .nf-status-menu button:focus-visible { outline: 2px solid var(--note-accent); outline-offset: 2px; }
#preview .nf-card-title[data-editing] { outline: 2px solid var(--note-accent); outline-offset: 2px; caret-color: var(--note-accent); background: color-mix(in srgb, var(--note-accent) 8%, transparent); }
#preview .nf-card-title[data-editing]:empty::after { content: '\200b'; }
#preview .nf-status-btn { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; max-width: 100%; margin: 4px 0 0; padding: 4px 10px; border: 1px solid var(--note-line); border-radius: 999px; background: transparent; color: var(--note-ink); font: inherit; font-size: .85em; cursor: pointer; }
#preview .nf-status-text { min-width: 0; overflow-wrap: anywhere; text-align: left; }
#preview .nf-status-btn:hover, #preview .nf-status-btn[aria-expanded=true] { border-color: var(--note-accent); }
#preview .nf-status-menu { list-style: none; margin: 4px 0 0; padding: 4px; display: grid; gap: 2px; border: 1px solid var(--note-line); border-radius: 8px; background: var(--note-paper); }
#preview .nf-status-menu button { display: block; width: 100%; min-height: 36px; padding: 4px 10px; border: 0; border-radius: 6px; background: transparent; color: inherit; font: inherit; font-size: .9em; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
#preview .nf-status-menu button:hover { background: color-mix(in srgb, var(--note-accent) 10%, transparent); }
#preview .nf-status-menu button[aria-checked=true] { background: var(--note-marker); color: var(--note-marker-ink, var(--note-ink)); font-weight: 600; }
#preview .nf-add-card { display: flex; align-items: center; gap: 6px; width: 100%; min-height: 36px; margin-top: 8px; padding: 4px 8px; border: 1px dashed var(--note-line); border-radius: var(--note-card-radius, 8px); background: transparent; color: var(--note-muted); font: inherit; font-size: .85em; cursor: pointer; }
#preview .nf-add-card:hover { color: var(--note-ink); border-color: var(--note-accent); }
@media print { #preview .nf-status-btn, #preview .nf-add-card, #preview .nf-status-menu { display: none !important; } }
/* NF-109: progress, timeline and calendar controls. Quiet until hovered or focused; always visible on touch. */
#preview .nf-w-btn { min-height: 36px; padding: 4px 12px; border: 1px solid var(--note-line); border-radius: 6px; background: transparent; color: var(--note-ink); font: 400 .85rem/1.2 var(--note-font); cursor: pointer; }
#preview .nf-w-btn:hover:not(:disabled) { border-color: var(--note-accent); }
#preview .nf-w-btn:disabled { opacity: .4; cursor: default; }
#preview .nf-w-primary { background: var(--note-accent); border-color: var(--note-accent); color: var(--note-paper); }
#preview .nf-w-btn:focus-visible, #preview .nf-w-input:focus-visible, .nf-event-edit:focus-visible, .nf-pop input:focus-visible { outline: 2px solid var(--note-accent); outline-offset: 2px; }
#preview .nf-w-input { box-sizing: border-box; width: 4.5em; min-height: 36px; padding: 2px 6px; border: 1px solid var(--note-line); border-radius: 6px; background: var(--note-paper); color: var(--note-ink); font: 400 .9rem/1.2 var(--note-font); font-variant-numeric: tabular-nums; }
#preview [data-prog-label], #preview [data-tl-title], #preview [data-det-title] { cursor: text; border-radius: 4px; }
#preview [data-prog-label]:hover, #preview [data-tl-title]:hover, #preview [data-det-title]:hover { background: color-mix(in srgb, var(--note-accent) 7%, transparent); }
#preview [data-prog-label]:focus-visible, #preview [data-tl-title]:focus-visible, #preview [data-det-title]:focus-visible { outline: 2px solid var(--note-accent); outline-offset: 2px; }
#preview [data-prog-label][data-editing], #preview [data-tl-title][data-editing], #preview [data-det-title][data-editing] { outline: 2px solid var(--note-accent); outline-offset: 2px; caret-color: var(--note-accent); background: color-mix(in srgb, var(--note-accent) 8%, transparent); }
/* PC-051: like the table tools, hidden tools float over the entry, so they take no space and revealing them moves nothing. */
.progress-row, .timeline-content { position: relative; }
.nf-prog-tools, .nf-tl-tools { position: absolute; right: 0; z-index: 2; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px; padding: 4px; border-radius: 8px; background: var(--note-paper); box-shadow: 0 2px 8px var(--nf-shade-md); opacity: 0; pointer-events: none; }
.nf-prog-tools { top: calc(100% + 2px); }
.nf-tl-tools { top: -4px; }
@media (prefers-reduced-motion: no-preference) { .nf-prog-tools, .nf-tl-tools, .nf-table-tools { transition: opacity .15s; } }
.progress-row:hover .nf-prog-tools, .progress-row:focus-within .nf-prog-tools, .timeline-entry:hover .nf-tl-tools, .timeline-entry:focus-within .nf-tl-tools { opacity: 1; pointer-events: auto; }
#preview .nf-prog-tools .nf-w-btn[data-prog-act=dec], #preview .nf-prog-tools .nf-w-btn[data-prog-act=inc] { min-width: 36px; padding: 4px 0; font-size: 1.1rem; }
.nf-prog-unit { color: var(--note-muted); font-size: .85rem; }
.nf-prog-add { margin-top: 16px; }
#preview .nf-view[data-cal] { position: relative; }
#preview .nf-events > li { display: flex; align-items: flex-start; gap: 4px; }
#preview .nf-events > li > .nf-event { flex: 1 1 0; width: auto; min-width: 0; }
#preview .nf-event-edit { flex: none; display: grid; place-items: center; width: 36px; height: 36px; min-height: 36px; padding: 0; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--note-muted); cursor: pointer; opacity: .7; }
#preview .nf-event-edit:hover { color: var(--note-ink); border-color: var(--note-accent); opacity: 1; }
/* PC-061: no hover on touch, so quiet tools show at low opacity (and keep their space, as there is nothing to reveal). */
@media (hover: none) { .nf-table-tools, .nf-prog-tools, .nf-tl-tools { opacity: .7; } .nf-prog-tools, .nf-tl-tools { position: static; margin-top: 8px; padding: 0; background: none; box-shadow: none; pointer-events: auto; } }
.nf-pop { position: absolute; z-index: 5; box-sizing: border-box; padding: 14px; border: 1px solid var(--note-line); border-radius: 8px; background: var(--note-paper); color: var(--note-ink); box-shadow: 0 8px 24px var(--nf-shade-md); font: 400 .9rem/1.3 var(--note-font); }
.nf-pop-form { display: grid; gap: 10px; margin: 0; }
.nf-pop-title { margin: 0; font-weight: 600; font-size: 1rem; }
.nf-pop-field { display: grid; gap: 4px; color: var(--note-muted); font-size: .8rem; }
.nf-pop-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 10px; }
.nf-pop input { box-sizing: border-box; width: 100%; min-height: 40px; padding: 4px 8px; border: 1px solid var(--note-line); border-radius: 6px; background: var(--note-paper); color: var(--note-ink); font: 400 1rem/1.2 var(--note-font); }
.nf-pop input[aria-invalid=true] { border-color: var(--nf-danger); }
.nf-pop-error { margin: 0; color: var(--nf-danger); font-size: .85rem; }
.nf-pop-error[hidden] { display: none; }
.nf-pop-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .nf-prog-tools, .nf-tl-tools, .nf-table-tools { transition: none; } }
/* Touch: in-note controls reach about 44px (the shell's size). The gutter keeps its narrow width on phones and grows taller. */
@media (pointer: coarse) {
  .notefriends-brand .nf-gutter button.nf-gutter-button { min-width: 44px; height: 44px; }
  .notefriends-brand .nf-gutter[data-compact=true] button.nf-gutter-button { min-width: 24px; width: 24px; height: 44px; }
  #preview .nf-table-more { width: 44px; height: 44px; min-height: 44px; }
  #preview .nf-table-menu button, #preview .nf-status-btn, #preview .nf-status-menu button, #preview .nf-add-card, #preview .nf-w-btn, #preview .nf-w-input { min-height: 44px; }
  #preview .nf-prog-tools .nf-w-btn[data-prog-act=dec], #preview .nf-prog-tools .nf-w-btn[data-prog-act=inc] { min-width: 44px; }
  #preview .nf-event-edit { width: 44px; height: 44px; min-height: 44px; }
}
@media print { .nf-prog-tools, .nf-tl-tools, .nf-prog-add, .nf-event-edit, .nf-view-act[data-cal-add], .nf-pop { display: none !important; } }
/* Pass 2: unreadable or unsupported parts are shown as a calm note plus their words, never as syntax. */
#preview .nf-invalid { margin: 1em 0; padding: .6em .9em; border-left: 3px solid var(--note-muted); border-radius: 4px; background: color-mix(in srgb, var(--note-muted) 8%, transparent); }
#preview .nf-invalid .nf-view-note { margin: 0 0 .4em; }
#preview .nf-invalid p:last-child, #preview .nf-invalid ul:last-child { margin-bottom: 0; }
#preview .nf-invalid ul { margin: .3em 0; padding-left: 1.2em; }

/* NF-138: block-wise editing of a block note (block-editor.js). Editors only; readers and exports never draw these. */
#preview .nf-empty { margin: 2em 0; color: var(--note-muted); }
#preview .nf-edit-block { position: relative; border-radius: var(--note-card-radius, 6px); cursor: text; }
#preview .nf-edit-block + .nf-edit-block { margin-top: 14px; }
#preview > .nf-edit-block:first-child > :first-child { margin-top: 12px; } /* as .prose > :first-child (reading.css): starting to edit a notebook page moves nothing */
/* NF-143, NF-243 polish, NF-248 (Craft): nothing is drawn until it is needed. The block being typed in looks exactly as it reads: no tint,
   border, outline or focus ring, only the caret. The hovered block shows only the handle. A picked block (Esc, the handle) is one light tint
   of the Look's accent (a shadow of the same colour pads it, and neighbours meet at the 14px gap so a range reads as one band). */
/* BUG-048: while editing, a picture grid stays inside its block's outline (the reading view lets it run wider). */
#preview .nf-edit-block > .nf-view.nf-images { width: auto; margin-left: 0; }
#preview .nf-edit-block:focus-visible:not([data-picked], [data-selected]) { outline: 3px solid var(--note-accent); outline-offset: 6px; }
#preview .nf-edit-block:is([data-picked], [data-selected]):focus-visible { outline: none; }
#preview .nf-edit-block [data-nf-field] { outline: none; cursor: text; caret-color: var(--note-accent); min-width: 1ch; border-radius: 3px; }
#preview .nf-edit-block [data-nf-field]:focus { background: none; }
/* BUG-037, NF-248: an empty text block is a blank line (a stray <br> from deleting counts as empty); only the one with the caret shows the hint. */
#preview .nf-edit-block[data-nf-type=text] > p:empty::before { content: '\200b'; }
#preview .nf-edit-block[data-nf-type=text] > p:focus:is(:empty, :has(> br:only-child))::before { content: 'Type / for a block'; color: var(--nf-pencil-muted); pointer-events: none; }
#preview .nf-edit-block .nf-empty, #preview > .nf-empty { cursor: text; }
#preview .nf-edit-block .nf-section-head > .nf-section-title { display: flex; align-items: center; min-height: 44px; padding: 6px 12px 6px 0; font-weight: 600; }
#preview .nf-edit-block .nf-gcard-open { cursor: inherit; }
/* The bar under the selected block: ordinary app controls, 44px to touch. It floats over the next block rather than taking
   room, so selecting a block never moves the note under the finger (BUG-036). It sits at the right, as wide as its buttons, so
   the start of the next line, where its text is, can still be pressed. Progress rows need the full width. */
/* NF-143: the bar takes the Look (--note-*): a raised tint of the paper in ink, so on a dark Look it is dark, not a white strip. */
/* NF-206: the bar sits in the flow under the selected block (right-aligned), so it never covers the next block. */
#preview .nf-bar { position: sticky; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 5; width: fit-content; max-width: 100%; box-sizing: border-box; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 16px 0 0 auto; padding: 3px; border: var(--nf-glass-edge); border-radius: 14px; background: color-mix(in srgb, var(--note-paper) 45%, transparent); box-shadow: var(--nf-glass-shadow); color: var(--note-ink); font: 400 14px/1.2 var(--nf-font-ui, system-ui, sans-serif); cursor: default; }
#preview .nf-bar :is(button, select) { box-sizing: border-box; min-height: var(--nf-control-h); min-width: var(--nf-control-h); margin: 0; padding: 6px 12px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: inherit; font: inherit; font-weight: 500; }
#preview .nf-bar button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer; }
#preview .nf-bar select { border-color: var(--note-line); background-color: var(--note-paper); font-size: 14px; }
#preview .nf-bar button:hover:not(:disabled) { background: color-mix(in srgb, var(--note-ink) 10%, transparent); }
#preview .nf-bar button:disabled { background: transparent; border-color: transparent; color: var(--note-muted); opacity: .55; cursor: not-allowed; }
#preview .nf-bar button.danger { color: var(--nf-danger-note); border-color: transparent; }
#preview .nf-bar button.danger:hover:not(:disabled) { background: color-mix(in srgb, var(--nf-danger-note) 16%, transparent); }
#preview .nf-bar :is(button, select):focus-visible { outline: 2px solid var(--note-accent); outline-offset: 0; }
#preview .nf-bar img { flex: none; width: 20px; height: 20px; filter: var(--note-icon-filter); }
#preview .nf-bar-button mark { font-size: 15px; font-weight: 600; padding: 0 .25em; }
#preview .nf-bar-tone { display: inline-flex; align-items: center; gap: 6px; }
/* BUG-040: an open code field draws the block's final newline itself, so a newline typed last is a real line. */
#preview pre code[data-nf-field] { display: block; white-space: pre; }
#preview pre code[data-nf-field]::after { content: "\a"; white-space: pre; }
#preview .nf-bar-item { display: inline-flex; align-items: center; gap: 2px; margin-left: 4px; padding-left: 6px; border-left: 1px solid var(--note-line); }
#preview .nf-bar-item button { padding-inline: 8px; }
#preview .nf-bar-item-name { padding-inline: 4px 2px; color: var(--note-muted); font-size: 13px; }
#preview .nf-bar-rows { display: grid; flex-basis: 100%; gap: 4px; }
#preview .nf-bar:has(.nf-bar-rows) { margin-left: 0; width: auto; }
#preview .nf-bar-row { display: flex; align-items: center; gap: 6px; }
#preview .nf-bar-label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#preview .nf-bar-value { flex: none; min-width: 4.5em; text-align: center; font-variant-numeric: tabular-nums; }
/* NF-243: block selection, the gutter handle (a "+" and a grip beside the hovered or selected block), the drop line and the block menu.
   No animation. The handle is fixed beside the note (placed by block-editor.js); the grip alone takes touch-action, so the page still scrolls. */
#preview .nf-edit-block[data-picked] { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--note-accent) 12%, transparent), 0 0 0 7px color-mix(in srgb, var(--note-accent) 12%, transparent); cursor: auto; }
#preview .nf-edit-block.nf-tint { margin-block: 0; }
#preview .nf-edit-block.nf-tint + .nf-edit-block, #preview .nf-edit-block + .nf-edit-block.nf-tint { margin-top: 14px; }
#preview .nf-edit-block[data-dragging] { opacity: .4; }
#preview.nf-sweeping { user-select: none; -webkit-user-select: none; }
.nf-handle[hidden] { display: none; }
.nf-drop-line { position: fixed; z-index: 42; height: 3px; margin-top: -1px; border-radius: 2px; background: var(--note-accent, var(--nf-accent)); pointer-events: none; }
.nf-drop-line[hidden] { display: none; }
body[data-nf-dragging] { cursor: grabbing; -webkit-user-select: none; user-select: none; }
@media print { .nf-handle, .nf-drop-line, .nf-block-menu { display: none !important; } }
/* NF-206: on phones the bar's button words are spoken, not drawn (aria-labels stay), so the bar fits one row. */
@media (max-width: 750px) {
  #preview .nf-bar-button > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  #preview .nf-bar { gap: 0; }
  #preview .nf-bar-tone { font-size: 0; gap: 0; } /* the name ("Turn into") stays for screen readers; the select shows the choice */
  #preview .nf-bar-tone select { font-size: 16px; max-width: 5em; text-overflow: ellipsis; } /* BUG-064: one row at 390 */
  #preview .nf-bar-item-name { display: none; }
  #preview .nf-bar :is(button, select) { padding-inline: 8px; }
}
@media print { .nf-bar { display: none !important; } }

/* NF-154: Memory is a page that reuses the Project settings classes; the sections replace the note the same way. */

/* The room's chat (components/room/chat.tsx; layout in notes.css). Messages, Nota's card, polls and the composer are drawn with the room components and Tailwind; these are the parts still plain markup:
   the sheet's header and search, the older-messages and new-messages buttons, the staged files, the selection being annotated, the message menu and Nota's first-draft prompt. */
.chat-scroll { padding: 0 0 32px; }
.chat-scroll:focus-visible { outline: 2px solid var(--nf-pencil); outline-offset: -2px; }
.chat-older { display: flex; justify-content: center; margin: 8px auto; }
.chat-empty { margin: 24px 16px; color: var(--nf-pencil-muted); text-align: center; }
.notefriends-brand .chat-msg button.chat-original, .notefriends-brand .chat-msg button.chat-quote-page { min-height: 0; margin: 0; padding: 0; border: 0; background: transparent; color: var(--nf-accent); font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.chat-new { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); z-index: 1; border-radius: 999px; box-shadow: 0 2px 8px var(--nf-shade-md); }
/* One disclosure replaces the repeated message/file action rows. Native details stays usable without hover. */
.hover-menu { opacity: 0; }
.hover-menu-host:hover > .hover-menu, .hover-menu-host:focus-within > .hover-menu, .hover-menu:has([aria-expanded=true]) { opacity: 1; }
@media (hover: none) { .hover-menu { opacity: 1; } }
/* Two cards across on a phone: the left card's menu opens rightwards, so it stays on the screen. */
@media (max-width: 750px) { #appendix-list > :nth-child(odd) [role=menu] { right: auto; left: 0; } }
@media (prefers-reduced-motion: no-preference) { .chat-sheet:not([hidden]) { animation: chat-sheet-in .15s ease-out; } }
@keyframes chat-sheet-in { from { opacity: 0; transform: translateY(8px); } }

/* NF-185: the Sketch editor (components/note/editors/sketch-editor.js): tools above the board, stickies you can drag and type in. */
#preview .nf-sketch-bar, #preview .nf-sketch-options { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 8px; }
#preview .nf-sketch :is(.nf-sketch-bar, .nf-sketch-options) button, #preview .nf-sketch-open { box-sizing: border-box; min-width: 44px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--note-line); border-radius: 8px; background: var(--note-paper); color: var(--note-ink); font: 14px/1.2 var(--nf-font-ui, system-ui, sans-serif); cursor: pointer; }
#preview .nf-sketch button:hover:not(:disabled) { background: color-mix(in srgb, var(--note-ink) 10%, var(--note-paper)); }
#preview .nf-sketch button:disabled { opacity: .5; cursor: default; }
#preview .nf-sketch button[aria-pressed=true] { border-color: var(--note-accent); background: color-mix(in srgb, var(--note-accent) 18%, var(--note-paper)); font-weight: 600; }
#preview .nf-sketch button:focus-visible, #preview .nf-sketch-note:focus-visible { outline: 3px solid var(--note-accent); outline-offset: 2px; }
#preview .nf-sketch .nf-sketch-done { margin-left: auto; border-color: var(--note-accent); }
#preview .nf-sketch button.danger { color: var(--nf-danger-note); }
#preview .nf-sketch .nf-sketch-options button.nf-sketch-swatch { padding: 0; background: var(--sticky); }
#preview .nf-sketch .nf-sketch-swatch[data-color=yellow] { --sticky: var(--note-sticky-yellow); }
#preview .nf-sketch .nf-sketch-swatch[data-color=pink] { --sticky: var(--note-sticky-pink); }
#preview .nf-sketch .nf-sketch-swatch[data-color=blue] { --sticky: var(--note-sticky-blue); }
#preview .nf-sketch .nf-sketch-swatch[data-color=green] { --sticky: var(--note-sticky-green); }
#preview .nf-sketch .nf-sketch-options button.nf-sketch-swatch[aria-pressed=true] { background: var(--sticky); box-shadow: inset 0 0 0 3px var(--note-accent); }
#preview .nf-sketch-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; margin: 6px 0 0; color: color-mix(in srgb, var(--note-ink) 70%, transparent); font-size: 13px; }
#preview .nf-sketch-status[data-tone=problem] { color: var(--nf-danger-note); }
#preview .nf-sketch-status button { box-sizing: border-box; min-width: 44px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--note-line); border-radius: 8px; background: var(--note-paper); color: var(--note-ink); font: 14px/1.2 var(--nf-font-ui, system-ui, sans-serif); cursor: pointer; }
#preview .nf-sketch polyline.is-unsaved { stroke-dasharray: 3 2; }
#preview .nf-sketch-status:empty { display: none; }
#preview .nf-sketch.is-editing .nf-sketch-board { touch-action: none; -webkit-user-select: none; user-select: none; cursor: crosshair; }
#preview .nf-sketch[data-tool=eraser] .nf-sketch-board { cursor: cell; }
#preview .nf-sketch.is-editing .nf-sketch-note { cursor: grab; touch-action: none; }
#preview .nf-sketch-note.is-selected { outline: 2px solid var(--note-accent); }
#preview .nf-sketch-note textarea { display: block; box-sizing: border-box; width: 100%; min-height: 3.6em; margin: 0; padding: 0; border: 0; outline: 0; background: transparent; color: inherit; font: inherit; resize: none; overflow: hidden; pointer-events: none; }
#preview .nf-sketch-note.is-typing { cursor: text; }
#preview .nf-sketch-note.is-typing textarea { pointer-events: auto; -webkit-user-select: text; user-select: text; }
#preview .nf-sketch polyline.is-erasing { opacity: .2; }
#preview .nf-sketch-open { margin-top: 8px; border-color: var(--note-accent); }
@media (max-width: 750px) {
  #preview .nf-sketch.is-expanded { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; align-items: center; gap: 4px; box-sizing: border-box; margin: 0; padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); overflow: auto; overscroll-behavior: contain; touch-action: none; background: var(--note-paper); }
  #preview .nf-sketch.is-expanded > :is(.nf-sketch-bar, .nf-sketch-options, .nf-sketch-status) { align-self: stretch; }
  #preview .nf-sketch.is-expanded .nf-sketch-board { flex: none; width: min(100%, calc((100dvh - 210px) * 1.6)); }
}
@media (prefers-reduced-motion: no-preference) { #preview .nf-sketch-note { transition: box-shadow .15s; } #preview .nf-sketch-note.is-selected { box-shadow: 0 3px 8px color-mix(in srgb, var(--note-ink) 45%, transparent); } }
@media print { .nf-sketch-bar, .nf-sketch-options, .nf-sketch-open { display: none !important; } }
/* NF-168: Witty, a popover at the selection (components/witty.js); a bottom sheet on narrow screens. */
.nf-witty { position: fixed; z-index: 60; box-sizing: border-box; width: min(360px, calc(100vw - 16px)); display: grid; gap: 8px; padding: 12px; border: 1px solid var(--nf-line); border-radius: var(--nf-radius-menu); background: var(--nf-sheet); color: var(--nf-pencil); box-shadow: var(--nf-shadow-menu); font: 14px/1.45 var(--nf-font-ui, system-ui, sans-serif); }
.nf-witty.is-sheet { inset: auto 0 0 0; width: 100%; border-radius: var(--nf-radius-menu) var(--nf-radius-menu) 0 0; padding-bottom: calc(12px + env(safe-area-inset-bottom)); max-height: 70dvh; overflow: auto; }
.nf-witty-head { display: flex; align-items: center; gap: 6px; }
.nf-witty-head strong { flex: 1; }
.nf-witty-scope, .nf-witty-status { margin: 0; color: var(--nf-pencil-muted); font-size: 13px; }
.nf-witty-status:empty { display: none; }
.nf-witty-asks { display: flex; flex-wrap: wrap; gap: 6px; }
.nf-witty-form { display: flex; gap: 6px; }
.nf-witty-result { max-height: 40dvh; overflow: auto; padding: 8px 10px; border-radius: 8px; background: var(--nf-hover); white-space: pre-wrap; overflow-wrap: anywhere; }
.nf-witty-result[hidden], .nf-witty-actions[hidden] { display: none; }
.nf-witty-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (prefers-reduced-motion: no-preference) { .nf-witty { animation: nf-witty-in .12s ease-out; } }
@keyframes nf-witty-in { from { opacity: 0; transform: translateY(4px); } }


/* ===== The global pages (Activity, Friends, You): their page kit is components/ui/global-page.tsx, drawn with Tailwind; only the shell's own states stay here ===== */
.destination { box-sizing: border-box; max-width: var(--nf-page-measure); margin: 0 auto; padding: 40px 24px 56px; }
/* The kit's pages carry their own width and padding. */
.destination.page-view { max-width: none; margin: 0; padding: 0; }
/* One line and one action for a page that is loading, unavailable or failed to load. */
.shell-state { padding-top: 96px; text-align: center; }
.shell-state p { margin: 0 0 16px; font-size: 17px; line-height: 1.5; }
.shell-state-actions { display: flex; justify-content: center; }
/* Needs you in a notebook's list (components/notebook/needs-list.tsx): what this person has to answer, each with its reason and a link to the message in Chat. */
.needs-list { margin: 0 0 24px; padding: 0; list-style: none; }
.needs-list[hidden] { display: none; }
.needs-item { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--nf-line); }
.needs-notebook { flex: 1 0 100%; font-size: 13px; color: var(--nf-pencil-muted); font-weight: 600; }
.needs-reason { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 750px) {
  .destination { padding: 12px 16px 32px; }
  .shell-state { padding-top: 48px; }
}

/* Magic Notebook slice 11: Sources and comments. A comment in Chat shows its quote and page; the thread's actions and the pages that use a message sit quietly under it. */
.notefriends-brand .chat-msg button.chat-quote-page { min-height: 0; margin: 0; padding: 0; text-decoration: underline; text-underline-offset: 2px; }
.notefriends-brand .chat-msg .chat-original { display: inline; min-height: 32px; margin: 0; padding: 2px 0; border: 0; background: transparent; color: inherit; text-decoration: underline; text-underline-offset: 3px; font: inherit; }
.comment-layer { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.comment-chip { position: absolute; display: flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 10px 2px 8px; border: 1px solid var(--nf-line); border-radius: 14px; background: var(--nf-sheet); color: var(--nf-pencil-muted); font: 400 13px/1.3 var(--nf-font-ui); cursor: pointer; pointer-events: auto; overflow: hidden; }
.comment-chip:hover, .comment-chip:focus-visible { border-color: var(--nf-pencil); color: var(--nf-pencil); }
.comment-count { flex: none; min-width: 1.4em; padding: 0 4px; border-radius: 10px; background: var(--nf-line); color: var(--nf-pencil); text-align: center; font-size: 12px; }
.comment-words { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.comment-mark { position: absolute; width: 3px; border-radius: 2px; background: var(--nf-pencil-muted); }
::highlight(nf-comment) { background-color: color-mix(in srgb, var(--nf-pencil-muted) 18%, transparent); }
[data-comments] { padding-bottom: 34px; }
@media print { .comment-layer { display: none !important; } ::highlight(nf-comment) { background: none; } [data-comments] { padding-bottom: 0 !important; } }
@media (prefers-reduced-motion: reduce) { .comment-chip { transition: none; } }
/* A comment reads from the left like a person's message in the reference, not as a bubble on the right. */

/* React mounts its tree here (src/app.tsx). The views draw into the page's own elements, so the root takes no part in the layout. */
#root { display: contents; }

/* The Things icon (components/ui/room-icon.tsx) orbits once on hover or tap and loops while Nota is making something: the set turns 360 degrees round the icon's centre, each shape turns back so it stays upright. At rest nothing moves, so the approved screens are unchanged. */
.nf-orbit { transform-box: view-box; transform-origin: 12px 12px; }
.nf-orbit-shape { transform-box: fill-box; transform-origin: center; }
@keyframes nf-orbit-once { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }
@keyframes nf-orbit-counter-once { 0% { transform: rotate(0deg); } 100% { transform: rotate(-360deg); } }
@keyframes nf-orbit-loop { 0% { transform: rotate(0deg); } 58% { transform: rotate(360deg); } 100% { transform: rotate(360deg); } }
@keyframes nf-orbit-counter-loop { 0% { transform: rotate(0deg); } 58% { transform: rotate(-360deg); } 100% { transform: rotate(-360deg); } }
@media (prefers-reduced-motion: no-preference) {
  .nf-orbit-icon[data-orbit="once"] .nf-orbit { animation: nf-orbit-once 1.4s cubic-bezier(.45, 0, .2, 1) 1; }
  .nf-orbit-icon[data-orbit="once"] .nf-orbit-shape { animation: nf-orbit-counter-once 1.4s cubic-bezier(.45, 0, .2, 1) 1; }
  .nf-orbit-icon[data-orbit="loop"] .nf-orbit { animation: nf-orbit-loop 2.4s cubic-bezier(.45, 0, .2, 1) infinite; }
  .nf-orbit-icon[data-orbit="loop"] .nf-orbit-shape { animation: nf-orbit-counter-loop 2.4s cubic-bezier(.45, 0, .2, 1) infinite; }
  /* The icon beside the open sheet's title: one 1.4s turn as it appears, then a rest, every 8 seconds. */
  .nf-orbit-icon[data-orbit="every"] .nf-orbit { animation: nf-orbit-every 8s cubic-bezier(.45, 0, .2, 1) infinite; }
  .nf-orbit-icon[data-orbit="every"] .nf-orbit-shape { animation: nf-orbit-counter-every 8s cubic-bezier(.45, 0, .2, 1) infinite; }
}
@keyframes nf-orbit-every { 0% { transform: rotate(0deg); } 17.5%, 100% { transform: rotate(360deg); } }
@keyframes nf-orbit-counter-every { 0% { transform: rotate(0deg); } 17.5%, 100% { transform: rotate(-360deg); } }

/* Link cards (components/room/link-card.tsx): the shimmer that holds a card's place for up to 5 seconds. Still when motion is reduced. */
.link-card-wait { background: linear-gradient(90deg, var(--nf-sheet) 0%, color-mix(in srgb, var(--nf-line) 55%, var(--nf-sheet)) 50%, var(--nf-sheet) 100%); background-size: 200% 100%; }
@media (prefers-reduced-motion: no-preference) { .link-card-wait { animation: link-card-wait 1.4s linear infinite; } @keyframes link-card-wait { to { background-position: -200% 0; } } }
