:root {
  --bg: #ffffff;
  --bg-soft: #f6f6f6;
  --bg-hover: #efefef;
  --bg-active: #e9f1fb;
  --border: #e5e5e5;
  --text: #2f2f2f;
  --text-soft: #808080;
  --accent: #086dd8;
  --nav-width: 220px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

:focus:not(:focus-visible) {
  outline: none;
}

#app {
  display: flex;
  height: 100vh;
  width: 100%;
}

/* Navigation sidebar */

.nav {
  width: var(--nav-width);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-soft);
  border-right: 1px solid var(--border);
}

.nav-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 16px 16px 12px;
}

.nav-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.nav-name {
  font-size: 14px;
  font-weight: 600;
}

.nav-items {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover {
  background: var(--bg-hover);
}

.nav-item.active {
  background: #e4e4e4;
  font-weight: 500;
}

.nav-item svg {
  color: var(--text-soft);
  flex-shrink: 0;
}

.nav-item.active svg {
  color: var(--accent);
}

.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--text-soft);
}

.nav-footer {
  margin-top: auto;
  padding: 12px 16px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-soft);
}

.nav-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
}

.new-category {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.new-category:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-categories {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 2px 8px;
}

.nav-category-icon {
  width: 15px;
  flex-shrink: 0;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
}

.nav-item.active .nav-category-icon {
  color: var(--accent);
}

.nav-category-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-category .close-note {
  opacity: 0;
  font-size: 14px;
  padding: 0 2px;
}

.nav-category:hover .close-note {
  opacity: 0.7;
}

/* Notes list panel */

.notes-panel {
  width: 280px;
  min-width: 0;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 12px 8px;
}

.panel-title {
  font-size: 13px;
  font-weight: 600;
}

.new-note {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.new-note:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.search-wrap {
  padding: 0 12px 10px;
}

.search {
  width: 100%;
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  background: var(--bg);
  outline: none;
}

.search:focus {
  border-color: var(--accent);
}

.search::placeholder {
  color: var(--text-soft);
}

.notes-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px 0;
}

.note-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: 0;
  border-left: 3px solid transparent;
  background: transparent;
  font: inherit;
  color: var(--text);
  text-align: left;
  padding: 9px 12px 9px 9px;
  cursor: pointer;
}

.note-item:hover {
  background: var(--bg-soft);
}

.note-item.active {
  background: var(--bg-active);
  border-left-color: var(--accent);
}

.note-item-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.note-item-title {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-item-snippet {
  font-size: 11.5px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.close-note {
  flex-shrink: 0;
  font-size: 15px;
  line-height: 1;
  color: var(--text-soft);
  opacity: 0;
  padding: 2px 4px;
  border-radius: 4px;
}

.note-item:hover .close-note {
  opacity: 0.7;
}

.close-note:hover {
  opacity: 1;
  background: var(--bg-hover);
  color: var(--text);
}

.empty-state {
  padding: 24px 12px;
  text-align: center;
  font-size: 12.5px;
  color: var(--text-soft);
}

/* Resize handle */

.resize-handle {
  width: 5px;
  flex-shrink: 0;
  cursor: col-resize;
  background: var(--bg);
  border-left: 1px solid var(--border);
}

.resize-handle:hover,
.resize-handle.dragging {
  background: var(--bg-soft);
}

/* Editor panel */

.editor-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}

.editor {
  flex: 1;
  width: 100%;
  border: 0;
  outline: none;
  resize: none;
  padding: 24px 32px;
  font: inherit;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: transparent;
}

.editor::placeholder {
  color: var(--text-soft);
}

.status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  border-top: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-soft);
}

.category-select {
  margin-left: auto;
  max-width: 160px;
  font: inherit;
  font-size: 11.5px;
  color: var(--text-soft);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 4px;
  cursor: pointer;
}

.category-select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Scrollbars */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #aaa;
}

@media (max-width: 720px) {
  .nav,
  .resize-handle {
    display: none;
  }

  .notes-panel {
    width: 180px !important;
  }
}
