body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Segoe UI", Roboto, sans-serif;
}

#sidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: 300px;
  height: 100%;
  background-color: #ffffff;
  border-right: 2px solid #fb8c00;  
  padding: 20px;
  box-sizing: border-box;
  z-index: 1000;
  overflow-y: auto;
  box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

#sidebar h2 {
  font-size: 18px;
  margin-top: 0;
}

#field-select {
  width: 100%;
  padding: 6px;
  font-size: 14px;
  margin-bottom: 20px;
}

#legend {
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding-top: 1rem;
  margin-top: 1rem;
}


#legend h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

#range-values {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: #333;
}
.dashboard-container {
display: flex;
flex-wrap: wrap;
gap: 2rem;
padding: 1rem;
}

.ambito-section {
background-color: #f9f9f9;
padding: 1rem;
border: 1px solid #ccc;
border-radius: 12px;
flex: 1 1 300px;
max-width: 350px;
}

.ambito-btn {
width: 100%;
background-color: #b00;
color: white;
border: none;
padding: 0.5rem;
font-weight: bold;
font-size: 1rem;
margin-bottom: 0.5rem;
border-radius: 8px;
cursor: pointer;
}

.checkbox-label {
display: block;
margin: 0.25rem 0;
cursor: pointer;
}
/* Aggiungi queste regole alle esistenti */

#ambito-buttons {
display: flex;
flex-direction: column;
gap: 10px;
margin-bottom: 20px;
}

.ambito-button:hover {
background-color: #e0e0e0;
}

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

.field-wrapper input {
margin: 0;
}

/* Stile per la legenda multi-strato */
#gradient-bar {
  height: 20px;
  background: linear-gradient(to right,
    rgba(34, 197, 94, 0.2),
    rgba(34, 197, 94, 0.8)
  );
  border: 1px solid #ccc;
  margin-bottom: 5px;
}

.leaflet-popup-content {
min-width: 300px;
max-width: 500px;
max-height: 70vh;
overflow-y: auto;
}

.leaflet-popup-content canvas {
display: block !important;
width: 100% !important;
height: auto !important;
}

.leaflet-popup-content strong {
font-size: 16px;
display: block;
margin-bottom: 8px;
border-bottom: 1px solid #eee;
padding-bottom: 4px;
}

/* Aggiungi queste regole */

.chart-container-actual {
  margin-top: 15px;
  position: relative;
  min-height: 250px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 0 4px rgba(0,0,0,0.1);
}

.dettaglio-btn {
  display: block;
  width: 100%;
  background-color: #b00;
  color: white;
  border: none;
  padding: 10px;
  margin-bottom: 10px;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
}

.leaflet-popup-content-wrapper {
max-height: 80vh;
overflow-y: auto;
}

/* Stile per lo switcher */
#grouping-control {
margin-bottom: 20px;
display: flex;
align-items: center;
gap: 10px;
}

.switch {
position: relative;
display: inline-block;
width: 50px;
height: 24px;
}

.switch input {
opacity: 0;
width: 0;
height: 0;
}

.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
transition: .4s;
border-radius: 24px;
}

.slider:before {
position: absolute;
content: "";
height: 16px;
width: 16px;
left: 4px;
bottom: 4px;
background-color: white;
transition: .4s;
border-radius: 50%;
}

input:checked + .slider {
background-color: #b00;
}

input:checked + .slider:before {
transform: translateX(26px);
}

body.dettaglio #map {
  position: relative !important;
  height: 300px;
  width: 100%;
}

body.dettaglio,
html {
  height: 100%;
  margin: 0;
  padding: 0;
}

.main-content {
  display: flex;
  flex-direction: column;
  margin-left: 300px;
  height: 100vh;
  overflow: hidden;
}

#chart-canvas {
  flex: 1;
  padding: 20px;
  background: #fff;
  box-sizing: border-box;
  overflow-y: auto;
}

#chart-canvas canvas {
  width: 100% !important;
  height: 100% !important;
}

#mapped-sites-list {
  margin-top: 1rem;
  font-family: sans-serif;
}

#mapped-sites-list h4 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

#mapped-sites-ul {
  list-style: none;
  padding-left: 0;
}

