:root {
  font-family:
    Inter,
    ui-sans-serif,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: #263249;
  background: #fff;
  font-synthesis: none;
  --muted: #8590a2;
  --line: #e9edf2;
  --accent: #5865d8;
  --soft: #eef0fd;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button {
  cursor: pointer;
}
button,
a,
input,
textarea,
select {
  outline-offset: 4px;
}
button {
  background: none;
  border: 0;
  color: inherit;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
a {
  color: var(--accent);
}
button:hover {
  background: #eef0f5;
}
input,
select,
textarea {
  border: 1px solid #dde2eb;
  border-radius: 8px;
  padding: 11px 12px;
  color: inherit;
  background: #fff;
}
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #c6ccff;
  border-color: #8792ec;
}
input::placeholder,
textarea::placeholder {
  color: #9aa3b2;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
.app-shell {
  display: grid;
  grid-template-columns: 246px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #f7f8fa;
  border-right: 1px solid var(--line);
  position: fixed;
  inset: 0 auto 0 0;
  width: 246px;
  padding: 27px 17px 16px;
  display: flex;
  flex-direction: column;
  z-index: 10;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 23px;
  letter-spacing: -1px;
  font-weight: 700;
  padding: 0 12px 20px;
}
.brand-mark {
  color: var(--accent);
  font-size: 35px;
  font-weight: 400;
  line-height: 1;
}
.workspace-switch {
  position: relative;
  margin-bottom: 14px;
}
.workspace-button,
.workspace-menu {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  box-shadow: 0 2px 3px #24324a03;
}
.workspace-button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 10px 10px;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
}
.workspace-button:hover,
.workspace-button[aria-expanded="true"] {
  background: white;
  border-color: #cfd5e2;
}
.workspace-button svg {
  width: 16px;
  height: 16px;
  margin-left: auto;
  flex: none;
  color: var(--muted);
  transition: transform 0.15s;
}
.workspace-button[aria-expanded="true"] svg {
  transform: rotate(180deg);
}
.workspace-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-menu {
  position: absolute;
  inset: calc(100% + 6px) 0 auto;
  z-index: 30;
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(560px, 75vh);
  overflow-y: auto;
  padding: 6px;
  box-shadow: 0 12px 28px #1b23381f;
}
.workspace-menu[hidden] {
  display: none;
}
.workspace-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 6px;
  border-radius: 7px;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
}
.workspace-menu button[aria-checked="true"] {
  font-weight: 600;
}
.workspace-menu button:focus-visible {
  outline: 2px solid #c6ccff;
  outline-offset: 0;
}
.workspace-menu button > svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--accent);
}
.workspace-menu .square {
  width: 26px;
  height: 26px;
  font-size: 12px;
}
.workspace-menu .square.new svg {
  width: 14px;
  height: 14px;
}
.menu-separator {
  height: 1px;
  margin: 4px 2px;
  background: var(--line);
}
.square {
  width: 30px;
  height: 30px;
  border-radius: 7px;
  background: #e8eafb;
  color: #626bc4;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.nav button,
.folder-button {
  display: flex;
  align-items: center;
  text-align: left;
  gap: 11px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  color: #68758a;
}
.nav button.active,
.folder-button.active {
  background: #e9ecfb;
  color: #5360cd;
  font-weight: 600;
}
.nav svg,
.folder-button svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}
.shortcut {
  margin-left: auto;
  font-size: 10px;
  color: #949baa;
  background: #eceef3;
  border: 1px solid #e1e5eb;
  padding: 2px 4px;
  border-radius: 4px;
}
.section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 29px 12px 10px;
  font-size: 10px;
  font-weight: 700;
  color: #98a0ad;
  letter-spacing: 1.5px;
}
.section-label button {
  font-size: 20px;
  line-height: 20px;
  color: #7e899c;
}
.folder-button {
  padding-left: 13px;
}
.folder-button .count {
  margin-left: auto;
  font-size: 11px;
  color: #9aa3b2;
}
.folder-list {
  overflow-y: auto;
  max-height: 35vh;
}
.sidebar-bottom {
  margin-top: auto;
  padding-top: 25px;
}
.server-status {
  margin: 20px 11px 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid #e5e9ef;
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: #8390a1;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #5db394;
}
.server-status span:last-child {
  margin-left: auto;
  font-size: 10px;
}
.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
}
.avatar {
  background: #e9decd;
  color: #8c7453;
  border-radius: 50%;
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.profile-name {
  font-size: 12px;
  font-weight: 600;
}
.profile-role {
  font-size: 10px;
  color: #99a2b0;
  margin-top: 3px;
}
.profile button {
  margin-left: auto;
  padding: 5px;
}
.main {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  height: 72px;
  border-bottom: 1px solid var(--line);
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: #8893a3;
}
.crumb {
  display: flex;
  align-items: center;
  gap: 12px;
}
.crumb strong {
  font-weight: 500;
  color: #4d5b70;
}
.top-actions {
  display: flex;
  gap: 16px;
  align-items: center;
}
.top-actions svg {
  width: 17px;
  height: 17px;
}
.badge {
  font-size: 10px;
  background: #f6f7fa;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 7px;
  letter-spacing: 0.3px;
}
.page {
  max-width: 1370px;
  margin: 0 auto;
  padding: 43px 50px;
}
.eyebrow {
  color: #8a93a2;
  font-size: 10px;
  letter-spacing: 2px;
  font-weight: 600;
  margin-bottom: 12px;
}
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 30px;
}
.page-heading h1 {
  font-size: 30px;
  letter-spacing: -1.1px;
  font-weight: 650;
  margin: 0 0 9px;
}
.subtitle {
  font-size: 13px;
  color: #8a94a4;
  margin: 0;
  line-height: 1.6;
}
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid #e1e5ed;
  background: white;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.btn svg {
  width: 15px;
  height: 15px;
}
.btn.primary {
  background: #5e69d6;
  border-color: #5e69d6;
  color: white;
  box-shadow: 0 3px 5px #5865d81a;
}
.btn.primary:hover {
  background: #4d59c3;
}
.btn.danger {
  color: #bf5261;
}
.welcome-banner {
  position: relative;
  overflow: hidden;
  background: #f2f3fc;
  border: 1px solid #e8eaf7;
  border-radius: 12px;
  padding: 29px 32px;
  margin-bottom: 35px;
  min-height: 182px;
  display: flex;
  align-items: center;
}
.welcome-copy {
  position: relative;
  z-index: 1;
  max-width: 64%;
}
.welcome-copy .eyebrow {
  color: #7b80b4;
  margin-bottom: 10px;
  font-size: 9px;
}
.welcome-copy h2 {
  font-size: 22px;
  letter-spacing: -0.5px;
  font-weight: 600;
  margin: 0 0 10px;
}
.welcome-copy p {
  font-size: 12px;
  color: #8186a2;
  line-height: 1.7;
  margin-bottom: 16px;
}
.text-link {
  font-size: 11px;
  padding: 0;
  color: #626bc2;
  font-weight: 600;
}
.banner-art {
  position: absolute;
  right: 58px;
  top: 20px;
  width: 200px;
  height: 150px;
}
.art-sheet {
  position: absolute;
  left: 38px;
  top: 10px;
  width: 107px;
  height: 130px;
  background: #fff;
  border-radius: 7px;
  transform: rotate(-13deg);
  box-shadow: 0 10px 35px #717ba21a;
  border: 1px solid #e7e9f6;
  padding: 25px 17px;
}
.art-sheet::before {
  content: "✳";
  color: #9a9fdd;
  font-size: 28px;
}
.art-sheet i {
  display: block;
  height: 4px;
  background: #e9eaf7;
  margin: 8px 0;
  border-radius: 4px;
}
.art-sheet i:last-child {
  width: 70%;
}
.art-sticky {
  position: absolute;
  width: 70px;
  height: 67px;
  right: 0;
  bottom: 6px;
  background: #f7e7b8;
  transform: rotate(12deg);
  border-radius: 5px;
  box-shadow: 0 8px 22px #717ba21a;
  display: grid;
  place-items: center;
  color: #bc9d49;
  font-size: 27px;
}
.art-star {
  position: absolute;
  right: 7px;
  top: 0;
  color: #b1b8e9;
  font-size: 28px;
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 17px;
}
.section-title h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.section-title span {
  color: #98a1b0;
  font-size: 11px;
}
.folder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 34px;
}
.folder-card {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 18px;
  text-align: left;
  background: white;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  display: flex;
  gap: 13px;
  align-items: center;
}
.folder-card:hover {
  transform: translateY(-2px);
  background: white;
  box-shadow: 0 5px 20px #25365008;
}
.folder-icon {
  background: #f2f0fc;
  border-radius: 8px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: #a194cc;
}
.folder-icon svg {
  width: 21px;
  height: 21px;
}
.folder-card:nth-child(3n + 2) .folder-icon {
  background: #eef5f2;
  color: #87aa9b;
}
.folder-card:nth-child(3n) .folder-icon {
  background: #fcf4e9;
  color: #c2a477;
}
.folder-card strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
}
.folder-card small {
  font-size: 10px;
  color: #97a1b0;
}
.notes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 20px;
}
.tabs {
  display: flex;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}
.tabs button {
  padding: 11px 0;
  font-size: 12px;
  color: #939cab;
  border-bottom: 2px solid transparent;
}
.tabs .active {
  color: #5966cf;
  border-color: #6874d7;
}
.view-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px;
  gap: 3px;
}
.view-toggle button {
  display: grid;
  place-items: center;
  border-radius: 4px;
  padding: 5px;
  color: #98a1af;
}
.view-toggle .active {
  background: #f0f2f7;
  color: #69768a;
}
.view-toggle svg {
  width: 14px;
  height: 14px;
}
.note-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 17px;
}
.note-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  overflow: hidden;
  cursor: pointer;
  transition:
    box-shadow 0.2s,
    transform 0.2s;
  text-align: left;
  padding: 0;
}
.note-card:hover {
  background: white;
  box-shadow: 0 8px 25px #29375109;
  transform: translateY(-2px);
}
.note-preview {
  height: 126px;
  background: #fafafc;
  padding: 22px 24px;
  border-bottom: 1px solid #eff1f5;
  position: relative;
  overflow: hidden;
}
.note-card:nth-child(3n + 2) .note-preview {
  background: #f8faf9;
}
.note-card:nth-child(3n) .note-preview {
  background: #fcfaf7;
}
.preview-symbol {
  font-family: Georgia, serif;
  font-size: 35px;
  color: #a8afc9;
}
.preview-lines {
  margin-top: 11px;
}
.preview-lines i {
  display: block;
  height: 4px;
  background: #e9ecf3;
  border-radius: 2px;
  margin-bottom: 7px;
  width: 83%;
}
.preview-lines i:nth-child(2) {
  width: 63%;
}
.preview-lines i:nth-child(3) {
  width: 74%;
}
.note-info {
  padding: 18px 18px 16px;
}
.note-info strong {
  font-size: 13px;
  font-weight: 600;
  display: block;
  margin-bottom: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9aa3b1;
  font-size: 10px;
}
.note-meta svg {
  width: 12px;
  height: 12px;
}
.note-meta .star {
  margin-left: auto;
  color: #c1a36d;
}
.note-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.note-list .note-card {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  display: flex;
  align-items: center;
}
.note-list .note-preview {
  height: 65px;
  width: 70px;
  flex-shrink: 0;
  padding: 13px 22px;
  border: 0;
  background: #fff;
}
.note-list .preview-symbol {
  font-size: 25px;
}
.note-list .preview-lines {
  display: none;
}
.note-list .note-info {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.note-list .note-info strong {
  margin: 0;
}
.note-list .note-meta {
  gap: 15px;
}
.empty {
  padding: 55px 20px;
  text-align: center;
  border: 1px dashed #dce1ed;
  border-radius: 10px;
  color: #939caf;
  font-size: 13px;
}
.empty h3 {
  color: #5c6a80;
  font-weight: 500;
  margin: 14px 0 10px;
}
.empty svg {
  width: 30px;
  height: 30px;
  color: #a6afc2;
}
.page-footer {
  text-align: center;
  font-size: 10px;
  color: #b0b7c3;
  margin-top: 40px;
  letter-spacing: 0.2px;
}
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #ffffffed;
  z-index: 5;
  backdrop-filter: blur(10px);
}
.editor-toolbar .spacer {
  flex: 1;
}
.editor-toolbar .btn {
  font-size: 11px;
  padding: 8px 11px;
}
.save-status {
  font-size: 10px;
  color: #8a97a4;
  margin-left: 7px;
}
.document {
  max-width: 820px;
  margin: 0 auto;
  padding: 52px 50px 120px;
}
.doc-icon {
  font-size: 42px;
  margin-bottom: 22px;
  display: inline-block;
}
.doc-title {
  font-size: 36px;
  letter-spacing: -1px;
  font-weight: 700;
  border: 0;
  padding: 0;
  width: 100%;
  margin-bottom: 16px;
  background: transparent;
}
.doc-meta {
  display: flex;
  gap: 18px;
  color: #98a1af;
  font-size: 11px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 27px;
}
.block {
  position: relative;
  padding: 3px 0;
  min-height: 30px;
  border-radius: 4px;
  line-height: 1.8;
  font-size: 14px;
}
.block-body {
  min-height: 29px;
  cursor: text;
  overflow-wrap: anywhere;
  padding: 2px 7px;
}
.block p {
  margin: 0 0 5px;
}
.block h1 {
  font-size: 28px;
  margin: 15px 0 10px;
}
.block h2 {
  font-size: 22px;
  font-weight: 600;
  margin: 16px 0 10px;
  letter-spacing: -0.4px;
}
.block h3 {
  font-size: 18px;
  margin: 10px 0;
}
.block blockquote {
  margin: 10px 0;
  padding: 12px 17px;
  border-left: 3px solid #b3b9e9;
  background: #f5f6fc;
  color: #7d85a4;
}
.block ul,
.block ol {
  margin: 0;
  padding-left: 23px;
}
.block pre {
  padding: 15px;
  background: #f2f4f8;
  border-radius: 7px;
  overflow: auto;
}
.block code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
  background: #f0f2f7;
  padding: 2px 4px;
  border-radius: 4px;
}
.block hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 20px 0;
}
.block table {
  border-collapse: collapse;
  width: 100%;
}
.block td,
.block th {
  border: 1px solid #ddd;
  padding: 8px;
}
.block img {
  max-width: 100%;
}
.block textarea {
  width: 100%;
  resize: vertical;
  min-height: 42px;
  line-height: 1.8;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  padding: 7px;
}
/* The block being edited looks like the text around it: no box, only the cursor
   and a faint line on its left. */
