@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&family=Roboto+Mono:wght@400;500;600&display=swap');

* {
  box-sizing: border-box;
}

:root {
  font-family: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  line-height: 1.5;
  font-weight: 400;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  --ui-font: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  --editor-font-inter: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --editor-font-serif: 'Iowan Old Style', 'Palatino Linotype', 'Book Antiqua', Georgia, serif;
  --editor-font-sans: var(--editor-font-inter);
  --editor-font-mono: 'Roboto Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;

  --bg-primary: #ffffff;
  --bg-secondary: #f3f4f6;
  --bg-tertiary: #f9fafb;
  --paper-bg: #fffdf4;
  --paper-text-primary: #2b2419;
  --paper-text-secondary: #5f5647;
  --paper-accent: #1d4ed8;
  --paper-code-bg: rgba(148, 163, 184, 0.18);
  --paper-quote-bg: rgba(255, 255, 255, 0.4);
  --paper-table-stripe: rgba(255, 255, 255, 0.3);
  --paper-separator: rgba(220, 38, 38, 0.6);
  --text-primary: #1f2937;
  --text-secondary: #6b7280;
  --border-color: #e5e5e5;
  --border-hover: #9ca3af;
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
  --button-bg: #ffffff;
  --button-border: #d1d5db;
  --button-hover: #f3f4f6;
  --button-active: #e5e7eb;
  --warning-bg: #fef3c7;
  --warning-text: #b45309;
  --success-color: #059669;
  --shadow-color: rgba(0, 0, 0, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --paper-bg: #11161f;
    --paper-text-primary: #e5edf8;
    --paper-text-secondary: #a9b7ca;
    --paper-accent: #8fc2ff;
    --paper-code-bg: rgba(59, 130, 246, 0.18);
    --paper-quote-bg: rgba(148, 163, 184, 0.08);
    --paper-table-stripe: rgba(51, 65, 85, 0.55);
    --paper-separator: rgba(248, 113, 113, 0.75);
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
    --border-hover: #4b5563;
    --button-bg: #374151;
    --button-border: #4b5563;
    --button-hover: #4b5563;
    --button-active: #6b7280;
    --warning-bg: #78350f;
    --warning-text: #fef3c7;
    --shadow-color: rgba(0, 0, 0, 0.3);
  }
}

body {
  margin: 0;
  padding: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background-color: var(--shell-bg, var(--bg-primary));
  color: var(--brand-text-primary, var(--text-primary));
  font-family: var(--ui-font);
}

a {
  font-weight: 500;
  color: var(--brand-accent, var(--accent-color));
  text-decoration: none;
}

a:hover {
  color: var(--brand-accent-strong, var(--accent-hover));
  text-decoration: underline;
}

html,
body,
#app {
  height: 100%;
}

#app {
  min-height: 100vh;
  width: 100%;
  margin: 0;
  padding: 0;
}

body {
  overflow: hidden;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0 0 0.5em 0;
  font-weight: 600;
}

p {
  margin: 0 0 0.5em 0;
}

button {
  font-family: inherit;
  font-size: inherit;
  border-radius: 6px;
  border: 1px solid transparent;
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

button:focus {
  outline: 2px solid var(--brand-accent, var(--accent-color));
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.milkdown {
    width: min(210mm, 100%) !important;
    min-width: min(42rem, 100%) !important;
    max-width: min(210mm, 100%) !important;
    min-height: max(36rem, 297mm) !important;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    position: relative;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--brand-paper, var(--paper-bg)) 96%, white) 0%, var(--brand-paper, var(--paper-bg)) 100%);
    border-radius: 0;
    box-shadow:
      0 20px 40px color-mix(in srgb, var(--shadow-color) 50%, transparent),
      0 2px 0 rgba(255, 255, 255, 0.65) inset;
    border: 1px solid var(--brand-paper-border, var(--border-color));
    font-family: var(--editor-font-mono);
  }

.milkdown,
  .milkdown .milkdown-theme-nord,
  .milkdown .milkdown-theme-nord.ProseMirror {
    background-color: var(--brand-paper, var(--paper-bg)) !important;
    color: var(--paper-text-primary) !important;
  }

