/* My notes: a calm two-pane workspace (list + editor); one pane at a time on phones. Tokens from app.css only. */

.nt-head { padding-top: var(--s5); padding-bottom: var(--s5); margin-bottom: var(--s5); }
.nt-head h1 { font-size: 26px; }
.nt-head .subtitle .icon { display: inline-block; vertical-align: -2px; margin-right: 4px; color: var(--accent-text); }

.nt-shell { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.nt-side { position: sticky; top: calc(var(--topbar-h) + var(--s3)); max-height: calc(100vh - var(--topbar-h) - var(--s6));
  overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: var(--s3); min-width: 0;
  padding: 2px 4px 2px 2px; scrollbar-width: thin; }
.nt-side-top { display: flex; flex-direction: column; gap: var(--s2); }
.nt-new .btn { width: 100%; }
.nt-search { display: flex; gap: var(--s2); align-items: center; }
.nt-search-box { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; }
.nt-search-box .icon { position: absolute; left: 10px; color: var(--muted); pointer-events: none; }
.nt-search-box .input { padding-left: 34px; width: 100%; }
.nt-views { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow: visible; }
.nt-views a { flex: 1 1 auto; justify-content: center; gap: 4px; padding-left: 8px; padding-right: 8px; }
.nt-count { display: inline-flex; min-width: 18px; height: 18px; padding: 0 5px; align-items: center; justify-content: center;
  border-radius: 9px; background: var(--surface-3); color: var(--muted); font-size: 11.5px; font-weight: 600; margin-left: auto; }
.nt-views .nt-count { margin-left: 0; }

.nt-group { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface); }
.nt-group > summary { display: flex; align-items: center; gap: var(--s2); padding: 10px var(--s3); cursor: pointer; font-weight: 600;
  font-size: 13px; color: var(--text-2); list-style: none; min-height: 40px; }
.nt-group > summary::-webkit-details-marker { display: none; }
.nt-group > summary .nt-count { margin-left: auto; }
.nt-group[open] > summary { border-bottom: 1px solid var(--border); }
.nt-pad { padding: var(--s2) var(--s3); margin: 0; }
.nt-tree { list-style: none; margin: 0; padding: var(--s1) 0; }
.nt-tree a { display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s3) 6px calc(var(--s3) + var(--d, 0) * 14px);
  color: var(--text-2); min-height: 32px; font-size: 13.5px; border-left: 2px solid transparent; }
.nt-tree a:hover { background: var(--surface-2); text-decoration: none; color: var(--text); }
.nt-tree a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); border-left-color: var(--accent); font-weight: 600; }
.nt-tree-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.nt-inline-form { display: flex; gap: var(--s2); padding: var(--s2) var(--s3) var(--s3); }
.nt-inline-form .input { flex: 1; min-width: 0; height: 32px; }
.nt-label { font-size: 12px; font-weight: 600; color: var(--muted); margin: var(--s2) var(--s3) var(--s1); text-transform: uppercase; letter-spacing: .04em; }
.nt-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--s3) var(--s3); }
.nt-chips .chip:hover { text-decoration: none; filter: brightness(.97); }
.nt-chips .nt-count { margin-left: 2px; height: 16px; min-width: 16px; font-size: 11px; }

