:root {
  --midnight-blue: #0d1b2a;
  --deep-sea-blue: #1b2f45;
  --coral: #e2584b;
  --midnight-rgb: 13 27 42;
  --deep-sea-rgb: 27 47 69;
  --coral-rgb: 226 88 75;
  --paper: #f7f6f2;
  --panel: #efeee9;
  --panel-strong: #e2e7e9;
  --browser-surface: #f5f6f4;
  --surface: #fffdf9;
  --surface-translucent: rgb(255 253 249 / 86%);
  --topbar: rgb(255 253 249 / 92%);
  --note-card-surface: rgb(255 255 255 / 46%);
  --ink: var(--midnight-blue);
  --muted: #526477;
  --faint: #718093;
  --line: #d8dde1;
  --accent: var(--coral);
  --accent-soft: #fbe7e3;
  --on-accent: #fffaf7;
  --danger: #b94339;
  --information: #47749b;
  --shadow: 0 18px 52px rgb(var(--midnight-rgb) / 14%);
  --shadow-soft: 0 7px 24px rgb(var(--midnight-rgb) / 8%);
  --sidebar-width: 232px;
  --browser-width: 260px;
  --resizer-width: 10px;
  --ui-font: var(--text-font);
  --editor-background: #fbfcfd;
  --editor-gutter-background: #f3f5f7;
  --editor-panel: #f3f5f7;
  --editor-input: #fff;
  --editor-foreground: #16283a;
  --editor-muted: #607286;
  --editor-gutter-foreground: #8995a2;
  --editor-active-gutter-foreground: #273e55;
  --editor-line: #dce2e7;
  --editor-active-line: rgb(var(--deep-sea-rgb) / 4%);
  --editor-selection: #c6dcec;
  --editor-selection-match: #dce9cc;
  --editor-search-match: #f4dcae;
  --editor-search-selected: #efc575;
  --editor-search-outline: #b78939;
  --editor-caret: var(--coral);
  --editor-syntax-keyword: #9d326b;
  --editor-syntax-name: #235f8c;
  --editor-syntax-function: #6c4c9c;
  --editor-syntax-constant: #a55216;
  --editor-syntax-definition: #16706a;
  --editor-syntax-type: #8c4932;
  --editor-syntax-tag: #79408a;
  --editor-syntax-link: #256b9b;
  --editor-syntax-comment: #657669;
  --editor-syntax-string: #4f792b;
  --editor-syntax-invalid: #b4232f;
  --text-font:
    "Segoe UI Variable Text", ui-sans-serif, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Noto Sans", "PingFang SC", "Microsoft YaHei", Helvetica, Arial,
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --document-font:
    ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display",
    "Segoe UI", "PingFang SC", "Microsoft YaHei", Helvetica, Arial, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji";
  --mono-font:
    "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --document-mono-font:
    "SFMono-Regular", Menlo, Consolas, "PT Mono", "Liberation Mono", Courier,
    monospace;
  --document-inline-code: #eb5757;
  --document-inline-code-background: rgb(135 131 120 / 15%);
  --document-code-background: rgb(135 131 120 / 15%);
  --document-divider: rgb(55 53 47 / 16%);
  --document-surface: #fff;
  --document-ink: #37352f;
  --document-selection: rgb(35 131 226 / 28%);
  color-scheme: light;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--text-font);
  font-synthesis: none;
}

html[data-theme="dark"] {
  --paper: #0c1624;
  --panel: #142337;
  --panel-strong: #24384d;
  --browser-surface: #101e2e;
  --surface: #132236;
  --surface-translucent: rgb(var(--deep-sea-rgb) / 84%);
  --topbar: rgb(12 22 36 / 92%);
  --note-card-surface: rgb(255 255 255 / 2.5%);
  --ink: #f5f7fa;
  --muted: #afbdca;
  --faint: #8194a7;
  --line: #2c4054;
  --accent: var(--coral);
  --accent-soft: #412d34;
  --on-accent: #fff9f7;
  --danger: #f07a6f;
  --document-inline-code: #cf5148;
  --document-inline-code-background: rgb(255 255 255 / 5.5%);
  --document-code-background: rgb(252 252 252 / 3%);
  --document-divider: rgb(255 255 235 / 10%);
  --document-surface: #191919;
  --document-ink: #f0efed;
  --information: #7aa3c4;
  --shadow: 0 20px 60px rgb(0 0 0 / 32%);
  --shadow-soft: 0 8px 28px rgb(0 0 0 / 18%);
  --editor-background: #0f1c2b;
  --editor-gutter-background: #0c1825;
  --editor-panel: #17283a;
  --editor-input: #0d1b2a;
  --editor-foreground: #dbe6f0;
  --editor-muted: #91a4b7;
  --editor-gutter-foreground: #62778b;
  --editor-active-gutter-foreground: #dbe6f0;
  --editor-line: #24384b;
  --editor-active-line: rgb(255 255 255 / 3.8%);
  --editor-selection: #244f70;
  --editor-selection-match: #334f3c;
  --editor-search-match: #604e29;
  --editor-search-selected: #846429;
  --editor-search-outline: #d1a74f;
  --editor-caret: #ff8175;
  --editor-syntax-keyword: #ef82b5;
  --editor-syntax-name: #82c6f3;
  --editor-syntax-function: #c4a7ef;
  --editor-syntax-constant: #f0a76f;
  --editor-syntax-definition: #67d5c8;
  --editor-syntax-type: #f3b49a;
  --editor-syntax-tag: #d6a2e3;
  --editor-syntax-link: #71b8e6;
  --editor-syntax-comment: #829580;
  --editor-syntax-string: #a7ce84;
  --editor-syntax-invalid: #ff8175;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
  scrollbar-color: var(--line) transparent;
  scrollbar-width: thin;
}

::selection {
  color: var(--ink);
  background: var(--accent-soft);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-size: 15px;
  transition: color 160ms, background 160ms;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

[hidden] {
  display: none !important;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--faint);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
  background:
    radial-gradient(
      circle at 16% 20%,
      rgb(var(--coral-rgb) / 11%),
      transparent 28%
    ),
    radial-gradient(
      circle at 85% 78%,
      rgb(var(--deep-sea-rgb) / 12%),
      transparent 32%
    ),
    var(--paper);
}

.login-card {
  width: min(100%, 420px);
  padding: 46px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface-translucent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.login-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin-bottom: 30px;
  place-items: center;
  border-radius: 17px;
  color: var(--surface);
  background: var(--ink);
  font-family: Georgia, serif;
  font-size: 27px;
}

.login-card h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(32px, 7vw, 45px);
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.05;
}

.login-copy {
  margin: 18px 0 34px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.login-card label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.login-card input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: var(--surface);
  transition: border-color 140ms, box-shadow 140ms;
}

.login-card input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--coral-rgb) / 12%);
}

.primary-button {
  width: 100%;
  height: 48px;
  margin-top: 12px;
  border-radius: 10px;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
  font-weight: 650;
  transition: transform 120ms, background 120ms;
}

.primary-button:hover {
  filter: brightness(1.18);
}

.primary-button:active {
  transform: translateY(1px);
}

.form-error {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 12px;
  text-align: center;
}

.workspace {
  --active-browser-width: var(--browser-width);
  --active-browser-resizer-width: var(--resizer-width);

  display: grid;
  min-height: 100vh;
  align-items: start;
  grid-template-columns:
    var(--active-browser-width) var(--active-browser-resizer-width)
    minmax(0, 1fr);
}

.workspace.browser-collapsed {
  --active-browser-width: 58px;
  --active-browser-resizer-width: 0px;
}

.workspace.browser-collapsed .sidebar > :not(.brand, .sidebar-browser-expand) {
  display: none;
}

.workspace.browser-collapsed .brand > span:last-child {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  height: 100vh;
  width: 100%;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  flex-direction: column;
  padding: 14px 10px 10px;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgb(var(--coral-rgb) / 4%), transparent 180px),
    var(--panel);
  box-shadow: inset -1px 0 rgb(255 255 255 / 16%);
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 5px 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.sidebar-browser-expand {
  position: absolute;
  z-index: 2;
  top: 70px;
  right: 15px;
  color: var(--ink);
}

.brand:hover {
  border-color: var(--line);
  background: var(--panel-strong);
}

.brand-mark {
  display: grid;
  width: 32px;
  height: 32px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 8px;
  color: var(--surface);
  background: var(--ink);
  font-family: Georgia, serif;
  box-shadow: 0 5px 12px rgb(var(--midnight-rgb) / 14%);
  font-size: 16px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 12px;
}

.brand small {
  margin-top: 1px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 500;
}

.layer-nav {
  margin-top: 14px;
}

.nav-section {
  min-width: 0;
}

.nav-section-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 3px;
  padding: 4px 7px;
  border-radius: 4px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-align: left;
}

.nav-section-toggle:hover {
  color: var(--ink);
  background: var(--panel-strong);
}

.nav-section-toggle:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.ui-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.nav-section-chevron {
  width: 14px;
  height: 14px;
  transition: transform 140ms;
}

.nav-section-toggle[aria-expanded="false"] .nav-section-chevron {
  transform: rotate(-90deg);
}

.nav-section.collapsed .nav-section-content {
  display: none;
}

.nav-section-heading {
  display: flex;
  align-items: center;
}

.nav-section-heading .nav-section-toggle {
  flex: 1;
}

.nav-section-heading #clear-tag {
  margin: 13px 7px 0 2px;
  padding: 5px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
}

.nav-section-heading #clear-tag:hover {
  color: var(--ink);
}

.explorer-section {
  display: flex;
  min-height: 180px;
  flex: 1 1 auto;
  flex-direction: column;
}

.explorer-section-heading,
.explorer-mode-row {
  display: flex;
  min-width: 0;
  align-items: center;
}

.explorer-section-heading .nav-section-toggle {
  min-width: 0;
  flex: 1;
}

.explorer-actions {
  display: flex;
  align-items: center;
  gap: 1px;
  padding-top: 5px;
}

.explorer-actions button {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 4px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
}

