:root {
  --primary: #267846;
  --muted: #99a6b5;
  --line: #c7d0d9;
  --text: #4a5560;
  --disabled: #66696d;
  --header: 64px;
  --shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

html,
body,
#app {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #fff;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--text);
}

.topbar {
  height: var(--header);
  display: flex;
  align-items: center;
  padding: 0 16px 0 20px;
  border-bottom: 1px solid #eee;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  position: relative;
  z-index: 40;
  background: #fff;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}

.logo-mark {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 40px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.04em;
  border-radius: 2px 14px 2px 2px;
}

.logo img {
  height: 40px;
  display: block;
}

.logo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.logo-row .ghost {
  width: auto;
  height: 36px;
  padding: 0 14px;
}

#logoPreview {
  height: 40px;
  max-width: 160px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  padding: 4px;
}

.program div:first-child {
  font-size: 15px;
  color: #6b7784;
}

.program .city {
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.topnav {
  display: flex;
  justify-content: center;
  flex: 1;
  gap: 4px;
}

.topnav a {
  color: var(--muted);
  text-decoration: none;
  text-transform: capitalize;
  font-size: 14px;
  padding: 20px 16px;
  height: var(--header);
  display: flex;
  align-items: center;
}

.topnav a.is-active {
  color: var(--primary);
}

.brand-spacer {
  min-width: 220px;
}

#fullscreenBtn svg {
  display: block;
}

#workspace {
  position: relative;
  height: calc(100% - var(--header));
}

.page {
  display: none;
  position: absolute;
  inset: 0;
}

.page.is-active {
  display: block;
}

#view-model.is-active {
  background: #eceff2;
}

#stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: move;
  touch-action: none;
  background: #fff;
}

#stage.is-pan {
  cursor: grab;
}

#stage.is-dragging {
  cursor: grabbing;
}

#stage.is-hotspot {
  cursor: pointer;
}

#overlay {
  pointer-events: none;
}

#modelEmpty {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: #fff;
  pointer-events: auto;
}

#modelEmpty[hidden] {
  display: none !important;
}

.model-loader {
  width: 56px;
  height: 56px;
  border: 5px solid #d8e3dc;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: model-spin 0.8s linear infinite;
}

.model-loader-label {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--text);
}

@keyframes model-spin {
  to {
    transform: rotate(360deg);
  }
}

#hdLoader {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 16;
  pointer-events: none;
}

#hdLoader[hidden] {
  display: none !important;
}

.hd-loader-spin {
  display: block;
  width: 66px;
  height: 66px;
  border: 6px solid rgba(255, 255, 255, 0.45);
  border-top-color: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 0 9px rgba(0, 0, 0, 0.12);
  animation: model-spin 0.7s linear infinite;
}

#view,
#hit,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#hit {
  opacity: 0;
  pointer-events: none;
}

.search-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 12;
  background: #fff;
  border: 0;
  box-shadow: var(--shadow);
  border-radius: 2px;
  height: 40px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  letter-spacing: 0.02em;
}

#frameHud {
  position: absolute;
  left: 20px;
  bottom: 72px;
  z-index: 12;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 2px;
  padding: 8px 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

#frameHudLevel {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

#frameHudIndex {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.compass {
  position: absolute;
  top: 20px;
  right: 130px;
  width: 88px;
  height: 88px;
  z-index: 12;
  border-radius: 50%;
  background:
    conic-gradient(from 0deg, transparent 0 40deg, rgba(0, 0, 0, 0.04) 40deg 50deg, transparent 50deg),
    radial-gradient(circle, #fff 58%, #e8edf2 59% 62%, #fff 63%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
}

.compass span {
  color: var(--primary);
  font-weight: 700;
  font-size: 18px;
}

.levels {
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 12;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-width: 92px;
}

.levels button {
  border: 0;
  background: #fff;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.06em;
  padding: 14px 12px;
  cursor: pointer;
  text-align: left;
}

.levels button.is-active {
  background: var(--primary);
  color: #fff;
}

.toolbar {
  position: absolute;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 12;
  background: #fff;
  box-shadow: var(--shadow);
  border-radius: 2px;
  display: flex;
}

.tool {
  min-width: 44px;
  height: 44px;
  border: 0;
  border-right: 1px solid rgba(224, 224, 224, 0.7);
  background: #fff;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.tool:last-child {
  border-right: 0;
}

.tool.is-active,
.tool:hover {
  color: var(--primary);
}

.loader {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  z-index: 15;
  pointer-events: none;
}

.loader.is-hidden {
  display: none;
}

.progress {
  height: 4px;
  background: #e6e6e6;
}

.progress i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--primary);
}

.drawer {
  position: absolute;
  top: var(--header);
  bottom: 0;
  left: 0;
  width: 280px;
  background: #fff;
  border-right: 1px solid var(--line);
  z-index: 30;
  transform: translateX(-100%);
  transition: transform 0.22s ease;
  display: flex;
  flex-direction: column;
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer.is-open ~ #workspace .search-btn,
#app:has(.drawer.is-open) .search-btn {
  display: none;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--primary);
}

