.notes-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  margin: 0;
  background: var(--bg, #0f1115);
  color: var(--text, #e8eaed);
}

.notes-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border, #2a2e36);
  background: var(--panel-bg, #141821);
  flex: 0 0 auto;
}

.notes-page-header h1 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.notes-back {
  color: var(--text-muted, #98a0ad);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid transparent;
}

.notes-back:hover {
  background: var(--button-bg-hover, #1d222d);
  border-color: var(--button-border, #2a2e36);
}

.notes-page-status {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted, #98a0ad);
  min-height: 1em;
}

.notes-page-main {
  display: grid;
  grid-template-columns: 240px 1fr;
  flex: 1 1 auto;
  min-height: 0;
}

.notes-sidebar {
  border-right: 1px solid var(--border, #2a2e36);
  background: var(--panel-bg, #141821);
  overflow-y: auto;
  padding: 12px 0;
}

.notes-sidebar-section + .notes-sidebar-section {
  margin-top: 14px;
}

.notes-sidebar-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted, #98a0ad);
  padding: 0 16px;
  margin-bottom: 4px;
}

.notes-sidebar-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.notes-sidebar-list li {
  margin: 0;
}

.notes-sidebar-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  color: var(--text, #e8eaed);
  text-decoration: none;
  font-size: 13px;
  border-left: 2px solid transparent;
}

.notes-sidebar-list a:hover {
  background: var(--button-bg-hover, #1d222d);
}

.notes-sidebar-list a.active {
  background: var(--accent-soft, #1c2a3a);
  border-left-color: var(--accent-strong, #4d8ed8);
  font-weight: 500;
}

.notes-sidebar-list .badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--button-bg, #1d222d);
  color: var(--text-muted, #98a0ad);
  text-transform: uppercase;
}

.notes-sidebar-list .badge.local {
  background: rgba(77, 142, 216, 0.18);
  color: #8eb6e4;
}

.notes-page-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.notes-page-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border, #2a2e36);
  flex-wrap: wrap;
}

.notes-view-tabs {
  display: inline-flex;
  border: 1px solid var(--button-border, #2a2e36);
  border-radius: 6px;
  overflow: hidden;
}

.notes-view-tabs button {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 6px 14px;
  min-height: 32px;
  color: var(--text, #e8eaed);
  font-size: 13px;
}

.notes-view-tabs button + button {
  border-left: 1px solid var(--button-border, #2a2e36);
}

.notes-view-tabs button[aria-selected="true"] {
  background: var(--accent-soft, #1c2a3a);
  color: var(--text, #e8eaed);
}

.notes-source-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted, #98a0ad);
}

.notes-source-segmented {
  display: inline-flex;
  border: 1px solid var(--button-border, #2a2e36);
  border-radius: 6px;
  overflow: hidden;
}

.notes-source-segmented button {
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 5px 10px;
  min-height: 28px;
  color: var(--text, #e8eaed);
  font-size: 12px;
}

.notes-source-segmented button + button {
  border-left: 1px solid var(--button-border, #2a2e36);
}

.notes-source-segmented button.active {
  background: var(--accent-soft, #1c2a3a);
}

.notes-source-hint {
  font-size: 11px;
  color: var(--text-muted, #98a0ad);
}

.notes-record-body {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 16px 16px;
}

#notesText {
  flex: 1 1 auto;
  width: 100%;
  resize: none;
  border: 1px solid var(--button-border, #2a2e36);
  background: var(--input-bg, #0c1018);
  color: var(--text, #e8eaed);
  border-radius: 8px;
  padding: 12px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
}

#notesText:focus {
  outline: 2px solid var(--accent-strong, #4d8ed8);
  outline-offset: -2px;
}

.task-list-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.kanban-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: auto;
}

.notes-sidebar-all {
  font-weight: 600;
}

.notes-sidebar-all.active {
  background: var(--accent-soft, #1c2a3a);
  border-left-color: var(--accent-strong, #4d8ed8);
}

.notes-sidebar-icon {
  display: inline-flex;
  width: 16px;
  justify-content: center;
  color: var(--text-muted, #98a0ad);
}

.outline-controls {
  display: inline-flex;
  gap: 6px;
  margin-left: auto;
}

.outline-control-btn {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid var(--button-border, #2a2e36);
  background: var(--button-bg, #1d222d);
  color: var(--text, #e8eaed);
  cursor: pointer;
}

.outline-control-btn:hover {
  background: var(--button-bg-hover, #2a313d);
}

.outline-view {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 6px 16px;
  font-size: 14px;
  line-height: 1.35;
}

.outline-node {
  margin: 0;
}

.outline-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 1px 0;
  box-sizing: border-box;
}

.outline-caret,
.outline-bullet {
  box-sizing: border-box;
  flex: 0 0 14px;
  width: 14px;
  min-width: 14px;
  max-width: 14px;
  align-self: center;
}

.outline-bullet {
  height: 6px;
  min-height: 6px;
  max-height: 6px;
  width: 6px;
  min-width: 6px;
  max-width: 6px;
  flex-basis: 6px;
  margin: 0 4px;
  border-radius: 50%;
  background: var(--text-muted, #98a0ad);
  opacity: 0.45;
  cursor: pointer;
  border: 0;
  padding: 0;
}

.outline-bullet:hover {
  opacity: 1;
}

.outline-bullet.has-children {
  background: var(--accent-strong, #4d8ed8);
  opacity: 0.9;
}

.outline-caret {
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #98a0ad);
  cursor: pointer;
  border: 0;
  background: transparent;
  font-size: 10px;
  user-select: none;
  padding: 0;
}

.outline-caret.collapsed::before {
  content: "▸";
}

.outline-caret:not(.collapsed)::before {
  content: "▾";
}

.outline-caret.invisible {
  visibility: hidden;
}

.outline-title {
  flex: 1 1 auto;
  min-width: 0;
  padding: 1px 4px;
  border-radius: 4px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text, #e8eaed);
  font: inherit;
  outline: none;
  line-height: 1.35;
}

.outline-title:focus {
  border-color: var(--accent-strong, #4d8ed8);
  background: var(--input-bg, #0c1018);
}

.outline-title.project-title,
.outline-title.general-title {
  font-weight: 600;
}

.outline-title.general-title {
  color: var(--accent-strong, #4d8ed8);
}

.outline-project-row {
  padding-top: 6px;
}

.outline-source-dot {
  flex: 0 0 6px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted, #98a0ad);
  opacity: 0.6;
  margin-left: 4px;
}

.outline-source-dot.local {
  background: var(--accent-strong, #4d8ed8);
}

.outline-children {
  margin-left: 14px;
  border-left: 1px solid var(--border, #2a2e36);
  padding-left: 8px;
}

.outline-children.hidden {
  display: none;
}

.outline-empty {
  font-size: 12px;
  color: var(--text-muted, #98a0ad);
  font-style: italic;
  padding: 2px 4px;
}

.outline-add-row .outline-title {
  color: var(--text-muted, #98a0ad);
  cursor: text;
  font-size: 12px;
  padding-left: 4px;
}

.notes-page.outline-mode .notes-sidebar {
  display: none;
}

.notes-page.outline-mode .notes-page-main {
  grid-template-columns: 1fr;
}

.notes-page.outline-mode .notes-record-body {
  padding: 6px 10px 12px;
}

.notes-page.outline-mode .notes-page-toolbar {
  padding: 6px 10px;
  gap: 8px;
}

.notes-page.outline-mode .notes-page-header h1 {
  display: none;
}

@media (max-width: 720px) {
  .notes-page-main {
    grid-template-columns: 1fr;
  }
  .notes-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--border, #2a2e36);
    max-height: 200px;
  }
  .outline-view {
    padding: 2px 4px 12px;
    font-size: 15px;
  }
  .outline-children {
    margin-left: 10px;
    padding-left: 6px;
  }
  .outline-control-btn {
    min-height: 32px;
  }
}
