* { box-sizing: border-box; }
html, body.cosmos { margin: 0; height: 100%; font-family: "Segoe UI", system-ui, sans-serif; color: #1f2937; }

html, body.cosmos { background: #1c1c1c; }
.stage {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 300px 1fr 280px;
  grid-template-rows: auto 1fr;
  background: #1c1c1c;
}
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(18, 18, 18, .38), rgba(18, 18, 18, .48)),
    url('../simulator/assets/background.jpg') center center / cover no-repeat;
  filter: grayscale(.9) brightness(.78) contrast(.9);
  pointer-events: none;
  z-index: 0;
}
.stage > * { position: relative; z-index: 1; }

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px 18px 0;
  gap: 12px;
}
.wa {
  background: #22c55e;
  color: #fff;
  text-decoration: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.15;
  box-shadow: 0 6px 16px rgba(0,0,0,.35);
}
.tools { display: flex; gap: 10px; }
.tools button {
  width: 92px;
  background: #fff;
  border: none;
  border-radius: 10px;
  padding: 8px 4px 6px;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
}
.tools button .ico { display: block; font-weight: 800; font-size: 18px; }
.tools button small { display: block; font-size: 10px; color: #b91c1c; font-weight: 700; margin-top: 4px; }
.tools button.active { outline: 3px solid #f97316; }
.orcamento {
  background: linear-gradient(#fb923c, #ea580c);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 16px 22px;
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0,0,0,.35);
}

.dock {
  margin: 12px;
  background: #f3f4f6;
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  overflow: auto;
  max-height: calc(100vh - 110px);
  align-self: start;
}
.dock h2 { margin: 0 0 10px; font-size: 16px; }
.dock h3 { margin: 12px 0 6px; font-size: 13px; }
.dock label, .hint { display: block; font-size: 13px; margin: 6px 0; }
.dock input, .dock select { width: 100%; margin-top: 4px; }
.upload-add { margin-top: 18px; font-size: 13px; }
.upload-add input[type="file"] { width: auto; margin-top: 6px; font-size: 13px; }
.hidden { display: none; }
.sync-box { border: 0; padding: 0; margin: 0 0 8px; }
.piece-tabs { display: flex; margin: 8px 0; }
.piece {
  flex: 1; border: 1px solid #d1d5db; background: #fff; padding: 8px; cursor: pointer;
}
.piece.on { background: #dc2626; color: #fff; border-color: #dc2626; }
.finish-grid { display: flex; flex-wrap: wrap; gap: 10px; margin: 10px 0 16px; }
.finish-card {
  width: 96px;
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 6px 6px;
  cursor: pointer;
  text-align: center;
}
.finish-card.on { border-color: #111; }
.finish-card img, .finish-card .swatch {
  display: block;
  width: 100%;
  height: 46px;
  object-fit: contain;
  background: #fff;
}
.finish-card strong { display: block; margin-top: 4px; font-size: 12px; font-weight: 650; }
.name-flags { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; }
.name-flags label { display: flex; gap: 6px; align-items: center; }
.place-row { display: flex; gap: 8px; margin: 8px 0; }
.place-card {
  flex: 1;
  min-height: 72px;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px;
}
.place-row.small .place-card { min-height: 58px; }
.place-card.on { border-color: #16a34a; box-shadow: inset 0 0 0 1px #16a34a; }
.place-name { font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.place-num { font-size: 18px; font-weight: 800; line-height: 1; }
.shirt-mini {
  position: relative;
  width: 34px;
  height: 28px;
  border: 2px solid #111;
  border-radius: 4px 4px 2px 2px;
  display: block;
}
.shirt-mini::before, .shirt-mini::after {
  content: "";
  position: absolute;
  top: 6px;
  width: 8px;
  height: 10px;
  border: 2px solid #111;
}
.shirt-mini::before { left: -8px; border-right: 0; }
.shirt-mini::after { right: -8px; border-left: 0; }
.shirt-mini b { position: absolute; top: 8px; left: 4px; font-size: 9px; }
.shirt-mini.center b { left: 8px; }
.shirt-mini.right b { left: auto; right: 4px; }
.shorts-mini {
  position: relative;
  width: 52px;
  height: 34px;
  display: block;
  border: 2px solid #111;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}
.shorts-mini::before, .shorts-mini::after {
  content: "";
  position: absolute;
  bottom: -12px;
  width: 16px;
  height: 14px;
  border: 2px solid #111;
  border-top: 0;
}
.shorts-mini::before { left: 4px; }
.shorts-mini::after { right: 4px; }
.shorts-mini b { position: absolute; top: 8px; font-size: 11px; font-style: normal; }
.shorts-mini.right b { right: 6px; }
.shorts-mini.left b { left: 6px; }
.mark-dot, .mark-bar {
  position: absolute;
  top: 10px;
  background: #1e3a5f;
  font-size: 0;
}
.mark-dot { width: 8px; height: 8px; }
.mark-bar { width: 14px; height: 5px; top: 14px; background: #9ca3af; }
.mark-dot.left, .mark-bar.left { left: 3px; }
.mark-dot.right, .mark-bar.right { right: 3px; left: auto; }
.shirt-mini > .mark-dot.left { left: 4px; top: 8px; }
.shirt-mini > .mark-dot.center { left: 50%; margin-left: -4px; top: 8px; }
.shirt-mini > .mark-dot.right { right: 4px; left: auto; top: 8px; }
.shirt-mini > .mark-bar, .shorts-mini > .mark-bar { left: 50%; margin-left: -7px; }
.shirt-mini > .mark-bar.high { top: 4px; }
.shirt-mini > .mark-bar.mid { top: 12px; }
.shirt-mini > .mark-bar.low { top: 20px; }
.place-row.is-off { opacity: .4; pointer-events: none; }
.text-line { display: flex; gap: 6px; }
.text-line input, .text-line select { min-width: 0; }
.text-line input[type="number"] { width: 64px; flex: none; }
.text-colors { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 12px; }
.text-colors label { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; width: 72px; }
.text-colors input[type="color"] { width: 36px; height: 36px; padding: 2px; }
.border-none {
  width: 36px;
  height: 36px;
  border: 1px solid #d1d5db;
  background:
    linear-gradient(45deg, transparent 46%, #dc2626 46%, #dc2626 54%, transparent 54%);
  cursor: pointer;
  font-size: 0;
}
.model-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.model-card {
  background: #fff; border: 2px solid #e5e7eb; border-radius: 8px; padding: 6px; cursor: pointer; text-align: center;
}
.model-card img, .model-card .swatch {
  display: block; width: 100%; height: 52px; object-fit: contain; background: #f4f4f5; border-radius: 4px;
}
.model-card strong, .model-card span { display: block; font-size: 10px; line-height: 1.25; }
.model-card.selected { border-color: #dc2626; }
.mini-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.mini-actions button { font-size: 12px; }

.floor {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 8vh;
  background: transparent;
}
.codes { color: #fff; font-size: 12px; letter-spacing: .04em; margin: 0 0 8px; text-shadow: 0 2px 6px #000; }
.pair {
  display: flex;
  gap: clamp(8px, 2vw, 28px);
  align-items: flex-end;
  justify-content: center;
  width: min(980px, 100%);
}
.kit-wrap {
  flex: 1 1 0;
  max-width: 440px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 8px;
}
.kit-stage { position: relative; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.kit-rail {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 36px;
  height: 148px;
  margin-bottom: 22vh;
  flex: none;
}
.kit-rail::before {
  content: "";
  position: absolute;
  top: 16px;
  bottom: 16px;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: rgba(255,255,255,.9);
}
.kit-nav, .kit-lock {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 17, 17, .55);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,.35);
}
.kit-lock.locked { background: #dc2626; }
.kit {
  flex: 1 1 0;
  max-width: 380px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.kit svg {
  height: min(72vh, 760px);
  width: 100%;
  max-width: 360px;
  display: block;
  filter: drop-shadow(0 22px 14px rgba(0,0,0,.5));
}
#palette-swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch-btn { width: 22px; height: 22px; border: 1px solid #9ca3af; padding: 0; cursor: pointer; }
.color-group { margin: 0 0 12px; }
.color-row { display: flex; flex-wrap: wrap; gap: 10px; }
.color-item { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 56px; }
.color-item span { font-size: 11px; text-align: center; }
.color-chip {
  width: 36px;
  height: 36px;
  border: 2px solid #d1d5db;
  border-radius: 6px;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.4);
}
.color-chip.on { outline: 3px solid #f97316; border-color: #fff; }

.upload-img { cursor: grab; }
.upload-handle[data-mode="resize"] { cursor: nwse-resize; }
.upload-handle[data-mode="rotate"] { cursor: grab; }
.upload-handle[data-mode="delete"] { cursor: pointer; }

.chooser {
  border: 0;
  border-radius: 2px;
  padding: 28px 32px 22px;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .35);
}
.chooser::backdrop { background: rgba(30, 30, 30, .55); }
.chooser p { margin: 0 0 18px; font-size: 22px; font-weight: 700; }
.chooser-actions { display: flex; justify-content: center; gap: 12px; }
.chooser-actions button {
  min-width: 96px;
  background: #111;
  color: #fff;
  border: 0;
  padding: 8px 14px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 1100px) {
  .stage { grid-template-columns: 1fr; }
  .dock { max-height: none; }
  .kit svg { height: 58vh; }
}
