* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  color: #111827;
  background: #f7f9fb;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

#app {
  display: grid;
  grid-template-columns: 280px 1fr;
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "toolbar toolbar"
    "sidebar canvas"
    "status status";
  height: 100vh;
}

.toolbar {
  grid-area: toolbar;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  background: #0f172a;
  color: #e5e7eb;
  align-items: center;
}

.toolbar .ui-btn {
  background: #1f2937;
  color: #e5e7eb;
}

.sidebar {
  grid-area: sidebar;
  padding: 8px;
  background: #ffffff;
  border-right: 1px solid #e5e7eb;
  overflow-y: auto;
}

.canvas-wrapper {
  grid-area: canvas;
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
}

#editor-svg {
  width: 100%;
  height: 100%;
  cursor: crosshair;
}

.panel {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 12px;
  overflow: hidden;
}

.panel-header {
  padding: 8px 10px;
  font-weight: 600;
  background: #e5e7eb;
}

.panel-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ui-btn {
  border: 1px solid #cbd5e1;
  background: #e5e7eb;
  color: #111827;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}

.ui-btn:hover {
  background: #dbeafe;
}

.ui-btn.toggle.active {
  background: #93c5fd;
  color: #0f172a;
}

.ui-input,
.ui-select {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 14px;
}

.ui-input input,
.ui-select select {
  flex: 1;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
}

.color-palette {
  display: grid;
  grid-template-columns: repeat(auto-fill, 28px);
  gap: 6px;
}

.color-swatch {
  width: 28px;
  height: 28px;
  border: 2px solid #f8fafc;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
}

.color-swatch:hover {
  border-color: #0ea5e9;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-display {
  font-weight: 600;
  padding: 0 6px;
}

.status-bar {
  grid-area: status;
  background: #111827;
  color: #e5e7eb;
  padding: 6px 10px;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.selection-rect {
  fill: rgba(59, 130, 246, 0.1);
  stroke: #3b82f6;
  stroke-width: 1;
  stroke-dasharray: 4 2;
  pointer-events: none;
}

.node {
  cursor: pointer;
  stroke: #111827;
  stroke-width: 2;
}

.connection {
  stroke: #111827;
  stroke-width: 2;
  fill: none;
  pointer-events: stroke;
}

.text-item {
  cursor: text;
  fill: #111827;
  font-weight: 600;
}

.selected {
  filter: drop-shadow(0 0 4px rgba(59, 130, 246, 0.6));
}

.grid {
  stroke: #e5e7eb;
  stroke-width: 0.5;
}

.toolbar-group {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-right: 12px;
}

.hidden {
  display: none;
}
