/* ============================================================
   Benaco.live — Stylesheet
   Design system: editorial, inspired by FT / Il Sole 24 Ore
   ============================================================ */

* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --cream: #faf8f4;
  --white: #fff;
  --ink: #1a1a1a;
  --charcoal: #2d2d2d;
  --stone: #6b6b6b;
  --silver: #999;
  --mist: #e8e4de;
  --cloud: #f2efe9;
  --accent: #b8432f;
  --accent-light: #f4ece9;
  --blue: #2563eb;
  --green: #16713a;
  --amber: #a16207;
  --serif: 'Libre Baskerville', Georgia, serif;
  --sans: 'Source Sans 3', 'Source Sans Pro', sans-serif;
  --mono: 'JetBrains Mono', monospace;
  --max: 1140px;
}

html { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body { font-family: var(--sans); background: var(--cream); color: var(--ink); line-height: 1.65; font-size: 16px; }

/* ---- MASTHEAD ---- */
.masthead {
  padding: 20px 0 16px;
  text-align: center;
  background: var(--white);
}
.masthead-inner { max-width: var(--max); margin: 0 auto; padding: 0 24px; position: relative; }
.masthead-date { font-size: 12px; color: var(--stone); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 8px; }
.masthead h1 {
  font-family: var(--serif);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.1;
  color: var(--ink);
}
.masthead h1 span { color: var(--accent); }
.masthead-tagline { font-size: 14px; color: var(--stone); font-style: italic; font-family: var(--serif); margin-top: 6px; }
.masthead-clock {
  position: absolute; right: 24px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 13px; color: var(--stone);
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; width: 240px;
  background: var(--white); border-right: 1px solid var(--mist);
  z-index: 200; display: flex; flex-direction: column;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1);
}
.sidebar-brand { padding: 24px 24px 20px; border-bottom: 1px solid var(--mist); }
.sidebar-brand h2 { font-family: var(--serif); font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.sidebar-brand h2 span { color: var(--accent); }
.sidebar-brand p { font-size: 11px; color: var(--stone); margin-top: 4px; line-height: 1.4; }
.sidebar-clock { font-family: var(--mono); font-size: 12px; color: var(--silver); margin-top: 8px; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 0; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; font-size: 14px; font-weight: 500; color: var(--stone);
  text-decoration: none; transition: all .15s; border-left: 3px solid transparent;
}
.sidebar-nav a:hover { color: var(--ink); background: var(--cloud); }
.sidebar-nav a.active { color: var(--accent); background: var(--accent-light); border-left-color: var(--accent); font-weight: 700; }
.sidebar-nav a .nav-icon { width: 18px; height: 18px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.sidebar-nav a .nav-icon svg { width: 18px; height: 18px; stroke: currentColor; }
.sidebar-nav .nav-divider { height: 1px; background: var(--mist); margin: 12px 24px; }
.sidebar-footer {
  padding: 16px 24px; border-top: 1px solid var(--mist);
  font-size: 11px; color: var(--silver); line-height: 1.6;
}
.sidebar-footer a { color: var(--accent); text-decoration: none; }

/* ---- MAIN CONTENT ---- */
.main-content { margin-left: 240px; min-height: 100vh; }

/* ---- MOBILE HAMBURGER ---- */
.hamburger {
  display: none; position: fixed; top: 12px; left: 12px; z-index: 300;
  width: 44px; height: 44px; border-radius: 8px;
  background: var(--white); border: 1px solid var(--mist);
  cursor: pointer; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.hamburger svg { width: 20px; height: 20px; color: var(--ink); }
.overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.3); z-index: 150;
  opacity: 0; transition: opacity .3s;
}
.overlay.show { display: block; opacity: 1; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 24px rgba(0,0,0,.12); z-index: 350; }
  .main-content { margin-left: 0; }
  .hamburger { display: flex; }
}

