:root {
    --rosso-cri: #b71c1c;
    --bianco: #ffffff;
    --grigio: #f5f5f5;
  }
  * { margin: 0; padding: 0; box-sizing: border-box; }
  

  html, body{ height:100%; 
    overflow: hidden; /* ✅ scroll solo nel main */
  }
body {
    margin: 0;
    font-family: Arial, sans-serif;
    display: flex;
    min-height: 100vh;
    background: var(--grigio);
  }

  .sidebar {
    width: 260px;
    flex-shrink: 0;
    background: var(--rosso-cri);
    color: var(--bianco);
    display: flex;
    flex-direction: column;
    padding-top: 20px;
    height: 100vh;
    overflow: hidden;
    align-items: center;
  
    position: sticky;
  }
  .sidebar img {
    width: 220px;
    margin-bottom: 20px;
    border-radius: 8px;
  }

  .menu {
    list-style: none;
    padding: 0;
    width: 100%;
    flex-grow: 1;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .menu li { width: 100%; }
  .menu a {
    display: block;
    padding: 15px 20px;
    color: var(--bianco);
    text-decoration: none;
    font-weight: bold;
  }
  .menu a:hover, .menu a.active { background: #9f1b1b; }

  #logout {
    flex-shrink: 0;
    margin: 12px auto 20px auto;
    padding: 10px 20px;
    width: 80%;
    background-color: #fff;
    color: var(--rosso-cri);
    border: 2px solid var(--rosso-cri);
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
  }
  #logout:hover { background-color: var(--rosso-cri); color: #fff; }

  .main {
    flex-grow: 1;
    padding: 30px;
    background: var(--bianco);
    overflow-y: auto;
    position: relative;
  
    height: 100vh;
    flex: 1 1 auto;
  
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}

  .topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 10px;
  }

  .btn-copia-link {
    background: var(--rosso-cri);
    color: var(--bianco);
    border: 2px solid var(--bianco);
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 0.9rem;
    display: none;
    white-space: nowrap;
  }
  .btn-copia-link:hover { background: var(--bianco); color: var(--rosso-cri); }
  .btn-copia-link.copiato { background: #28a745; border-color: #28a745; }

  .main h1 { color: var(--rosso-cri); margin: 0; }

  .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
  }
  .card {
    background: var(--grigio);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  }
  .card h2 { margin-top: 0; color: var(--rosso-cri); font-size: 1.3rem; }
  .card-content { color: #333; line-height: 1.6; }
  .stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--rosso-cri);
    margin: 10px 0;
  }
  .stat-label { color: #666; font-size: 0.9rem; }
  .list-item { padding: 8px 0; border-bottom: 1px solid #e0e0e0; }
  .list-item:last-child { border-bottom: none; }
  .empty-state { color: #999; font-style: italic; padding: 10px 0; }

  @media (max-width: 768px){
    html, body{ height:auto; overflow:auto; }
body { flex-direction: column; 
    .sidebar{ position: relative; height:auto; overflow: visible; width:100%; }

    .menu{ overflow: visible; }

    .main{ height:auto; overflow: visible; }
}
.sidebar { width: 100%; height: auto; padding: 15px; overflow: visible; }
    .menu { overflow: visible; }
    .topbar { flex-direction: column; align-items: stretch; }
    .btn-copia-link { width: 100%; }
    .cards { grid-template-columns: 1fr; }
  }

/* ====== Card uniformi (stile Area Admin) ====== */
.cards{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap:25px;
  align-items: stretch;
}
.card{
  background: rgba(255,255,255,0.95);
  border-radius: 20px;
  padding: 26px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.10);
  border: 1px solid rgba(0,0,0,0.05);
  transition: transform .2s ease, box-shadow .2s ease;
  position: relative;
  overflow: hidden;
  display:flex;
  flex-direction:column;
  gap:10px;
  min-height: 260px;   /* tutte della stessa altezza, meteo compreso */
}
.card::before{
  content:'';
  position:absolute;
  top:0; left:0; right:0;
  height:5px;
  background: linear-gradient(90deg, #b71c1c, #1976d2);
}
.card:hover{
  transform: translateY(-6px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.13);
}
.card h2{
  margin:0;
  color:#b71c1c;
  font-size: 1.3rem;
  font-weight: 800;
  display:flex;
  align-items:center;
  gap:10px;
  line-height:1.2;
}
.card .card-content{
  display:flex;
  flex-direction:column;
  gap:6px;
  flex:1;
}
.card .stat-number{
  font-size: 2.6rem;
  font-weight: 900;
  color:#b71c1c;
  line-height:1;
  margin: 6px 0 0;
}
.card .stat-label{
  font-size: .95rem;
  color:#666;
  font-weight:700;
  margin:0;
}
@media (max-width: 768px){
  .cards{ grid-template-columns: 1fr; gap:18px; }
  .card{ min-height: auto; padding:20px; }
}

/* la bacheca e' alta quanto i suoi avvisi, non quanto gli altri riquadri */
#card-bacheca{ min-height:0; }
