    :root {
      --strava-orange: #fc5200;
      --text-black: #111;
    }

    body {
      font-family: system-ui, sans-serif;
      background: #f9f9f9;
      margin: 0;
      padding: 0;
    }

    .timeline {
      max-width: 800px;
      margin: 0 auto;
      padding: 1rem;
    }

    .activity-card {
      background: #fff;
      border: 1px solid #ddd;
      border-radius: 8px;
      padding: 1rem;
      margin-bottom: 1.5rem;
      box-shadow: 0 2px 4px rgba(0,0,0,0.05);
      transition: box-shadow 0.2s ease;
    }

    .activity-card:hover {
      box-shadow: 0 4px 10px rgba(0,0,0,0.1);
    }

    .activity-header {
      display: flex;
      justify-content: space-between;
      font-size: 0.85rem;
      color: #666;
      margin-bottom: 0.5rem;
    }

    .activity-title {
      margin: 0.2rem 0;
      font-size: 1.2rem;
      color: #000;
    }

    .activity-title a {
      color: #000;
      text-decoration: none;
    }

    .activity-title a:hover {
      color: var(--strava-orange);
    }

    .activity-metrics {
      font-size: 0.95rem;
      color: #333;
      margin-top: 0.4rem;
    }
    
    .activity-type i {
		width: 20px;
  		height: 20px;
  		color: #FC4C02;
  		vertical-align: middle;
  		margin-right: 4px;
	}

    .pagination {
      text-align: center;
      margin: 2rem 0;
    }

    .pagination a,
    .pagination strong {
      margin: 0 6px;
      text-decoration: none;
      color: var(--text-black);
      font-weight: bold;
    }

    .pagination a:hover {
      color: var(--strava-orange);
    }


#######
    	:root {
			--strava-orange: #FC4C02;
			--text-black: #111;
		}
		
		a {
  			color: var(--text-black);
 			text-decoration: none;
  			transition: color 0.1s ease;
		}

		a:hover {
  			color: var(--strava-orange);
		}
        
        body { 
            font-family: Arial, sans-serif;
    		margin: 0px auto;
    		font-size: 1rem;
    		line-height: 1.5;
    		background: #f5f5f5;
    	}
    	
    	.container {
			max-width: 900px;
 		   	margin: 40px auto;
		    padding: 0 20px;
    	}
    	
        table { border-collapse: collapse; width: 100%; margin-bottom: 2rem; }
        th, td { border: 1px solid #ccc; padding: 8px; text-align: left; }
        th { background: #eee; }
        h1, h2 { color: #FC4C02; }
        
        .toggle-box {
	    	margin-bottom: 1.5rem;
	    	border: 1px solid #ccc;
	    	border-radius: 3px;
		}

		.toggle-header {
		    display: flex;
		    justify-content: space-between;
		    align-items: center;
		    background: #FFFFFF;
		    padding: 10px;
		    cursor: pointer;
		    font-weight: bold;
		    color: #000000;
		}

		.toggle-icon {
		    width: 20px;
		    height: 20px;
		    transition: transform 0.3s ease;
		}

		.toggle-header.active .toggle-icon {
		    transform: rotate(90deg); /* Rotazione quando aperto */
		}

		.toggle-content {
		    display: none;
		    padding: 10px;
		}
		

	.navbar {
      background-color: #FFFFFF;
      color: #000000;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 6px 20px;
      border-bottom: 1px solid #ccc;
    }

	.navbar-left {
		display: flex;
		align-items: center;
		gap: 10px;
	}

    .navbar-left svg {
    	color: var(--strava-orange);
    }
    
    .navbar-left button {
  		color: var(--strava-orange); /* Colore usato da Lucide */
	}

    .navbar-center ul {
      list-style: none;
      margin: 0;
      padding: 0;
      display: flex;
      gap: 10px;
    }

    .navbar-center a {
      color: #000000;
      text-decoration: none;
      line-height: 1.7;
    }

    .navbar-center a:hover {
      text-decoration: underline;
    }

    .navbar-right img {
      width: 36px;
      height: 36px;
      border-radius: 50%;
      border: 2px solid white;
    }
    
    /* Stile header Strava-like */
.profile-header {
  position: relative;
  width: 100%;
  height: auto;
  /* overflow: hidden; */
}

.header-img {
  width: 100%;
  height: 200px;
  object-fit: cover;
}

/* Avatar sopra l'immagine */
.avatar-wrapper {
  position: absolute;
  bottom: -50px;
  left: 20px;
}

.header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.4); /* bianco con opacità */
  pointer-events: none; /* così non interferisce con click */
}

.avatar {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  border: 1px solid white;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.activity-photos {
  margin-top: 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.activity-photo {
  aspect-ratio: 4 / 3; /* oppure 3/2 se preferisci */
  object-fit: cover;
  object-position: center;
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
  width: 100%;
}

.activity-photo:hover {
  transform: scale(1.02);
}

.activity-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-bottom: 2rem;
  border: 1px solid #ddd;
  padding: 1rem;
  border-radius: 10px;
}

.activity-photo-wrapper {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  border-radius: 8px;
}

.activity-photo-single {
  width: 100%;
  object-fit: cover;
  display: block;
}


###### attività singola 

.activity-details-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid #ccc;
  padding-bottom: 1rem;
}

.activity-meta {
  font-size: 0.95rem;
  color: #666;
}

.activity-title-large {
  font-size: 1.6rem;
  font-weight: bold;
  margin: 0;
  color: var(--text-black);
}

.metrics-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0.5rem;
}

.metrics-table td {
  padding: 6px 10px;
  vertical-align: top;
}

.metric-label {
  font-weight: bold;
  color: #222;
  width: 150px;
}

.section {
  margin-top: 0rem;
}

.section h3 {
  margin-bottom: 0.5rem;
  color: var(--strava-orange);
  font-size: 1.2rem;
}

#map {
  width: 100%;
  height: 400px;
  border-radius: 8px;
  margin-top: 1rem;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* Disattiva i badge delle tile Leaflet */
.leaflet-control-attribution img,
.leaflet-control-attribution img[src*="ukraine"] {
  display: none !important;
}

/* scheda timeline : mappa + foto */
.activity-photo:hover {
  transform: scale(1.02);
}

.activity-bottom-media {
  display: flex;
  /* flex-wrap: wrap; */
  gap: 8px;
  margin-top: 1rem;
}

.activity-map {
  flex: 1;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  object-fit: cover;
  width: 100%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}


.activity-map.full-width {
  aspect-ratio: 2 / 1;
}

/* layout 3 colonne sinistra centrale destra */
/* Contenitore flessibile */
.page-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1rem;
}

/* Box profilo */
.sidebar-profile {
  order: -1; /* Per farlo apparire sopra timeline su mobile */
}

.profile-box {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 1rem;
  background-color: #fff;
  display: flex;
  gap: 1rem;
  align-items: center;
}

.avatar {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  object-fit: cover;
}

.profile-info h3 {
  margin: 0;
  font-size: 1.2rem;
}

.profile-info p {
  margin: 0;
  color: #777;
}

/* Colonna centrale */
.timeline-container {
  order: 1;
  flex-grow: 1;
}

/* Colonna destra vuota per ora */
.sidebar-right {
  display: none; /* opzionale */
}

