:root {
  --ink: #111827;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f8fafc;
  --brand: #0f766e;
  --available: #31b66a;
  --hold: #f59e0b;
  --sold: #ef4444;
  --tentative: #c4137c;
  --provisional: #19b7b0;
  --registered: #4c1ee9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: #ffffff;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
a,
input,
select,
textarea {
  letter-spacing: 0;
}

.app-shell {
  width: min(98vw, 1640px);
  margin: 10px auto 24px;
}

.top-strip {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
  font-size: clamp(0.9rem, 1vw, 1.08rem);
  font-weight: 700;
  overflow: hidden;
}

.top-strip a {
  max-width: 100%;
  overflow: hidden;
  color: #db2777;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.project-title {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.project-title img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex: 0 0 auto;
}

.project-title h2 {
  margin: 0;
  font-size: 1.32rem;
  line-height: 1.1;
  font-weight: 750;
}

.project-title p {
  margin: 4px 0 0;
  color: #f59e0b;
  font-size: 0.95rem;
  font-weight: 600;
}

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

.icon-btn,
.tool-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  color: #ffffff;
  background: #111827;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.18);
}

.icon-btn:hover,
.tool-btn:hover {
  transform: translateY(-1px);
  color: #ffffff;
  background: #0f766e;
}

.stats-band {
  display: flex;
  gap: 7px;
  width: 100%;
  overflow-x: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--soft);
  scrollbar-width: thin;
}

.stats-band::-webkit-scrollbar {
  height: 5px;
}

.stats-band::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 13px;
  border: 0;
  border-radius: 999px;
  color: #ffffff;
  white-space: nowrap;
  font-size: 0.78rem;
  font-weight: 700;
  flex: 0 0 auto;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.12);
}

.stat-chip strong {
  font-size: 0.88rem;
}

.stat-chip.total {
  background: #16803a;
}

.stat-chip.available {
  background: var(--available);
}

.stat-chip.hold {
  background: var(--hold);
}

.stat-chip.sold {
  background: var(--sold);
}

.stat-chip.tentative {
  background: var(--tentative);
}

.stat-chip.provisional {
  background: var(--provisional);
}

.stat-chip.registered {
  background: var(--registered);
}

.layout-stage {
  position: relative;
  border: 1px solid var(--line);
  border-top: 0;
  min-height: 72vh;
  background: #ffffff;
}

.layout-viewport {
  height: 72vh;
  min-height: 450px;
  overflow: hidden;
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.layout-viewport.dragging {
  cursor: grabbing;
}

.layout-canvas {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  transform-origin: center center;
  transition: transform 160ms ease;
}

.layout-canvas svg {
  width: min(100%, 980px);
  height: min(100%, 72vh);
  display: block;
}

.layout-canvas svg .plot {
  fill: rgba(49, 182, 106, 0.64);
  stroke: rgba(15, 23, 42, 0.55);
  stroke-width: 4;
  cursor: pointer;
  transition: fill 140ms ease, stroke 140ms ease, opacity 140ms ease;
}

.layout-canvas svg .plot:hover,
.layout-canvas svg .plot.active {
  fill: rgba(14, 165, 233, 0.64) !important;
  stroke: #075985;
}

.layout-canvas svg .plot.status-available {
  fill: rgba(49, 182, 106, 0.62);
}

.layout-canvas svg .plot.status-hold {
  fill: rgba(245, 158, 11, 0.7);
}

.layout-canvas svg .plot.status-sold {
  fill: rgba(239, 68, 68, 0.68);
}

.layout-canvas svg .plot.status-tentative {
  fill: rgba(196, 19, 124, 0.66);
}

.layout-canvas svg .plot.status-provisional {
  fill: rgba(33, 209, 202, 0.55);
}

.layout-canvas svg .plot.status-registered {
  fill: rgba(76, 30, 233, 0.68);
}

.layout-canvas svg .plot.is-dimmed {
  opacity: 0.13;
}

.map-toolbar {
  position: fixed;
  right: 18px;
  bottom: 90px;
  z-index: 20;
  display: grid;
  gap: 10px;
}

.tool-btn {
  width: 44px;
  height: 44px;
  font-size: 1.1rem;
  background: #1f2937;
}

.project-tabs {
  position: sticky;
  bottom: 0;
  z-index: 19;
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 12px 10px;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(10px);
}

.project-tab {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 132px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.project-tab i {
  font-size: 1.2rem;
}

.project-tab span {
  line-height: 1.1;
  font-size: 0.84rem;
  font-weight: 750;
}

.project-tab.active {
  color: #ffffff;
  border-color: #2563eb;
  background: linear-gradient(135deg, #2563eb, #0f766e);
}

.modal-content {
  border: 0;
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
}

.modal-header {
  border-bottom-color: var(--line);
}

.form-label {
  color: #334155;
  font-weight: 700;
}

.filter-status {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--brand);
  font-weight: 700;
}

.plot-table {
  margin: 0;
}

.plot-table th {
  width: 38%;
  color: var(--muted);
}

.plot-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #ffffff;
  font-weight: 750;
}

.plot-status-badge.Available {
  background: var(--available);
}

.plot-status-badge.Hold {
  background: var(--hold);
}

.plot-status-badge.Sold {
  background: var(--sold);
}

.plot-status-badge.TentativelyBooked {
  background: var(--tentative);
}

.plot-status-badge.Provisional {
  background: var(--provisional);
}

.plot-status-badge.Registered {
  background: var(--registered);
}

.plot-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.enquiry-mini {
  margin: 0 0 14px;
  color: #0f766e;
  font-weight: 750;
}

.copy-message {
  display: none;
  margin: 10px 0 0;
  color: #16a34a;
  font-weight: 700;
}

.share-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 16px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
  text-transform: uppercase;
}

