/* ================================================================
   CasaHub — Tema Vivace 🌈
   Font: Fredoka (display) + Nunito (corpo)
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@400;600;700;800;900&display=swap');

/* ── VARIABILI ─────────────────────────────────────────────── */
:root {
  --rosa:       #ff6b9d; --rosa-l:   #ffe0ed; --rosa-d:   #c0306a;
  --giallo:     #ffd166; --giallo-l: #fff8e0; --giallo-d: #c08800;
  --verde:      #06d6a0; --verde-l:  #d1fae5; --verde-d:  #047a5a;
  --azzurro:    #4cc9f0; --azzurro-l:#ddf4fd; --azzurro-d:#0a7fa8;
  --arancio:    #ff9f43; --arancio-l:#fff0dc; --arancio-d:#b86000;
  --viola:      #a78bfa; --viola-l:  #ede9fe; --viola-d:  #5b21b6;
  --corallo:    #ff6b6b; --corallo-l:#ffe0e0; --corallo-d:#b83030;
  --menta:      #51cf66; --menta-l:  #dcfce7; --menta-d:  #166534;

  --bg:       #fff9f0;
  --card:     #ffffff;
  --text:     #2d2040;
  --text-mid: #5a4a70;
  --text-l:   #9a8ab0;

  --bw:         3px;
  --bw-sm:      2px;
  --shadow:     4px 4px 0 rgba(0,0,0,.08);
  --shadow-lg:  0 6px 24px rgba(0,0,0,.08);

  --r-sm:  12px;
  --r-md:  18px;
  --r-lg:  24px;
  --r-xl:  32px;

  --fd:    'Fredoka', 'Nunito', sans-serif;
  --nb:    'Nunito', sans-serif;

  --nav-h:    68px;
  --header-h: 60px;
}

/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; }
body { font-family: var(--nb); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 20px; position: relative; overflow: hidden;
}
.login-screen::before {
  content: ''; position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: var(--rosa-l); top: -80px; right: -80px; z-index: 0;
}
.login-screen::after {
  content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%;
  background: var(--giallo-l); bottom: -60px; left: -60px; z-index: 0;
}
.login-card {
  background: var(--card); border-radius: var(--r-xl); padding: 36px 28px;
  width: 100%; max-width: 380px; border: var(--bw) solid var(--giallo);
  box-shadow: var(--shadow); position: relative; z-index: 1;
}
.login-logo { font-family: var(--fd); font-size: 32px; font-weight: 700; color: var(--rosa); text-align: center; margin-bottom: 4px; }
.login-logo span { color: var(--giallo-d); }
.login-sub { text-align: center; color: var(--text-l); font-size: 14px; font-weight: 700; margin-bottom: 24px; }

/* ── FORM ──────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 800; color: var(--text-mid); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .5px; font-family: var(--fd); }
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%; border: var(--bw) solid var(--giallo); border-radius: var(--r-md);
  padding: 10px 14px; font-family: var(--nb); font-size: 14px; font-weight: 700;
  color: var(--text); background: var(--card); outline: none;
  transition: border-color .2s, box-shadow .2s; -webkit-appearance: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--rosa); box-shadow: 0 0 0 3px var(--rosa-l); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group input[type="checkbox"] { width: auto; height: 20px; accent-color: var(--rosa); }
.form-group input[type="color"] { padding: 4px; height: 42px; cursor: pointer; }
.form-group input[type="file"] { border-style: dashed; background: var(--giallo-l); cursor: pointer; }

.alert-error   { background: var(--corallo-l); color: var(--corallo-d); border: var(--bw) solid var(--corallo); border-radius: var(--r-md); padding: 10px 14px; font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.alert-success { background: var(--verde-l);   color: var(--verde-d);   border: var(--bw) solid var(--verde);   border-radius: var(--r-md); padding: 10px 14px; font-size: 13px; font-weight: 700; margin-bottom: 14px; }

/* ── BOTTONI ───────────────────────────────────────────────── */
.btn-primary {
  width: 100%; background: var(--rosa); color: white;
  border: var(--bw) solid var(--rosa-d); border-radius: var(--r-md);
  padding: 14px; font-family: var(--fd); font-size: 16px; font-weight: 700;
  cursor: pointer; transition: transform .1s, box-shadow .1s;
  touch-action: manipulation; box-shadow: var(--shadow);
}
.btn-primary:active { transform: scale(.97) translateY(2px); box-shadow: 2px 2px 0 rgba(0,0,0,.1); }

