/* Portale formazione — stile ripreso dal prototipo (Portale Formazione Scuole.html) */

@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url('../fonts/archivo-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Archivo'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url('../fonts/archivo-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('../fonts/plex-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('../fonts/plex-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --ink: #23211F; --ink-2: #3D3934; --soft: #6E675E; --muted: #8A8378; --faint: #B3ABA0;
  --bg: #F6F4F1; --side: #EFECE7; --panel: #FFFFFF; --panel-alt: #FAF8F5; --field: #FCFBF9;
  --line: rgba(35,33,31,.09); --line-2: rgba(35,33,31,.16);
  --orange: #E87722; --orange-dk: #C25C10; --orange-bg: #FBEEE2; --orange-row: #FDF6EF;
  --green: #3F6B29; --green-bg: #EEF6E9; --green-bd: rgba(92,154,60,.35);
  --amber: #8A6014; --amber-bg: #FCF5E7;
  --red: #8F2C18; --red-2: #C8442A; --red-bg: #FBEBE7;
  --head: 'Archivo', -apple-system, 'Segoe UI', sans-serif;
  --body: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 14px; line-height: 1.5; }
h1, h2, h3 { font-family: var(--head); font-weight: 600; margin: 0; letter-spacing: -.01em; }
a { color: var(--orange-dk); }
button, input, select, textarea { font-family: inherit; font-size: 13.5px; color: inherit; }
.avvio { padding: 60px 20px; text-align: center; color: var(--soft); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: #2B2926; }
.login { display: grid; grid-template-columns: 1fr 1fr; width: 100%; max-width: 860px; background: var(--panel); border-radius: 16px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.35); }
.login-brand { background: #23211F; color: #F6F4F1; padding: 34px 32px; display: flex; flex-direction: column; gap: 18px; }
.login-brand img { width: 150px; background: #fff; border-radius: 10px; padding: 10px 12px; }
.login-brand .sigla { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: rgba(246,244,241,.55); }
.login-brand p { font-size: 13px; line-height: 1.6; color: rgba(246,244,241,.8); margin: auto 0 0; }
.login-form { padding: 34px 32px; display: flex; flex-direction: column; gap: 14px; }
.login-form h1 { font-size: 22px; }
@media (max-width: 720px) { .login { grid-template-columns: 1fr; } .login-brand p { margin-top: 0; } }

/* ---------- struttura ---------- */
.shell { display: flex; min-height: 100vh; }
.side { width: 252px; flex: 0 0 252px; background: var(--side); border-right: 1px solid rgba(35,33,31,.12); display: flex; flex-direction: column; padding: 22px 0 18px; position: sticky; top: 0; height: 100vh; z-index: 21; }
.side .logo { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.side .logo img { width: 124px; height: auto; }
.side .sigla { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--soft); font-weight: 600; }
.side nav { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; flex: 1; overflow-y: auto; }
.side .gruppo { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 14px 10px 6px; }
.nav-voce { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); cursor: pointer; border: 0; background: none; text-align: left; width: 100%; }
.nav-voce:hover { background: rgba(35,33,31,.05); }
.nav-voce .punto { width: 5px; height: 5px; border-radius: 50%; background: transparent; flex: 0 0 5px; }
.nav-voce.attiva { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(35,33,31,.06); }
.nav-voce.attiva .punto { background: var(--orange); }
.nav-voce .badge-n { margin-left: auto; font-family: var(--head); font-size: 11px; font-weight: 600; color: #fff; background: var(--red-2); padding: 1px 6px; border-radius: 4px; }
.side .utente { padding: 14px 20px 0; border-top: 1px solid rgba(35,33,31,.14); display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.side .utente .nome { font-size: 12px; color: var(--ink-2); font-weight: 500; line-height: 1.45; }
.side .utente .org { color: var(--muted); font-weight: 400; }
.link-esci { font-size: 11.5px; font-weight: 700; color: var(--soft); cursor: pointer; background: none; border: 0; padding: 0; }
.link-esci:hover { color: var(--orange-dk); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.testata { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 30px 36px 22px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.testata .eyebrow { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--faint); font-weight: 600; }
.testata h1 { font-size: 26px; line-height: 1.12; letter-spacing: -.015em; }
.testata .sotto { font-size: 13.5px; color: var(--soft); max-width: 62ch; margin-top: 4px; }
.perimetro { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--green); background: var(--green-bg); border: 1px solid var(--green-bd); padding: 4px 9px; border-radius: 6px; margin-top: 8px; }
.testata .azioni { display: flex; align-items: center; gap: 10px; }
.contenuto { flex: 1; padding: 26px 36px 52px; display: flex; flex-direction: column; gap: 22px; }
.btn.menu-btn { display: none; }
.velo { display: none; }
@media (max-width: 1023px) {
  .side { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .2s; box-shadow: 14px 0 44px -18px rgba(35,33,31,.45); }
  .side.aperta { transform: none; }
  .velo.on { display: block; position: fixed; inset: 0; background: rgba(35,33,31,.35); z-index: 20; }
  .btn.menu-btn { display: inline-flex; }
  .testata { padding: 18px 16px 16px; }
  .testata h1 { font-size: 21px; }
  .contenuto { padding: 18px 16px 40px; }
}

/* ---------- componenti ---------- */
.card { background: var(--panel); border: 1px solid rgba(35,33,31,.08); border-radius: 12px; box-shadow: 0 1px 2px rgba(35,33,31,.04); }
.card-testa { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card-testa h2 { font-size: 15.5px; }
.card-testa .nota { font-size: 12px; color: var(--muted); }
.card-corpo { padding: 16px 18px; }
.card-piede { padding: 14px 18px; border-top: 1px solid var(--line); background: var(--panel-alt); display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; border-radius: 0 0 12px 12px; }

.kpi-griglia { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 7px; }
.kpi.cliccabile { cursor: pointer; }
.kpi.cliccabile:hover { border-color: var(--orange); }
.kpi .etichetta { font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.kpi .valore { font-family: var(--head); font-size: 34px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.kpi .nota { font-size: 12.5px; color: var(--soft); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-family: var(--head); font-size: 13px; font-weight: 600; padding: 9px 15px; border-radius: 8px; border: 1px solid var(--orange); background: var(--orange); color: #fff; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--orange-dk); border-color: var(--orange-dk); }
.btn.scuro { background: var(--ink); border-color: var(--ink); }
.btn.scuro:hover { background: #000; }
.btn.chiaro { background: var(--panel); color: var(--ink); border-color: rgba(35,33,31,.2); }
.btn.chiaro:hover { border-color: var(--orange); color: var(--orange-dk); background: var(--panel); }
.btn.piccolo { font-size: 12px; padding: 6px 11px; border-radius: 7px; }
.btn.pericolo { background: var(--panel); color: var(--red-2); border-color: rgba(200,68,42,.4); }
.btn.pericolo:hover { background: var(--red-bg); }
.btn:disabled, .btn[aria-disabled="true"] { background: #F2EEE9; border-color: rgba(35,33,31,.14); color: var(--muted); cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--orange-dk); font-weight: 600; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
.link:hover { text-decoration: underline; }

.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo label { font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.campo .aiuto { font-size: 11.5px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=number], select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; background: var(--field); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(232,119,34,.15); }
input.maiuscolo { text-transform: uppercase; }
.griglia-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px 14px; }
.riga { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filtri { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 18px; border-bottom: 1px solid var(--line); background: var(--panel-alt); }
.filtri select, .filtri input { width: auto; flex: 0 1 200px; font-size: 12.5px; padding: 7px 10px; }
.filtri input[type=search] { flex: 1 1 220px; }

.msg { font-size: 12.5px; padding: 9px 12px; border-radius: 8px; line-height: 1.45; }
.msg.errore { background: var(--red-bg); color: var(--red); border: 1px solid rgba(200,68,42,.3); }
.msg.ok { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-bd); }
.msg.avviso { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(201,144,43,.35); }
.msg.info { background: var(--orange-bg); color: #8A4A0A; border: 1px solid rgba(232,119,34,.4); }

.chip { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 5px; white-space: nowrap; }
.chip.verde { color: var(--green); background: var(--green-bg); }
.chip.ambra { color: var(--amber); background: var(--amber-bg); }
.chip.rosso { color: var(--red); background: var(--red-bg); }
.chip.grigio { color: var(--muted); background: #F2EEE9; }
.chip.arancio { color: var(--orange-dk); background: var(--orange-bg); }

table.tab { width: 100%; border-collapse: collapse; font-size: 13px; }
.tab th { text-align: left; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tab td { padding: 10px 12px; border-top: 1px solid rgba(35,33,31,.06); vertical-align: middle; }
.tab tr.cliccabile { cursor: pointer; }
.tab tr.cliccabile:hover td { background: var(--orange-row); }
.tab tr.selezionata td { background: var(--orange-row); }
.tab .num { font-variant-numeric: tabular-nums; }
.tab .soft { color: var(--soft); }
.scorre { overflow-x: auto; }
.vuoto { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 13px; }
.spunta { width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid rgba(35,33,31,.28); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; }
.spunta.on { background: var(--orange); border-color: var(--orange); }

.barra { height: 6px; border-radius: 3px; background: #F2EEE9; overflow: hidden; }
.barra > span { display: block; height: 100%; background: var(--orange); }

.due-col { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .due-col { grid-template-columns: 1fr; } }

/* calendario mensile */
.cal-testa { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cal-testa h2 { font-size: 19px; min-width: 160px; }
.cal-griglia { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-griglia .gs { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cal-giorno { min-height: 96px; border-right: 1px solid rgba(35,33,31,.06); border-bottom: 1px solid rgba(35,33,31,.06); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-giorno:nth-child(7n) { border-right: 0; }
.cal-giorno .n { font-family: var(--head); font-size: 12px; font-weight: 600; color: var(--soft); }
.cal-giorno.fuori { background: var(--panel-alt); }
.cal-giorno.fuori .n { color: var(--faint); }
.cal-giorno.oggi .n { color: #fff; background: var(--orange); border-radius: 50%; width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; }
.cal-evento { font-size: 11.5px; line-height: 1.3; padding: 4px 6px; border-radius: 6px; cursor: pointer; border-left: 3px solid var(--green); background: var(--green-bg); color: var(--ink-2); text-align: left; border-top: 0; border-right: 0; border-bottom: 0; width: 100%; }
.cal-evento.ambra { border-left-color: #C9902B; background: var(--amber-bg); }
.cal-evento.rosso { border-left-color: var(--red-2); background: var(--red-bg); }
.cal-evento.grigio { border-left-color: var(--faint); background: #F2EEE9; color: var(--muted); }
.cal-evento strong { display: block; font-weight: 600; }
.legenda { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--soft); padding: 10px 18px; }
.legenda span::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
@media (max-width: 760px) { .cal-griglia.mese { display: none; } }

/* pannello laterale */
.pannello-velo { position: fixed; inset: 0; background: rgba(35,33,31,.35); z-index: 40; }
.pannello { position: fixed; top: 0; right: 0; height: 100vh; width: min(560px, 100vw); background: var(--panel); z-index: 41; display: flex; flex-direction: column; box-shadow: -18px 0 44px -18px rgba(35,33,31,.45); }
.pannello .p-testa { padding: 20px 22px 14px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pannello .p-testa h2 { font-size: 18px; }
.pannello .p-corpo { padding: 18px 22px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.pannello .p-piede { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--panel-alt); }
.chiudi { background: none; border: 0; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }

.dati { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px 18px; }
.dati .d label { display: block; font-size: 10.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 3px; }
.dati .d div { font-size: 13.5px; }

.passi { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.passo { display: flex; gap: 12px; }
.passo .n { font-family: var(--head); font-weight: 600; width: 26px; height: 26px; border-radius: 50%; background: var(--orange-bg); color: var(--orange-dk); display: flex; align-items: center; justify-content: center; flex: 0 0 26px; }
.passo strong { display: block; font-size: 13.5px; }
.passo span { font-size: 12.5px; color: var(--soft); }

.toast { position: fixed; left: 24px; bottom: 24px; z-index: 60; max-width: 440px; background: var(--ink); color: #F6F4F1; border-radius: 10px; box-shadow: 0 10px 28px rgba(35,33,31,.28); padding: 13px 15px; font-size: 12.5px; line-height: 1.45; display: flex; gap: 14px; align-items: center; }
.toast.errore { background: #7A2415; }
