.cap-insight-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(8, 14, 27, 0.62);
  z-index: 2410;
}

.cap-insight-popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: fit-content;
  min-width: 420px;
  max-width: 92vw;
  max-height: 88vh;
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid #cfd8e3;
  box-shadow: 0 24px 52px rgba(15, 23, 42, 0.34);
  padding: 18px 20px 20px;
  z-index: 2411;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cap-insight-chart svg {
  width: auto;
  height: auto;
  max-width: 90vw;
  max-height: 60vh;
  display: block;
}

.cap-insight-chart svg text {
  font-size: 100% !important;
}

.cap-insight-title {
  font-weight: 800;
  font-size: 16px;
  color: #0f172a;
  border-bottom: 1px solid #e2e8f0;
  padding-bottom: 8px;
}

.cap-insight-chart {
  min-height: 220px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
}

.cap-insight-note {
  font-size: 13px;
  color: #475569;
  line-height: 1.4;
}

.cap-insight-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 30px;
  height: 30px;
  border: 1px solid #cfd8e3;
  background: #ffffff;
  border-radius: 8px;
  padding: 0;
  color: #0f172a;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cap-insight-close:hover {
  border-color: var(--interactive);
  background: var(--interactive-light);
}

.cap-insight-tooltip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  max-width: 420px;
}

.cap-insight-tooltip-title {
  font-weight: 800;
  font-size: 13px;
  color: #0f172a;
}

.cap-insight-tooltip .cap-insight-chart {
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
  padding: 6px;
  overflow: visible;
}

.cap-insight-tooltip .cap-insight-chart svg {
  width: 320px;
  max-width: 360px;
  height: auto;
  display: block;
  overflow: visible;
}

.cap-insight-tooltip .cap-insight-chart svg text {
  font-size: 100% !important;
}

.cap-insight-tooltip .cap-insight-note {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.35;
}

.tippy-box[data-theme~='enterprise-chart'],
.tippy-box[data-theme~='enterprise-popover'] {
  background: #ffffff;
  color: #0f172a;
  border: 1px solid #cfd8e3;
  border-radius: 10px;
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.24);
  font-size: 13px;
}

.tippy-box[data-theme~='enterprise-chart'] > .tippy-arrow::before,
.tippy-box[data-theme~='enterprise-popover'] > .tippy-arrow::before {
  color: #ffffff;
}

.tippy-box[data-theme~='enterprise-chart'] .tippy-content,
.tippy-box[data-theme~='enterprise-popover'] .tippy-content {
  padding: 10px 12px;
}

.tippy-box[data-theme~='cap-stability'] .tippy-content {
  font-size: 78%;
}

.omi-istat-row,
.cap-istat-row {
  margin-top: 6px;
  font-size: 13px;
  color: var(--text-muted);
}

.omi-istat-row input,
.cap-istat-row input {
  margin-right: 6px;
}

.cap-quadrant-tooltip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px;
  min-width: 220px;
}

.cap-quadrant-tooltip-title {
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}

.cap-quadrant-tooltip-sub {
  font-size: 12px;
  color: var(--text-muted);
}

.cap-quadrant-tooltip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  color: #0f172a;
}

.cap-quadrant-value {
  font-weight: 600;
}

.cap-quadrant-yoy {
  font-weight: 400;
  font-size: 12px;
  color: #475569;
}

.group-count-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  margin-top: 6px;
}

.group-count-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.group-count-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: #ffffff;
  cursor: pointer;
  font-weight: 700;
  line-height: 1;
}

.group-count-trash-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='3,6 21,6'/><line x1='8' y1='6' x2='8' y2='4'/><line x1='16' y1='6' x2='16' y2='4'/><rect x='6' y='6' width='12' height='14' rx='2'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  cursor: pointer;
  padding: 0;
}

.group-count-trash-btn:hover {
  background-color: var(--surface-alt);
}

.surface-group {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #eef1f4;
  padding: 6px;
  margin-top: 8px;
}

.surface-groups-scroll {
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #ffffff;
  margin-top: 6px;
  scrollbar-gutter: stable;
}

.surface-group-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.surface-group-header input[type="radio"] {
  accent-color: var(--interactive);
}

.surface-group-number {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
}

.surface-group-name {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 13px;
}

.surface-group-center-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7-11-7-11-7z'/><circle cx='12' cy='12' r='3' fill='%23475569' stroke='none'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  cursor: pointer;
  padding: 0;
}

.surface-group-delete-btn {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--border-strong);
  background-color: var(--surface);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='3,6 21,6'/><line x1='8' y1='6' x2='8' y2='4'/><line x1='16' y1='6' x2='16' y2='4'/><rect x='6' y='6' width='12' height='14' rx='2'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  cursor: pointer;
  padding: 0;
}

.surface-group-delete-btn:hover {
  background-color: var(--surface-alt);
}