.btn {
  border-radius: var(--r-sm); padding: 9px 16px; font-family: var(--fd);
  font-size: 13px; font-weight: 700; cursor: pointer; transition: transform .1s, box-shadow .1s;
  touch-action: manipulation; display: inline-flex; align-items: center; gap: 5px;
  box-shadow: var(--shadow); border-width: var(--bw); border-style: solid;
}
.btn:active { transform: scale(.96) translateY(1px); box-shadow: 1px 1px 0 rgba(0,0,0,.1); }
.btn-sm     { padding: 6px 12px; font-size: 11px; border-radius: 10px; box-shadow: 2px 2px 0 rgba(0,0,0,.07); }
.btn-full   { width: 100%; justify-content: center; }

/* Colori bottoni — tutti con bordo dark */
.btn-rosa    { background: var(--rosa);    color: white;           border-color: var(--rosa-d);    }
.btn-giallo  { background: var(--giallo);  color: var(--text);     border-color: var(--giallo-d);  }
.btn-verde   { background: var(--verde);   color: white;           border-color: var(--verde-d);   }
.btn-azzurro { background: var(--azzurro); color: white;           border-color: var(--azzurro-d); }
.btn-viola   { background: var(--viola);   color: white;           border-color: var(--viola-d);   }
.btn-arancio { background: var(--arancio); color: white;           border-color: var(--arancio-d); }
.btn-menta   { background: var(--menta);   color: white;           border-color: var(--menta-d);   }
.btn-corallo { background: var(--corallo); color: white;           border-color: var(--corallo-d); }
.btn-ghost   { background: var(--card);    color: var(--text-mid); border-color: var(--giallo);    }
.btn-danger  { background: var(--corallo-l); color: var(--corallo-d); border-color: var(--corallo); }

/* Alias per retrocompatibilità */
.btn-mint  { background: var(--verde);   color: white; border-color: var(--verde-d);   }
.btn-lav   { background: var(--viola);   color: white; border-color: var(--viola-d);   }
.btn-rose  { background: var(--rosa);    color: white; border-color: var(--rosa-d);    }
.btn-amber { background: var(--arancio); color: white; border-color: var(--arancio-d); }
.btn-sky   { background: var(--azzurro); color: white; border-color: var(--azzurro-d); }
.btn-peach { background: var(--arancio-l); color: var(--arancio-d); border-color: var(--arancio); }

/* ── APP SHELL ─────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; }

/* ── HEADER ────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h); background: var(--card); display: flex; align-items: center;
  padding: 0 16px; gap: 12px; flex-shrink: 0; position: relative; z-index: 100;
  border-bottom: var(--bw) solid var(--giallo);
}
.app-header::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, var(--rosa), var(--arancio), var(--giallo), var(--verde), var(--azzurro), var(--viola));
}
.header-logo { font-family: var(--fd); font-size: 20px; font-weight: 700; color: var(--rosa); flex-shrink: 0; }
.header-logo span { color: var(--giallo-d); }
.header-center { flex: 1; text-align: center; font-family: var(--fd); font-size: 15px; font-weight: 700; color: var(--text); }
.header-right { display: flex; align-items: center; gap: 8px; }
.notif-bell {
  font-size: 18px; cursor: pointer; position: relative; width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--giallo-l); border-radius: 10px; border: var(--bw-sm) solid var(--giallo);
}
.notif-badge {
  position: absolute; top: -5px; right: -5px; background: var(--rosa); color: white;
  font-size: 9px; font-weight: 900; border-radius: 50%; width: 17px; height: 17px;
  display: flex; align-items: center; justify-content: center; border: 2px solid white;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 10px; background: var(--viola-l);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  cursor: pointer; border: var(--bw-sm) solid var(--viola);
}
.user-menu {
  position: absolute; top: calc(var(--header-h) + 4px); right: 12px;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  z-index: 200; min-width: 160px; overflow: hidden; border: var(--bw) solid var(--giallo);
}
.um-nome { padding: 12px 16px; font-size: 13px; font-weight: 800; color: var(--text-l); border-bottom: 2px solid var(--giallo-l); font-family: var(--fd); }
.um-item { padding: 12px 16px; font-size: 14px; font-weight: 700; color: var(--text); cursor: pointer; transition: background .15s; font-family: var(--fd); }
.um-item:hover { background: var(--giallo-l); }

/* ── NAVIGAZIONE ───────────────────────────────────────────── */
.app-nav {
  height: var(--nav-h); background: var(--card); display: flex; overflow-x: auto;
  scrollbar-width: none; -webkit-overflow-scrolling: touch; flex-shrink: 0;
  border-bottom: var(--bw) solid var(--giallo-l); padding: 4px; align-items: center;
}
.app-nav::-webkit-scrollbar { display: none; }
.nav-btn {
  flex-shrink: 0; border: none; background: transparent; padding: 6px 10px;
  font-family: var(--fd); font-size: 11px; font-weight: 600; color: var(--text-l);
  cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px;
  transition: all .15s; touch-action: manipulation; min-width: 58px;
  border-radius: var(--r-sm); margin: 2px; position: relative;
}
/* emoji via data-icon attribute */
.nav-btn::before { content: attr(data-icon); font-size: 22px; line-height: 1; display: block; }
.nav-btn span { font-size: 10px; white-space: nowrap; }

