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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  color: #222;
  background: #f7f8fa;
}

/* ---- Toolbar ---- */
#toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
#toolbar select, #toolbar button {
  font-size: 13px;
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
#toolbar button:hover { background: #f0f0f0; }
#saveStatus {
  margin-left: 4px;
  font-size: 12px;
  color: #6b7280;
}

/* ---- Layout ---- */
#main {
  display: flex;
  height: calc(100vh - 45px);
}
#mindMapContainer {
  flex: 1;
  height: 100%;
  background: #fff;
  position: relative;
}
#mindMapContainer * { margin: 0; padding: 0; }

/* ---- Sidebar ---- */
#sidebar {
  width: 340px;
  border-left: 1px solid #e5e7eb;
  background: #fff;
  overflow-y: auto;
  padding: 0 14px 14px;
  flex-shrink: 0;
}
#sidebar.hidden { display: none; }
#sidebarHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0 10px;
  border-bottom: 1px solid #f0f0f0;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
}
#sidebarTitle {
  font-weight: 600;
  font-size: 14px;
}
#closeSidebarBtn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  color: #6b7280;
  padding: 2px 6px;
}
.sidebar-section {
  margin-top: 14px;
}
.sidebar-label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 6px;
  font-weight: 500;
}
#sidebar textarea {
  width: 100%;
  font-family: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  resize: vertical;
}

/* ---- Status buttons ---- */
#statusButtons {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.status-btn {
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.status-btn.active {
  outline: 2px solid #2563eb;
  outline-offset: 1px;
  font-weight: 600;
}
.status-adopted { color: #15803d; border-color: #86efac; }
.status-adopted.active { background: #dcfce7; }
.status-rejected { color: #b91c1c; border-color: #fca5a5; }
.status-rejected.active { background: #fee2e2; }
.status-pending { color: #b45309; border-color: #fcd34d; }
.status-pending.active { background: #fef3c7; }
.status-in-progress { color: #1d4ed8; border-color: #93c5fd; }
.status-in-progress.active { background: #dbeafe; }

/* ---- Action buttons ---- */
.sidebar-actions {
  display: flex;
  gap: 6px;
}
.sidebar-actions button {
  flex: 1;
  font-size: 13px;
  padding: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.sidebar-actions button:hover { background: #f0f0f0; }
.sidebar-actions button.danger { color: #b91c1c; border-color: #fca5a5; }
.sidebar-actions button.danger:hover { background: #fee2e2; }

/* ---- Comments ---- */
#commentsList {
  margin-bottom: 8px;
}
.comment-item {
  padding: 8px;
  background: #f9fafb;
  border-radius: 4px;
  margin-bottom: 6px;
  border-left: 3px solid #93c5fd;
}
.comment-meta {
  font-size: 11px;
  color: #6b7280;
  margin-bottom: 3px;
}
.comment-author { font-weight: 600; color: #374151; }
.comment-text { font-size: 13px; color: #1f2937; white-space: pre-wrap; word-break: break-word; }
.comment-delete {
  float: right;
  font-size: 11px;
  color: #b91c1c;
  background: none;
  border: none;
  cursor: pointer;
}
.comment-add {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.comment-add textarea {
  width: 100%;
}
.comment-add button {
  align-self: flex-start;
  font-size: 13px;
  padding: 4px 12px;
  border: 1px solid #2563eb;
  background: #2563eb;
  color: #fff;
  border-radius: 4px;
  cursor: pointer;
}
.comment-add button:hover { background: #1d4ed8; }
