body.notes-page {
  max-width: none;
  padding: 1rem 1.25rem 2rem;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notes-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.notes-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.notes-sidebar-head {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.notes-sidebar-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem 0;
}

.notes-sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.45rem 0.75rem;
  font: inherit;
  color: var(--text);
  cursor: pointer;
  border-radius: 0;
}

.notes-sidebar-item:hover {
  background: var(--surface-hover);
}

.notes-sidebar-item.active {
  background: var(--accent-muted);
  color: var(--accent-hover);
  font-weight: 600;
}

.notes-sidebar-icon {
  flex-shrink: 0;
  font-size: 0.95rem;
}

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

.notes-sidebar-empty {
  padding: 1rem 0.75rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.notes-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.notes-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.notes-content [hidden] {
  display: none !important;
}

.notes-active {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notes-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.notes-toolbar-spacer {
  flex: 1;
}

.notes-title-input {
  flex: 1;
  min-width: 12rem;
  font-size: 1.125rem;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--text);
  padding: 0.25rem 0;
  outline: none;
}

.notes-title-input:focus {
  box-shadow: inset 0 -2px 0 var(--accent);
}

.notes-view-tabs {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.notes-view-tab {
  border: none;
  background: var(--surface);
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
  color: var(--muted);
}

.notes-view-tab.active {
  background: var(--accent-muted);
  color: var(--accent-hover);
  font-weight: 600;
}

.notes-editor-pane,
.notes-preview-pane {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem 1.25rem 1.5rem;
}

.notes-editor-pane textarea {
  width: 100%;
  height: 100%;
  min-height: 20rem;
  resize: none;
  border: none;
  outline: none;
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text);
  background: transparent;
}

.notes-preview-pane {
  font-size: 0.975rem;
  line-height: 1.65;
}

.notes-preview-pane h1,
.notes-preview-pane h2,
.notes-preview-pane h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0.5rem;
  line-height: 1.3;
}

.notes-heading-text {
  flex: 1;
  min-width: 0;
}

.notes-preview-pane h1:first-child,
.notes-preview-pane h2:first-child,
.notes-preview-pane h3:first-child {
  margin-top: 0;
}

.notes-preview-pane h1 { font-size: 1.5rem; }
.notes-preview-pane h2 { font-size: 1.25rem; }
.notes-preview-pane h3 { font-size: 1.0625rem; }

.notes-preview-pane p { margin: 0.65rem 0; }
.notes-preview-pane ul,
.notes-preview-pane ol { margin: 0.5rem 0; padding-left: 1.4rem; }
.notes-preview-pane blockquote {
  margin: 0.75rem 0;
  padding: 0.5rem 0.85rem;
  border-left: 3px solid var(--accent);
  background: var(--bg-subtle);
  color: var(--muted);
}
.notes-preview-pane code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-subtle);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.notes-preview-pane pre {
  background: #1e293b;
  color: #e2e8f0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
}
.notes-preview-pane pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.notes-preview-empty {
  color: var(--muted);
  font-style: italic;
}

.notes-tts-btn {
  flex-shrink: 0;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  border-radius: var(--radius-sm);
  min-width: 2rem;
  height: 2rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.35rem;
}

.notes-tts-btn:hover,
.notes-tts-btn.is-playing {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.notes-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.975rem;
}

#save-status {
  font-size: 0.8125rem;
  color: var(--muted);
}

#save-status.is-dirty {
  color: var(--warn);
}

#save-status.is-error {
  color: var(--danger);
}

.notes-pause-btn[hidden] {
  display: none !important;
}

.notes-voice-label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8125rem;
  color: var(--muted);
}

.notes-voice-label-text {
  font-weight: 600;
}

.notes-voice-select {
  font: inherit;
  font-size: 0.8125rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}

@media (max-width: 768px) {
  body.notes-page {
    height: auto;
    overflow: auto;
  }
  .notes-layout {
    grid-template-columns: 1fr;
  }
  .notes-sidebar {
    max-height: 220px;
  }
}
