:root {
  color-scheme: dark;
  --base: light-dark(#faf9fc, #171719);
  --sidebar: light-dark(#f0eef4, #111113);
  --raised: light-dark(#ffffff, #212124);
  --input: light-dark(#ffffff, #19191c);
  --line: light-dark(#d8d5de, #303034);
  --ink: light-dark(#26232c, #efedf1);
  --secondary: light-dark(#514d5a, #b5b3bd);
  --muted: light-dark(#676271, #94919e);
  --accent: light-dark(#654393, #b9a2f0);
  --accent-quiet: light-dark(#ebe4f5, #2c2639);
  --hover: light-dark(#e8e5ed, #232326);
  --red: light-dark(#a53042, #efa5aa);
  --sans: 'Inter', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  font: 16px/1.5 var(--sans);
  color: var(--ink);
  background: var(--base);
}
:root[data-theme='light'] {
  color-scheme: light;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input,
select,
textarea,
.button {
  font: inherit;
}
button,
.button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  background: var(--raised);
  font-size: 0.875rem;
  line-height: 1.3;
  cursor: pointer;
  text-decoration: none;
}
button:hover:not(:disabled),
.button:hover {
  background: light-dark(#d8d5de, #303034);
  border-color: light-dark(#aba6b3, #49474e);
}
button:disabled {
  opacity: 0.46;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button.primary,
.button.primary {
  color: light-dark(#ffffff, #1c1527);
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}
button.primary:hover:not(:disabled),
.button.primary:hover {
  background: light-dark(#53367c, #cbb9f5);
}
button.danger {
  color: var(--red);
  border-color: light-dark(#c28d95, #654044);
}
a {
  color: var(--accent);
}
svg.lucide {
  width: 16px;
  height: 16px;
  stroke-width: 1.65;
  flex: none;
}
button.icon-btn {
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  padding: 0;
  width: 32px;
  height: 32px;
  min-height: 32px;
  flex: none;
}
button.icon-btn.selected {
  color: var(--accent);
  background: var(--accent-quiet);
}
button.icon-btn:hover:not(:disabled) {
  background: var(--hover);
  color: var(--ink);
  border-color: transparent;
}
input:not([type='checkbox']),
select,
textarea {
  color: var(--ink);
  background: var(--input);
  border: 1px solid light-dark(#bcb7c5, #45434b);
  border-radius: 6px;
  min-height: 40px;
  width: 100%;
  padding: 8px 12px;
  font-size: 0.9375rem;
}
input::placeholder {
  color: var(--muted);
}
input[type='checkbox'] {
  accent-color: var(--accent);
}
label {
  display: block;
  color: var(--secondary);
  font-size: 0.875rem;
}
label > input:not([type='checkbox']),
label > textarea,
label > select {
  display: block;
  margin-top: 6px;
}
button svg,
a svg {
  pointer-events: none;
}
kbd {
  font: 0.75rem/1.3 var(--mono);
  border: 1px solid light-dark(#c4bfcb, #403f45);
  color: var(--muted);
  border-radius: 4px;
  padding: 2px 4px;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1 {
  font-size: 1.875rem;
  font-weight: 550;
  line-height: 1.15;
  letter-spacing: -0.035em;
}
h2 {
  font-size: 1.125rem;
  font-weight: 550;
  line-height: 1.35;
}
h3 {
  font-size: 0.9375rem;
  font-weight: 550;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}
.brand > svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  stroke-width: 2;
}
.muted,
.file-size {
  color: var(--muted);
  font-size: 0.875rem;
}
.error {
  color: var(--red);
  font-size: 0.875rem;
  overflow-wrap: anywhere;
}
.workspace {
  display: flex;
  height: 100dvh;
  min-height: 256px;
  overflow: hidden;
}
.sidebar {
  width: 252px;
  flex: none;
  background: var(--sidebar);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0 12px;
}
.brand-row {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
}
.brand-row > .icon-btn,
.mobile-menu,
.drawer-overlay {
  display: none;
}
.space-select {
  max-width: min(32vw, 28rem);
  min-width: 0;
  min-height: 32px;
  padding: 4px;
  background: transparent;
  border-color: transparent;
  color: var(--secondary);
  font-size: inherit;
}
.space-select span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.space-select svg { flex: none; }
.space-select .lucide-chevron-down { width: 12px; }
.sidebar-bottom {
  display: flex;
  flex-direction: column;
}
.sidebar-bottom > button,
.sidebar-bottom > a,
.detail-row,
.outline-link,
.menu-list > button,
.menu-list > a {
  justify-content: start;
  color: var(--secondary);
  background: transparent;
  border-color: transparent;
  text-align: left;
  font-size: 0.875rem;
}
.sidebar-bottom > button,
.sidebar-bottom > a {
  padding: 6px 8px;
  min-height: 32px;
}
.sidebar-bottom > button:hover:not(:disabled),
.sidebar-bottom > a:hover,
.detail-row:hover:not(:disabled),
.outline-link:hover:not(:disabled) {
  border-color: transparent;
  background: var(--hover);
}
.sidebar-bottom > button.active {
  color: var(--ink);
  background: var(--raised);
}
.sidebar-bottom svg {
  color: var(--muted);
}
.explorer {
  border-top: 1px solid var(--line);
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.explorer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 4px 8px;
}
.view-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.view-switch select {
  appearance: none;
  field-sizing: content;
  width: auto;
  margin: 0;
  cursor: pointer;
  border: 0;
  border-radius: 4px;
  background: var(--sidebar);
  color: var(--ink);
  font: 600 0.875rem var(--sans);
  min-height: 32px;
  padding: 4px 22px 4px 4px;
}
.view-switch > svg {
  position: absolute;
  right: 4px;
  width: 12px;
  color: var(--muted);
  pointer-events: none;
}
.details header h2 {
  font: 500 0.8125rem/1.4 var(--sans);
  color: var(--secondary);
}
.explorer-head > div {
  display: flex;
}
.explorer-head .icon-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
}
.tree {
  overflow-y: auto;
  padding-bottom: 32px;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.tree-root {
  width: 100%;
  min-height: 32px;
  justify-content: flex-start;
  gap: 8px;
  padding: 4px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--secondary);
  font-size: 0.8125rem;
}
.tree-root[aria-pressed='true'] {
  color: var(--accent);
  background: var(--accent-quiet);
}
.tree-row {
  display: flex;
  align-items: center;
  border-radius: 5px;
  color: var(--secondary);
  min-height: 32px;
}
.tree-row.selected {
  background: var(--accent-quiet);
  color: light-dark(#54357a, #dccdf6);
}
.tree-row:hover {
  background: var(--hover);
}
.tree-row.selected:hover {
  background: light-dark(#e0d5ee, #342d41);
}
.tree-item {
  font-size: 0.875rem;
  min-height: 32px;
  border: 0;
  background: transparent;
  padding: 4px 0;
  justify-content: start;
  gap: 6px;
  flex: 1;
  min-width: 0;
  color: inherit;
}
.tree-item span:not(.disclosure) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-item:hover:not(:disabled),
.row-actions:hover:not(:disabled) {
  background: transparent;
}
.disclosure,
.tree-item svg.disclosure {
  width: 12px;
  height: 12px;
  color: var(--muted);
  flex: none;
}
.tree-item > svg:not(.disclosure) {
  color: var(--muted);
}
.tree-row.selected .tree-item > svg {
  color: var(--accent);
}
.tree-item .file-star {
  width: 12px;
  height: 12px;
  color: var(--accent);
}
.row-actions {
  width: 24px;
  min-height: 28px;
  padding: 0;
  border: 0;
  margin-right: 4px;
  background: transparent;
  color: var(--muted);
  opacity: 0;
}
.tree-row:is(:hover, :focus-within) .row-actions {
  opacity: 1;
}
.drop-target {
  outline: 1px solid var(--accent);
  outline-offset: -1px;
  background: var(--accent-quiet);
}
.tree-empty {
  margin: 12px 8px;
  color: var(--muted);
  font-size: 0.8125rem;
}
.sidebar-bottom {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.user-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--line);
  margin: 8px -12px 0;
  padding: 8px 12px;
  min-height: 52px;
  font-size: 0.875rem;
}
.user-row .icon-btn {
  margin-left: auto;
}
.avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  background: var(--raised);
  border: 1px solid light-dark(#bcb7c5, #45434b);
  border-radius: 6px;
  font-size: 0.8125rem;
}
.main-workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.workspace-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 8px 24px;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}
.workspace-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.workspace-actions + .document-actions {
  padding-left: 8px;
  border-left: 1px solid var(--line);
}
.graph-loading {
  margin: auto;
  color: var(--secondary);
}
.crumbs,
.document-actions,
.tabs,
.tab {
  display: flex;
  align-items: center;
}
.crumbs {
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--muted);
  min-width: 0;
}
.crumbs > span,
.tab > button:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.crumbs .crumb-current {
  color: var(--secondary);
}
.crumbs > .lucide-chevron-right {
  width: 12px;
}
.document-actions {
  gap: 4px;
  flex: none;
}
.share-button {
  min-height: 32px;
  background: transparent;
  border-color: light-dark(#bdb5c7, #49454f);
}
.tabs {
  overflow-x: auto;
  scrollbar-width: thin;
  min-height: 40px;
  background: light-dark(#f4f2f7, #141416);
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  align-items: stretch;
}
.tabs > .icon-btn {
  align-self: center;
  width: 28px;
}
.tab {
  max-width: 208px;
  flex: none;
  position: relative;
  border-right: 1px solid var(--line);
  padding: 0 4px;
  gap: 0;
  color: var(--muted);
}
.tab > button:first-child {
  display: block;
  min-width: 40px;
  max-width: 176px;
  font-size: 0.8125rem;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 4px 8px;
}
.tab > button:first-child svg {
  vertical-align: -3px;
  margin-right: 8px;
  width: 14px;
  height: 14px;
}
.tab > .icon-btn {
  width: 20px;
  height: 24px;
  min-height: 24px;
}
.tab > .icon-btn svg {
  width: 12px;
}
.tab.active {
  background: var(--base);
  color: var(--ink);
}
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--accent);
}
.work-area,
.editor-group {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.editor-pane {
  display: flex;
  flex: 1;
  min-width: 0;
  flex-direction: column;
  min-height: 0;
  position: relative;
}
.editor-group.split .editor-pane:not([hidden]) + .editor-pane:not([hidden]) {
  border-inline-start: 1px solid var(--line);
}
.editor-toolbar {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 6px 16px;
  min-height: 44px;
  border-bottom: 1px solid light-dark(#e4e0e9, #28282b);
}
.editor-toolbar .icon-btn {
  width: 28px;
  height: 28px;
  min-height: 28px;
}
.toolbar-spacer {
  flex: 1;
}
.separator {
  height: 16px;
  width: 1px;
  background: var(--line);
  margin: 0 4px;
}
.read-only {
  color: var(--muted);
  font-size: 0.8125rem;
}
.cm-host {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.cm-host .cm-editor {
  height: 100%;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink);
}
.cm-host .cm-scroller {
  font-family: var(--sans);
  scrollbar-width: thin;
  scrollbar-color: light-dark(#b7b1bf, #49474b) transparent;
}
.cm-host .cm-content {
  caret-color: var(--accent);
  padding: clamp(24px, 5vh, 56px) 0 30vh;
  width: min(100%, 840px);
  max-width: 840px;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0 auto;
}
.cm-host .cm-line {
  padding: 0 clamp(16px, 3.6vw, 56px);
}
.cm-host .cm-content ::selection {
  background: light-dark(#d6c4ed, #524166);
}
.cm-host .cm-focused {
  outline: 0;
}
.cm-host .cm-cursor {
  border-left-color: var(--accent);
}
.cm-host .cm-selectionBackground,
.cm-host .cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground {
  background: light-dark(#dfd0f0, #493b57);
}
.cm-host .cm-placeholder {
  color: var(--muted);
}
.cm-host .md-h1,
.cm-host .md-h2,
.cm-host .md-h3,
.cm-host .md-h4,
.cm-host .md-h5,
.cm-host .md-h6 {
  color: var(--ink);
  font-weight: 550;
  letter-spacing: -0.02em;
  line-height: 1.35;
}
.cm-host .md-h1 {
  font-size: 2.25rem;
  padding-block: 8px;
}
.cm-host .md-h2 {
  font-size: 1.5rem;
  padding-block: 6px;
}
.cm-host .md-h3 {
  font-size: 1.2rem;
  padding-block: 4px;
}
.md-StrongEmphasis {
  font-weight: 650;
}
.md-Emphasis {
  font-style: italic;
}
.md-Strikethrough {
  text-decoration: line-through;
}
.md-InlineCode,
.md-code,
.md-table-source {
  font: 0.9em/1.7 var(--mono);
}
.md-InlineCode {
  color: light-dark(#644276, #cfbfdf);
  padding: 2px 4px;
  border-radius: 3px;
  background: light-dark(#eee8f3, #29262d);
}
.md-code {
  background: light-dark(#f2f0f5, #1e1e21);
  color: var(--secondary);
}
.md-quote {
  color: var(--secondary);
  text-decoration: none;
}
.md-quote::before {
  content: '';
  display: inline-block;
  margin-inline-end: 8px;
  border-inline-start: 2px solid light-dark(#9279ac, #75648e);
  height: 1em;
  vertical-align: -0.15em;
}
.md-check {
  height: 16px;
  width: 16px;
  vertical-align: -2px;
  cursor: pointer;
  margin: 0 2px;
}
.md-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.md-image {
  display: inline-block;
  max-width: 100%;
  max-height: 52vh;
  vertical-align: middle;
  object-fit: contain;
  border-radius: 4px;
}
.md-table-row {
  display: inline-flex;
  width: 100%;
  color: var(--secondary);
  border-bottom: 1px solid var(--line);
}
.md-table-header {
  font-weight: 550;
  color: var(--ink);
  background: var(--raised);
}
.md-table-cell {
  flex: 1;
  padding: 4px 8px;
  cursor: text;
  border-left: 1px solid var(--line);
  min-width: 0;
  overflow-wrap: anywhere;
}
.md-table-row > :nth-last-child(1 of .md-table-cell) {
  border-right: 1px solid var(--line);
}
.cm-host .md-table-divider {
  height: 0;
  line-height: 0;
  overflow: hidden;
}
.cm-host .cm-tooltip {
  color: var(--ink);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 4px;
}
.cm-host .cm-tooltip-autocomplete ul li[aria-selected] {
  background: var(--accent-quiet);
  color: var(--accent);
}
.cm-host .cm-panels {
  background: var(--input);
  color: var(--secondary);
  border-color: var(--line);
}
.cm-host .cm-panel.cm-search {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  padding: 8px 32px 8px 12px;
}
.cm-host .cm-panel.cm-search input:not([type='checkbox']) {
  width: 12rem;
  min-height: 28px;
  padding: 4px;
}
.cm-host .cm-button {
  background: var(--raised);
  min-height: 28px;
  font: 0.8125rem var(--sans);
  border-radius: 4px;
}
.cm-host .cm-panel.cm-search label {
  font-size: 0.8125rem;
}
.editor-status {
  display: flex;
  align-items: center;
  min-height: 32px;
  gap: 16px;
  padding: 4px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font: 0.75rem/1.4 var(--mono);
}
.editor-status > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.editor-status svg {
  width: 14px;
  height: 14px;
}
.editor-status .word-count {
  margin-left: auto;
}
.save-pending {
  color: var(--accent);
}
.editor-loading {
  position: absolute;
  top: 72px;
  left: 32px;
  color: var(--muted);
  font-size: 0.875rem;
}
.details {
  width: 232px;
  flex: none;
  border-left: 1px solid var(--line);
  padding: 0 16px 32px;
  background: light-dark(#f5f3f7, #151517);
  overflow-y: auto;
}
.details > header {
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}
.details section {
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.details h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8125rem;
  color: var(--secondary);
  margin-bottom: 8px;
}
.details h3 svg {
  width: 14px;
  height: 14px;
}
.details h3 button {
  min-height: 24px;
  padding: 2px 6px;
  margin-inline-start: auto;
  font-size: 0.75rem;
  background: transparent;
}
.details p {
  font-size: 0.8125rem;
  color: var(--muted);
}
.outline-link,
.detail-row {
  width: 100%;
  min-height: 28px;
  font-size: 0.8125rem;
  padding: 4px;
  overflow-wrap: anywhere;
  line-height: 1.4;
}
.outline-link.h2 {
  padding-left: 12px;
}
.outline-link.h3,
.outline-link.h4,
.outline-link.h5,
.outline-link.h6 {
  padding-left: 20px;
}
.detail-row svg {
  width: 14px;
}
.revision-list {
  max-height: 224px;
  overflow: auto;
}
.empty-work,
.boot {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: var(--muted);
  padding: 24px;
}
.empty-work > svg {
  color: var(--accent);
  width: 36px;
  height: 36px;
  stroke-width: 1.3;
}
.empty-work h1 {
  color: var(--ink);
  font-size: 1.375rem;
}
.boot {
  min-height: 100dvh;
}
.boot .brand {
  color: var(--ink);
}
.modal {
  padding: 20px;
  border: 1px solid light-dark(#bfbac6, #424147);
  background: light-dark(#ffffff, #1c1c1f);
  color: var(--ink);
  width: min(440px, calc(100vw - 32px));
  max-height: min(82dvh, 760px);
  border-radius: 10px;
  overflow: auto;
}
.modal.wide {
  width: min(840px, calc(100vw - 32px));
}
.modal::backdrop {
  background: rgb(0 0 0 / 0.64);
}
.modal-head,
.actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-head {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.modal-head h2 {
  overflow-wrap: anywhere;
}
.actions {
  justify-content: flex-end;
  padding-top: 8px;
}
.stack,
.new-link {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.modal > p,
.modal > h3,
.modal .new-link {
  margin: 16px 0;
}
.field-hint {
  color: var(--muted);
  float: right;
  font-size: 0.8125rem;
}
