* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; background:#fff; }

/* Index map page: only the right panel should scroll */
body.map-page{
  height: 100vh;
  overflow: hidden;
}

.topbar {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #e6e6e6; background: #fff;
  position: sticky; top: 0; z-index: 10;
}
.topbar h1 { margin: 0; font-size: 18px; }
.muted { margin: 4px 0 0; color: #666; font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  height: calc(100vh - 62px);
}

#map { width: 100%; height: 100%; }

.panel {
  border-left: 1px solid #e6e6e6;
  background: #fafafa;
  padding: 0;          /* IMPORTANT: keep panel height exact so only inner scrolls */
  overflow: hidden;    /* prevent the body from scrolling */
  position: relative;
}

.row { display: flex; gap: 8px; margin-bottom: 10px; }
.input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background:#fff;
}
textarea.input { min-height: 70px; resize: vertical; }

.btn {
  padding: 10px 12px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn.secondary { background: #fff; color: #111; border-color: #ddd; }

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

.list { display: grid; gap: 10px; }
.card {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 10px;
}
.card h3 { margin: 0 0 6px; font-size: 14px; }
.card p { margin: 4px 0; font-size: 13px; color: #333; }
.badge { display: inline-block; padding: 2px 8px; border: 1px solid #ddd; border-radius: 999px; font-size: 12px; color: #333; }

.center {
  min-height: calc(100vh - 62px);
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 18px;
}
.wide { width: min(520px, 100%); }

/* Modal */
.modal-backdrop{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 9999;
}
.modal-backdrop.open{ display:flex; }
.modal{
  width: min(720px, 100%);
  max-height: 88vh;
  overflow:auto;
  background:#fff;
  border-radius: 16px;
  border: 1px solid #eee;
  padding: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.18);
}
.modal h2{ margin: 0 0 6px; font-size: 18px; }
.modal .grid2{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.modal .grid1{ display:grid; grid-template-columns: 1fr; gap:10px; }
.modal .footer{
  display:flex; gap: 10px; justify-content:flex-end; margin-top: 10px;
}
.help{ font-size: 12px; color:#666; margin: 6px 0 0; }
.readonly{ background:#f7f7f7; }
.err{ color:#b00020; font-size: 13px; margin-top: 8px; }

/* Leaflet marker (camera) */
.cam-pin{
  width: 28px; height: 28px;
  border-radius: 999px;
  display:flex; align-items:center; justify-content:center;
  background: #111;
  color: #fff;
  border: 2px solid #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.25);

  font-size: 16px;
  line-height: 1;
}

/* Leaflet: address search (top-right) */

.addr-search{
  display:flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  margin: 10px;
  pointer-events: auto;
  z-index: 1005;
}

.addr-search-btn{
  width: 44px;
  height: 44px;
  border-radius: 16px;
  border: 1px solid rgba(0,0,0,.10);
  background: rgba(255,255,255,.96);
  cursor: pointer;
  box-shadow: 0 18px 50px rgba(0,0,0,.18);
  display:flex;
  align-items:center;
  justify-content:center;
  color: #111;
  transition: transform .12s ease, box-shadow .12s ease;
}
.addr-search-btn:hover{ transform: translateY(-1px); box-shadow: 0 20px 56px rgba(0,0,0,.20); }
.addr-search-btn:active{ transform: translateY(0); }

.addr-search-panel{
  display:none;
  width: min(380px, 80vw);
  background: rgba(255,255,255,.94);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  padding: 12px;
  box-shadow: 0 22px 70px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
}

.addr-search.open .addr-search-panel{ display:block; }

.addr-search-field{
  display:flex;
  align-items:center;
  gap: 8px;
  padding: 10px 10px;
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 14px;
  background: rgba(255,255,255,.92);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.30);
}

.addr-search-ico{ opacity:.70; display:flex; align-items:center; }

.addr-search-input{
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14.5px;
}

.addr-search-clear,
.addr-search-go{
  border: none;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  height: 30px;
  width: 30px;
  border-radius: 10px;
  background: transparent;
  color: #111;
}

.addr-search-clear{ opacity: .65; }
.addr-search-clear:hover{ opacity: 1; background: rgba(0,0,0,.06); }

.addr-search-go{
  background: #111;
  color: #fff;
  box-shadow: 0 10px 22px rgba(0,0,0,.18);
}
.addr-search-go:hover{ transform: translateY(-1px); }
.addr-search-go:active{ transform: translateY(0); }
.addr-search-go:disabled{ opacity: .55; cursor: not-allowed; transform: none; }

.addr-search-hint{
  margin-top: 8px;
  font-size: 12px;
  opacity: .70;
}
.addr-search-hint span{ font-weight: 600; }

/* Autocomplete suggestions (dropdown) */
.addr-search-suggest{
  display:none;
  margin-top: 10px;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 16px;
  padding: 6px;
  box-shadow: 0 20px 60px rgba(0,0,0,.18);
  max-height: 260px;
  overflow:auto;
}

.addr-search-suggest.show{ display:block; }

.addr-search-suggest.loading{ opacity: .85; }
.addr-search-suggest.loading:before{
  content:'';
  display:block;
  width: 18px;
  height: 18px;
  margin: 8px auto 10px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.20);
  border-top-color: rgba(0,0,0,.65);
  animation: addrSpin .8s linear infinite;
}
@keyframes addrSpin{ to{ transform: rotate(360deg);} }

.addr-suggest-item{
  display:block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 10px 10px;
  border-radius: 14px;
}
.addr-suggest-item:hover,
.addr-suggest-item.active{ background: rgba(0,0,0,.06); }

.addr-suggest-main{
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addr-suggest-sub{
  font-size: 12px;
  opacity: .78;
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addr-suggest-empty{
  padding: 12px 10px;
  font-size: 13px;
  opacity: .75;
}

/* Leaflet marker (searched address) */
.addr-pin{
  width: 44px;
  height: 44px;
  background: #d40000;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 18px 36px rgba(0,0,0,.26);
  position: relative;
}
.addr-pin-core{
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 999px;
  position: absolute;
  top: 12px;
  left: 12px;
  transform: rotate(45deg);
  box-shadow: inset 0 0 0 3px rgba(212,0,0,.22);
}
.addr-pin:before{
  content:'';
  position:absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  transform: translate(-50%,-50%) rotate(45deg);
  border: 2px solid rgba(212,0,0,.32);
  animation: addrPulse 1.8s ease-out infinite;
  z-index: -1;
}
@keyframes addrPulse{
  0%{ transform: translate(-50%,-50%) rotate(45deg) scale(.75); opacity:.85; }
  100%{ transform: translate(-50%,-50%) rotate(45deg) scale(1.20); opacity:0; }
}

/* Collapsible right panel (index) */
.layout.collapsed { grid-template-columns: 1fr 44px; }
.layout.collapsed .panel-inner{ display: none; }

/* Panel content: scroll ONLY inside the sidebar */
.panel-inner{
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 52px 12px 12px; /* space for toggle button + normal padding */
}

.panel-toggle{
  position: absolute;
  top: 10px;
  right: 10px;         /* in the top-right corner of the panel */
  width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid #111;
  background: #111;
  color: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size: 20px;
  line-height: 1;
  box-shadow: 0 10px 28px rgba(0,0,0,.18);
  z-index: 80;
}

/* When collapsed, keep it centered in the narrow strip */
.layout.collapsed .panel-toggle{
  right: 3px;
  top: 10px;
}
.layout.collapsed .panel-inner{ padding-top: 0; }

/* Info modal (premium table) */
.modal .info-wrap{ display:flex; flex-direction:column; gap: 12px; }
.modal .info-sub{ font-size: 13px; color:#666; margin: 0; }
.info-table{
  width:100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid #eee;
  border-radius: 14px;
  background: #fff;
}
.info-table tr + tr td, .info-table tr + tr th{
  border-top: 1px solid #f0f0f0;
}
.info-table th{
  width: 170px;
  text-align:left;
  font-weight: 600;
  padding: 10px 12px;
  background:#fafafa;
  color:#222;
  font-size: 14px;
  vertical-align: top;
}
.info-table td{
  padding: 10px 12px;
  font-size: 14px;
  color:#222;
  vertical-align: top;
  word-break: break-word;
}
.info-pill{
  display:inline-flex;
  align-items:center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid #eee;
  background: #fcfcfc;
  font-size: 13px;
  color:#222;
}
.info-row{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items:center;
  justify-content: space-between;
}
.info-actions{
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
}
.linklike{
  text-decoration: underline;
  cursor: pointer;
}


/* ===== GMAPS SEARCH OVERRIDES (premium) ===== */

.addr-search.gmaps{
  position: relative;
  width: 360px;
  max-width: calc(100vw - 24px);
  margin: 10px !important;
  gap: 0;
  align-items: stretch;
}

/* Hide legacy toggle UI if present */
.addr-search.gmaps .addr-search-btn,
.addr-search.gmaps .addr-search-panel,
.addr-search.gmaps .addr-search-hint{ display:none !important; }

.addr-search.gmaps .addr-search-bar{
  display:flex;
  align-items:center;
  gap: 8px;
  height: 46px;
  padding: 0 8px 0 12px;
  border-radius: 24px;
  background: rgba(255,255,255,.97);
  border: 1px solid rgba(0,0,0,.10);
  box-shadow: 0 18px 55px rgba(0,0,0,.22);
  backdrop-filter: blur(10px);
}

.addr-search.gmaps .addr-search-mag{ opacity:.75; display:flex; }
.addr-search.gmaps .addr-search-input{
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14.5px;
  padding: 0;
}

.addr-search.gmaps .addr-search-clear{
  height: 32px;
  width: 32px;
  border-radius: 999px;
  border: none;
  background: rgba(0,0,0,.05);
  color: #111;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
}
.addr-search.gmaps .addr-search-clear:hover{ background: rgba(0,0,0,.08); }

.addr-search.gmaps .addr-search-go{
  height: 34px;
  width: 34px;
  border-radius: 999px;
  border: none;
  background: #111;
  color: #fff;
  cursor: pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: 0 10px 22px rgba(0,0,0,.20);
  transition: transform .12s ease;
}
.addr-search.gmaps .addr-search-go:hover{ transform: translateY(-1px); }
.addr-search.gmaps .addr-search-go:active{ transform: translateY(0); }
.addr-search.gmaps .addr-search-go:disabled{ opacity:.55; cursor:not-allowed; transform:none; }

.addr-search.gmaps .addr-search-spinner{
  display:none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,.18);
  border-top-color: rgba(0,0,0,.65);
  animation: addrSpin .8s linear infinite;
  margin-left: 2px;
}
.addr-search.gmaps.loading .addr-search-spinner{ display:inline-block; }

/* Dropdown like Google Maps */
.addr-search.gmaps .addr-search-suggest{
  position: absolute;
  top: 54px;
  left: 0;
  right: 0;
  display:none;
  padding: 6px;
  background: rgba(255,255,255,.98);
  border: 1px solid rgba(0,0,0,.10);
  border-radius: 18px;
  box-shadow: 0 22px 70px rgba(0,0,0,.22);
  max-height: 320px;
  overflow:auto;
  z-index: 2000;
}
.addr-search.gmaps .addr-search-suggest.show{ display:block; }

.addr-search.gmaps .addr-suggest-item{
  display:flex;
  align-items:flex-start;
  gap: 10px;
  width: 100%;
  text-align:left;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 10px 10px;
  border-radius: 14px;
}
.addr-search.gmaps .addr-suggest-item:hover,
.addr-search.gmaps .addr-suggest-item.active{ background: rgba(0,0,0,.06); }

.addr-search.gmaps .addr-suggest-ico{
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
  display:flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
  color: #111;
  margin-top: 1px;
}
.addr-search.gmaps .addr-suggest-text{ display:flex; flex-direction:column; gap: 3px; min-width:0; }
.addr-search.gmaps .addr-suggest-main{
  font-weight: 700;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addr-search.gmaps .addr-suggest-sub{
  font-size: 12px;
  opacity: .78;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.addr-search.gmaps mark{
  background: rgba(0,0,0,.10);
  padding: 0 2px;
  border-radius: 6px;
}

.addr-search.gmaps .addr-search-foot{
  margin-top: 8px;
  font-size: 12px;
  opacity: .70;
  text-align: left;
  padding-left: 6px;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}
.addr-search.gmaps .addr-search-foot span{ font-weight: 700; }

/* Bigger premium address pin */
.addr-pin{
  width: 54px;
  height: 54px;
  background: #d40000;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 22px 44px rgba(0,0,0,.28);
  position: relative;
}
.addr-pin:after{
  content:'';
  position:absolute;
  top: 7px;
  left: 7px;
  right: 7px;
  height: 20px;
  border-radius: 999px;
  transform: rotate(45deg);
  background: rgba(255,255,255,.22);
  filter: blur(.2px);
}
.addr-pin-core{
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 999px;
  position: absolute;
  top: 15px;
  left: 15px;
  transform: rotate(45deg);
  box-shadow: inset 0 0 0 4px rgba(212,0,0,.22);
}
.addr-pin:before{
  content:'';
  position:absolute;
  left: 50%;
  top: 50%;
  width: 78px;
  height: 78px;
  border-radius: 999px;
  transform: translate(-50%,-50%) rotate(45deg);
  border: 2px solid rgba(212,0,0,.28);
  animation: addrPulse 1.8s ease-out infinite;
  z-index: -1;
}
