:root{--brand:#0d6efd;--ink:#172033;--muted:#6b7280;--surface:#fff;--bg:#f5f7fb}
html{height:100%}
body{background:var(--bg);color:var(--ink);min-height:100vh;display:flex;flex-direction:column}
body>main.flex-grow-1{flex:1 0 auto;width:100%}
.login-page{min-height:100vh;display:grid;place-items:center;padding:20px;background:linear-gradient(135deg,#eef5ff,#f8fafc)}
.login-card{width:min(430px,100%);border-radius:18px}
.brand-mark{width:58px;height:58px;border-radius:16px;display:grid;place-items:center;margin:0 auto 14px;background:var(--brand);color:#fff;font-size:28px;font-weight:800}
.hero-panel{background:var(--surface);border-radius:18px;border:1px solid #e7eaf0}
.eyebrow{font-size:.7rem;font-weight:800;letter-spacing:.12em;color:var(--brand);margin-bottom:5px}
.stat-card{background:#fff;border:1px solid #e7eaf0;border-radius:16px;padding:20px;box-shadow:0 4px 16px rgba(0,0,0,.04)}
.stat-label{font-size:.8rem;color:var(--muted);font-weight:700}.stat-value{font-size:1.7rem;font-weight:800;margin-top:4px}

/* Map shell */
.map-shell{position:relative;height:calc(100vh - 95px);min-height:650px;border-radius:16px;overflow:hidden;background:#e5e7eb}
#map{position:absolute;inset:0;width:100%;height:100%}

/* Sidebar toolbar */
.map-toolbar{position:absolute;z-index:1000;top:14px;left:14px;width:360px;max-width:calc(100% - 28px);max-height:calc(100% - 28px);overflow:auto}
.analysis-card{background:#f7f9fc;border:1px solid #e5e9f0;border-radius:12px;padding:12px}
.analysis-row{display:flex;justify-content:space-between;gap:10px;padding:8px 0;border-bottom:1px solid #e7eaf0;font-size:.88rem}.analysis-row:last-child{border-bottom:0}.analysis-row.final{font-weight:800;font-size:.96rem}
.analysis-row .analysis-input{width:74px;font-size:.8rem;padding:.18rem .4rem;text-align:right}

/* Map action buttons */
.map-actions{
  position:absolute; z-index:1000; top:16px; right:16px;
  display:flex; flex-direction:column; gap:7px;
}
.map-actions button{
  width:38px; height:38px; border:1px solid #d9dee8; border-radius:11px;
  background:#fff; color:#172033; font-size:11px; font-weight:700;
  box-shadow:0 4px 14px rgba(0,0,0,.12); cursor:pointer;
  display:grid; place-items:center; line-height:1;
}
.map-actions button:hover{background:#f3f6fb;transform:translateY(-1px)}
.map-actions button#toggleStreetView{
  width:auto;min-width:38px;padding:0 8px;font-size:9.5px;white-space:nowrap;
}
.map-actions button#toggleStreetView.btn-primary{background:#0d6efd;color:#fff;border-color:#0d6efd}

/* Google Maps marker styles */
.gmarker-wrap{display:inline-flex;align-items:center;justify-content:center}
.gmarker{
  display:grid;place-items:center;border-radius:50%;
  box-shadow:0 3px 9px rgba(0,0,0,.28);border:2px solid #fff;
  transition:transform .15s;
}
.gmarker:hover{transform:scale(1.15)}
.gmarker-applied{width:36px;height:36px;background:#0d6efd;border-width:3px;box-shadow:0 5px 16px rgba(13,110,253,.45)}
.gmarker-school{width:22px;height:22px;background:#4f78a8}
.gmarker-closer{width:26px;height:26px;background:#dc3545;border-color:#fff;box-shadow:0 4px 12px rgba(220,53,69,.35)}
.gmarker-residence{width:30px;height:30px;background:#198754;border-width:3px;box-shadow:0 5px 16px rgba(25,135,84,.4);border-radius:50% 50% 50% 0;transform:rotate(-45deg)}
.gmarker-residence svg{transform:rotate(45deg)}
.gmarker-measure{width:10px;height:10px;background:#6b7280;border-width:1px}

/* Info window styles */
.info-window{font-family:inherit;max-width:280px;padding:2px}
.info-badge{
  display:inline-block;font-size:.62rem;font-weight:800;letter-spacing:.08em;
  border-radius:999px;padding:3px 8px;margin-bottom:6px;
}
.badge-applied{color:#0d6efd;background:#eaf2ff}
.badge-school{color:#4f78a8;background:#eef3f9}
.badge-closer{color:#dc3545;background:#fce8ea}
.badge-residence{color:#198754;background:#e6f4ed}
.info-title{font-weight:800;font-size:.95rem;margin-bottom:4px}
.info-line{font-size:.78rem;line-height:1.45}
.info-distance{
  margin-top:6px;padding-top:6px;border-top:1px solid #e7eaf0;
  font-weight:800;color:#0d6efd;font-size:.78rem
}

/* Manual map tools */
.manual-map-tools{position:absolute;left:18px;bottom:22px;z-index:900;padding:10px}
.manual-map-tools .active{box-shadow:0 0 0 2px rgba(13,110,253,.25)}

/* Map status note */
.map-zoom-note{
  position:absolute;z-index:900;right:16px;bottom:16px;
  max-width:300px;padding:7px 10px;border-radius:10px;
  background:rgba(255,255,255,.93);border:1px solid #d9dee8;
  box-shadow:0 3px 12px rgba(0,0,0,.10);font-size:.68rem;color:#5b6472;
  pointer-events:none;
}

/* On-map legend (decorative; the five analysis elements) */
.map-legend{
  position:absolute;z-index:950;top:14px;left:50%;transform:translateX(-50%);
  display:flex;flex-wrap:wrap;justify-content:center;gap:6px 12px;
  background:rgba(255,255,255,.94);border:1px solid #d9dee8;border-radius:12px;
  padding:7px 12px;box-shadow:0 3px 12px rgba(0,0,0,.10);
  pointer-events:none;max-width:calc(100% - 380px);
}
.map-legend-item{
  display:inline-flex;align-items:center;gap:5px;
  font-size:.62rem;font-weight:700;letter-spacing:.04em;color:#31465d;
  white-space:nowrap;
}
.map-legend-item svg{flex:none}
@media(max-width:768px){.map-legend{display:none}}

/* Google Maps error overlay */
.google-key-notice{
  position:absolute;top:14px;left:50%;transform:translateX(-50%);
  z-index:1001;padding:0;width:auto;max-width:480px;
  background:transparent;display:none;
}
.google-key-notice .card{
  border:1px solid #f5c2c7;background:rgba(254,243,199,.97);
  border-radius:10px;box-shadow:0 3px 12px rgba(0,0,0,.12);
}
.google-key-notice .card-body{padding:10px 16px}
.google-key-notice .card-body h5{font-size:.85rem;margin-bottom:2px}
.google-key-notice .card-body p{font-size:.75rem;margin:0}

/* Coordinate verification search box */
.coord-search-box{
  position:relative;z-index:950;top:12px;left:12px;
  width:min(320px,calc(100% - 24px));pointer-events:auto;
}
.coord-search-box .form-control{
  font-size:.82rem;padding:8px 12px 8px 36px;
  border:1px solid #d9dee8;border-radius:10px;
  box-shadow:0 3px 12px rgba(0,0,0,.13);
  background:#fff;
}
.coord-search-box .form-control:focus{border-color:#0d6efd;box-shadow:0 3px 12px rgba(0,0,0,.18)}
.coord-search-box .search-icon{
  position:absolute;left:10px;top:50%;transform:translateY(-50%);
  color:#6b7280;font-size:.82rem;pointer-events:none;
}
.coord-search-box .coord-search-hint{
  font-size:.65rem;color:#6b7280;margin-top:3px;
  background:rgba(255,255,255,.92);padding:2px 6px;border-radius:6px;
}
.coord-search-box.hidden{display:none}

/* Map provider badge */
.map-provider-badge{
  position:absolute;z-index:1000;bottom:16px;left:50%;transform:translateX(-50%);
  padding:3px 10px;border-radius:999px;font-size:.65rem;font-weight:700;
  letter-spacing:.04em;pointer-events:none;
}
.badge-google{background:rgba(255,255,255,.9);border:1px solid #d9dee8;color:#172033}
.badge-fallback{background:rgba(255,255,255,.9);border:1px solid #d9dee8;color:#6b7280}

/* Category count */
.category-count-card{border:1px solid #e5e7eb;border-radius:.75rem;padding:.7rem .85rem;background:#f8fafc}

/* Button icon */
.btn-icon{font-size:1.05rem;vertical-align:-1px;margin-right:4px}

/* Footer */
.site-footer{flex-shrink:0;margin-top:auto}
.site-footer a{text-decoration:none}
.site-footer a:hover{text-decoration:underline}

/* Map top banner shown only while the Leaflet/OSM fallback is live */
.map-fallback-notice{
  position:absolute;z-index:1200;top:16px;left:50%;transform:translateX(-50%);
  max-width:min(480px,calc(100% - 24px));
  padding:7px 12px;border-radius:10px;
  background:rgba(254,243,199,.97);border:1px solid #f5c2c7;color:#856404;
  box-shadow:0 4px 14px rgba(0,0,0,.12);font-size:.78rem;font-weight:600;
  text-align:center;
}

/* Compact toast used for Street View feedback and provider notices */
.map-toast{
  position:absolute;z-index:1300;top:52px;left:50%;transform:translateX(-50%);
  max-width:min(520px,calc(100% - 84px));
  padding:9px 14px;border-radius:10px;
  box-shadow:0 6px 20px rgba(16,24,40,.16);
  font-size:.8rem;font-weight:600;text-align:center;cursor:default;
}
.map-toast-info{background:#fff;border:1px solid #d9dee8;color:#172033}
.map-toast-warning{background:rgba(254,243,199,.98);border:1px solid #f5c2c7;color:#856404}
.map-toast-danger{background:rgba(254,226,226,.98);border:1px solid #f1aeb5;color:#842029}
.map-toast-success{background:rgba(209,231,221,.98);border:1px solid #75b798;color:#0f5132}
@media(max-width:700px){.map-toast{width:calc(100% - 40px);max-width:none;top:10px}}

/* Responsive */
@media(max-width:700px){
  .map-toolbar{width:calc(100% - 28px);max-height:52vh}
  .map-shell{min-height:760px}
  .map-actions{top:10px;right:10px}
  .map-actions button{width:34px;height:34px}
  .map-zoom-note{right:10px;bottom:10px;max-width:220px}
}

/* Print */
.print-letterhead{min-height:650px}.print-report{background:#fff}
.developer-contact a{text-decoration:none}
@media print{.no-print{display:none!important}}

/* Dashboard */
.dashboard-hero{box-shadow:0 5px 20px rgba(16,24,40,.04)}
.stat-card.compact{padding:12px 16px;min-height:94px;position:relative}
.stat-card.compact .stat-icon{font-size:1.05rem;line-height:1;margin-bottom:5px;color:#0d6efd}
.stat-card.compact .stat-value{font-size:1.45rem;margin-top:2px}
.dashboard-page .card-body{padding:14px}
.dashboard-page .category-tile{padding:9px 12px!important}
.dashboard-page .quick-action{padding:.46rem .75rem}
@media(min-width:992px){.dashboard-page{min-height:calc(100vh - 128px)}.dashboard-page .hero-panel{margin-bottom:0}.dashboard-page .stat-card{height:100%}}
@media(max-height:820px) and (min-width:992px){.dashboard-page .row.g-3{--bs-gutter-y:.6rem}.dashboard-page .dashboard-hero{padding:.8rem 1.1rem!important}.dashboard-page .stat-card.compact{min-height:78px;padding:9px 14px}.dashboard-page .stat-card.compact .stat-icon{font-size:.9rem;margin-bottom:2px}.dashboard-page .stat-card.compact .stat-value{font-size:1.25rem}.dashboard-page .category-tile{padding:7px 10px!important}.dashboard-page .quick-action{padding:.35rem .65rem}.dashboard-page .card-body{padding:11px}}

/* Map panel compact controls */
.map-shell .map-toolbar{width:335px;top:10px;left:10px;max-height:calc(100% - 20px)}
.map-shell .map-toolbar .p-3{padding:12px!important}
.map-shell .map-toolbar .form-label{font-size:.82rem;margin-bottom:.28rem}
.map-shell .map-toolbar .form-control,.map-shell .map-toolbar .form-select{font-size:.84rem;padding:.42rem .65rem}
.map-shell .map-toolbar .mb-3{margin-bottom:.62rem!important}
.map-shell .map-toolbar .analysis-card{padding:9px}
.map-shell .map-toolbar .analysis-row{padding:6px 0;font-size:.8rem}

/* Compact Application + Category summary (New Location Verification context) */
.verification-summary{border:1px solid #e5e9f0;border-radius:.75rem;padding:.55rem .85rem;background:#f8fafc}
.verification-summary .eyebrow{font-size:.62rem;margin-bottom:4px}
.verification-summary .summary-category{font-size:.9rem}
.verification-summary code{font-size:.9rem;font-weight:700}

/* Collapsible live-analysis panel — the map stays the primary workspace */
.analysis-card{position:relative}
.analysis-card.analysis-hidden>div:not(.analysis-card-head){display:none}
@media(max-width:700px){.map-shell .map-toolbar{width:calc(100% - 20px);left:10px;top:10px;max-height:54vh}.map-shell .map-toolbar .p-3{padding:10px!important}}

/* Active/Inactive toggle buttons */
.btn-active{color:#198754;border-color:#198754;background:rgba(25,135,84,.08)}
.btn-active:hover{background:#198754;color:#fff}
.btn-inactive{color:#dc3545;border-color:#dc3545;background:rgba(220,53,69,.08)}
.btn-inactive:hover{background:#dc3545;color:#fff}

/* Result modal */
.result-grid{display:grid;grid-template-columns:1fr 1fr;gap:.35rem .9rem;margin:0}
.result-grid>div{padding:.4rem .55rem;background:#f7f9fc;border:1px solid #e5e9f0;border-radius:8px}
.result-grid dt{font-size:.68rem;text-transform:uppercase;letter-spacing:.06em;color:#6b7280;font-weight:700}
.result-grid dd{margin:0;font-size:.92rem;font-weight:700;word-break:break-word}
.result-grid .final{grid-column:1/-1;background:#eaf2ff;border-color:#c4dafe}
.result-grid .final dd{color:#0d6efd;font-size:1.05rem}
.result-subhead{font-size:.72rem;font-weight:800;letter-spacing:.06em;color:#6b7280;margin:10px 0 4px}
.result-closer{list-style:none;margin:0;padding:0;border:1px solid #e5e9f0;border-radius:10px;overflow:hidden}
.result-closer li{display:flex;justify-content:space-between;gap:8px;padding:.42rem .7rem;border-bottom:1px solid #f0f2f6;font-size:.82rem}
.result-closer li:last-child{border-bottom:0}
.result-closer li:nth-child(odd){background:#fbfcfe}
/* Result side panel — docked to the right of the map on desktop (top margin
   keeps the Map/Satellite/SV/Fit/FS buttons fully usable; bottom margin keeps
   the zoom note + provider badge visible). Bottom sheet on small screens. */
.result-panel{
  position:absolute; z-index:960;
  top:196px; right:18px; bottom:64px;
  width:392px; max-width:calc(100% - 44px); min-width:0;
  display:flex; flex-direction:column; overflow:hidden;
  background:#fff; border:1px solid #e5e9f0; border-radius:16px;
  box-shadow:0 14px 38px rgba(16,24,40,.18);
  transform:translateX(calc(100% + 32px));
  opacity:0; pointer-events:none;
  transition:transform .25s ease, opacity .18s ease;
}
.result-panel.open{transform:translateX(0);opacity:1;pointer-events:auto}
.result-panel-head{
  display:flex;justify-content:space-between;align-items:flex-start;gap:8px;
  padding:14px 16px 10px;border-bottom:1px solid #e7eaf0;
}
.result-panel-body{flex:1;overflow-y:auto;padding:12px 16px}
.result-panel-foot{
  display:flex;justify-content:flex-end;gap:8px;
  padding:12px 16px;border-top:1px solid #e7eaf0;
}
@media(max-width:768px){
  .result-panel{
    top:auto;left:10px;right:10px;bottom:10px;
    width:auto;max-width:none;max-height:46vh;border-radius:14px;
    transform:translateY(calc(100% + 32px));
  }
  .result-panel.open{transform:translateY(0)}
}

/* Unified reference search dropdown */
.ref-search-dropdown{
  position:absolute;top:100%;left:0;right:0;margin-top:3px;z-index:2000;
  background:#fff;border:1px solid #d9dee8;border-radius:10px;
  box-shadow:0 8px 22px rgba(0,0,0,.14);overflow:hidden;
}
#mapSearchWrap{position:relative}
.ref-search-dropdown.d-none{display:none}
.ref-search-group{
  font-size:.62rem;font-weight:800;letter-spacing:.08em;color:#6b7280;
  padding:5px 10px 2px;border-bottom:1px solid #f0f2f6
}
.ref-search-item{
  display:flex;align-items:center;gap:6px;width:100%;text-align:left;
  padding:7px 10px;border:0;background:#fff;font-size:.82rem;color:#172033;
}
.ref-search-item:hover{background:#eef4ff}
.ref-search-item code{font-size:.72rem;color:#6b7280}
.ref-search-empty{padding:9px 10px;font-size:.78rem;color:#6b7280}

/* Provider badge — always visible so the user knows which map engine is live */
.map-provider-badge{background:rgba(255,255,255,.92);border:1px solid #d9dee8;box-shadow:0 2px 8px rgba(0,0,0,.08)}
.badge-google{color:#0d6efd}
.badge-fallback{color:#6b7280;border-color:#d9dee8;background:rgba(255,255,255,.94)}

/* Coordinate verification modal — fit viewport */
#coordModal .modal-dialog{max-width:min(1100px,96vw)}
#coordModal .modal-body{max-height:calc(100vh - 130px);overflow:hidden}
#coordModal .coord-map-col{height:min(62vh,540px);min-height:340px}
#coordModal .coord-side-col{max-height:calc(100vh - 130px);overflow-y:auto;padding:.9rem 1rem}
@media(max-width:768px){
  #coordModal .coord-map-col{height:46vh}
  #coordModal .modal-body{max-height:calc(100vh - 110px);overflow-y:auto}
  #coordModal .coord-side-col{max-height:none}
}