.explorer-actions button:hover,
.explorer-actions button:focus-visible {
  color: var(--ink);
  background: var(--panel-strong);
}

.explorer-actions svg,
.explorer-search-box svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.65;
}

.explorer-section > .nav-section-content {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.explorer-section.collapsed {
  min-height: 0;
  flex: 0 0 auto;
}

.explorer-search-box {
  display: flex;
  height: 30px;
  align-items: center;
  gap: 7px;
  margin: 0 4px 5px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--faint);
  background: var(--surface-translucent);
}

.explorer-search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(var(--coral-rgb) / 10%);
}

.explorer-search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 11px;
}

.explorer-mode-row {
  justify-content: space-between;
  gap: 6px;
}

.explorer-mode-row .browse-mode-switch {
  min-width: 0;
  flex: 1;
}

.explorer-mode-row #clear-tag {
  padding: 5px 7px;
  border-radius: 5px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  white-space: nowrap;
}

.explorer-mode-row #clear-tag:hover {
  color: var(--ink);
  background: var(--panel-strong);
}

.nav-label {
  margin: 25px 10px 8px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.nav-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-label-row .nav-label {
  margin-top: 18px;
}

.nav-label-row button {
  margin: 12px 8px 0 0;
  padding: 4px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
}

.nav-label-row button:hover {
  color: var(--ink);
}

.nav-item,
.sidebar-action {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  text-decoration: none;
  transition: border-color 120ms, background 120ms, color 120ms;
}

.nav-item:hover,
.sidebar-action:hover,
.nav-item.active {
  color: var(--ink);
  border-color: transparent;
  background: var(--surface-translucent);
}

.nav-item.active {
  font-weight: 650;
  box-shadow: inset 2px 0 var(--accent);
}

.nav-icon {
  display: grid;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  place-items: center;
  color: var(--muted);
}

.nav-icon svg,
.theme-icon svg,
.search-icon svg,
.recent-nav-icon svg,
.folder-nav-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.status-nav-icon {
  display: inline-flex;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.status-nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.unread-nav-indicator {
  fill: var(--information);
  stroke: none;
}

.nav-item:hover .status-nav-icon,
.nav-item.active .status-nav-icon {
  color: var(--ink);
}

.note-unread-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--information);
}

.nav-count {
  min-width: 20px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 10px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 9px;
  text-align: center;
}

.layer-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #b8b4ab;
}

.layer-dot.resources {
  background: #b9784b;
}

.layer-dot.inbox {
  background: var(--coral);
}

.layer-dot.wiki {
  background: #4f7c75;
}

.layer-dot.archive {
  background: #74869b;
}

.sidebar-spacer {
  min-height: 14px;
  flex: 1;
}

.recent-section {
  margin-top: 2px;
}

.recent-list {
  min-height: 28px;
}

.recent-nav-item {
  display: flex;
  width: 100%;
  min-height: 28px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.recent-nav-item:hover,
.recent-nav-item.active {
  color: var(--ink);
  background: var(--surface-translucent);
}

.recent-nav-item > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-nav-icon {
  display: grid;
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
  place-items: center;
  color: var(--faint);
}

.tag-section {
  overflow: hidden;
}

.explorer-section:not(.collapsed) + .sidebar-spacer {
  flex: 0;
}

.browse-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 4px 5px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.browse-mode-switch button {
  display: flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.browse-mode-switch button:hover,
.browse-mode-switch button.active {
  color: var(--ink);
  background: transparent;
}

.browse-mode-switch button.active {
  font-weight: 650;
  border-bottom-color: var(--accent);
  box-shadow: none;
}

.tag-list,
.folder-list {
  max-height: min(26vh, 220px);
  overflow-y: auto;
}

.explorer-section .folder-list,
.explorer-section .tag-list {
  min-height: 0;
  max-height: none;
  flex: 1;
  padding: 1px 2px 6px;
}

.tag-nav-item,
.folder-nav-item {
  display: flex;
  width: 100%;
  min-height: 28px;
  align-items: center;
  gap: 7px;
  padding: 3px 6px;
  border: 1px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.tag-nav-item:hover,
.tag-nav-item.active,
.folder-nav-item:hover,
.folder-nav-item.active,
.folder-nav-item.selected {
  color: var(--ink);
  border-color: transparent;
  background: var(--surface-translucent);
}

.tag-nav-item.active,
.folder-nav-item.active,
.folder-nav-item.selected {
  box-shadow: inset 2px 0 var(--accent);
  font-weight: 650;
}

.tag-nav-item > span:nth-child(2),
.folder-nav-item > span:nth-child(2) {
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag-nav-item > span:first-child,
.folder-nav-item > span:first-child {
  color: var(--faint);
}

.folder-tree-row {
  display: flex;
  min-width: 0;
  align-items: center;
  padding-left: calc(1px + var(--folder-depth, 0) * 14px);
}

.folder-tree-row.drop-target {
  border-radius: 5px;
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  background: var(--accent-soft);
}

.folder-tree-row .folder-nav-item {
  width: auto;
  min-width: 0;
  flex: 1;
  padding-left: 3px;
}

.folder-tree-disclosure,
.folder-tree-disclosure-spacer {
  display: grid;
  width: 16px;
  height: 28px;
  flex: 0 0 16px;
  place-items: center;
}

.folder-tree-disclosure {
  border-radius: 5px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
}

.folder-tree-disclosure:hover {
  color: var(--ink);
  background: var(--panel-strong);
}

.folder-tree-disclosure svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  transition: transform 120ms ease;
}

.folder-tree-disclosure.expanded svg {
  transform: rotate(90deg);
}

.folder-nav-icon {
  display: grid;
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  place-items: center;
  color: var(--faint);
}

.folder-nav-icon.expanded {
  color: var(--accent);
}

.folder-nav-item[data-folder="Resources"] .folder-nav-icon,
.folder-nav-item[data-folder^="Resources/"] .folder-nav-icon {
  color: #b9784b;
}

.folder-nav-item[data-folder="Inbox"] .folder-nav-icon,
.folder-nav-item[data-folder^="Inbox/"] .folder-nav-icon {
  color: var(--coral);
}

.folder-nav-item[data-folder="Wiki"] .folder-nav-icon,
.folder-nav-item[data-folder^="Wiki/"] .folder-nav-icon {
  color: #4f7c75;
}

.folder-nav-item[data-folder="Archive"] .folder-nav-icon,
.folder-nav-item[data-folder^="Archive/"] .folder-nav-icon {
  color: #74869b;
}

.explorer-file-row,
.folder-create-row {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 27px;
  align-items: center;
  gap: 6px;
  padding: 2px 6px 2px calc(23px + var(--folder-depth, 0) * 14px);
  border: 1px solid transparent;
  border-radius: 3px;
}

.explorer-file-row {
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.explorer-file-row.search-result { flex-wrap: wrap; }
.explorer-search-excerpt {
  order: 2;
  flex: 0 0 calc(100% - 28px);
  margin-left: 28px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.explorer-file-row:hover,
.explorer-file-row.active {
  color: var(--ink);
  background: var(--surface-translucent);
}

.folder-nav-item[role="treeitem"]:focus-visible,
.explorer-file-row[role="treeitem"]:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  color: var(--ink);
  background: var(--surface-translucent);
}

.explorer-file-row.active {
  box-shadow: inset 2px 0 var(--accent);
}

.explorer-file-row .file-type-glyph {
  display: inline-flex;
  width: 22px;
  flex: 0 0 22px;
  justify-content: center;
  color: var(--faint);
  font: 700 8px/1 var(--mono-font);
  letter-spacing: -0.04em;
}

.explorer-file-row .explorer-file-name {
  min-width: 0;
  overflow: hidden;
  flex: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.explorer-file-rename-row {
  cursor: default;
}

.explorer-file-rename-input {
  min-width: 0;
  height: 23px;
  flex: 1;
  padding: 2px 5px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.explorer-file-row .note-unread-dot {
  width: 6px;
  height: 6px;
}

.explorer-comment-count {
  min-width: 16px;
  padding: 1px 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--faint);
  font-size: 8px;
  text-align: center;
}

.folder-create-row input {
  width: 100%;
  height: 25px;
  min-width: 0;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.folder-tree-row .folder-rename-input {
  width: 100%;
  height: 25px;
  min-width: 0;
  margin-right: 8px;
  padding: 2px 6px;
  border: 1px solid var(--accent);
  border-radius: 3px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font-size: 11px;
}

.explorer-file-row[draggable="true"]:active,
.folder-nav-item[draggable="true"]:active {
  cursor: grabbing;
}

.explorer-upload-hint {
  display: none;
  margin: auto 8px 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  font-size: 9px;
  line-height: 1.45;
}

.explorer-section.importing .explorer-upload-hint {
  display: block;
  color: var(--accent);
}

.tag-count {
  color: var(--faint);
  font-size: 9px;
}

.empty-tags {
  margin: 4px 10px;
  color: var(--faint);
  font-size: 10px;
}

.sidebar-action > span:first-child,
.sidebar-action-icon {
  width: 15px;
  color: var(--faint);
  text-align: center;
}

.sidebar-action-icon {
  height: 15px;
}

.theme-icon {
  display: grid;
  height: 15px;
  flex: 0 0 15px;
  place-items: center;
}

.sidebar-action-label {
  width: auto !important;
  color: inherit !important;
  font-size: inherit !important;
  text-align: left !important;
  white-space: nowrap;
}

.panel-resizer {
  position: sticky;
  top: 0;
  z-index: 4;
  height: 100vh;
  min-width: 0;
  cursor: col-resize;
  touch-action: none;
}

.panel-resizer::before {
  position: absolute;
  inset: 0 4.5px;
  background: transparent;
  content: "";
  opacity: 0;
  transition: inset 120ms, opacity 120ms;
}

.panel-resizer:hover::before,
.panel-resizer.dragging::before {
  inset: 0 3px;
  background: var(--accent);
  opacity: 0.35;
}

.panel-action-button,
.icon-button {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  padding: 5px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 120ms, background 120ms;
}

.panel-action-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.panel-action-button:hover,
.icon-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface-translucent);
}

.panel-action-button:focus-visible,
.icon-button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

body.panel-dragging {
  cursor: col-resize;
  user-select: none;
}

.note-browser {
  position: sticky;
  top: 0;
  display: none;
  height: 100vh;
  min-width: 0;
  overflow: hidden;
  border-right: 1px solid var(--line);
  background: var(--browser-surface);
  box-shadow: 8px 0 24px rgb(var(--midnight-rgb) / 4%);
}

.browser-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 26px 20px 17px;
}

.browser-header-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.new-document-control {
  position: relative;
  display: flex;
}

.browser-header h2 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.new-note-button {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 12px;
  border-radius: 10px 0 0 10px;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  box-shadow: 0 7px 18px rgb(var(--coral-rgb) / 22%);
  transition: filter 120ms, transform 120ms;
}

.new-note-button .ui-icon {
  width: 14px;
  height: 14px;
}

.new-note-button:hover {
  filter: brightness(1.06);
}

.new-note-button:active {
  transform: translateY(1px);
}

.new-note-menu-toggle {
  display: grid;
  width: 27px;
  height: 36px;
  place-items: center;
  border-left: 1px solid color-mix(in srgb, var(--on-accent) 28%, transparent);
  border-radius: 0 10px 10px 0;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 7px 18px rgb(var(--coral-rgb) / 22%);
}

.new-note-menu-toggle:hover,
.new-note-menu-toggle[aria-expanded="true"] {
  filter: brightness(1.06);
}

.new-note-menu-toggle .ui-icon {
  width: 13px;
  height: 13px;
}

.new-note-menu {
  position: absolute;
  z-index: 18;
  top: calc(100% + 7px);
  right: 0;
  display: grid;
  width: 230px;
  gap: 3px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.new-note-menu[hidden] {
  display: none;
}

.new-note-menu button {
  display: grid;
  align-items: center;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.new-note-menu-copy {
  display: grid;
  gap: 2px;
}

.new-note-menu button:hover {
  color: var(--ink);
  background: var(--panel-strong);
}

.new-note-menu strong {
  font-size: 11px;
}

.new-note-menu small {
  color: var(--faint);
  font-size: 9px;
  font-weight: 400;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  margin: 0 14px 14px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--faint);
  background: var(--surface);
  box-shadow: 0 3px 12px rgb(var(--midnight-rgb) / 4%);
  transition: border-color 140ms, box-shadow 140ms;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--coral-rgb) / 10%);
}

.search-icon {
  display: grid;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  place-items: center;
}

.search-box input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 13px;
}

.search-box kbd {
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--faint);
  background: var(--paper);
  font: 9px ui-monospace, monospace;
}

