:root[data-theme=dark] {
  color-scheme: dark;
  --bg: #211b2e; --card: #2a2239; --ink: #faf3ff; --soft: #cabddc; --line: #483b58;
  --line-strong: #5a4b70; --bg-input: var(--card); --acc: #c8b3ff; --acc-d: #7d68c3;
  --lilac: #473866; --tint: #36294e; --tint-2: #47386a;
}
:root[data-theme=dark] .btn-primary { background: #6244c2; }
:root[data-theme=dark] :is(input[type=text],input[type=search]):focus { background: var(--card); }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.app { height: 100dvh; }
.doc-open { width: 100%; }
.doc-open .doc-meta { text-align: left; }
.doc-excerpt { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; max-width: 100%; }
.doc-meta { overflow-wrap: anywhere; }
.doc[data-color=rose] { border-inline-start: 4px solid #efb4c6; }
.doc[data-color=lilac] { border-inline-start: 4px solid #cebef2; }
.doc[data-color=blue] { border-inline-start: 4px solid #a9d2ee; }
.doc[data-color=mint] { border-inline-start: 4px solid #a8dcca; }
.doc[data-color=gold] { border-inline-start: 4px solid #edd596; }
.ed-bar .ed-title { width: auto; }
.ed-bar .back-button { display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; }
.ed-bar .ed-status { max-width: 35ch; overflow: hidden; text-overflow: ellipsis; }
#file-menu summary { list-style: none; cursor: pointer; }
#file-menu summary::-webkit-details-marker { display: none; }
#note-actions { display: grid; }
#file-menu .menu { z-index: 20; }
.presence { margin: 4px 24px; color: var(--soft); font-size: 13px; overflow-wrap: anywhere; }
.tools .color-label { margin-inline-start: auto; color: var(--soft); }
#add-tools { position: relative; z-index: 3; }
.tools .color-label { display: flex; align-items: center; gap: 5px; }
.tools .nk-select { min-width: 106px; }
.tools .nk-select > .nk-pop { min-width: 130px; }
#list-bar .nk-select { width: min(230px, 30vw); }
.sketch-tools .nk-select { min-width: 110px; }
.result .nk-select { flex: 0 1 11rem; min-width: 0; }
.jot-panel .nk-pop { z-index: 4; }
.jot-workspace {
  display: grid; grid-template-columns: minmax(0,1fr);
  flex: 1; min-height: 0;
}
.jot-workspace:has(.jot-panel:not([hidden])) { grid-template-columns: minmax(0,1fr) min(34%,380px); }
.jot-workspace .sheet-wrap { min-width: 0; }
#note-sheet {
  padding-inline: clamp(24px, 8vw, 96px);
  background: #fff; border-radius: 6px;
  box-shadow: 0 2px 0 var(--line), 0 12px 30px #221b3a12;
}
#note-sheet[data-color=rose] { background: #fff3f7; }
#note-sheet[data-color=lilac] { background: #f9f4ff; }
#note-sheet[data-color=blue] { background: #f2faff; }
#note-sheet[data-color=mint] { background: #f5fcf8; }
#note-sheet[data-color=gold] { background: #fffaed; }
#note-sheet {
  min-height: 65dvh; padding-block: clamp(24px, 5vw, 56px);
}
#jot-text {
  min-height: 50dvh; white-space: pre-wrap; overflow-wrap: anywhere;
  cursor: text; outline: none; caret-color: #5632cc;
}
#jot-text { position: relative; }
#jot-text:has(> .jot-flow-line[data-style="p"]:only-child > br:only-child)::before {
  position: absolute;
  inset-inline-start: 0;
  content: attr(data-placeholder);
  color: #706783;
  pointer-events: none;
}
.jot-flow-line { min-height: 1.5em; }
.jot-flow-line[data-style="bullet"] { display: list-item; margin-inline-start: 1.45em; list-style-type: disc; }
.jot-flow-line[data-style^="h"] { margin-block: .45em .2em; font-weight: 650; line-height: 1.25; min-height: 1.25em; }
.jot-flow-line[data-style="h1"] { font-size: 2em; }
.jot-flow-line[data-style="h2"] { font-size: 1.6em; }
.jot-flow-line[data-style="h3"] { font-size: 1.35em; }
.jot-flow-line[data-style="h4"] { font-size: 1.2em; }
.jot-flow-line[data-style="h5"] { font-size: 1.1em; }
.jot-flow-line[data-style="h6"] { font-size: 1em; }
#jot-paragraph-style + .nk-select { width: 144px; }
#note-sheet:has(#sketch-panel:not([hidden])) #jot-text { min-height: 7em; }
#note-sheet :is(a.inline-ref,.jot-flow-menu a) { color: #145ac1; text-decoration: underline; text-underline-offset: .15em; }
#note-sheet .inline-ref.unavailable { color: #665a79; }
.flow-atom { user-select: all; }
.inline-task { display: inline-flex; align-items: baseline; flex-wrap: wrap; max-width: 100%; gap: .32rem; vertical-align: baseline; }
.inline-task input { accent-color: #6c4dff; margin: 0; align-self: center; }
.inline-task-title { border: 0; background: none; padding: 0; color: inherit; text-align: start; overflow-wrap: anywhere; min-width: 0; }
.inline-task-title:hover:not(:disabled) { text-decoration: underline; }
.inline-task[data-done=true] .inline-task-title { text-decoration: line-through; color: #665a79; }
.inline-due { color: #665a79; font-size: .75em; }
.markdown-preview { overflow-wrap: anywhere; min-height: 2rem; }
.markdown-preview > :first-child { margin-top: 0; }
.markdown-preview > :last-child { margin-bottom: 0; }
.markdown-preview pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.markdown-preview table { width: 100%; border-collapse: collapse; }
.markdown-preview :is(th,td) { border: 1px solid #eae2df; padding: 5px 8px; }
.jot-flow-menu {
  position: fixed; z-index: 20; display: grid; min-width: min(250px,calc(100vw - 16px));
  max-width: calc(100vw - 16px); max-height: 15rem; overflow: auto; padding: 6px 10px;
  background: #fff; border: 1px solid #e8ded6; border-radius: 12px; box-shadow: 0 7px 22px #221b3a24;
}
.jot-flow-menu a { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 4px; font-size: .88rem; }
.jot-flow-menu small { color: #665a79; }
.jot-flow-menu a[aria-selected=true] { background: #f0f5ff; border-radius: 4px; }
.editor-section { margin-top: 20px; padding-top: 14px; border-top: 1px solid #eae2df; }
.editor-section h2 { font-size: 18px; margin: 0 0 12px; }
.sheet :is(input, select) { color: #221b3a; background: #fff; }
.sheet .btn { color: #221b3a; }
.sketch-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
#canvas {
  width: 100%; height: auto; display: block; border: 1px solid #eae2df;
  border-radius: 9px; background: #fff; touch-action: none;
}
.jot-panel {
  min-width: 0; min-height: 0; overflow: auto; margin: 12px 18px 14px 0;
  border: 1px solid var(--line); border-radius: 22px; background: var(--card);
}
.jot-panel header {
  position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px; background: var(--card); border-bottom: 1px solid var(--line);
}
.jot-panel h2 { margin: 0; font: 20px/1.15 var(--font-display); }
#panel-content { padding: 12px; }
.panel-search,.results { display: grid; gap: 8px; margin-bottom: 8px; }
.panel-search input { min-width: 0; }
.result {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between;
  border: 1px solid var(--line); padding: 8px; border-radius: 12px;
}
.result > :first-child { min-width: 0; overflow-wrap: anywhere; }
.result small { display: block; color: var(--soft); }
.result[aria-selected=true] { border-color: var(--acc); background: var(--tint); }
.mail-choices { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.mail-choices .btn { display: inline-block; }
.preview-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.quiet-text { color: var(--soft); font-size: 13px; }
@media (max-width: 800px) {
  #editor .ed-bar { display: grid; grid-template-columns: 40px minmax(0,1fr) auto auto; }
  #editor .ed-title { grid-area: 1 / 2 / 2 / 5; width: 100%; }
  #editor .ed-status { grid-area: 2 / 1 / 3 / 3; min-width: 0; }
  #share { grid-area: 2 / 3; }
  #editor #file-menu { grid-area: 2 / 4; }
  #list-bar .search,#list-bar .sort,#list-bar .nk-select { max-width: none; min-width: 0; }
  #list-bar .nk-select { flex: 1 1 136px; }
  .jot-workspace:has(.jot-panel:not([hidden])) { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  .jot-panel { grid-row: 1; max-height: 43dvh; margin: 8px 10px; border-radius: 16px; }
  #note-sheet { padding-inline: 20px; border-radius: 10px; }
  .presence { margin-inline: 10px; }
}