#mapped-sites-ul li {
  margin-bottom: 0.3rem;
}

.mapped-site-button {
  background: none;
  border: none;
  color: #007bff;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-size: 0.9rem;
}

.mapped-site-button:hover {
  text-decoration: underline;
}

/* Header della dashboard */
.dashboard-header {
  text-align: center;
  padding: 1rem 0;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid #e1e5eb;
}

.dashboard-logo {
  max-width: 80%;
  height: auto;
  margin-bottom: 1rem;
  border: 2px solid #22c55e;
  border-radius: 12px;       /* opzionale: angoli arrotondati */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* opzionale: leggero effetto ombra */
}

/* Stili per i bottoni degli ambiti */
.ambito-button {
  padding: 12px 15px;
  background-color: #f8f9fa;
  border: 2px solid #3498db;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
  font-weight: 600;
  transition: all 0.3s ease;
  width: 100%;
  color: #2c3e50;
  margin-bottom: 8px;
}

.ambito-button:hover {
  background-color: #e3f2fd;
  border-color: #2980b9;
}

.ambito-description {
  font-size: 0.9em;
  color: #555;
  margin: 8px 0;
  padding: 8px 12px;
  background-color: #f8f9fa;
  border-left-color: #fb8c00;
  border-radius: 0 4px 4px 0;
}

.fields-container {
  display: none;
  grid-template-columns: 1fr 1fr; 
  gap: 8px;
  margin-top: 8px;
  padding-left: 15px;
}

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

.field-label {
  font-size: 0.9rem;
  color: #34495e;
  cursor: pointer;
  transition: color 0.2s;
}

.field-label:hover {
  color: #2980b9;
}

/* Stile per le necropoli mappate */
#mapped-sites-container {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #e1e5eb;
}

#mapped-sites-container h3 {
  color: #2c3e50;
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.region-accordion {
  margin-bottom: 0.5rem;
}

.region-header {
  width: 100%;
  padding: 8px 12px;
  background-color: #f8f9fa;
  border: 1px solid #ddd;
  border-radius: 4px;
  text-align: left;
  font-weight: 600;
  color: #2c3e50;
  cursor: pointer;
  transition: all 0.2s;
}

.region-header:hover {
  background-color: #e9ecef;
}

.region-list {
  list-style: none;
  padding-left: 1rem;
  margin-top: 0.5rem;
}

.mapped-site-button {
  background: none;
  border: none;
  color: #3498db;
  cursor: pointer;
  text-align: left;
  padding: 4px 0;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.mapped-site-button:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* Footer della dashboard */
.dashboard-footer {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid #e1e5eb;
  font-size: 0.85rem;
}

.dashboard-footer h4 {
  color: #2c3e50;
  font-size: 1rem;
  margin-bottom: 0.75rem;
}

.sources-list {
  list-style-type: none;
  padding-left: 0;
  margin-bottom: 1.5rem;
}

.source-item {
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.source-item a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.2s;
}

.source-item a:hover {
  color: #2980b9;
  text-decoration: underline;
}

.source-description {
  color: #7f8c8d;
  font-style: italic;
}

.credits {
  margin-top: 1.5rem;
}

/* Pannello crediti con sfondo richiesto */
.credits--panel {
  background: #5D4E6D;
  color: #f4f4f4;
  border-radius: 12px;
  padding: 1rem;
}

/* Titolo dentro al pannello: chiaro */
.credits--panel h4 {
  color: #fff;
}

/* Testo e link nel pannello */
.credits--panel a {
  color: #c6f6d5; /* verde chiaro leggibile */
  text-decoration: underline;
}

/* Logo Sapienza nel pannello crediti */
.credits-sapienza {
  max-width: 180px;
  height: auto;
  display: block;
  margin: .25rem 0 1rem 0;
}

.author-info {
  text-align: center;
}

.author-logo {
  max-width: 120px;
  height: auto;
  margin: 0.5rem 0;
}

.contact-info {
  margin-top: 0.5rem;
}

.contact-info a {
  color: #3498db;
  text-decoration: none;
  transition: color 0.2s;
}

.contact-info a:hover {
  color: #2980b9;
  text-decoration: underline;
}

/* Stile per la mappa centrale */
#map {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 300px;
  z-index: 1;
}