.notes-list {
  height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 0 10px 24px;
}

.note-card {
  width: 100%;
  margin-bottom: 6px;
  padding: 15px 14px 14px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--note-card-surface);
  cursor: pointer;
  text-align: left;
  transition:
    transform 120ms,
    border-color 120ms,
    background 120ms,
    box-shadow 120ms;
}

.note-card:hover,
.note-card.active {
  border-color: var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.note-card:hover {
  transform: translateY(-1px);
}

.note-card.active {
  transform: none;
  box-shadow:
    inset 3px 0 var(--accent),
    var(--shadow-soft);
}

.note-card-top {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.note-card h3 {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  flex: 1;
  margin: 0;
  font-size: 14.5px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: normal;
  hyphens: none;
  word-break: normal;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.note-card:not(.unread) h3 {
  color: var(--muted);
  font-weight: 530;
}

.note-card .note-unread-dot {
  margin-top: 5px;
}

.note-card time {
  color: var(--faint);
  font-size: 9px;
}

.note-card-comment-count {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 2px;
  margin-top: 2px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1;
}

.note-card-comment-count svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.6;
}

.note-card p {
  display: -webkit-box;
  overflow: hidden;
  margin: 9px 0 0 15px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.note-card-tags {
  display: flex;
  overflow: hidden;
  gap: 5px;
  margin: 9px 0 0 15px;
}

.note-card-tags span {
  overflow: hidden;
  max-width: 110px;
  padding: 2px 6px;
  border: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-list {
  padding: 60px 26px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.editor-shell {
  --tabs-height: 45px;

  height: 100vh;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
}

.note-tabs {
  display: flex;
  height: var(--tabs-height);
  min-width: 0;
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  box-shadow: 0 4px 16px rgb(var(--midnight-rgb) / 3%);
  backdrop-filter: blur(14px);
}

.home-tab,
.note-tab-open,
.note-tab-close {
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.home-tab {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  margin: 5px 0 5px 6px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 11px;
}

.home-tab svg,
.note-tab-close svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.home-tab:hover,
.home-tab.active {
  color: var(--ink);
  border-color: var(--line);
  background: var(--surface);
}

.open-note-tabs {
  display: flex;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: thin;
}

.note-tab {
  position: relative;
  display: flex;
  min-width: 138px;
  max-width: 230px;
  flex: 0 0 auto;
  align-items: stretch;
  margin: 5px 0 5px 5px;
  border: 1px solid transparent;
  border-radius: 8px;
}

.note-tab::after {
  position: absolute;
  right: 10px;
  bottom: -5px;
  left: 10px;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: transparent;
  content: "";
}

.note-tab.active {
  border-color: var(--line);
  background: var(--surface);
}

.note-tab.active::after {
  background: var(--accent);
}

.note-tab.comparison::after {
  background: var(--information);
}

.note-tab-open {
  display: flex;
  min-width: 0;
  align-items: center;
  flex: 1;
  gap: 7px;
  padding: 0 5px 0 11px;
  font-size: 11px;
  text-align: left;
}

.note-tab-open > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-file-type {
  display: grid;
  min-width: 25px;
  height: 18px;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  background: var(--panel);
  font: 700 8px/1 var(--mono-font);
  letter-spacing: -0.03em;
}

.note-tab.active .tab-file-type {
  color: var(--accent);
  background: var(--accent-soft);
}

.tab-file-type[data-language="python"],
.document-mode-badge[data-language="python"] {
  color: #39739d;
}

.tab-file-type[data-language="javascript"],
.tab-file-type[data-language="typescript"],
.tab-file-type[data-language="jsx"],
.tab-file-type[data-language="tsx"],
.document-mode-badge[data-language="javascript"],
.document-mode-badge[data-language="typescript"],
.document-mode-badge[data-language="jsx"],
.document-mode-badge[data-language="tsx"] {
  color: #9b7418;
}

.tab-file-type[data-language="json"],
.document-mode-badge[data-language="json"] {
  color: #6f648e;
}

.note-tab:hover .note-tab-open,
.note-tab.active .note-tab-open {
  color: var(--ink);
}

.note-tab-close {
  display: grid;
  width: 28px;
  flex: 0 0 28px;
  place-items: center;
  padding: 0;
  opacity: 0;
}

.note-tab:hover .note-tab-close,
.note-tab-close:focus-visible {
  opacity: 1;
}

.note-tab-close:hover {
  color: var(--ink);
  background: var(--panel-strong);
}

.editor-content {
  height: calc(100vh - var(--tabs-height));
  min-width: 0;
}

.welcome-view {
  height: 100%;
  overflow: auto;
  background:
    radial-gradient(
      circle at 92% 8%,
      rgb(var(--coral-rgb) / 10%),
      transparent 28%
    ),
    radial-gradient(
      circle at 8% 92%,
      rgb(var(--deep-sea-rgb) / 5%),
      transparent 30%
    ),
    var(--surface);
}

.welcome-page {
  width: min(100%, 780px);
  margin: 0 auto;
  padding: 76px 64px 112px;
}

.welcome-mark {
  display: grid;
  width: 62px;
  height: 62px;
  margin-bottom: 34px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 18px;
  color: var(--surface);
  background: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  box-shadow: 0 14px 32px rgb(var(--midnight-rgb) / 18%);
  font-size: 26px;
}

.welcome-page h1 {
  margin: 0 0 30px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(40px, 5vw, 54px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 1.05;
}

.welcome-content {
  color: var(--ink);
  background: transparent !important;
  font-family: var(--text-font);
  font-size: 16px;
  line-height: 1.72;
  overflow-wrap: normal;
  hyphens: none;
  word-break: normal;
}

.welcome-content h1,
.welcome-content h2,
.welcome-content h3,
.welcome-content h4 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.02em;
}

.welcome-content h1,
.welcome-content h2 {
  margin-top: 1.7em;
  margin-bottom: 0.6em;
}

.welcome-content h2 {
  font-size: 25px;
}

.welcome-content li {
  margin: 0.42em 0;
  padding-left: 0.15em;
}

.page-pet {
  position: relative;
  width: 116px;
  height: 72px;
  margin: 54px 4px 0 auto;
  color: var(--accent);
}

.page-pet-body,
.page-pet-head {
  position: absolute;
  background: currentcolor;
}

.page-pet-body {
  bottom: 4px;
  left: 18px;
  width: 68px;
  height: 38px;
  border-radius: 56% 48% 42% 48%;
}

.page-pet-head {
  bottom: 26px;
  left: 7px;
  width: 42px;
  height: 38px;
  border-radius: 46% 46% 52% 52%;
}

.page-pet-ear {
  position: absolute;
  top: -10px;
  width: 0;
  height: 0;
  border-right: 9px solid transparent;
  border-bottom: 18px solid currentcolor;
  border-left: 9px solid transparent;
}

.page-pet-ear.left {
  left: 1px;
  transform: rotate(-13deg);
}

.page-pet-ear.right {
  right: 1px;
  transform: rotate(13deg);
}

.page-pet-eye {
  position: absolute;
  top: 16px;
  width: 4px;
  height: 7px;
  border-radius: 999px;
  background: var(--surface);
}

.page-pet-eye.left {
  left: 11px;
}

.page-pet-eye.right {
  right: 11px;
}

.page-pet-tail {
  position: absolute;
  right: 4px;
  bottom: 2px;
  width: 44px;
  height: 44px;
  border: 8px solid currentcolor;
  border-bottom-color: transparent;
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(20deg);
}

.note-workspace {
  display: grid;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
}

.note-workspace.comparing {
  grid-template-columns: minmax(360px, 1fr) minmax(320px, 1fr);
}

.note-workspace.comments-open {
  grid-template-columns:
    minmax(420px, 1fr)
    minmax(300px, var(--comments-width, 360px));
}

.editor {
  container-type: inline-size;
  container-name: note-editor;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
}

.editor:not(.plaintext-mode),
.compare-pane:not(.plaintext-mode) {
  color: var(--document-ink);
  background: var(--document-surface);
}

.editor:not(.plaintext-mode) {
  scrollbar-gutter: stable;
}

.editor.plaintext-mode {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  background: var(--editor-background);
}

.editor.plaintext-mode .editor-topbar {
  position: relative;
  flex: 0 0 52px;
}

.editor-topbar {
  position: sticky;
  z-index: 26;
  top: 0;
  display: flex;
  height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(10px);
}

.compare-pane {
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: var(--surface);
}

.compare-pane.plaintext-mode {
  display: flex;
  overflow: hidden;
  flex-direction: column;
  background: var(--editor-background);
}

.compare-pane.plaintext-mode .compare-topbar {
  position: relative;
  flex: 0 0 52px;
}

.compare-topbar {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  height: 52px;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  background: var(--topbar);
  font-size: 11px;
  backdrop-filter: blur(10px);
}

.compare-topbar > div {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 8px;
}

.compare-label {
  margin-left: 6px;
  color: var(--faint);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.compare-page {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 72px 52px 100px;
}

.compare-page h2 {
  margin: 0 0 38px;
  overflow-wrap: normal;
  hyphens: none;
  word-break: normal;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.compare-content {
  color: var(--ink);
  background: transparent !important;
  font-family: var(--text-font);
  font-size: 16px;
  line-height: 1.75;
  overflow-wrap: normal;
  hyphens: none;
  word-break: normal;
}

.compare-content h1,
.compare-content h2,
.compare-content h3,
.compare-content h4 {
  font-family: Georgia, "Times New Roman", serif;
}

.comments-pane {
  position: relative;
  display: flex;
  min-height: 0;
  min-width: 0;
  height: 100%;
  overflow: hidden;
  flex-direction: column;
  border-left: 1px solid var(--line);
  background: var(--browser-surface);
}

.comments-resizer {
  position: absolute;
  z-index: 6;
  inset: 0 auto 0 -7px;
  width: 14px;
  cursor: col-resize;
  touch-action: none;
}

.comments-resizer::before {
  position: absolute;
  inset: 0 6px;
  background: transparent;
  content: "";
  transition: inset 120ms, background 120ms;
}

.comments-resizer:hover::before,
.comments-resizer:focus-visible::before,
.comments-resizer.dragging::before {
  inset: 0 5px;
  background: var(--accent);
}

.comments-resizer:focus-visible {
  outline: 0;
}

.comments-header {
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  padding: 14px 15px 12px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar);
  backdrop-filter: blur(10px);
}

.comments-header .eyebrow {
  margin-bottom: 3px;
}

.comments-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
}

.comments-list {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 18px 14px 28px;
  scrollbar-color: var(--muted) transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
}

.comments-list::-webkit-scrollbar {
  width: 10px;
}

.comments-list::-webkit-scrollbar-track {
  background: transparent;
}

.comments-list::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 10px;
  background: var(--muted);
  background-clip: padding-box;
}

.comments-empty {
  margin: 36px 18px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

.comment-card {
  margin-bottom: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  transition: border-color 160ms, box-shadow 160ms;
}

.comment-card.focused-comment {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--coral-rgb) / 10%);
}

.comment-card.reply {
  margin-left: 24px;
  border-left: 2px solid var(--accent);
}

.comment-card-header {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.comment-card-header strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-card-header time {
  color: var(--faint);
  font-size: 9px;
}

.note-card-tags .document-mode-badge {
  font-family: var(--mono-font);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.025em;
}

.comment-card-body {
  margin: 8px 0 9px;
  color: var(--ink);
  background: transparent !important;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: normal;
  hyphens: none;
  word-break: normal;
}

.comment-card-body p {
  margin: 0 0 4px;
  line-height: 1.4;
}

.comment-card-quote {
  display: block;
  width: 100%;
  max-height: 84px;
  overflow: hidden;
  margin: 9px 0 2px;
  padding: 8px 9px;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  background: var(--accent-soft);
  cursor: pointer;
  font: italic 11px/1.5 var(--text-font);
  text-align: left;
  text-overflow: ellipsis;
}

.comment-card-quote:hover {
  color: var(--ink);
}

.comment-card-body.plaintext {
  white-space: pre-wrap;
}

.comment-card-body > :first-child {
  margin-top: 0 !important;
}

.comment-card-body > :last-child {
  margin-bottom: 0 !important;
}

.comment-card-body pre {
  max-width: 100%;
  overflow-x: auto;
}

.comment-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-card-actions button {
  padding: 2px 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

.comment-card-actions button:hover {
  color: var(--accent);
}

.comment-card-actions .comment-delete-button {
  margin-left: auto;
}

.comment-delete-button.confirming {
  color: var(--danger);
}

.comment-card-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.comment-edit-form {
  display: grid;
  gap: 8px;
  margin: 8px 0 9px;
}

.comment-edit-form textarea {
  width: 100%;
  min-height: 88px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  outline: 0;
  color: var(--ink);
  background: var(--surface);
  font: 12px/1.45 var(--text-font);
  resize: vertical;
}

.comment-edit-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgb(var(--coral-rgb) / 10%);
}

.comment-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.comment-edit-actions button {
  padding: 5px 9px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--panel);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.comment-edit-actions button[type="submit"] {
  color: var(--on-accent);
  background: var(--accent);
}

.comment-form {
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.comment-form > label {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
}

.comment-form textarea {
  display: block;
  width: 100%;
  min-height: 76px;
  max-height: 240px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  outline: 0;
  color: var(--ink);
  background: var(--paper);
  font: 12px/1.5 var(--text-font);
  resize: none;
}

.comment-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--coral-rgb) / 10%);
}

.comment-form-actions,
.comment-reply-context,
.comment-anchor-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.comment-form-actions {
  margin-top: 9px;
}

.comment-form-actions span {
  color: var(--faint);
  font-size: 9px;
}

.comment-form-actions button {
  min-height: 30px;
  padding: 5px 11px;
  border-radius: 7px;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
  font-size: 10px;
  font-weight: 650;
}

.comment-form-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.comment-reply-context {
  margin-bottom: 9px;
  padding: 7px 9px;
  border-radius: 7px;
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 9px;
}

.comment-reply-context span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.comment-anchor-context {
  max-height: 118px;
  margin-bottom: 9px;
  padding: 8px 9px;
  overflow: hidden;
  border-radius: 7px;
  color: var(--muted);
  background: var(--accent-soft);
  font-size: 9px;
}

.comment-anchor-context > div {
  min-width: 0;
  overflow: hidden;
}

.comment-anchor-context span {
  display: block;
  margin-bottom: 3px;
  color: var(--faint);
  font-weight: 650;
  text-transform: uppercase;
}

.comment-anchor-context blockquote {
  max-height: 72px;
  margin: 0;
  overflow: hidden;
  font: italic 10px/1.45 var(--text-font);
}

.comment-anchor-context button,
.comment-reply-context button {
  flex: 0 0 auto;
  padding: 2px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
}

.mobile-back-button {
  display: none;
}

.mobile-note-menu-button {
  display: none;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.mobile-note-menu-button svg {
  width: 18px;
  height: 18px;
  fill: currentcolor;
}

.breadcrumb,
.save-state {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.breadcrumb span:last-child {
  overflow: hidden;
  max-width: 220px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.save-indicator {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #80a281;
}

.save-indicator.saving {
  background: #d39a51;
}

.save-indicator.error {
  background: #c6503e;
}

.save-indicator.conflict {
  background: #b65f9a;
  box-shadow: 0 0 0 3px rgb(182 95 154 / 14%);
}

.editor-topbar-actions,
.view-mode-switch {
  display: flex;
  align-items: center;
}

.editor-topbar-actions {
  gap: 14px;
}

.block-actions { position: relative; color: var(--muted); font-size: 11px; }
.block-actions summary { padding: 8px; cursor: pointer; border-radius: 7px; list-style: none; }
.block-actions summary::-webkit-details-marker { display: none; }
.block-actions summary:hover, .block-actions[open] summary { background: var(--panel-strong); color: var(--ink); }
.block-actions summary:focus-visible { outline: 2px solid var(--accent); }
.block-actions-panel {
  position: absolute; top: 38px; left: 0; z-index: 32;
  width: 180px; padding: 6px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); box-shadow: 0 8px 28px rgb(0 0 0 / 15%);
}
.block-actions-panel button { display: block; width: 100%; padding: 8px; text-align: left; border-radius: 4px; background: transparent; color: var(--ink); cursor: pointer; }
.block-actions-panel button:hover, .block-actions-panel button:focus-visible { background: var(--panel-strong); }
.block-actions-panel button:disabled { opacity: .4; cursor: default; }

@container note-editor (min-width: 850px) {
  .editor-topbar #document-properties summary { width: auto; font-size: 11px; padding-inline: 8px; }
  #document-properties summary::after { content: "Properties"; }
  #document-properties summary > span { display: none; }
}

@container note-editor (max-width: 700px) {
  .editor-topbar { height: auto; min-height: 52px; flex-wrap: wrap; gap: 6px; padding-block: 8px; }
  .editor-page:not(.plaintext-mode) { padding-inline: clamp(20px, 5cqw, 32px); }
  .editor-topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
  .history-toggle-label,
  .outline-toggle-label,
  .comments-toggle-label {
    display: none;
  }

  .editor-topbar-actions { gap: 6px; }
  .editor-topbar { padding-inline: 14px; }
}

.outline-control {
  position: relative;
}

.outline-toggle,
.comments-toggle {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.outline-toggle:hover,
.outline-toggle[aria-expanded="true"],
.comments-toggle:hover,
.comments-toggle[aria-expanded="true"] {
  color: var(--ink);
  background: var(--panel-strong);
}

.outline-toggle:focus-visible,
.comments-toggle:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.outline-toggle svg,
.comments-toggle svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.outline-count {
  min-width: 17px;
  padding: 0 5px;
  border-radius: 999px;
  color: var(--faint);
  background: var(--panel-strong);
  font-size: 9px;
  line-height: 17px;
  text-align: center;
}

.outline-toggle[aria-expanded="true"] .outline-count {
  color: var(--on-accent);
  background: var(--accent);
}

.outline-panel {
  position: absolute;
  z-index: 4;
  top: calc(100% + 9px);
  right: 0;
  display: flex;
  width: min(320px, calc(100vw - 28px));
  max-height: min(62vh, 560px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 97%, transparent);
  box-shadow: 0 18px 52px rgb(var(--midnight-rgb) / 20%);
  backdrop-filter: blur(16px);
}

.outline-header {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px 9px 14px;
  border-bottom: 1px solid var(--line);
}

.outline-header > div {
  display: grid;
  gap: 2px;
}

.outline-header strong {
  font-size: 12px;
  font-weight: 700;
}

.outline-header span {
  color: var(--faint);
  font-size: 9px;
}

.outline-header .icon-button {
  width: 28px;
  height: 28px;
}

.outline-list {
  display: grid;
  min-height: 0;
  gap: 2px;
  padding: 6px;
  overflow-y: auto;
}

.outline-list button {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 32px;
  align-items: center;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 3px;
  padding: 5px 8px 5px calc(8px + (var(--outline-level) - 1) * 12px);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.outline-list button:hover,
.outline-list button:focus-visible {
  color: var(--ink);
  background: var(--panel-strong);
  outline: 0;
}

.outline-level {
  color: var(--faint);
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 700;
}

.outline-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.outline-empty {
  margin: 0;
  padding: 24px 18px 26px;
  color: var(--faint);
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
}

.history-list {
  display: grid;
  min-height: 0;
  gap: 2px;
  padding: 6px;
  overflow-y: auto;
}

.history-list button {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 8px 9px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.history-list button:hover,
.history-list button:focus-visible,
.history-list button[aria-selected="true"] {
  color: var(--ink);
  background: var(--panel-strong);
  outline: 0;
}

.history-list strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-list span {
  color: var(--faint);
  font-size: 9px;
}

.history-footer {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px 10px;
  border-top: 1px solid var(--line);
}

.history-footer button {
  min-height: 32px;
  padding: 0 11px;
  border-radius: 7px;
  color: var(--on-accent);
  background: var(--accent);
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.history-footer button:disabled {
  cursor: default;
  opacity: 0.45;
}

.comments-count {
  min-width: 16px;
  padding: 1px 5px;
  border-radius: 10px;
  color: var(--muted);
  background: var(--surface);
  font-size: 9px;
  text-align: center;
}

.editor-page {
  position: relative;
  width: min(100%, 900px);
  margin: 0 auto;
  padding: 40px clamp(20px, 11cqw, 90px) 100px;
}

@container note-editor (min-width: 701px) {
  .editor:not(.plaintext-mode) .editor-topbar { height: 44px; }
  .editor-page:not(.plaintext-mode) { padding-top: 24px; }
}

.editor-page.full-width:not(.plaintext-mode) {
  width: 100%;
}

#markdown-width-toggle {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  cursor: pointer;
}

#markdown-width-toggle[aria-pressed="true"] {
  color: var(--ink);
  background: var(--surface);
}

#markdown-width-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.comment-markers {
  position: absolute;
  z-index: 4;
  inset: 0;
  overflow: visible;
  pointer-events: none;
}

.comment-marker {
  position: absolute;
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, var(--line));
  border-radius: 50%;
  color: var(--accent);
  background: var(--surface);
  box-shadow: 0 3px 10px rgb(0 0 0 / 13%);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  pointer-events: auto;
  transform: translateX(-3px);
}

.comment-marker:hover,
.comment-marker:focus-visible {
  color: var(--on-accent);
  background: var(--accent);
  outline: 0;
}

.note-title {
  display: block;
  width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: var(--document-font);
  font-size: clamp(32px, 5cqw, 40px);
  font-weight: 700;
  letter-spacing: normal;
  line-height: 1.2;
  overflow-wrap: anywhere;
  hyphens: none;
  word-break: normal;
  resize: none;
  white-space: pre-wrap;
}

.note-title::placeholder {
  color: var(--faint);
}

.note-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 20px 0 10px;
}

.page-options {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

#document-properties {
  position: relative;
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
}

#document-properties summary {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  list-style: none;
  font-size: 17px;
  cursor: pointer;
}

#document-properties summary::-webkit-details-marker { display: none; }
#document-properties[open] summary,
#document-properties summary:hover { background: var(--panel-strong); color: var(--ink); }

#document-properties .note-actions {
  position: absolute;
  z-index: 30;
  top: 38px;
  right: -38px;
  width: min(340px, calc(100cqw - 96px));
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgb(0 0 0 / 15%);
}

.editor-page > .note-title { margin-bottom: 20px; }
.editor-page.plaintext-mode > .note-title { margin-bottom: 8px; }
.editor-topbar-actions { gap: 6px; }
.editor-topbar #markdown-width-toggle {
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  font-size: 18px;
}
.editor-topbar #markdown-width-toggle:hover { background: var(--panel-strong); color: var(--ink); }
.editor-topbar .save-state { min-width: 46px; font-size: 10px; }

#document-properties summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

#document-properties .note-actions { margin: 8px 0; }

.editor-page.plaintext-mode .page-options { margin: 0; padding: 4px 18px; }

.metadata-icon {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.note-actions select {
  flex: 0 0 auto;
  height: 29px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  outline: 0;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.note-actions select:hover,
.note-actions select:focus-visible {
  border-color: var(--line);
  background: var(--surface-translucent);
}

.note-actions select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.note-actions #updated-time {
  margin-left: auto;
  color: var(--faint);
  font-size: 10px;
  white-space: nowrap;
}

.backlinks {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 12px;
  color: var(--faint);
  font-size: 11px;
}

.backlinks-label {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.backlinks-list {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.backlinks-list button {
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.backlinks-list button:hover {
  text-decoration: underline;
}

.backlinks-list button:focus-visible {
  border-radius: 2px;
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tags-field-wrap {
  position: relative;
  min-width: 140px;
  max-width: 520px;
  flex: 1 1 260px;
}

.tags-field {
  display: flex;
  width: 100%;
  height: 29px;
  align-items: center;
  gap: 4px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
}

.tags-field:hover {
  border-color: var(--line);
  background: var(--surface-translucent);
}

.tags-field input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

.tags-field button {
  display: grid;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 5px;
  color: var(--faint);
  background: transparent;
  cursor: pointer;
}

.tags-field button:hover,
.tags-field button[aria-expanded="true"] {
  color: var(--ink);
  background: var(--panel-strong);
}

.tags-field button .ui-icon {
  width: 14px;
  height: 14px;
  transition: transform 140ms;
}

.tags-field button[aria-expanded="true"] .ui-icon {
  transform: rotate(180deg);
}

.tags-field:focus-within {
  border-color: var(--accent);
  background: var(--surface);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.tag-picker {
  position: absolute;
  z-index: 18;
  top: calc(100% + 6px);
  left: 0;
  display: grid;
  width: 100%;
  max-height: 240px;
  gap: 2px;
  padding: 5px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgb(0 0 0 / 16%);
}

.tag-picker > p {
  margin: 7px 8px;
  color: var(--faint);
  font-size: 10px;
}

.tag-picker > button {
  display: grid;
  min-height: 32px;
  align-items: center;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  text-align: left;
}

.tag-picker > button:hover,
.tag-picker > button.selected {
  color: var(--ink);
  background: var(--panel-strong);
}

.tag-picker > button > span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-find-widget {
  position: sticky;
  z-index: 24;
  top: 58px;
  display: grid;
  width: min(520px, 100%);
  gap: 5px;
  margin: 16px 0 -8px auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 12px 34px rgb(var(--midnight-rgb) / 16%);
  backdrop-filter: blur(12px);
  font: 11px/1.2 var(--ui-font);
}

.editor-find-row {
  display: grid;
  grid-template-columns: 26px minmax(120px, 1fr) auto auto auto auto auto;
  align-items: center;
  gap: 4px;
}

.editor-find-row[hidden] {
  display: none;
}

.editor-find-widget input {
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 5px;
  outline: 0;
  color: var(--ink);
  background: var(--paper);
  font: 12px/1 var(--mono-font);
}

.editor-find-widget input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.editor-find-widget button {
  height: 26px;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.editor-find-widget button:hover,
.editor-find-widget button:focus-visible,
.editor-find-widget button[aria-pressed="true"],
.editor-find-widget button[aria-expanded="true"] {
  color: var(--ink);
  background: var(--panel-strong);
  outline: 0;
}

.editor-find-widget button:disabled {
  opacity: 0.38;
  cursor: default;
}

.editor-find-icon-button {
  display: grid;
  width: 26px;
  padding: 0;
  place-items: center;
}

.editor-find-icon-button svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

#markdown-find-toggle-replace svg {
  transition: transform 120ms;
}

.editor-find-widget.replace-visible
  #markdown-find-toggle-replace
  svg {
  transform: rotate(90deg);
}

.editor-find-text-button {
  min-width: 27px;
  padding: 0 5px;
  font-family: var(--text-font) !important;
}

.editor-find-count {
  min-width: 48px;
  color: var(--faint);
  text-align: center;
  white-space: nowrap;
}

.editor-find-indent {
  width: 26px;
}

.editor-find-row:last-child {
  grid-template-columns: 26px minmax(120px, 1fr) auto auto;
}

.editor-find-action-button {
  padding: 0 8px;
  border: 1px solid var(--line) !important;
  background: var(--paper) !important;
}

::highlight(x2-markdown-find) {
  color: inherit;
  background: var(--editor-search-match);
}

::highlight(x2-markdown-find-current) {
  color: inherit;
  background: var(--editor-search-selected);
  text-decoration-line: underline;
  text-decoration-color: var(--editor-search-outline);
  text-decoration-thickness: 1px;
}

#vditor-editor {
  min-height: 420px;
  margin-top: 18px;
  border: 0;
  background: transparent;
}

#vditor-editor .outline-target-flash {
  animation: outline-target-flash 850ms ease-out;
}

@keyframes outline-target-flash {
  0%,
  30% {
    background: var(--editor-search-match);
    box-shadow: 0 0 0 5px var(--editor-search-match);
  }
  100% {
    background: transparent;
    box-shadow: 0 0 0 0 transparent;
  }
}

.editor-page.plaintext-mode {
  display: flex;
  width: 100%;
  height: calc(100% - 52px);
  max-width: none;
  flex: 1;
  flex-direction: column;
  margin: 0;
  padding: 16px 18px 0;
  overflow: hidden;
  background: var(--editor-background);
}

.editor-page.plaintext-mode .note-title {
  flex: 0 0 auto;
  font-family: var(--mono-font);
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 650;
  letter-spacing: -0.025em;
  line-height: 1.25;
}

.editor-page.plaintext-mode .note-actions {
  flex: 0 0 auto;
  margin: 8px 0;
}

.plaintext-workspace {
  display: flex;
  min-width: 0;
  min-height: 260px;
  flex: 1;
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--editor-line);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: var(--editor-background);
  box-shadow: none;
}

.plaintext-editor {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

#plaintext-editor .cm-panel.cm-search {
  display: flex;
  min-height: 38px;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  padding: 5px 7px;
  border-bottom: 1px solid var(--editor-line);
  font: 11px/1.2 var(--ui-font);
}

#plaintext-editor .cm-panel.cm-search br {
  display: block;
  width: 100%;
  height: 0;
  flex-basis: 100%;
}

#plaintext-editor .cm-panel.cm-search input:not([type="checkbox"]) {
  min-width: 130px;
  height: 26px;
  flex: 1 1 180px;
  padding: 0 7px;
}

#plaintext-editor .cm-panel.cm-search button {
  min-height: 25px;
  padding: 0 7px;
  cursor: pointer;
}

#plaintext-editor .cm-panel.cm-search button[name="close"] {
  order: 20;
  margin-left: auto;
  font-size: 16px;
}

