:root {
  --note-1: #fff3b0;
  --note-2: #ffd6e0;
  --note-3: #c8f4de;
  --note-4: #cfe4ff;
  --note-5: #e6d6ff;

  --bg: #f4f2ee;
  --panel: #ffffff;
  --border: #e2ddd3;
  --text: #2b2a28;
  --text-dim: #8a8578;
  --accent: #4a4740;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
}

.hidden { display: none !important; }

.app {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 320px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-header h1 {
  font-size: 18px;
  margin: 0;
}

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

.note-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

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

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

.note-color-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.note-item-text {
  overflow: hidden;
  min-width: 0;
}

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

.note-item-preview {
  font-size: 12px;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.sidebar-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}

.sync-status {
  font-size: 11px;
  color: var(--text-dim);
  padding: 0 12px 10px;
  text-align: center;
}

.icon-btn {
  border: none;
  background: var(--bg);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover { background: var(--border); }

.text-btn {
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
}

.text-btn:hover { color: var(--text); }

.editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.empty-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
}

.editor-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 40px;
  min-height: 0;
}

.note-title-input {
  font-size: 24px;
  font-weight: 700;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  margin-bottom: 12px;
}

.color-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--swatch-color);
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}

.color-swatch.selected {
  border-color: var(--accent);
}

.delete-btn {
  margin-left: auto;
  background: none;
}

.delete-btn:hover { background: var(--border); }

.note-content-input {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  font-family: inherit;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.modal-box {
  background: var(--panel);
  border-radius: 10px;
  padding: 24px;
  width: 320px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-box h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.modal-box label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}

.modal-box input {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}

.modal-box input:focus {
  border-color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.primary-btn {
  border: none;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.primary-btn:hover { opacity: 0.9; }