.nt-list { display: flex; flex-direction: column; gap: var(--s2); min-width: 0; }
.nt-list-head { display: flex; align-items: center; gap: var(--s2); justify-content: space-between; margin-top: var(--s1); }
.nt-list-head h2 { font-size: 15px; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-sort { display: flex; gap: var(--s1); }
.nt-sort .input { height: 32px; font-size: 13px; padding-top: 0; padding-bottom: 0; width: auto; }
.nt-folder-bar, .nt-trash-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.nt-folder-bar .nt-crumbs, .nt-trash-bar p { margin: 0; }
.nt-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.nt-item { display: flex; flex-direction: column; gap: 3px; padding: 10px var(--s3); border-radius: var(--r-sm); color: var(--text);
  border: 1px solid transparent; }
.nt-item:hover { background: var(--surface); border-color: var(--border); text-decoration: none; }
.nt-item.current { background: var(--surface); border-color: var(--border-strong); box-shadow: var(--shadow-1); }
.nt-item.current .nt-item-title { color: var(--accent-text); }
.nt-item-title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.nt-item-title > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-pin { color: var(--accent); display: inline-flex; flex: none; }
.nt-item-snippet { font-size: 13px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.nt-item-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px var(--s2); font-size: 12px; color: var(--faint); }
.nt-item-meta > span { display: inline-flex; align-items: center; gap: 3px; }
.nt-tag { color: var(--accent-text); }
.nt-flag { padding: 0 6px; border-radius: 6px; background: var(--neutral-soft); color: var(--neutral); }
.nt-export { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding-top: var(--s2); border-top: 1px solid var(--border); }

/* --------------------------------------------------------------- the editor */
.nt-pane { min-width: 0; }
.nt-note { padding: var(--s4) var(--s8) var(--s6); display: flex; flex-direction: column; gap: var(--s3); min-height: 60vh; }
.nt-bar { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; min-height: 36px; }
.nt-bar .nt-crumbs { margin: 0; display: inline-flex; align-items: center; gap: 4px; min-width: 0; flex: 1 1 auto; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.nt-back { display: none; }
.nt-status { font-size: 12.5px; color: var(--muted); white-space: nowrap; min-height: 18px; display: inline-flex; align-items: center; gap: 6px; }
.nt-status:not(:empty)::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.nt-status[data-tone="ok"]::before { background: var(--good); }
.nt-status[data-tone="warn"] { color: var(--warn); white-space: normal; }
.nt-status[data-tone="warn"]::before { background: var(--warn); }
.nt-status[data-tone="error"] { color: var(--danger); white-space: normal; }
.nt-status[data-tone="error"]::before { background: var(--danger); }
.nt-actions { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.nt-actions form { margin: 0; }
.nt-actions .btn[aria-pressed="true"] { color: var(--accent-text); }
.nt-more { position: relative; }
.nt-more > summary { list-style: none; }
.nt-more > summary::-webkit-details-marker { display: none; }
.nt-pop { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: min(320px, 86vw); padding: var(--s4);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column; gap: var(--s4); }
.nt-pop-right { left: auto; right: 0; }
.nt-pop label { font: 600 13px/1.3 var(--font); color: var(--text-2); }
.nt-pop .row { flex-wrap: nowrap; }
.nt-pop .input { min-width: 0; flex: 1; }
.nt-trashed .nt-trash-actions { margin-top: var(--s2); }
.nt-conflict-actions { margin-top: var(--s2); flex-wrap: wrap; }

.nt-form { display: flex; flex-direction: column; gap: var(--s2); }
.nt-title { border: 0; background: transparent; font: 650 28px/1.25 var(--font-display); color: var(--text); padding: var(--s2) 0;
  width: 100%; letter-spacing: -.01em; border-radius: var(--r-sm); }
.nt-title::placeholder { color: var(--faint); }
.nt-title:focus { outline: none; box-shadow: none; }
.nt-title:focus-visible { box-shadow: 0 2px 0 0 var(--accent); }
.nt-form:not(.rich) .nt-rich-wrap { display: none; }
.nt-form.rich .nt-fallback { display: none; }
.nt-fallback { display: flex; flex-direction: column; gap: var(--s2); }
.nt-fallback > label { font: 600 13px/1.3 var(--font); color: var(--text-2); }
.nt-textarea { min-height: 320px; font: 14px/1.6 var(--font-mono); resize: vertical; height: auto; padding: var(--s3); }

.nt-toolbar { position: sticky; top: var(--topbar-h); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 4px; margin: 0 calc(var(--s2) * -1); background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); }
.nt-tb { min-width: 32px; height: 32px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2);
  font: 600 13.5px/1 var(--font); display: inline-flex; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.nt-tb:hover { background: var(--surface-3); color: var(--text); }
.nt-tb[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }
.nt-tb:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 1px; }
.nt-tb-text { margin-left: auto; font-weight: 500; }
.nt-tb-sep { width: 1px; height: 20px; background: var(--border); margin: 0 4px; }

.nt-rich { min-height: 42vh; padding: var(--s3) 0 var(--s8); outline: none; font-size: 16px; line-height: 1.7; color: var(--text);
  max-width: 76ch; overflow-wrap: anywhere; caret-color: var(--accent); }
.nt-rich:focus-visible { box-shadow: -3px 0 0 0 var(--accent-soft); }
.nt-rich.is-empty::before { content: attr(data-placeholder); color: var(--faint); pointer-events: none; display: block; }
.nt-rich.is-empty > p:first-child, .nt-rich.is-empty > br:first-child { display: none; }
.nt-rich > :first-child { margin-top: 0; }
.nt-rich p, .nt-rich ul, .nt-rich ol, .nt-rich blockquote, .nt-rich pre { margin: 0 0 .7em; }
.nt-rich h2 { font: 650 22px/1.3 var(--font-display); margin: 1.1em 0 .4em; }
.nt-rich h3 { font: 650 18px/1.35 var(--font-display); margin: 1em 0 .35em; }
.nt-rich h4 { font: 650 16px/1.4 var(--font); margin: .9em 0 .3em; color: var(--text-2); }
.nt-rich ul, .nt-rich ol { padding-left: 1.5em; }
.nt-rich li { margin: .15em 0; }
.nt-rich blockquote { border-left: 3px solid var(--lavender); padding: .1em 0 .1em 1em; color: var(--text-2); }
.nt-rich pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: var(--s3); overflow-x: auto;
  font: 13.5px/1.55 var(--font-mono); white-space: pre-wrap; }