/* Colori attivi per sezione */
.nav-btn.active { color: var(--rosa-d); background: var(--rosa-l); }
.nav-btn.active::after { content: ''; position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%); width: 20px; height: 3px; background: var(--rosa); border-radius: 3px; }
.nav-btn[data-sec="calendario"].active,  .nav-btn[data-sec="frigo"].active      { background: var(--azzurro-l); color: var(--azzurro-d); }
.nav-btn[data-sec="calendario"].active::after, .nav-btn[data-sec="frigo"].active::after { background: var(--azzurro); }
.nav-btn[data-sec="ricette"].active,     .nav-btn[data-sec="animali"].active    { background: var(--arancio-l); color: var(--arancio-d); }
.nav-btn[data-sec="ricette"].active::after, .nav-btn[data-sec="animali"].active::after { background: var(--arancio); }
.nav-btn[data-sec="spese"].active,       .nav-btn[data-sec="consumi"].active    { background: var(--giallo-l);  color: var(--giallo-d);  }
.nav-btn[data-sec="spese"].active::after, .nav-btn[data-sec="consumi"].active::after { background: var(--giallo); }
.nav-btn[data-sec="lista-spesa"].active, .nav-btn[data-sec="manutenzioni"].active { background: var(--verde-l);  color: var(--verde-d);  }
.nav-btn[data-sec="lista-spesa"].active::after, .nav-btn[data-sec="manutenzioni"].active::after { background: var(--verde); }
.nav-btn[data-sec="task"].active,        .nav-btn[data-sec="scuola"].active     { background: var(--menta-l);  color: var(--menta-d);  }
.nav-btn[data-sec="task"].active::after, .nav-btn[data-sec="scuola"].active::after { background: var(--menta); }
.nav-btn[data-sec="salute"].active,      .nav-btn[data-sec="documenti"].active  { background: var(--viola-l);  color: var(--viola-d);  }
.nav-btn[data-sec="salute"].active::after, .nav-btn[data-sec="documenti"].active::after { background: var(--viola); }
.nav-btn[data-sec="veicoli"].active      { background: var(--azzurro-l); color: var(--azzurro-d); }
.nav-btn[data-sec="veicoli"].active::after { background: var(--azzurro); }
.nav-btn[data-sec="inventario"].active,  .nav-btn[data-sec="viaggi"].active     { background: var(--rosa-l);   color: var(--rosa-d);   }
.nav-btn[data-sec="domotica"].active     { background: var(--giallo-l); color: var(--giallo-d); }
.nav-btn[data-sec="telecamere"].active   { background: var(--viola-l);  color: var(--viola-d);  }
.nav-btn[data-sec="assistente"].active   { background: var(--viola-l);  color: var(--viola-d);  }
.nav-btn[data-sec="assistente"].active::after { background: var(--viola); }

