:root {
  --blu: #1f7cf2;
  --blu-scuro: #1260c9;
  --blu-chiaro: #e8f1ff;
  --sfondo: #eef2fb;
  --card: #ffffff;
  --testo: #18233a;
  --testo-2: #5b6782;
  --muto: #8f99b0;
  --bordo: #e3e8f2;
  --verde: #12a150;
  --verde-chiaro: #e3f7ec;
  --rosso: #e0464b;
  --rosso-chiaro: #fde8e9;
  --giallo: #f5a524;
  --ciano: #22c3e6;
  --oro: #ffc531;
  --rosa: #f37ba6;
  --turchese: #19cfc0;
  --viola: #7c6cf2;
  --arancio: #ff8a3d;
  --raggio: 20px;
  --ombra: 0 6px 24px rgba(31, 60, 120, .08);
  --nav-h: 68px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--sfondo);
  color: var(--testo);
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
svg { width: 20px; height: 20px; flex: none; }
a { color: var(--blu); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.hidden { display: none !important; }
.muted { color: var(--muto); }
.small { font-size: 12.5px; }
.error { color: var(--rosso); min-height: 1em; font-size: 13.5px; margin: 0; }
input, select, textarea, button { font: inherit; color: inherit; }

/* ---------- pulsanti e campi ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 14px; padding: 10px 16px; cursor: pointer;
  background: var(--blu-chiaro); color: var(--blu); font-weight: 600; font-size: 14px;
  white-space: nowrap; transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.97); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--blu); color: #fff; }
.btn.primary:hover { background: var(--blu-scuro); }
.btn.success { background: var(--verde); color: #fff; }
.btn.danger { background: var(--rosso-chiaro); color: var(--rosso); }
.btn.ghost { background: transparent; color: var(--testo-2); }
.btn.big { width: 100%; padding: 14px; font-size: 16px; border-radius: 16px; }
.btn.icon { padding: 8px; border-radius: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.cyan { background: #3cc8f0; color: #fff; }

label { display: block; font-size: 13px; font-weight: 500; color: var(--testo-2); }
input, select, textarea {
  display: block; width: 100%; margin-top: 4px;
  border: 1.5px solid var(--bordo); border-radius: 12px; background: #fff;
  padding: 10px 12px; font-size: 16px; outline: none; -webkit-appearance: none; appearance: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--blu); }
textarea { resize: vertical; min-height: 70px; }
input[type=checkbox] { display: inline; width: 18px; height: 18px; margin: 0 6px 0 0; padding: 0; vertical-align: -3px; -webkit-appearance: checkbox; appearance: auto; }
select { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6782' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 16px; padding-right: 36px; }

/* ---------- login ---------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 16px;
  background: linear-gradient(160deg, #3f93f7 0%, var(--blu) 55%, #1662d0 100%);
}
.login-card {
  width: 100%; max-width: 380px; background: #fff; border-radius: 28px;
  padding: 32px 26px; box-shadow: 0 20px 60px rgba(0,0,0,.18); display: grid; gap: 14px;
}
.login-card h1 { font-size: 24px; }
.login-card p { margin: 0; }
.login-logo {
  width: 60px; height: 60px; border-radius: 18px; background: var(--blu-chiaro); color: var(--blu);
  display: grid; place-items: center;
}
.login-logo svg { width: 32px; height: 32px; }

/* ---------- layout ---------- */
#app { min-height: 100vh; }
main { padding-bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
.nav {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; height: var(--nav-h);
  background: #fff; display: flex; justify-content: space-around; align-items: center;
  box-shadow: 0 -4px 20px rgba(31,60,120,.08); padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
}
.nav a {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px;
  color: var(--muto); font-weight: 500; padding: 6px 8px; border-radius: 14px;
}
.nav a.active { color: var(--blu); }
.nav a svg { width: 23px; height: 23px; }
.nav-brand, .nav .lungo { display: none !important; }
body { overflow-x: hidden; }

.page { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.section { margin-top: 22px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.section-head h3 { color: var(--testo); }
.section-head .link { font-size: 13px; color: var(--muto); }
.card { background: var(--card); border-radius: var(--raggio); box-shadow: var(--ombra); padding: 18px; }

/* tablet (iPad verticale): barra laterale compatta con icone */
@media (min-width: 700px) {
  main { padding: 0 0 40px calc(92px + env(safe-area-inset-left)); }
  .nav {
    top: 0; bottom: 0; right: auto; width: calc(92px + env(safe-area-inset-left)); height: auto;
    flex-direction: column; justify-content: flex-start; align-items: stretch; gap: 6px;
    padding: calc(18px + env(safe-area-inset-top)) 10px 18px calc(10px + env(safe-area-inset-left));
    box-shadow: 4px 0 24px rgba(31,60,120,.06);
  }
  .nav a { flex: 0 0 auto; padding: 10px 4px; font-size: 11.5px; }
  .nav a.active { background: var(--blu); color: #fff; }
  .page { padding: 0 24px; }
  .toast { bottom: 24px; }
}
/* computer e iPad orizzontale: barra laterale completa */
@media (min-width: 1100px) {
  main { padding: 0 0 40px 240px; }
  .nav { width: 240px; gap: 4px; padding: 22px 14px; }
  .nav a { flex-direction: row; gap: 12px; font-size: 15px; padding: 12px 14px; }
  .nav-brand { display: flex !important; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--blu); padding: 4px 10px 22px; }
  .nav-brand svg { width: 28px; height: 28px; }
  .nav .lungo { display: inline !important; }
  .nav .corto { display: none; }
  .page { padding: 0 32px; }
}
@media (min-width: 1600px) { body { font-size: 16px; } .page, .hero-inner { max-width: 1320px; } }

/* ---------- testata blu ---------- */
.hero {
  background: linear-gradient(150deg, #3d92f8 0%, var(--blu) 60%, #1868dc 100%);
  color: #fff; border-radius: 0 0 34px 34px; padding: calc(18px + env(safe-area-inset-top)) 16px 26px; margin-bottom: 6px;
}
.hero-inner { max-width: 1180px; margin: 0 auto; }
@media (min-width: 700px) { .hero { margin: 0 24px 6px; } .hero-inner { padding: 0 8px; } }
@media (min-width: 1100px) { .hero { margin: 0 32px 6px; } }
.hero h1 { font-size: 28px; font-weight: 700; margin-top: 18px; }
.hero p { margin: 4px 0 0; opacity: .85; font-size: 14px; }
.hero .bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.hero .user-pill { display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: .95; }
.hero .user-pill .btn { background: rgba(255,255,255,.18); color: #fff; }
.searchbox { position: relative; flex: 1; }
.searchbox svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #fff; opacity: .9; }
.searchbox input {
  margin: 0; padding: 12px 14px 12px 44px; border: 0; border-radius: 16px;
  background: rgba(255,255,255,.2); color: #fff;
}
.searchbox input::placeholder { color: rgba(255,255,255,.85); }
.hero .dash { width: 50px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.55); margin: 18px auto 0; }

/* ---------- zone (riquadri colorati) ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 640px) { .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  border: 0; cursor: pointer; text-align: left; color: #fff; border-radius: 18px; padding: 14px;
  display: flex; align-items: center; gap: 12px; min-height: 76px; position: relative; overflow: hidden;
  box-shadow: 0 6px 16px rgba(31,60,120,.10); transition: transform .1s;
}
.tile:active { transform: scale(.97); }
.tile .ico { width: 42px; height: 42px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); display: grid; place-items: center; flex: none; }
.tile .ico svg { width: 22px; height: 22px; }
.tile b { display: block; font-size: 14px; line-height: 1.25; overflow-wrap: break-word; }
.tile > div:last-child { min-width: 0; }
.tile span { font-size: 12px; opacity: .92; }
.tile.sel { outline: 3px solid var(--testo); outline-offset: 2px; }
.c0 { background: var(--ciano); } .c1 { background: var(--oro); } .c2 { background: var(--rosa); }
.c3 { background: var(--turchese); } .c4 { background: var(--viola); } .c5 { background: var(--arancio); }
.c6 { background: var(--blu); } .c7 { background: #4bb35a; }

/* ---------- chip (comuni) ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  border: 0; background: transparent; color: var(--blu); font-weight: 600; font-size: 14px;
  padding: 6px 4px; cursor: pointer; white-space: nowrap; border-bottom: 3px solid transparent;
}
.chip.sel { border-bottom-color: var(--blu); color: var(--testo); }
.chip small { color: var(--muto); font-weight: 500; }

/* ---------- striscia giorni ---------- */
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; background: #e4e9f3; border-radius: 18px; padding: 10px; }
.day { border: 0; background: transparent; border-radius: 14px; padding: 6px 0; cursor: pointer; color: var(--blu); text-align: center; }
.day b { display: block; font-size: 12.5px; font-weight: 600; }
.day span { font-size: 17px; font-weight: 600; color: var(--testo); }
.day.sel { background: var(--blu); color: #fff; }
.day.sel span { color: #fff; }
.day.weekend { opacity: .55; }
.day.oggi span { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- schede medico ---------- */
.docs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.doc {
  background: #fff; border-radius: 18px; box-shadow: var(--ombra); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: transform .1s;
}
.doc:hover { transform: translateY(-2px); }
.doc .ph { background: linear-gradient(160deg, #3d92f8, var(--blu)); aspect-ratio: 1 / .92; display: grid; place-items: end center; overflow: hidden; position: relative; }
.doc .ph img { width: 100%; height: 100%; object-fit: cover; }
.doc .ph .ini { place-self: center; font-size: 38px; font-weight: 700; color: rgba(255,255,255,.95); }
.doc .ph .badge { position: absolute; top: 8px; left: 8px; }
.doc .body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.doc .nome { font-weight: 600; font-size: 14px; color: var(--blu); line-height: 1.25; }
.doc .spec { font-size: 12.5px; color: var(--testo-2); }
.doc .str { font-size: 11.5px; color: var(--muto); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc .orario { font-size: 12px; font-weight: 600; color: var(--testo); margin-top: 4px; }
.doc .acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.doc .acts .btn { flex: 1 1 64px; min-width: 0; padding: 8px 4px; font-size: 12px; gap: 3px; border-radius: 10px; }
.doc .acts .btn svg { width: 15px; height: 15px; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 20px; background: var(--blu-chiaro); color: var(--blu); }
.badge.ok { background: var(--verde-chiaro); color: var(--verde); }
.badge.warn { background: #fff4dc; color: #a56a00; }
.badge.no { background: var(--rosso-chiaro); color: var(--rosso); }
.badge.white { background: rgba(255,255,255,.92); color: var(--blu); }

/* lista compatta */
.list { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); }
.row {
  background: #fff; border-radius: 16px; box-shadow: var(--ombra); padding: 12px; display: flex; gap: 12px; align-items: center; cursor: pointer;
}
.avatar { width: 46px; height: 46px; border-radius: 14px; background: var(--blu); color: #fff; display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.row .main { flex: 1; min-width: 0; }
.row .main b { display: block; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .main span { display: block; font-size: 12.5px; color: var(--testo-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .side { display: flex; gap: 6px; align-items: center; }
.row.effettuata { border-left: 5px solid var(--verde); }
.row.pianificata { border-left: 5px solid var(--blu); }
.row.annullata { border-left: 5px solid var(--muto); opacity: .7; }

.group-title { font-size: 13px; font-weight: 600; color: var(--testo-2); margin: 18px 0 8px; display: flex; align-items: center; gap: 6px; }
.group-title svg { width: 16px; height: 16px; color: var(--blu); }

.empty { text-align: center; color: var(--muto); padding: 28px 12px; background: #fff; border-radius: 18px; border: 2px dashed var(--bordo); }

/* ---------- scheda dettaglio ---------- */
.profile-hero {
  background: linear-gradient(160deg, #3d92f8, var(--blu)); border-radius: 0 0 0 0; position: relative;
  height: 300px; display: grid; place-items: end center; overflow: hidden;
}
@media (min-width: 700px) { .profile-hero { margin: 0 24px; border-radius: 0 0 34px 34px; height: 340px; } }
@media (min-width: 1100px) { .profile-hero { margin: 0 32px; } }
.profile-hero img { height: 100%; width: 100%; object-fit: cover; }
@media (min-width: 640px) { .profile-hero img { width: auto; max-width: 100%; } }
.profile-hero .ini { place-self: center; font-size: 84px; font-weight: 700; color: rgba(255,255,255,.9); }
.profile-hero .tl, .profile-hero .tr { position: absolute; top: calc(16px + env(safe-area-inset-top)); display: flex; gap: 8px; }
.profile-hero .tl { left: 16px; } .profile-hero .tr { right: 16px; }
.round { width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.95); color: var(--blu); display: grid; place-items: center; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.profile-card { position: relative; margin: -34px auto 0; max-width: 820px; background: #fff; border-radius: 30px 30px 24px 24px; padding: 22px 20px; box-shadow: var(--ombra); }
.profile-card h2 { color: var(--blu); font-size: 22px; }
.profile-card .spec { color: var(--ciano); font-weight: 600; margin-top: 2px; }
.profile-card .contacts { display: flex; gap: 8px; }
.profile-card .contacts a { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--blu-chiaro); color: var(--blu); }
.profile-card .contacts svg { width: 17px; height: 17px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; border-top: 1.5px solid var(--bordo); border-bottom: 1.5px solid var(--bordo); padding: 12px 0; margin: 16px 0; }
.stats div { display: grid; gap: 2px; }
.stats b { font-size: 12.5px; color: var(--blu); font-weight: 600; }
.stats span { font-size: 14px; font-weight: 500; }
.info { display: grid; gap: 14px; }
.info h4 { margin: 0 0 4px; font-size: 15px; }
.info p { margin: 0; color: var(--testo-2); font-size: 14px; white-space: pre-wrap; }
.week { background: #e4e9f3; border-radius: 20px; padding: 14px; margin-top: 18px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.week div b { display: block; color: var(--blu); font-size: 13px; }
.week div span { display: block; font-size: 12px; font-weight: 600; margin-top: 4px; min-height: 2.4em; word-break: break-word; }
.week div.off span { color: var(--muto); font-weight: 400; }
.week div.oggi { background: #fff; border-radius: 12px; padding: 4px 0; }

/* ---------- calendario ---------- */
.week-nav { display: flex; align-items: center; justify-content: center; gap: 14px; }
.week-nav h3 { min-width: 200px; text-align: center; color: var(--blu); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters > * { flex: 1 1 160px; }
.cal { display: grid; gap: 14px; margin-top: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .cal { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; } }
@media (min-width: 1100px) { .cal { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1400px) { .cal { grid-template-columns: repeat(var(--ng, 5), minmax(0, 1fr)); } }
.cal-day { background: #fff; border-radius: 18px; box-shadow: var(--ombra); padding: 12px; }
.cal-day.oggi { outline: 2.5px solid var(--blu); }
.cal-day header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.cal-day header b { font-size: 15px; }
.cal-day header span { color: var(--muto); font-size: 13px; }
.visit { border-radius: 12px; padding: 8px 10px; background: var(--blu-chiaro); margin-bottom: 8px; cursor: pointer; font-size: 13px; }
.visit b { display: block; color: var(--testo); font-size: 13.5px; }
.visit span { color: var(--testo-2); }
.visit.effettuata { background: var(--verde-chiaro); }
.visit.annullata { background: #f0f1f4; text-decoration: line-through; opacity: .7; }
.sugg { margin-top: 8px; border-top: 1.5px dashed var(--bordo); padding-top: 8px; }
.sugg summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--blu); }
.sugg-item { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12.5px; padding: 6px 0; border-bottom: 1px solid var(--bordo); }
.sugg-item div { min-width: 0; }
.sugg-item b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sugg-item span { color: var(--muto); }
.sugg-item .btn { padding: 4px 8px; border-radius: 9px; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi { border-radius: 18px; padding: 16px; color: #fff; box-shadow: 0 6px 16px rgba(31,60,120,.10); }
.kpi b { font-size: 30px; font-weight: 700; display: block; line-height: 1.1; }
.kpi span { font-size: 13px; opacity: .95; }
.kpi.c1, .kpi.c3 { color: #1b2333; }
.grid2 { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1000px) { .grid2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.chart-box { position: relative; height: 260px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; color: var(--muto); font-weight: 500; font-size: 12px; padding: 6px 8px; border-bottom: 1.5px solid var(--bordo); }
.table td { padding: 8px; border-bottom: 1px solid var(--bordo); vertical-align: middle; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.meter { height: 8px; border-radius: 6px; background: var(--blu-chiaro); overflow: hidden; min-width: 70px; }
.meter i { display: block; height: 100%; background: var(--blu); border-radius: 6px; }
.scroll-x { overflow-x: auto; }

/* ---------- modale ---------- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(15,25,50,.45); display: grid; place-items: end center; }
@media (min-width: 640px) { .modal { place-items: center; } }
.modal-box {
  background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow: auto;
  border-radius: 26px 26px 0 0; padding: 22px 18px calc(22px + env(safe-area-inset-bottom));
}
@media (min-width: 640px) { .modal-box { border-radius: 26px; padding: 26px; } }
.modal-box h2 { margin-bottom: 14px; }
.form { display: grid; gap: 12px; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form .five { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.form .five input { padding: 8px 6px; font-size: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; flex-wrap: wrap; }
.form-actions .spacer { flex: 1; }
.picker { max-height: 260px; overflow: auto; border: 1.5px solid var(--bordo); border-radius: 12px; }
.picker div { padding: 9px 12px; border-bottom: 1px solid var(--bordo); cursor: pointer; font-size: 14px; }
.picker div:hover, .picker div.sel { background: var(--blu-chiaro); }
.picker small { color: var(--muto); display: block; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--testo); color: #fff; padding: 11px 18px; border-radius: 14px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 60; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--rosso); }

.preview { max-height: 320px; overflow: auto; border: 1.5px solid var(--bordo); border-radius: 12px; }
.preview table { font-size: 12px; }
.preview td, .preview th { white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.steps { margin: 0; padding-left: 20px; color: var(--testo-2); font-size: 14px; display: grid; gap: 4px; }
.loading { text-align: center; color: var(--muto); padding: 40px; }

/* telefono: riquadri e menu più compatti */
@media (max-width: 699px) {
  .tile { min-height: 62px; padding: 10px 12px; gap: 10px; border-radius: 16px; }
  .tile .ico { width: 34px; height: 34px; }
  .tile .ico svg { width: 18px; height: 18px; }
  .tile b { font-size: 13px; }
  .tile span { font-size: 11.5px; }
  .tiles { gap: 10px; }
  .nav a { font-size: 10px; padding: 6px 2px; }
  .nav a.no-tel { display: none; }
  .hero h1 { font-size: 25px; margin-top: 14px; }
}

/* ---------- note libere ---------- */
.nota { background: #fff8e1; border-radius: 16px; padding: 12px 14px; box-shadow: var(--ombra); cursor: pointer; border-left: 5px solid var(--oro); }
.nota p { margin: 0; white-space: pre-wrap; font-size: 14px; color: var(--testo); overflow-wrap: anywhere; }
.nota .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--testo-2); }
.nota .meta .badge { background: #fff; }
.nota.mini { padding: 8px 10px; border-radius: 12px; margin-bottom: 8px; box-shadow: none; }
.nota.mini p { font-size: 13px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cal-day header .btns { display: flex; gap: 6px; }
.btn.nota-btn { background: #fff4d0; color: #9a6a00; }

/* ---------- strutture e contatti ---------- */
.chips.strutture { align-items: center; gap: 6px; margin-top: 2px; }
.chips.strutture > svg { width: 18px; height: 18px; color: var(--muto); flex: none; }
.chips.strutture .chip { background: #fff; border: 1.5px solid var(--bordo); border-radius: 20px; padding: 6px 12px; font-size: 13px; color: var(--testo-2); }
.chips.strutture .chip.sel { background: var(--blu); border-color: var(--blu); color: #fff; }
.chips.strutture .chip.sel small { color: rgba(255,255,255,.85); }
.chips.strutture .chip.nuova { display: inline-flex; align-items: center; gap: 4px; color: var(--blu); border-style: dashed; }
.chips.strutture .chip.nuova svg { width: 14px; height: 14px; }
.str-card { border-top: 5px solid var(--blu); }
.card-tel a.tel, a.tel { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--blu); padding: 4px 0; }
a.tel svg { width: 14px; height: 14px; }
.contatti { display: grid; gap: 10px; grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
@media (min-width: 640px) { .contatti { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.contatti > div { display: flex; gap: 10px; align-items: center; background: var(--blu-chiaro); border-radius: 14px; padding: 10px 12px; min-width: 0; }
.contatti > div > svg { color: var(--blu); }
.contatti > div > div { min-width: 0; display: grid; }
.contatti b { font-size: 12px; color: var(--blu); font-weight: 600; }
.contatti a, .contatti span { font-size: 15px; font-weight: 500; color: var(--testo); overflow-wrap: anywhere; }
.contatti .aggiungi { border: 0; background: none; padding: 0; color: var(--muto); font-size: 14px; text-align: left; cursor: pointer; text-decoration: underline; }

/* ---------- conferma ---------- */
.conferma { position: fixed; inset: 0; z-index: 80; background: rgba(15,25,50,.5); display: grid; place-items: center; padding: 16px; }
.conferma-box { background: #fff; border-radius: 22px; padding: 22px; max-width: 380px; width: 100%; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.conferma-box p { margin: 0 0 8px; font-size: 16px; font-weight: 500; }
.btn.danger-pieno { background: var(--rosso); color: #fff; }

/* ---------- strutture ---------- */
.strutture-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.struttura { background: var(--card); border-radius: 18px; padding: 14px; display: grid; grid-template-columns: 46px minmax(0,1fr) auto; gap: 12px; align-items: center; cursor: pointer; box-shadow: 0 4px 14px rgba(31,60,120,.06); }
.struttura:hover { box-shadow: 0 6px 20px rgba(31,60,120,.12); }
.struttura .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--blu); }
.struttura .ico svg { width: 24px; height: 24px; }
.struttura.c1 .ico { background: var(--ciano); } .struttura.c2 .ico { background: var(--viola); } .struttura.c3 .ico { background: var(--turchese); }
.struttura.c4 .ico { background: var(--arancio); } .struttura.c5 .ico { background: var(--rosa); } .struttura.c6 .ico { background: var(--verde); } .struttura.c7 .ico { background: var(--giallo); }
.struttura .nome { font-weight: 600; overflow-wrap: anywhere; }
.struttura .body > div { margin-top: 2px; }
.struttura .body .small svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; color: var(--muto); }
.struttura .num { text-align: center; background: var(--blu-chiaro); border-radius: 12px; padding: 6px 10px; }
.struttura .num b { display: block; font-size: 18px; color: var(--blu); }
.struttura .num span { font-size: 11px; color: var(--testo-2); }
@media (max-width: 699px) { .strutture-grid { grid-template-columns: minmax(0,1fr); } }

/* ---------- ricorrenze e dettatura ---------- */
.badge.torta { background: #ffe9f1; color: #c2185b; }
.row.ric { cursor: pointer; }
.row.ric .avatar { width: 40px; height: 40px; flex: 0 0 40px; font-size: 14px; }
.due { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1.4fr); gap: 8px; }
.btn.mic { align-self: flex-start; margin-top: -4px; background: var(--blu-chiaro); color: var(--blu); }
.btn.mic.on { background: var(--rosso); color: #fff; animation: pulsa 1.2s infinite; }
@keyframes pulsa { 50% { box-shadow: 0 0 0 8px rgba(224,70,75,.15); } }
@media (max-width: 699px) { .two.ric-form { grid-template-columns: minmax(0,1fr); } }
details.discreto { margin-top: 28px; color: var(--testo-2); }
details.discreto summary { cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muto); padding: 8px 0; list-style-position: inside; }
details.discreto h4 { margin: 0; font-size: 13px; color: var(--testo-2); }
details.discreto .row { box-shadow: none; }