.nt-rich code { font: .9em var(--font-mono); background: var(--surface-3); padding: .1em .35em; border-radius: 4px; }
.nt-rich pre code { background: none; padding: 0; }
.nt-rich a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.nt-rich hr { border: 0; border-top: 1px solid var(--border-strong); margin: 1.4em 0; }
.nt-rich img { max-width: 100%; height: auto; border-radius: var(--r-sm); border: 1px solid var(--border); display: block; margin: .4em 0; }
.nt-rich ul[data-checklist="true"] { list-style: none; padding-left: 30px; }
.nt-rich ul[data-checklist="true"] > li { position: relative; }
.nt-rich ul[data-checklist="true"] > li::before { content: ""; position: absolute; left: -28px; top: .32em; width: 17px; height: 17px;
  border: 1.5px solid var(--control-border); border-radius: 5px; background: var(--surface); cursor: pointer; box-sizing: border-box; }
.nt-rich ul[data-checklist="true"] > li[data-checked="true"]::before { background: var(--accent); border-color: var(--accent); }
.nt-rich ul[data-checklist="true"] > li[data-checked="true"]::after { content: ""; position: absolute; left: -22px; top: calc(.32em + 3px);
  width: 5px; height: 9px; border: solid var(--surface); border-width: 0 2px 2px 0; transform: rotate(45deg); pointer-events: none; }
.nt-rich ul[data-checklist="true"] > li[data-checked="true"] { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); }

.nt-details { border-top: 1px solid var(--border); padding-top: var(--s3); }
.nt-details > summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--text-2); min-height: 28px; display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.nt-tags-inline { font-weight: 500; color: var(--accent-text); }
.nt-details-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); margin-top: var(--s3); }
.nt-details-form .form-actions { grid-column: 1 / -1; margin: 0; }

.nt-files { border-top: 1px solid var(--border); padding-top: var(--s3); display: flex; flex-direction: column; gap: var(--s3); }
.nt-files-title { font-size: 13.5px; margin: 0; color: var(--text-2); display: flex; align-items: center; gap: var(--s2); }
.nt-files-title .nt-count { margin-left: 0; }
.nt-file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.nt-file { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; padding: var(--s2); border: 1px solid var(--border); border-radius: var(--r-sm); }
.nt-file form { margin: 0; }
.nt-file img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; display: block; background: var(--surface-2); }
.nt-file-name { font-weight: 500; font-size: 13.5px; flex: 1 1 140px; min-width: 0; overflow-wrap: anywhere; }
.nt-upload { display: flex; flex-direction: column; gap: var(--s1); }
.nt-upload > label { font: 600 13px/1.3 var(--font); color: var(--text-2); }
.nt-upload .row { flex-wrap: wrap; }
.nt-upload input[type="file"] { max-width: 100%; font-size: 13px; }
.nt-meta { margin: 0; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

.nt-placeholder { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s10) var(--s4);
  border: 1px dashed var(--border-strong); border-radius: var(--r-lg); background: var(--surface); }

@media (max-width: 1200px) {
  .nt-note { padding: var(--s4) var(--s5) var(--s5); }
}
@media (max-width: 900px) {
  main:has(.nt-shell.has-note) .nt-head { display: none; }
  .nt-shell { grid-template-columns: minmax(0, 1fr); }
  .nt-side { position: static; max-height: none; overflow: visible; padding: 0; }
  .nt-shell.has-note .nt-side { display: none; }
  .nt-shell:not(.has-note) .nt-pane { display: none; }
  .nt-back { display: inline-flex; }
  .nt-note { padding: var(--s3) var(--s4) var(--s4); border-radius: var(--r); }
  .nt-title { font-size: 23px; }
  .nt-rich { font-size: 16.5px; min-height: 50vh; }
  .nt-details-form { grid-template-columns: minmax(0, 1fr); }
  .nt-tb-text { margin-left: 0; }
}
@media print {
  .nt-side, .nt-bar, .nt-toolbar, .nt-details, .nt-upload, .nt-head { display: none !important; }
  .nt-shell { display: block; }
  .nt-note { border: 0; box-shadow: none; padding: 0; }
}