.milkdown :is(p, li, h1, h2, h3, h4, h5, h6, strong, em, span) {
    color: inherit;
  }

.milkdown .milkdown-theme-nord a {
    color: var(--paper-accent);
  }

.milkdown .milkdown-theme-nord blockquote {
    color: var(--paper-text-secondary);
    background: var(--paper-quote-bg);
    border-color: var(--paper-separator);
    border-radius: 0 12px 12px 0;
    padding-block: 0.25rem;
  }

.milkdown .milkdown-theme-nord :is(code, pre) {
    background-color: var(--paper-code-bg);
    color: var(--paper-text-primary);
  }

.milkdown .milkdown-theme-nord code {
    color: var(--paper-accent);
  }

.milkdown .milkdown-theme-nord hr,
  .milkdown .milkdown-theme-nord.prose tr {
    border-color: var(--paper-separator);
  }

.milkdown .milkdown-theme-nord.prose :where(td, th):nth-child(odd) {
    background-color: var(--paper-table-stripe);
  }

@media (max-width: 768px) {
  .milkdown {
    flex: 1 1 auto;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    min-height: 100% !important;
    height: 100% !important;
    padding: 0.5rem;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  }

.milkdown > .editor {
  outline: none;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.milkdown > .editor:first-child {
  padding: 8px;
}

  .editor-shell.svelte-nmz6rb {
    position: relative;
    width: 100%;
    min-width: 0;
    min-height: 100%;
  }

  .editor-shell[data-editor-font='sans'].svelte-nmz6rb .milkdown,
  .editor-shell[data-editor-font='sans'].svelte-nmz6rb .milkdown .editor {
    font-family: var(--editor-font-inter);
  }

  .editor-shell[data-editor-font='serif'].svelte-nmz6rb .milkdown,
  .editor-shell[data-editor-font='serif'].svelte-nmz6rb .milkdown .editor {
    font-family: var(--editor-font-serif);
  }

  .editor-shell[data-editor-font='mono'].svelte-nmz6rb .milkdown,
  .editor-shell[data-editor-font='mono'].svelte-nmz6rb .milkdown .editor {
    font-family: var(--editor-font-mono);
  }

  .editor-host.svelte-nmz6rb {
    width: 100%;
    min-width: 0;
    min-height: 100%;
    display: flex;
    justify-content: center;
  }

  .upload-placeholder-layer.svelte-nmz6rb {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: clamp(6rem, 14vh, 9rem);
    pointer-events: none;
  }

  .upload-placeholder.svelte-nmz6rb {
    width: min(26rem, calc(100% - 3rem));
    min-height: 12rem;
    border: 2px dashed color-mix(in srgb, var(--paper-accent) 40%, var(--border-color));
    border-radius: 18px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--paper-bg) 92%, white) 0%, var(--paper-bg) 100%);
    box-shadow: 0 20px 40px color-mix(in srgb, var(--shadow-color) 40%, transparent);
    display: grid;
    place-items: center;
    gap: 0.9rem;
    padding: 1.5rem;
    text-align: center;
  }

  .upload-copy.svelte-nmz6rb {
    display: grid;
    gap: 0.35rem;
    color: var(--paper-text-secondary);
  }

  .upload-copy.svelte-nmz6rb strong:where(.svelte-nmz6rb) {
    color: var(--paper-text-primary);
    font-size: 1rem;
    font-weight: 700;
  }

  .upload-copy.svelte-nmz6rb span:where(.svelte-nmz6rb) {
    font-size: 0.92rem;
  }

  .upload-spinner.svelte-nmz6rb {
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    border: 3px solid color-mix(in srgb, var(--paper-accent) 18%, transparent);
    border-top-color: var(--paper-accent);
    animation: svelte-nmz6rb-upload-spin 0.85s linear infinite;
  }

  @keyframes svelte-nmz6rb-upload-spin {
    to {
      transform: rotate(360deg);
    }
  }

  @media (max-width: 768px) {
    .editor-shell.svelte-nmz6rb {
      min-height: 100%;
      height: 100%;
      display: flex;
      flex-direction: column;
    }

    .editor-host.svelte-nmz6rb {
      justify-content: stretch;
      flex: 1 1 auto;
      min-height: 100%;
    }

    .upload-placeholder-layer.svelte-nmz6rb {
      padding-top: 2rem;
      align-items: flex-start;
    }

    .upload-placeholder.svelte-nmz6rb {
      width: calc(100% - 1.5rem);
      min-height: 9.5rem;
      border-radius: 14px;
      padding: 1.25rem;
    }
  }

  .command-palette-overlay {
    position: fixed;
    inset: 0;
    background:
      radial-gradient(circle at top, color-mix(in srgb, var(--brand-accent-soft, var(--paper-accent)) 30%, transparent) 0%, transparent 45%),
      rgba(14, 18, 28, 0.42);
    backdrop-filter: blur(16px);
    z-index: 40;
  }

  .command-palette-content {
    position: fixed;
    top: min(14vh, 5rem);
    left: 50%;
    width: min(42rem, calc(100vw - 2rem));
    transform: translateX(-50%);
    border: 1px solid color-mix(in srgb, var(--menu-border, var(--border-color)) 85%, white);
    border-radius: 1rem;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--menu-surface, var(--paper-bg)) 96%, white) 0%, var(--menu-surface, var(--paper-bg)) 100%);
    box-shadow:
      0 28px 80px color-mix(in srgb, var(--menu-shadow, var(--shadow-color)) 55%, transparent),
      0 1px 0 rgba(255, 255, 255, 0.6) inset;
    padding: 0;
    z-index: 50;
  }

  .command-palette-shell.svelte-1bm0yy4 {
    display: grid;
    gap: 0;
    overflow: hidden;
  }

  .command-palette-head.svelte-1bm0yy4 {
    display: grid;
    gap: 0.4rem;
    padding: 0.7rem 0.7rem 0.6rem;
    border-bottom: 1px solid color-mix(in srgb, var(--menu-border, var(--border-color)) 75%, white);
  }

  .command-palette-input {
    width: 100%;
    border: 1px solid color-mix(in srgb, var(--menu-border, var(--border-color)) 95%, white);
    border-radius: 0.75rem;
    padding: 0.68rem 0.82rem;
    background: rgba(255, 255, 255, 0.72);
    color: var(--brand-text-primary, var(--text-primary));
    font: inherit;
  }

  .command-palette-input:focus {
    outline: 2px solid var(--brand-accent, var(--accent-color));
    outline-offset: 2px;
  }

  .command-palette-list {
    max-height: min(60vh, 30rem);
    overflow-y: auto;
    padding: 0.35rem;
    display: grid;
    gap: 0.28rem;
    scroll-padding-block: 0.45rem;
  }

  .command-palette-list [cmdk-group-heading],
  .command-palette-list [data-cmdk-group-heading] {
    padding: 0.5rem 0.55rem 0.35rem;
    font-size: 0.74rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-text-secondary, var(--text-secondary));
  }

  .command-row {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.9rem;
    padding: 0.72rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 0.85rem;
    color: var(--brand-text-primary, var(--text-primary));
    transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
  }

  .command-row-copy.svelte-1bm0yy4 {
    min-width: 0;
    display: grid;
    gap: 0.22rem;
  }

  .command-row-copy.svelte-1bm0yy4 strong:where(.svelte-1bm0yy4) {
    font-size: 0.95rem;
    color: var(--brand-text-primary, var(--text-primary));
  }

  .command-row-copy.svelte-1bm0yy4 span:where(.svelte-1bm0yy4) {
    font-size: 0.82rem;
    line-height: 1.35;
    color: var(--brand-text-secondary, var(--text-secondary));
    overflow-wrap: anywhere;
  }

  mark.match-highlight.svelte-1bm0yy4 {
    display: inline;
    background: color-mix(in srgb, var(--brand-accent) 30%, white);
    color: color-mix(in srgb, var(--brand-accent-strong, var(--accent-color)) 82%, black 18%);
    border-radius: 0.3rem;
    padding: 0.05rem 0.14rem;
    font-weight: 600;
    text-decoration: none;
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--brand-accent) 32%, transparent);
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
  }

  .command-enter-key {
    display: none;
    flex: 0 0 auto;
    margin-left: auto;
    border: 1px solid color-mix(in srgb, var(--menu-border, var(--border-color)) 92%, white);
    border-bottom-width: 2px;
    border-radius: 0.5rem;
    padding: 0.24rem 0.42rem;
    background: rgba(255, 255, 255, 0.78);
    color: var(--brand-text-secondary, var(--text-secondary));
    font: inherit;
    font-size: 0.92rem;
    line-height: 1;
  }

  .command-empty {
    padding: 1rem;
    color: var(--brand-text-secondary, var(--text-secondary));
    font-size: 0.86rem;
  }

  .command-row[data-selected] {
    border-color: transparent;
    background: color-mix(in srgb, black 10%, var(--menu-surface, var(--paper-bg)));
    box-shadow: 0 8px 18px color-mix(in srgb, black 8%, transparent);
    transform: none;
  }

  .command-row[data-selected] .command-enter-key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .command-row[data-selected] .command-row-copy strong {
    color: color-mix(in srgb, var(--brand-text-primary, var(--text-primary)) 84%, black 16%);
  }

  .command-row[data-selected] .command-row-copy span {
    color: color-mix(in srgb, var(--brand-text-secondary, var(--text-secondary)) 82%, black 18%);
  }

  .command-row[data-selected] mark.match-highlight {
    background: color-mix(in srgb, var(--brand-accent-strong, var(--accent-color)) 42%, white);
    color: color-mix(in srgb, var(--brand-text-primary, var(--text-primary)) 80%, black 20%);
  }

  @media (max-width: 640px) {
    .command-palette-content {
      top: 1rem;
      width: calc(100vw - 1rem);
    }

    .command-row {
      gap: 0.75rem;
      padding: 0.68rem 0.72rem;
    }

    .command-enter-key {
      display: none;
    }
  }

  .settings-overlay.svelte-182y78p {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
  }

  .settings-dismiss.svelte-182y78p {
    position: absolute;
    inset: 0;
    border: 0;
    padding: 0;
    margin: 0;
    border-radius: 0;
    background: transparent;
  }

   .settings-modal.svelte-182y78p {
     position: relative;
     background: var(--bg-primary);
     color: var(--text-primary);
     border-radius: 8px;
     padding: 24px;
     max-width: 400px;
     width: 90%;
     max-height: 80vh;
     overflow-y: auto;
     box-shadow: 0 20px 25px -5px var(--shadow-color), 0 10px 10px -5px var(--shadow-color);
   }

   @media (max-width: 768px) {
     .settings-modal.svelte-182y78p {
       width: 95%;
       padding: 20px;
       margin: 10px;
     }

     .close-button.svelte-182y78p {
       min-width: 44px;
       min-height: 44px;
       width: 44px;
       height: 44px;
     }

     .save-button.svelte-182y78p, .clear-button.svelte-182y78p {
       min-height: 44px;
       padding: 10px 16px;
     }
   }

  .settings-header.svelte-182y78p {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
  }

  .settings-header.svelte-182y78p h2:where(.svelte-182y78p) {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
  }

  .close-button.svelte-182y78p {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    color: var(--text-primary);
  }

  .close-button.svelte-182y78p:hover {
    background: var(--bg-secondary);
  }

  .setting-group.svelte-182y78p {
    margin-bottom: 20px;
  }

  .setting-group.svelte-182y78p label:where(.svelte-182y78p) {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
  }

  .input-wrapper.svelte-182y78p {
    position: relative;
    display: flex;
    align-items: center;
  }

  .api-key-input.svelte-182y78p {
    width: 100%;
    padding: 10px 12px;
    padding-right: 40px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    font-family: monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
  }

  .toggle-visibility.svelte-182y78p {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
    opacity: 0.6;
    transition: opacity 0.2s;
  }

  .toggle-visibility.svelte-182y78p:hover {
    opacity: 1;
  }

  .api-key-input.svelte-182y78p:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  }

  .api-key-help.svelte-182y78p {
    margin-top: 6px;
    font-size: 12px;
    color: var(--text-secondary);
  }

  .api-key-help.svelte-182y78p a:where(.svelte-182y78p) {
    color: var(--accent-color);
    text-decoration: none;
  }

  .api-key-help.svelte-182y78p a:where(.svelte-182y78p):hover {
    text-decoration: underline;
  }

  .setting-actions.svelte-182y78p {
    display: flex;
    gap: 8px;
    align-items: center;
  }

  .save-button.svelte-182y78p {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
  }

  .save-button.svelte-182y78p:hover:not(:disabled) {
    background: var(--accent-hover);
  }

  .save-button.svelte-182y78p:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
  }

  .clear-button.svelte-182y78p {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
  }

  .clear-button.svelte-182y78p:hover {
    background: var(--button-hover);
    border-color: var(--border-hover);
  }

  .success-message.svelte-182y78p {
    color: var(--success-color);
    font-size: 14px;
    font-weight: 500;
  }

  main.svelte-1n46o8q {
    height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 22rem minmax(0, 1fr);
    gap: 1.5rem;
    font-family: var(--ui-font);
    margin: 0;
    padding: 1.5rem;
    background: var(--shell-bg);
    overflow: hidden;
  }

  main.sidebar-collapsed.svelte-1n46o8q {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  aside.svelte-1n46o8q {
    display: flex;
    align-items: flex-start;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
    transition: width 0.24s ease, transform 0.24s ease, opacity 0.24s ease;
  }

  aside.collapsed.svelte-1n46o8q {
    width: 0;
    min-width: 0;
    opacity: 0;
  }

  .workspace.svelte-1n46o8q {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    gap: 1rem;
  }

  .sidebar-backdrop.svelte-1n46o8q {
    display: none;
  }

  .menu-card.svelte-1n46o8q {
    width: min(100%, 22rem);
    max-height: min(calc(100dvh - 3rem), 48rem);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--menu-border);
    border-radius: 0.75rem;
    background: var(--menu-surface);
    backdrop-filter: blur(24px);
    box-shadow: 0 12px 28px color-mix(in srgb, var(--menu-shadow) 45%, transparent);
    overflow: hidden;
  }

  .menu-header.svelte-1n46o8q {
    padding: 1rem 1rem 0.85rem;
    display: grid;
    gap: 0.8rem;
    border-bottom: 1px solid color-mix(in srgb, var(--menu-border) 75%, white);
  }

  .menu-header-row.svelte-1n46o8q {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
  }

  .brand-block.svelte-1n46o8q {
    display: grid;
    gap: 0;
  }

  .brand-block.svelte-1n46o8q h1:where(.svelte-1n46o8q) {
    margin: 0;
    font-size: 1.38rem;
    line-height: 1.05;
    color: var(--brand-text-primary);
    font-family: var(--editor-font-serif);
    font-weight: 700;
  }

  .sidebar-close.svelte-1n46o8q,
  .sidebar-toggle.svelte-1n46o8q,
  .font-option.svelte-1n46o8q,
  .new-note-button.svelte-1n46o8q,
  .settings-button.svelte-1n46o8q,
  .note-delete.svelte-1n46o8q,
  .note-link.svelte-1n46o8q {
    font-family: var(--ui-font);
  }

  .sidebar-close.svelte-1n46o8q {
    display: none;
    margin-left: auto;
    min-height: auto;
    padding: 0.1rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: color-mix(in srgb, var(--brand-text-secondary) 88%, var(--brand-accent));
    line-height: 1;
    gap: 0.35rem;
    align-items: center;
  }

  .sidebar-close.svelte-1n46o8q svg:where(.svelte-1n46o8q) {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
  }

  .sidebar-search.svelte-1n46o8q {
    width: 100%;
    min-width: 0;
    border: 1px solid color-mix(in srgb, var(--menu-border) 95%, white);
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.72);
    color: var(--brand-text-primary);
    padding: 0.42rem 0.72rem;
    font: 0.82rem/1.2 inherit;
  }

  .sidebar-search.svelte-1n46o8q:focus {
    outline: 2px solid var(--brand-accent);
    outline-offset: 2px;
  }

  .notes-section.svelte-1n46o8q {
    min-height: 0;
    flex: 0 1 auto;
    display: flex;
    flex-direction: column;
  }

  .notes-section-header.svelte-1n46o8q {
    padding: 0.45rem 0.75rem 0.3rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
  }

  .notes-nav.svelte-1n46o8q {
    display: flex;
    flex-direction: column;
    gap: 0.28rem;
    padding: 0 0.6rem 0.6rem;
    min-height: 0;
    max-height: min(50vh, 28rem);
    overflow-y: auto;
  }

  .empty-state.svelte-1n46o8q {
    margin: 0;
    color: var(--brand-text-secondary);
    font-size: 0.85rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border: 1px dashed color-mix(in srgb, var(--menu-border) 85%, white);
    border-radius: 0.45rem;
    font-family: system-ui, sans-serif;
  }

  .note-row.svelte-1n46o8q {
    display: flex;
    align-items: stretch;
    gap: 0.22rem;
    border: 1px solid transparent;
    border-radius: 0.4rem;
    background: transparent;
    transition: background 0.2s ease, border-color 0.2s ease;
  }

  .note-link.svelte-1n46o8q {
    width: 100%;
    text-align: left;
    justify-content: flex-start;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.62rem 0.72rem;
    background: transparent;
    border: 1px solid transparent;
    box-shadow: none;
    flex: 1;
    min-width: 0;
  }

  .new-note-button.svelte-1n46o8q:focus,
  .new-note-button.svelte-1n46o8q:focus-visible,
  .note-link.svelte-1n46o8q:focus,
  .note-link.svelte-1n46o8q:focus-visible,
  .note-delete.svelte-1n46o8q:focus,
  .note-delete.svelte-1n46o8q:focus-visible,
  .sidebar-toggle.svelte-1n46o8q:focus,
  .sidebar-toggle.svelte-1n46o8q:focus-visible {
    outline: none;
    box-shadow: none;
  }

  .note-row.selected.svelte-1n46o8q {
    border-color: color-mix(in srgb, var(--brand-accent) 35%, white);
    background: color-mix(in srgb, var(--brand-accent-soft) 88%, white);
  }

  .note-row.locked-note.svelte-1n46o8q {
    opacity: 0.68;
  }

  .note-delete.svelte-1n46o8q {
    opacity: 0;
    pointer-events: none;
    align-self: center;
    flex-shrink: 0;
    min-width: 28px;
    min-height: 28px;
    padding: 0;
    border: 1px solid transparent;
    background: transparent;
    color: #dc2626;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  }

  .note-title-row.svelte-1n46o8q {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
  }

  .note-title.svelte-1n46o8q {
    font-size: 0.82rem;
    color: var(--brand-text-primary);
    flex: 1;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .note-lock-badge.svelte-1n46o8q {
    flex-shrink: 0;
    font-size: 0.62rem;
    color: var(--brand-text-secondary);
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid color-mix(in srgb, var(--menu-border) 90%, white);
    border-radius: 0.35rem;
    padding: 0.1rem 0.36rem;
  }

  .menu-footer.svelte-1n46o8q {
    border-top: 1px solid color-mix(in srgb, var(--menu-border) 75%, white);
    padding: 0.7rem 1rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  .footer-meta.svelte-1n46o8q {
    min-height: 0;
    margin-right: auto;
    color: var(--brand-text-secondary);
    font: 0.82rem/1.4 system-ui, sans-serif;
  }

  .editor-controls.svelte-1n46o8q {
    width: min(210mm, 100%);
    max-width: min(210mm, 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    align-self: center;
  }

  .editor-share-link.svelte-1n46o8q {
    min-height: auto;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand-text-secondary);
    font: 0.78rem/1.2 var(--ui-font);
    white-space: nowrap;
    text-decoration: underline;
    text-underline-offset: 0.14em;
  }

  .editor-share-link.svelte-1n46o8q:hover {
    background: transparent;
    color: var(--brand-accent-strong);
  }

  .editor-share-link.svelte-1n46o8q:active {
    background: transparent;
  }

  .editor-share-link.svelte-1n46o8q:focus,
  .editor-share-link.svelte-1n46o8q:focus-visible {
    outline: none;
    box-shadow: none;
  }

  .sidebar-toggle.svelte-1n46o8q,
  .new-note-button.svelte-1n46o8q,
  .settings-button.svelte-1n46o8q {
    padding: 0.72rem 1rem;
    cursor: pointer;
    border: 1px solid color-mix(in srgb, var(--menu-border) 90%, white);
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.72);
    color: var(--brand-text-primary);
    font-size: 0.87rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 2.7rem;
  }

  .editor-toolbar.svelte-1n46o8q {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
    padding: 0.15rem 0;
    border: 1px solid color-mix(in srgb, var(--menu-border) 85%, white);
    border-radius: 0.45rem;
    background: rgba(255, 255, 255, 0.58);
    opacity: 0.42;
    transition: opacity 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  }

  .editor-toolbar.svelte-1n46o8q:hover,
  .editor-toolbar.svelte-1n46o8q:focus-within {
    opacity: 1;
  }

  .font-option.svelte-1n46o8q {
    min-height: auto;
    padding: 0.42rem 0.72rem;
    border: 0;
    border-radius: 0.3rem;
    background: transparent;
    color: var(--brand-text-secondary);
    font-size: 0.78rem;
    line-height: 1;
  }

  .font-option.selected.svelte-1n46o8q {
    background: color-mix(in srgb, var(--brand-accent-soft) 90%, white);
    color: var(--brand-text-primary);
  }

  .new-note-button.svelte-1n46o8q {
    flex-shrink: 0;
    white-space: nowrap;
    min-height: auto;
    padding: 0.18rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: color-mix(in srgb, var(--brand-text-secondary) 88%, var(--brand-accent));
    font-size: 0.76rem;
    font-weight: 600;
  }

  .sidebar-toggle.svelte-1n46o8q:hover,
  .font-option.svelte-1n46o8q:hover,
  .new-note-button.svelte-1n46o8q:hover,
  .settings-button.svelte-1n46o8q:hover,
  .note-row.svelte-1n46o8q:hover,
  .note-link.svelte-1n46o8q:hover {
    background: color-mix(in srgb, var(--brand-accent-soft) 65%, white);
    border-color: transparent;
  }

  .new-note-button.svelte-1n46o8q:hover {
    background: transparent;
    border-color: transparent;
    color: var(--brand-accent-strong);
  }

  .note-row.svelte-1n46o8q:hover .note-delete:where(.svelte-1n46o8q),
  .note-row.svelte-1n46o8q:focus-within .note-delete:where(.svelte-1n46o8q) {
    opacity: 1;
    pointer-events: auto;
  }

  .note-delete.svelte-1n46o8q:hover {
    background: transparent;
    border-color: transparent;
    color: #dc2626;
  }

  .new-note-button.svelte-1n46o8q:active,
  .settings-button.svelte-1n46o8q:active,
  .sidebar-toggle.svelte-1n46o8q:active,
  .font-option.svelte-1n46o8q:active,
  .note-link.svelte-1n46o8q:active {
    background: color-mix(in srgb, var(--brand-accent-soft) 95%, white);
  }

  .new-note-button.svelte-1n46o8q:active {
    background: transparent;
  }

  .sidebar-toggle.svelte-1n46o8q {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    align-self: flex-start;
    min-height: auto;
    min-width: 1.4rem;
    padding: 0.1rem 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: color-mix(in srgb, var(--brand-text-secondary) 88%, var(--brand-accent));
    box-shadow: none;
    gap: 0.35rem;
  }

  .sidebar-toggle.svelte-1n46o8q svg:where(.svelte-1n46o8q) {
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
  }

  .sidebar-toggle-label.svelte-1n46o8q {
    font-size: 0.72rem;
    line-height: 1;
  }

  .settings-button.svelte-1n46o8q {
    min-height: auto;
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }

  .editor-wrapper.svelte-1n46o8q {
    flex: 1;
    min-height: 0;
    padding: 0;
    overflow: hidden;
    overflow-y: auto;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 100%;
  }

  .editor-wrapper.locked.svelte-1n46o8q .milkdown {
    opacity: 0.5;
    pointer-events: none;
    user-select: none;
  }

  .lock-overlay.svelte-1n46o8q {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: color-mix(in srgb, var(--shell-bg) 72%, transparent);
  }

  .lock-card.svelte-1n46o8q {
    max-width: 320px;
    padding: 20px;
    border-radius: 0.45rem;
    border: 1px solid var(--menu-border);
    background: rgba(255, 252, 246, 0.96);
    box-shadow: 0 10px 24px var(--shadow-color);
    text-align: center;
  }

  .lock-card.svelte-1n46o8q h2:where(.svelte-1n46o8q) {
    margin: 0 0 8px;
    font-size: 18px;
  }

  .lock-card.svelte-1n46o8q p:where(.svelte-1n46o8q) {
    margin: 0 0 16px;
    color: var(--brand-text-secondary);
  }

  .clone-button.svelte-1n46o8q {
    width: 100%;
    font-family: system-ui, sans-serif;
  }

  @media (max-width: 900px) {
    main.svelte-1n46o8q {
      grid-template-columns: 1fr;
      position: relative;
      padding: 1rem;
    }

    main.sidebar-collapsed.svelte-1n46o8q {
      grid-template-columns: 1fr;
    }

    aside.svelte-1n46o8q {
      position: absolute;
      inset: 1rem auto 1rem 1rem;
      width: min(22rem, calc(100vw - 2rem));
      min-width: min(22rem, calc(100vw - 2rem));
      transform: translateX(-100%);
      z-index: 10;
    }

    .menu-card.svelte-1n46o8q {
      max-height: calc(100dvh - 2rem);
    }

    aside.collapsed.svelte-1n46o8q {
      width: min(22rem, calc(100vw - 2rem));
      min-width: min(22rem, calc(100vw - 2rem));
    }

    aside.open.svelte-1n46o8q {
      transform: translateX(0);
      opacity: 1;
    }

    .sidebar-close.svelte-1n46o8q {
      display: flex;
    }

    .sidebar-backdrop.svelte-1n46o8q {
      display: block;
      position: absolute;
      inset: 0;
      border: 0;
      padding: 0;
      margin: 0;
      background: color-mix(in srgb, var(--shell-bg) 35%, transparent);
      z-index: 9;
      cursor: pointer;
    }
  }

  @media (max-width: 768px) {
    main.svelte-1n46o8q {
      height: 100dvh;
      padding: 0.75rem;
    }

    .workspace.svelte-1n46o8q {
      min-height: 0;
      height: 100%;
    }

    .sidebar-toggle.svelte-1n46o8q,
    .font-option.svelte-1n46o8q,
    .new-note-button.svelte-1n46o8q,
    .note-link.svelte-1n46o8q,
    .settings-button.svelte-1n46o8q {
      min-height: 44px;
      font-size: 13px;
    }

    .font-option.svelte-1n46o8q {
      min-height: auto;
      padding: 0.36rem 0.62rem;
      font-size: 0.74rem;
    }

    .editor-toolbar.svelte-1n46o8q {
      width: auto;
      justify-content: center;
      margin-left: 0;
      padding: 0.1rem;
    }

    .editor-controls.svelte-1n46o8q {
      width: 100%;
      gap: 0.75rem;
      flex-shrink: 0;
    }

    .notes-section-header.svelte-1n46o8q {
      justify-content: center;
    }

    .new-note-button.svelte-1n46o8q,
    .settings-button.svelte-1n46o8q {
      width: auto;
      justify-content: center;
    }

    .editor-wrapper.svelte-1n46o8q {
      padding: 0;
      align-items: stretch;
      flex: 1 1 auto;
      min-height: 0;
    }

    .lock-overlay.svelte-1n46o8q {
      inset: 0;
      border-radius: 0;
    }

    .lock-card.svelte-1n46o8q {
      padding: 18px;
    }

    .lock-card.svelte-1n46o8q {
      width: min(100%, 320px);
    }
  }
