.bim-shell {
  --bim-blue: #0f4776;
  --bim-blue-dark: #07345d;
  --bim-sky: #0aa9d7;
  --bim-gold: #f4bc35;
  --bim-ink: #102033;
  --bim-line: rgba(255, 255, 255, 0.18);
  display: grid;
  grid-template-columns: clamp(240px, 18vw, 300px) minmax(640px, 1fr) clamp(210px, 16vw, 260px);
  gap: 12px;
  width: 100%;
  align-items: start;
  color: #fff;
  font-family: Inter, "LINE Seed Sans TH", "Noto Sans Thai", system-ui, sans-serif;
}

.bim-shell * {
  box-sizing: border-box;
}

.bim-panel {
  min-height: 0;
  max-height: min(760px, calc(100vh - 24px));
  border-radius: 8px;
  background: linear-gradient(180deg, var(--bim-blue), var(--bim-blue-dark));
  box-shadow: 0 18px 42px rgba(8, 26, 48, 0.22);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.bim-panel__head {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--bim-line);
}

.bim-panel__head p {
  margin: 0 0 4px;
  font-size: 13px;
  font-weight: 700;
  opacity: 0.82;
}

.bim-panel__head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
  letter-spacing: 0;
}

.bim-search {
  display: grid;
  gap: 7px;
  padding: 12px 14px 10px;
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.74);
}

.bim-search input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font: inherit;
  font-size: 14px;
  padding: 9px 11px;
  outline: none;
}

.bim-search input::placeholder {
  color: rgba(255, 255, 255, 0.56);
}

.bim-search input:focus {
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(10, 169, 215, 0.25);
}

.bim-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 0 14px 10px;
}

