:root {
  --canvas-bg: #ffffff;
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  background: #d7d7d7;
  color: #1f1f1f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid #9c9c9c;
  background: #f7f7f7;
  border-radius: 4px;
  cursor: pointer;
  min-height: 32px;
  padding: 5px 10px;
}

button:disabled {
  color: #8d8d8d;
  cursor: default;
}

button.active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

#app {
  display: grid;
  grid-template-columns: 260px minmax(320px, 1fr) 300px;
  height: 100vh;
  min-height: 0;
}

.sidebar,
.inspector {
  background: #eeeeee;
  border-right: 1px solid #b8b8b8;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.inspector {
  border-left: 1px solid #b8b8b8;
  border-right: 0;
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
}

.topbar {
  align-items: center;
  background: #f2f2f2;
  border-bottom: 1px solid #b8b8b8;
  display: flex;
  gap: 10px;
  min-height: 48px;
  padding: 8px 12px;
}

.tool-group,
.toolbar-block {
  display: flex;
  gap: 8px;
}

.toolbar-block {
  margin-bottom: 12px;
}

.canvas-wrap {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 0;
  overflow: auto;
  padding: 24px;
  position: relative;
}

#canvas {
  background-color: var(--canvas-bg);
  background-image:
    linear-gradient(45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(-45deg, #d0d0d0 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d0d0d0 75%),
    linear-gradient(-45deg, transparent 75%, #d0d0d0 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
  box-shadow: 0 2px 16px rgb(0 0 0 / 24%);
  display: none;
  image-rendering: auto;
}

#emptyState {
  color: #666;
}

.field,
.compact-field,
.check-field {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
}

.compact-field {
  align-items: center;
  grid-template-columns: auto 72px;
  margin-bottom: 0;
}

.check-field {
  align-items: center;
  display: flex;
  gap: 6px;
  margin-bottom: 0;
  white-space: nowrap;
}

.field span,
.compact-field span,
.check-field span {
  color: #555;
  font-size: 12px;
}

.field input,
.field select,
.field textarea,
.compact-field input {
  border: 1px solid #aaa;
  border-radius: 4px;
  min-height: 30px;
  padding: 5px 7px;
  width: 100%;
}

.field textarea {
  resize: vertical;
}

.grid {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.image-list {
  display: grid;
  gap: 6px;
}

.image-item {
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  width: 100%;
}

.image-item.active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

#statusText {
  color: #555;
  font-size: 13px;
  margin-left: auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#zoomText {
  color: #555;
  font-size: 13px;
  min-width: 46px;
}

@media (max-width: 980px) {
  #app {
    grid-template-columns: 220px minmax(320px, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    max-height: 42vh;
  }
}