#plaintext-editor .cm-panel.cm-search label {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.editor-statusbar {
  display: flex;
  min-height: 27px;
  flex: 0 0 27px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 9px 0 13px;
  border-top: 1px solid rgb(255 255 255 / 9%);
  color: #eaf1f7;
  background: var(--deep-sea-blue);
  font: 10px/1 var(--text-font);
}

.editor-status-group {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 13px;
  white-space: nowrap;
}

.editor-status-settings {
  justify-content: flex-end;
  overflow: hidden;
}

.editor-statusbar button {
  height: 21px;
  padding: 0 5px;
  border-radius: 3px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
}

.editor-statusbar button:hover,
.editor-statusbar button:focus-visible,
.editor-statusbar button[aria-pressed="true"] {
  background: rgb(255 255 255 / 13%);
  outline: 0;
}

.compare-page.plaintext-mode {
  display: flex;
  width: 100%;
  min-height: 0;
  flex: 1;
  flex-direction: column;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.compare-page.plaintext-mode h2 {
  flex: 0 0 auto;
  margin: 0;
  padding: 15px 18px 13px;
  border-bottom: 1px solid var(--editor-line);
  font: 600 15px/1.25 var(--mono-font);
}

.compare-content.plaintext-document {
  min-width: 0;
  min-height: 0;
  flex: 1;
  overflow: hidden;
  background: var(--editor-background);
}

#vditor-editor .vditor-toolbar {
  display: none;
}