.share-divider::before,
.share-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.share-icons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.share-icons a {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: #ffffff;
  font-size: 1.08rem;
  text-decoration: none;
}

.share-icons .whatsapp {
  background: #25d366;
}

.share-icons .facebook {
  background: #1877f2;
}

.share-icons .twitter {
  background: #111827;
}

.share-icons .email {
  background: #ea4335;
}

.share-icons .linkedin {
  background: #0a66c2;
}

.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.62);
  backdrop-filter: blur(6px);
  animation: fadeIn 220ms ease;
}

.welcome-overlay.hide {
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.welcome-box {
  width: min(92vw, 410px);
  padding: 26px;
  text-align: center;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.28);
}

.welcome-box h1 {
  margin: 0 0 8px;
  font-size: 1.85rem;
  font-weight: 800;
}

.company-name {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 700;
}

.browse-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--brand);
  font-weight: 800;
}

.instruction-list {
  padding: 12px;
  border-radius: 8px;
  background: #f1f5f9;
  text-align: left;
}

.instruction-list p {
  display: flex;
  gap: 8px;
  margin: 7px 0;
  color: #334155;
}

.welcome-progress {
  height: 6px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e8f0;
}

.welcome-progress span {
  display: block;
  height: 100%;
  width: 100%;
  background: #0f766e;
  animation: progressShrink 2600ms linear forwards;
}

.spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes progressShrink {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}

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

@media (max-width: 768px) {
  .app-shell {
    width: 100vw;
    margin-top: 0;
  }

  .top-strip,
  .project-header {
    padding-inline: 12px;
  }

  .project-header {
    align-items: flex-start;
  }

  .project-title h2 {
    font-size: 1.12rem;
  }

  .layout-stage {
    min-height: 66vh;
  }

  .layout-viewport {
    min-height: 420px;
    height: 66vh;
  }

  .map-toolbar {
    right: 12px;
    bottom: 88px;
  }

  .project-tabs {
    gap: 6px;
    justify-content: flex-start;
    overflow-x: auto;
    padding: 8px;
  }

  .project-tab {
    min-width: 118px;
    flex: 0 0 118px;
    justify-content: center;
    padding: 9px 7px;
  }

  .project-tab span {
    font-size: 0.72rem;
  }

  .header-actions .btn {
    display: none;
  }
}

.admin-body {
  background: #f3f6f9;
}

.admin-shell {
  width: min(96vw, 1480px);
  margin: 22px auto 40px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.admin-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-card {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #ffffff;
  background: #16803a;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

.metric-card span {
  display: block;
  font-size: 0.78rem;
  font-weight: 750;
  opacity: 0.9;
}

.metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
  line-height: 1;
}

.metric-card.available {
  background: var(--available);
}

.metric-card.hold {
  background: var(--hold);
}

.metric-card.sold {
  background: var(--sold);
}

.metric-card.tentative {
  background: var(--tentative);
}

.metric-card.provisional {
  background: var(--provisional);
}

.admin-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.07);
  overflow: hidden;
}

.admin-tools,
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.bulk-bar {
  justify-content: space-between;
  background: #f8fafc;
}

.search-box {
  flex: 1 1 360px;
}

.admin-tools > .form-select {
  width: min(100%, 190px);
}

.inventory-table-wrap {
  max-height: calc(100vh - 330px);
}

.inventory-table {
  margin: 0;
  min-width: 920px;
}

.inventory-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: #475569;
  background: #f8fafc;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.inventory-table td,
.inventory-table th {
  padding: 12px 14px;
}

.status-select {
  min-width: 172px;
}

.plot-number-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 5px 10px;
  border-radius: 999px;
  color: #ffffff;
  background: #111827;
  font-weight: 800;
}

.row-actions {
  display: inline-flex;
  gap: 6px;
}

.row-actions .btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

@media (max-width: 992px) {
  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inventory-table-wrap {
    max-height: none;
  }
}
