body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #f6f7f9;
  color: #111827;
}

header {
  background: #1b8c2f;
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-nav {
  min-height: 62px;
  box-sizing: border-box;
  background: linear-gradient(to bottom, #239a41, #1f8f3a);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  padding: 8px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.logo-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding-left: 4px;
}

.naviform-logo {
  display: block;
  height: 72px;
  width: auto;
}

header nav a {
  color: #fff;
  margin-left: 0;
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  line-height: 1;
  opacity: 0.96;
  transition: all 0.2s ease;
}

header nav a:hover {
  color: #fff;
  opacity: 0.85;
}

.app-nav nav {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: nowrap;
}

.app-nav nav a {
  margin-left: 0;
}

.app-nav .primary-nav a {
  min-height: 36px;
  padding: 6px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.app-nav .primary-nav a.is-active {
  background: rgba(255, 255, 255, 0.15);
}

.app-nav #authSlot {
  margin-left: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 36px;
}

.header-demo-slot {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
}

.header-demo-slot .btn-primary {
  white-space: nowrap;
}

main {
  padding: 1.5rem 1.25rem 2rem;
}

.app-footer {
  margin-top: 2rem;
  padding: 1rem 1.25rem 1.35rem;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  background: #f6f7f9;
}

.app-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  text-align: center;
}

.app-footer a {
  color: #166534;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.app-footer a:hover {
  text-decoration: underline;
}

.app-footer-sep {
  margin: 0 0.5rem;
  color: #6b7280;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
}

h1 {
  margin: 0.2rem 0 0.9rem;
  font-size: clamp(1.75rem, 2.8vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.25;
}

.card {
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 14px;
  padding: 1.4rem 1.5rem;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  margin-bottom: 1.25rem;
}

/* Index page polish */
.index-page {
  background: #f6f7f9;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #111827;
}

.index-page main {
  padding: 1.5rem 1.25rem 2rem;
}

.index-page .container {
  max-width: 1024px;
}

.index-page h1 {
  font-size: clamp(1.75rem, 2.8vw, 2rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 1rem;
}

.index-page h2 {
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.25;
  margin: 0 0 0.65rem;
}

.index-page p,
.index-page li {
  font-size: 1rem;
  line-height: 1.6;
}

.index-page .card {
  border-radius: 14px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  padding: 1.4rem 1.5rem;
  box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
  margin-bottom: 1.25rem;
}

.index-page .index-break-image {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  margin: 1.35rem 0 0.7rem;
}

.index-page .card > .index-break-image:first-child {
  margin-top: 0;
}

.index-page .index-shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  margin: 0.55rem 0 1rem;
}

.index-page .index-shot-thumb {
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 10px;
  background: #fff;
  padding: 0;
  cursor: zoom-in;
  overflow: hidden;
}

.index-page .index-shot-thumb img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  display: block;
}

.index-page .index-lightbox[hidden] {
  display: none !important;
}

.index-page .index-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.index-page .index-lightbox img {
  max-width: min(96vw, 1500px);
  max-height: 84vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  box-shadow: 0 14px 48px rgba(0, 0, 0, 0.45);
}

.index-page .index-lightbox-caption {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  margin: 0;
  max-width: min(92vw, 980px);
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.58);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.35;
  text-align: center;
}

.index-page .index-lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  border-radius: 9px;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  cursor: pointer;
}

.index-page .card ul {
  margin: 0.7rem 0 0;
  padding-left: 1.2rem;
}

.index-page .card li + li {
  margin-top: 0.4rem;
}

.index-page .index-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.95rem;
}

.index-page .index-cta-row .btn-primary,
.index-page .index-cta-row .btn-ghost {
  min-height: 38px;
  padding: 0.5rem 0.85rem;
  border-radius: 9px;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.index-page .index-cta-row .btn-primary {
  background: #1b8c2f;
  color: #fff;
  border: 1px solid #1b8c2f;
}

.index-page .index-cta-row .btn-primary:hover {
  background: #167428;
  border-color: #167428;
}

.index-page .index-cta-row .btn-primary:active,
.index-page .index-cta-row .btn-ghost:active {
  transform: translateY(1px);
}

.index-page .index-cta-row .btn-ghost {
  background: #fff;
  color: #1f2937;
  border: 1px solid rgba(0, 0, 0, 0.16);
}

.index-page .index-cta-row .btn-ghost:hover {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.22);
}

.index-page a:focus-visible,
.index-page button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28);
}