/* Layout desktop (>=800px) */
@media (min-width: 800px) {
  .page-layout {
    flex-direction: row;
    justify-content: center;
    align-items: flex-start;
  }

  .sidebar-profile {
    width: 250px;
    order: 0;
    position: sticky;
    top: 80px;
  }

  .timeline-container {
    flex: 1;
    max-width: 700px;
  }

  .sidebar-right {
    width: 250px;
    display: block;
  }
}



		@media screen and (max-width: 600px) {
		
			.navbar {
    			padding: 0.5rem;       /* meno padding */
    			margin: 0;             /* elimina margini residui */
  			}
		
			body {
				font-size: 1.125rem; /* equivale a 18px se 1rem=16px */
				padding: 10px;
			}
			h1 {
				font-size: 1.8em;
			}
			h2 {
				font-size: 1.5em;
			}
			table, th, td {
				font-size: 16px;
			}
			.toggle-header {
				font-size: 1.1em;
				padding: 12px;
			}
			.toggle-icon {
				width: 24px;
				height: 24px;
			}
			.avatar-wrapper {
				top: 90px;
			    left: 50%;
			    transform: translateX(-50%);
			}
			.avatar {
			    width: 70px;
			    height: 70px;
			}
			.timeline {
        		padding: 0.5rem;
      		}
      		
      		.metrics-table td {
				display: block;
    			width: 100%;
    			padding: 4px 0;
  			}
  			
  			.metric-label {
    			display: inline-block;
    			width: auto;
    			font-weight: bold;
  			}
  			
  			.activity-bottom-media {
  				display: flex !important;
				/* flex-wrap: wrap !important; */
				flex-direction: row !important; /* IMPORTANTE: assicurati che resti row */
  				/* justify-content: space-between; */
  				gap: 8px !important; /* opzionale, per distanziarle un po' */
			}

			.activity-photo {
  				width: 100% !important; /* non 50% così lasci un po’ di margine tra le due */
  				/* aspect-ratio: 4 / 3; */
  				margin-bottom: 0;
			}
  			
		}

/* ==========================================================
   MSB - RESTYLE PAGINA SINGOLA ATTIVITA
   Solo attivita-restyle.php
   ========================================================== */

.activity-restyle-page {
  background: #f7f7f7;
  color: #242428;
}

/* contenitore più largo, stile pagina attività desktop */
.activity-restyle-page .container {
  max-width: 1050px;
  margin: 32px auto 60px;
  padding: 0 20px;
}

/* la vecchia card diventa la pagina vera e propria */
.activity-restyle-page .activity-card {
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  gap: 0;
  overflow: hidden;
}

/* niente effetto "card che si solleva" */
.activity-restyle-page .activity-card:hover {
  box-shadow: none;
}

/* ==========================================================
   HEADER ATTIVITA
   ========================================================== */

.activity-restyle-page .activity-details-header {
  display: block;
  padding: 28px 32px 24px;
  border-bottom: 1px solid #e5e5e5;
}

.activity-restyle-page .activity-title-edit-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.activity-restyle-page .activity-title-large {
  margin: 0;
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
  color: #242428;
  letter-spacing: -0.4px;
}

/* matita titolo */
.activity-restyle-page #activity-title-edit {
  opacity: 0.45;
}

.activity-restyle-page #activity-title-edit:hover {
  opacity: 1;
  color: var(--strava-orange);
}

.activity-restyle-page .activity-meta {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.5;
  color: #6d6d72;
}

/* ==========================================================
   METRICHE PRINCIPALI
   Trasformiamo la vecchia tabella in una fascia orizzontale
   ========================================================== */

.activity-restyle-page .metrics-table {
  display: block;
  width: auto;
  margin: 0;
  padding: 24px 32px;
  border-bottom: 1px solid #e5e5e5;
}

.activity-restyle-page .metrics-table tbody {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 0;
  row-gap: 0;
}

.activity-restyle-page .metrics-table tr {
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  min-height: 72px;
  padding: 4px 24px;
  border-right: 1px solid #e5e5e5;
}

.activity-restyle-page .metrics-table tr:nth-child(3n) {
  border-right: 0;
}

.activity-restyle-page .metrics-table td {
  display: block;
  width: auto;
  border: 0;
  padding: 0;
}

/* valore */
.activity-restyle-page .metrics-table td:not(.metric-label) {
  font-size: 24px;
  line-height: 1.25;
  font-weight: 500;
  color: #242428;
  white-space: nowrap;
}

/* etichetta */
.activity-restyle-page .metrics-table .metric-label {
  width: auto;
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 400;
  color: #77777c;
}

/* ==========================================================
   SEZIONI
   ========================================================== */

.activity-restyle-page .section {
  margin: 0;
  padding: 26px 32px;
  border-bottom: 1px solid #e5e5e5;
}

.activity-restyle-page .section:last-child {
  border-bottom: 0;
}

.activity-restyle-page .section h3 {
  margin: 0 0 16px;
  color: #242428;
  font-size: 17px;
  line-height: 1.3;
  font-weight: 600;
}

/* ==========================================================
   MAPPA
   ========================================================== */

.activity-restyle-page #map {
  width: 100%;
  height: 480px;
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* la sezione mappa non deve avere imbottitura */
.activity-restyle-page .section:has(#map) {
  padding: 0;
}

.activity-restyle-page .section:has(#map) h3 {
  padding: 22px 32px 0;
  margin-bottom: 16px;
}

/* ==========================================================
   FOTO
   ========================================================== */

.activity-restyle-page .activity-photos {
  margin-top: 0;
  gap: 10px;
}

.activity-restyle-page .activity-photo {
  border-radius: 2px;
  box-shadow: none;
}

/* ==========================================================
   MOBILE
   ========================================================== */

@media (max-width: 700px) {

  .activity-restyle-page {
    padding: 0;
  }

  .activity-restyle-page .container {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .activity-restyle-page .activity-card {
    border-left: 0;
    border-right: 0;
  }

  .activity-restyle-page .activity-details-header {
    padding: 20px 16px;
  }

  .activity-restyle-page .activity-title-large {
    font-size: 25px;
  }

  .activity-restyle-page .metrics-table {
    padding: 18px 16px;
  }

  .activity-restyle-page .metrics-table tbody {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .activity-restyle-page .metrics-table tr {
    min-height: 66px;
    padding: 6px 12px;
    border-right: 0;
    border-bottom: 1px solid #eeeeee;
  }

  .activity-restyle-page .metrics-table tr:nth-child(odd) {
    border-right: 1px solid #eeeeee;
  }

  .activity-restyle-page .metrics-table td:not(.metric-label) {
    font-size: 21px;
  }

  .activity-restyle-page .section {
    padding: 22px 16px;
  }

  .activity-restyle-page .section:has(#map) {
    padding: 0;
  }

  .activity-restyle-page .section:has(#map) h3 {
    padding: 18px 16px 0;
  }

  .activity-restyle-page #map {
    height: 360px;
  }
}

/* ==========================================================
   RESTYLE - GERARCHIA METRICHE
   ========================================================== */

.activity-restyle-page .activity-restyle-primary-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 26px 32px;
  border-bottom: 1px solid #e5e5e5;
}

.activity-restyle-page .activity-restyle-primary-metric {
  padding: 0 26px;
  border-right: 1px solid #e5e5e5;
}

.activity-restyle-page .activity-restyle-primary-metric:first-child {
  padding-left: 0;
}

.activity-restyle-page .activity-restyle-primary-metric:last-child {
  border-right: 0;
}

.activity-restyle-page .activity-restyle-primary-value {
  font-size: 28px;
  line-height: 1.15;
  font-weight: 500;
  color: #242428;
  white-space: nowrap;
}

.activity-restyle-page .activity-restyle-primary-label {
  margin-top: 5px;
  font-size: 12px;
  color: #77777c;
}


/* metriche tecniche */

.activity-restyle-page .activity-restyle-secondary-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 24px 32px;
  border-bottom: 1px solid #e5e5e5;
  row-gap: 24px;
}

.activity-restyle-page .activity-restyle-secondary-metric {
  padding-right: 24px;
}

.activity-restyle-page .activity-restyle-secondary-value {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 500;
  color: #242428;
}

.activity-restyle-page .activity-restyle-secondary-text {
  font-size: 16px;
}

.activity-restyle-page .activity-restyle-secondary-label {
  margin-top: 3px;
  font-size: 12px;
  color: #77777c;
}


/* mobile */

