
  body {
    background: #f6f8fb;
  }

  .dashboard-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    padding: 18px 22px;
    margin-bottom: 24px;
  }

  .section-header {
    font-size: 1rem;
    font-weight: 600;
    color: #444;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 14px;
  }
  .section-header i {
    color: #007bff;
  }

  .kpi-card {
    border: none;
    border-radius: 10px;
    text-align: center;
    padding: 18px 10px;
    color: #333;
    transition: transform .2s ease, box-shadow .2s ease;
  }

  .kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
  }

  .kpi-title {
    font-size: .85rem;
    color: #555;
    font-weight: 500;
    margin-top: 6px;
  }

  .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
  }

  /* Colori tematici per KPI */
  .kpi-blue { background: #eaf3ff; color: #0d6efd; }
  .kpi-green { background: #eafaf1; color: #198754; }
  .kpi-yellow { background: #fff7e6; color: #ff9800; }
  .kpi-purple { background: #f5e9ff; color: #7b1fa2; }
  .kpi-red { background: #ffe8e8; color: #dc3545; }
  .kpi-cyan { background: #e6f6f8; color: #17a2b8; }
  .kpi-gray { background: #f1f1f1; color: #444; }

  /* Badge periodo */
  #periodoBadge {
    font-size: .9rem;
    background: #e9f1ff;
    border-radius: 8px;
    padding: 10px 16px;
    color: #333;
  }

  .card-header {
    font-weight: 600;
    color: #333;
    background: #f9fbff;
  }

  .card {
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  }

  /* --- Filtri dashboard moderni --- */
.filter-group {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  padding: 16px 22px;
  margin-bottom: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: end;
}

.filter-group label {
  font-size: 0.85rem;
  color: #555;
  font-weight: 500;
  margin-bottom: 4px;
  display: block;
}

.filter-group select,
.filter-group input[type="date"] {
  border: 1px solid #d3dae6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.9rem;
  color: #333;
  min-width: 160px;
  transition: border-color .2s ease, box-shadow .2s ease;
}

.filter-group select:focus,
.filter-group input[type="date"]:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
  outline: none;
}

.filter-group button {
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(90deg, #007bff, #00b4d8);
  color: #fff;
  border: none;
  padding: 0 18px;
  font-weight: 600;
  letter-spacing: .3px;
  transition: filter .2s ease;
}

.filter-group button:hover {
  filter: brightness(1.1);
}


  #applyFilters {
  background: linear-gradient(90deg, #007bff, #00b4d8);
  border: none;
  font-weight: 600;
  letter-spacing: .3px;
}
#applyFilters:hover {
  filter: brightness(1.1);}
  
/* --- RIEPILOGO FILTRI --- */
.filter-summary {
  background: linear-gradient(90deg, #f3f7ff 0%, #e8f1ff 100%);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
  padding: 16px 20px;
  color: #333;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.filter-summary .summary-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
  color: #0d6efd;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.filter-summary .summary-header i {
  font-size: 1.1rem;
  color: #0d6efd;
}

.filter-summary .date {
  font-weight: 600;
  color: #222;
}

.filter-summary .summary-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.9rem;
}

.filter-summary .tag {
  background: #ffffff;
  border-radius: 20px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #333;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border: 1px solid #e3e8f0;
  transition: all .2s ease;
  font-weight: 500;
}

.filter-summary .tag i {
  color: #0d6efd;
  font-size: 0.9rem;
}

.filter-summary .tag:hover {
  background: #eaf2ff;
  border-color: #c6dcff;
}


 /* =========================
   KPI SECTION – STILE PREMIUM
========================= */
#kpiGrid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
  margin: 0 auto;
  max-width: 1400px; /* centrato e contenuto */
}

/* Card KPI */
.kpi-card {
  border: 1px solid rgba(0, 0, 0, 0.05);
  border-radius: 14px;
  background: #fff;
  text-align: center;
  padding: 22px 10px;
  color: #333;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  transition: all 0.25s ease;
  position: relative;
  cursor: default;
  width: 100%;
}

/* Animazione hover */
.kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
  border-color: rgba(13, 110, 253, 0.2);
}

/* Icona in alto */
.kpi-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
  opacity: 0.9;
  display: block;
}

/* Valore principale */
.kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-top: 4px;
}

/* Titolo KPI */
.kpi-title {
  font-size: 0.9rem;
  color: #555;
  font-weight: 500;
  margin-top: 4px;
}

/* Colori coerenti con sfondo chiaro */
.kpi-blue    { background: #f0f6ff; color: #0d6efd; }
.kpi-green   { background: #edf9f2; color: #198754; }
.kpi-yellow  { background: #fff8e6; color: #ff9800; }
.kpi-cyan    { background: #eaf9ff; color: #0dcaf0; }
.kpi-purple  { background: #f7efff; color: #6f42c1; }
.kpi-red     { background: #ffe9eb; color: #dc3545; }

/* Titoletti sezione KPI */
h6.text-muted.fw-semibold {
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(90deg, #f3f7ff, #eef4ff);
  color: #0d6efd;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  margin: 20px auto 6px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Divider sottile per distacco visivo */
.section-divider {
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, #cfd9f9, transparent);
  margin: 10px auto 20px;
  border-radius: 1px;
}

/* Tooltip sopra le card (versione elegante) */
.kpi-card[title]:hover::after {
  content: attr(title);
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  background: #222;
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  line-height: 1.2;
  white-space: nowrap;
  opacity: 1;
  pointer-events: none;
  z-index: 20;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kpi-card[title]:hover::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(180deg);
  border-width: 6px;
  border-style: solid;
  border-color: #222 transparent transparent transparent;
}


.tag-highlight {
  background: linear-gradient(90deg, #d4f4ff, #e6faff);
  color: #007bff;
  font-weight: 600;
  border: 1px solid #b8e8ff;
}


/* 🔹 Contenitore responsive per i grafici Chart.js */
.chart-container {
  position: relative;
  width: 100%;
  height: 360px; /* desktop */
}

@media (max-width: 992px) {
  .chart-container {
    height: 300px; /* tablet */
  }
}

@media (max-width: 768px) {
  .chart-container {
    height: 260px; /* smartphone verticale */
  }
}

/* 🔹 Legenda compatta */
.chartjs-legend ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  font-size: 0.8rem;
  padding: 0;
  margin: 6px 0 0;
  list-style: none;
}


/* Grafici a torta più grandi */
.card-body canvas[id^="pie_"] {
  min-height: 360px !important;  /* altezza minima più grande */
  max-height: 400px !important;  /* opzionale, per limite */
}




/* Sfondo modale leggermente opacizzato */
.modal-backdrop.show {
  background-color: rgba(33, 37, 41, 0.6);
}

/* Contenitore principale */
#modalConfronto .modal-content {
  border: none;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  background: linear-gradient(145deg, #ffffff, #f9fafc);
}

/* Header */
#modalConfronto .modal-header {
  background: linear-gradient(90deg, #0d6efd, #3a8bfd);
  color: #fff;
  border-bottom: none;
  padding: 1rem 1.25rem;
}

#modalConfronto .modal-title {
  font-weight: 600;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
}

#modalConfronto .modal-title i {
  font-size: 1.2rem;
}

/* Body */
#modalConfronto .modal-body {
  background: #f8f9fb;
  padding: 1.5rem;
}

/* Campi data */
#modalConfronto input[type="date"] {
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: all 0.2s ease;
}

#modalConfronto input[type="date"]:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 0.15rem rgba(13, 110, 253, 0.25);
}

/* Pulsanti periodo rapido */
#modalConfronto #quickPeriods button {
  border-radius: 20px;
  padding: 0.35rem 0.9rem;
  font-size: 0.85rem;
  color: #495057;
  transition: all 0.2s ease;
}

#modalConfronto #quickPeriods button:hover,
#modalConfronto #quickPeriods button.active {
  background-color: #0d6efd;
  color: white;
  box-shadow: 0 2px 6px rgba(13, 110, 253, 0.3);
}

/* Dropdown */
#modalConfronto .dropdown-toggle {
  border-radius: 20px;
  font-size: 0.85rem;
}

/* Risultati */
#compareResults .border {
  border: 1px solid #e3e6eb !important;
  border-radius: 12px !important;
  background: white;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#compareResults .border:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0,0,0,0.05);
}