.surface-group-sep {
  height: 1px;
  background: #e5e7eb;
  margin: 8px 0;
}

.surface-groups-table-wrap {
  margin-top: 8px;
  overflow-x: auto;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-gutter: stable;
}

.surface-groups-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.surface-groups-table th,
.surface-groups-table td {
  border: 1px solid #e5e7eb;
  padding: 4px 6px;
  text-align: left;
}

.surface-groups-table tfoot td {
  font-weight: 600;
}

.coords-gps-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 13px;
}

.coords-gps-row .value {
  font-weight: 600;
}

.views-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.view-block {
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  padding: 6px 8px;
  font-size: 13px;
  background: #f9fafb;
}

.view-block h3 {
  margin: 0 0 4px 0;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
}

.view-block .zoom-row {
  margin-top: 2px;
}

.view-block select {
  width: 100%;
  margin-top: 2px;
}

.view-block .disabled {
  opacity: 0.4;
}

#resultLog {
  margin-top: 8px;
  font-size: 13px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
  padding: 8px;
  max-height: 260px;
  overflow-y: auto;
}

#resultLog h3 {
  margin-top: 6px;
  margin-bottom: 4px;
  font-size: 14px;
}

#resultLog p,
#resultLog ul {
  margin: 0 0 4px 0;
  padding-left: 16px;
}

#resultLog ul {
  padding-left: 16px;
}

#resultLog li {
  margin-bottom: 2px;
}

.progress-container {
  margin-top: 8px;
  font-size: 13px;
}

.progress-bar-outer {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.progress-bar-inner {
  width: 0;
  height: 100%;
  background: var(--interactive);
  transition: width 0.3s ease;
  position: relative;
  overflow: hidden;
}

.progress-bar-inner.is-active {
  background-color: var(--interactive);
}

.progress-bar-inner.is-indeterminate {
  width: 45%;
  transition: none;
  background: var(--interactive);
  animation: progress-indeterminate 1.1s ease-in-out infinite;
}

.progress-bar-inner.is-active::after {
  content: "";
  position: absolute;
  top: 0;
  left: -50%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.55),
    transparent
  );
  animation: progress-sheen 1.1s linear infinite;
}

@keyframes progress-sheen {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(300%);
  }
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(230%);
  }
}

.copy-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.copy-hint.success {
  color: #16a34a;
}

.catasto-row-label {
  font-size: 13px;
  margin-bottom: 2px;
}

.catasto-row-label .value {
  font-weight: bold;
}

.catasto-streetview-actions {
  align-items: center;
  margin-top: 8px;
}

.catasto-streetview-actions .btn {
  min-width: 120px;
  padding-left: 10px;
  padding-right: 10px;
}

#btnPeriziePerimetroRestore {
  min-width: 86px;
  padding-left: 8px;
  padding-right: 8px;
}

#surfaceGroupNavWindow.perizie-minimal .perizie-layout-right {
  display: none;
}

#surfaceGroupNavWindow.perizie-minimal .perizie-layout-left > * {
  display: none;
}

#surfaceGroupNavWindow.perizie-minimal
  .perizie-layout-left
  .perizie-perimetro-block {
  display: block;
  margin-top: 0;
}

#surfaceGroupNavWindow.perizie-minimal
  .perizie-perimetro-block
  .nav-window-label,
#surfaceGroupNavWindow.perizie-minimal
  .perizie-perimetro-block
  .streetview-hint {
  display: none;
}

#surfaceGroupNavWindow.perizie-minimal #btnPeriziePerimetroSave {
  display: none;
}

.streetview-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.streetview-hint.error {
  color: #b91c1c;
}

.catasto-details-section {
  display: none;
}

.catasto-tooltip {
  font-size: 13px;
  color: var(--text-main);
}

.catasto-tooltip h3 {
  margin: 0 0 6px;
  font-size: 14px;
  font-weight: 600;
}

.catasto-tooltip .catasto-message {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

#catMessage {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.inspire-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.inspire-header-label {
  font-weight: 600;
  font-size: 14px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}

.toggle-switch input {
  display: none;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--border-strong);
  border: none;
  box-sizing: border-box;
  border-radius: var(--radius-full);
  overflow: hidden;
  transition: background 0.2s ease;
}

.toggle-slider:before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 2px;
  top: 2px;
  background: var(--surface);
  border-radius: var(--radius-full);
  transition: transform 0.2s ease;
  box-shadow: var(--shadow-xs);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--interactive);
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

.inspire-layers {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.layer-item {
  padding: 6px 8px;
  background: #f9fafb;
  border-radius: 6px;
  border: 1px solid #e5e7eb;
}

.layer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  margin-bottom: 4px;
}

.layer-header label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
}

.layer-slider {
  width: 100%;
}

/* --- Controllo marker catasto (stile Mapbox controls) --- */