/* ---- LAYOUT ---- */
.container { max-width: var(--max); margin: 0 auto; padding: 0 24px; }
section { padding: 48px 0; border-bottom: 1px solid var(--mist); }
.section-label { font-size: 11px; text-transform: uppercase; letter-spacing: 2px; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.section-title { font-family: var(--serif); font-size: 1.6rem; font-weight: 700; margin-bottom: 4px; }
.section-desc { color: var(--stone); font-size: 15px; margin-bottom: 28px; max-width: 600px; }
h3.subsection {
  font-family: var(--serif); font-size: 1.1rem; font-weight: 700;
  margin: 32px 0 16px; padding-bottom: 8px; border-bottom: 1px solid var(--mist);
}

/* ---- HERO TICKER ---- */
.ticker { background: var(--ink); color: #fff; padding: 10px 0; overflow: hidden; }
.ticker-inner { display: flex; gap: 48px; animation: scroll 22s linear infinite; white-space: nowrap; }
@keyframes scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.ticker-item { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.ticker-item .label { color: #fff; font-weight: 300; }
.ticker-item .label::after { content: '·'; margin-left: 4px; opacity: 0.4; }
.ticker-item .value { color: #fff; font-weight: 600; }
.ticker-item .up { color: #4ade80; }
.ticker-item .down { color: #f87171; }

/* ---- WEATHER GRID ---- */
.weather-hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border: 1px solid var(--mist); background: var(--white); margin-bottom: 24px;
}
.weather-hero > div { padding: 28px 32px; }
.weather-hero .main { border-right: 1px solid var(--mist); }
.weather-hero .temp { font-size: 4rem; font-weight: 300; line-height: 1; font-family: var(--sans); }
.weather-hero .desc { font-family: var(--serif); font-style: italic; color: var(--stone); margin-top: 8px; font-size: 15px; }
.weather-hero .location { font-size: 12px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); font-weight: 700; margin-bottom: 8px; }
.weather-detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--cloud); font-size: 14px; }
.weather-detail-row:last-child { border-bottom: none; }
.weather-detail-row .label { color: var(--stone); }
.weather-detail-row .val { font-weight: 600; }

.comuni-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1px; background: var(--mist); border: 1px solid var(--mist); }
.comune-card { background: var(--white); padding: 16px 18px; transition: background .2s; cursor: default; }
.comune-card:hover { background: var(--cloud); }
.comune-card .name { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.comune-card .temp { font-size: 1.5rem; font-weight: 300; line-height: 1; }
.comune-card .meta { font-size: 12px; color: var(--stone); margin-top: 4px; }
.comune-card .province {
  display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; padding: 2px 6px; border-radius: 2px; margin-top: 6px;
}
.comune-card .province.BS { background: #e8f0fe; color: #1a56db; }
.comune-card .province.VR { background: #fef3c7; color: #92400e; }
.comune-card .province.TN { background: #ecfdf5; color: #065f46; }

/* ---- BEACH INDEX ---- */
.beach-bar {
  display: flex; align-items: center; gap: 16px; padding: 20px 24px;
  background: var(--white); border: 1px solid var(--mist); margin-bottom: 24px;
}
.beach-score { font-size: 2.5rem; font-weight: 700; color: var(--accent); line-height: 1; }
.beach-label { font-family: var(--serif); font-weight: 700; font-size: 15px; }
.beach-tip { font-size: 13px; color: var(--stone); }

/* ---- HOURLY ---- */
.hourly-strip {
  display: flex; gap: 0; overflow-x: auto; border: 1px solid var(--mist); background: var(--mist);
  scrollbar-width: thin; scrollbar-color: var(--silver) transparent;
}
.hourly-cell { flex-shrink: 0; width: 72px; text-align: center; padding: 14px 8px; background: var(--white); border-right: 1px solid var(--mist); }
.hourly-cell:last-child { border-right: none; }
.hourly-cell .time { font-size: 11px; color: var(--stone); font-weight: 600; }
.hourly-cell .icon { font-size: 18px; margin: 6px 0; }
.hourly-cell .t { font-size: 15px; font-weight: 600; }

/* ---- TRAINS ---- */
.train-board { background: var(--white); border: 1px solid var(--mist); overflow: hidden; }
.train-header {
  display: grid; grid-template-columns: 80px 1fr 90px 100px; gap: 12px;
  padding: 10px 20px; background: var(--cloud); font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px; color: var(--stone); font-weight: 700;
  border-bottom: 1px solid var(--mist);
}
.train-row {
  display: grid; grid-template-columns: 80px 1fr 90px 100px; gap: 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--cloud);
  font-size: 14px; transition: background .15s;
}
.train-row:hover { background: var(--cloud); }
.train-row:last-child { border-bottom: none; }
.train-unavailable { padding: 32px 16px; text-align: center; color: var(--stone); }
.train-unavailable-icon { font-size: 32px; margin-bottom: 12px; }
.train-unavailable-text { font-size: 15px; margin-bottom: 16px; }
.train-unavailable-link { display: inline-block; font-size: 13px; color: var(--accent); text-decoration: none; margin-bottom: 12px; }
.train-unavailable-link:hover { text-decoration: underline; }
.train-unavailable-retry { display: block; margin: 0 auto; padding: 8px 20px; background: var(--ink); color: #fff; border: none; border-radius: 4px; font-size: 13px; cursor: pointer; }
.train-unavailable-retry:hover { opacity: .8; }
.train-time { font-family: var(--mono); font-size: 16px; font-weight: 500; }
.train-dest { font-weight: 600; }
.train-via { font-size: 12px; color: var(--stone); font-weight: 400; }
.train-cat {
  font-size: 10px; font-weight: 700; padding: 3px 8px; border-radius: 2px;
  text-align: center; text-transform: uppercase; letter-spacing: .5px; align-self: center;
}
.train-cat.RE { background: #dbeafe; color: #1e40af; }
.train-cat.RV { background: #d1fae5; color: #065f46; }
.train-cat.FR { background: #fee2e2; color: #991b1b; }
.train-cat.IC { background: #fef3c7; color: #92400e; }
.train-cat.IT { background: #ede9fe; color: #5b21b6; }
.train-status { text-align: right; font-size: 13px; font-weight: 600; }
.train-status.ontime { color: var(--green); }
.train-status.delayed { color: var(--accent); }

/* ---- WEBCAMS ---- */
.webcam-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.webcam-card { background: var(--white); border: 1px solid var(--mist); overflow: hidden; }
.webcam-frame { width: 100%; aspect-ratio: 16/9; background: #e5e5e5; position: relative; overflow: hidden; }
.webcam-frame img { width: 100%; height: 100%; object-fit: cover; }
.webcam-live {
  position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff;
  font-size: 9px; font-weight: 700; padding: 3px 8px; letter-spacing: 1px;
  text-transform: uppercase; display: flex; align-items: center; gap: 4px;
}
.webcam-live::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: #fff; animation: blink 1.5s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.webcam-info { padding: 14px 16px; }
.webcam-info h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.webcam-info p { font-size: 12px; color: var(--stone); }

/* ---- EVENTS ---- */
.event-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--mist); background: var(--white); }
.event-row {
  display: grid; grid-template-columns: 64px 1fr auto; gap: 16px;
  padding: 18px 20px; border-bottom: 1px solid var(--cloud); transition: background .15s;
}
.event-row:hover { background: var(--cloud); }
.event-row:last-child { border-bottom: none; }
.event-date { text-align: center; }
.event-date .day { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--accent); }
.event-date .month { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--stone); }
.event-body h4 { font-size: 15px; font-weight: 600; margin-bottom: 2px; }
.event-body p { font-size: 13px; color: var(--stone); line-height: 1.5; }
.event-tag {
  align-self: center; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .8px; padding: 4px 10px; border: 1px solid var(--mist); color: var(--stone);
}

/* ---- QUALITY OF LIFE ---- */
.qol-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.qol-card { background: var(--white); border: 1px solid var(--mist); padding: 24px; }
.qol-card .comune-name { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; margin-bottom: 12px; }
.qol-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--cloud); font-size: 13px; }
.qol-row:last-child { border-bottom: none; }
.qol-row .label { color: var(--stone); }
.qol-row .val { font-weight: 600; }
.qol-trend { font-size: 11px; margin-left: 4px; }
.qol-trend.up { color: var(--green); }
.qol-trend.down { color: var(--accent); }

/* ---- NEWSLETTER ---- */
.newsletter { background: var(--ink); color: var(--cream); padding: 56px 0; text-align: center; border-bottom: none; }
.newsletter h2 { font-family: var(--serif); font-size: 1.8rem; margin-bottom: 8px; color: #fff; }
.newsletter p { color: var(--silver); font-size: 15px; margin-bottom: 24px; max-width: 480px; margin-left: auto; margin-right: auto; }
.newsletter-form { display: flex; gap: 0; max-width: 440px; margin: 0 auto; }
.newsletter-form input {
  flex: 1; padding: 14px 18px; border: 1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06); color: #fff; font-size: 15px;
  font-family: var(--sans); outline: none; transition: border .2s;
}
.newsletter-form input::placeholder { color: var(--silver); }
.newsletter-form input:focus { border-color: rgba(255,255,255,.4); }
.newsletter-form button {
  padding: 14px 28px; background: var(--accent); color: #fff; border: none;
  font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  cursor: pointer; font-family: var(--sans); transition: background .2s;
}
.newsletter-form button:hover { background: #9a3626; }
.newsletter-note { font-size: 12px; color: var(--silver); margin-top: 12px; }

/* ---- FOOTER ---- */
footer { background: var(--white); border-top: 3px double var(--ink); padding: 40px 0; text-align: center; }
footer .brand { font-family: var(--serif); font-size: 1.3rem; font-weight: 700; margin-bottom: 8px; }
footer p { font-size: 13px; color: var(--stone); line-height: 1.8; }
footer a { color: var(--accent); text-decoration: none; }

/* ---- SOURCE TAG ---- */
.source { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--silver); margin-top: 12px; }
.source::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--green); flex-shrink: 0; }

/* ---- FARMACIE ---- */
.farmacia-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1px; background: var(--mist); border: 1px solid var(--mist); }
.farmacia-card { background: var(--white); padding: 20px 22px; position: relative; }
.farmacia-card.turno { border-left: 4px solid var(--green); }
.farmacia-card.turno::after {
  content: 'DI TURNO'; position: absolute; top: 12px; right: 12px;
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  background: #dcfce7; color: var(--green); padding: 3px 8px;
}
.farmacia-card .farmacia-name { font-weight: 700; font-size: 15px; margin-bottom: 2px; }
.farmacia-card .farmacia-addr { font-size: 13px; color: var(--stone); margin-bottom: 6px; }
.farmacia-card .farmacia-meta { display: flex; gap: 16px; font-size: 12px; color: var(--stone); }
.farmacia-card .farmacia-meta a { color: var(--accent); text-decoration: none; font-weight: 600; }
.farmacia-card .farmacia-comune { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--silver); margin-top: 8px; }
.farmacia-filter { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.farmacia-provincia-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--silver); padding: 12px 0 6px; }
.farmacia-badge { display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; padding: 2px 6px; border-radius: 3px; margin-left: 6px; vertical-align: middle; }
.farmacia-badge.turno { background: var(--green); color: #fff; }
.farmacia-badge.nonstop { background: var(--accent); color: #fff; }
.farmacia-orario { font-size: 12px; color: var(--stone); margin-bottom: 4px; }
.farmacia-tel { color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 600; }
.farmacia-pending-card { background: var(--cloud); border: 1px solid var(--mist); border-radius: 4px; padding: 16px 20px; margin-top: 12px; }
.farmacia-pending-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--stone); margin-bottom: 4px; }
.farmacia-pending-text { font-size: 13px; color: var(--stone); }
.farmacia-pending-text a { color: var(--accent); text-decoration: none; }
.farmacia-pending { font-size: 14px; color: var(--stone); padding: 12px 0; }
.farmacia-filter select {
  padding: 8px 14px; border: 1px solid var(--mist); background: var(--white);
  font-family: var(--sans); font-size: 13px; color: var(--ink); cursor: pointer; appearance: auto;
}

/* ---- SERVIZI / ATTIVITÀ ---- */
.servizi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1px; background: var(--mist); border: 1px solid var(--mist); }
.servizio-card { background: var(--white); padding: 18px 20px; transition: background .15s; }
.servizio-card:hover { background: var(--cloud); }
.servizio-card:hover .servizio-name::after { content: ' ↗'; font-size: 11px; color: var(--accent); }
.servizio-card .servizio-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 6px; }
.servizio-card .servizio-name { font-weight: 700; font-size: 14px; }
.servizio-card .servizio-status { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; padding: 3px 8px; }
.servizio-card .servizio-status.aperto { background: #dcfce7; color: var(--green); }
.servizio-card .servizio-status.chiuso { background: #fee2e2; color: #991b1b; }
.servizio-card .servizio-cat { font-size: 11px; color: var(--silver); text-transform: uppercase; letter-spacing: .8px; margin-bottom: 4px; }
.servizio-card .servizio-addr { font-size: 12px; color: var(--stone); margin-bottom: 4px; }
.servizio-card .servizio-hours { font-size: 12px; color: var(--stone); }
.servizio-card .servizio-hours strong { color: var(--ink); }
.servizio-card .servizio-rating { font-size: 12px; color: var(--amber); margin-top: 6px; }
.servizio-card.sponsor { border-left: 3px solid var(--accent); background: var(--accent-light); }
.servizio-card.sponsor .sponsor-badge { font-size: 9px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--accent); margin-top: 8px; }
.servizi-filter { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-btn {
  padding: 7px 14px; border: 1px solid var(--mist); background: var(--white);
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--stone);
  cursor: pointer; transition: all .2s; text-transform: uppercase; letter-spacing: .5px;
}
.filter-btn:hover, .filter-btn.active { background: var(--ink); color: var(--white); border-color: var(--ink); }

/* ---- TRASPARENZA ---- */
.trasparenza-list { border: 1px solid var(--mist); background: var(--white); }
.trasparenza-row {
  display: grid; grid-template-columns: 90px 100px 1fr auto; gap: 16px;
  padding: 14px 20px; border-bottom: 1px solid var(--cloud); font-size: 14px; transition: background .15s;
}
.trasparenza-row:hover { background: var(--cloud); }
.trasparenza-row:last-child { border-bottom: none; }
.trasparenza-date { font-family: var(--mono); font-size: 12px; color: var(--stone); align-self: center; }
.trasparenza-tipo {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px;
  padding: 4px 8px; align-self: center; text-align: center;
}
.trasparenza-tipo.delibera { background: #dbeafe; color: #1e40af; }
.trasparenza-tipo.determina { background: #fef3c7; color: #92400e; }
.trasparenza-tipo.avviso { background: #ede9fe; color: #5b21b6; }
.trasparenza-tipo.ordinanza { background: #fee2e2; color: #991b1b; }
.trasparenza-body { align-self: center; }
.trasparenza-body h4 { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.trasparenza-body p { font-size: 12px; color: var(--stone); }
.trasparenza-comune { font-size: 11px; font-weight: 600; color: var(--stone); align-self: center; text-align: right; }
.trasparenza-header {
  display: grid; grid-template-columns: 90px 100px 1fr auto; gap: 16px;
  padding: 10px 20px; background: var(--cloud); font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px; color: var(--stone); font-weight: 700;
  border-bottom: 1px solid var(--mist);
}
.trasparenza-search { display: flex; gap: 8px; margin-bottom: 20px; }
.trasparenza-search input {
  flex: 1; padding: 10px 16px; border: 1px solid var(--mist); background: var(--white);
  font-family: var(--sans); font-size: 14px; color: var(--ink); outline: none;
}
.trasparenza-search input:focus { border-color: var(--stone); }
.trasparenza-search select {
  padding: 10px 14px; border: 1px solid var(--mist); background: var(--white);
  font-family: var(--sans); font-size: 13px; color: var(--ink); cursor: pointer;
}

/* ---- SOLDI PUBBLICI ---- */
.sp-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1px; background: var(--mist); border: 1px solid var(--mist); margin-bottom: 28px; }
.sp-kpi { background: var(--white); padding: 20px 22px; }
.sp-kpi .kpi-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--stone); font-weight: 600; margin-bottom: 4px; }
.sp-kpi .kpi-value { font-size: 1.8rem; font-weight: 300; line-height: 1.2; }
.sp-kpi .kpi-sub { font-size: 12px; color: var(--stone); margin-top: 4px; }
.sp-kpi .kpi-trend { font-size: 12px; font-weight: 600; margin-left: 6px; }
.sp-kpi .kpi-trend.up { color: var(--accent); }
.sp-kpi .kpi-trend.down { color: var(--green); }

.sp-metric-select { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.sp-metric-btn {
  padding: 7px 14px; border: 1px solid var(--mist); background: var(--white);
  font-family: var(--sans); font-size: 12px; font-weight: 600; color: var(--stone);
  cursor: pointer; transition: all .2s;
}
.sp-metric-btn:hover, .sp-metric-btn.active { background: var(--ink); color: var(--white); border-color: var(--ink); }

.sp-chart-container { background: var(--white); border: 1px solid var(--mist); padding: 24px; margin-bottom: 24px; }
.sp-chart-title { font-family: var(--serif); font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.sp-chart-sub { font-size: 12px; color: var(--stone); margin-bottom: 20px; }
.sp-bar-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--cloud); }
.sp-bar-row:last-child { border-bottom: none; }
.sp-bar-name { width: 160px; font-size: 13px; font-weight: 500; flex-shrink: 0; }
.sp-bar-track { flex: 1; height: 24px; background: var(--cloud); position: relative; overflow: hidden; }
.sp-bar-fill { height: 100%; transition: width .8s cubic-bezier(.4, 0, .2, 1); }
.sp-bar-fill.above { background: var(--accent); }
.sp-bar-fill.below { background: var(--green); }
.sp-bar-fill.neutral { background: var(--stone); opacity: .4; }
.sp-bar-value { width: 90px; text-align: right; font-size: 13px; font-weight: 600; font-family: var(--mono); flex-shrink: 0; }
.sp-bar-avg { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); z-index: 2; }
.sp-bar-avg::after {
  content: 'media'; position: absolute; top: -16px; left: -14px;
  font-size: 9px; text-transform: uppercase; letter-spacing: .5px; color: var(--stone);
}

.sp-highlight { background: var(--accent-light); border: 1px solid rgba(184,67,47,.15); padding: 20px 24px; margin-bottom: 24px; }
.sp-highlight .sp-h-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; color: var(--accent); font-weight: 700; margin-bottom: 4px; }
.sp-highlight .sp-h-title { font-family: var(--serif); font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.sp-highlight .sp-h-body { font-size: 14px; color: var(--charcoal); line-height: 1.6; }
.sp-highlight .sp-h-source { font-size: 11px; color: var(--silver); margin-top: 8px; }

.sp-table { width: 100%; border-collapse: collapse; background: var(--white); border: 1px solid var(--mist); font-size: 13px; }
.sp-table th {
  text-align: left; padding: 10px 16px; background: var(--cloud);
  font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--stone);
  font-weight: 700; border-bottom: 1px solid var(--mist);
}
.sp-table td { padding: 10px 16px; border-bottom: 1px solid var(--cloud); }
.sp-table tr:hover td { background: var(--cloud); }
.sp-table td.num { text-align: right; font-family: var(--mono); font-weight: 500; }
.sp-table .above-avg { color: var(--accent); font-weight: 700; }
.sp-table .below-avg { color: var(--green); font-weight: 700; }

/* ---- GREETING CARD ---- */
.greeting-card {
  background: var(--white);
  border: 1px solid var(--mist);
  padding: 28px 32px;
  margin-bottom: 1px;
}
.greeting-header {
  margin-bottom: 10px;
}
.greeting-eyebrow {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
}
.greeting-toggle {
  display: flex;
  width: 100%;
  border: 1px solid var(--mist);
  overflow: hidden;
}
.greeting-toggle-btn {
  flex: 1;
  padding: 7px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--white);
  border: none;
  border-right: 1px solid var(--mist);
  cursor: pointer;
  color: var(--stone);
  font-family: var(--sans);
  transition: all 0.15s;
  text-align: center;
}
.greeting-toggle-btn:last-child { border-right: none; }
.greeting-toggle-btn.active { background: var(--ink); color: var(--white); }
.greeting-alert {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 10px 14px;
  font-size: 13px;
  color: var(--charcoal);
  margin-bottom: 14px;
  line-height: 1.7;
}
.greeting-text {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.75;
  color: var(--ink);
}
.greeting-meta {
  font-size: 11px;
  color: var(--silver);
  margin-top: 14px;
  text-align: right;
}