@media (max-width: 700px) {
  .index-page main {
    padding: 1.1rem 0.9rem 1.4rem;
  }

  .index-page .card {
    padding: 1.05rem;
    border-radius: 12px;
  }

  .index-page .index-cta-row .btn-primary,
  .index-page .index-cta-row .btn-ghost {
    flex: 1 1 auto;
  }
}

.grid {
  display: grid;
  gap: 1rem;
}

.grid-2 {
  grid-template-columns: 1.5fr 1fr;
}

label {
  display: block;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

input, select, textarea, button {
  font-family: inherit;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"],
textarea,
select {
  width: 100%;
  min-height: 38px;
  padding: 0.48rem 0.62rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.16);
  background: #fff;
  color: #111827;
  box-sizing: border-box;
  font-size: 0.92rem;
}

textarea {
  min-height: 96px;
}

button {
  border-radius: 9px;
  border: 1px solid transparent;
  padding: 0.5rem 0.85rem;
  min-height: 38px;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
}

button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn,
.btn-primary,
.btn-secondary,
.btn-ghost,
.btn-danger,
a.btn,
a.btn-primary,
a.btn-secondary,
a.btn-ghost,
a.btn-danger {
  min-height: 38px;
  padding: 0.5rem 0.85rem;
  border-radius: 9px;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.btn,
.btn-secondary {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.16);
  color: #1f2937;
}

.btn:hover,
.btn-secondary:hover {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.22);
}

.btn-primary,
.btn.primary {
  background: #1b8c2f;
  border-color: #1b8c2f;
  color: #fff;
}

.btn-primary:hover,
.btn.primary:hover {
  background: #167428;
  border-color: #167428;
}

.btn-ghost {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.16);
  color: #111827;
}

.btn-ghost:hover {
  background: #f9fafb;
  border-color: rgba(0, 0, 0, 0.22);
}

.btn-danger,
.btn.danger {
  background: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn-danger:hover,
.btn.danger:hover {
  background: #991b1b;
  border-color: #991b1b;
}

.btn:active,
.btn-primary:active,
.btn-secondary:active,
.btn-ghost:active,
.btn-danger:active,
.btn.primary:active,
.btn.danger:active {
  transform: translateY(1px);
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.28);
}

/* Header auth control (non-tab) */
.app-nav .btn-ghost {
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  opacity: 0.95;
  box-shadow: none;
}

.app-nav .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.17);
  opacity: 1;
}

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.auth-user {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-decoration: none;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.84rem;
  letter-spacing: 0.2px;
}

.auth-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #2bd576;
  box-shadow: 0 0 0 4px rgba(43, 213, 118, 0.18);
}

.auth-role {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.app-nav .nav-billing {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 8px;
  padding: 6px 12px;
}

.app-nav .nav-logout {
  background: transparent;
  border-color: transparent;
  opacity: 0.85;
}

.app-nav .nav-logout:hover {
  background: transparent;
  opacity: 1;
}

/* Login role toggle */
.role-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0 10px;
}

.role-btn {
  border: 1px solid #e6e6e6;
  background: #f7f7f7;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.role-btn:hover { transform: translateY(-1px); }

.role-btn.is-active {
  background: #1b8c2f;
  border-color: #1b8c2f;
  color: #fff;
  box-shadow: 0 10px 30px rgba(27, 140, 47, 0.25);
}

#map,
#tech-map {
  width: 100%;
  height: 520px;
  border-radius: 8px;
  overflow: hidden;
}

.unit-list,
.job-locations,
.admin-list {
  max-height: 300px;
  overflow-y: auto;
}

.unit-item,
.location-item {
  padding: 0.3rem 0.4rem;
  margin-bottom: 0.25rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
}

.unit-item:hover,
.location-item:hover {
  background: #f0f7f0;
}

.unit-item.active,
.location-item.active {
  background: #d8f3db;
  font-weight: 600;
}

.notice {
  font-size: 0.8rem;
  color: #666;
  margin-top: 0.3rem;
}

/* Badges + group headers */
.badge {
  display: inline-block;
  font-size: 0.72rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #eef2ff;
  border: 1px solid #dbe4ff;
  color: #2b3a90;
  margin-left: 0.4rem;
  vertical-align: middle;
}

.badge-danger {
  background: #ffecec;
  border-color: #ffd0d0;
  color: #9b1c1c;
}