@media (max-width: 700px) {

  .activity-restyle-page .activity-restyle-primary-metrics {
    padding: 20px 16px;
  }

  .activity-restyle-page .activity-restyle-primary-metric {
    padding: 0 12px;
  }

  .activity-restyle-page .activity-restyle-primary-value {
    font-size: 20px;
  }

  .activity-restyle-page .activity-restyle-primary-label {
    font-size: 11px;
  }

  .activity-restyle-page .activity-restyle-secondary-metrics {
    grid-template-columns: repeat(2, 1fr);
    padding: 20px 16px;
    gap: 20px 16px;
  }

  .activity-restyle-page .activity-restyle-secondary-metric {
    padding-right: 0;
  }

}

@media (max-width: 700px) {

  .activity-restyle-page .activity-restyle-primary-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: 18px 12px;
  }

  .activity-restyle-page .activity-restyle-primary-metric {
    padding: 0 8px;
    text-align: center;
  }

  .activity-restyle-page .activity-restyle-primary-value {
    font-size: 18px;
    white-space: nowrap;
  }

  .activity-restyle-page .activity-restyle-primary-label {
    font-size: 10px;
    line-height: 1.2;
  }

  .activity-restyle-page .activity-restyle-secondary-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 18px 16px;
    gap: 18px 12px;
  }

  .activity-restyle-page .activity-restyle-secondary-metric {
    min-width: 0;
  }

  .activity-restyle-page .activity-restyle-secondary-value {
    font-size: 16px;
  }

  .activity-restyle-page .activity-restyle-secondary-text {
    font-size: 14px;
    overflow-wrap: anywhere;
  }
}

/* ==========================================================
   TIMELINE RESTYLE - stile squadrato / old-school
   ========================================================== */

.timeline-restyle-page {
  background: #f7f7f7;
}

.timeline-restyle-page .timeline {
  max-width: 900px;
  margin: 32px auto;
  padding: 0 20px 40px;
}

.timeline-restyle-page .activity-card {
  background: #fff;
  border: 1px solid #dcdcdc;
  border-radius: 0;
  box-shadow: none;
  margin-bottom: 22px;
  padding: 0;
  overflow: hidden;
}

.timeline-restyle-page .activity-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px 10px;
  border-bottom: 1px solid #eeeeee;
}

.timeline-restyle-page .activity-type {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
}

.timeline-restyle-page .activity-type svg {
  width: 18px;
  height: 18px;
}

.timeline-restyle-page .activity-date {
  font-size: 12px;
  color: #777;
}

.timeline-restyle-page .activity-title {
  margin: 0;
  padding: 16px 20px 10px;
  font-size: 22px;
  line-height: 1.2;
  font-weight: 500;
}

.timeline-restyle-page .activity-title a {
  color: #222;
  text-decoration: none;
}

.timeline-restyle-page .activity-title a:hover {
  text-decoration: underline;
}

.timeline-restyle-page .activity-metrics {
  padding: 0 20px 18px;
  font-size: 14px;
  color: #555;
  line-height: 1.5;
}

.timeline-restyle-page .activity-bottom-media {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  margin-top: 4px;
}

.timeline-restyle-page .activity-bottom-media:empty {
  display: none;
}

.timeline-restyle-page .activity-bottom-media a {
  display: block;
  min-width: 0;
}

.timeline-restyle-page .activity-photo {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
  border-radius: 0;
}

.timeline-restyle-page #loader {
  max-width: 900px;
  margin: 0 auto 40px;
  padding: 18px 20px;
  text-align: center;
  font-size: 13px;
  color: #777;
}

/* mobile */

@media (max-width: 700px) {

  .timeline-restyle-page .timeline {
    margin: 18px auto;
    padding: 0 10px 30px;
  }

  .timeline-restyle-page .activity-card {
    margin-bottom: 16px;
  }

  .timeline-restyle-page .activity-header {
    padding: 13px 14px 9px;
  }

  .timeline-restyle-page .activity-title {
    padding: 13px 14px 8px;
    font-size: 19px;
  }

  .timeline-restyle-page .activity-metrics {
    padding: 0 14px 14px;
    font-size: 13px;
  }

  .timeline-restyle-page .activity-photo {
    height: 190px;
  }

}

/* ============================================================
   TIMELINE RESTYLE - CARD ATTIVITA'
   ============================================================ */

.timeline-restyle-page .timeline-activity-card {
  position: relative;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  padding: 20px 22px 22px;
}

.timeline-restyle-page .timeline-activity-rail {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.timeline-restyle-page .timeline-avatar,
.timeline-restyle-page .timeline-type-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
}

.timeline-restyle-page .timeline-avatar svg {
  width: 30px;
  height: 30px;
}

.timeline-restyle-page .timeline-type-icon svg {
  width: 19px;
  height: 19px;
}

.timeline-restyle-page .timeline-activity-main {
  grid-column: 2;
  min-width: 0;
}

.timeline-restyle-page .timeline-activity-card .activity-title {
  margin: 0;
  padding: 0;
  font-size: 23px;
  line-height: 1.2;
  font-weight: 500;
}

.timeline-restyle-page .timeline-activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
  font-size: 12px;
  color: #77777c;
}

.timeline-restyle-page .timeline-meta-separator {
  color: #aaa;
}

.timeline-restyle-page .timeline-activity-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 20px;
  padding: 17px 0;
  border-top: 1px solid #e5e5e5;
}

.timeline-restyle-page .timeline-metric {
  padding: 0 18px;
  border-right: 1px solid #e5e5e5;
}

.timeline-restyle-page .timeline-metric:first-child {
  padding-left: 0;
}

.timeline-restyle-page .timeline-metric:last-child {
  border-right: 0;
}

.timeline-restyle-page .timeline-metric-value {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 500;
  color: #242428;
  white-space: nowrap;
}

.timeline-restyle-page .timeline-metric-label {
  margin-top: 3px;
  font-size: 11px;
  color: #77777c;
}


/* Media */

.timeline-restyle-page .timeline-activity-media {
  display: grid;
  gap: 2px;
  margin-top: 4px;
}

.timeline-restyle-page .timeline-activity-media.has-map.media-count-0 {
  grid-template-columns: 1fr;
}

/* Desktop: mappa 2/3 + una foto 1/3 */
.timeline-restyle-page .timeline-activity-media.has-map.media-count-1 {
  grid-template-columns: 2fr 1fr;
}

/* Desktop: mappa sopra, due foto sotto */
.timeline-restyle-page .timeline-activity-media.has-map.media-count-2 {
  grid-template-columns: 1fr 1fr;
}

.timeline-restyle-page
.timeline-activity-media.has-map.media-count-2
.timeline-map {
  grid-column: 1 / -1;
}