/* ---- HOME SPLIT (dato + notizia) ---- */
.home-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--mist);
  border: 1px solid var(--mist);
  margin-bottom: 32px;
}
.dato-card, .notizia-card {
  background: var(--white);
  padding: 24px 28px;
}
.home-split.notizia-full .notizia-card { grid-column: 1 / -1; }
.dato-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 6px 0 10px;
  line-height: 1.35;
}
.dato-body {
  font-size: 14px;
  color: var(--charcoal);
  line-height: 1.65;
  margin-bottom: 16px;
}
.dato-cta {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: var(--sans);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dato-cta:hover { text-decoration: underline; }
.notizia-coming {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-top: 8px;
  color: var(--stone);
}
.notizia-coming svg { flex-shrink: 0; color: var(--silver); margin-top: 2px; }
.notizia-coming div { font-size: 13px; line-height: 1.65; }
.notizia-coming strong { color: var(--ink); }
.notizia-tag { font-size: 12px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: 1px; margin: 4px 0 8px; }

@media (max-width: 768px) {
  .home-split { grid-template-columns: 1fr; }
  .greeting-card { padding: 20px 20px; }
  .greeting-text { font-size: 1rem; }
}

/* ---- HOME GRID ---- */
.home-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1px; background: var(--mist); border: 1px solid var(--mist); }
.home-card { background: var(--white); padding: 24px 26px; cursor: pointer; transition: background .15s; }
.home-card:hover { background: var(--cloud); }
.home-card .home-card-icon { color: var(--accent); margin-bottom: 10px; }
.home-card .home-card-icon svg { width: 20px; height: 20px; stroke: currentColor; }
.home-card .home-card-title { font-family: var(--serif); font-size: 1rem; font-weight: 700; margin-bottom: 5px; }
.home-card .home-card-desc { font-size: 13px; color: var(--stone); line-height: 1.5; }