#blocks .block textarea,
#blocks .block textarea:focus {
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
  resize: none;
  min-height: 0;
  overflow: hidden;
  font: inherit;
  color: inherit;
  padding: 2px 7px;
}
/* Blocks read as one page: the handle shows only on hover, never while text is
   selected, and is never part of a selection. */
.block-controls {
  position: absolute;
  right: 100%;
  top: 5px;
  display: flex;
  padding-right: 4px;
  opacity: 0;
  pointer-events: none;
  user-select: none;
  transition: opacity 0.12s;
}
.block:hover .block-controls,
.block-controls:focus-within {
  opacity: 1;
  pointer-events: auto;
}
body.selecting-text .block-controls,
body.dragging-block .block-controls {
  opacity: 0;
  pointer-events: none;
}
.block-controls button {
  padding: 2px 3px;
  color: #b1b8c3;
  font-size: 13px;
  border-radius: 4px;
  background: transparent;
}
.block-controls button:hover {
  color: #5b6475;
}
.block-handle {
  cursor: grab;
  touch-action: none;
}
body.dragging-block,
body.dragging-block * {
  cursor: grabbing !important;
  user-select: none;
}
.block.dragging {
  opacity: 0.4;
}
.block-drop-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent, #5b63d3);
  border-radius: 1px;
  pointer-events: none;
}
#blocks {
  position: relative;
}
.block-placeholder {
  color: #b1b8c3;
  font-size: 13px;
}
/* Collaborators: a name tag left of the block each one is on, solid while they
   edit it and outlined while they read. A block someone else edits shows their
   colour on its left edge and cannot be opened. */
.peer-layer {
  position: absolute;
  inset: 0 auto auto 0;
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 3;
}
.peer-tag {
  position: absolute;
  transform: translateX(calc(-100% - 40px));
  max-width: 120px;
  padding: 1px 7px;
  border: 1px solid var(--peer);
  border-radius: 5px;
  background: var(--surface, #fff);
  color: var(--peer);
  font-size: 11px;
  font-weight: 600;
  line-height: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition:
    top 0.25s ease,
    left 0.25s ease;
}
.peer-tag.editing {
  background: var(--peer);
  color: #fff;
}
.peer-tag.inside {
  transform: translateX(calc(-100% - 4px));
  opacity: 0.92;
}
.block.peer-editing {
  box-shadow: inset 2px 0 0 var(--peer);
  background: color-mix(in srgb, var(--peer) 5%, transparent);
}
.block.peer-editing .block-body {
  cursor: not-allowed;
}
.presence .peer {
  background: color-mix(in srgb, var(--peer) 12%, transparent);
  color: var(--peer);
}
.add-block {
  color: #9aa3b4;
  font-size: 12px;
  padding: 10px 7px;
  margin-top: 15px;
}
.editor-help {
  color: #adb4c0;
  font-size: 10px;
  margin-top: 23px;
}
.canvas {
  background-color: #fafbfe;
  background-image: radial-gradient(#dbe0eb 1px, transparent 1px);
  background-size: 20px 20px;
  height: calc(100vh - 135px);
  overflow: auto;
  position: relative;
}
.canvas-surface {
  position: relative;
  width: 2200px;
  height: 2200px;
}
.canvas-card {
  position: absolute;
  width: 280px;
  min-height: 100px;
  max-height: 400px;
  overflow: auto;
  background: #fffef3;
  border: 1px solid #e8e4cb;
  border-radius: 9px;
  box-shadow: 0 5px 15px #33333308;
  padding: 0 15px 15px;
  font-size: 13px;
}
.canvas-handle {
  padding: 8px 0;
  margin-bottom: 7px;
  font-size: 10px;
  color: #aaa586;
  cursor: grab;
  border-bottom: 1px solid #eeeada;
  touch-action: none;
}
.canvas-card .block {
  font-size: 13px;
}
.canvas-card .block-controls {
  display: none;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.panel-heading {
  padding: 20px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.panel-heading h2 {
  font-size: 14px;
  margin: 0;
}
.panel p {
  font-size: 12px;
  color: #8b96a7;
  margin: 5px 0 0;
}
.table-wrap {
  overflow: auto;
}
table.admin-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
  text-align: left;
}
.admin-table th {
  font-size: 10px;
  font-weight: 500;
  color: #9aa3b0;
  background: #fafbfc;
  padding: 12px 22px;
}
.admin-table td {
  padding: 16px 22px;
  border-top: 1px solid var(--line);
}
.admin-table td small {
  display: block;
  color: #98a1af;
  margin-top: 5px;
}
.admin-table select {
  font-size: 11px;
  padding: 7px;
}
.pill {
  border-radius: 4px;
  padding: 4px 7px;
  background: #edf5f0;
  color: #74a18b;
  font-size: 10px;
}
.permission-form {
  padding: 22px;
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 11px;
  font-weight: 500;
  color: #6c788a;
}
.permission-form label {
  flex: 1;
  min-width: 150px;
}
.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-art {
  background: #eef0fb;
  padding: 65px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}
.login-art .brand {
  position: absolute;
  left: 50px;
  top: 40px;
}
.login-art h1 {
  font-size: 52px;
  line-height: 1.15;
  letter-spacing: -2px;
  max-width: 450px;
  font-weight: 600;
}
.login-art p {
  color: #858da9;
  line-height: 1.8;
  max-width: 350px;
  font-size: 14px;
}
.login-art .banner-art {
  position: relative;
  top: auto;
  right: auto;
  margin-top: 35px;
  margin-left: 40px;
  transform: scale(1.3);
}
.login-main {
  display: grid;
  place-items: center;
  padding: 30px;
}
.login-form {
  width: 100%;
  max-width: 340px;
}
.login-form h2 {
  font-size: 26px;
  letter-spacing: -0.7px;
  margin-bottom: 10px;
}
.login-form p {
  font-size: 12px;
  color: #939cac;
  line-height: 1.7;
  margin-bottom: 30px;
}
.login-form label {
  margin-bottom: 18px;
}
.login-form .btn {
  width: 100%;
  padding: 13px;
}
.form-error {
  font-size: 12px;
  color: #b75363;
  line-height: 1.5;
  min-height: 20px;
}
.login-form .footnote {
  font-size: 10px;
  margin-top: 25px;
  text-align: center;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px;
  width: min(480px, 92vw);
  box-shadow: 0 24px 100px #27355230;
  color: #344057;
}
dialog::backdrop {
  background: #1d284b50;
  backdrop-filter: blur(3px);
}
dialog h2 {
  font-size: 20px;
  margin: 0 0 8px;
}
dialog p {
  font-size: 12px;
  color: #8e98a8;
  line-height: 1.6;
  margin-bottom: 23px;
}
dialog label {
  margin-bottom: 15px;
}
dialog footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 24px;
}
.search-results {
  max-height: 50vh;
  overflow: auto;
  margin-top: 14px;
}
.search-result {
  display: flex;
  gap: 10px;
  padding: 14px 10px;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.search-result small {
  color: #9aa4b3;
  margin-left: auto;
}
.history-row {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #34415b;
  color: white;
  padding: 13px 20px;
  border-radius: 9px;
  font-size: 12px;
  box-shadow: 0 4px 25px #28314b20;
  z-index: 100;
  transition: transform 0.2s;
  max-width: 90vw;
}
#toast.visible {
  transform: translateX(-50%) translateY(0);
}
.loading {
  height: 100vh;
  display: flex;
  gap: 15px;
  align-items: center;
  justify-content: center;
  color: #6875cf;
  font-size: 30px;
}
.loading span {
  font-size: 13px;
  color: #8c96a9;
}
.mobile-menu {
  display: none;
}
.toolbar-group {
  display: flex;
  gap: 5px;
}
.toolbar-group .selected {
  background: #eeeffb;
  color: #6370cb;
}
.checkbox-label {
  flex-direction: row;
  align-items: center;
}
input[type="checkbox"] {
  accent-color: #6874d5;
}
.sr-only {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
@media (min-width: 1500px) {
  .page {
    padding-top: 55px;
  }
  .note-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
@media (max-width: 1100px) {
  .page {
    padding: 32px;
  }
  .note-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .folder-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .banner-art {
    right: 18px;
    transform: scale(0.85);
  }
  .topbar {
    padding: 0 30px;
  }
  .editor-toolbar {
    padding: 12px 20px;
    flex-wrap: wrap;
  }
  .save-status {
    display: none;
  }
}
@media (max-width: 760px) {
  .app-shell {
    display: block;
  }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s;
    box-shadow: 10px 0 40px #26324915;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .mobile-menu {
    display: block;
  }
  .topbar {
    height: 60px;
    padding: 0 18px;
  }
  .top-actions .badge {
    display: none;
  }
  .page {
    padding: 28px 20px;
  }
  .page-heading {
    align-items: flex-start;
  }
  .page-heading h1 {
    font-size: 25px;
  }
  .page-heading .btn {
    padding: 9px;
  }
  .welcome-banner {
    padding: 24px;
  }
  .welcome-copy {
    max-width: 80%;
  }
  .welcome-copy h2 {
    font-size: 20px;
  }
  .banner-art {
    right: -55px;
    opacity: 0.45;
  }
  .folder-grid {
    gap: 10px;
  }
  .folder-card {
    padding: 12px;
    gap: 8px;
  }
  .note-grid {
    gap: 12px;
  }
  .note-info {
    padding: 14px;
  }
  .note-preview {
    height: 105px;
    padding: 15px;
  }
  .document {
    padding: 35px 30px 80px;
  }
  .doc-title {
    font-size: 29px;
  }
  .editor-toolbar {
    gap: 5px;
  }
  .editor-toolbar .btn {
    font-size: 10px;
    padding: 7px;
  }
  .login-shell {
    grid-template-columns: 1fr;
  }
  .login-art {
    display: none;
  }
  .login-main {
    min-height: 100vh;
  }
  .section-title span {
    display: none;
  }
  .note-list .note-meta {
    display: none;
  }
  .admin-table td,
  .admin-table th {
    padding: 12px;
  }
  .folder-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
.task-toggle {
  float: left;
  margin: 3px 6px 0 0;
  color: #7581c9;
  font-size: 20px;
  padding: 0 3px;
  position: relative;
  z-index: 1;
}
.task-toggle + .block-body ul {
  list-style: none;
  padding-left: 25px;
}
.profile svg,
.crumb > svg,
.mobile-menu svg {
  width: 17px;
  height: 17px;
}
/* Theme tokens apply to both new tools and the original workspace. */
:root {
  --surface: #fff;
  --surface-alt: #f7f8fa;
  --ink: #263249;
  --subtle: #748198;
  --border: #e5e9f1;
}
body {
  background: var(--surface);
  color: var(--ink);
}
#theme {
  font-size: 11px;
  padding: 6px 8px;
  border-color: var(--line);
  color: var(--subtle);
  background: var(--surface);
}
.presence {
  display: flex;
  gap: 5px;
  align-items: center;
  max-width: 260px;
  overflow: hidden;
}
.peer {
  padding: 4px 8px;
  background: #e8f3ed;
  color: #478066;
  border-radius: 20px;
  font-size: 10px;
  white-space: nowrap;
}
.presence-label {
  font-size: 10px;
  color: var(--subtle);
}
.db-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 24px 0 18px;
  flex-wrap: wrap;
}
.db-toolbar #db-filter {
  margin-left: auto;
  font-size: 12px;
  min-width: 180px;
}
.db-toolbar label {
  font-size: 11px;
}
.records-table {
  border-collapse: collapse;
  min-width: 100%;
  text-align: left;
  font-size: 12px;
}
.records-table th {
  background: var(--surface-alt);
  border-bottom: 1px solid var(--border);
  font-weight: 500;
  white-space: nowrap;
}
.records-table th button {
  padding: 14px 12px;
  width: 100%;
  text-align: left;
  font-size: 12px;
}
.records-table th small {
  font-size: 9px;
  color: var(--subtle);
  font-weight: 400;
  margin-left: 8px;
}
.records-table td {
  padding: 5px 7px;
  border: 1px solid var(--line);
  min-width: 145px;
}
.records-table td input:not([type="checkbox"]),
.records-table td select {
  border-color: transparent;
  background: transparent;
  border-radius: 4px;
  max-width: 250px;
  width: 100%;
  font-size: 12px;
  padding: 9px 5px;
}
.records-table td:focus-within {
  box-shadow: inset 0 0 0 2px #8d97ed;
}
.records-table input[type="checkbox"] {
  margin: 0 20px;
}
.records-table .saving {
  opacity: 0.5;
}
.records-table .cell-error {
  outline: 2px solid #d66376;
}
.records-table input:disabled,
.records-table select:disabled {
  opacity: 0.8;
  color: var(--ink);
}
.board {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding: 4px 0 20px;
}
.board-column {
  flex: 1;
  min-width: 230px;
  max-width: 360px;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 15px;
}
.board-column h3 {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  color: var(--subtle);
}
.board-column h3 span {
  font-size: 10px;
  border-radius: 6px;
  background: var(--surface);
  padding: 3px 6px;
}
.record-card {
  display: block;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  text-align: left;
  margin: 10px 0;
  box-shadow: 0 2px 5px #00000003;
}
.record-card strong {
  font-size: 13px;
  display: block;
  margin-bottom: 8px;
}
.record-card small {
  display: block;
  font-size: 11px;
  color: var(--subtle);
  margin-top: 7px;
}
.mcp-art {
  font-size: 95px;
  color: #b5b9e3;
  position: absolute;
  right: 60px;
  top: 30px;
}
.integration-tools {
  margin-top: 35px;
}
.integration-tools h2 {
  font-size: 15px;
  margin-bottom: 20px;
}
.integration-tools .folder-card {
  cursor: default;
}
.integration-tools small {
  line-height: 1.7;
}
#mcp-config {
  width: 100%;
  font:
    11px/1.7 ui-monospace,
    monospace;
  resize: vertical;
}
.database-page .page-heading {
  gap: 15px;
}
.database-page .toolbar-group {
  flex-wrap: wrap;
}
[data-theme="dark"] {
  --surface: #181d28;
  --surface-alt: #131823;
  --ink: #e1e6f1;
  --subtle: #9ba7bd;
  --border: #30394b;
  --line: #2c3445;
  --muted: #a6b1c6;
  --accent: #a3adff;
  --soft: #282d4a;
  color: #e1e6f1;
  background: #181d28;
  color-scheme: dark;
}
[data-theme="dark"] .sidebar,
[data-theme="dark"] .login-art {
  background: #131823;
  border-color: var(--line);
}
[data-theme="dark"] .topbar,
[data-theme="dark"] .document,
[data-theme="dark"] .main {
  background: var(--surface);
}
[data-theme="dark"] .editor-toolbar {
  background: #181d28ed;
}
[data-theme="dark"] .workspace-button,
[data-theme="dark"] .workspace-menu,
[data-theme="dark"] .folder-card,
[data-theme="dark"] .note-card,
[data-theme="dark"] .btn,
[data-theme="dark"] dialog,
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
  background: #1d2432;
  border-color: #343e53;
  color: var(--ink);
}
/* The note title reads as a heading, not a form field. */
[data-theme="dark"] .doc-title {
  background: transparent;
  border: 0;
}
[data-theme="dark"] button:hover,
[data-theme="dark"] .record-card:hover {
  background: #293247;
}
[data-theme="dark"] .btn.primary {
  background: #737ce2;
  border-color: #737ce2;
  color: #fff;
}
[data-theme="dark"] .btn.primary:hover {
  background: #858eec;
}
[data-theme="dark"] .nav button,
[data-theme="dark"] .folder-button,
[data-theme="dark"] label,
[data-theme="dark"] .crumb strong {
  color: #b3bed3;
}
[data-theme="dark"] .nav .active,
[data-theme="dark"] .folder-button.active,
[data-theme="dark"] .toolbar-group .selected {
  background: #2a3150;
  color: #bac3ff;
}
[data-theme="dark"] .welcome-banner {
  background: #242a42;
  border-color: #333c5e;
}
[data-theme="dark"] .welcome-copy p,
[data-theme="dark"] .welcome-copy .eyebrow,
[data-theme="dark"] .subtitle,
[data-theme="dark"] .note-meta,
[data-theme="dark"] .folder-card small,
[data-theme="dark"] .doc-meta,
[data-theme="dark"] .save-status,
[data-theme="dark"] .panel p,
[data-theme="dark"] dialog p,
[data-theme="dark"] .login-form p {
  color: #abb6cd;
}
[data-theme="dark"] .note-preview,
[data-theme="dark"] .note-card:nth-child(3n + 2) .note-preview,
[data-theme="dark"] .note-card:nth-child(3n) .note-preview {
  background: #202737;
  border-color: var(--line);
}
[data-theme="dark"] .preview-lines i {
  background: #323c52;
}
[data-theme="dark"] .art-sheet {
  background: #3d4564;
  border-color: #525c80;
}
[data-theme="dark"] .art-sheet i {
  background: #626b92;
}
[data-theme="dark"] .folder-icon,
[data-theme="dark"] .square {
  background: #333455;
  color: #b4b0ee;
}
[data-theme="dark"] .folder-card:nth-child(3n + 2) .folder-icon {
  background: #24403b;
  color: #9ac9b9;
}
[data-theme="dark"] .folder-card:nth-child(3n) .folder-icon {
  background: #443b30;
  color: #d8bf90;
}
[data-theme="dark"] .badge,
[data-theme="dark"] .shortcut,
[data-theme="dark"] .view-toggle .active,
[data-theme="dark"] .admin-table th {
  background: #242c3c;
  color: #b0bbcf;
  border-color: #343e53;
}
[data-theme="dark"] .block blockquote {
  background: #252e46;
  border-color: #7c88c9;
  color: #bcc7e6;
}
[data-theme="dark"] .block pre,
[data-theme="dark"] .block code {
  background: #101620;
  color: #c9d5ef;
}
[data-theme="dark"] .pill,
[data-theme="dark"] .peer {
  background: #213d35;
  color: #a2d1bb;
}
[data-theme="dark"] .form-error,
[data-theme="dark"] .btn.danger {
  color: #f29caa;
}
[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: #8c99b3;
}
[data-theme="dark"] .text-link,
[data-theme="dark"] .tabs .active {
  color: #adb7ff;
}
[data-theme="dark"] .empty,
[data-theme="dark"] .server-status {
  border-color: #343e53;
}
[data-theme="dark"] .empty h3,
[data-theme="dark"] .login-form h2 {
  color: #d2dbed;
}
@media (max-width: 760px) {
  .presence {
    display: none;
  }
  .db-toolbar #db-filter {
    width: 100%;
    margin-left: 0;
  }
  .database-page .page-heading {
    flex-direction: column;
  }
  .mcp-art {
    right: 15px;
    font-size: 65px;
    opacity: 0.5;
  }
  .top-actions {
    gap: 8px;
  }
  #theme {
    max-width: 110px;
  }
  .integration-tools .folder-grid {
    grid-template-columns: 1fr;
  }
}

