/* ntcom-notes.css - NTCOM (ntcom.29): Notes page (dashboard/ntcom-notes.js) and the Lexical
   editor surface. Colours come from the theme variables, so light/dark follow the app. */
.nnt { display: grid; grid-template-columns: 250px minmax(240px, 320px) minmax(0, 1fr); gap: 0;
  height: calc(100vh - var(--topbar-h, 52px) - 64px); min-height: 460px;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface-1); }
.nnt [hidden] { display: none !important; }
.nnt button { font: inherit; color: inherit; }
.nnt svg { width: 16px; height: 16px; flex: 0 0 auto; }

/* categories: iOS-style grouped list (tinted icon tile, name, count, chevron) */
.nnt-cats { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px 10px 16px; display: flex; flex-direction: column; min-height: 0; }
.nnt-cats-top { display: flex; align-items: center; gap: 4px; padding: 2px 4px 8px; }
.nnt-cats-head { font-weight: 700; font-size: 17px; flex: 1 1 auto; }
.nnt-cats .nnt-search { margin: 0 0 10px; }
.nnt-new-top { display: none; }
.nnt-group { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; margin-bottom: 12px; }
.nnt-cat { display: flex; align-items: center; gap: 12px; width: 100%; border: 0; background: none; cursor: pointer;
  padding: 9px 10px; text-align: left; color: var(--text); position: relative; }
.nnt-cat + .nnt-cat::before { content: ""; position: absolute; top: 0; left: 52px; right: 0; border-top: 1px solid var(--border); }
.nnt-cat:hover { background: var(--surface-2, rgba(127, 127, 127, .08)); }
.nnt-cat.on { background: var(--accent-wash, rgba(31, 95, 191, .14)); }
.nnt-cat.picked { background: var(--accent-wash, rgba(31, 95, 191, .14)); }
.nnt-cat-ic { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  color: var(--cc); background: color-mix(in srgb, var(--cc) 14%, transparent); }
.nnt-cat-ic svg { width: 18px; height: 18px; }
.nnt-cat-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.nnt-cat.dim .nnt-cat-name { color: var(--text2); }
.nnt-cat-n { font-size: 14px; color: var(--text3); min-width: 1.2em; text-align: right; }
.nnt-cat-ai, .nnt-item-ai { display: inline-flex; color: var(--text3); }
.nnt-cat-ai svg, .nnt-item-ai svg { width: 14px; height: 14px; }
.nnt-chev, .nnt-check { display: inline-flex; color: var(--text3); }
.nnt-check svg { width: 20px; height: 20px; }
.nnt-cat.picked .nnt-check, .nnt-item.picked .nnt-check { color: var(--accent); }
.nnt-more .nnt-cat-name { color: var(--accent); }
.nnt-addcat .nnt-cat-name { color: #22a06b; }
.nnt-ai-note { display: flex; gap: 8px; align-items: flex-start; margin: 2px 4px 0; font-size: 12.5px; line-height: 1.45; color: var(--text3); }
.nnt-ai-note svg { width: 14px; height: 14px; margin-top: 2px; flex: 0 0 auto; }

/* attachments of a note (ntcom.38) */
.nnt-files { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.nnt-file { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 5px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface-1); color: var(--text2); cursor: pointer; font-size: 13px; }
.nnt-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.nnt-file svg { width: 14px; height: 14px; }
.nnt-file:hover { border-color: var(--accent); color: var(--accent); }
.nnt-modal-note { white-space: pre-line; }

/* hidden vault box (ntcom.35) */
.nnt-vault { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 2px 12px; padding: 9px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-1); font-size: 13px; color: var(--text2); }
.nnt-vault > svg { width: 16px; height: 16px; color: var(--accent); }
.nnt-vault span { flex: 1 1 160px; }
.nnt-vault .nnt-btn { padding: 5px 12px; font-size: 13px; }
.nnt-vault.warn { border-color: var(--red); color: var(--text); }
.nnt-vault.warn > svg { color: var(--red); }

