/* Layout */
#app {
  padding: 16px;
  min-height: 100%;
  box-sizing: border-box;
}

.planner {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

/* Rack column */
.col-rack {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rack-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hint {
  font-size: 0.78em;
  color: var(--muted);
  min-height: 1.5em;
}

/* Rack frame */
.rack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #090909;
  border: 2px solid #2a2a2a;
  border-radius: 3px;
  padding: 8px 8px 8px 6px;
  width: 420px;
  max-height: 72vh;
  overflow-y: auto;
  /* rack ear illusion */
  box-shadow: -6px 0 0 #1a1a1a, 6px 0 0 #1a1a1a, inset 0 0 0 1px #111;
}

/* Empty slot */
.rack-slot {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px;
  border: 1px solid #1c1c1c;
  border-radius: 1px;
  background: #0f0f0f;
  transition: border-color 0.1s, background 0.1s;
  box-sizing: border-box;
  flex-shrink: 0;
}

.rack-slot.placeable {
  border-color: var(--green);
  background: #0a1a0a;
  cursor: pointer;
}

.rack-slot.placeable:hover {
  background: #0d240d;
}


/* Placed item */
.rack-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
  border: 1px solid #2a2a2a;
  border-left: 3px solid var(--item-color, var(--border));
  border-radius: 1px;
  background: #131313;
  cursor: pointer;
  box-sizing: border-box;
  flex-shrink: 0;
  transition: background 0.1s;
  overflow: hidden;
}

.rack-item:hover {
  background: #1a1a1a;
}

.rack-item:hover .ri-rm {
  opacity: 1;
}

/* U label shared by slot and item */
.ru {
  font-size: 0.65em;
  color: #2a2a2a;
  min-width: 26px;
  font-variant-numeric: tabular-nums;
  user-select: none;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 6px;
}

.rack-slot .ru {
  align-self: center;
  padding-top: 0;
}

.rack-item:hover .ru {
  color: #3a3a3a;
}

/* SVG faceplate graphic */
.fp-svg {
  display: block;
  flex-shrink: 0;
  pointer-events: none;
}

/* Text info alongside faceplate */
.ri-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  align-self: stretch;
}

.ri-label {
  font-size: 0.78em;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ri-meta {
  font-size: 0.65em;
  color: var(--muted);
  white-space: nowrap;
}

.ri-rm {
  font-size: 1em;
  color: var(--red);
  opacity: 0;
  transition: opacity 0.1s;
  line-height: 1;
  padding: 0 2px;
  flex-shrink: 0;
  align-self: flex-start;
  padding-top: 6px;
}

/* Sidebar */
.col-side {
  flex: 1;
  min-width: 240px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: var(--bg-raise);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 12px;
}

.panel-title {
  font-size: 0.68em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: 10px;
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 8px;
  margin-bottom: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sv {
  font-size: 1.15em;
  color: var(--green);
  font-variant-numeric: tabular-nums;
}

.sl {
  font-size: 0.68em;
  text-transform: uppercase;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.util-wrap {
  height: 3px;
  background: #1a1a1a;
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 4px;
}

.util-bar {
  height: 100%;
  background: var(--green);
  border-radius: 2px;
  transition: width 0.2s ease;
  min-width: 0;
}

.util-lbl {
  font-size: 0.7em;
  color: var(--muted);
}

/* Catalog */
.cat-section {
  margin-bottom: 14px;
}

.cat-section:last-child {
  margin-bottom: 0;
}

.cat-heading {
  font-size: 0.65em;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
}

.cat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid var(--border);
  border-radius: 2px;
  margin-bottom: 3px;
  cursor: pointer;
  transition: border-color 0.1s, background 0.1s;
}

.cat-item:hover {
  background: var(--bg-sunken);
}

.cat-item.sel {
  background: var(--bg-sunken);
}

.ci-u {
  font-size: 0.72em;
  font-weight: 700;
  min-width: 18px;
  font-variant-numeric: tabular-nums;
}

.ci-label {
  font-size: 0.8em;
  flex: 1;
}

.ci-meta {
  font-size: 0.68em;
  color: var(--muted);
  white-space: nowrap;
}

/* Responsive: stack on narrow viewports */
@media (max-width: 780px) {
  .planner {
    flex-direction: column;
  }

  .rack {
    width: 100%;
    max-width: 420px;
  }

  .col-side {
    max-width: 100%;
    width: 100%;
  }
}