/* Explicit foregrounds keep code readable independently of surrounding text. */
.block pre,
.block code {
  color: #25324b;
}
.block pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}
.block img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}
.attachment-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.attachment-row > span {
  flex: 1;
  overflow-wrap: anywhere;
  min-width: 0;
}
#command-results {
  max-height: 360px;
  overflow-y: auto;
  margin-top: 12px;
}
.command-selected {
  background: var(--accent-soft, #e8edf8);
  color: #25324b;
  outline: 2px solid #7889ba;
  outline-offset: -2px;
}

.ai-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}
.ai-history,
.ai-conversation,
.ai-notice,
.ai-provider {
  padding: 24px;
}
.ai-history h3 {
  margin-top: 24px;
}
/* Past conversations: one line each, with context and age. */
#chat-history {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}
.chat-history-row {
  border-radius: 8px;
}
.chat-history-row:hover,
.chat-history-row.current {
  background: var(--soft, #eef0fd);
}
.chat-history-item {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1;
  padding: 7px 8px;
  text-align: left;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
}
.chat-history-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
}
.chat-history-row.current .chat-history-title {
  font-weight: 650;
}
.chat-history-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11px;
}
.chat-history-empty {
  color: var(--muted);
  font-size: 13px;
}
.ai-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.ai-controls label {
  min-width: 0;
}
.ai-controls select {
  width: 100%;
}
.ai-disclosure,
.ai-notice p {
  color: var(--muted);
  line-height: 1.6;
  font-size: 13px;
}
.ai-provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.ai-provider small {
  overflow-wrap: anywhere;
}
.chat-messages {
  min-height: 240px;
  max-height: 58vh;
  overflow: auto;
  padding: 12px 0;
}
/* A conversation: your question in a bubble on the right, the reply below in
   its own box. */
.chat-turn {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 0;
}
.chat-question {
  align-self: flex-end;
  max-width: 80%;
  margin: 0;
  padding: 10px 14px;
  border-radius: 14px 14px 4px 14px;
  background: var(--soft, #eef0fd);
  color: var(--ink, inherit);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-answer {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  background: var(--surface, #fff);
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-answer.chat-pending {
  color: var(--muted);
  font-style: italic;
}
.chat-turn > .chat-sources,
.chat-turn > small,
.chat-turn > .chat-reply-actions {
  margin: 0;
}
.chat-incomplete .chat-answer {
  border-color: #e0a43a;
}
.chat-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 16px 0 10px;
}
.source-chip {
  max-width: 100%;
  white-space: normal;
  text-align: left;
  font-size: 12px;
}
.chat-compose-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}
#chat-status {
  flex: 1;
  font-size: 12px;
  color: var(--muted);
}
#chat-question {
  width: 100%;
  min-height: 90px;
  resize: vertical;
}
.chat-incomplete {
  border-left: 2px solid #c88444;
  padding-left: 12px;
}
@media (max-width: 900px) {
  .ai-layout {
    grid-template-columns: 1fr;
  }
  .ai-history {
    max-height: 200px;
    overflow: auto;
  }
  .ai-controls {
    grid-template-columns: 1fr;
  }
}

/* Accessibility helpers */
.skip-link {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.skip-link:focus {
  top: 12px;
}
.block-body:focus-visible,
.btn:focus-visible,
button:focus-visible {
  outline: 2px solid #8792ec;
  outline-offset: 2px;
}

/* Sharing */
.share-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: var(--soft);
  color: var(--accent);
  vertical-align: 1px;
}
.share-badge.public {
  background: #e7f6ec;
  color: #227a45;
}
.public-indicator,
.share-indicator {
  color: #227a45;
  font-weight: 500;
}
.share-indicator {
  color: var(--accent);
}
dialog:has(.share-section) {
  width: min(640px, 94vw);
}
.share-section {
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.share-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}
.share-row {
  display: flex;
  gap: 8px;
}
.share-row input {
  flex: 1;
  min-width: 0;
}
.share-row input,
.share-row select,
.publish-form input {
  padding: 8px 10px;
  font-size: 13px;
}
.share-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}
.share-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
}
.share-list li > span:first-child {
  flex: 1;
  min-width: 0;
}
.share-list small,
.share-list .muted,
.hint {
  color: var(--muted);
}
.hint {
  margin: 8px 0 0;
  font-size: 12px;
}
.panel .subhead {
  margin: 22px 0 0;
  padding: 0 22px;
  font-size: 14px;
}
.panel .subhead + .hint {
  padding: 0 22px 8px;
}
.new-link {
  display: flex;
  align-items: end;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 10px;
  background: var(--soft);
}
.new-link label {
  flex: 1;
  margin: 0;
  font-size: 12px;
  font-weight: 600;
}
.new-link input {
  width: 100%;
  margin-top: 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.publish-form {
  display: grid;
  gap: 12px;
}
.publish-form label {
  display: grid;
  gap: 6px;
  margin: 0;
  font-size: 13px;
}
.publish-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.publish-form legend {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.slug-field {
  display: flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: 12px;
}
.slug-field input {
  flex: 1;
  min-width: 120px;
}
.slug-field select {
  width: auto;
  min-width: 0;
  padding-right: 22px;
}
.share-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.public-state {
  color: #227a45 !important;
}
.shared-shell {
  min-height: 100vh;
}
.shared-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}
.shared-top .brand {
  margin: 0;
}
.shared-top .spacer {
  flex: 1;
}

/* Storage administration */
.storage-panel {
  margin-top: 24px;
}
.storage-panel h3 {
  margin: 22px 22px 4px;
  font-size: 15px;
}
.storage-panel > p {
  margin: 0 22px 12px;
  font-size: 12px;
  color: var(--muted);
}
.usage-bar {
  height: 8px;
  margin: 18px 22px;
  border-radius: 99px;
  background: var(--line);
  overflow: hidden;
}
.usage-bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}
#delete-orphans {
  margin: 12px 22px 20px;
}