/* quick select bar (hide/show from AI) */
.nnt-selbar { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px;
  margin-top: auto; background: var(--bg-elev, var(--bg, #111)); border-top: 1px solid var(--border); }
.nnt-selbar .nnt-btn { padding: 6px 10px; font-size: 13px; }
.nnt-selbar .nnt-btn[disabled] { opacity: .45; cursor: default; }
.nnt-sel-n { font-size: 13px; color: var(--text2); margin-right: auto; }
.nnt.selecting .nnt-new, .nnt.selecting .nnt-selcats, .nnt.selecting .nnt-selnotes { display: none !important; }

/* list */
.nnt-list { border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.nnt-list .nnt-search { display: flex; }
.nnt-list-head { display: flex; align-items: center; gap: 6px; padding: 10px 10px 6px; }
.nnt-list-title { flex: 1 1 auto; font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nnt-back-cats { display: none; }
.nnt-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid transparent; background: none; cursor: pointer; color: var(--text2); }
.nnt-icon:hover { border-color: var(--border); color: var(--accent); }
.nnt-icon.on { color: var(--accent); background: var(--accent-wash, rgba(255, 122, 60, .12)); }
.nnt-aibtn { color: var(--green, #22a06b); }
.nnt-aibtn.off { color: var(--text3); }
.nnt-icon svg { width: 18px; height: 18px; }
.nnt-search { display: flex; align-items: center; gap: 6px; margin: 0 10px 8px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg, transparent); color: var(--text3); }
.nnt-search input { flex: 1 1 auto; min-width: 0; border: 0; outline: 0; background: none; color: var(--text); font: inherit; }
.nnt-items { flex: 1 1 auto; overflow-y: auto; padding: 0 6px 10px; }
.nnt-sec { font-size: 12px; font-weight: 700; color: var(--text3); padding: 10px 8px 4px; text-transform: uppercase; letter-spacing: .03em; }
.nnt-item { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: left; border: 0; background: none; cursor: pointer; padding: 9px 10px;
  border-radius: 10px; border-bottom: 1px solid var(--border); }
.nnt-item-main { display: block; flex: 1 1 auto; min-width: 0; }
.nnt-item-top, .nnt-item-sub { display: flex; }
.nnt-item-sub { display: block; }
.nnt-item .nnt-check { padding-top: 2px; }
.nnt-item.picked { background: var(--accent-wash, rgba(31, 95, 191, .14)); }
.nnt-item:hover { background: var(--surface-2, rgba(127, 127, 127, .08)); }
.nnt-item.on { background: var(--accent-wash, rgba(255, 122, 60, .14)); border-bottom-color: transparent; }
.nnt-item-top { display: flex; align-items: center; gap: 5px; }
.nnt-pin { color: var(--accent); display: inline-flex; }
.nnt-pin svg { width: 13px; height: 13px; }
.nnt-item-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nnt-item-sub { font-size: 13px; color: var(--text3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.nnt-item-time { color: var(--text2); margin-right: 4px; }
.nnt-lockline { display: inline-flex; align-items: center; gap: 3px; }
.nnt-lockline svg { width: 12px; height: 12px; }
.nnt-item-cat { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text3); margin-top: 3px; }
.nnt-item-cat svg { color: var(--cc, currentColor); }
.nnt-item-cat svg { width: 12px; height: 12px; }
.nnt-empty-list { color: var(--text3); padding: 18px 10px; text-align: center; }
.nnt-link { border: 0; background: none; color: var(--accent); cursor: pointer; text-decoration: underline; padding: 0 2px; }
.nnt-err { color: var(--red); padding: 12px; }

/* editor pane */
.nnt-editor { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; padding: 0 18px 24px; }
.nnt-empty, .nnt-loading { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 10px; color: var(--text3); text-align: center; padding: 30px; }
.nnt-empty svg { width: 42px; height: 42px; opacity: .5; }
.nnt-ed-head { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  padding: 10px 0 8px; background: var(--bg-elev, var(--bg, #111)); border-bottom: 1px solid var(--border); }
.nnt-back { display: none; }
.nnt-grow { flex: 1 1 auto; }
.nnt-catsel { font: inherit; color: var(--text); background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; max-width: 46vw; }
.nnt-status { font-size: 12px; color: var(--text3); margin-left: 6px; }
.nnt-status.ok { color: var(--green); }
.nnt-status.err { color: var(--red); }
.nnt-ed-trash { flex: 1 1 auto; color: var(--text3); }
.nnt-btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface-1);
  padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--text); }
.nnt-btn:hover { border-color: var(--accent); color: var(--accent); }
.nnt-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent, #fff); }
.nnt-primary:hover { color: var(--on-accent, #fff); filter: brightness(1.08); }
.nnt-danger { color: var(--red); }
.nnt-danger:hover { border-color: var(--red); color: var(--red); }
.nnt-conflict, .nnt-hint { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 9px 12px; border-radius: 8px; font-size: 13px; }
.nnt-conflict { border: 1px solid var(--red); color: var(--text); }
.nnt-conflict span { flex: 1 1 200px; }
.nnt-hint { border: 1px solid var(--border); color: var(--text2); }
.nnt-hint span { flex: 1 1 auto; }
.nnt-title { font: inherit; font-size: 24px; font-weight: 700; border: 0; outline: 0; background: none; color: var(--text); padding: 14px 0 2px; width: 100%; }
.nnt-meta { font-size: 12px; color: var(--text3); padding-bottom: 8px; }
.nnt-tools { position: sticky; top: 53px; z-index: 1; display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  padding: 6px 0; background: var(--bg-elev, var(--bg, #111)); border-bottom: 1px solid var(--border); }
.nnt-tools.off .nnt-tool { opacity: .35; pointer-events: none; }
.nnt-tool { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border: 0; border-radius: 6px; background: none; cursor: pointer; color: var(--text2); }
.nnt-tool:hover { background: var(--surface-2, rgba(127, 127, 127, .1)); color: var(--text); }
.nnt-tool.on { background: var(--accent-wash, rgba(255, 122, 60, .16)); color: var(--accent); }
.nnt-tool[disabled] { opacity: .35; cursor: default; }
.nnt-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.nnt-lang { font: inherit; font-size: 12px; color: var(--text); background: var(--surface-1); border: 1px solid var(--border); border-radius: 6px; padding: 3px 6px; margin-left: 6px; }
.nnt-body { padding-top: 10px; flex: 1 1 auto; }
.nnt-src { width: 100%; min-height: 240px; resize: vertical; font-family: var(--mono); font-size: 13.5px; line-height: 1.55;
  color: var(--text); background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 12px; }

/* lock screen */
.nnt-lockscreen { margin: 40px auto; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; max-width: 360px; }
.nnt-lockscreen > svg { width: 44px; height: 44px; color: var(--accent); }
.nnt-lockscreen h3 { margin: 0; }
.nnt-lockscreen p { margin: 0; color: var(--text3); }
.nnt-unlock { display: flex; gap: 8px; width: 100%; }
.nnt-unlock input { flex: 1 1 auto; min-width: 0; font: inherit; color: var(--text); background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.nnt-unlock-err { min-height: 1.2em; color: var(--red); font-size: 13px; }

/* modal + toast (body level, outside .nnt) */
.nnt-modal { position: fixed; inset: 0; z-index: 1000; background: rgba(0, 0, 0, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.nnt-modal [hidden] { display: none !important; }
.nnt-modal-card { width: min(420px, 100%); background: var(--bg-elev, var(--bg, #1b1b25)); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-3, 0 10px 40px rgba(0, 0, 0, .4)); }
.nnt-modal-card h3 { margin: 0; font-size: 17px; }
.nnt-modal-note { margin: 0; color: var(--text2); font-size: 13.5px; line-height: 1.5; }
.nnt-field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text2); }
.nnt-field input { font: inherit; color: var(--text); background: var(--surface-1); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.nnt-icons { display: flex; flex-wrap: wrap; gap: 4px; }
.nnt-icopick { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 8px; background: none; color: var(--text2); cursor: pointer; }
.nnt-icopick.on { border-color: var(--accent); color: var(--accent); }
.nnt-icopick svg { width: 16px; height: 16px; }
.nnt-modal-err { color: var(--red); font-size: 13px; min-height: 1em; }
.nnt-modal-btns { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.nnt-modal-btns button { font: inherit; }
.nnt-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 1001; background: var(--bg-elev, #222); color: var(--text, #fff);
  border: 1px solid var(--border); border-radius: 10px; padding: 9px 14px; box-shadow: var(--shadow-2, 0 6px 20px rgba(0, 0, 0, .3)); }
.nnt-toast.bad { border-color: var(--red); }

/* Lexical surface (also used by the mobile app's editor page) */
.lx-root { outline: 0; min-height: 260px; line-height: 1.6; font-size: 15px; color: var(--text); word-wrap: break-word; position: relative; }
.lx-root.lx-empty::before { content: attr(data-placeholder); color: var(--text3); position: absolute; top: 0; left: 0; pointer-events: none; }
.lx-p { margin: 0 0 6px; }
.lx-h1 { font-size: 1.6em; margin: 16px 0 8px; }
.lx-h2 { font-size: 1.35em; margin: 14px 0 6px; }
.lx-h3 { font-size: 1.15em; margin: 12px 0 6px; }
.lx-h4, .lx-h5, .lx-h6 { font-size: 1em; margin: 10px 0 4px; }
.lx-quote { margin: 8px 0; padding: 2px 12px; border-left: 3px solid var(--accent); color: var(--text2); }
.lx-b { font-weight: 700; }
.lx-i { font-style: italic; }
.lx-s { text-decoration: line-through; }
.lx-u { text-decoration: underline; }
.lx-b.lx-s, .lx-i.lx-s { text-decoration: line-through; }
.lx-icode { font-family: var(--mono); font-size: .9em; background: var(--surface-2, rgba(127, 127, 127, .14)); padding: 1px 5px; border-radius: 5px; }
.lx-mark { background: rgba(255, 214, 10, .35); color: inherit; border-radius: 3px; }
.lx-link { color: var(--accent); text-decoration: underline; cursor: pointer; }
.lx-ul, .lx-ol { margin: 4px 0 8px; padding-left: 24px; }
.lx-li { margin: 2px 0; }
.lx-li-nested { list-style: none; }
.lx-li-checked, .lx-li-unchecked { position: relative; list-style: none; padding-left: 26px; margin-left: -24px; outline: none; }
.lx-li-checked { color: var(--text3); text-decoration: line-through; }
.lx-li-checked::before, .lx-li-unchecked::before { content: ""; position: absolute; left: 2px; top: .3em; width: 15px; height: 15px;
  border: 1.5px solid var(--text3); border-radius: 50%; cursor: pointer; box-sizing: border-box; }
.lx-li-checked::before { background: var(--accent); border-color: var(--accent); }
.lx-li-checked::after { content: ""; position: absolute; left: 7px; top: calc(.3em + 3px); width: 4px; height: 7px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.lx-code { display: block; font-family: var(--mono); font-size: 13.5px; line-height: 1.55; white-space: pre; overflow-x: auto; tab-size: 2;
  margin: 8px 0; padding: 12px 14px; border-radius: 10px; background: var(--code-bg, rgba(0, 0, 0, .28)); border: 1px solid var(--border); }
:root[data-theme="light"] .lx-code { background: var(--code-bg, rgba(60, 42, 24, .05)); }
.lxt-c { color: var(--tok-c); font-style: italic; }
.lxt-s { color: var(--tok-s); }
.lxt-n { color: var(--tok-n); }
.lxt-k { color: var(--tok-k); font-weight: 600; }
.lxt-t { color: var(--tok-t); }
.lxt-a { color: var(--tok-a); }
.lxt-f { color: var(--tok-t); }
.lxt-o { color: var(--text2); }

/* phone / narrow: one pane at a time */
/* wide screens: the search box lives above the note list only */
@media (min-width: 861px) { .nnt-cats .nnt-search { display: none; } }
@media (max-width: 860px) {
  .nnt-cats-top .nnt-new-top { display: inline-flex; }
  .nnt[data-pane="cats"] .nnt-cats { display: flex; }
  .nnt { display: block; height: calc(100dvh - var(--topbar-h, 52px) - 24px); border-radius: 10px; }
  .nnt > section, .nnt > aside { display: none; height: 100%; border-right: 0; }
  .nnt[data-pane="list"] .nnt-list { display: flex; }
  .nnt[data-pane="editor"] .nnt-editor { display: flex; padding: 0 12px 24px; }
  .nnt-back-cats, .nnt-back { display: inline-flex; }
  .nnt-ed-head { flex-wrap: nowrap; gap: 0; }
  .nnt-ed-head .nnt-icon { width: 34px; flex: 0 0 auto; }
  .nnt-catsel { flex: 1 1 auto; min-width: 0; max-width: none; margin-right: 4px; }
  .nnt-grow { display: none; }
  .nnt-status { position: absolute; right: 0; bottom: -2px; margin: 0; font-size: 11px; }
  .nnt-ed-head { position: sticky; }
  .nnt-title { font-size: 21px; }
  .nnt-tools { top: 49px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nnt-tools::-webkit-scrollbar { display: none; }
  .nnt-tool { width: 34px; height: 34px; flex: 0 0 auto; }
  .nnt-cat, .nnt-item { padding-top: 10px; padding-bottom: 10px; }
}