/* ── MAIN ──────────────────────────────────────────────────── */
.app-main { flex: 1; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; padding: 14px 14px 90px; }
.app-main::-webkit-scrollbar { width: 5px; }
.app-main::-webkit-scrollbar-thumb { background: var(--giallo); border-radius: 5px; }

/* ── SEZIONE HEADER ────────────────────────────────────────── */
.sec-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.sec-title { font-family: var(--fd); font-size: 22px; font-weight: 700; color: var(--text); }

/* ── CARD ──────────────────────────────────────────────────── */
.card {
  background: var(--card); border-radius: var(--r-lg); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 12px;
  border: var(--bw) solid var(--giallo-l);
  animation: bounceIn .35s ease both;
}
.card:nth-child(1) { animation-delay: .05s; }
.card:nth-child(2) { animation-delay: .10s; }
.card:nth-child(3) { animation-delay: .15s; }
.card:nth-child(4) { animation-delay: .20s; }
.card:nth-child(5) { animation-delay: .25s; }
.card:nth-child(6) { animation-delay: .30s; }

.card-rosa    { border-color: var(--rosa);    }
.card-verde   { border-color: var(--verde);   }
.card-azzurro { border-color: var(--azzurro); }
.card-viola   { border-color: var(--viola);   }
.card-arancio { border-color: var(--arancio); }
.card-giallo  { border-color: var(--giallo);  }
.card-menta   { border-color: var(--menta);   }
.card-corallo { border-color: var(--corallo); }

.card-title { font-family: var(--fd); font-size: 13px; font-weight: 700; color: var(--text-mid); margin-bottom: 10px; display: flex; align-items: center; gap: 5px; }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; flex-wrap: wrap; gap: 8px; }
.card-header h2 { font-family: var(--fd); font-size: 18px; font-weight: 700; color: var(--text); }

/* ── GRIGLIE ───────────────────────────────────────────────── */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
@media (max-width: 480px) { .grid3 { grid-template-columns: 1fr 1fr; } }

/* ── STAT CARDS ────────────────────────────────────────────── */
.stat-card {
  border-radius: var(--r-lg); padding: 14px 12px; text-align: center;
  border: var(--bw) solid transparent; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .15s;
}
.stat-card:hover  { transform: translateY(-3px); }
.stat-card:active { transform: scale(.97); }
.stat-num   { font-family: var(--fd); font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-label { font-size: 10px; font-weight: 800; margin-top: 3px; font-family: var(--fd); }

/* ── LIST ITEMS ────────────────────────────────────────────── */
.list-item { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 2px dashed var(--giallo-l); }
.list-item:last-child { border-bottom: none; }
.item-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; border: 2px solid rgba(0,0,0,.1); }
.item-em  { font-size: 24px; width: 38px; text-align: center; flex-shrink: 0; }
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 14px; font-weight: 800; color: var(--text); font-family: var(--fd); }
.item-sub  { font-size: 11px; color: var(--text-l); margin-top: 1px; font-weight: 600; }
.item-badge { border-radius: 20px; padding: 4px 10px; font-size: 10px; font-weight: 800; flex-shrink: 0; font-family: var(--fd); border: var(--bw-sm) solid transparent; }
.badge-ok    { background: var(--verde-l);   color: var(--verde-d);   border-color: var(--verde);   }
.badge-warn  { background: var(--giallo-l);  color: var(--giallo-d);  border-color: var(--giallo);  }
.badge-err   { background: var(--corallo-l); color: var(--corallo-d); border-color: var(--corallo); }
.badge-info  { background: var(--azzurro-l); color: var(--azzurro-d); border-color: var(--azzurro); }
.badge-lav   { background: var(--viola-l);   color: var(--viola-d);   border-color: var(--viola);   }