.timeline-restyle-page .timeline-activity-media.no-map {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.timeline-restyle-page .timeline-map,
.timeline-restyle-page
.timeline-activity-media
.activity-photo {
  width: 100%;
  height: 260px;
}

.timeline-restyle-page .timeline-map {
  min-width: 0;
  background: #eee;
}

.timeline-restyle-page .timeline-activity-media a {
  display: block;
  min-width: 0;
}

.timeline-restyle-page
.timeline-activity-media
.activity-photo {
  display: block;
  object-fit: cover;
  border-radius: 0;
}


/* Mobile */

@media (max-width: 700px) {

  .timeline-restyle-page .timeline-activity-card {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 16px 12px 14px;
  }

  .timeline-restyle-page .timeline-activity-rail {
    gap: 14px;
  }

  .timeline-restyle-page .timeline-avatar,
  .timeline-restyle-page .timeline-type-icon {
    width: 26px;
    height: 26px;
  }

  .timeline-restyle-page .timeline-avatar svg {
    width: 25px;
    height: 25px;
  }

  .timeline-restyle-page .timeline-type-icon svg {
    width: 17px;
    height: 17px;
  }

  .timeline-restyle-page
  .timeline-activity-card
  .activity-title {
    font-size: 19px;
  }

  .timeline-restyle-page .timeline-activity-metrics {
    margin-top: 15px;
    padding: 14px 0;
  }

  .timeline-restyle-page .timeline-metric {
    padding: 0 8px;
  }

  .timeline-restyle-page .timeline-metric-value {
    font-size: 16px;
  }

  .timeline-restyle-page .timeline-metric-label {
    font-size: 10px;
  }

  /* Mobile: mappa + una foto = 50 / 50 */
  .timeline-restyle-page
  .timeline-activity-media.has-map.media-count-1 {
    grid-template-columns: 1fr 1fr;
  }

  /* Mobile: mappa sopra + due foto 50 / 50 sotto */
  .timeline-restyle-page
  .timeline-activity-media.has-map.media-count-2 {
    grid-template-columns: 1fr 1fr;
  }

  .timeline-restyle-page
  .timeline-activity-media.has-map.media-count-2
  .timeline-map {
    grid-column: 1 / -1;
  }

  .timeline-restyle-page .timeline-map,
  .timeline-restyle-page
  .timeline-activity-media
  .activity-photo {
    height: 190px;
  }

}

/* ============================================================
   TIMELINE HOME - LAYOUT + SUMMARY SIDEBAR
   ============================================================ */

.timeline-restyle-page .timeline-home-layout {
  width: min(1180px, calc(100% - 40px));
  margin: 32px auto 40px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  gap: 28px;
  align-items: start;
}

.timeline-restyle-page .timeline-home-main {
  min-width: 0;
}

.timeline-restyle-page .timeline-home-layout .timeline {
  max-width: none;
  margin: 0;
  padding: 0;
}

.timeline-restyle-page .timeline-summary {
  min-width: 0;
}

.timeline-restyle-page .timeline-summary-box {
  position: static;
  background: #fff;
  border: 1px solid #dcdcdc;
  padding: 20px;
  margin-bottom: 20px;
}

.timeline-restyle-page .timeline-summary-year-form {
  margin: 0 0 18px;
}

.timeline-restyle-page .timeline-summary-year-select {
  width: 100%;
  border: 0;
  border-bottom: 1px solid #e5e5e5;
  border-radius: 0;
  background: #fff;
  padding: 0 0 10px;
  font: inherit;
  font-size: 20px;
  font-weight: 500;
  color: #242428;
}

.timeline-restyle-page .timeline-summary-list {
  display: grid;
  gap: 10px;
}

.timeline-restyle-page .timeline-summary-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
}

.timeline-restyle-page .timeline-summary-list span {
  font-size: 12px;
  color: #77777c;
}

.timeline-restyle-page .timeline-summary-list strong {
  font-size: 13px;
  font-weight: 500;
  color: #242428;
  white-space: nowrap;
}

.timeline-restyle-page .timeline-summary-divider {
  border-top: 1px solid #e5e5e5;
  margin: 20px 0;
}

.timeline-restyle-page .timeline-summary-heading {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 500;
  color: #242428;
}

.timeline-restyle-page .timeline-summary-footer {
  margin-top: 20px;
  text-align: right;
}

.timeline-restyle-page .timeline-summary-footer a {
  font-size: 12px;
}

@media (max-width: 700px) {

  .timeline-restyle-page .timeline-home-layout {
    width: auto;
    margin: 10px 10px 30px;
    display: flex;
    flex-direction: column;
    gap: 14px;
  }

  .timeline-restyle-page .timeline-summary {
    order: -1;
    width: 100%;
  }

  .timeline-restyle-page .timeline-summary-box {
    position: static;
    padding: 16px;
  }

}

@media (max-width: 700px) {
  .timeline-restyle-page .timeline-home-main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .timeline-restyle-page .timeline-home-layout .timeline {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }

  .timeline-restyle-page #loader {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }
}

/* ============================================================
   MSB - TOGGLE GRAFICO ANNUALE
   ============================================================ */

.timeline-weekly-chart .timeline-weekly-controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.timeline-weekly-chart .timeline-weekly-sports,
.timeline-weekly-chart .timeline-weekly-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-weekly-chart .weekly-toggle {
  appearance: none;
  border: 1px solid #d6dce1;
  border-radius: 6px;
  background: #f3f5f7;
  color: #5b6570;
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  transition: background-color .15s ease,
              border-color .15s ease,
              color .15s ease,
              box-shadow .15s ease;
}

.timeline-weekly-chart .weekly-toggle:hover {
  background: #e7edf1;
  border-color: #aebdc7;
  color: #263746;
}

.timeline-weekly-chart .weekly-toggle:focus-visible {
  outline: 2px solid #009CE0;
  outline-offset: 2px;
}

/* Ciclismo */
.timeline-weekly-chart .weekly-sport-toggle[data-sport="cycling"].active {
  background: #009CE0;
  border-color: #009CE0;
  color: #fff;
}

/* Corsa */
.timeline-weekly-chart .weekly-sport-toggle[data-sport="running"].active {
  background: #36A878;
  border-color: #36A878;
  color: #fff;
}

/* Camminata */
.timeline-weekly-chart .weekly-sport-toggle[data-sport="walking"].active {
  background: #D99A45;
  border-color: #D99A45;
  color: #fff;
}

/* Allenamento generico */
.timeline-weekly-chart .weekly-sport-toggle[data-sport="workout"].active {
  background: #7566B5;
  border-color: #7566B5;
  color: #fff;
}

/* Pesi */
.timeline-weekly-chart .weekly-sport-toggle[data-sport="weights"].active {
  background: #B85C58;
  border-color: #B85C58;
  color: #fff;
}

/* Yoga / Stretching */
.timeline-weekly-chart .weekly-sport-toggle[data-sport="mobility"].active {
  background: #9B79B8;
  border-color: #9B79B8;
  color: #fff;
}

/* Metriche: scelta esclusiva, colore unico */
.timeline-weekly-chart .weekly-metric-toggle.active {
  background: #009CE0;
  border-color: #009CE0;
  color: #fff;
}

.timeline-weekly-chart .weekly-toggle.active:hover {
  filter: brightness(.94);
}


/* ============================================================
   TIMELINE HOME - PROFILE HEADER
   ============================================================ */

.timeline-restyle-page .timeline-profile-photos {
  width: min(1180px, calc(100% - 40px));
  margin: 32px auto 0;
}

.timeline-restyle-page .timeline-profile-photo-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.timeline-restyle-page .timeline-profile-photo-placeholder {
  aspect-ratio: 1 / 1;
  background: #e8e8e8;
}

.timeline-restyle-page .timeline-profile-header {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 32px;
  margin-bottom: 28px;
  background: #fff;
  border: 1px solid #dcdcdc;
  padding: 24px;
}

.timeline-restyle-page .timeline-profile-identity {
  text-align: center;
}

.timeline-restyle-page .timeline-profile-avatar-placeholder {
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #e8e8e8;
}

.timeline-restyle-page .timeline-profile-name {
  font-size: 22px;
  font-weight: 600;
  color: #242428;
}

.timeline-restyle-page .timeline-profile-meta,
.timeline-restyle-page .timeline-profile-links {
  margin-top: 6px;
  font-size: 13px;
  color: #77777c;
}

.timeline-restyle-page .timeline-profile-4weeks-heading {
  font-size: 14px;
  font-weight: 600;
  color: #242428;
}

.timeline-restyle-page .timeline-profile-4weeks-count {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
  color: #242428;
}

.timeline-restyle-page .timeline-profile-calendar-placeholder {
  margin-top: 20px;
  min-height: 120px;
  background: #f3f3f3;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #999;
  font-size: 13px;
}

@media (max-width: 700px) {

  .timeline-restyle-page .timeline-profile-photos {
    width: auto;
    margin: 10px 10px 0;
  }

  .timeline-restyle-page .timeline-profile-photo-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .timeline-restyle-page .timeline-profile-header {
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 16px;
  }

}
.timeline-restyle-page .timeline-profile-4weeks {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  grid-template-areas:
    "heading heading"
    "count calendar";
  column-gap: 24px;
  align-items: start;
}

.timeline-restyle-page .timeline-profile-4weeks-heading {
  grid-area: heading;
}