#vditor-editor .vditor-ir,
#vditor-editor .vditor-wysiwyg {
  background: transparent;
}

#vditor-editor .vditor-ir pre.vditor-reset,
#vditor-editor .vditor-wysiwyg pre.vditor-reset {
  min-height: 420px;
  padding: 14px 0 80px !important;
  color: var(--ink);
  background: transparent;
  font-family: var(--text-font);
  font-size: 17px;
  line-height: 1.75;
  overflow-wrap: normal;
  hyphens: none;
  word-break: normal;
}

#vditor-editor .vditor-reset > :first-child {
  margin-top: 0;
}

.vditor-reset {
  font-synthesis: weight style;
}

.vditor-reset em,
.vditor-reset i {
  font-style: italic;
}

.vditor-reset u,
.vditor-reset mark {
  color: inherit;
  background: transparent;
  text-decoration-line: underline;
  text-decoration-thickness: from-font;
  text-underline-offset: 0.14em;
}

#vditor-editor .vditor-task,
.welcome-content .vditor-task,
.compare-content .vditor-task,
.comment-card-body .vditor-task {
  overflow-wrap: normal;
  hyphens: none;
  word-break: normal;
}

#vditor-editor .vditor-ir__node {
  min-height: 1.75em;
}

#vditor-editor .vditor-ir__preview,
#vditor-editor .vditor-wysiwyg__preview {
  font-family: var(--text-font);
}

