* {
  box-sizing: border-box;
  font-family: Arial, sans-serif;
}

body {
  margin: 0;
  padding: 0;
  height: 100vh;
  display: flex;
}

#app {
  display: grid;
  grid-template-columns: 320px 1fr 340px;
  height: 100vh;
  width: 100vw;
}

#leftPanel, #rightPanel {
  border-right: 1px solid #ccc;
  padding: 8px;
  overflow-y: auto;
  font-size: 13px;
}

#rightPanel {
  border-left: 1px solid #ccc;
  border-right: none;
}

h3, h4 {
  margin: 6px 0;
  font-size: 14px;
}

label {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}

input[type="text"],
input[type="number"],
select {
  width: 100%;
  padding: 3px 4px;
  margin-top: 2px;
  font-size: 12px;
}

button {
  margin-top: 4px;
  padding: 4px 8px;
  font-size: 12px;
  cursor: pointer;
}

button.small {
  font-size: 11px;
  padding: 2px 5px;
  margin-left: 4px;
}

.section {
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #ddd;
}

#centerPanel {
  padding: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#layoutAreaWrapper {
  flex: 1;
  overflow: auto;
  border: 1px solid #aaa;
  background: #f8f8f8;
  position: relative;
}

#layoutArea {
  position: relative;
  background: #fff;
  min-width: 800px;
  min-height: 500px;
}

.container-rect {
  position: absolute;
  border: 2px solid #333;
  background-image:
    linear-gradient(to right, rgba(0,0,0,0.07) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(0,0,0,0.07) 1px, transparent 1px);
  background-size: 24px 24px;
}

.container-label {
  position: absolute;
  top: -16px;
  left: 0;
  font-size: 11px;
  background: rgba(255,255,255,0.9);
  padding: 0 2px;
  border: 1px solid #aaa;
  cursor: move;
}

.staging-area {
  position: absolute;
  border: 2px dashed #888;
  background: #fafafa;
}

.staging-label {
  position: absolute;
  top: -16px;
  left: 0;
  font-size: 11px;
  background: rgba(255,255,255,0.9);
  padding: 0 2px;
  border: 1px solid #aaa;
  cursor: move;
}

/* ITEM BLOCKS – centered text + adjustable shrink */
.item {
  position: absolute;
  border: 1px solid #333;
  background-color: #d0f0ff;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 10px;
  padding: 0;
  text-align: center;

  overflow: hidden;
  cursor: move;
}

.item.selected {
  outline: 2px solid #ff8800;
  z-index: 9999 !important;
}

.item.storage-item {
  border-style: dashed;
}

/* Storage slot warning */
.warn-slot {
  color: red !important;
  font-weight: bold !important;
}

/* Panel tabs */
.panel-tabs {
  display: flex;
  margin-bottom: 4px;
}

.panel-tab {
  flex: 1;
  text-align: center;
  padding: 3px 0;
  cursor: pointer;
  border: 1px solid #ccc;
  border-bottom: none;
  background: #eee;
  font-size: 12px;
}

.panel-tab.active {
  background: #fff;
  font-weight: bold;
}

.panel-tab-content {
  border: 1px solid #ccc;
  padding: 4px;
  height: 260px;
  overflow-y: auto;
  font-size: 12px;
}

/* Template & garage rows */
.template-row,
.garage-item-row {
  border: 1px solid #ccc;
  padding: 3px;
  margin-top: 3px;
  background: #fafafa;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
}

.template-row span,
.garage-item-row span {
  display: inline-block;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Inventory table */
table.inventory {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

table.inventory th,
table.inventory td {
  border: 1px solid #ccc;
  padding: 2px 3px;
}

table.inventory th {
  background: #eee;
}

.muted {
  color: #777;
  font-size: 11px;
}

.clickable {
  cursor: pointer;
}

/* MODALS */
.modal-overlay {
  position: fixed;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4);

  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.modal-box {
  background: #fff;
  border: 1px solid #666;
  padding: 10px;
  max-width: 360px;
  width: 92%;
  font-size: 12px;
}

.modal-box h3 {
  margin-top: 0;
  font-size: 14px;
}

.modal-actions {
  margin-top: 8px;
  text-align: right;
}