.building-group {
  margin: 0.35rem 0 0.4rem;
  padding: 0.35rem 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  color: #1b8c2f;
  background: #f0f7f0;
  border: 1px solid #d8f3db;
  border-radius: 6px;
}

/* Map markers: highlight service points relevant to current unit */
.sp-marker {
  width: 26px;
  height: 26px;
}

.sp-marker.is-critical {
  transform: scale(1.08);
  filter: drop-shadow(0 0 8px rgba(255,0,0,0.35));
}

.sp-marker.is-multi {
  filter: drop-shadow(0 0 8px rgba(30,64,175,0.25));
}

/* Floorplan */

#floorplan-container {
  border-radius: 8px;
  background: #fff;
  height: 520px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#floorplan-svg {
  border: 1px solid #ccc;
  background: #fafafa;
}

/* Public map – unit floorplan preview */
.unit-floorplan-card {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid #eee;
}

.unit-floorplan-card h4 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.unit-floorplan-canvas {
  position: relative;
  width: 100%;
  height: 220px;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #f3f3f3;
}

.unit-floorplan-image {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  transform-origin: center center;
}

.unit-floorplan-hotspots {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.unit-floorplan-hotspot {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ffcc00;
  color: #000;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.route-details {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}


/* Admin */

.admin-section-title {
  margin-top: 0;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-bottom: 0.5rem;
}

.admin-table th,
.admin-table td {
  border: 1px solid #ddd;
  padding: 0.3rem 0.4rem;
}

.admin-table th {
  background: #f4f4f4;
}

.admin-form-group {
  margin-bottom: 0.5rem;
}

.tag-pill {
  display: inline-block;
  padding: 0.15rem 0.4rem;
  border-radius: 12px;
  background: #e3f5e6;
  font-size: 0.75rem;
  margin-right: 0.25rem;
}

/* Login */

.login-card {
  max-width: 360px;
  margin: 2rem auto;
}

/* QR sheet printing */

.qr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.qr-item {
  background: #fff;
  border-radius: 8px;
  padding: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
  text-align: center;
  font-size: 0.8rem;
}

.qr-item img {
  display: block;
  margin: 0.25rem auto 0.5rem;
}

@media print {
  header, nav, .no-print {
    display: none !important;
  }
  body {
    background: #fff;
  }
  main {
    padding: 0.5rem;
  }
  .qr-item {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}

/* Floorplan upload + editor */

#floorplanImagePreviewWrapper {
  margin-top: 0.75rem;
  border-radius: 8px;
  border: 1px dashed #ccc;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
}

#floorplanImagePreview {
  max-width: 100%;
  max-height: 260px;
}

#fp-editor-wrapper {
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #f3f3f3;
  overflow: hidden;
  margin-top: 0.5rem;
}

#fp-editor-canvas {
  position: relative;
  width: 100%;
  height: 360px;
  overflow: hidden;
  cursor: grab;
}

#fp-image {
  position: absolute;
  top: 50%;
  left: 50%;
  transform-origin: center center;
  max-width: none;
}

#fp-hotspots-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.fp-hotspot {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ffcc00;
  color: #000;
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  cursor: grab;
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

body.fp-dragging,
body.fp-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

.fp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.fp-toolbar label {
  font-size: 0.85rem;
}

.fp-toolbar input[type="range"] {
  width: 140px;
}

.fp-draw-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.fp-draw-toolbar .tool-btn {
  border: 1px solid #d2d2d2;
  background: #fff;
  color: #1c1c1c;
  border-radius: 6px;
  font-size: 0.84rem;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
}

.fp-draw-toolbar .tool-btn.is-active {
  border-color: #0d7a2b;
  background: #0d7a2b;
  color: #fff;
}

.fp-draw-toolbar input[type="number"] {
  width: 95px;
  margin-left: 0.2rem;
}

.fp-draw-shell {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 0.75rem;
}


#fp-stage-container {
  height: 520px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f5f5f5;
  overflow: hidden;
}

.fp-studio-host {
  height: max(360px, calc(100vh - 180px));
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #f7f7f7;
  overflow: hidden;
}

.fp-overlay-stage {
  position: relative;
  height: 560px;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fafafa;
  overflow: hidden;
}

#overlayGeometryCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#overlayPointsLayer {
  position: absolute;
  inset: 0;
}

.fp-overlay-marker {
  position: absolute;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  margin-top: -7px;
  border-radius: 999px;
  border: 2px solid #fff;
  background: #e06b00;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
  cursor: grab;
}