.icon-btn {
  border: 0;
  background: transparent;
  font-size: 24px;
  color: var(--muted);
  cursor: pointer;
}

.drawer-body {
  overflow: auto;
  padding: 12px 16px 24px;
  flex: 1;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 14px;
  padding: 4px 10px;
  font-size: 11px;
  text-transform: uppercase;
  cursor: pointer;
}

.chip.is-on {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.lot-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eef2f5;
  background: transparent;
  padding: 10px 0;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
  color: inherit;
}

.lot-row.is-sold {
  color: var(--disabled);
}

.lot-id {
  font-weight: 700;
}

.badge {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 2px;
}

.meta {
  font-size: 12px;
  color: var(--muted);
}

.lot-sheet h3 {
  margin: 0 0 8px;
  font-size: 22px;
}

.lot-sheet dl {
  margin: 0;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 10px;
  font-size: 13px;
}

.lot-sheet dt {
  color: var(--muted);
}

.fav {
  margin-top: 16px;
  width: 100%;
}

.primary,
.fav {
  border: 0;
  background: var(--primary);
  color: #fff;
  border-radius: 2px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
}

.scrim {
  display: none;
}

.help {
  display: none;
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 50;
  place-items: center;
}

.help.is-open {
  display: grid;
}

.help-card {
  background: #fff;
  width: min(420px, 90vw);
  padding: 24px;
  border-radius: 4px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.help-card h3 {
  margin: 0 0 12px;
  color: var(--primary);
}

.help-card ul {
  margin: 0 0 12px;
  padding-left: 18px;
  line-height: 1.5;
  font-size: 14px;
}

.help-note {
  font-size: 12px;
  color: var(--muted);
}

.placeholder {
  height: 100%;
  display: grid;
  place-items: center;
  color: var(--muted);
  text-align: center;
  padding: 40px;
  font-size: 16px;
}

.placeholder a {
  color: var(--primary);
}

.map-page {
  padding: 0;
  place-items: stretch;
}

.map-frame {
  position: relative;
  height: 100%;
  background: #e8eef3;
}

.map-frame iframe,
.map-canvas {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.leaflet-container {
  font-family: inherit;
  background: #1a1a1a;
}

.site-pin {
  background: none !important;
  border: 0 !important;
}

.site-pin svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.45));
}

.leaflet-popup-content-wrapper {
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  margin: 10px 12px;
}