.bim-tabs button,
.bim-toolbar button,
.bim-item {
  appearance: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

.bim-tabs button {
  min-width: 0;
  border-radius: 8px;
  padding: 7px 6px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 800;
}

.bim-tabs button.is-active {
  background: #fff;
  color: var(--bim-blue-dark);
}

.bim-list {
  overflow: auto;
  padding: 0 8px 10px;
}

.bim-group {
  padding-top: 6px;
}

.bim-group__title {
  margin: 12px 8px 6px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bim-item {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  min-height: 40px;
  align-items: center;
  padding: 7px;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  text-align: left;
}

.bim-item:hover,
.bim-item.is-active {
  background: rgba(255, 255, 255, 0.13);
}

.bim-item.is-active {
  box-shadow: inset 3px 0 0 var(--bim-gold);
}

.bim-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: var(--bim-sky);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.bim-item[data-category="rooms"] .bim-badge {
  background: var(--bim-gold);
  color: #17324d;
}

.bim-item[data-category="garden"] .bim-badge {
  background: #75bd43;
}

.bim-item__name {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 850;
  line-height: 1.25;
}

.bim-item__meta {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
  color: rgba(255, 255, 255, 0.65);
  font-size: 10px;
  line-height: 1.25;
}

.bim-map-card {
  position: relative;
  min-width: 0;
  width: 100%;
  aspect-ratio: 1555.04 / 931.58;
  min-height: 0;
  border-radius: 8px;
  background: #4f7558;
  overflow: hidden;
  box-shadow: 0 18px 42px rgba(8, 26, 48, 0.18);
}

.bim-toolbar {
  position: absolute;
  z-index: 10;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 7px;
}

.bim-toolbar button {
  min-width: 36px;
  height: 36px;
  border-radius: 8px;
  background: rgba(7, 52, 93, 0.92);
  color: #fff;
  font-size: 15px;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.bim-toolbar button:hover {
  background: #0f4776;
}

.bim-legend {
  align-self: start;
  width: 100%;
  max-height: min(760px, calc(100vh - 24px));
  overflow: auto;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(7, 52, 93, 0.98), rgba(9, 63, 107, 0.96));
  padding: 10px;
  box-shadow: 0 18px 40px rgba(7, 25, 45, 0.24);
}

.bim-legend__item {
  appearance: none;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  width: 100%;
  min-height: 32px;
  margin: 0;
  padding: 4px 5px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.bim-legend__item:hover,
.bim-legend__item.is-active {
  background: rgba(255, 255, 255, 0.13);
}

.bim-legend__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  color: #123b5d;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  overflow: hidden;
}

.bim-legend__icon svg {
  display: block;
  width: 21px;
  height: 21px;
}

.bim-parking-icon {
  display: block;
  color: #0b2035;
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
}

.bim-legend__name {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.bim-viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.bim-viewport.is-dragging {
  cursor: grabbing;
}

.bim-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 1555.04px;
  height: 931.58px;
  transform-origin: 0 0;
  will-change: transform;
}

.bim-map {
  display: block;
  width: 1555.04px;
  height: 931.58px;
  user-select: none;
  pointer-events: none;
}

.bim-marker {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: transparent;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  font-size: 0;
  box-shadow: none;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.bim-map-icon-fix {
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  display: grid;
  place-items: center;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 0 0 0.75px rgba(255, 255, 255, 0.96);
}

.bim-map-icon-fix__icon {
  display: grid;
  place-items: center;
  width: 8px;
  height: 8px;
  overflow: hidden;
}

.bim-map-icon-fix__icon svg {
  display: block;
  width: 8px;
  height: 8px;
}

.bim-map-icon-fix__icon .bim-parking-icon {
  display: none;
}

.bim-map-icon-fix.is-active {
  z-index: 3;
  box-shadow: 0 0 0 1.4px #f4bc35, 0 0 0 3px rgba(244, 188, 53, 0.28);
}

.bim-route {
  position: absolute;
  z-index: 5;
  inset: 0;
  width: 1555.04px;
  height: 931.58px;
  overflow: visible;
  pointer-events: none;
}

.bim-route path {
  fill: none;
  stroke: #ffcf43;
  stroke-width: 9;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 16 13;
  filter: drop-shadow(0 3px 4px rgba(7, 52, 93, 0.42));
  opacity: 0;
}

.bim-route.is-visible path {
  animation: bim-route-draw 1100ms ease both, bim-route-pulse 1500ms ease-in-out 1100ms infinite;
}

@keyframes bim-route-draw {
  from {
    stroke-dashoffset: 260;
    opacity: 0;
  }

  18% {
    opacity: 1;
  }

  to {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes bim-route-pulse {
  0%,
  100% {
    stroke-width: 9;
    opacity: 0.95;
  }

  50% {
    stroke-width: 12;
    opacity: 0.72;
  }
}

.bim-marker.is-active {
  z-index: 6;
  transform: translate(-50%, -50%) scale(1.18);
  box-shadow: 0 0 0 8px rgba(244, 188, 53, 0.34), 0 0 0 2px #f4bc35 inset;
}

.bim-popup {
  position: absolute;
  z-index: 6;
  left: var(--x);
  top: var(--y);
  width: 240px;
  transform: translate(-50%, calc(30px / var(--popup-scale, 1))) scale(var(--popup-scale, 1));
  transform-origin: center top;
  border-radius: 8px;
  background: rgba(7, 52, 93, 0.96);
  color: #fff;
  padding: 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.bim-popup h3 {
  margin: 0 0 5px;
  font-size: 16px;
  line-height: 1.2;
}

.bim-popup p {
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
  font-size: 13px;
  line-height: 1.45;
}

.bim-empty {
  padding: 18px 14px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 13px;
}

@media (max-width: 900px) {
  .bim-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .bim-panel {
    max-height: 360px;
  }

  .bim-map-card {
    height: 560px;
    aspect-ratio: auto;
    min-height: 560px;
  }

  .bim-legend {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
  }
}

@media (max-width: 560px) {
  .bim-shell {
    gap: 10px;
  }

  .bim-panel__head h2 {
    font-size: 23px;
  }

  .bim-tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .bim-map-card {
    height: 470px;
    min-height: 470px;
  }
}