.timeline-restyle-page .timeline-profile-4weeks-count {
  grid-area: count;
}

.timeline-restyle-page .timeline-profile-calendar-placeholder {
  grid-area: calendar;
  margin-top: 8px;
}

@media (max-width: 700px) {
  .timeline-restyle-page .timeline-profile-4weeks {
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "count"
      "calendar";
  }
}
body.timeline-restyle-page .timeline-profile-4weeks {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  grid-template-areas:
    "heading heading"
    "count calendar";
  column-gap: 24px;
  align-items: start;
}

.timeline-restyle-page .timeline-profile-photo-item {
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #e8e8e8;
}

.timeline-restyle-page .timeline-profile-photo-item img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Profilo MBS: avatar reale */
.timeline-restyle-page .timeline-profile-avatar-placeholder {
  display: block;
  object-fit: cover;
}

/* Editor inline profilo MBS */

.timeline-restyle-page .timeline-profile-bio {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.timeline-restyle-page .timeline-profile-edit-button {
  margin-top: 12px;
  cursor: pointer;
}

.timeline-restyle-page .timeline-profile-editor {
  width: 100%;
  margin-top: 14px;
  text-align: left;
}

.timeline-restyle-page .timeline-profile-editor label {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
}

.timeline-restyle-page .timeline-profile-editor input,
.timeline-restyle-page .timeline-profile-editor textarea {
  box-sizing: border-box;
  display: block;
  width: 100%;
  margin-top: 4px;
}

.timeline-restyle-page .timeline-profile-editor textarea {
  resize: vertical;
}

.timeline-restyle-page .timeline-profile-editor-actions {
  display: flex;
  gap: 6px;
}

.timeline-restyle-page .timeline-profile-editor-actions button {
  cursor: pointer;
}

.timeline-restyle-page .timeline-profile-error {
  margin-top: 8px;
  font-size: 12px;
}

/* Ultime 4 settimane: calendario attività */
.timeline-restyle-page .timeline-profile-calendar {
  grid-area: calendar;
  display: grid;
  grid-template-columns: repeat(7, 18px);
  grid-template-rows: repeat(4, 18px);
  gap: 4px;
  margin-top: 8px;
  justify-content: start;
}

.timeline-restyle-page .timeline-profile-calendar-day {
  width: 18px;
  height: 18px;
  box-sizing: border-box;
  background: #e8e8e8;
  border: 1px solid #dddddd;
}

.timeline-restyle-page .timeline-profile-calendar-day.has-activity {
  background: #009CE0;
  border-color: #009CE0;
}

body.timeline-restyle-page .timeline-profile-calendar-placeholder {
  display: none;
}

@media (max-width: 700px) {
  .timeline-restyle-page .timeline-profile-calendar {
    grid-template-columns: repeat(7, 18px);
    grid-template-rows: repeat(4, 18px);
  }
}

/* Calendario 4 settimane: cerchi proporzionali */
.timeline-restyle-page .timeline-profile-calendar {
  display: grid;
  grid-template-columns: repeat(7, 28px);
  grid-template-rows: repeat(4, 28px);
  gap: 3px;
  align-items: center;
  justify-items: center;
  margin-top: 8px;
}

.timeline-restyle-page .timeline-profile-calendar-day {
  display: block;
  width: var(--activity-size);
  height: var(--activity-size);
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: #cfcfcf;
  cursor: default;
  box-shadow: none;
  appearance: none;
  transition:
    width 0.12s ease,
    height 0.12s ease,
    transform 0.12s ease;
}

.timeline-restyle-page .timeline-profile-calendar-day.has-activity {
  background: #009CE0;
  cursor: pointer;
}

.timeline-restyle-page .timeline-profile-calendar-day.has-activity:hover {
  transform: scale(1.12);
  background: #007FB6;
}

.timeline-restyle-page .timeline-profile-calendar-day:disabled {
  opacity: 1;
}

/* Intestazione giorni calendario 4 settimane */
.timeline-restyle-page .timeline-profile-calendar {
  grid-template-rows: 16px repeat(4, 28px);
}

.timeline-restyle-page .timeline-profile-calendar-weekday {
  font-size: 10px;
  line-height: 16px;
  font-weight: 600;
  color: #777;
  text-align: center;
  width: 28px;
}

/* Profilo: riepilogo ultime 4 settimane stile Strava */
body.timeline-restyle-page .timeline-profile-4weeks {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  grid-template-areas:
    "heading calendar"
    "count   calendar";
  column-gap: 40px;
  align-items: center;
}

.timeline-restyle-page .timeline-profile-4weeks-heading {
  grid-area: heading;
  align-self: end;
  text-align: center;
  font-size: 18px;
  font-weight: 500;
  color: #444;
  white-space: nowrap;
}

.timeline-restyle-page .timeline-profile-4weeks-count {
  grid-area: count;
  align-self: start;
  margin-top: 0;
  text-align: center;
  color: #242428;
}

.timeline-restyle-page .timeline-profile-4weeks-count strong {
  display: block;
  font-size: 72px;
  font-weight: 700;
  line-height: 88px;
}

.timeline-restyle-page .timeline-profile-4weeks-count span {
  display: block;
  margin-top: -4px;
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #666;
}

.timeline-restyle-page .timeline-profile-calendar {
  grid-area: calendar;
  align-self: center;
  margin-top: 0;
}

@media (max-width: 700px) {
  body.timeline-restyle-page .timeline-profile-4weeks {
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "count"
      "calendar";
    row-gap: 14px;
  }

  .timeline-restyle-page .timeline-profile-calendar {
    justify-self: center;
  }
}

/* Blocchi Risultati + Foto sopra il grafico annuale */

.timeline-restyle-page .timeline-profile-results,
.timeline-restyle-page .timeline-profile-gallery {
  margin-bottom: 28px;
}

.timeline-restyle-page .timeline-profile-results h3,
.timeline-restyle-page .timeline-profile-gallery h3 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 600;
  color: #242428;
}

.timeline-restyle-page .timeline-profile-results-content {
  min-height: 70px;
  background: #fff;
  border: 1px solid #dcdcdc;
}

.timeline-restyle-page .timeline-profile-gallery-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 4px;
}

.timeline-restyle-page .timeline-profile-gallery-placeholder,
.timeline-restyle-page .timeline-profile-gallery-more {
  aspect-ratio: 1 / 1;
}

.timeline-restyle-page .timeline-profile-gallery-placeholder {
  background: #e8e8e8;
}

.timeline-restyle-page .timeline-profile-gallery-more {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: #f1f1f1;
  color: #555;
  cursor: pointer;
}

.timeline-restyle-page .timeline-profile-gallery-more span {
  font-size: 13px;
}

.timeline-restyle-page .timeline-profile-gallery-more strong {
  font-size: 26px;
  line-height: 24px;
  font-weight: 400;
}

.timeline-restyle-page .timeline-profile-gallery-more:hover {
  background: #e5e5e5;
}

@media (max-width: 700px) {
  .timeline-restyle-page .timeline-profile-gallery-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Galleria foto reale */
.timeline-restyle-page .timeline-profile-gallery-photo {
  display: block;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #e8e8e8;
  cursor: pointer;
}

.timeline-restyle-page .timeline-profile-gallery-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.15s ease;
}

.timeline-restyle-page .timeline-profile-gallery-photo:hover img {
  transform: scale(1.035);
}


/* Lightbox */
.timeline-gallery-lightbox[hidden] {
  display: none;
}

.timeline-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.88);
}

.timeline-gallery-lightbox-content {
  max-width: min(1000px, calc(100vw - 150px));
  max-height: calc(100vh - 80px);
  margin: 0;
  text-align: center;
}

.timeline-gallery-lightbox-content img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  margin: 0 auto;
  object-fit: contain;
}

.timeline-gallery-lightbox-content figcaption {
  margin-top: 10px;
  color: #fff;
}

