.bath-placement {
  --place-line: #cfd7d4;
  --place-ink: #182e2b;
  --place-muted: #50635e;
  --place-accent: #166253;
  --place-bg: #f4f7f6;
  display: grid;
  gap: 12px;
  min-width: 0;
  color: var(--place-ink);
}

.bath-place-header {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.bath-place-header > div { flex: 1 1 220px; }
.bath-place-header h2 { margin: 0; font-size: 18px; letter-spacing: -.045em; }
.bath-place-header p { margin: 4px 0 0; }
.bath-place-header p,.bath-place-selection p { font-size: 12px; color: var(--place-muted); line-height: 1.45; }

.bath-place-header label,.bath-place-inputs label { display: grid; gap: 4px; min-width: 0; font-size: 12px; font-weight: 650; }
.bath-place-choose { flex: 1 1 170px; max-width: min(100%,230px); }
.bath-placement select,.bath-placement [type="number"] {
  width: 100%;
  height: 39px;
  min-width: 0;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--place-line);
  border-radius: 8px;
  background: white;
  color: var(--place-ink);
  font-size: 14px;
}
.bath-placement label small { margin-inline: 0; font-size: 10px; font-weight: 500; }

.bath-place-drawing {
  position: relative;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 31px clamp(30px,5.5vw,66px);
  border: 1px solid var(--place-line);
  border-radius: 14px;
  background: radial-gradient(ellipse at top,#fafcfb,#e9f0ed);
}

.bath-place-wall {
  position: absolute;
  color: var(--place-muted);
  font-size: 11px;
  font-weight: 670;
  white-space: nowrap;
  pointer-events: none;
}

.bath-place-wall.is-back,.bath-place-wall.is-front { left: 50%; transform: translateX(-50%); }
.bath-place-wall.is-back { top: 5px; }
.bath-place-wall.is-front { bottom: 5px; }
.bath-place-wall.is-left,.bath-place-wall.is-right { top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; }
.bath-place-wall.is-left { left: 5px; }
.bath-place-wall.is-right { right: 5px; }

.bath-place-board {
  position: relative;
  width: min(100%,calc(245px * var(--bath-place-ratio)));
  aspect-ratio: var(--bath-place-ratio);
  border: 2px solid #687e75;
  background-color: #f9fcfa;
  background-image: linear-gradient(to right,#dce6e0 1px,transparent 1px),linear-gradient(to bottom,#dce6e0 1px,transparent 1px);
  background-size: 10% 10%;
  box-shadow: 0 6px 14px #203b2c22;
  cursor: crosshair;
}

.bath-placement .bath-place-marker {
  position: absolute;
  z-index: 1;
  left: var(--bath-place-x);
  top: var(--bath-place-z);
  transform: translate(-50%,-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: max-content;
  min-width: 34px;
  max-width: 92px;
  min-height: 34px;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid #8a9e95;
  border-radius: 7px;
  background: #ffffffed;
  box-shadow: 0 3px 5px #172e2620;
  color: var(--place-ink);
  font-size: 11px;
  font-weight: 720;
  line-height: 1.2;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.bath-placement .bath-place-marker.is-wall { border-color: #9b9878; background: #f9f5e8; }
.bath-placement .bath-place-marker[aria-pressed="true"],.bath-placement .bath-place-marker.is-dragging {
  z-index: 3;
  border-color: #134b41;
  background: #176858;
  color: white;
  box-shadow: 0 4px 8px #122b2340;
}
.bath-placement .bath-place-marker.is-dragging { cursor: grabbing; }
.bath-placement .bath-place-marker:focus-visible { z-index: 4; }
.bath-place-marker img { flex: none; width: 23px; height: 23px; object-fit: contain; border-radius: 4px; background: white; pointer-events: none; }
.bath-place-marker span { pointer-events: none; }
.bath-place-dot { display: block; flex: none; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.bath-place-inspector { min-width: 0; padding: 10px; border: 1px solid var(--place-line); border-radius: 11px; background: var(--place-bg); }
.bath-place-selection { display: flex; align-items: center; gap: 7px; padding-bottom: 8px; }
.bath-place-selection strong { font-size: 14px; overflow-wrap: anywhere; }
.bath-place-selection p { margin: 2px 0 0; }
.bath-place-inspector [data-place-faucet-depth] { margin: 5px 0 0; font-size: 12px; color: var(--place-muted); }
.bath-place-selection img { flex: 0 0 40px; width: 40px; height: 40px; object-fit: contain; border-radius: 6px; background: white; }

.bath-place-inputs { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,94px),1fr)); gap: 5px; }
.bath-place-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.bath-placement .bath-place-actions button {
  min-height: 38px;
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid var(--place-line);
  border-radius: 7px;
  background: white;
  color: var(--place-ink);
  font-size: 12px;
  font-weight: 680;
}

@media(max-width:540px) {
  .bath-place-choose { max-width: none; }
  .bath-place-drawing { padding: 29px 33px; }
  .bath-placement .bath-place-marker { max-width: 74px; font-size: 10px; }
  .bath-place-marker img { width: 18px; height: 18px; }
}

.bath-place-footprint {
  position: absolute;
  left: var(--bath-place-x);
  top: var(--bath-place-z);
  transform: translate(-50%,-50%);
  border: 1px solid #82948a;
  border-radius: 6px;
  background: #d5e5dc80;
  pointer-events: none;
}
.bath-place-footprint.is-toilet { border-radius: 8px 8px 40% 40%; }
.bath-place-footprint.is-bath { border-radius: 12px; box-shadow: inset 0 0 0 4px #ffffff88; }
.bath-place-footprint.is-selected { border-color: #165b4f; background: #92b8a8a8; }

.bath-place-overlap {
  margin: 0;
  padding: 7px 9px;
  border: 1px solid #e6c998;
  border-radius: 7px;
  background: #fcf2df;
  color: #754315;
  font-size: 12px;
  line-height: 1.45;
}
.bath-place-overlap strong { margin-right: 4px; }
.bath-place-footprint.is-overlap { border-color: #bd7736; background: #d3a2615c; }
@media(max-width:540px) {
  .bath-place-wall.is-left,.bath-place-wall.is-right {
    top: 5px;
    transform: none;
    writing-mode: horizontal-tb;
  }
  .bath-place-wall.is-left { left: 10px; }
  .bath-place-wall.is-right { right: 10px; }
}