/* Logo centrale */
.map-logo-container {
  position: absolute;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  text-align: center;
  background-color: rgba(255, 250, 250, 0.932);
  padding: 1px 1px;
  border-radius: 100px;
  border: 2px solid #0c92eb;
  max-width: 120px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

#map-logo-link {
  display: block;
}

.map-logo {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
}

#map-logo-toggle {
  position: absolute;
  top: -16px; /* o 4px se vuoi dentro */
  right: 50%;
  transform: translateX(50%);
  background: #22c55e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(132, 166, 229, 0.849);
  z-index: 1001;
  transition: background 0.3s ease;
}

#map-logo-toggle:hover {
  background: #16a34a; 
}

/* Stato nascosto */
#map-logo-wrapper.hidden {
  opacity: 0;
  transform: translate(-50%, -20px);
  pointer-events: none;
}

/* Pulsante per ripristino*/

#map-logo-restore {
  position: absolute;
  top: 20px;
  right: 20px;
  background: #3a0ca3;
  color: white;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  display: none;
  z-index: 1000;
}

#map-logo-restore.visible {
  display: block;
}

/* Tutorial Styles */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9998;
  transition: opacity 0.3s;
}

.tutorial-highlight {
  position: fixed;
  background-color: rgba(255, 255, 255, 0.3);
  border: 2px solid #3498db;
  border-radius: 8px;
  z-index: 9999;
  transition: all 0.3s;
  pointer-events: none;
  opacity: 0;
}

.tutorial-highlight::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background-color: #3498db;
  transform: rotate(45deg);
  z-index: 10000;
}

.tutorial-highlight.arrow-right::after {
  top: 50%;
  right: -10px;
  margin-top: -10px;
}

.tutorial-highlight.arrow-left::after {
  top: 50%;
  left: -10px;
  margin-top: -10px;
}

.tutorial-highlight.arrow-top::after {
  top: -10px;
  left: 50%;
  margin-left: -10px;
}

.tutorial-highlight.arrow-bottom::after {
  bottom: -10px;
  left: 50%;
  margin-left: -10px;
}

.tutorial-box {
  position: fixed;
  background-color: white;
  border-radius: 12px;
  padding: 25px;
  max-width: 400px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  z-index: 10000;
  transition: opacity 0.3s;
}

.tutorial-title {
  color: #2c3e50;
  font-size: 1.4rem;
  margin-top: 0;
  margin-bottom: 15px;
  font-family: 'Playfair Display', serif;
}

.tutorial-content {
  color: #34495e;
  margin-bottom: 20px;
  line-height: 1.5;
}

.tutorial-image {
  max-width: 100%;
  height: auto;
  margin-bottom: 20px;
  border-radius: 8px;
  display: none;
}

.tutorial-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tutorial-button {
  padding: 8px 15px;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.tutorial-prev {
  background-color: #f8f9fa;
  color: #7f8c8d;
}

.tutorial-prev:hover {
  background-color: #e9ecef;
}

.tutorial-next {
  background-color: #3498db;
  color: white;
}

.tutorial-next:hover {
  background-color: #2980b9;
}

.tutorial-close {
  background-color: #e74c3c;
  color: white;
  margin-left: auto;
}

.tutorial-close:hover {
  background-color: #c0392b;
}

/* Tutorial highlight in green */
.tutorial-highlight {
  border: 2px solid #22c55e;            /* verde */
}
.tutorial-highlight::after {
  background-color: #22c55e;            /* verde */
}


.region-accordion,
.province-accordion {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 6px 8px;
  margin-bottom: 8px;
  background: #fafafa;
}

.region-row,
.province-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.caret {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: #eef2f7;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 0.15s ease;
}
.caret.open {
  transform: rotate(90deg);
}

.region-title,
.province-title {
  flex: 1;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 6px 4px;
}

.province-sites {
  list-style: none;
  padding-left: 36px; /* rientro sotto la caret */
  margin: 8px 0 0 0;
  display: block;
}

.province-sites li {
  margin: 2px 0;
}

.mapped-site-button {
  width: 100%;
  text-align: left;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
}
.mapped-site-button:hover {
  background: #f5f7fb;
}

/* ====== Sites Graph (toggle + card) ====== */
.sites-mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .25rem .25rem .5rem .25rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: .5rem;
}