#vditor-editor .vditor-ir .vditor-reset > h1::before,
#vditor-editor .vditor-ir .vditor-reset > h2::before,
#vditor-editor .vditor-ir .vditor-reset > h3::before,
#vditor-editor .vditor-ir .vditor-reset > h4::before,
#vditor-editor .vditor-ir .vditor-reset > h5::before,
#vditor-editor .vditor-ir .vditor-reset > h6::before,
#vditor-editor .vditor-wysiwyg > .vditor-reset > h1::before,
#vditor-editor .vditor-wysiwyg > .vditor-reset > h2::before,
#vditor-editor .vditor-wysiwyg > .vditor-reset > h3::before,
#vditor-editor .vditor-wysiwyg > .vditor-reset > h4::before,
#vditor-editor .vditor-wysiwyg > .vditor-reset > h5::before,
#vditor-editor .vditor-wysiwyg > .vditor-reset > h6::before,
#vditor-editor .vditor-wysiwyg div.vditor-wysiwyg__block::before {
  content: none;
}

#vditor-editor .vditor-reset h1,
#vditor-editor .vditor-reset h2,
#vditor-editor .vditor-reset h3,
#vditor-editor .vditor-reset h4,
#vditor-editor .vditor-reset h5,
#vditor-editor .vditor-reset h6 {
  color: var(--ink);
  font-family: var(--text-font);
  font-weight: 700;
  letter-spacing: -0.02em;
}

#vditor-editor .vditor-reset h1,
#vditor-editor .vditor-reset h2 {
  padding-bottom: 0;
  border-bottom: 0;
}

#vditor-editor .vditor-reset a {
  color: var(--accent);
  overflow-wrap: anywhere;
  word-break: normal;
}

.welcome-content a,
.compare-content a,
.comment-card-body a {
  overflow-wrap: anywhere;
  word-break: normal;
}

.vditor-reset blockquote {
  border-left: 3px solid var(--accent);
  color: var(--muted);
  background: var(--accent-soft);
}

#vditor-editor .vditor-reset code {
  background: var(--panel);
}

#vditor-editor .vditor-ir__marker {
  color: var(--faint);
  background: transparent;
  opacity: 0.72;
}

#vditor-editor .vditor-reset table {
  display: block;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  border-color: var(--line);
  background: transparent;
}

#vditor-editor .vditor-reset table tr {
  background: transparent;
}

#vditor-editor .vditor-reset table tbody tr:nth-child(2n) {
  background: var(--panel);
}

#vditor-editor .vditor-reset table th,
#vditor-editor .vditor-reset table td {
  padding: 10px 12px;
  border-color: var(--line);
  vertical-align: top;
  white-space: normal;
}

#vditor-editor .vditor-ir__marker--pre {
  max-width: 100%;
  padding: 14px 16px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

#vditor-editor .vditor-ir__marker--pre code {
  display: block;
  min-width: max-content;
  background: transparent;
  font-family: var(--mono-font);
  overflow-wrap: normal;
  hyphens: none;
  white-space: pre;
  word-break: normal;
}

#vditor-editor .vditor-wysiwyg div[data-type="code-block"] {
  max-width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

#vditor-editor .vditor-wysiwyg div[data-type="code-block"] pre {
  margin: 0;
  padding: 14px 16px;
  overflow-x: auto;
  background: transparent;
}

#vditor-editor .vditor-wysiwyg div[data-type="code-block"] code {
  font-family: var(--mono-font);
  overflow-wrap: normal;
  hyphens: none;
  white-space: pre;
  word-break: normal;
}

#vditor-editor .vditor-wysiwyg div[data-type="math-block"] {
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: text;
}

#vditor-editor [data-block][data-type="math-block"] > .vditor-ir__preview {
  max-width: 100%;
  overflow-x: auto;
}

#vditor-editor
  .vditor-wysiwyg
  div[data-type="math-block"]
  .language-math[data-math=""]::before {
  content: "Click to edit equation";
  display: block;
  padding: 12px 14px;
  color: var(--faint);
  font-family: var(--text-font);
  font-size: 13px;
  font-style: italic;
  text-align: left;
}

#vditor-editor
  .vditor-ir__node--expand[data-type="code-block"]
  > .vditor-ir__marker--pre {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 2px var(--accent-soft);
}

#vditor-editor .vditor-reset img {
  max-width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.attachment-hover-download {
  position: fixed;
  z-index: 18;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-translucent);
  box-shadow: 0 5px 18px rgb(0 0 0 / 16%);
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.attachment-hover-download .ui-icon {
  width: 17px;
  height: 17px;
}

.attachment-hover-download:hover {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
}

.selection-format-toolbar {
  position: fixed;
  z-index: 32;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 10px 30px rgb(0 0 0 / 18%);
}

.selection-format-toolbar button {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-family: var(--text-font);
  font-size: 12px;
}