/* Code: highlighting and diagnostics */
.code-diagnostic {
  margin: 6px 0 0;
  color: #bf5261;
  font-size: 12px;
}
.block pre code {
  background: none;
  padding: 0;
}
.hl-comment {
  color: #7a8396;
  font-style: italic;
}
.hl-string,
.hl-markup.hl-inserted {
  color: #2f7d4f;
}
.hl-constant.hl-numeric,
.hl-constant.hl-language,
.hl-constant.hl-character {
  color: #b05a00;
}
.hl-keyword,
.hl-storage {
  color: #7542c4;
}
.hl-entity.hl-name.hl-function,
.hl-support.hl-function {
  color: #2a62c9;
}
.hl-entity.hl-name.hl-type,
.hl-entity.hl-name.hl-class,
.hl-support.hl-type,
.hl-support.hl-class,
.hl-entity.hl-name.hl-tag {
  color: #a3366b;
}
.hl-entity.hl-other.hl-attribute-name,
.hl-variable.hl-parameter {
  color: #9a6a00;
}
.hl-invalid,
.hl-markup.hl-deleted {
  color: #c4313f;
}
[data-theme="dark"] .hl-comment {
  color: #8b95a8;
}
[data-theme="dark"] .hl-string,
[data-theme="dark"] .hl-markup.hl-inserted {
  color: #8fd19e;
}
[data-theme="dark"] .hl-constant.hl-numeric,
[data-theme="dark"] .hl-constant.hl-language,
[data-theme="dark"] .hl-constant.hl-character {
  color: #f2b072;
}
[data-theme="dark"] .hl-keyword,
[data-theme="dark"] .hl-storage {
  color: #c7a6ff;
}
[data-theme="dark"] .hl-entity.hl-name.hl-function,
[data-theme="dark"] .hl-support.hl-function {
  color: #8fb8ff;
}
[data-theme="dark"] .hl-entity.hl-name.hl-type,
[data-theme="dark"] .hl-entity.hl-name.hl-class,
[data-theme="dark"] .hl-support.hl-type,
[data-theme="dark"] .hl-support.hl-class,
[data-theme="dark"] .hl-entity.hl-name.hl-tag {
  color: #f59cc3;
}
[data-theme="dark"] .hl-entity.hl-other.hl-attribute-name,
[data-theme="dark"] .hl-variable.hl-parameter {
  color: #e6c66e;
}
[data-theme="dark"] .hl-invalid,
[data-theme="dark"] .hl-markup.hl-deleted {
  color: #ff8a95;
}
[data-theme="dark"] .code-diagnostic {
  color: #ff8a95;
}
[data-theme="dark"] .share-badge.public,
[data-theme="dark"] .public-indicator,
[data-theme="dark"] .public-state {
  background: none;
  color: #8fd19e !important;
}
[data-theme="dark"] .share-badge.public {
  background: #1f3a2a;
}
[data-theme="dark"] .shared-top {
  background: #131823;
}
[data-theme="dark"] dialog p,
[data-theme="dark"] .hint {
  color: #a6b1c6;
}
/* Rendered content shared by the app and published pages. */
mark {
  padding: 0 2px;
  border-radius: 3px;
  background: #fff1a8;
  color: inherit;
}
.tag {
  display: inline-block;
  padding: 0 6px;
  border-radius: 99px;
  background: #eef0fd;
  color: #4d59c3;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
}
/* Audio files and recordings in notes. */
.audio-player {
  display: block;
  width: min(100%, 520px);
  height: 40px;
  margin: 4px 0;
}
.recorder {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 8px 0 12px;
}
.record-time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
#blocks.media-drop {
  outline: 2px dashed var(--accent);
  outline-offset: 6px;
  border-radius: 8px;
}
/* `@person@example.com` assignments and `⏰` email reminders in notes. */
.mention,
.reminder {
  display: inline-block;
  padding: 0 7px;
  border-radius: 99px;
  font-size: 0.9em;
  font-weight: 500;
  background: #e8f3ec;
  color: #2a6a49;
}
.reminder {
  background: #fdf2e3;
  color: #8a5312;
}
[data-theme="dark"] .mention {
  background: #1f3a2d;
  color: #9fd6b4;
}
[data-theme="dark"] .reminder {
  background: #3d2f1b;
  color: #f0c98c;
}
.login-form .forgot {
  margin: 4px 0 0;
  text-align: center;
}
blockquote[class^="markdown-alert-"] {
  margin: 4px 0;
  padding: 10px 14px 10px 16px;
  border: 0;
  border-left: 4px solid var(--alert, #5e69d6);
  border-radius: 8px;
  background: color-mix(in srgb, var(--alert, #5e69d6) 9%, transparent);
  color: inherit;
}
blockquote[class^="markdown-alert-"]::before {
  display: block;
  margin-bottom: 4px;
  color: var(--alert);
  font-size: 0.85em;
  font-weight: 700;
  letter-spacing: 0.02em;
}
blockquote[class^="markdown-alert-"] p {
  margin: 0;
}
.markdown-alert-note {
  --alert: #3b6fd8;
}
.markdown-alert-note::before {
  content: "ⓘ Note";
}
.markdown-alert-tip {
  --alert: #23864b;
}
.markdown-alert-tip::before {
  content: "💡 Tip";
}
.markdown-alert-important {
  --alert: #7b4cd6;
}
.markdown-alert-important::before {
  content: "❗ Important";
}
.markdown-alert-warning {
  --alert: #b36b00;
}
.markdown-alert-warning::before {
  content: "⚠ Warning";
}
.markdown-alert-caution {
  --alert: #c4313f;
}
.markdown-alert-caution::before {
  content: "⛔ Caution";
}
math {
  font-size: 1.1em;
  /* An OpenType MATH font gives proper limits, fractions, and radicals. */
  font-family:
    "STIX Two Math", "Latin Modern Math", "Cambria Math", "Noto Sans Math", math;
}
/* MathML keeps its own display type (`block math`); overriding it breaks layout. */
math[display="block"] {
  margin: 10px 0;
}
.math-error,
merror {
  color: #c4313f;
}
.mermaid-diagram {
  display: flex;
  justify-content: center;
  overflow-x: auto;
}
.mermaid-diagram svg {
  max-width: 100%;
  height: auto;
}
.cover-gradient-1 {
  background: linear-gradient(135deg, #a1c4fd, #c2e9fb);
}
.cover-gradient-2 {
  background: linear-gradient(135deg, #fbc2eb, #a6c1ee);
}
.cover-gradient-3 {
  background: linear-gradient(135deg, #fddb92, #d1fdff);
}
.cover-gradient-4 {
  background: linear-gradient(135deg, #84fab0, #8fd3f4);
}
.cover-gradient-5 {
  background: linear-gradient(135deg, #5865d8, #a3adff);
}
.cover-gradient-6 {
  background: linear-gradient(135deg, #f6d365, #fda085);
}
.cover-gradient-7 {
  background: linear-gradient(135deg, #2b3a55, #5e69d6);
}
.cover-gradient-8 {
  background: linear-gradient(135deg, #e0e3ea, #f7f8fa);
}

/* Note cover, icon, tags, statistics, backlinks */
.note-cover {
  position: relative;
  height: clamp(120px, 22vw, 220px);
  overflow: hidden;
}
.note-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.cover-change {
  position: absolute;
  right: 16px;
  bottom: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}
.note-cover:hover .cover-change,
.cover-change:focus-visible {
  opacity: 1;
}
.document.has-cover {
  padding-top: 24px;
}
.doc-adders {
  display: flex;
  gap: 14px;
  min-height: 22px;
  margin-bottom: 6px;
  opacity: 0;
  transition: opacity 0.15s;
}
.document:hover .doc-adders,
.doc-adders:focus-within {
  opacity: 1;
}
.doc-adders .text-link {
  color: var(--muted);
  font-size: 12px;
}
button.doc-icon {
  padding: 2px 6px;
  border-radius: 10px;
  font-family: inherit;
}
button.doc-icon:hover {
  background: var(--soft);
}
.tag-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: -6px 0 18px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 4px 2px 9px;
  border-radius: 99px;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.tag-chip.inline {
  padding-right: 9px;
  background: transparent;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, transparent);
}
.tag-remove {
  padding: 0 5px;
  border-radius: 99px;
  color: inherit;
  font-size: 13px;
  line-height: 1.2;
}
.tag-add input {
  width: 110px;
  padding: 3px 8px;
  border: 1px dashed var(--line);
  border-radius: 99px;
  font-size: 12px;
  background: transparent;
}
.tag-list .tag-hash {
  width: 16px;
  text-align: center;
  color: var(--muted);
}
.backlinks {
  margin-top: 40px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.backlinks h2 {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.backlink {
  display: block;
  padding: 6px 8px;
  border-radius: 6px;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
}
.backlink:hover {
  background: var(--soft);
}

/* Popovers: icon, cover, note links */
.popover {
  position: absolute;
  z-index: 50;
  width: min(340px, 92vw);
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 16px 50px #27355230;
  display: grid;
  gap: 10px;
}
.icon-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 2px;
}
.icon-grid button {
  padding: 4px 0;
  border-radius: 6px;
  font-size: 18px;
}
.icon-custom,
.cover-url {
  display: flex;
  gap: 6px;
}
.icon-custom input,
.cover-url input {
  flex: 1;
  min-width: 0;
  padding: 6px 9px;
  font-size: 13px;
}
.cover-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}
.cover-grid button {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
}
.cover-upload {
  justify-content: center;
}
.popover .text-link {
  justify-self: start;
  color: #bf5261;
  font-size: 12px;
}

/* Formatting toolbar and note-link picker inside a block */
.block {
  position: relative;
  /* Contains the floated task checkbox so consecutive tasks do not stair-step. */
  display: flow-root;
}
.format-bar {
  position: absolute;
  top: -40px;
  right: 0;
  z-index: 6;
  display: flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 6px 20px #27355222;
}
.format-bar button {
  min-width: 30px;
  height: 28px;
  border-radius: 6px;
  font-size: 13px;
}
.format-bar code {
  font-size: 11px;
  background: none;
}
.format-highlight {
  background: #fff1a8 !important;
}
.link-picker {
  position: absolute;
  left: 12px;
  top: 100%;
  z-index: 6;
  width: min(360px, 90%);
  max-height: 260px;
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 12px 34px #27355228;
}
.link-picker button {
  display: block;
  width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}
.link-picker button.selected {
  background: var(--soft);
  color: var(--accent);
}
.link-picker p {
  margin: 6px 10px;
  font-size: 13px;
}

/* Find and replace */
.find-bar {
  position: sticky;
  top: 58px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 8px 40px;
  border-bottom: 1px solid var(--line);
  background: #fffffff2;
}
.find-bar input:not([type="checkbox"]) {
  width: 200px;
  padding: 6px 9px;
  font-size: 13px;
}
.find-count {
  min-width: 70px;
  color: var(--muted);
  font-size: 12px;
}
.block.find-hit {
  box-shadow: inset 3px 0 0 #f2c94c;
}
.block.find-current {
  box-shadow: inset 3px 0 0 #e08a00;
}
::highlight(find-match) {
  background: #fff1a8;
  color: inherit;
}
::highlight(find-current) {
  background: #ffb84d;
  color: #1e2433;
}

/* Focus mode: only the note remains */
body.focus-mode:has(.document) .sidebar,
body.focus-mode:has(.document) .topbar,
body.focus-mode .editor-toolbar .btn:not(#focus-toggle):not(#find-note),
body.focus-mode #presence,
body.focus-mode .doc-meta,
body.focus-mode .tag-bar,
body.focus-mode .editor-help,
body.focus-mode .backlinks,
body.focus-mode .block-controls {
  display: none !important;
}
body.focus-mode:has(.document) .app-shell {
  grid-template-columns: 1fr;
}
body.focus-mode:has(.document) .main {
  grid-column: 1 / -1;
}
body.focus-mode .editor-toolbar {
  justify-content: flex-end;
  border-color: transparent;
}
body.focus-mode .document {
  max-width: 720px;
  padding-top: 64px;
  font-size: 1.05em;
}
body.focus-mode #blocks:focus-within .block:not(:focus-within) {
  opacity: 0.35;
  transition: opacity 0.2s;
}
#word-count {
  font-variant-numeric: tabular-nums;
}

[data-theme="dark"] mark,
[data-theme="dark"] .format-highlight {
  background: #6b5a12 !important;
}
[data-theme="dark"] .tag {
  background: #282d4a;
  color: #a3adff;
}
[data-theme="dark"] .popover,
[data-theme="dark"] .format-bar,
[data-theme="dark"] .link-picker {
  background: #1d2432;
  border-color: #343e53;
  box-shadow: 0 16px 50px #0008;
}
[data-theme="dark"] .find-bar {
  background: #181d28f2;
}
[data-theme="dark"] ::highlight(find-match) {
  background: #6b5a12;
}
[data-theme="dark"] ::highlight(find-current) {
  background: #b36b00;
  color: #fff;
}
[data-theme="dark"] .markdown-alert-note {
  --alert: #7fa8ff;
}
[data-theme="dark"] .markdown-alert-tip {
  --alert: #6fd39a;
}
[data-theme="dark"] .markdown-alert-important {
  --alert: #b99bff;
}
[data-theme="dark"] .markdown-alert-warning {
  --alert: #f2b072;
}
[data-theme="dark"] .markdown-alert-caution {
  --alert: #ff8a95;
}

/* Export dialog */
.export-formats {
  display: grid;
  gap: 8px;
}
.export-format {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  margin: 0 !important;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.export-format:has(input:checked) {
  border-color: var(--accent);
  background: var(--soft);
}
.export-format input {
  margin-top: 3px;
}
.export-format strong {
  display: block;
  font-size: 13px;
}
.export-format small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.export-options {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
}
.export-options legend {
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 600;
}
.export-options label {
  margin: 0;
  font-size: 13px;
}
.export-options select {
  margin-left: 8px;
  padding: 4px 8px;
}
.print-frame {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 1px;
  height: 1px;
  border: 0;
  opacity: 0;
  pointer-events: none;
}
.export-options [hidden] {
  display: none !important;
}

/* Journal */
.journal-layout {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .journal-layout {
    grid-template-columns: 1fr;
  }
}
.calendar {
  padding: 16px;
}
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.calendar-head h2 {
  margin: 0;
  font-size: 15px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}
.calendar-grid .weekday {
  padding: 4px 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.calendar-grid .day {
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 13px;
  position: relative;
}
.calendar-grid .day.has-entry {
  background: var(--soft);
  color: var(--accent);
  font-weight: 600;
}
.calendar-grid .day.has-entry::after {
  content: "";
  position: absolute;
  bottom: 5px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  border-radius: 50%;
  background: var(--accent);
}
.calendar-grid .day.today {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.journal-list {
  display: grid;
}
.journal-entry {
  display: grid;
  gap: 2px;
  padding: 11px 22px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.journal-entry small {
  color: var(--muted);
}
.journal-settings {
  display: flex;
  align-items: end;
  gap: 10px;
  padding: 16px 22px;
}
.journal-settings label {
  display: grid;
  gap: 6px;
  flex: 1;
  margin: 0;
  font-size: 13px;
}
.journal-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}
.journal-nav .btn {
  padding: 4px 10px;
  font-size: 12px;
}
.template-badge {
  display: inline-block;
  margin-bottom: 6px;
  padding: 2px 9px;
  border-radius: 99px;
  background: #fdf3dc;
  color: #8a5a00;
  font-size: 12px;
  font-weight: 500;
}
.template-fill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 13px;
}
.template-list {
  display: grid;
  max-height: 300px;
  overflow: auto;
}
.template-list button {
  padding: 8px 10px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}
.journal-tasks {
  display: block;
}
.journal-tasks-panel {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--soft) 55%, transparent);
}
.journal-tasks-title {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}
.journal-tasks-title small {
  margin-left: 6px;
  padding: 0 7px;
  border-radius: 99px;
  background: var(--soft);
  color: var(--accent);
  font-size: 11px;
}
.journal-tasks-list {
  display: grid;
  gap: 2px;
}
.journal-task {
  display: flex;
  align-items: center;
  gap: 6px;
}
.journal-task .task-toggle {
  float: none;
  margin: 0;
  font-size: 18px;
}
.journal-task-text {
  flex: 1;
}
.journal-task-origin {
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
}
.journal-tasks-note {
  color: var(--muted);
  font-size: 13px;
}
[data-theme="dark"] .template-badge {
  background: #3d3416;
  color: #ffe9a8;
}
/* An empty block keeps one line of height so it stays visible spacing and clickable. */
.block-empty {
  display: block;
  min-height: 1.6em;
}

/* Account security and two-factor authentication */
.profile-link {
  flex: 1;
  min-width: 0;
  padding: 2px 4px;
  border-radius: 6px;
  text-align: left;
}
.security-body {
  display: grid;
  gap: 12px;
  padding: 18px 22px 22px;
}
.security-body p {
  margin: 0;
}
.pill-on {
  background: #e7f6ec !important;
  color: #227a45 !important;
}
.totp-steps {
  display: grid;
  gap: 16px;
  margin: 0 0 8px;
  padding-left: 20px;
  font-size: 14px;
}
.totp-steps input {
  display: block;
  width: 160px;
  margin-top: 8px;
  font-size: 18px;
  letter-spacing: 0.15em;
}
.totp-qr {
  width: 200px;
  margin: 10px 0;
  padding: 8px;
  border-radius: 10px;
  background: #fff;
}
.totp-qr svg {
  display: block;
  width: 100%;
  height: auto;
}
.totp-secret {
  display: block;
  margin: 8px 0;
  font-size: 15px;
  letter-spacing: 0.08em;
  user-select: all;
}
.recovery-codes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px 18px;
  margin: 12px 0;
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--soft);
}
.recovery-codes code {
  font-size: 15px;
  letter-spacing: 0.05em;
}
[data-theme="dark"] .pill-on {
  background: #1f3a2a !important;
  color: #8fd19e !important;
}

/* Nested blocks (Tab / Shift+Tab). The level comes from leading spaces. */
.block.indent-1 {
  margin-left: 1.6rem;
}
.block.indent-2 {
  margin-left: 3.2rem;
}
.block.indent-3 {
  margin-left: 4.8rem;
}
.block.indent-4 {
  margin-left: 6.4rem;
}
.block.indent-5 {
  margin-left: 8rem;
}
.block.indent-6 {
  margin-left: 9.6rem;
}
/* The block itself is indented in the editor; the rendered wrapper is not. */
.block-body .md-indent {
  margin-left: 0;
}
.block.indent-1 ul,
.block.indent-4 ul {
  list-style-type: circle;
}
.block.indent-2 ul,
.block.indent-5 ul {
  list-style-type: square;
}
/* Destructive actions in tab rows and menus. */
.tabs .danger-text,
.workspace-menu .danger-item {
  color: #bf5261;
}
.workspace-menu .square.danger {
  background: #fdeef0;
  color: #bf5261;
}
.workspace-menu .square.danger svg {
  width: 14px;
  height: 14px;
}
[data-theme="dark"] .tabs .danger-text,
[data-theme="dark"] .workspace-menu .danger-item {
  color: #ff8a95;
}
[data-theme="dark"] .workspace-menu .square.danger {
  background: #3a2026;
  color: #ff8a95;
}

/* ------------------------------------------------------------------------
   Sidebar: search row, collapsible sections, and the folder tree.
   ------------------------------------------------------------------------ */
:root {
  --row-hover: #eef0f5;
  --row-action-hover: #e2e6ee;
  --drop: #dfe3fb;
}
[data-theme="dark"] {
  --row-hover: #222a3a;
  --row-action-hover: #2e3850;
  --drop: #2c3560;
}
.sidebar {
  overflow: hidden;
}
.search-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
}
.search-row #search {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 13px;
  color: #68758a;
}
.search-row svg {
  width: 17px;
  height: 17px;
  flex: none;
}
#quick-note {
  display: grid;
  place-items: center;
  width: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #68758a;
}
.sidebar-scroll {
  flex: 1;
  min-height: 0;
  margin: 8px -6px 0;
  padding: 0 6px 8px;
  overflow-y: auto;
  scrollbar-width: thin;
}
.side-section .section-label {
  margin: 14px 0 4px;
  padding: 0 4px 0 0;
  border-radius: 6px;
}
.section-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  border-radius: 5px;
  color: #98a0ad;
  font-size: 10px !important;
  font-weight: 700;
  letter-spacing: 1.5px;
  line-height: 1.4 !important;
  text-transform: uppercase;
}
.section-toggle svg,
.section-add svg {
  width: 13px;
  height: 13px;
  transition: transform 0.15s;
}
.section-toggle[aria-expanded="false"] svg {
  transform: rotate(-90deg);
}
.section-add {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
}
.side-empty {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 2px 8px 6px;
  color: var(--muted);
  font-size: 12px;
}
.side-empty svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.tree-row {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 32px;
  padding-left: calc(var(--depth, 0) * 14px + 2px);
  border-radius: 7px;
  color: #5d6a80;
  font-size: 13px;
}
.tree-row:hover,
.tree-row.menu-open,
.tree-row:focus-within {
  background: var(--row-hover);
}
.tree-row.active {
  background: #e9ecfb;
  color: #5360cd;
  font-weight: 600;
}
.tree-row.drop-target {
  background: var(--drop);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}
.tree-row.dragging {
  opacity: 0.45;
}
/* Rows are hover targets; their buttons stay transparent inside them. */
.sidebar .tree-row button:hover {
  background: transparent;
}
.tree-toggle,
.tree-spacer {
  display: grid;
  flex: none;
  place-items: center;
  width: 20px;
  height: 22px;
  border-radius: 5px;
  color: var(--muted);
}
.tree-toggle svg {
  width: 13px;
  height: 13px;
  transform: rotate(-90deg);
  transition: transform 0.15s;
}
.tree-toggle[aria-expanded="true"] svg {
  transform: none;
}
.tree-toggle:disabled {
  opacity: 0;
  cursor: default;
}
.tree-label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 6px 6px 6px 2px;
  text-align: left;
  color: inherit;
  font-weight: inherit;
}
.tree-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 17px;
  color: var(--muted);
}
.tree-row.active .tree-icon {
  color: inherit;
}
.tree-icon svg {
  width: 16px;
  height: 16px;
}
.note-icon {
  font-size: 13px;
  line-height: 1;
}
.tree-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-row .count {
  font-size: 11px;
  font-weight: 400;
  color: #9aa3b2;
}
/* Row actions overlay the count; they stay focusable so keyboard users reach them. */
.tree-actions {
  position: absolute;
  top: 50%;
  right: 4px;
  display: flex;
  gap: 1px;
  border-radius: 6px;
  background: var(--row-hover);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%);
}
.tree-row.active .tree-actions {
  background: inherit;
}
.tree-row:hover .tree-actions,
.tree-row:focus-within .tree-actions,
.tree-row.menu-open .tree-actions {
  opacity: 1;
  pointer-events: auto;
}
.tree-row:hover .count,
.tree-row:focus-within .count,
.tree-row.menu-open .count {
  visibility: hidden;
}
.tree-actions button {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  color: var(--muted);
}
.sidebar .tree-actions button:hover,
.sidebar .tree-actions button[aria-expanded="true"] {
  background: var(--row-action-hover);
  color: inherit;
}
.tree-actions svg {
  width: 15px;
  height: 15px;
}
.tree-actions [data-row-menu] svg {
  stroke-width: 3;
}
/* Touch screens have no hover: keep row actions visible. */
@media (hover: none) {
  .tree-actions {
    position: static;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    background: none;
  }
  .tree-row .count {
    display: none;
  }
}
.row-menu {
  position: fixed;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 210px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 12px 28px #1b23382a;
}
.row-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  text-align: left;
  font-size: 13px;
}
.row-menu button:hover,
.row-menu button:focus-visible {
  background: var(--row-hover);
  outline: 0;
}
.row-menu button svg {
  width: 15px;
  height: 15px;
  flex: none;
  color: var(--muted);
}
.row-menu .danger-item,
.row-menu .danger-item svg {
  color: #bf5261;
}
.row-menu [aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
[data-theme="dark"] .tree-row {
  color: #b3bed3;
}
[data-theme="dark"] .tree-row.active {
  background: #2a3150;
  color: #bac3ff;
}
[data-theme="dark"] .row-menu {
  border-color: #343e53;
  box-shadow: 0 12px 28px #0008;
}
[data-theme="dark"] .row-menu .danger-item,
[data-theme="dark"] .row-menu .danger-item svg {
  color: #ff8a95;
}
[data-theme="dark"] #quick-note {
  border-color: #343e53;
}