.sites-title {
  margin: 0;
  font-size: 1.05rem;
  color: #2c3e50;
}

.mode-label {
  font-size: .85rem;
  color: #606f7b;
}

.mode-switch {
  position: relative;
  width: 46px;
  height: 24px;
  display: inline-block;
}
.mode-switch input {
  appearance: none;
  width: 100%; height: 100%;
  border-radius: 999px;
  background: #e5e7eb;
  outline: none;
  cursor: pointer;
  transition: background .15s;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.mode-switch input::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .15s;
}
.mode-switch input:checked {
  background: #3b82f6;
}
.mode-switch input:checked::after {
  transform: translateX(22px);
}

#sites-graph-container {
  display: none; /* appare quando il toggle è ON */
}

.sites-graph-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: .5rem .75rem .75rem;
  box-shadow: 0 4px 10px rgba(0,0,0,.06);
}

.graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .25rem;
}
.graph-title {
  font-weight: 600;
  color: #2c3e50;
  font-size: .95rem;
}
.graph-back {
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 8px;
  padding: 4px 8px;
  cursor: pointer;
  color: #334155;
}
.graph-back:hover { background: #eef2f7; }

.graph-canvas-wrap {
  position: relative;
  height: 280px; /* altezza grafico */
}

.graph-caption {
  font-size: .85rem;
  color: #6b7280;
  margin-top: .5rem;
}

.sites-table-wrapper {
  margin-top: .5rem;
}

.sites-table-title {
  font-size: .92rem;
  color: #2c3e50;
  margin-bottom: .25rem;
}

.sites-table-scroll {
  max-height: 240px;              /* scroll verticale compatto */
  overflow: auto;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #fff;
}

.sites-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

.sites-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
  font-weight: 700;
  color: #374151;
  z-index: 1;
}

.sites-table tbody td {
  border-bottom: 1px solid #f1f5f9;
  padding: 8px 10px;
  color: #374151;
}

.sites-table tbody tr:nth-child(even) td {
  background: #fbfdff;
}

.sites-table a {
  color: #2563eb;
  text-decoration: none;
}
.sites-table a:hover {
  text-decoration: underline;
}

.sites-table td.empty {
  text-align: center;
  color: #6b7280;
  padding: 16px;
}

.graph-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.graph-link {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #334155;
  text-decoration: none;
  font-size: .85rem;
}
.graph-link:hover { background: #eef2f7; }

.graph-link--active {
  background: #22c55e !important;
  color: #fff !important;
  border-color: #16a34a !important;
}

/* --- stile card download --- */
#download-entry.download-entry-card {
  margin: 1rem 0 1.25rem 0;
  padding: 0.9rem 0.9rem 1rem;
  border: 1px solid #e7e7e7;
  border-radius: 14px;
  background: #fafafa;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-column-gap: 10px;
  align-items: start;
}
#download-entry .download-icon { margin-top: 2px; opacity: .85; }
#download-entry .download-text h3 { margin: 0 0 .25rem 0; font-size: 1rem; }
#download-entry .download-text p { margin: 0 0 .6rem 0; font-size: .9rem; color: #555; }
#download-entry .download-entry-btn {
  grid-column: 1 / -1;
  margin-top: .5rem;
  border: 0;
  padding: .55rem .8rem;
  border-radius: 10px;
  background: #0b7dda;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}
#download-entry .download-entry-btn:hover { filter: brightness(0.95); }

.graph-link--disabled {
  background: #fca5a5;   /* rosso chiaro */
  color: #7f1d1d;
  border-color: #ef4444;
  pointer-events: none;   /* non cliccabile */
  opacity: .9;
}

/* Card ambito senza bordi colorati */
.ambito-container {
  border: 0;
  border-radius: 12px;
  padding: 8px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0,0,0,.06);
}

/* Pulsante intestazione neutro */
.ambito-button {
  padding: 10px 12px;
  width: 100%;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  color: #1f2937;
  font-weight: 700;
  letter-spacing: .2px;
}
.ambito-button:hover {
  background: #ffffff;
  border-color: #d1d5db;
}