.selection-format-toolbar button:hover,
.selection-format-toolbar button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.selection-format-divider {
  width: 1px;
  height: 18px;
  margin: 0 2px;
  background: var(--line);
}

.slash-command-menu {
  position: fixed;
  z-index: 33;
  width: min(320px, calc(100vw - 20px));
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 38px rgb(0 0 0 / 20%);
}

.slash-command-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 7px;
  color: var(--faint);
}

.slash-command-header span {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.09em;
}

.slash-command-header small {
  font-size: 10px;
}

.slash-command-list {
  max-height: min(390px, calc(100vh - 40px));
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--muted) transparent;
}

.slash-command-list button {
  display: grid;
  width: 100%;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 5px 7px;
  border-radius: 7px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.slash-command-list button:hover,
.slash-command-list button.selected {
  background: var(--panel-strong);
}

.slash-command-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--panel);
  font-family: var(--mono-font);
  font-size: 13px;
}

.slash-command-list button > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.slash-command-list strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slash-command-list small {
  overflow: hidden;
  color: var(--faint);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.slash-command-empty {
  margin: 0;
  padding: 14px 10px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}

.context-menu,
.selection-comment-menu {
  position: fixed;
  z-index: 30;
  width: 190px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgb(0 0 0 / 18%);
}

.context-menu button,
.selection-comment-menu button {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  text-align: left;
}

.context-menu button:hover,
.selection-comment-menu button:hover {
  background: var(--panel-strong);
}

.context-menu button:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  background: var(--panel-strong);
}

.selection-comment-menu {
  position: fixed;
  z-index: 31;
  width: 190px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  box-shadow: 0 12px 34px rgb(0 0 0 / 18%);
}

.read-status-check {
  opacity: 0;
}

.read-status-icon.read .read-status-check {
  opacity: 1;
}

.context-menu button:disabled {
  color: var(--faint);
  cursor: default;
  background: transparent;
}

.menu-icon {
  width: 15px;
  height: 15px;
  color: var(--faint);
  text-align: center;
}

.menu-svg {
  width: 15px;
  height: 15px;
  flex: 0 0 15px;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.menu-separator {
  height: 1px;
  margin: 4px -5px;
  background: var(--line);
}

.context-menu .danger-menu-item {
  color: var(--danger);
}

.command-palette-backdrop {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(14vh, 120px) 20px 24px;
  background: rgb(var(--midnight-rgb) / 34%);
  backdrop-filter: blur(3px);
}

.command-palette-surface {
  display: flex;
  width: min(620px, 100%);
  max-height: min(68vh, 640px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 28px 90px rgb(var(--midnight-rgb) / 32%);
}

.command-palette-header {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 16px 10px 18px;
}

.command-palette-header .eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 8px;
}

.command-palette-header h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.command-palette-header > .command-palette-shortcut,
.command-palette-footer .keycap {
  border: 1px solid var(--line);
  border-bottom-color: var(--line-strong);
  border-radius: 5px;
  color: var(--faint);
  background: var(--panel);
  box-shadow: 0 1px 0 var(--line-strong);
  font: 9px/1 var(--mono-font);
}

.command-palette-shortcut {
  padding: 6px 7px;
  white-space: nowrap;
}

.command-palette-search {
  display: flex;
  min-height: 46px;
  align-items: center;
  gap: 10px;
  margin: 0 12px 8px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--paper);
}

.command-palette-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.command-palette-search svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--faint);
  stroke-linecap: round;
  stroke-width: 1.7;
}

.command-palette-search input {
  min-width: 0;
  flex: 1;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font: 13px/1.2 var(--ui-font);
}

.command-palette-search input::placeholder {
  color: var(--faint);
}

.command-palette-list {
  display: grid;
  min-height: 0;
  gap: 2px;
  padding: 2px 8px 8px;
  overflow-y: auto;
}

.command-palette-item {
  display: grid;
  width: 100%;
  min-height: 48px;
  align-items: center;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 9px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.command-palette-item:hover,
.command-palette-item.selected,
.command-palette-item[aria-selected="true"] {
  color: var(--ink);
  background: var(--panel-strong);
}

.command-palette-item:focus-visible {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
}

.command-palette-item-icon {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--faint);
  background: var(--surface);
  font: 700 10px/1 var(--mono-font);
}

.command-palette-item-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.command-palette-item-copy strong {
  overflow: hidden;
  font-size: 11px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette-item-copy small {
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.command-palette-item > .command-palette-shortcut {
  color: var(--faint);
  font: 9px/1 var(--mono-font);
  white-space: nowrap;
}

.command-palette-empty {
  margin: 0;
  padding: 28px 18px 34px;
  color: var(--faint);
  font-size: 11px;
  text-align: center;
}

.command-palette-footer {
  display: flex;
  min-height: 36px;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  color: var(--faint);
  background: var(--panel);
  font-size: 9px;
}

.command-palette-footer span {
  display: flex;
  align-items: center;
  gap: 4px;
}

.command-palette-footer .keycap {
  padding: 3px 4px;
}

.dialog-backdrop {
  position: fixed;
  z-index: 40;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(var(--midnight-rgb) / 48%);
  backdrop-filter: blur(3px);
}

.confirm-dialog {
  width: min(100%, 410px);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  box-shadow: 0 22px 70px rgb(0 0 0 / 25%);
}

.confirm-dialog h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  font-weight: 500;
}

.confirm-dialog p {
  margin: 13px 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.confirm-dialog strong {
  color: var(--ink);
}

.move-destination-field {
  display: grid;
  gap: 7px;
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
}

.move-destination-field select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  color: var(--ink);
  background: var(--paper);
  font: 12px/1.4 var(--ui-font);
}

.move-destination-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgb(var(--coral-rgb) / 10%);
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.confirm-actions button {
  min-height: 35px;
  padding: 0 13px;
  border-radius: 7px;
  background: var(--panel-strong);
  cursor: pointer;
  font-size: 11px;
  font-weight: 650;
}

.confirm-actions #delete-confirm {
  color: white;
  background: var(--danger);
}

.confirm-actions #move-confirm {
  color: var(--on-accent);
  background: var(--accent);
}

.confirm-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.toast {
  position: fixed;
  z-index: 20;
  right: 24px;
  bottom: 24px;
  max-width: min(340px, calc(100vw - 48px));
  padding: 11px 15px;
  border-radius: 8px;
  color: var(--surface);
  background: var(--ink);
  box-shadow: var(--shadow);
  font-size: 11px;
}

@media (max-width: 1100px) {
  .note-workspace.comments-open {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
  }

  .comments-pane {
    position: absolute;
    z-index: 5;
    inset: 0 0 0 auto;
    width: min(100%, var(--comments-width, 360px));
    box-shadow: -18px 0 45px rgb(44 37 30 / 12%);
  }
}

@media (max-width: 960px) {
  :root {
    --browser-width: 280px;
  }

  .compare-page {
    padding-right: 36px;
    padding-left: 36px;
  }

  .welcome-page {
    padding-right: 42px;
    padding-left: 42px;
  }
}