.fp-overlay-marker.is-selected {
  transform: scale(1.2);
  background: #006be0;
}

.fp-overlay-marker-label {
  position: absolute;
  font-size: 12px;
  color: #1f2937;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 41, 55, 0.15);
  border-radius: 5px;
  padding: 1px 5px;
  pointer-events: none;
}


.fp-shape-panel {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 0.65rem;
  background: #fff;
}

.fp-shape-panel h4 {
  margin: 0 0 0.5rem;
}

.fp-shape-panel label {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.85rem;
}

.fp-shape-panel input,
.fp-shape-panel textarea {
  width: 100%;
  margin-top: 0.2rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  padding: 0.35rem 0.45rem;
  font-size: 0.88rem;
}

@media (max-width: 900px) {
  .fp-draw-shell {
    grid-template-columns: 1fr;
  }
  #fp-stage-container {
    height: 420px;
  }
  .fp-overlay-stage {
    height: 420px;
  }
  .fp-studio-host {
    height: max(320px, calc(100vh - 220px));
  }
}

.fp-unit-route {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fp-unit-route .fp-field label {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.fp-unit-route select,
.fp-unit-route textarea {
  width: 100%;
  font-size: 0.9rem;
  padding: 0.35rem 0.45rem;
  border-radius: 4px;
  border: 1px solid #ccc;
}

/* ─────────────────────────────────────────────────────────────
   Public map overlay layout (RV park-style list on the right)
   ───────────────────────────────────────────────────────────── */
.public-map-shell {
  position: relative;
  height: calc(100dvh - var(--public-header-h, 0px));
  background: #e3e3e3;
}

#public-map,
#sharedMap {
  position: absolute;
  inset: 0;
}

/* Public map page should size to the real viewport below the variable-height header */
body[data-map-view-mode="public"] {
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

body[data-map-view-mode="public"] .main {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0;
}

/* Sidebar floating over the map on the right */
.public-map-sidebar {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 260px;
  max-height: calc(100vh - 120px);
  z-index: 10;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 6px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 0.85rem;
}

.public-map-sidebar-header {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid #e0e0e0;
  font-weight: 600;
}

.public-map-sidebar-body {
  padding: 0.25rem 0.5rem 0.5rem;
  overflow-y: auto;
}

/* Location list items (Space 36, Space 37, etc.) */
.location-item {
  padding: 0.35rem 0.45rem;
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 0.2rem;
  transition: background 0.12s ease, transform 0.08s ease;
}

.location-item:hover {
  background: #f2f2f2;
  transform: translateX(1px);
}

.location-item.active {
  background: #e5f0ff;
  font-weight: 600;
}

.location-title {
  margin-bottom: 0.15rem;
}

/* Google / Apple Maps links, only visible on active item */
.nav-links {
  display: none;
  font-size: 0.7rem;
}

.location-item.active .nav-links {
  display: block;
}

.nav-links a {
  text-decoration: none;
  margin-right: 0.35rem;
  color: #444;
  border-bottom: 1px dotted #777;
}

/* Mobile: dock the list at the bottom */
@media (max-width: 768px) {
  .public-map-sidebar {
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    top: auto;
    bottom: 12px;
    max-height: 32vh;
  }
}

/* Selected unit details card (bottom-left) */
.public-map-details {
  position: absolute;
  left: 16px;
  bottom: 54px;
  width: 320px;
  max-width: 90vw;
  z-index: 10;
  background: rgba(255, 255, 255, 0.97);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.25);
  font-size: 0.85rem;
  display: none;
  overflow: hidden;
}

.public-map-details.visible {
  display: block;
}

.public-map-details-header {
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  border-bottom: 1px solid #e0e0e0;
}

.public-map-details-body {
  padding: 0.5rem 0.75rem 0.75rem;
}

.public-map-details-body h4 {
  margin: 0.5rem 0 0.25rem;
  font-size: 0.85rem;
}

.public-map-details-buttons {
  margin: 0.35rem 0 0.4rem;
}

.public-map-details-buttons button {
  display: inline-block;
  margin-right: 0.35rem;
  margin-bottom: 0.25rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  border: none;
  cursor: pointer;
}

.public-map-details-buttons .btn-google {
  background: #2e7d32;
  color: #fff;
}

.public-map-details-buttons .btn-apple {
  background: #424242;
  color: #fff;
}

.public-map-details-floorplan {
  margin-top: 0.4rem;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #e0e0e0;
  background: #fafafa;
}

.public-map-details-floorplan img {
  display: block;
  width: 100%;
  height: auto;
}

.public-map-details-route {
  padding: 0.35rem 0.5rem;
  font-size: 0.78rem;
  color: #444;
}

.public-map-branding {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 11;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.14);
  font-size: 12px;
  font-weight: 600;
  color: #1f2937;
}