.timeline-gallery-lightbox-title {
  font-size: 14px;
  font-weight: 600;
}

.timeline-gallery-lightbox-meta {
  margin-top: 3px;
  font-size: 12px;
  color: #bbb;
}

.timeline-gallery-lightbox-activity {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
  color: #fff;
}

.timeline-gallery-lightbox-close,
.timeline-gallery-lightbox-prev,
.timeline-gallery-lightbox-next {
  position: absolute;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.timeline-gallery-lightbox-close {
  top: 20px;
  right: 28px;
  font-size: 42px;
  line-height: 42px;
}

.timeline-gallery-lightbox-prev,
.timeline-gallery-lightbox-next {
  top: 50%;
  transform: translateY(-50%);
  font-size: 64px;
  line-height: 64px;
}

.timeline-gallery-lightbox-prev {
  left: 28px;
}

.timeline-gallery-lightbox-next {
  right: 28px;
}

@media (max-width: 700px) {
  .timeline-gallery-lightbox-content {
    max-width: calc(100vw - 60px);
  }

  .timeline-gallery-lightbox-prev {
    left: 8px;
  }

  .timeline-gallery-lightbox-next {
    right: 8px;
  }
}

/* Sidebar: statistiche ciclismo */

.timeline-restyle-page .timeline-cycling-summary {
  margin-bottom: 28px;
}

.timeline-restyle-page .timeline-cycling-summary h3 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: #242428;
}

.timeline-restyle-page .timeline-cycling-summary-subtitle {
  margin-top: 24px !important;
}

.timeline-restyle-page .timeline-cycling-summary-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: baseline;
  padding: 6px 0;
  border-bottom: 1px solid #eeeeee;
  font-size: 13px;
  line-height: 1.35;
}

.timeline-restyle-page .timeline-cycling-summary-row span {
  color: #666;
}

.timeline-restyle-page .timeline-cycling-summary-row strong {
  color: #242428;
  font-weight: 600;
  white-space: nowrap;
}

.timeline-restyle-page .timeline-cycling-summary-row a {
  color: #007fb6;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.timeline-restyle-page .timeline-cycling-summary-row a:hover {
  text-decoration: underline;
}

.timeline-restyle-page .timeline-cycling-history-date {
  font-size: 12px;
  font-weight: 400;
  color: #777;
}

/* Profilo: evita che il calendario invada la sidebar
   quando la finestra desktop si restringe */
@media (max-width: 1200px) {
    body.timeline-restyle-page .timeline-profile-4weeks {
        grid-template-columns: 1fr;
        grid-template-areas:
            "heading"
            "count"
            "calendar";
        row-gap: 16px;
        justify-items: center;
    }
}


/* Profilo: breakpoint intermedio quando la colonna principale
   diventa troppo stretta mantenendo ancora la sidebar */
@media (max-width: 950px) {
    body.timeline-restyle-page .timeline-profile-header {
        grid-template-columns: 1fr;
        gap: 22px;
    }
}



/* MBS memory row */
.timeline-profile-memory {
    grid-column: 1 / -1;
    width: 100%;
    margin-top: 10px;
    text-align: left;
    font-size: 0.9rem;
    line-height: 1.4;
}

.timeline-profile-memory span {
    margin-right: 4px;
    font-weight: bold;
}

.timeline-profile-memory a {
    text-decoration: none;
}

.timeline-profile-memory a:hover {
    text-decoration: underline;
}

.timeline-profile-memory {
    display: flex;
    align-items: center;
    gap: 5px;
}

.timeline-profile-memory-icon {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
}


/* ============================================================
   NAVBAR - LOGIN / LOGOUT
   ============================================================ */

.navbar-center a.navbar-auth-btn {
    display: inline-block;
    padding: 7px 14px;
    border-radius: 4px;
    line-height: 1;
    text-decoration: none;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

/* Login: arancio Strava */
.navbar-center a.navbar-login-btn {
    color: #fff;
    background: #fc4c02;
    border: 1px solid #fc4c02;
}

.navbar-center a.navbar-login-btn:hover {
    color: #fff;
    background: #e34402;
    border-color: #e34402;
}

/* Logout: neutro */
.navbar-center a.navbar-logout-btn {
    color: #555;
    background: #f2f2f2;
    border: 1px solid #d5d5d5;
}

.navbar-center a.navbar-logout-btn:hover {
    color: #333;
    background: #e5e5e5;
    border-color: #c8c8c8;
}


/* NAVBAR - ALLINEAMENTO VERTICALE MENU */
.navbar-center {
    transform: translateY(2px);
}


/* NAVBAR - FINE TUNING LINK */

/* Login / Esci tornano alla quota originale */
.navbar-center a.navbar-auth-btn {
    transform: translateY(-2px);
}

/* Link testuali leggermente più in basso */
.navbar-center li a:not(.navbar-auth-btn) {
    transform: translateY(4px);
}

/* =========================================================
   MBS FOTO
   ========================================================= */

.photos-page {
  background: #fff;
}

.photos-main {
  width: 100%;
  box-sizing: border-box;
  padding: 18px 42px 48px 6px;
}

.photos-header {
  margin: 0 0 12px 8px;
}

.photos-header h1 {
  margin: 0;
  color: #242428;
  font-size: 22px;
  font-weight: 600;
}


/* Griglia full-width */

.photos-grid {
  display: grid;
  grid-template-columns:
    repeat(auto-fill, minmax(170px, 1fr));
  gap: 3px;
}

.photos-item {
  display: block;
  position: relative;
  min-width: 0;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: #e8e8e8;
  cursor: pointer;
}

.photos-thumb-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.15s ease;
}

.photos-item:hover .photos-thumb-media {
  transform: scale(1.025);
}


/* Infinite scroll */

.photos-loader,
.photos-end {
  padding: 24px 0 8px;
  text-align: center;
  color: #888;
  font-size: 12px;
}

.photos-sentinel {
  height: 1px;
}


/* =========================================================
   Rail cronologica
   ========================================================= */

.photos-time-rail {
  position: fixed;
  z-index: 500;
  top: 92px;
  right: 4px;
  bottom: 22px;
  width: 36px;
  pointer-events: none;
}

.photos-time-tick {
  position: absolute;
  right: 0;
  width: 36px;
  height: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  transform: translateY(-50%);
  cursor: pointer;
  pointer-events: auto;
}

.photos-time-line {
  position: absolute;
  top: 50%;
  right: 0;
  width: 6px;
  height: 1px;
  background: #aaa;
  transform: translateY(-50%);
  transition:
    width 0.12s ease,
    background 0.12s ease;
}

.photos-time-tick:hover .photos-time-line,
.photos-time-tick.is-active .photos-time-line {
  width: 15px;
  background: #FC4C02;
}


/* Anno */

.photos-time-tick.is-year
.photos-time-line {
  width: 11px;
  height: 2px;
  background: #666;
}

.photos-time-year {
  position: absolute;
  top: 50%;
  right: 15px;
  transform: translateY(-50%);
  font-size: 9px;
  line-height: 1;
  color: #777;
  white-space: nowrap;
}


/* Mese: appare solo al passaggio */

.photos-time-month {
  position: absolute;
  top: 50%;
  right: 19px;
  transform: translateY(-50%);
  padding: 2px 4px;
  background: rgba(255,255,255,0.94);
  color: #555;
  font-size: 10px;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}

.photos-time-tick:hover
.photos-time-month {
  opacity: 1;
}


/*
 * Nei punti di cambio anno evitiamo
 * sovrapposizione mese/anno.
 */
.photos-time-tick.is-year:hover
.photos-time-year {
  opacity: 0;
}

.photos-time-tick.is-active
.photos-time-line {
  width: 15px;
  background: #FC4C02;
}


/* Video nella lightbox esistente */

.timeline-gallery-lightbox-content video {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  margin: 0 auto;
  object-fit: contain;
}


/* Tablet */