@media (max-width: 720px) {
  :root {
    --mobile-navigation-height: 66px;
    --mobile-topbar-height: calc(52px + env(safe-area-inset-top));
  }

  body {
    min-height: 100dvh;
  }

  .login-shell {
    min-height: 100dvh;
    padding: 20px;
  }

  .login-card {
    padding: 36px 28px;
    border-radius: 18px;
  }

  .workspace {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    z-index: 4;
    inset: auto 0 0;
    width: 100%;
    height: calc(
      var(--mobile-navigation-height) + env(safe-area-inset-bottom)
    );
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    overflow: hidden;
    border-top: 1px solid var(--line);
    border-right: 0;
    background: var(--surface-translucent);
    backdrop-filter: blur(18px);
  }

  .workspace.browser-collapsed .sidebar > .layer-nav {
    display: grid;
  }

  .brand,
  .tag-section,
  .recent-section,
  .sidebar-spacer,
  .sidebar-action,
  .nav-section-toggle {
    display: none;
  }

  .layer-nav {
    display: grid;
    width: 100%;
    height: 100%;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    margin: 0;
  }

  .nav-item,
  .nav-item:not(.active)::after {
    font-size: 9px;
  }

  .nav-item {
    position: relative;
    display: flex;
    min-height: 0;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    padding: 5px 2px 4px;
    border-radius: 10px;
    text-align: center;
  }

  .nav-item .layer-dot {
    width: 9px;
    height: 9px;
  }

  .nav-item .nav-icon {
    width: auto;
    height: auto;
    font-size: 18px;
    line-height: 0.6;
  }

  .nav-count {
    position: absolute;
    top: 3px;
    left: calc(50% + 3px);
    min-width: 15px;
    margin: 0;
    padding: 0 4px;
    font-size: 8px;
    line-height: 15px;
  }

  .panel-resizer {
    display: none;
  }

  .sidebar-browser-expand {
    display: none !important;
  }

  .browser-header .panel-action-button {
    display: none;
  }

  .note-browser {
    position: relative;
    display: flex;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    flex-direction: column;
    padding-bottom: calc(
      var(--mobile-navigation-height) + env(safe-area-inset-bottom)
    );
    border-right: 0;
  }

  .workspace.browser-collapsed .note-browser {
    visibility: visible;
    pointer-events: auto;
  }

  .browser-header {
    padding: calc(22px + env(safe-area-inset-top)) 18px 14px;
  }

  .browser-header h2 {
    font-size: 27px;
  }

  .new-note-button {
    height: 38px;
    padding: 0 14px;
    border-radius: 10px 0 0 10px;
  }

  .new-note-menu-toggle {
    height: 38px;
    border-radius: 0 10px 10px 0;
  }

  .search-box {
    height: 42px;
    margin: 0 14px 12px;
    border-radius: 10px;
  }

  .notes-list {
    height: auto;
    min-height: 0;
    flex: 1;
    padding: 0 10px 18px;
  }

  .note-card {
    padding: 15px 14px;
    border-radius: 12px;
  }

  .editor-shell {
    --tabs-height: 0px;

    position: fixed;
    z-index: 5;
    inset: 0;
    display: none;
    height: 100vh;
    height: 100dvh;
  }

  .note-tabs {
    display: none;
  }

  .editor-shell.mobile-open {
    display: block;
    overflow: hidden;
  }

  .editor-content {
    height: 100vh;
    height: 100dvh;
  }

  .note-workspace {
    height: 100%;
  }

  .editor-topbar {
    height: var(--mobile-topbar-height);
    padding: env(safe-area-inset-top) 14px 0;
  }

  .editor-topbar-actions {
    gap: 7px;
  }

  .save-state {
    font-size: 0;
  }

  .mobile-back-button {
    display: flex;
    min-width: 64px;
    min-height: 44px;
    align-items: center;
    gap: 5px;
    margin-left: -7px;
    padding: 0 7px;
    color: var(--muted);
    background: transparent;
    cursor: pointer;
  }

  .mobile-back-button .ui-icon {
    width: 18px;
    height: 18px;
  }

  .mobile-back-button span:last-child {
    font-size: 11px;
    font-weight: 600;
  }

  .mobile-note-menu-button {
    display: grid;
    min-width: 42px;
    min-height: 42px;
    place-items: center;
    border-radius: 7px;
  }

  .mobile-note-menu-button:hover,
  .mobile-note-menu-button:focus-visible {
    color: var(--ink);
    background: var(--panel-strong);
  }

  .breadcrumb span:nth-child(3),
  .breadcrumb span:last-child {
    display: none;
  }

  .editor-page {
    width: 100%;
    padding:
      38px 20px
      calc(88px + env(safe-area-inset-bottom));
  }

  .note-actions {
    flex-wrap: wrap;
    margin-top: 22px;
  }

  .note-actions select,
  .tags-field {
    height: 36px;
  }

  .tags-field-wrap {
    order: 3;
    min-width: 0;
    max-width: none;
    flex-basis: 100%;
  }

  #vditor-editor {
    min-height: 360px;
    margin-top: 18px;
  }

  #vditor-editor .vditor-ir pre.vditor-reset,
  #vditor-editor .vditor-wysiwyg pre.vditor-reset {
    min-height: 360px;
    padding: 14px 0 64px !important;
    font-size: 16px;
  }

  .editor-page.plaintext-mode {
    min-height: 0;
    padding: 16px 14px 0;
  }

  .editor-page.plaintext-mode .note-title {
    font-size: 21px;
  }

  .plaintext-workspace {
    min-height: 360px;
    border-radius: 6px 6px 0 0;
  }

  #editor-character-count,
  .editor-status-settings > span:not(#editor-language) {
    display: none;
  }

  .note-workspace.comparing {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
  }

  .note-workspace.comments-open {
    position: static;
    grid-template-columns: 1fr;
  }

  .compare-pane {
    display: none !important;
  }

  .note-workspace.revision-comparing .editor {
    display: none;
  }

  .note-workspace.revision-comparing .compare-pane {
    display: block !important;
    border-left: 0;
  }

  .note-workspace.revision-comparing .compare-pane.plaintext-mode {
    display: flex !important;
  }

  .comments-pane {
    position: fixed;
    z-index: 7;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    border-left: 0;
    box-shadow: none;
  }

  .comments-resizer {
    display: none;
  }

  .comments-header {
    min-height: var(--mobile-topbar-height);
    padding:
      env(safe-area-inset-top) 14px 0
      20px;
  }

  .comments-list {
    padding: 18px 16px 28px;
  }

  .comment-form {
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  }

  .comment-form textarea {
    min-height: 88px;
    font-size: 16px;
  }

  .comments-toggle-label {
    display: none;
  }

  .outline-toggle-label,
  .history-toggle-label {
    display: none;
  }

  .outline-toggle,
  .comments-toggle {
    min-width: 42px;
    min-height: 42px;
    justify-content: center;
    padding: 7px;
  }

  .outline-panel {
    position: fixed;
    top: calc(var(--mobile-topbar-height) + 8px);
    right: 10px;
    left: 10px;
    width: auto;
    max-height: min(62dvh, 520px);
  }

  .command-palette-backdrop {
    align-items: flex-start;
    padding: calc(18px + env(safe-area-inset-top)) 10px 18px;
  }

  .command-palette-surface {
    max-height: calc(100dvh - 36px - env(safe-area-inset-top));
    border-radius: 11px;
  }

  .command-palette-header > .command-palette-shortcut {
    display: none;
  }

  .command-palette-item {
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .command-palette-item > .command-palette-shortcut {
    display: none;
  }

  .command-palette-footer {
    justify-content: center;
  }

  .welcome-page {
    padding: 62px 28px 90px;
  }

  .markdown-body {
    font-size: 16px;
  }

  .metadata-grid {
    grid-template-columns: 1fr;
  }

  #context-compare {
    display: none;
  }

  .toast {
    right: 14px;
    bottom: calc(
      var(--mobile-navigation-height) + env(safe-area-inset-bottom) + 12px
    );
    max-width: calc(100vw - 28px);
  }
}

/* Preserve explicit Markdown soft breaks without exposing the HTML marker. */
#vditor-editor .x2-soft-break > code { display: none !important; }
#vditor-editor .x2-soft-break { display: block; height: 0; }

/* Transaction-based Markdown migration preview. */
#markdown-candidate .tiptap { outline: none; min-height: 420px; max-width: none; margin: 0; padding: 24px 0 160px; font-family: var(--document-font); font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
#markdown-candidate .tiptap::selection,
#markdown-candidate .tiptap *::selection { color: inherit; background: var(--document-selection); }
#markdown-candidate .tiptap p { margin: 0; }
#markdown-candidate .tiptap > p { padding: 8px 0; }
#markdown-candidate .tiptap h1,
#markdown-candidate .tiptap h2,
#markdown-candidate .tiptap h3 { padding: 2px 0; font-weight: 600; letter-spacing: normal; }
#markdown-candidate .tiptap h1 { margin: 30px 0 6px; font-size: 30px; line-height: 39px; }
#markdown-candidate .tiptap h2 { margin: 26px 0 6px; font-size: 24px; line-height: 31.2px; }
#markdown-candidate .tiptap h3 { margin: 22px 0 6px; font-size: 20px; line-height: 26px; }
#markdown-candidate .tiptap ul,
#markdown-candidate .tiptap ol { margin: 0; padding-left: 2em; }
#markdown-candidate .tiptap > ul,
#markdown-candidate .tiptap > ol { margin: 6px 0; }
#markdown-candidate .tiptap li > p { padding: 2px 0; }
#markdown-candidate ul[data-type="taskList"] { list-style: none; padding-left: .5em; }
#markdown-candidate li[data-checked] { display: flex; gap: 0; align-items: flex-start; }
#markdown-candidate li[data-checked] > label { display: flex; flex: 0 0 24px; height: 28px; align-items: center; justify-content: center; padding: 2px 0; user-select: none; }
#markdown-candidate li[data-checked] > label input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: #2783de; cursor: pointer; }
#markdown-candidate li[data-checked] > div { flex: 1; min-width: 0; }
#markdown-candidate li[data-checked] > div > p { padding: 2px 0; }
#markdown-candidate li[data-checked="true"] > div > p:first-child { opacity: 0.7; text-decoration-line: line-through; text-decoration-color: color-mix(in srgb, currentColor 50%, transparent); }
#markdown-candidate pre { margin: 8px; padding: 36px 22px; background: var(--document-code-background); border-radius: 10px; overflow: auto; font-family: var(--document-mono-font); font-size: 13.6px; line-height: 20.4px; }
#markdown-candidate .tiptap :not(pre) > code { position: relative; bottom: 0.065em; padding: 0.2em 0.4em; border-radius: 4px; color: var(--document-inline-code); background: var(--document-inline-code-background); font-family: var(--document-mono-font); font-size: 85%; line-height: normal; }
#markdown-candidate .tiptap a { color: inherit; opacity: 0.7; text-decoration-line: underline; text-decoration-thickness: 0.05em; text-decoration-color: color-mix(in srgb, currentColor 30%, transparent); text-underline-offset: 10%; cursor: pointer; }
#markdown-candidate .tiptap hr { height: 13px; margin: 0; border: 0; background: linear-gradient(var(--document-divider), var(--document-divider)) center / calc(100% - 16px) 1px no-repeat; }
#markdown-candidate table { border-collapse: collapse; width: 100%; margin: 8px 0; font-size: 14px; line-height: 20px; }
#markdown-candidate th, #markdown-candidate td { border: 1px solid #8886; padding: 7px 9px; min-width: 60px; vertical-align: top; }
#markdown-candidate img { max-width: 100%; }
#markdown-candidate blockquote { margin: 0; padding: 8px 8px 8px 14px; border-left: 3px solid currentcolor; }

.editor-page.full-width #markdown-candidate .tiptap { max-width: none; }
@media (max-width: 700px) { #markdown-candidate .tiptap { padding: 16px 0 120px; } }

.x2-math-dialog { width: min(560px, 90vw); border: 1px solid #888; border-radius: 10px; padding: 20px; color: inherit; background: var(--paper, #fff); }
.x2-math-dialog::backdrop { background: #0006; }
.x2-math-dialog textarea { display: block; box-sizing: border-box; width: 100%; margin: 12px 0; padding: 10px; font-family: monospace; }
.x2-math-dialog button { margin-right: 8px; padding: 6px 16px; }

#markdown-candidate [data-type="block-math"] { min-height: 2em; cursor: pointer; }
#markdown-candidate [data-type="block-math"][data-latex=""]::before { content: "Click to edit equation"; opacity: 0.6; }

#table-block-actions { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 4px; }
.block-actions-panel { max-height: min(70vh, 480px); overflow-y: auto; }

/* Child blocks retain their indentation when a parent becomes plain text. */
#markdown-candidate [data-type="nested-block"] > :not(:first-child) {
  margin-left: 1.5rem;
}

.x2-equation-preview { min-height: 2.5em; max-height: 180px; overflow: auto; margin: 12px 0; padding: 12px; border: 1px solid var(--line, #888); border-radius: 6px; }