.map-popup-title {
  display: block;
  color: var(--primary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.map-open {
  position: absolute;
  right: 16px;
  bottom: 16px;
  z-index: 500;
  background: #fff;
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.state-available {
  color: var(--primary);
}
.state-reserved {
  color: #c48a1a;
}
.state-sold {
  color: var(--disabled);
}

@media (max-width: 1100px) {
  .topnav {
    display: none;
  }
  .compass {
    right: 16px;
    width: 64px;
    height: 64px;
  }
  .levels {
    right: 10px;
    min-width: 76px;
  }
}

html.setup-html,
html.setup-html body.setup-page {
  height: auto;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: scroll;
}

.setup-page * {
  user-select: text;
  -webkit-user-select: text;
}

.setup {
  display: grid;
  grid-template-columns: minmax(320px, 520px) 1fr;
  gap: 32px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.setup-card,
.setup-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.setup h1,
.setup h2 {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 22px;
}

.setup .lead {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  margin: 0 0 20px;
}

.field,
.stepper-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field span,
.field-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.field input,
.field select {
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0 12px;
  font-size: 15px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.color-row input[type="color"] {
  width: 56px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fff;
  cursor: pointer;
}

.color-row input[type="text"] {
  flex: 1;
  font-family: ui-monospace, Consolas, monospace;
  letter-spacing: 0.04em;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 8px;
}

.stepper input {
  width: 72px;
  height: 48px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  border: 1px solid var(--line);
  border-radius: 2px;
}

.stepper button {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--primary);
  font-size: 22px;
  cursor: pointer;
}

.hint-inline {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.checks {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 18px;
  font-size: 14px;
}

.menu-toggles {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.menu-toggles .field-label {
  margin-bottom: 4px;
}

.checks input {
  margin-right: 8px;
}

.setup .actions {
  margin-top: 8px;
}

.save-status {
  min-height: 1.3em;
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--text);
}

.save-status.is-error {
  color: #b42318;
  font-weight: 600;
}

.setup .path-actions {
  margin: -4px 0 16px;
}

.setup .path-actions .ghost {
  width: auto;
  height: 36px;
  padding: 0 14px;
}

.setup .primary {
  width: 100%;
  height: 44px;
}

.level-stack {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}

.level-stack li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid #eef2f5;
  font-size: 13px;
}

.level-stack li:last-child {
  border-bottom: 0;
}

.level-stack li.is-top {
  background: var(--primary);
  color: #fff;
}

.level-stack li span {
  color: var(--muted);
  font-size: 11px;
}

.level-stack li.is-top span {
  color: rgba(255, 255, 255, 0.8);
}

.setup-preview pre,
.folder-list {
  background: #f7f9fb;
  border: 1px solid var(--line);
  padding: 12px;
  font-size: 12px;
  font-family: Consolas, "Courier New", monospace;
  color: var(--text);
  line-height: 1.55;
  white-space: pre-wrap;
  min-height: 120px;
  overflow: auto;
}

@media (max-width: 900px) {
  .setup {
    grid-template-columns: 1fr;
  }
}

.upload-panel {
  max-width: 1100px;
  margin: 0 auto 64px;
  padding: 0 24px;
}

.upload-inner {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.upload-inner h2 {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 22px;
}

.dropzone {
  border: 2px dashed var(--line);
  border-radius: 4px;
  padding: 28px 20px;
  text-align: center;
  background: #fafcfd;
  margin: 16px 0;
}

.dropzone.is-over {
  border-color: var(--primary);
  background: #f1f8f4;
}

.drop-title {
  margin: 0 0 6px;
  font-size: 16px;
}

.drop-sub {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 13px;
}

.drop-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  align-items: flex-end;
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 2px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
}

.ghost.danger {
  color: #a33;
  border-color: #e3c0c0;
  margin-top: 16px;
}

.inline-level {
  margin: 0;
  text-align: left;
  min-width: 160px;
}

.upload-status {
  min-height: 1.4em;
  font-size: 13px;
  color: var(--primary);
}

.upload-status.is-error {
  color: #a33;
}

.upload-levels {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.upload-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  padding: 12px 14px;
  border-radius: 2px;
}

.upload-row .meta {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.mini-bar {
  margin-top: 8px;
  height: 4px;
  background: #e8edf2;
  border-radius: 2px;
  overflow: hidden;
  width: 220px;
}

.mini-bar i {
  display: block;
  height: 100%;
  background: var(--primary);
}

.drop-actions .primary,
.drop-actions .ghost {
  width: auto;
}

.docs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 8px;
}

.doc-card.is-over {
  border-color: var(--primary);
  background: #f1f8f4;
}

.doc-card h3 {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 16px;
}

.doc-card .primary,
.doc-card .ghost {
  width: auto;
}

.doc-card .ghost.danger {
  margin-top: 8px;
}

.gallery-page,
.plaquette-page {
  padding: 0;
  place-items: stretch;
  overflow: auto;
}

.gallery-page {
  background: #eef1f4;
}

.gallery-masonry {
  column-count: 3;
  column-gap: 8px;
  padding: 8px;
}

.gallery-tile {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 0;
  border: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  background: #111;
  break-inside: avoid;
  position: relative;
  cursor: pointer;
  overflow: hidden;
}

.gallery-tile img {
  display: block;
  width: 100%;
  height: auto;
}

.gallery-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.gallery-tile:hover .gallery-overlay,
.gallery-tile:focus-visible .gallery-overlay {
  opacity: 1;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  place-items: center;
  background: rgba(8, 10, 12, 0.92);
}

.lightbox.is-open {
  display: grid !important;
}

.lightbox img {
  max-width: min(1200px, 88vw);
  max-height: 82vh;
  object-fit: contain;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  line-height: 1;
}

.lightbox-close {
  top: 12px;
  right: 18px;
  font-size: 42px;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  font-size: 56px;
  padding: 8px 16px;
  opacity: 0.85;
}

.lightbox-prev {
  left: 8px;
}

.lightbox-next {
  right: 8px;
}

.lightbox-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  color: #fff;
  font-size: 13px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
}

@media (max-width: 900px) {
  .gallery-masonry {
    column-count: 2;
  }
}

@media (max-width: 560px) {
  .gallery-masonry {
    column-count: 1;
  }
  .lightbox-nav {
    font-size: 40px;
  }
}

.plaquette-frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #525659;
}

.plaquette-image {
  height: 100%;
  overflow: auto;
  background: #f4f6f8;
  display: grid;
  place-items: start center;
  padding: 16px;
}

.plaquette-image img {
  max-width: 100%;
  height: auto;
  box-shadow: var(--shadow);
}

.setup.setup-lots {
  grid-template-columns: 1fr;
  max-width: 1100px;
}

.lots-card {
  overflow: auto;
}

.lots-table-wrap {
  overflow-x: auto;
  margin: 16px 0 20px;
}

.lots-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.lots-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.lots-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.lots-table .lot-name {
  font-weight: 600;
  white-space: nowrap;
  color: var(--primary);
}

.lots-table input,
.lots-table select {
  width: 100%;
  min-width: 88px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 0 8px;
  font-size: 14px;
  background: #fff;
}

.lots-table input[type="number"] {
  min-width: 96px;
}

.setup-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 8px;
}

.setup-actions .primary {
  width: auto;
  min-width: 180px;
  padding: 0 20px;
}

.setup-actions .ghost {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  text-decoration: none;
}

@media (max-width: 800px) {
  .docs-grid {
    grid-template-columns: 1fr;
  }
}
