html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font-family: sans-serif;
}

#workspace {
  background: #f0f0f0;
  cursor: default;
  display: block;
}

body.dark #workspace {
  background: #222;
  color: #eee;
}

#toolbar {
  position: fixed;
  top: 0;
  left: 0;
  background: #ccc;
  padding: 4px;
  z-index: 10;
}

body.dark #toolbar {
  background: #333;
  color: #eee;
}

#sidebar {
  position: fixed;
  top: 40px;
  right: 0;
  background: #eee;
  padding: 8px;
  width: 160px;
  z-index: 10;
  box-sizing: border-box;
}

body.dark #sidebar {
  background: #444;
  color: #fff;
}

.sidebar-resizer {
  position: absolute;
  left: -5px;
  top: 0;
  width: 5px;
  height: 100%;
  cursor: ew-resize;
}

.sidebar-resizer:hover {
  background: rgba(0, 0, 0, 0.1);
}

#sidebar label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  white-space: nowrap;
}

#sidebar label input,
#sidebar label select {
  flex: 1;
  margin-left: 4px;
}

.hidden {
  display: none !important;
}

.temp {
  stroke: #888;
  stroke-dasharray: 4;
}

.context-menu {
  font-family: Arial, sans-serif;
  font-size: 14px;
}

.context-menu-item {
  transition: background-color 0.1s ease;
}

.context-menu-item:hover {
  background-color: #f0f0f0 !important;
}

.context-menu-item:active {
  background-color: #e0e0e0 !important;
}

body.dark .context-menu {
  background: #333;
  border-color: #555;
  color: white;
}

body.dark .context-menu-item {
  border-bottom-color: #555;
}

body.dark .context-menu-item:hover {
  background-color: #444 !important;
}

body.dark .context-menu-item:active {
  background-color: #555 !important;
}

#helpBtn {
  font-size: 18px;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  padding: 0;
}

#helpModal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 20;
}

.help-content {
  background: #fff;
  padding: 20px;
  max-width: 400px;
  max-height: 80%;
  overflow: auto;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

body.dark .help-content {
  background: #333;
  color: #fff;
}

@media (max-width: 600px) {
  #sidebar {
    width: 100%;
    height: auto;
    top: auto;
    bottom: 0;
    padding: 8px 12px;
    min-height: 36px;
  }

  .sidebar-resizer {
    display: none;
  }

  /* Increase resize handle touch target */
  .resize-handle {
    r: 8px;
  }
}