.sidebar-bottom {
  margin-top: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.sidebar-bottom .profile {
  margin-top: 0;
}
.profile .avatar {
  position: relative;
}
.profile .avatar .dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  border: 2px solid var(--surface-alt);
  box-sizing: content-box;
}
.sidebar-scroll .nav + .side-section .section-label {
  margin-top: 18px;
}

/* ------------------------------------------------------------------------
   Live databases inside notes.
   ------------------------------------------------------------------------ */
.db-embed,
.db-embed-panel {
  display: block;
}
.db-embed-panel {
  margin: 4px 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  overflow: hidden;
  cursor: default;
}
.db-embed-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-alt);
}
.db-embed-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-weight: 650;
  font-size: 14px;
}
.db-embed-title svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.db-embed-meta {
  color: var(--muted);
  font-size: 12px;
}
.db-embed-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}
.db-embed-actions button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  font-size: 12px;
}
.db-embed-actions button svg {
  width: 13px;
  height: 13px;
}
.db-embed-actions button.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
.db-embed-views {
  display: inline-flex;
}
.db-embed-views button {
  border-radius: 0;
}
.db-embed-views button:first-child {
  border-radius: 6px 0 0 6px;
}
.db-embed-views button:last-child {
  margin-left: -1px;
  border-radius: 0 6px 6px 0;
}
.db-embed-views [aria-pressed="true"] {
  background: var(--soft);
  color: var(--accent);
  font-weight: 600;
}
.db-embed-scroll {
  overflow-x: auto;
}
.db-embed-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.db-embed-table th {
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-align: left;
  white-space: nowrap;
}
.db-embed-table td {
  padding: 2px 4px;
  border-bottom: 1px solid var(--line);
}
.db-embed-table tr:last-child td {
  border-bottom: 0;
}
.db-embed-table input:not([type="checkbox"]),
.db-embed-table select {
  width: 100%;
  min-width: 90px;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  font-size: 13px;
}
.db-embed-table input:not([type="checkbox"]):hover,
.db-embed-table select:hover {
  border-color: var(--line);
}
.db-embed-table input[type="checkbox"] {
  margin: 0 6px;
}
.db-embed-table .saving {
  opacity: 0.6;
}
.db-embed-table .cell-error {
  border-color: #bf5261;
}
.db-embed-empty {
  margin: 0;
  padding: 14px;
  color: var(--muted);
  font-size: 13px;
}
.db-embed-board {
  display: flex;
  gap: 10px;
  padding: 10px;
  overflow-x: auto;
}
.db-embed-column {
  flex: 1 0 180px;
  min-width: 180px;
}
.db-embed-column h4 {
  display: flex;
  justify-content: space-between;
  margin: 2px 4px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}
.db-embed-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
  margin-bottom: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: left;
  font-size: 13px;
}
.db-embed-card small {
  color: var(--muted);
  font-size: 11px;
}
.db-embed-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}
.db-embed-note svg {
  width: 15px;
  height: 15px;
}
/* Database page: header menus and record actions. */
.th-inner {
  display: flex;
  align-items: center;
  gap: 2px;
}
.th-menu {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  color: var(--muted);
  opacity: 0;
}
th:hover .th-menu,
.th-menu:focus-visible,
.th-menu[aria-expanded="true"] {
  opacity: 1;
}
.th-menu svg {
  width: 14px;
  height: 14px;
  stroke-width: 3;
}
.record-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}
.record-actions svg {
  width: 14px;
  height: 14px;
}
[data-theme="dark"] .db-embed-actions button.primary {
  border-color: #737ce2;
  background: #737ce2;
}
@media (hover: none) {
  .th-menu {
    opacity: 1;
  }
}