/* Titoli box */
#compareResults h6 {
  font-size: 0.9rem;
  font-weight: 600;
}

/* Valori principali */
#compareResults .fw-bold.fs-5 {
  color: #0d6efd;
  font-weight: 700;
}

/* Differenze */
#compareResults #cmpPropostoDiff span,
#compareResults #cmpAccettatoDiff span,
#compareResults #cmpPPPDiff span {
  font-weight: 600;
}

/* Footer */
#modalConfronto .modal-footer {
  background: #f8f9fb;
  border-top: none;
}

/* Responsive */
@media (max-width: 768px) {
  #modalConfronto .modal-dialog {
    margin: 0.5rem;
  }

  #modalConfronto .modal-body {
    padding: 1rem;
  }

  #quickPeriods {
    flex-direction: column;
    align-items: center;
  }

  #quickPeriods button {
    margin-bottom: 0.3rem;
  }
}

/* === FIX: forza il menu "Confronta con" a restare dentro il modale === */
#modalConfronto .dropdown-menu {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  right: auto !important;
  transform: none !important;
  z-index: 1085 !important;
  margin-top: 0.25rem !important;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  animation: fadeIn 0.15s ease-in-out;
}

#modalConfronto .dropdown-menu.show {
  display: block;
}

#modalConfronto .dropdown-item {
  font-size: 0.9rem;
  padding: 0.4rem 1rem;
  transition: background-color 0.2s ease;
}

#modalConfronto .dropdown-item:hover {
  background-color: #f1f4ff;
  color: #0d6efd;
}

/* Animazione apertura */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}


