.porti-modal-bg {
  position: fixed; z-index: 9999; left:0;top:0;width:100vw;height:100vh;
  background: rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto;
  padding: 18px 10px;
  box-sizing: border-box;
}

.porti-modal {
  background: #fff; padding: 20px; border-radius: 12px; max-width:860px; width:95%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.19);
  position: relative;
  overflow: auto;
  z-index: 10000;
  max-height: calc(100vh - 36px);
  box-sizing: border-box;
  margin: 0 auto;
  transform: translate(0,0);
}

.porti-close {
  position: absolute; top:12px; right:16px; font-size:1.8em; cursor:pointer;
}
#salva-porti-btn.porti-btn {
  margin-top:16px; background:#1271d8; color:white; border:none;
  border-radius:6px; padding:8px 20px; cursor:pointer;
}
.leaflet-marker-icon.selected { filter: drop-shadow(0 0 10px #2ecc40) brightness(1.5); }
.leaflet-marker-icon.suggested { filter: drop-shadow(0 0 8px #7ec8ff) brightness(1.12); }

.porti-modal #mappa-porti,
.porti-modal #mappa-porti .leaflet-container {
  position: relative;
  z-index: 1;
}

.porti-modal #mappa-porti .leaflet-pane,
.porti-modal #mappa-porti .leaflet-control-container,
.porti-modal #mappa-porti .leaflet-top,
.porti-modal #mappa-porti .leaflet-bottom {
  z-index: 2 !important;
}

.porti-modal h3 {
  color: #133574;
}

.porti-modal-drag-handle {
  cursor: move;
  user-select: none;
  padding-right: 44px;
}

.porti-close {
  font-weight: bold;
  color: #333;
  transition: color 0.2s;
}
.porti-close:hover {
  color: #c00;
}

#apri-porti-modale {
    display: none !important;
}

.porti-btn--ghost {
  margin-top:16px; background:#eef3fb; color:#133574; border:none;
  border-radius:6px; padding:8px 20px; cursor:pointer;
}

.porti-suggest-bg {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  border-radius: 12px;
}

.porti-suggest-modal {
  width: 94%;
  max-width: 620px;
  background: #fff;
  border: 1px solid #d9e4f5;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.14);
  padding: 18px;
  position: relative;
  z-index: 5001;
  max-height: calc(100vh - 44px);
  overflow: auto;
  box-sizing: border-box;
}

.porti-suggest-close {
  position: absolute;
  top: 10px;
  right: 14px;
  font-size: 1.5em;
  font-weight: bold;
  cursor: pointer;
  color: #333;
}

.porti-suggest-close:hover {
  color: #c00;
}

.porti-suggest-modal h4 {
  margin: 0 0 8px 0;
  color: #133574;
}

.porti-suggest-note {
  margin: 0 0 14px 0;
  color: #3f4d63;
  font-size: 0.95em;
}

.porti-suggest-radius-wrap {
  margin-bottom: 14px;
}

.porti-suggest-radius-wrap label,
.porti-suggest-radius-wrap strong,
#porti-suggest-radius-value {
  color: #133574;
}

.porti-suggest-radius-wrap input[type="range"] {
  width: 100%;
  margin-top: 8px;
}

.porti-suggest-list {
  max-height: min(240px, 34vh);
  overflow: auto;
  border: 1px solid #e6edf8;
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafcff;
}

.porti-suggest-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px solid #edf2fa;
}

.porti-suggest-row:last-child {
  border-bottom: none;
}

.porti-suggest-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.porti-suggest-name {
  font-weight: 600;
  color: #20324d;
}

.porti-suggest-distance {
  white-space: nowrap;
  font-size: 0.92em;
  color: #537099;
}

.porti-suggest-empty {
  color: #58708f;
  font-style: italic;
  padding: 8px 2px;
}

.porti-suggest-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px 16px;
  align-items: stretch;
  margin-top: 16px;
  padding-bottom: 4px;
}

.porti-suggest-actions .porti-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 0;
  box-sizing: border-box;
}

#segnala-porto-btn-suggest {
  grid-column: 1;
  grid-row: 1;
}

#porti-suggest-reject {
  grid-column: 2;
  grid-row: 1;
}

#porti-suggest-accept {
  grid-column: 2;
  grid-row: 2;
}

.porti-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.porti-report-inline {
  border: 1px solid #d9e4f5;
  border-radius: 12px;
  background: #f7fbff;
  padding: 14px 16px;
  box-sizing: border-box;
}

.porti-report-head {
  margin: 0 0 12px 0;
}

.porti-report-head h4 {
  margin: 0 0 8px 0;
  color: #133574;
}

.porti-report-note {
  margin: 0 0 12px 0;
  color: #3f4d63;
  font-size: 0.95em;
  line-height: 1.45;
}

.porti-report-head-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.porti-report-panel {
  margin: 14px 0 0 0;
}

.porti-modal.is-report-mode #mappa-porti {
  border: 2px solid #9cc5ff;
  border-radius: 12px;
  overflow: hidden;
}

.porti-modal.is-report-mode .leaflet-container {
  cursor: crosshair;
}

.porti-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.porti-report-field {
  margin-bottom: 12px;
}

.porti-report-field label {
  display: block;
  margin-bottom: 6px;
  color: #133574;
  font-weight: 600;
}

.porti-report-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.98em;
  color: #20324d;
  background: #fff;
  box-sizing: border-box;
}

.porti-report-status {
  min-height: 20px;
  margin-top: 4px;
  color: #58708f;
  font-size: 0.93em;
}

.porti-report-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 16px;
}

.porti-report-success {
  margin-top: 10px;
  padding: 14px 16px;
  border: 1px solid #d9e4f5;
  border-radius: 10px;
  background: #f7fbff;
  color: #133574;
}

.porti-report-success p {
  margin: 0;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .porti-modal {
    width: 100%;
    max-width: none;
    border-radius: 10px;
  }
  .porti-report-grid {
    grid-template-columns: 1fr;
  }
  .porti-report-head-actions,
  .porti-report-actions {
    justify-content: stretch;
  }
  .porti-report-head-actions .porti-btn,
  .porti-report-actions .porti-btn {
    width: 100%;
  }

  .porti-suggest-actions {
    grid-template-columns: 1fr;
  }

  #segnala-porto-btn-suggest,
  #porti-suggest-reject,
  #porti-suggest-accept {
    grid-column: 1;
    grid-row: auto;
  }
}

.porti-search-box {
    margin: 10px 0 12px;
    position: relative;
}

.porti-search-box label {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

#porti-search-input {
    width: 100%;
    box-sizing: border-box;
    padding: 9px 10px;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
}

.porti-search-results {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    z-index: 9999;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 6px;
    box-shadow: 0 8px 22px rgba(0, 0, 0, 0.14);
    overflow: hidden;
}

.porti-search-result {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 10px;
    border: 0;
    border-bottom: 1px solid #edf0f2;
    background: #fff;
    text-align: left;
    cursor: pointer;
}

.porti-search-result:hover,
.porti-search-result:focus {
    background: #f6f7f7;
    outline: none;
}

.porti-search-result:last-child {
    border-bottom: 0;
}

.porti-search-result-name {
    font-weight: 600;
}

.porti-search-result-meta {
    font-size: 12px;
    opacity: 0.75;
}

.porti-search-empty {
    padding: 8px 10px;
    font-size: 13px;
    opacity: 0.75;
}