/* ---- SECTION SELECTOR (comune / station dropdowns) ---- */
.section-selector { margin-bottom: 20px; }
.section-selector select {
  padding: 9px 14px; border: 1px solid var(--mist); background: var(--white);
  font-family: var(--sans); font-size: 14px; color: var(--ink); cursor: pointer;
  min-width: 280px; appearance: auto;
}
.section-selector select:focus { outline: none; border-color: var(--stone); }

/* ---- SP TABLE WRAPPER (horizontal scroll on mobile) ---- */
.sp-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sp-table-wrap .sp-table { min-width: 700px; }

/* ---- SECTION SWITCHING ---- */
/* Only the active section is shown; footer always visible */
.main-content section { display: none; }
.main-content section.section-active { display: block; }

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
  .weather-hero { grid-template-columns: 1fr; }
  .weather-hero .main { border-right: none; border-bottom: 1px solid var(--mist); }
  .train-header, .train-row { grid-template-columns: 70px 1fr 90px; }
  .event-row { grid-template-columns: 56px 1fr; }
  .event-tag { display: none; }
  .trasparenza-header, .trasparenza-row { grid-template-columns: 80px 1fr; }
  .trasparenza-tipo, .trasparenza-comune { display: none; }
  .farmacia-grid { grid-template-columns: 1fr; }
  .servizi-grid { grid-template-columns: 1fr; }
  .trasparenza-search { flex-direction: column; }
  .sp-bar-name { width: 100px; font-size: 11px; }
  .sp-bar-value { width: 70px; font-size: 11px; }
  .sp-table { font-size: 11px; }
  .sp-table th, .sp-table td { padding: 8px 10px; }
}