/* Independent editor panes keep live sessions and undo state intact across tabs. */
.has-note-tabs #content {
  padding-top: 44px;
}
.note-tabs-host {
  position: fixed;
  z-index: 45;
  bottom: 0;
  pointer-events: none;
}
.note-tabs-host[hidden],
.note-tab-deck[hidden],
.note-pane-frame[hidden] {
  display: none;
}
.note-tab-strip {
  height: 44px;
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--surface, #f7f8fb);
  pointer-events: auto;
}
.note-tab-list {
  display: flex;
  overflow: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: thin;
}
.note-tab {
  display: flex;
  align-items: center;
  min-width: 170px;
  max-width: 280px;
  border-right: 1px solid var(--line);
  border-top: 2px solid transparent;
}
.note-tab.active {
  border-top-color: #7c78d3;
  background: var(--bg, #fff);
}
.note-tab.secondary {
  border-top-color: #48a293;
}
.note-tab.drag-over {
  box-shadow: inset 3px 0 #7c78d3;
}
.note-tab [role="tab"] {
  padding: 4px 9px;
  text-align: left;
  min-width: 0;
  flex: 1;
}
.note-tab [role="tab"] > span:first-child {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.note-tab small {
  display: block;
  font-size: 10px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.note-tab > button:not([role="tab"]) {
  width: 26px;
  height: 30px;
  flex-shrink: 0;
}
.tab-browse,
.tab-remote,
.tab-unsplit {
  width: 36px;
  flex-shrink: 0;
}
.note-tab-deck {
  position: absolute;
  top: 44px;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: auto;
}
.note-pane-frame {
  position: absolute;
  top: 0;
  height: 100%;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--bg, #fff);
}
.editor-pane .sidebar,
.editor-pane .skip-link,
.editor-pane .topbar,
.editor-pane .mobile-menu {
  display: none;
}
.editor-pane .main {
  margin-left: 0;
  width: 100%;
  min-width: 0;
}
.editor-pane .app-shell {
  display: block;
}
.editor-pane .document {
  padding-left: 38px;
  padding-right: 30px;
  max-width: 950px;
}
.editor-pane .editor-toolbar {
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 12px;
}
.editor-pane .login-art {
  display: none;
}
.editor-pane .login-shell {
  grid-template-columns: 1fr;
}
.youtube-card {
  display: grid;
  gap: 6px;
}
/* The player is positioned over this box (see youtube.js). */
.youtube-frame {
  aspect-ratio: 16/9;
  min-height: 200px;
  border-radius: 10px;
  background: #10141d;
}
.youtube-caption {
  display: flex;
  gap: 12px;
  font-size: 12px;
}
/* Inline players stay under the editor's toolbars and menus. */
.youtube-portal {
  position: fixed;
  z-index: 4;
  background: #10141d;
  border-radius: 10px;
  overflow: hidden;
}
.youtube-portal[hidden] {
  display: none;
}
.youtube-portal iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.youtube-portal.floating iframe {
  height: calc(100% - 34px);
}
.youtube-controls {
  display: none;
  justify-content: space-between;
  height: 34px;
  align-items: center;
  padding: 0 9px;
  background: #202737;
  color: #fff;
  font-size: 12px;
}
.youtube-controls button {
  color: inherit;
  padding: 4px 8px;
}
.youtube-portal.floating {
  z-index: 40;
  outline: 1px solid #ffffff35;
  box-shadow: 0 8px 32px #0005;
}
.youtube-portal.floating .youtube-controls {
  display: flex;
}
[data-theme="dark"] .note-tab-strip {
  background: #1d2432;
}
[data-theme="dark"] .note-tab.active,
[data-theme="dark"] .note-pane-frame {
  background: #151a24;
}
.editor-pane.pane-browsing .sidebar {
  display: flex;
  width: 200px;
}
.editor-pane.pane-browsing .main {
  margin-left: 200px;
  width: calc(100% - 200px);
}
@media (max-width: 600px) {
  .editor-pane.pane-browsing .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    transform: none;
  }
  .editor-pane.pane-browsing .sidebar-scroll,
  .editor-pane.pane-browsing .sidebar-bottom {
    display: none;
  }
  .editor-pane.pane-browsing .main {
    margin-left: 0;
    width: 100%;
  }
}

/* Note metadata dialog. */
.meta-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 12px 0;
}
.meta-fields label:has(textarea) {
  grid-column: 1 / -1;
}
.meta-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.meta-key {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 400;
}
.meta-custom {
  margin: 4px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.meta-custom legend {
  padding: 0 4px;
  font-size: 12px;
  font-weight: 600;
}
.meta-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
  gap: 8px;
  margin-bottom: 8px;
}
dialog:has(#metadata-form) {
  width: min(660px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}
@media (max-width: 640px) {
  .meta-fields {
    grid-template-columns: 1fr;
  }
}
/* Offline copies in the desktop app. */
.sync-badge {
  cursor: pointer;
  color: inherit;
  font: inherit;
  font-size: 10px;
}
.sync-badge.attention {
  border-color: #e0a43a;
  background: #fff6e5;
}
.sync-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: grid;
  gap: 8px;
}
.sync-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.sync-list li > div:first-child,
.sync-list li span {
  display: grid;
  gap: 2px;
}
.sync-list span {
  color: var(--muted, #8590a2);
  font-size: 13px;
}
[data-theme="dark"] .sync-badge.attention {
  background: #3a2c12;
  border-color: #9a6d1f;
}

/* Worker actions must remain hidden until their stage is available. */
#modal [id^="plugin-"][hidden] {
  display: none;
}
#plugin-preview + footer {
  flex-wrap: wrap;
}
#plugin-preview section {
  margin-top: 1rem;
}

