html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow: hidden;
  background: #f5fbff;
  color: #1f2933;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Top toolbar */

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid #cfe8ff;
  background: linear-gradient(90deg, #b6e0ff 0%, #b6ffdc 100%);
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-right {
  margin-left: auto;
}

.toolbar button,
.toolbar .icon-button,
.schema-button,
.schema-menu-dropdown button {
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #7fb0d8;
  background: #ffffffaa;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.toolbar button:hover,
.toolbar .icon-button:hover,
.schema-menu-dropdown button:hover,
.schema-button:hover {
  background: #ffffff;
}

.tool-toggle.active {
  background: #2c5282;
  color: #ffffff;
  border-color: #2c5282;
}

.icon-button {
  text-decoration: none;
  color: #1f2933;
}

.logo {
  height: 26px;
  display: block;
}

/* Schema menu */

.schema-menu {
  position: relative;
}

.schema-button {
  background: #ffffffaa;
}

.schema-menu-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  background: #f5fbff;
  border: 1px solid #cfe8ff;
  border-radius: 6px;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.15);
  display: none;
  flex-direction: column;
  padding: 4px;
  z-index: 10;
}

.schema-menu-dropdown button {
  width: 140px;
  justify-content: flex-start;
}

.schema-menu.open .schema-menu-dropdown {
  display: flex;
}

/* Schema title */

.schema-title {
  padding: 6px 14px;
  border-bottom: 1px solid #d5e9ff;
  background: #f9fcff;
  font-size: 18px;
  font-weight: 500;
  color: #1f3a57;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Editor layout */

.editor-container {
  flex: 1;
  display: flex;
  min-height: 0;
}

.canvas-wrapper {
  flex: 1;
  position: relative;
  background: #f9fcff;
  overflow: hidden;
  border-right: 1px solid #dde7f3;
}

svg#canvas {
  width: 100%;
  height: 100%;
  user-select: none;
  cursor: grab;
}

svg#canvas.dragging {
  cursor: grabbing;
}

/* Selection rectangle */

.selection-rect {
  fill: rgba(134, 182, 255, 0.15);
  stroke: #4c6fff;
  stroke-width: 1;
  stroke-dasharray: 4 2;
}

/* Properties panel */

.properties-panel {
  width: 340px;
  max-width: 45%;
  padding: 8px;
  font-size: 13px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fdfefe;
  border-left: 1px solid #dde7f3;
  overflow-y: auto;          /* <-- скролл по вертикали */
}

/* состояние «свернуто» */
.properties-panel.collapsed {
  width: 22px;
  padding: 4px 2px;
  overflow: hidden;
}

/* Fields */

.section {
  border: 1px solid #e1ecf7;
  border-radius: 6px;
  padding: 8px;
  background: #ffffff;
}

.section + .section {
  margin-top: 8px;
}

.section h3 {
  margin: 0 0 6px 0;
  font-size: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 6px;
}

.field label {
  font-size: 12px;
  color: #4b6278;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="color"],
.field select,
.field textarea {
  font-size: 13px;
  padding: 4px 6px;
  border-radius: 4px;
  border: 1px solid #cbd5e0;
  width: 100%;
  box-sizing: border-box;
  background: #ffffff;
}

.field textarea {
  resize: vertical;
  min-height: 60px;
}

.field input[type="checkbox"] {
  width: auto;
}

.btn-small {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #a0c4e8;
  background: #f0f7ff;
  cursor: pointer;
}

.btn-small:hover {
  background: #e0f0ff;
}

/* Status bar */

.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  border-top: 1px solid #cfe0f2;
  background: #edf7ff;
  font-size: 12px;
  color: #425466;
}

.zoom-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.zoom-controls button {
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid #a0c4e8;
  background: #ffffff;
  cursor: pointer;
  font-size: 11px;
}

.zoom-label {
  min-width: 46px;
  text-align: center;
}

/* Help modal */

.modal.hidden {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}

.modal-content {
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 16px 10px 16px;
  max-width: 480px;
  max-height: 80vh;
  box-shadow: 0 18px 40px rgba(15,23,42,0.45);
  font-size: 13px;
  color: #243b53;
  overflow-y: auto;
}

.modal-content h2 {
  margin-top: 0;
  margin-bottom: 8px;
  font-size: 16px;
  color: #1a365d;
}

.modal-content p {
  margin: 6px 0;
}

.modal-content ul {
  margin: 4px 0 6px 18px;
  padding: 0;
}
.collapse-toggle {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  align-self: flex-start;
  margin-bottom: 4px;
  color: #2c5282;
}

.collapse-toggle:hover {
  color: #1a365d;
}