:root {
  --bg: #f5f5f7; --card: #ffffff; --text: #1d1d1f; --muted: #6e6e73; --line: #e5e5ea;
  --blue: #0071e3; --green: #1a7f37; --orange: #b25000; --red: #d70015;
  --medical: #0a84ff; --wellness: #30a46c;
  --radius: 14px;
  --bordo: clamp(16px, 2.2vw, 40px);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

header { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.82); backdrop-filter: saturate(180%) blur(20px); border-bottom: 1px solid var(--line); }
header .in { margin: 0 auto; padding: 0 var(--bordo); display: flex; align-items: center; gap: 22px; height: 52px; overflow-x: auto; }
header .logo { font-weight: 600; letter-spacing: -.01em; white-space: nowrap; color: var(--text); }
header nav { display: flex; gap: 18px; font-size: 14px; }
header nav a { color: var(--muted); white-space: nowrap; }
header nav a.on, header nav a:hover { color: var(--text); text-decoration: none; }
header .esci { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; }

/* a tutto schermo: resta solo una fascia vuota ai lati, che cresce poco con lo schermo */
main { margin: 0 auto; padding: 28px var(--bordo) 64px; }
h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 4px; font-weight: 600; }
h2 { font-size: 19px; letter-spacing: -.01em; margin: 30px 0 10px; font-weight: 600; }
.sotto { color: var(--muted); margin: 0 0 22px; }
.riga-titolo { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px 20px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.griglia { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.kpi { font-size: 32px; font-weight: 600; letter-spacing: -.02em; line-height: 1.1; }
.kpi-label { color: var(--muted); font-size: 13px; }

table.lista { width: 100%; border-collapse: collapse; background: var(--card); border-radius: var(--radius); overflow: hidden; }
.lista th { text-align: left; font-size: 12px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.lista td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.lista tr:last-child td { border-bottom: 0; }
.scorri { overflow-x: auto; border-radius: var(--radius); }
.vuoto { color: var(--muted); padding: 14px 0; }

.pill { display: inline-block; font-size: 12px; font-weight: 500; padding: 2px 9px; border-radius: 980px; background: #e8e8ed; color: var(--text); white-space: nowrap; }
.pill.medical { background: #e5f1ff; color: #0058b0; }
.pill.wellness { background: #e3f5ea; color: #19603a; }
.s-in_approvazione { background: #fff4e5; color: var(--orange); }
.s-in_preparazione { background: #fff4e5; color: var(--orange); }
.s-approvato, .s-eseguito { background: #e3f5ea; color: var(--green); }
.s-fallito, .s-rifiutato { background: #ffe5e7; color: var(--red); }
.s-annullato { background: #f0f0f2; color: var(--muted); text-decoration: line-through; }

.esiti { list-style: none; padding: 0; margin: 0; }
.esiti li { padding: 8px 12px; border-radius: 10px; margin-bottom: 6px; font-size: 14px; }
.esiti .blocco { background: #ffe5e7; color: var(--red); }
.esiti .manca, .esiti .avviso { background: #fff4e5; color: var(--orange); }

.testo { white-space: pre-wrap; background: var(--bg); border-radius: 12px; padding: 14px 16px; }
dl.scheda { display: grid; grid-template-columns: 140px 1fr; gap: 6px 14px; margin: 0; }
dl.scheda dt { color: var(--muted); }
dl.scheda dd { margin: 0; }

form.stack { display: grid; gap: 14px; max-width: 680px; }
label { display: grid; gap: 5px; font-size: 13px; color: var(--muted); }
input, select, textarea { font: inherit; color: var(--text); padding: 10px 12px; border: 1px solid #d2d2d7; border-radius: 10px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,113,227,.15); }
textarea { min-height: 120px; resize: vertical; }
.due { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.scelte { display: grid; gap: 6px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); max-height: 260px; overflow: auto; padding: 10px; border: 1px solid #d2d2d7; border-radius: 10px; background: #fff; }
.scelte label { display: flex; gap: 8px; align-items: center; color: var(--text); font-size: 14px; }
.scelte input { width: auto; }

.btn { display: inline-block; border: 0; cursor: pointer; font: inherit; font-weight: 500; padding: 9px 18px; border-radius: 980px; background: var(--blue); color: #fff; }
.btn:hover { text-decoration: none; filter: brightness(1.08); }
.btn.verde { background: var(--green); }
.btn.rosso { background: #fff; color: var(--red); box-shadow: inset 0 0 0 1px var(--red); }
.btn.grigio { background: #e8e8ed; color: var(--text); }
.azioni-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.azioni-bar form { display: flex; gap: 8px; flex-wrap: wrap; }
.errore { background: #ffe5e7; color: var(--red); padding: 10px 14px; border-radius: 10px; }
.filtri { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filtri select { width: auto; }
.nota { font-size: 13px; color: var(--muted); }
.banner { background: #f2f7fd; border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 18px; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal .gs { font-size: 12px; color: var(--muted); text-align: center; padding-bottom: 4px; }
.cal .g { background: var(--card); border-radius: 10px; min-height: 110px; padding: 6px; font-size: 12px; overflow: hidden; }
.cal .g.fuori { background: transparent; }
.cal .g.oggi { box-shadow: inset 0 0 0 2px var(--blue); }
.cal .n { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.cal .ev { display: block; padding: 3px 6px; border-radius: 6px; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); border-left: 3px solid var(--wellness); background: #f3faf6; }
.cal .ev.medical { border-left-color: var(--medical); background: #f0f7ff; }

.login { max-width: 380px; width: 100%; margin: 0 auto; }

/* accesso: loghi La Vida grandi sopra, powered by Ideal Consulting sotto */
.accesso { min-height: calc(100vh - 92px); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 34px; padding: 24px 0; }
.accesso-loghi { display: flex; gap: 36px; align-items: center; justify-content: center; flex-wrap: wrap; }
.accesso-loghi img { height: 92px; width: auto; }
.accesso-powered { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.accesso-powered span { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.accesso-powered img { height: 72px; width: auto; }

header .logo { display: flex; gap: 12px; align-items: center; flex-shrink: 0; }
header .logo img { height: 27px; width: auto; display: block; }
header .logo:hover { text-decoration: none; opacity: .85; }
/* schermi medi e piccoli: loghi ed Esci sulla prima riga, il menu sotto e scorrevole */
@media (max-width: 1100px) {
  header .in { flex-wrap: wrap; height: auto; min-height: 52px; padding-top: 10px; padding-bottom: 6px; row-gap: 6px; overflow: visible; }
  header nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  header nav::-webkit-scrollbar { display: none; }
}

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  .accesso-loghi { gap: 18px; }
  .accesso-loghi img { height: 52px; }
  .accesso-powered img { height: 46px; }
  header .logo img { height: 16px; }
  .due { grid-template-columns: 1fr; }
  dl.scheda { grid-template-columns: 1fr; }
  dl.scheda dt { margin-top: 6px; }
  .cal .g { min-height: 64px; }
  .cal .ev { font-size: 0; padding: 0; height: 6px; }
  .lista .nascondi-m { display: none; }
}

/* revisione del piano */
.rev { display: grid; gap: 10px; }
.rev-scheda.scelta:has(input[name=ids]:checked) { box-shadow: inset 0 0 0 2px var(--blue); }
.rev-testa { display: flex; gap: 12px; align-items: flex-start; }
.rev-file { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.rev-file img { height: 120px; width: auto; border-radius: 10px; display: block; background: var(--bg); }
.barra-decidi { position: sticky; bottom: 0; margin: 22px calc(-1 * var(--bordo)) 0; padding: 12px var(--bordo); background: rgba(255,255,255,.9); backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--line); }
.barra-decidi .in { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.barra-decidi input { width: auto; }
@media (max-width: 720px) { .rev-file img { height: 84px; } }

/* eliminazioni */
.btn.piccolo { padding: 5px 12px; font-size: 13px; }
.cestino { border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 8px; }
.cestino:hover { color: var(--red); background: #ffe5e7; }