@media (max-width: 900px) {

  .photos-main {
    padding:
      10px 31px 30px 3px;
  }

  .photos-grid {
    grid-template-columns:
      repeat(
        auto-fill,
        minmax(125px, 1fr)
      );
    gap: 2px;
  }

  .photos-time-rail {
    right: 2px;
    width: 28px;
  }

  .photos-time-tick {
    width: 28px;
  }

  .photos-time-year {
    display: none;
  }

}


/* Smartphone */

@media (max-width: 560px) {

  .photos-main {
    padding:
      8px 27px 24px 2px;
  }

  .photos-header {
    margin-left: 6px;
  }

  .photos-grid {
    grid-template-columns:
      repeat(3, minmax(0, 1fr));
    gap: 2px;
  }

}


/* ==========================================================
   MBS TRACK V1 - PROFILO ALTIMETRICO + MARKER MAPPA
   ========================================================== */

.activity-restyle-page .mbs-elevation-panel {
  width: 100%;
  padding: 18px 24px 14px;
  box-sizing: border-box;
  background: #fff;
  border-top: 1px solid #e5e5e5;
}

.activity-restyle-page .mbs-elevation-panel[hidden] {
  display: none !important;
}

.activity-restyle-page .mbs-elevation-chart {
  position: relative;
  width: 100%;
  height: 190px;
  min-width: 0;
}


/* START */

.mbs-map-start-marker {
  width: 14px;
  height: 14px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #2da44e;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .28),
    0 1px 3px rgba(0, 0, 0, .28);
}


/* FINISH */

.mbs-map-finish-marker {
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 2px solid #fff;
  background:
    conic-gradient(
      #202020 0 25%,
      #fff 0 50%,
      #202020 0 75%,
      #fff 0
    );
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .30),
    0 1px 3px rgba(0, 0, 0, .28);
}


/* CURSORE SINCRONIZZATO PROFILO <-> MAPPA */

.mbs-map-cursor-marker {
  width: 16px;
  height: 16px;
  box-sizing: border-box;
  border: 3px solid #242428;
  border-radius: 50%;
  background: #fff;
  box-shadow:
    0 1px 4px rgba(0, 0, 0, .38);
  pointer-events: none;
}


/* MOBILE */

@media (max-width: 700px) {

  .activity-restyle-page .mbs-elevation-panel {
    padding: 14px 12px 10px;
  }

  .activity-restyle-page .mbs-elevation-chart {
    height: 160px;
  }
}

/* ============================================================
   MBS MAP - RIDIMENSIONAMENTO VERTICALE
   ============================================================ */

.mbs-map-resizer {
    height: 11px;
    cursor: ns-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;

    background: #f7f7fa;
    border-top: 1px solid #d8d8d8;
    border-bottom: 1px solid #d8d8d8;
    box-sizing: border-box;
}

.mbs-map-resizer span {
    position: relative;
    display: block;

    width: 10px;
    height: 1px;

    background: #999;
}

.mbs-map-resizer span::before,
.mbs-map-resizer span::after {
    content: "";
    position: absolute;
    left: 0;

    width: 10px;
    height: 1px;

    background: #999;
}

.mbs-map-resizer span::before {
    top: -3px;
}

.mbs-map-resizer span::after {
    top: 3px;
}

.mbs-map-resizer:hover span,
.mbs-map-resizer:hover span::before,
.mbs-map-resizer:hover span::after,
.mbs-map-resizer.is-dragging span,
.mbs-map-resizer.is-dragging span::before,
.mbs-map-resizer.is-dragging span::after {
    background: #777;
}

/* ============================================================
   ATTIVITA RESTYLE - MOBILE FULL WIDTH
   Neutralizza il vecchio padding globale mobile del body
   ============================================================ */
@media (max-width: 600px) {

    body.activity-restyle-page {
        padding: 0;
        width: 100%;
        max-width: 100%;
    }

    body.activity-restyle-page .container {
        width: 100%;
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
        box-sizing: border-box;
    }

    body.activity-restyle-page .activity-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}


/* ============================================================
   NAVBAR - MOBILE ALIGNMENT
   Riga 1: logo + avatar
   Riga 2: menu completo
   ============================================================ */
@media (max-width: 600px) {

    .navbar {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        align-items: center;
        width: 100%;
        max-width: 100%;
        padding: 5px 2px 7px;
        box-sizing: border-box;
    }

    .navbar-left {
        display: contents;
    }

    .navbar-left .msb-logo {
        grid-column: 1;
        grid-row: 1;
        width: 46px !important;
        justify-self: start;
    }

    .navbar-center {
        grid-column: 1 / -1;
        grid-row: 2;
        width: 100%;
        max-width: 100%;
        min-width: 0;
        transform: none;
    }

    .navbar-center ul {
        display: flex;
        width: 100%;
        max-width: 100%;
        justify-content: space-between;
        align-items: center;
        gap: 4px;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    .navbar-center li {
        min-width: 0;
    }

    .navbar-center a {
        display: block;
        font-size: 13px;
        line-height: 1.2;
        padding: 4px 2px;
        white-space: nowrap;
    }

    .navbar-center a.navbar-auth-btn {
        padding: 4px 5px;
        transform: none;
    }

    .navbar-center li a:not(.navbar-auth-btn) {
        transform: none;
    }

    .navbar-right {
        position: static;
        grid-column: 2;
        grid-row: 1;
        width: 30px;
        height: 30px;
        margin: 0;
        justify-self: end;
    }

    .navbar-right a {
        display: block;
        width: 30px;
        height: 30px;
    }

    .navbar-right img {
        display: block;
        width: 28px;
        height: 28px;
        box-sizing: border-box;
    }
}


/* ============================================================
   ATTIVITA RESTYLE - MOBILE MAX WIDTH
   1px sfondo laterale + bordo card
   ============================================================ */
@media (max-width: 600px) {

    body.activity-restyle-page .container {
        width: calc(100% - 2px);
        max-width: calc(100% - 2px);
        margin: 5px 1px 0;
        padding: 0;
        box-sizing: border-box;
    }

    body.activity-restyle-page .activity-card {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-left: 1px solid #e5e5e5;
        border-right: 1px solid #e5e5e5;
        box-sizing: border-box;
    }
}


/* Description activity: 2 righe + espansione */
.activity-description {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
}

.activity-description.is-expanded {
    display: block;
    overflow: visible;
}

.activity-description-toggle {
    display: none;
    margin-top: 2px;
    padding: 0;
    border: 0;
    background: none;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.activity-description-toggle.is-visible {
    display: inline-block;
}

/* Navbar search icon */
.navbar-search-link {
    display: flex;
    align-items: center;
    justify-content: center;
}

.navbar-search-icon {
    width: 21px;
    height: 21px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

/* ============================================================
   MBS - Statistiche
   ============================================================ */

.stats-page {
    background: #f5f5f5;
}

.stats-page .stats-container {
    max-width: 900px;
    margin: 32px auto 60px;
    padding: 0 20px;
}

.stats-page .stats-heading {
    margin-bottom: 24px;
}

.stats-page .stats-heading h1 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.15;
    color: #111;
}

.stats-page .stats-heading p {
    margin: 6px 0 0;
    color: #666;
    font-size: 0.95rem;
}


/* KPI */

.stats-page .stats-kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 24px;
}

.stats-page .stats-kpi {
    padding: 20px 16px;
    text-align: center;
    border-right: 1px solid #e5e5e5;
}

.stats-page .stats-kpi:last-child {
    border-right: 0;
}

.stats-page .stats-kpi-value {
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.2;
    color: #111;
}

.stats-page .stats-kpi-value span {
    font-size: 0.85rem;
    font-weight: 500;
    color: #666;
}

.stats-page .stats-kpi-label {
    margin-top: 5px;
    font-size: 0.8rem;
    color: #777;
}


/* Sezioni */

.stats-page .stats-section {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 20px;
    overflow: hidden;
}

.stats-page details.stats-section > summary,
.stats-page .stats-section-title {
    display: block;
    padding: 15px 18px;
    font-weight: 700;
    color: #111;
}

.stats-page details.stats-section > summary {
    cursor: pointer;
    list-style: none;
    position: relative;
    padding-right: 46px;
}

.stats-page details.stats-section > summary::-webkit-details-marker {
    display: none;
}

.stats-page details.stats-section > summary::after {
    content: "›";
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.5rem;
    font-weight: 400;
    color: #777;
    transition: transform 0.15s ease;
}

.stats-page details.stats-section[open] > summary::after {
    transform: translateY(-50%) rotate(90deg);
}

.stats-page .stats-section-content {
    border-top: 1px solid #eee;
    padding: 0 18px 16px;
}

.stats-page .stats-section-static .stats-section-title {
    border-bottom: 1px solid #eee;
}


/* Conteggio tipi */

.stats-page .stats-type-list {
    width: 100%;
}

.stats-page .stats-type-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    min-height: 44px;
    border-bottom: 1px solid #eee;
}