/* ── CHIPS ─────────────────────────────────────────────────── */
.chip { display: inline-flex; align-items: center; gap: 4px; border-radius: 20px; padding: 4px 10px; font-size: 11px; font-weight: 800; font-family: var(--fd); border: var(--bw-sm) solid transparent; }
.chip-mint  { background: var(--verde-l);   color: var(--verde-d);   border-color: var(--verde);   }
.chip-lav   { background: var(--viola-l);   color: var(--viola-d);   border-color: var(--viola);   }
.chip-rose  { background: var(--rosa-l);    color: var(--rosa-d);    border-color: var(--rosa);    }
.chip-sky   { background: var(--azzurro-l); color: var(--azzurro-d); border-color: var(--azzurro); }
.chip-amber { background: var(--arancio-l); color: var(--arancio-d); border-color: var(--arancio); }
.chip-peach { background: var(--arancio-l); color: var(--arancio-d); border-color: var(--arancio); }

/* ── BANNER COLORATI ───────────────────────────────────────── */
.banner { border-radius: var(--r-lg); padding: 12px 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; border: var(--bw) solid transparent; }
.banner-rosa    { background: var(--rosa-l);    border-color: var(--rosa);    }
.banner-verde   { background: var(--verde-l);   border-color: var(--verde);   }
.banner-giallo  { background: var(--giallo-l);  border-color: var(--giallo);  }
.banner-azzurro { background: var(--azzurro-l); border-color: var(--azzurro); }
.banner-arancio { background: var(--arancio-l); border-color: var(--arancio); }
.banner-viola   { background: var(--viola-l);   border-color: var(--viola);   }
.banner-testo   { font-family: var(--fd); font-size: 13px; font-weight: 600; color: var(--text); }