.public-map-branding img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  border-radius: 6px;
}

/* Mobile: move card above bottom sidebar */
@media (max-width: 768px) {
  .public-map-details {
    left: 50%;
    transform: translateX(-50%);
    top: 12px;
    bottom: auto;
    width: 94%;
    max-height: 34vh;
    overflow: auto;
  }
}


.small{font-size:0.85rem;}
.muted{opacity:0.75;}


/* ─────────────────────────────────────────────
   Map Editor layout + right sidebar lists
   ───────────────────────────────────────────── */
.split{
  display:flex;
  gap:1rem;
  align-items:flex-start;
}
@media (max-width: 980px){
  .split{ flex-direction:column; }
}
.editor-list{
  list-style:none;
  margin:0;
  padding:0;
}
.editor-list li{
  padding:0.5rem 0.6rem;
  border:1px solid #eee;
  border-radius:8px;
  margin-bottom:0.5rem;
  cursor:pointer;
  background:#fff;
}
.editor-list li:hover{ background:#f7fbf7; }
.editor-list li.active{
  background:#d8f3db;
  border-color:#b8e6bd;
  font-weight:600;
}
.editor-list .meta{
  font-size:0.8rem;
  color:#555;
  margin-top:0.15rem;
}
.editor-search{
  display:flex;
  gap:0.5rem;
  align-items:center;
  margin-bottom:0.75rem;
}
.editor-search input{
  flex:1;
}

.map-editor-sidebar-card {
  display: block;
}

.map-editor-points-scroll {
  max-height: calc(70vh - 220px);
  min-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}


/* NaviForm modal + list actions */

.editor-list li .row{display:flex;gap:10px;align-items:flex-start;justify-content:space-between}
.editor-list li .txt{min-width:0}
.editor-list li .title{font-weight:700}
.editor-list li .actions{display:flex;gap:6px;flex-shrink:0}
.editor-list li .actions button{border:1px solid #ddd;border-radius:10px;padding:6px 10px;cursor:pointer;background:#fff}
.editor-list li .actions .btn-del{border-color:#f3b5b5}
.editor-list li .actions .btn-edit{border-color:#b5d5f3}

.nf-modal{position:fixed;inset:0;z-index:9999;display:flex;align-items:center;justify-content:center;padding:16px}
.nf-modal-backdrop{position:absolute;inset:0;background:rgba(0,0,0,0.35)}
.nf-modal-card{position:relative;background:#fff;border-radius:16px;box-shadow:0 12px 40px rgba(0,0,0,0.25);width:min(560px, 96vw);max-height:90vh;overflow:auto;padding:14px}
.nf-modal-head{display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid #eee;padding-bottom:10px;margin-bottom:10px}
.nf-modal-title{font-weight:800;font-size:18px}
.nf-modal-close{border:0;background:transparent;font-size:18px;cursor:pointer}
.nf-modal-body{padding-bottom:6px}
.nf-label{display:block;margin:10px 0 6px;font-size:12px;color:#444;font-weight:700}
.nf-input{width:100%;padding:10px;border:1px solid #ddd;border-radius:12px}
.nf-modal-actions{display:flex;gap:10px;margin-top:12px}

/* Keep map-editor marker menus constrained to the popup ("white flag") area */
#map-editor-map .mapboxgl-popup {
  max-width: min(92vw, 360px);
}
#map-editor-map .mapboxgl-popup-content {
  width: min(88vw, 340px);
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 10px;
  box-sizing: border-box;
}
#map-editor-map .mapboxgl-popup-content .map-editor-popup {
  min-width: 0 !important;
  width: 100%;
  max-width: 100%;
  max-height: calc(min(62vh, 560px) - 20px);
  overflow: auto;
  box-sizing: border-box;
}
#map-editor-map .mapboxgl-popup-content input,
#map-editor-map .mapboxgl-popup-content select,
#map-editor-map .mapboxgl-popup-content textarea,
#map-editor-map .mapboxgl-popup-content button {
  max-width: 100%;
  box-sizing: border-box;
}

.share-qr {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
}

.map-editor-map-wrap {
  position: relative;
}

.address-search-box {
  position: absolute;
  top: 12px;
  left: 12px;
  width: min(420px, calc(100% - 24px));
  z-index: 4;
}

.address-search-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #d6d9dd;
  border-radius: 10px;
  background: #fff;
  padding: 10px 12px;
  font-size: 14px;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.12);
}

.address-search-suggestions,
.address-search-recent {
  list-style: none;
  margin: 6px 0 0 0;
  padding: 6px 0;
  border: 1px solid #dfe3e8;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.14);
  max-height: 280px;
  overflow-y: auto;
}

.address-search-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
}

.address-search-item small {
  display: block;
  color: #6b7280;
  margin-top: 2px;
}

.address-search-item:hover,
.address-search-item.is-active {
  background: #eef6ff;
}

.address-search-match {
  font-weight: 700;
  color: #0f2f53;
}

.demo-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.12), transparent 28%),
    linear-gradient(180deg, #f7f7f2 0%, #eef2f7 100%);
}