.stats-page .stats-type-row:last-child {
    border-bottom: 0;
}

.stats-page .stats-type-name {
    min-width: 0;
}

.stats-page .stats-type-count {
    flex: 0 0 auto;
    font-variant-numeric: tabular-nums;
}


/* Top 3 */

.stats-page .stats-ranking {
    margin: 0 -18px -16px;
}

.stats-page .stats-ranking-row {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 13px 18px;
    color: #111;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.stats-page .stats-ranking-row:last-child {
    border-bottom: 0;
}

.stats-page .stats-ranking-row:hover {
    background: #fafafa;
    color: #fc4c02;
}

.stats-page .stats-ranking-position {
    font-size: 1.2rem;
    font-weight: 700;
    color: #999;
}

.stats-page .stats-ranking-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.stats-page .stats-ranking-main strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stats-page .stats-ranking-main small {
    margin-top: 2px;
    color: #777;
}

.stats-page .stats-ranking-value {
    white-space: nowrap;
    font-weight: 700;
}


/* Archivio */

.stats-page .stats-archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    border-bottom: 1px solid #eee;
}

.stats-page .stats-archive-header .stats-section-title {
    border-bottom: 0;
}

.stats-page .stats-limit-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 18px;
    font-size: 0.85rem;
    color: #666;
}

.stats-page .stats-limit-form select {
    padding: 5px 26px 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    color: #111;
}

.stats-page .stats-archive-content {
    padding-bottom: 0;
}

.stats-page .stats-archive-list {
    margin: 0 -18px;
}

.stats-page .stats-archive-row {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 130px 90px;
    gap: 14px;
    align-items: center;
    min-height: 46px;
    padding: 8px 18px;
    color: #111;
    text-decoration: none;
    border-bottom: 1px solid #eee;
}

.stats-page .stats-archive-row:hover {
    background: #fafafa;
    color: #fc4c02;
}

.stats-page .stats-archive-date,
.stats-page .stats-archive-type,
.stats-page .stats-archive-distance {
    color: #666;
    font-size: 0.9rem;
}

.stats-page .stats-archive-name {
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.stats-page .stats-archive-distance {
    text-align: right;
    white-space: nowrap;
}


/* Paginazione */

.stats-page .stats-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 18px;
    padding: 16px;
}

.stats-page .stats-pagination a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 1px solid #ddd;
    border-radius: 50%;
    color: #111;
    text-decoration: none;
    font-size: 1.4rem;
    line-height: 1;
}

.stats-page .stats-pagination a:hover {
    border-color: #fc4c02;
    color: #fc4c02;
}

.stats-page .stats-pagination span {
    font-size: 0.9rem;
    color: #666;
}

.stats-page .stats-empty {
    margin: 16px 0 0;
    color: #777;
}


/* Mobile */

@media screen and (max-width: 700px) {

    .stats-page .stats-container {
        margin: 18px auto 40px;
        padding: 0 10px;
    }

    .stats-page .stats-heading h1 {
        font-size: 1.65rem;
    }

    .stats-page .stats-kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .stats-page .stats-kpi {
        border-right: 1px solid #e5e5e5;
        border-bottom: 1px solid #e5e5e5;
    }

    .stats-page .stats-kpi:nth-child(2n) {
        border-right: 0;
    }

    .stats-page .stats-kpi:nth-last-child(-n + 2) {
        border-bottom: 0;
    }

    .stats-page .stats-archive-header {
        align-items: flex-start;
    }

    .stats-page .stats-limit-form {
        padding: 10px 12px 0 0;
    }

    .stats-page .stats-limit-form label {
        display: none;
    }

    .stats-page .stats-archive-row {
        grid-template-columns: 78px minmax(0, 1fr) auto;
        gap: 8px;
    }

    .stats-page .stats-archive-type {
        display: none;
    }

    .stats-page .stats-archive-date,
    .stats-page .stats-archive-distance {
        font-size: 0.8rem;
    }

    .stats-page .stats-ranking-row {
        grid-template-columns: 28px minmax(0, 1fr) auto;
    }
}

@media screen and (max-width: 420px) {

    .stats-page .stats-kpi {
        padding: 16px 8px;
    }

    .stats-page .stats-kpi-value {
        font-size: 1.2rem;
    }

    .stats-page .stats-archive-row {
        grid-template-columns: 1fr auto;
    }

    .stats-page .stats-archive-date {
        grid-column: 1 / -1;
        padding-top: 3px;
    }

    .stats-page .stats-archive-name {
        padding-bottom: 3px;
    }
}

/* ============================================================
   MBS FOTO - marcatore prima foto attività
   ============================================================ */

.photos-activity-overlay {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;

  padding: 8px 7px 6px;

  background:
    linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0) 0%,
      rgba(0, 0, 0, 0.20) 30%,
      rgba(0, 0, 0, 0.50) 100%
    );

  color: #fff;
  text-align: left;
  pointer-events: none;
}

.photos-activity-overlay-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 12px;
  line-height: 1.15;
  font-weight: 700;

  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

.photos-activity-overlay-meta {
  margin-top: 2px;

  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;

  font-size: 9px;
  line-height: 1.15;
  font-weight: 400;

  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}

/* Il titolo nel lightbox ora è direttamente il link all'attività */
.timeline-gallery-lightbox-title {
  color: inherit;
  font-weight: 700;
  text-decoration: none;
}

.timeline-gallery-lightbox-title:hover {
  text-decoration: underline;
}

@media (max-width: 560px) {

  .photos-activity-overlay {
    padding: 6px 5px 5px;
  }

  .photos-activity-overlay-title {
    font-size: 10px;
  }

  .photos-activity-overlay-meta {
    margin-top: 1px;
    font-size: 8px;
  }

}

/* ============================================================
   MBS FOTO - lightbox: media hidden non occupano spazio
   ============================================================ */

.timeline-gallery-lightbox-content img[hidden],
.timeline-gallery-lightbox-content video[hidden] {
  display: none !important;
}

/* ============================================================
   MBS - Logo header: bici + MSB
   ============================================================ */

.msb-logo {
    width: auto;
    flex: 0 0 auto;
}

.msb-logo > a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    color: #FC4C02;
    text-decoration: none;
    white-space: nowrap;
}

.msb-logo .fa-bicycle {
    flex: 0 0 auto;
    font-size: 28px;
    line-height: 1;
}

.msb-logo svg {
    display: block;
    width: 58px;
    height: 40px;
    flex: 0 0 58px;
}

/* Corregge il vecchio width:46px del layout responsive */
@media (max-width: 768px) {
    .navbar-left .msb-logo {
        width: auto !important;
    }
}

/* MBS - icona tipo attività nel titolo della singola attività */
.activity-title-type-icon {
    color: #fc4c02;
    margin-right: 5px;
    vertical-align: -2px;
}

/* MBS - bici Lucide header: altezza visiva coerente con logo MSB */
.msb-logo svg.lucide-bike {
    width: 36px;
    height: 36px;
    flex: 0 0 36px;
}