/* Metadata: suggested variable names. */
.meta-suggest {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.meta-suggest-head {
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.meta-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.meta-chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft, #eef0fd);
  color: inherit;
}
.meta-chip:hover:not(:disabled) {
  border-color: var(--accent, #5e69d6);
}
.ai-provider-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chat-history-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.chat-history-row .search-result {
  flex: 1;
  min-width: 0;
}
.chat-delete {
  flex-shrink: 0;
  min-width: 26px;
  height: 26px;
  border-radius: 6px;
  color: var(--muted);
  opacity: 0.55;
}
.chat-history-row:hover .chat-delete,
.chat-delete:focus-visible,
.chat-delete.armed {
  opacity: 1;
}
.chat-delete:hover,
.chat-delete.armed {
  color: #c43d4b;
}
.chat-delete.armed {
  padding: 0 6px;
  font-size: 12px;
}
.chat-delete-all {
  margin-top: 12px;
  font-size: 12px;
}
.chat-delete-all.armed {
  color: #c43d4b;
}
/* An AI chat tab beside a note: no sidebar, the conversation fills the pane. */
.editor-pane.chat-pane .sidebar,
.editor-pane.chat-pane.pane-browsing .sidebar {
  display: none;
}
.editor-pane.chat-pane .main,
.editor-pane.chat-pane.pane-browsing .main {
  margin-left: 0;
  width: 100%;
}
.ai-page.docked {
  padding: 18px 20px;
}
.ai-page.docked .ai-docked-heading {
  margin-bottom: 12px;
}
.ai-page.docked .ai-docked-heading h1 {
  font-size: 20px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-page.docked .ai-layout {
  grid-template-columns: 1fr;
}
.ai-page.docked .ai-history {
  order: 2;
  max-height: 180px;
  overflow: auto;
  padding: 14px;
}
.ai-page.docked .ai-history h3 {
  margin-top: 10px;
}
.ai-page.docked .ai-conversation {
  padding: 16px;
}
.ai-page.docked .chat-messages {
  max-height: calc(100vh - 380px);
}
/* Replies shown as note blocks. */
.chat-answer.chat-blocks {
  white-space: normal;
  line-height: 1.6;
}
.chat-block {
  position: relative;
  padding: 2px 64px 2px 8px;
  border-radius: 6px;
}
/* Reply blocks read like note blocks, not like panel captions. */
.ai-conversation .chat-block-body p,
.ai-conversation .chat-block-body li {
  font-size: 14px;
  color: inherit;
  margin: 0.35em 0;
}
.chat-block-body h1 {
  font-size: 1.45em;
}
.chat-block-body h2 {
  font-size: 1.25em;
}
.chat-block-body h3 {
  font-size: 1.1em;
}
.chat-block-body h1,
.chat-block-body h2,
.chat-block-body h3 {
  margin: 0.5em 0 0.25em;
}
.chat-block-body pre {
  padding: 12px;
  background: #f2f4f8;
  border-radius: 7px;
  overflow: auto;
}
.chat-block-body code {
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.chat-block-body :not(pre) > code {
  background: #f0f2f7;
  padding: 2px 4px;
  border-radius: 4px;
}
[data-theme="dark"] .chat-block-body pre,
[data-theme="dark"] .chat-block-body :not(pre) > code {
  background: #1d2432;
}
/* A docked chat has one fixed context. */
.ai-page.docked .ai-controls {
  grid-template-columns: 1fr;
}
.ai-page.docked .ai-controls label:first-child {
  display: none;
}
.chat-block:hover {
  background: var(--row-hover, #f4f5f9);
}
.chat-block-body > :first-child {
  margin-top: 0;
}
.chat-block-body > :last-child {
  margin-bottom: 0;
}
.chat-block-body pre {
  white-space: pre-wrap;
}
.chat-messages {
  overflow-x: hidden;
}
.chat-block-add {
  position: absolute;
  top: 2px;
  right: 4px;
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface, #fff);
  opacity: 0;
}
.chat-block:hover .chat-block-add,
.chat-block-add:focus-visible {
  opacity: 1;
}
.chat-reply-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 4px;
}
@media (hover: none) {
  .chat-block-add {
    opacity: 1;
  }
}

/* Default light: the landing page’s paper, forest and warm accent palette.
 * Plugin variants retain the original base, including Classic Light. */
:root:not([data-theme="dark"]):not([data-variant]) {
  --surface: #fffef9;
  --surface-alt: #f4f3ed;
  --ink: #243b31;
  --subtle: #626d62;
  --muted: #626d62;
  --border: #d5dbce;
  --line: #d5dbce;
  --accent: #2a493b;
  --soft: #e5ecb1;
  --row-hover: #edf0e7;
  --row-action-hover: #dfe6d5;
  --drop: #e5ecb1;
  color: var(--ink);
  background: var(--surface-alt);
}
:root:not([data-theme="dark"]):not([data-variant]) body,
:root:not([data-theme="dark"]):not([data-variant]) .main,
:root:not([data-theme="dark"]):not([data-variant]) .topbar {
  background: var(--surface-alt);
  color: var(--ink);
}
:root:not([data-theme="dark"]):not([data-variant]) .sidebar,
:root:not([data-theme="dark"]):not([data-variant]) .login-art {
  background: #edf0e7;
  border-color: var(--line);
}
:root:not([data-theme="dark"]):not([data-variant]) .document,
:root:not([data-theme="dark"]):not([data-variant]) .workspace-button,
:root:not([data-theme="dark"]):not([data-variant]) .workspace-menu,
:root:not([data-theme="dark"]):not([data-variant]) .folder-card,
:root:not([data-theme="dark"]):not([data-variant]) .note-card,
:root:not([data-theme="dark"]):not([data-variant]) .btn,
:root:not([data-theme="dark"]):not([data-variant]) dialog,
:root:not([data-theme="dark"]):not([data-variant]) input,
:root:not([data-theme="dark"]):not([data-variant]) select,
:root:not([data-theme="dark"]):not([data-variant]) textarea,
:root:not([data-theme="dark"]):not([data-variant]) .block-controls {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
:root:not([data-theme="dark"]):not([data-variant]) .editor-toolbar {
  background: #fffef9f5;
  border-color: var(--line);
}
:root:not([data-theme="dark"]):not([data-variant]) .page-heading h1,
:root:not([data-theme="dark"]):not([data-variant]) .welcome-copy h2,
:root:not([data-theme="dark"]):not([data-variant]) .login-art h1,
:root:not([data-theme="dark"]):not([data-variant]) .login-form h2,
:root:not([data-theme="dark"]):not([data-variant]) .doc-title {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
  letter-spacing: -0.035em;
  color: var(--ink);
}
:root:not([data-theme="dark"]):not([data-variant]) .doc-title {
  background: transparent;
  border: 0;
}
:root:not([data-theme="dark"]):not([data-variant]) .page-heading h1 {
  font-size: 34px;
}
:root:not([data-theme="dark"]):not([data-variant]) .btn,
:root:not([data-theme="dark"]):not([data-variant]) .workspace-button,
:root:not([data-theme="dark"]):not([data-variant]) input,
:root:not([data-theme="dark"]):not([data-variant]) select,
:root:not([data-theme="dark"]):not([data-variant]) textarea {
  border-radius: 5px;
}
:root:not([data-theme="dark"]):not([data-variant]) button:hover,
:root:not([data-theme="dark"]):not([data-variant]) .workspace-button:hover,
:root:not([data-theme="dark"]):not([data-variant])
  .workspace-button[aria-expanded="true"],
:root:not([data-theme="dark"]):not([data-variant]) .record-card:hover {
  background: #edf0e7;
}
:root:not([data-theme="dark"]):not([data-variant]) .btn.primary,
:root:not([data-theme="dark"]):not([data-variant])
  .db-embed-actions
  button.primary {
  background: #2a493b;
  border-color: #2a493b;
  color: #fffef9;
  box-shadow: none;
}
:root:not([data-theme="dark"]):not([data-variant]) .btn.primary:hover,
:root:not([data-theme="dark"]):not([data-variant])
  .db-embed-actions
  button.primary:hover {
  background: #3b5d4b;
}
:root:not([data-theme="dark"]):not([data-variant]) .nav button,
:root:not([data-theme="dark"]):not([data-variant]) .folder-button,
:root:not([data-theme="dark"]):not([data-variant]) label,
:root:not([data-theme="dark"]):not([data-variant]) .crumb strong {
  color: var(--ink);
}
:root:not([data-theme="dark"]):not([data-variant]) .nav button.active,
:root:not([data-theme="dark"]):not([data-variant]) .folder-button.active,
:root:not([data-theme="dark"]):not([data-variant]) .tree-row.active,
:root:not([data-theme="dark"]):not([data-variant]) .toolbar-group .selected,
:root:not([data-theme="dark"]):not([data-variant]) .view-toggle .active {
  background: #dfe6d5;
  color: #243b31;
}
:root:not([data-theme="dark"]):not([data-variant]) .welcome-banner {
  background: #e2e7d8;
  border-color: #d5dbce;
}
:root:not([data-theme="dark"]):not([data-variant]) .subtitle,
:root:not([data-theme="dark"]):not([data-variant]) .note-meta,
:root:not([data-theme="dark"]):not([data-variant]) .folder-card small,
:root:not([data-theme="dark"]):not([data-variant]) .doc-meta,
:root:not([data-theme="dark"]):not([data-variant]) .save-status,
:root:not([data-theme="dark"]):not([data-variant]) .panel p,
:root:not([data-theme="dark"]):not([data-variant]) dialog p,
:root:not([data-theme="dark"]):not([data-variant]) .login-form p,
:root:not([data-theme="dark"]):not([data-variant]) .welcome-copy p,
:root:not([data-theme="dark"]):not([data-variant]) .welcome-copy .eyebrow,
:root:not([data-theme="dark"]):not([data-variant]) .section-label,
:root:not([data-theme="dark"]):not([data-variant]) .server-status,
:root:not([data-theme="dark"]):not([data-variant]) .note-preview {
  color: #626d62;
}
:root:not([data-theme="dark"]):not([data-variant]) .note-preview {
  background: #edf0e7;
  border-color: var(--line);
}
:root:not([data-theme="dark"]):not([data-variant])
  .note-card:nth-child(3n + 2)
  .note-preview {
  background: #f0f2df;
}
:root:not([data-theme="dark"]):not([data-variant])
  .note-card:nth-child(3n)
  .note-preview {
  background: #f5e9df;
}
:root:not([data-theme="dark"]):not([data-variant]) .preview-lines i,
:root:not([data-theme="dark"]):not([data-variant]) .art-sheet i {
  background: #d5dbce;
}
:root:not([data-theme="dark"]):not([data-variant]) .art-sheet {
  background: #fffef9;
  border-color: #d5dbce;
  box-shadow: 0 12px 30px #263c3010;
}
:root:not([data-theme="dark"]):not([data-variant]) .art-sticky {
  background: #e5ecb1;
  color: #243b31;
}
:root:not([data-theme="dark"]):not([data-variant]) .art-star,
:root:not([data-theme="dark"]):not([data-variant]) .preview-symbol {
  color: #6c7b4c;
}
:root:not([data-theme="dark"]):not([data-variant]) .folder-icon,
:root:not([data-theme="dark"]):not([data-variant]) .square,
:root:not([data-theme="dark"]):not([data-variant]) .badge,
:root:not([data-theme="dark"]):not([data-variant]) .shortcut,
:root:not([data-theme="dark"]):not([data-variant]) .tag {
  background: #edf0e7;
  border-color: #d5dbce;
  color: #2a493b;
}
:root:not([data-theme="dark"]):not([data-variant])
  .folder-card:nth-child(3n + 2)
  .folder-icon {
  background: #e5ecb1;
  color: #52633c;
}
:root:not([data-theme="dark"]):not([data-variant])
  .folder-card:nth-child(3n)
  .folder-icon,
:root:not([data-theme="dark"]):not([data-variant]) .avatar {
  background: #f5e3d5;
  color: #934729;
}
:root:not([data-theme="dark"]):not([data-variant]) .folder-row .tree-icon,
:root:not([data-theme="dark"]):not([data-variant]) .section-toggle {
  color: #6c7b4c;
}
:root:not([data-theme="dark"]):not([data-variant]) .text-link,
:root:not([data-theme="dark"]):not([data-variant]) .tabs .active {
  color: #2a493b;
  border-color: #2a493b;
}
:root:not([data-theme="dark"]):not([data-variant]) .block blockquote {
  background: #f0f2df;
  border-color: #a1ae69;
  color: #3e503c;
}
:root:not([data-theme="dark"]):not([data-variant]) .block pre,
:root:not([data-theme="dark"]):not([data-variant]) .block code {
  background: #edf0e7;
}
:root:not([data-theme="dark"]):not([data-variant]) .block pre code {
  background: transparent;
}
:root:not([data-theme="dark"]):not([data-variant]) mark {
  background: #e5ecb1;
  color: #243b31;
}
:root:not([data-theme="dark"]):not([data-variant]) .pill,
:root:not([data-theme="dark"]):not([data-variant]) .peer {
  background: #e2e7d8;
  color: #2a493b;
}
:root:not([data-theme="dark"]):not([data-variant]) .admin-table th,
:root:not([data-theme="dark"]):not([data-variant]) .db-embed-head {
  background: #edf0e7;
}
:root:not([data-theme="dark"]):not([data-variant]) input::placeholder,
:root:not([data-theme="dark"]):not([data-variant]) textarea::placeholder {
  color: #737d70;
}
:root:not([data-theme="dark"]):not([data-variant]) button:focus-visible,
:root:not([data-theme="dark"]):not([data-variant]) a:focus-visible,
:root:not([data-theme="dark"]):not([data-variant]) input:focus,
:root:not([data-theme="dark"]):not([data-variant]) textarea:focus,
:root:not([data-theme="dark"]):not([data-variant]) select:focus {
  outline: 2px solid #c4623e;
  outline-offset: 3px;
}
:root:not([data-theme="dark"]):not([data-variant]) .form-error,
:root:not([data-theme="dark"]):not([data-variant]) .btn.danger {
  color: #a03d37;
}
:root:not([data-theme="dark"]):not([data-variant]) .note-tab.active {
  background: #fffef9;
  border-top-color: #2a493b;
}
:root:not([data-theme="dark"]):not([data-variant]) .art-sheet::before {
  color: #6c7b4c;
}

/* Flashcards: shared theme tokens keep study sessions calm in every theme. */
.flashcards-page {
  max-width: 1120px;
}
.fc-intro,
.fc-deck-heading,
.fc-review-meta {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 24px;
}
.fc-actions,
.fc-ratings {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.fc-decks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}
.fc-deck,
.fc-card-row,
.fc-study,
.fc-draft {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px;
}
.fc-deck {
  text-align: left;
  min-height: 160px;
}
.fc-deck strong {
  font-size: 21px;
}
.fc-deck p,
.fc-card-row p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.fc-deck span,
.fc-card-row small {
  color: var(--subtle);
}
.fc-form {
  max-width: 700px;
  display: grid;
  gap: 18px;
}
.fc-form label,
.fc-draft label {
  display: grid;
  gap: 8px;
}
.fc-form [hidden] {
  display: none;
}
.fc-form textarea,
.fc-draft textarea {
  width: 100%;
  resize: vertical;
}
.fc-form .fc-actions {
  margin-top: 12px;
}
.fc-card-list {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.fc-card-row {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 20px;
}
.fc-card-row > div {
  min-width: 0;
}
.fc-card-row strong {
  overflow-wrap: anywhere;
}
.fc-study {
  max-width: 800px;
  margin: 24px auto;
  padding: clamp(24px, 5vw, 56px);
  text-align: center;
}
.fc-face {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 24px;
  line-height: 1.6;
  margin: 24px 0;
}
.fc-study hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 28px 0;
}
.fc-ratings {
  justify-content: center;
}
.fc-ratings button {
  display: flex;
  flex-direction: column;
  min-width: 100px;
}
.fc-ratings small {
  font-size: 11px;
}
.fc-sources {
  margin-top: 12px;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.fc-draft {
  display: grid;
  gap: 16px;
  margin: 20px 0;
}
.fc-draft legend {
  padding: 0 8px;
}
.fc-draft legend label {
  display: flex;
  align-items: center;
}
.flashcards-page [hidden] {
  display: none;
}
.fc-picture {
  display: block;
  max-width: 100%;
  max-height: 360px;
  margin: 8px auto;
  border-radius: 6px;
}
.fc-card-row .fc-picture {
  max-height: 120px;
  margin: 6px 0;
}
.user-actions {
  white-space: nowrap;
}
.user-actions .btn + .btn {
  margin-left: 6px;
}

/* Workspace menu: places (this computer, each server) and their workspaces. */
.workspace-menu .menu-heading {
  display: grid;
  gap: 1px;
  padding: 8px 6px 4px;
}
.workspace-menu .menu-heading strong {
  font-size: 12px;
  font-weight: 650;
}
.workspace-menu .menu-heading small,
.workspace-menu .menu-hint {
  color: var(--muted);
  font-size: 11px;
  font-weight: 400;
}
.workspace-menu .menu-hint {
  margin-left: auto;
  white-space: nowrap;
}
.workspace-menu .menu-row {
  display: flex;
  align-items: center;
  gap: 2px;
}
.workspace-menu .menu-row > button:first-child {
  flex: 1;
  min-width: 0;
}
.workspace-menu .menu-icon {
  width: auto;
  flex: none;
  padding: 6px;
  color: var(--muted);
}
.workspace-menu .menu-icon:hover {
  color: var(--accent);
}
.workspace-menu .menu-hint svg {
  width: 13px;
  height: 13px;
}
.workspace-menu .workspace-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Overview dashboard: rows of widgets on a four-column grid, each row filled. */
.dashboard-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin: -8px 0 16px;
}
.dashboard-bar .dash-hint {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}
.dashboard {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}
.widget {
  position: relative;
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface, #fff);
}
.widget {
  grid-column: span var(--span, 4);
}
@media (max-width: 900px) {
  .dashboard {
    grid-template-columns: minmax(0, 1fr);
  }
  .widget {
    grid-column: 1 / -1;
  }
}
.widget-welcome {
  padding: 0;
  border: 0;
  background: none;
}
.widget-welcome .welcome-banner {
  margin: 0;
}
.widget-dismiss {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: var(--muted);
}
.widget-dismiss:hover {
  background: var(--soft);
  color: inherit;
}
.widget-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.widget-head h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.widget-tools {
  display: flex;
  align-items: center;
  gap: 4px;
}
.widget-welcome .widget-tools {
  justify-content: flex-end;
  margin-bottom: 8px;
}
.widget-tools button,
.widget-tools select {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface, #fff);
  font-size: 12px;
}
.dashboard.editing .widget {
  cursor: grab;
  user-select: none;
  touch-action: none;
  outline: 1px dashed var(--line);
  outline-offset: 3px;
}
/* Lifted while dragged; the pointer sees the widgets underneath. */
.dashboard .widget.dragging {
  position: relative;
  z-index: 20;
  opacity: 0.85;
  pointer-events: none;
  box-shadow: 0 18px 40px rgb(0 0 0 / 0.18);
}
body.dragging-widget,
body.dragging-widget * {
  cursor: grabbing !important;
}
/* Where a dragged widget will land: a bar beside it, or above or below its row. */
.dashboard.editing .widget[data-drop]::after {
  content: "";
  position: absolute;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
}
.widget[data-drop="before"]::after,
.widget[data-drop="after"]::after {
  top: 0;
  bottom: 0;
  width: 4px;
}
.widget[data-drop="before"]::after {
  left: -11px;
}
.widget[data-drop="after"]::after {
  right: -11px;
}
.widget[data-drop="above"]::after,
.widget[data-drop="below"]::after {
  left: 0;
  right: 0;
  height: 4px;
}
.widget[data-drop="above"]::after {
  top: -11px;
}
.widget[data-drop="below"]::after {
  bottom: -11px;
}
.widget-loading,
.widget-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
.widget-action {
  margin-top: 12px;
}
.widget-notes {
  display: grid;
  gap: 2px;
}
.widget-note {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  text-align: left;
}
.widget-note:hover {
  background: var(--soft);
}
.widget-note strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  font-size: 13px;
}
.widget-note small {
  color: var(--muted);
  font-size: 11px;
}
.calendar.compact .calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.calendar.compact .calendar-grid .day {
  font-size: 12px;
  border-radius: 6px;
}
.widget-due {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
}
.widget-due strong {
  color: var(--ink, inherit);
  font-size: 18px;
}
.widget-card {
  padding: 14px;
  border-radius: 10px;
  background: var(--soft);
}
.widget-card-face {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.55;
}
.widget-card .fc-ratings {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.widget-card .fc-ratings small {
  display: block;
  font-size: 10px;
  color: var(--muted);
}
.widget-picker .widget-choices {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
  margin: 12px 0;
}
.widget-choice {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
}
.widget-choice:hover {
  border-color: var(--accent);
}
.widget-choice small {
  color: var(--muted);
}
/* Charts: one hue for bars; the reference categorical order for pie slices,
   stepped separately for the dark theme. */
.widget-chart {
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #6250d6;
  --chart-track: #eef0f4;
}
@media (prefers-color-scheme: dark) {
  :root:where(:not([data-theme="light"])) .widget-chart {
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --series-4: #c98500;
    --series-5: #d55181;
    --series-6: #008300;
    --series-7: #9085e9;
    --chart-track: #252b38;
  }
}
:root[data-theme="dark"] .widget-chart {
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #008300;
  --series-7: #9085e9;
  --chart-track: #252b38;
}
.chart-bars {
  display: grid;
  gap: 8px;
}
.chart-bar {
  display: grid;
  grid-template-columns: minmax(60px, 30%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.chart-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chart-track {
  height: 12px;
  border-radius: 4px;
  background: var(--chart-track);
  overflow: hidden;
}
.chart-fill {
  display: block;
  height: 100%;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
}
.chart-value {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.chart-caption {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}
.chart-pie {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
}
.chart-pie svg {
  width: 140px;
  height: 140px;
  flex: none;
}
.chart-pie .slice {
  stroke: var(--surface, #fff);
  stroke-width: 1.5;
}
.chart-legend {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 13px;
}
.chart-legend li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}
.chart-legend small {
  color: var(--muted);
}
.swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}
.slice.s1,
.swatch.s1 {
  fill: var(--series-1);
  background: var(--series-1);
}
.slice.s2,
.swatch.s2 {
  fill: var(--series-2);
  background: var(--series-2);
}
.slice.s3,
.swatch.s3 {
  fill: var(--series-3);
  background: var(--series-3);
}
.slice.s4,
.swatch.s4 {
  fill: var(--series-4);
  background: var(--series-4);
}
.slice.s5,
.swatch.s5 {
  fill: var(--series-5);
  background: var(--series-5);
}
.slice.s6,
.swatch.s6 {
  fill: var(--series-6);
  background: var(--series-6);
}
.slice.s7,
.swatch.s7 {
  fill: var(--series-7);
  background: var(--series-7);
}
.calendar.compact .calendar-head strong {
  font-size: 13px;
  white-space: nowrap;
}
/* Server overview: the administrator's statistics. */
.server-overview .panel {
  padding: 20px 22px;
}
.server-overview .panel h2 {
  margin: 0 0 6px;
}
.server-overview .panel > p {
  margin: 0 0 16px;
  color: var(--muted);
}
.server-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.server-stat-grid strong {
  display: block;
  font-size: 30px;
  margin-top: 12px;
}
.server-storage {
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}
.storage-pie {
  width: 180px;
  height: 180px;
  border-radius: 50%;
  flex: none;
}
.legacy-workspace {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
}

/* Sharing: one row per workspace, note, or site, with who can see it. */
.sharing-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}
.sharing-stat {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface, #fff);
}
.sharing-stat svg {
  grid-row: span 2;
  width: 22px;
  height: 22px;
  color: var(--accent);
}
.sharing-stat strong {
  font-size: 24px;
  line-height: 1.1;
}
.sharing-stat span {
  color: var(--muted);
  font-size: 13px;
}
.sharing-section {
  padding: 20px 22px;
  margin-bottom: 18px;
}
.sharing-section .panel-heading {
  align-items: flex-start;
  gap: 16px;
  padding: 0 0 14px;
}
.sharing-section .panel-heading h2 {
  margin: 0 0 4px;
}
.sharing-group {
  margin: 18px 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.sharing-rows {
  display: grid;
}
.sharing-row {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.sharing-what {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.sharing-what > div {
  display: grid;
  min-width: 0;
}
.sharing-what strong,
.sharing-what .text-link {
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
  font-weight: 600;
}
.sharing-what small {
  color: var(--muted);
  font-size: 12px;
}
.sharing-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--line);
}
.sharing-icon svg {
  width: 17px;
  height: 17px;
}
.sharing-who {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px 3px 10px;
  border-radius: 99px;
  background: var(--line);
  font-size: 13px;
}
.person-chip small {
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--surface, #fff);
  color: var(--muted);
  font-size: 11px;
}
.sharing-who .pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.sharing-who .pill svg {
  width: 13px;
  height: 13px;
}
.pill-public {
  color: var(--accent);
  text-decoration: none;
}
.sharing-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.sharing-actions svg {
  width: 15px;
  height: 15px;
}
.sharing-empty {
  margin: 8px 0 0;
  color: var(--muted);
}
.segmented {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.segmented button {
  padding: 5px 11px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--muted);
}
.segmented button.active {
  background: var(--line);
  color: var(--ink);
}
@media (max-width: 800px) {
  .sharing-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .sharing-actions {
    justify-content: flex-start;
  }
  .sharing-section .panel-heading {
    flex-direction: column;
  }
}

/* The `@` picker: who can open the note. */
.link-picker small {
  margin-left: 6px;
  color: var(--muted);
  font-size: 12px;
}
.mention-avatar {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border-radius: 50%;
  background: #e8f3ec;
  color: #2a6a49;
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

/* Sharing a workspace: invite row, then the people with access. */
dialog:has(.share-workspace) {
  width: min(560px, 92vw);
}
.share-workspace select {
  min-width: 0;
}
.share-invite select[name="role"] {
  width: auto;
}
.share-workspace header h2 {
  margin: 0 0 6px;
}
.share-workspace header p,
.share-hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}
.share-invite {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  margin-bottom: 22px;
}
.share-subtitle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.share-subtitle span {
  padding: 0 7px;
  border-radius: 99px;
  background: var(--line);
  font-size: 11px;
}
.share-people {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
.share-person {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.share-person:first-child {
  border-top: 0;
}
.share-person select {
  width: auto;
  padding: 5px 28px 5px 10px;
  font-size: 13px;
}
.share-person .pill {
  grid-column: span 2;
  justify-self: end;
}
.share-avatar {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--line);
  font-weight: 600;
}
.share-person-name {
  display: grid;
  min-width: 0;
}
.share-person-name strong,
.share-person-name > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.share-person-name strong small {
  font-weight: 400;
  color: var(--muted);
}
.share-person-name > small {
  color: var(--muted);
  font-size: 12px;
}
.share-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 18px;
}
.share-remove:hover {
  color: #c4623e;
}
.share-workspace footer {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}
@media (max-width: 560px) {
  .share-invite {
    grid-template-columns: 1fr;
  }
}

/* A note tab is in front: the page under it is not the current one. Wins
   over every theme's highlight. */
body.note-tab-shown .sidebar .nav .active,
body.note-tab-shown .sidebar .tree-row.active {
  background: none !important;
  color: inherit !important;
  font-weight: inherit !important;
}

/* Ask AI, refreshed: a full-height conversation with the question box pinned
   at the bottom, replies introduced by who answers, compact sources. */
.ai-disclosure {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.ai-disclosure summary {
  cursor: pointer;
  width: fit-content;
}
.ai-disclosure p {
  margin: 6px 0 0;
}
.chat-reply {
  display: grid;
  gap: 8px;
}
.chat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.chat-meta strong {
  color: var(--ink);
  font-weight: 600;
}
.chat-avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 13px;
}
.chat-answer {
  border-radius: 14px;
}
.chat-answer.chat-pending {
  display: flex;
  align-items: center;
  gap: 10px;
  font-style: normal;
}
.chat-dots {
  display: inline-flex;
  gap: 4px;
}
.chat-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: chat-dot 1.2s infinite ease-in-out;
}
.chat-dots i:nth-child(2) {
  animation-delay: 0.15s;
}
.chat-dots i:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes chat-dot {
  0%,
  80%,
  100% {
    opacity: 0.25;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .chat-dots i {
    animation: none;
    opacity: 0.6;
  }
}
.chat-sources {
  margin: 0;
}
.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 10px 3px 4px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: transparent;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-chip:hover {
  border-color: var(--accent);
}
.source-number {
  padding: 1px 6px;
  border-radius: 99px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
}
.chat-usage {
  font-size: 11px;
  color: var(--muted);
}
.chat-reply-actions .btn {
  padding: 4px 10px;
  font-size: 12px;
}
/* The question box: grows with the text, send button inside. */
.chat-composer {
  margin-top: 10px;
}
.chat-input {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface, #fff);
}
.chat-input:focus-within {
  border-color: var(--accent);
}
.chat-input textarea#chat-question {
  flex: 1;
  min-height: 24px;
  max-height: 220px;
  padding: 4px 0;
  border: 0;
  outline: 0;
  background: transparent;
  resize: none;
  box-shadow: none;
}
.chat-send {
  flex: none;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 50%;
  font-size: 17px;
}
.chat-composer .chat-compose-actions {
  margin-top: 6px;
}
.chat-composer #stop-chat:disabled {
  visibility: hidden;
}
/* Beside a note: the conversation fills the panel. */
.ai-page.docked {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 14px 16px;
  box-sizing: border-box;
}
.ai-page.docked .ai-docked-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.ai-page.docked .ai-docked-heading h1 {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  font-size: 17px;
}
.ai-heading-actions {
  display: flex;
  flex: none;
  gap: 6px;
}
.ai-heading-actions .btn {
  padding: 5px 10px;
  font-size: 12px;
}
.ai-page.docked .ai-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.ai-page.docked .ai-history {
  order: 0;
  flex: none;
  max-height: 40vh;
}
.ai-page.docked .ai-conversation {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
}
.ai-page.docked .chat-messages {
  flex: 1;
  min-height: 0;
  max-height: none;
}
.ai-page.docked .ai-controls label {
  font-size: 12px;
}
/* Tables in replies read like tables in notes. */
.chat-block-body table {
  border-collapse: collapse;
  margin: 0.4em 0;
  font-size: 13px;
}
.chat-block-body th,
.chat-block-body td {
  padding: 5px 12px;
  border: 1px solid var(--line);
  text-align: left;
}
.chat-block-body th {
  background: var(--line);
}
/* The chat tab fills its frame; only the conversation scrolls. */
html.editor-pane.chat-pane,
html.editor-pane.chat-pane body {
  overflow: hidden;
}
/* Every theme keeps the chat heading compact and the send button round. */
.ai-page.docked .ai-docked-heading h1 {
  font-family: inherit !important;
  font-size: 17px !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
}
.chat-input .chat-send {
  border-radius: 50% !important;
}

/* Emoji pickers: the note icon and /emoji. */
.emoji-picker {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(360px, 82vw);
}
.emoji-dialog .emoji-picker {
  width: 100%;
}
.emoji-search {
  width: 100%;
}
.emoji-tabs {
  display: flex;
  justify-content: space-between;
  gap: 2px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.emoji-tabs button {
  padding: 4px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
}
.emoji-grid {
  height: 280px;
  overflow-y: auto;
}
.emoji-grid h4 {
  position: sticky;
  top: 0;
  margin: 0;
  padding: 6px 2px 4px;
  background: var(--surface, #fff);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.emoji-set {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
}
.emoji-set button {
  height: 36px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
}
.emoji-set button:hover,
.emoji-set button:focus-visible,
.emoji-tabs button:hover {
  background: var(--line);
}
.emoji-name,
.emoji-empty,
.emoji-loading {
  margin: 0;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}
.emoji-tabs[hidden] {
  display: none;
}

/* Files in notes: a card with the file's type, name, size and date. */
.file-card {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 560px;
  margin: 4px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface, #fff);
}
.file-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: var(--line);
  font-size: 22px;
}
.file-pdf .file-icon {
  background: #fbe3e1;
}
.file-image .file-icon,
.file-video .file-icon {
  background: #e3ecfb;
}
.file-audio .file-icon {
  background: #ece3fb;
}
.file-sheet .file-icon {
  background: #e1f4e6;
}
[data-theme="dark"] .file-icon {
  background: #2b3445;
}
.file-info {
  display: grid;
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}
.file-info strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-info small {
  color: var(--muted);
  font-size: 12px;
}
.file-actions {
  display: flex;
  flex: none;
  gap: 6px;
}
.file-actions .btn {
  padding: 5px 12px;
  font-size: 13px;
  text-decoration: none;
}
@media (max-width: 560px) {
  .file-card {
    flex-wrap: wrap;
  }
}
/* Reminders page: category filters, then the reminders grouped by when they
   are due, each with a small calendar leaf. */
.reminder-notice {
  margin: -12px 0 22px;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  font-size: 13px;
}
.reminder-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 26px;
}
.reminder-filters button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
}
.reminder-filters button.active {
  border-color: var(--accent);
  background: var(--soft);
  color: var(--accent);
}
.reminder-filters .count,
.reminder-group .count,
.reminder-past .count {
  font-size: 11px;
  opacity: 0.7;
}
.cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--cat);
}
.reminder-group h2,
.reminder-past summary {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
.reminder-group.due h2 {
  color: #c2410c;
}
.reminder-group {
  margin-bottom: 26px;
}
.reminder-group ul,
.reminder-past ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.reminder-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
}
.reminder-row + .reminder-row {
  border-top: 1px solid var(--line);
}
.reminder-row.due .reminder-date {
  border-color: #f0b490;
  color: #c2410c;
}
.reminder-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 3px 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  line-height: 1.1;
}
.reminder-date b {
  font-size: 17px;
}
.reminder-date span {
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
}
.reminder-main {
  min-width: 0;
}
.reminder-main strong {
  display: block;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.reminder-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
}
.reminder-meta .text-link {
  font-size: 12px;
  padding: 0;
}
.reminder-cat {
  padding: 0 8px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  color: var(--cat);
  font-weight: 550;
}
.reminder-actions {
  display: flex;
  gap: 6px;
}
.reminder-actions .btn {
  padding: 4px 10px;
  font-size: 12px;
}
.reminder-past {
  margin-bottom: 26px;
}
.reminder-past summary {
  cursor: pointer;
  margin-bottom: 8px;
}
.reminder-past .reminder-row {
  opacity: 0.7;
}
.reminder-custom {
  display: flex;
  gap: 10px;
}
.reminder-custom[hidden] {
  display: none;
}
.reminder-custom label {
  flex: 1;
}
.reminder-suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: -4px 0 10px;
}
.reminder-suggest button {
  padding: 2px 10px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--cat) 14%, transparent);
  color: var(--cat);
  font-size: 12px;
}
@media (max-width: 640px) {
  .reminder-row {
    grid-template-columns: 40px 1fr;
  }
  .reminder-actions {
    grid-column: 2;
  }
}