/* ── SEZIONE TABS ──────────────────────────────────────────── */
.sec-tabs { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sec-tabs::-webkit-scrollbar { display: none; }
.stab { flex-shrink: 0; border: var(--bw) solid var(--giallo-l); border-radius: 20px; padding: 6px 14px; font-family: var(--fd); font-size: 12px; font-weight: 600; cursor: pointer; background: var(--card); color: var(--text-l); transition: all .15s; touch-action: manipulation; }
.stab.on { background: var(--giallo-l); color: var(--giallo-d); border-color: var(--giallo); box-shadow: var(--shadow); }

/* ── PROGRESS BAR ──────────────────────────────────────────── */
.prog-bar  { height: 10px; border-radius: 20px; background: var(--giallo-l); overflow: hidden; border: var(--bw-sm) solid var(--giallo); }
.prog-fill { height: 100%; border-radius: 20px; transition: width .5s; }

/* ── TOGGLE ────────────────────────────────────────────────── */
.toggle { width: 46px; height: 26px; border-radius: 20px; border: var(--bw-sm) solid transparent; cursor: pointer; position: relative; flex-shrink: 0; transition: background .2s; touch-action: manipulation; }
.toggle.on  { background: var(--verde);  border-color: var(--verde-d); }
.toggle.off { background: #ddd; border-color: #bbb; }
.toggle::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: white; top: 2px; transition: left .2s; box-shadow: 1px 1px 3px rgba(0,0,0,.2); }
.toggle.on::after  { left: 24px; }
.toggle.off::after { left: 2px; }

/* ── FAB ───────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: calc(var(--nav-h) + 14px); right: 16px;
  width: 56px; height: 56px; border-radius: 18px; background: var(--rosa); color: white;
  font-size: 26px; border: var(--bw) solid var(--rosa-d); cursor: pointer;
  box-shadow: 4px 4px 0 var(--rosa-d); z-index: 50;
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s, box-shadow .15s; touch-action: manipulation;
  font-family: var(--fd); font-weight: 700;
}
.fab:hover  { transform: translateY(-2px); box-shadow: 4px 6px 0 var(--rosa-d); }
.fab:active { transform: scale(.92) translateY(2px); box-shadow: 2px 2px 0 var(--rosa-d); }

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(45,32,64,.5); z-index: 300; display: flex; align-items: flex-end; justify-content: center; }
.modal-card { background: var(--card); border-radius: var(--r-xl) var(--r-xl) 0 0; width: 100%; max-width: 600px; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; border: var(--bw) solid var(--giallo); border-bottom: none; }
.modal-header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 2px dashed var(--giallo-l); background: var(--giallo-l); }
.modal-title { font-family: var(--fd); font-size: 17px; font-weight: 700; color: var(--text); flex: 1; }
.modal-close { background: var(--rosa-l); border: var(--bw-sm) solid var(--rosa); border-radius: 10px; width: 32px; height: 32px; font-size: 14px; font-weight: 900; color: var(--rosa-d); cursor: pointer; display: flex; align-items: center; justify-content: center; font-family: var(--fd); }
.modal-body { flex: 1; overflow-y: auto; padding: 16px 20px; }

/* ── TOAST ─────────────────────────────────────────────────── */
.toast-container { position: fixed; top: calc(var(--header-h) + 8px); right: 12px; z-index: 500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--card); border-radius: var(--r-md); padding: 10px 16px; font-family: var(--fd); font-size: 13px; font-weight: 700; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 8px; animation: slideIn .3s ease; pointer-events: auto; min-width: 200px; max-width: 300px; border: var(--bw) solid var(--giallo); }
.toast.success { border-color: var(--verde);   }
.toast.error   { border-color: var(--corallo); }
.toast.info    { border-color: var(--azzurro); }
@keyframes slideIn  { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slideOut { to   { transform: translateX(120%); opacity: 0; } }

/* ── SPINNER ───────────────────────────────────────────────── */
.spinner { display: flex; justify-content: center; padding: 40px; }
.spin { width: 40px; height: 40px; border: 4px solid var(--giallo-l); border-top-color: var(--rosa); border-right-color: var(--azzurro); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── EMPTY STATE ───────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; }
.empty-state .empty-em { font-size: 56px; margin-bottom: 12px; display: block; }
.empty-state p { font-family: var(--fd); font-size: 16px; font-weight: 600; color: var(--text-l); }

/* ── ANIMAZIONI ────────────────────────────────────────────── */
@keyframes bounceIn {
  0%   { transform: scale(.85) translateY(8px); opacity: 0; }
  60%  { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}

/* ── TABLET ────────────────────────────────────────────────── */
@media (min-width: 768px) {
  .app-main   { padding: 20px 28px 90px; max-width: 100%; }
  .nav-btn    { min-width: 72px; font-size: 12px; }
  .card:hover { transform: translateY(-2px); box-shadow: 6px 6px 0 rgba(0,0,0,.09); }
  .modal-overlay { align-items: center; padding: 20px; }
  .modal-card    { border-radius: var(--r-xl); max-height: 85vh; border-bottom: var(--bw) solid var(--giallo); }
}
@media (min-width: 1024px) { .app-main { max-width: 100%; padding: 24px 40px 90px; } }

/* ── ACCESSIBILITÀ ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--rosa); outline-offset: 2px; }

/* ── LAYOUT RESPONSIVE OTTIMIZZATO ─────────────────────────── */
@media (min-width: 1200px) {
  .app-main { padding: 28px 48px 90px; }
  .grid2 { gap: 16px; }
  .grid3 { grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
  .card  { padding: 20px; }
  .sec-title { font-size: 26px; }
  .stat-num  { font-size: 34px; }
}

/* ── LAYOUT TABLET LANDSCAPE (es. tablet Android 10") ───────── */
@media (min-width: 900px) and (max-width: 1199px) {
  .app-main { padding: 20px 32px 90px; }
  .grid2 { gap: 14px; }
  .grid3 { gap: 12px; }
}

/* ── SMARTPHONE (fino a 480px) ──────────────────────────────── */
@media (max-width: 480px) {
  .app-main { padding: 12px 12px 80px; }
  .grid2 { grid-template-columns: 1fr; gap: 10px; }
  .sec-title { font-size: 18px; }
  .stat-num  { font-size: 24px; }
  .nav-btn   { min-width: 52px; padding: 5px 8px; }
  .nav-btn::before { font-size: 20px; }
  .nav-btn span { font-size: 9px; }
}

/* ── SMARTPHONE MEDIO (481-767px) ───────────────────────────── */
@media (min-width: 481px) and (max-width: 767px) {
  .app-main { padding: 14px 16px 80px; }
  .grid2 { gap: 10px; }
}

/* ── NAV su schermi grandi: mostra icone più grandi ─────────── */
@media (min-width: 768px) {
  .nav-btn::before { font-size: 24px; }
  .nav-btn span    { font-size: 11px; }
  .nav-btn         { min-width: 76px; padding: 7px 12px; }
  --nav-h: 72px;
}