.demo-shell {
  max-width: 1560px;
  margin: 0 auto;
  padding: 1.25rem;
}

.demo-hero {
  margin-bottom: 1rem;
}

.demo-eyebrow {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  color: #0f766e;
}

.demo-hero h1 {
  margin: 0 0 0.5rem;
}

.demo-tabs {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
}

.demo-tab {
  appearance: none;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 999px;
  padding: 0.7rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.demo-tab.is-active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.demo-panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(320px, 0.9fr);
  gap: 1rem;
  align-items: start;
}

.demo-panel-grid[hidden] {
  display: none !important;
}

.demo-workspace,
.demo-phone-wrap {
  min-width: 0;
}

.demo-panel-head h2 {
  margin: 0 0 0.35rem;
}

.demo-panel-head p {
  margin: 0 0 0.9rem;
}

.demo-frame {
  width: 100%;
  border: 0;
  background: #fff;
  display: block;
}

.demo-frame-builder {
  min-height: 78vh;
}

.demo-phone {
  width: min(100%, 390px);
  aspect-ratio: 9 / 19.5;
  margin: 0 auto;
  border-radius: 34px;
  padding: 12px;
  background: linear-gradient(180deg, #111827 0%, #334155 100%);
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.24);
}

.demo-frame-phone {
  height: 100%;
  border-radius: 24px;
  overflow: hidden;
}

.demo-inline-note {
  margin-top: 0.6rem;
}

@media (max-width: 900px) {
  main {
    padding: 0.75rem;
  }

  .container {
    max-width: 100%;
  }

  header.app-nav {
    min-height: 60px;
    padding: 8px 10px;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .app-nav .logo-link {
    order: 1;
  }

  .naviform-logo {
    height: 64px;
  }

  .app-nav #authSlot {
    order: 2;
    margin-left: 0;
  }

  .header-demo-slot {
    order: 2;
    margin-left: auto;
  }

  .app-nav .primary-nav {
    order: 3;
    width: 100%;
    flex-wrap: nowrap;
    gap: 0.3rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
  }

  .app-nav .primary-nav a {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 5px 10px;
  }

  .auth-pill {
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .auth-user {
    font-size: 0.8rem;
    padding: 6px 9px;
    gap: 7px;
  }

  .app-nav .btn-ghost {
    padding: 5px 10px;
    min-height: 34px;
    font-size: 0.78rem;
  }

  input[type="text"],
  input[type="password"],
  input[type="number"],
  input[type="email"],
  textarea,
  select {
    font-size: 16px;
  }

  .card {
    padding: 0.75rem;
    border-radius: 10px;
  }

  .login-card {
    max-width: 100%;
    margin: 0.75rem auto;
  }

  #map,
  #tech-map,
  #floorplan-container {
    height: min(58vh, 460px);
  }

  #fp-editor-canvas {
    height: 320px;
  }

  .nf-modal {
    padding: 8px;
  }

  .demo-shell {
    padding: 0.75rem;
  }

  .demo-tabs {
    overflow-x: auto;
  }

  .demo-panel-grid {
    grid-template-columns: 1fr;
  }

  .demo-frame-builder {
    min-height: 66vh;
  }

  .demo-phone {
    width: min(100%, 360px);
  }
}

@media (max-width: 980px) {
  .map-editor-points-scroll {
    max-height: none;
    min-height: 0;
    overflow: visible;
    padding-right: 0;
  }
}
