:root {
  --bg: #F5F0E8;
  --sidebar-bg: #1C1C1E;
  --editor-bg: #FFFDF7;
  --accent: #C17B3F;
  --text: #1C1C1E;
  --muted: #888;
  --border: #E8E0D0;
  --card-hover: #2A2A2C;
  --selected: #C17B3F;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app {
  display: flex;
  width: 95vw;
  max-width: 900px;
  height: 85vh;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.2);
}

/* SIDEBAR */
.sidebar {
  width: 260px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header h1 {
  color: white;
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 600;
}

.new-btn {
  background: var(--accent);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.2s;
}

.new-btn:hover { opacity: 0.8; }

#notesList {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

.note-item {
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
}

.note-item:hover { background: var(--card-hover); }
.note-item.active { background: var(--selected); }

.note-item-title {
  color: white;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-item-preview {
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* EDITOR */
.editor {
  flex: 1;
  background: var(--editor-bg);
  display: flex;
  flex-direction: column;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 28px 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 16px;
}

#noteTitle {
  flex: 1;
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--text);
  border: none;
  background: transparent;
  outline: none;
}

#noteTitle::placeholder { color: #CCC; }

.delete-btn {
  background: none;
  border: 1px solid #E0D0C0;
  color: var(--muted);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.delete-btn:hover { background: #FFF0F0; color: #E05555; border-color: #E05555; }

#noteBody {
  flex: 1;
  padding: 24px 28px;
  font-family: 'Lora', serif;
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
  border: none;
  background: transparent;
  outline: none;
  resize: none;
}

#noteBody::placeholder { color: #CCC; }

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 28px;
  border-top: 1px solid var(--border);
}

#wordCount {
  font-size: 12px;
  color: var(--muted);
}

.save-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 24px;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s;
}

.save-btn:hover { opacity: 0.85; }
.save-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.saved-msg {
  color: var(--accent);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.3s;
}

.saved-msg.show {
  opacity: 1;
}