* { box-sizing: border-box; }
body {
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  margin: 0;
  background: #f4f4f5;
  color: #1a1a1a;
}
.app {
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 16px;
  padding: 16px;
  height: 100vh;
}
.panel {
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  overflow-y: auto;
}
h2 { margin-top: 0; font-size: 16px; }
h3 { font-size: 13px; margin: 16px 0 6px; color: #555; }

.new-rack, .new-equip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 10px;
}
input, textarea, button {
  font-size: 13px;
  padding: 6px;
  border: 1px solid #ccc;
  border-radius: 4px;
}
button {
  background: #2b2b2b;
  color: white;
  border: none;
  cursor: pointer;
}
button:hover { background: #444; }

#rack-list, #catalog-list { list-style: none; padding: 0; margin: 0; }
#rack-list li, #catalog-list li {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
}
#rack-list li:hover, #catalog-list li:hover { background: #f0f0f0; }
#rack-list li.active { background: #e8f0fe; border-color: #a8c7fa; }

#catalog-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: grab;
}
#catalog-list li .ru-badge {
  font-size: 11px;
  color: #666;
  background: #eee;
  padding: 1px 5px;
  border-radius: 3px;
}

.rack-elevation {
  position: relative;
  width: 320px;
  border: 2px solid #333;
  background: repeating-linear-gradient(
    to bottom,
    #2c2c2c,
    #2c2c2c 1px,
    #3a3a3a 1px,
    #3a3a3a 20px
  );
  margin-top: 10px;
}

.rack-slot-guide {
  position: absolute;
  left: 0;
  right: 0;
  font-size: 9px;
  color: #999;
  padding-left: 2px;
  pointer-events: none;
}

.rack-item {
  position: absolute;
  left: 26px;
  right: 4px;
  background: #6b7280;
  border: 1px solid #333;
  border-radius: 2px;
  color: white;
  font-size: 11px;
  cursor: grab;
  overflow: hidden;
}
.rack-item.standard { background: #4b5563; }
.rack-item img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  z-index: 0;
}
.rack-item span {
  position: absolute;
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  padding: 1px 5px;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 8px);
}
.rack-item.drag-over-invalid {
  outline: 2px solid #d33;
}

.message {
  margin-top: 10px;
  font-size: 12px;
  color: #a33;
  min-height: 18px;
}

.suggestion-btn {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 2px 8px;
  font-size: 11px;
  background: #eef;
  border: 1px solid #99c;
  border-radius: 3px;
  cursor: pointer;
}

.image-picker { margin-top: 10px; border-top: 1px solid #eee; padding-top: 8px; }
.image-picker-results { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.image-picker-results img {
  width: 70px; height: 70px; object-fit: cover;
  border: 1px solid #ccc; border-radius: 4px; cursor: pointer;
}
.image-picker-results img:hover { border-color: #2b6cb0; }

#import-results { font-size: 12px; margin-top: 8px; }
.import-row { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px solid #eee; }
.import-row.unmatched { color: #a33; }
