:root{box-sizing:border-box;padding-top:env(safe-area-inset-top,0px);padding-bottom:env(safe-area-inset-bottom,0px);
--bg:#f6f4f1;--surf:#fff;--tx:#1d1d1f;--mut:#6b6b70;--bd:#d9d5cf;--acc:#c8102e;--hit:#bfe0ff;--nt:#ece9f7;--zb:rgba(0,0,0,.08);--w:36px;--cap:#f7c4c3}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]){--bg:#17171a;--surf:#212125;--tx:#ececef;--mut:#9a9aa2;--bd:#3a3a40;--acc:#ff4d5e;--hit:#1f4f80;--nt:#2a2838;--zb:rgba(255,255,255,.08)}}
html{height:100%;scroll-padding-top:env(safe-area-inset-top,0px)}
*{box-sizing:border-box}
body{margin:0;height:100%;display:flex;flex-direction:column;background:var(--bg);color:var(--tx);font:14px/1.4 system-ui,-apple-system,"Segoe UI",sans-serif}
header,.bar,.legend{flex:none}
header{display:flex;align-items:center;gap:10px;padding:12px 16px;background:var(--surf);border-bottom:3px solid var(--acc)}
header h1{font-size:15px;margin:0}
.hl{flex:1 1 0;display:flex;align-items:center;gap:10px;min-width:220px}
.hr{flex:1 1 0;display:flex;align-items:center;justify-content:flex-end;gap:10px;min-width:max-content}
#tools{display:flex;gap:8px}
header{flex-wrap:wrap}
header button{white-space:nowrap;width:36px;height:36px;padding:0;font-size:15px;line-height:1}
.tb{background:var(--surf);color:var(--tx);font-size:13px;font-weight:700}
.tb.sel,.tb.sel:hover{border:2px solid var(--acc)}
#smenu{position:fixed;display:none;z-index:40;background:var(--surf);border:1px solid var(--bd);border-radius:8px;padding:6px;box-shadow:0 6px 20px #0005;min-width:160px}
#smenu.on{display:block}
#disk.ok{border:2px solid #2e7d32;background:#e8f5e9}
#disk.warn{border:2px solid var(--acc);background:#ffebee;animation:blink 1.2s ease-in-out infinite}
@keyframes blink{50%{opacity:.45}}
#smenu button{display:block;width:100%;height:auto;text-align:left;margin:2px 0;border:0;padding:6px 10px}
header h1 small{display:block;font-weight:400;color:var(--mut)}
button{font:inherit;color:inherit;background:var(--surf);border:1px solid var(--bd);border-radius:6px;padding:6px 10px;cursor:pointer}
button:hover{border-color:var(--acc)}
.bar{display:flex;align-items:center;gap:6px;padding:6px 16px}
#mbs{display:flex;flex:1;gap:6px;min-width:0}
#prev,#next{width:44px;height:36px;padding:0}
@media (max-width:700px){.bar{flex-wrap:wrap}#mbs{order:5;flex:1 1 100%}#next{margin-left:auto}}
#yr{width:84px;height:36px;font:inherit;font-size:18px;font-weight:700;text-align:center;color:inherit;background:var(--surf);border:1px solid var(--bd);border-radius:6px;padding:0}
.mb{flex:1 1 0;min-width:0;height:36px;padding:0 2px;font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden}
.mb.sel{flex:0 0 auto;padding:0 16px;background:var(--acc);color:#fff;border-color:var(--acc)}
.wrap{overflow:auto;margin:0 16px;border:1px solid var(--bd);border-radius:8px;background:var(--surf);display:flex;flex-direction:column;flex:1 1 0;min-height:120px}
#fill{flex:1 0 auto;min-width:980px}
table{border-collapse:separate;border-spacing:0;table-layout:fixed;width:100%;min-width:980px;flex:none}
th,td{border-right:1px solid var(--bd);border-bottom:1px solid var(--bd);text-align:center;padding:0;height:var(--w);background:var(--surf);overflow:hidden}
th:last-child,td:last-child{border-right:2px solid var(--tx)}
thead tr:last-child th:last-child{border-right:1px solid var(--bd)}
thead th{position:sticky;z-index:2;font-weight:600;font-size:11px;line-height:1.2;padding:3px 0}
thead tr:first-child th{top:0;height:28px}
thead tr:nth-child(2) th{top:28px;height:26px}
thead tr:last-child th{top:54px;height:20px;border-bottom:2px solid var(--tx)}
th.sm[rowspan="2"]{border-bottom:2px solid var(--tx)}
/* riepilogo MESE/ANNO: simboli a dimensione doppia (12px -> 24px), N a 24px */
th.sm.sy{font-size:24px;line-height:1}
th.sm.sn{font-size:24px;line-height:1}
th.wd{font-size:10px;font-weight:400;color:var(--mut)}
th.sg.bad{background:var(--acc)}
thead th span{display:block;color:var(--mut);font-weight:400;font-size:10px}
th.sg{font-size:14px;font-weight:700;color:#000}
.pb{border-left:2px solid var(--tx)}
.sl input{color:#000;font-weight:700}
@media (prefers-color-scheme:dark){:root:not([data-theme="light"]) th.sg,:root:not([data-theme="light"]) .sl input,:root:not([data-theme="light"]) .sl b{color:var(--tx)}}
th.fest{background-color:var(--surf);background-image:linear-gradient(rgba(229,57,53,.5),rgba(229,57,53,.5))}
.name{position:sticky;left:0;z-index:3;text-align:left;padding:0 6px;white-space:nowrap;font-size:12px;text-overflow:ellipsis}
thead th.name{text-align:center}
th.n1,th.n2,th.n3{cursor:pointer;font-size:11px;padding:0 4px;text-align:center}
th.n2{left:auto}
th.n0{padding:0}
.srt{display:flex;height:100%;align-items:center}
.srt span{flex:1 1 0;text-align:center;cursor:pointer;font-size:11px;white-space:nowrap}
.srt span:hover{color:var(--acc)}
th.n1:hover,th.n2:hover,th.n3:hover{color:var(--acc)}
.sl{z-index:3;white-space:nowrap;font-size:12px}
.sl b{color:#000}
thead .name,thead .sl{z-index:4}
.sl input{width:28px;margin-right:-18px;text-align:left;font:inherit;font-weight:700;color:#000;background:transparent;border:0;outline:0;padding:0}
td.name button{position:absolute;right:2px;top:50%;transform:translateY(-50%);opacity:0;border:0;color:var(--mut);padding:0 4px;background:none}
td.name:hover button{opacity:1}
td.c{font-weight:700;font-size:13px;user-select:none}
tbody td{height:22px}
td.name{text-transform:uppercase}
.sm{font-weight:700;font-size:12px}
select{font:inherit;color:inherit;background:var(--surf);border:1px solid var(--bd);border-radius:6px;padding:6px}
td.c.ed{cursor:pointer}
td.c.ed:hover{outline:2px solid var(--acc);outline-offset:-2px}
td.hit,th.hit{background:var(--hit)}
/* turno senza CR/CS con mansione valida: rosso pieno trasparente al 70% sulle caselle vuote dei CR/CS */
tbody td.c.nocap{background:var(--cap)!important;color:#000}
.out{opacity:.5}
td.out:not(.hit){background:var(--nt)}
tbody tr:nth-child(odd) td:not(.hit):not([style]){background-image:linear-gradient(var(--zb),var(--zb))}
.tools,.legend{display:flex;flex-wrap:wrap;gap:8px;padding:6px 16px;align-items:center}
.legend span{padding:3px 9px;border-radius:5px;font-size:12px;border:1px solid var(--bd)}
.legend span.who{margin-left:auto;border-color:transparent;color:var(--mut);font-weight:600}
#menu{position:fixed;display:none;z-index:30;background:var(--surf);border:1px solid var(--bd);border-radius:8px;padding:6px;box-shadow:0 6px 20px #0005;min-width:190px}
#menu.on{display:block}
#dlg,#dlg2{position:fixed;inset:0;background:#0007;display:none;z-index:50;align-items:center;justify-content:center;padding:12px}
#dlg2{z-index:60}
#dlg.on,#dlg2.on{display:flex}
#dlg .card,#dlg2 .card{background:var(--surf);border-top:3px solid var(--acc);border-radius:10px;padding:16px;width:max-content;max-width:min(75vw,100%);max-height:90vh;overflow:auto;box-shadow:0 10px 40px #0008}
#dlg h2,#dlg2 h2{margin:0 0 10px;font-size:16px}
#dlg2 .in{width:100%;min-width:260px;font:inherit;color:inherit;background:var(--bg);border:1px solid var(--bd);border-radius:5px;padding:5px 7px}
#dlg .mt{border-collapse:collapse;width:auto;min-width:0;table-layout:auto}
#dlg .mt td.hd.c{text-align:center}
#dlg .mt td{white-space:nowrap}
#dlg .mt button{min-width:36px}
#dlg .card{scrollbar-gutter:stable}
#dlg .mt td{padding:4px;border:0;height:auto;text-align:left;background-color:transparent;overflow:visible}
#dlg .mt td.hd{font-size:12px;color:var(--mut)}
#dlg .in{width:100%;font:inherit;color:inherit;background:var(--bg);border:1px solid var(--bd);border-radius:5px;padding:5px 7px}
#dlg .in:disabled{background:transparent;border-color:transparent;-webkit-text-fill-color:currentColor;opacity:1}
#dlg .in.nn{width:150px}
#dlg .in.sg{width:64px;text-align:center}
#dlg .in.nm,#dlg .in.nm:disabled{width:32px;height:32px;padding:0;text-align:center;font-weight:700;background:#fff;color:#000;-webkit-text-fill-color:#000;border:1px solid var(--bd);border-radius:4px}
#dlg input[type=color]{width:50px;height:30px;padding:2px;border:1px solid var(--bd);border-radius:4px;background:var(--surf);cursor:pointer}
#dlg .sw{display:inline-block;width:50px;height:30px;border:1px solid var(--bd);border-radius:4px;vertical-align:middle}
#dlg tr.new td{border-top:1px solid var(--bd)}
#dlg button:disabled{opacity:.35;cursor:default}
#dlg .in[data-f="p"]{width:130px}
#dlg select.in{width:auto}
#dlg select.in:disabled{appearance:none;-webkit-appearance:none}
#dlg .mt td.mut{color:var(--mut);font-size:12px}
#dlg .unote{margin:10px 0 0;max-width:560px;color:var(--mut);font-size:12px;white-space:normal}
/* utente User (sola lettura): niente barra delle mansioni né menu impostazioni */
body.ro #tools,body.ro #sett{display:none}
body.ro td.c.ed{cursor:default}
body.ro td.c.ed:hover{outline:0}
.dfoot{display:flex;justify-content:flex-end;gap:8px;margin-top:12px}
.dfoot button{min-width:80px}
.dfoot button.pri{background:var(--acc);border-color:var(--acc);color:#fff}
#dlg2 .msg{margin:4px 0 8px;max-width:380px}
#menu button{display:block;width:100%;text-align:left;margin:2px 0;border:0}
.note{padding:0 16px 16px;color:var(--mut);font-size:12px}
/* stampa del modello riepilogo: solo l'immagine, A4 orizzontale a tutta pagina */
#printimg{display:none}
@page{size:A4 landscape;margin:8mm}
@media print{body.pimg>*:not(#printimg){display:none!important}
 body.pimg{display:block;height:auto;background:#fff;margin:0}
 body.pimg #printimg{display:block;width:100%;height:auto;max-height:193mm;object-fit:contain;break-inside:avoid}}
@media print{header button,.bar button,.tools,#picker,.note{display:none}body{background:#fff;height:auto;display:block}.wrap{overflow:visible;display:block}#fill{display:none}}
/* pagina di accesso (login.html, solo versione online): stesso stile delle finestre #dlg */
body.login main{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:16px}
body.login .card{width:100%;max-width:340px;background:var(--surf);border-top:3px solid var(--acc);border-radius:10px;padding:16px;box-shadow:0 10px 40px #0003}
body.login h2{margin:0 0 12px;font-size:16px}
body.login label{display:block;margin:10px 0 4px;font-size:12px;color:var(--mut)}
body.login .in{width:100%;font:inherit;color:inherit;background:var(--bg);border:1px solid var(--bd);border-radius:5px;padding:7px 9px}
body.login .in:focus{outline:2px solid var(--acc);outline-offset:-1px;border-color:var(--acc)}
body.login .lerr{margin:0 0 4px;padding:6px 9px;border-radius:5px;background:var(--cap);color:#000;font-size:13px}
body.login .dfoot{margin-top:16px}
body.login .lnote{margin:12px 0 0;color:var(--mut);font-size:12px}