/* Testo descrizione (niente bordo arancione) */
.ambito-description {
  display: none;
  margin: 10px 0;
  padding: 8px 10px;
  background: #f9fafb;
  border-left: 0;
  border-radius: 6px;
  color: #374151;
}

/* Collassabile: CHIUSO di default */
.fields-container {
  display: none;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 8px;
  padding-left: 2px;
}

/* Collassabile: APERTO quando .ambito-container ha .open */
.ambito-container.open .ambito-description { display: block; }
.ambito-container.open .fields-container { display: grid; }

/* (Switch “levetta” rimangono come prima) */
.fancy-toggle { display: flex; align-items: center; }
.toggle-input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none;
  padding: 8px 10px; border: 1px solid #e5e7eb; border-radius: 12px; background: #ffffff;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease; width: 100%;
}
.toggle-label:hover { background: #f8fafc; border-color: #d1d5db; }
.toggle-slider { position: relative; width: 46px; height: 26px; border-radius: 999px; background: #e5e7eb;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); transition: background .15s ease; flex: 0 0 46px; }
.toggle-slider::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s ease; }
.fancy-toggle .toggle-input:checked + .toggle-label .toggle-slider { background: #22c55e; }
.fancy-toggle .toggle-input:checked + .toggle-label .toggle-slider::after { transform: translateX(20px); }
.toggle-text { color: #374151; font-size: .95rem; }
.fancy-toggle .toggle-input:focus + .toggle-label { box-shadow: 0 0 0 3px rgba(34,197,94,.25); border-color: #22c55e; }

.toggle-text {
  color: #374151;
  font-size: .95rem;
}

/* Focus accessibile per tastiera */
.fancy-toggle .toggle-input:focus + .toggle-label {
  box-shadow: 0 0 0 3px rgba(34,197,94,.25);
  border-color: #22c55e;
}

/* comprimiamo un po' la lista */
.field-wrapper + .field-wrapper .toggle-label {
  margin-top: 2px;
}

.see-all-records-btn {
  display: block;
  width: 100%;
  margin: 0.5rem 0 1rem;
  padding: .6rem .8rem;
  border: 0;
  border-radius: 10px;

  background: #2563eb;      /* blu coerente con gli switch analitici */
  color: #fff;
  font-size: .9rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  box-shadow: 0 2px 4px rgb(0 0 0 / .15);
}

.see-all-records-btn:hover {
  background: #1e40af;
}

.chart-caption {
  font-size: 12px;
  line-height: 1.4;
  color: #6b7280;           /* grigio neutro leggibile */
  font-style: italic;
  margin-bottom: 6px;
}

/* =========================
   Premium Sites Graph look
   ========================= */
.sites-graph-card--dark{
  background:
    radial-gradient(circle at 25% 18%, rgba(56,189,248,0.22), transparent 38%),
    radial-gradient(circle at 82% 28%, rgba(168,85,247,0.20), transparent 45%),
    linear-gradient(180deg, #0b1220 0%, #111a33 55%, #0b1220 100%);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e5e7eb;
}

.sites-graph-card--dark .graph-title{ color:#f8fafc; }
.sites-graph-card--dark .graph-caption{ color: rgba(255,255,255,0.72); }
.sites-graph-card--dark .graph-back{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.16);
  color:#e5e7eb;
}
.sites-graph-card--dark .graph-back:hover{ background: rgba(255,255,255,0.12); }

.graph-canvas-wrap--dark{
  position: relative;
  border-radius: 16px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
}

.graph-center-label{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  text-align:center;
  transform: translateY(-2px);
}

.graph-center-label .kpi{
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: .2px;
  color:#ffffff;
  text-shadow: 0 6px 18px rgba(0,0,0,0.35);
}
.graph-center-label .sub{
  font-size: .85rem;
  margin-top: .15rem;
  color: rgba(255,255,255,0.72);
}

/* link azioni in dark card */
.sites-graph-card--dark .graph-link{
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.86);
}
.sites-graph-card--dark .graph-link:hover{
  background: rgba(255,255,255,0.12);
}

/* =========================
   Nicer sites accordion list
   ========================= */
.region-title, .province-title{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.acc-label{
  display:inline-block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  padding-right: 6px;
}

.count-badge{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width: 34px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 800;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #e0e7ff;
  flex: 0 0 auto;
}

.count-badge--prov{
  background:#ecfeff;
  color:#155e75;
  border-color:#cffafe;
}

.mapped-site-button--rich{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}

.site-name{
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.site-chip{
  flex: 0 0 auto;
  font-size: .74rem;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #334155;
}

/* =========================
   Hide Download entry (not removed)
   ========================= */
.download-entry-card.is-hidden{
  display: none !important;
}

/* box unico */
.sites-panel{
  margin-top: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,.06);
  background: #fff;
}
.sites-panel-head{
  padding: .75rem .75rem .6rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.sites-panel-title{
  font-weight: 800;
  color: #111827;
  letter-spacing: .2px;
}
.sites-panel-controls{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}
.see-all-records-btn--inline{
  margin: 0;
  width: auto;
  padding: .5rem .75rem;
}

/* tilt “trasversale” SAFE (scale lineare): solo sul canvas, non sulla label */
.sites-graph-card--dark canvas{
  transform: scaleY(0.88);
  transform-origin: center;
}

/* ===== Sites panel (dark, integrated header) ===== */
.sites-panel{
  margin-top: 1rem;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 20px rgba(0,0,0,.10);
}

.sites-panel--dark{
  background:
    radial-gradient(circle at 25% 18%, rgba(56,189,248,0.22), transparent 38%),
    radial-gradient(circle at 82% 28%, rgba(168,85,247,0.20), transparent 45%),
    linear-gradient(180deg, #0b1220 0%, #111a33 55%, #0b1220 100%);
  border: 1px solid rgba(255,255,255,0.12);
  color: #e5e7eb;
}

.sites-panel-head{
  padding: .85rem .85rem .7rem;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  display: flex;
  flex-direction: column;
  gap: .55rem;
}

.sites-panel-title{
  font-weight: 900;
  letter-spacing: .2px;
  color: #f8fafc;
}

.sites-panel-controls{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: .75rem;
  flex-wrap: wrap;
}

.sites-panel--dark .mode-label{
  color: rgba(255,255,255,0.78);
  font-size: .85rem;
}

/* Switch dark */
.mode-switch--dark input{
  background: rgba(255,255,255,0.18);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}
.mode-switch--dark input::after{
  background: #fff;
}
.mode-switch--dark input:checked{
  background: rgba(34,197,94,0.95);
}

/* See all button dark */
.see-all-records-btn--inline{
  margin: 0;
  width: auto;
  padding: .5rem .75rem;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0,0,0,.18);
}
.see-all-records-btn--dark{
  background: rgba(59,130,246,0.95);
}
.see-all-records-btn--dark:hover{
  filter: brightness(.95);
}

.sites-panel-body{
  padding: .75rem .85rem .9rem;
}

.graph-actions--top{
  margin-bottom: .5rem;
}

/* Canvas wrap dark + tilt “trasversale” SAFE */
.graph-canvas-wrap--dark{
  position: relative;
  height: 300px;
  border-radius: 16px;
  padding: 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
}

/* tilt solo sul canvas (lineare -> click ok) */
.graph-canvas-wrap--dark canvas{
  transform: scaleY(0.88);
  transform-origin: center;
}

/* center label (non tiltato) */
.graph-center-label{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  pointer-events:none;
  text-align:center;
  transform: translateY(-2px);
}

.graph-center-label .kpi{
  font-size: 1.45rem;
  font-weight: 900;
  color:#ffffff;
  text-shadow: 0 10px 22px rgba(0,0,0,0.45);
}
.graph-center-label .sub{
  font-size: .85rem;
  margin-top: .15rem;
  color: rgba(255,255,255,0.72);
}

.sites-panel--dark .graph-caption{
  color: rgba(255,255,255,0.72);
}

/* lista dentro dark: solo un “contenitore” soft */
.sites-list-area{
  margin-top: .75rem;
  padding-top: .25rem;
}
.sites-panel--dark #mapped-sites-container{
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: 14px;
  padding: .75rem;
}
