:root{font-family:"Atkinson Hyperlegible",Segoe UI,system-ui,sans-serif;color:#203b34;background:#f7f8f2;line-height:1.6;font-size:17px;--green:#246b59;--line:#d9e3dc;--muted:#556c62;--soft:#eaf3ed;--warm:#fbf0cf}
*{box-sizing:border-box}body{margin:0}main{max-width:1100px;margin:auto;padding:22px 16px 70px}
.welcome{max-width:520px;padding-top:40px}.welcome .brand{margin-bottom:22px}
header{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:22px;flex-wrap:wrap}
.brand{display:inline-flex;align-items:center;gap:10px;font-weight:800;letter-spacing:.06em;color:#1c5446;font-size:1rem}.brand img{width:40px;height:40px;border-radius:11px;box-shadow:0 4px 12px #1c544633}
h1{font-size:clamp(26px,5vw,36px);line-height:1.15;letter-spacing:-.03em;margin:0 0 10px}h2{font-size:1.3rem;line-height:1.3;margin:0 0 12px}h3{font-size:1.05rem;margin:14px 0 8px}p{margin:0 0 12px}
.card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:20px;margin:16px 0;box-shadow:0 4px 18px #173d2106}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,320px),1fr));gap:18px}.grid>.card{margin:0}
.row,.actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.actions{margin-top:10px}
nav.tabs{display:flex;gap:8px;overflow-x:auto;padding:4px 0 8px;margin:10px 0 6px;-webkit-overflow-scrolling:touch}nav.tabs button{flex-shrink:0;border-radius:30px;padding:9px 16px}
.muted,small{color:var(--muted)}small{display:block;font-size:.85rem}
.badge{display:inline-block;padding:4px 11px;background:var(--soft);color:var(--green);border-radius:20px;font-size:.8rem;font-weight:700}
button,.button{font:inherit;cursor:pointer;border:1px solid transparent;border-radius:12px;padding:11px 18px;background:var(--green);color:white;text-decoration:none;display:inline-flex;align-items:center;justify-content:center;gap:8px;font-weight:700;min-height:46px}
button:hover,.button:hover{filter:brightness(.94)}button:disabled{opacity:.5;cursor:wait}
.secondary{background:#fff;color:var(--green);border-color:var(--line)}.danger{background:#fff1ed;color:#903d26;border-color:#e7b4a4}.small{padding:7px 13px;min-height:38px;font-size:.9rem}.wide{width:100%;margin:12px 0}
.field{margin:14px 0}label{display:block;font-weight:700;margin-bottom:6px;font-size:.95rem}
input,textarea,select{font:inherit;width:100%;padding:11px 13px;border:1px solid #c2d1c6;border-radius:10px;background:white;color:inherit;min-height:46px}textarea{min-height:100px;resize:vertical}input[type=file]{font-size:15px}
.choice{display:flex;align-items:center;gap:8px;padding:10px 12px;border:1px solid var(--line);border-radius:10px;margin:6px 0;font-weight:500}.choice input{width:auto;min-height:0}
a{color:var(--green)}p,li,code{overflow-wrap:anywhere}code{display:block;background:#edf3e9;padding:12px;border-radius:8px;white-space:pre-wrap;font-size:1.1rem;letter-spacing:.08em}
.notice{padding:16px;background:var(--warm);border-radius:12px}.error{color:#982a21;margin:8px 0 0}.error:empty{display:none}
.entry{border-bottom:1px solid #e5ebe1;padding:14px 0}.entry:last-child{border:0}.entry p{white-space:pre-wrap;margin:6px 0}.entry.grade{display:flex;gap:14px;align-items:flex-start}.grow{flex:1;min-width:0}
.gradebox{flex-shrink:0;min-width:60px;height:60px;padding:0 10px;border-radius:14px;background:#fff3da;color:#755614;font-weight:800;font-size:1.3rem;display:flex;align-items:center;justify-content:center}
.summary{display:grid;grid-template-columns:repeat(auto-fit,minmax(150px,1fr));gap:10px;margin-bottom:14px}.stat{background:var(--soft);border-radius:14px;padding:12px 14px}.stat strong{font-size:1.5rem;display:block;color:var(--green);line-height:1.2}.stat span{font-size:.8rem;color:var(--muted)}
.person{padding:10px 0;border-top:1px solid #eef2ee}
summary{cursor:pointer;font-weight:700;padding:8px 0;color:var(--green)}
#toast{position:fixed;bottom:20px;left:50%;transform:translateX(-50%);background:#203d32;color:white;border-radius:12px;padding:14px 24px;max-width:90%;display:none;z-index:9}#toast.show{display:block}
:focus-visible{outline:3px solid #dcab35;outline-offset:3px}.student-title{display:flex;justify-content:space-between;gap:12px;align-items:center;flex-wrap:wrap}.empty{padding:20px 0;color:var(--muted)}
.chat-ok{color:var(--green);font-weight:700}
.chat-log{background:#dfeadf;border-radius:14px;padding:12px;max-height:50vh;overflow:auto;margin-bottom:12px}.msg{background:#fff;border-radius:12px;padding:12px 14px;margin:10px 0;max-width:92%}.msg.user{background:#bfdcc9;margin-left:auto}.msg strong{display:block;margin-bottom:4px;font-size:.9rem}
.md>*:first-child{margin-top:0}.md>*:last-child{margin-bottom:0}.md p,.md ul,.md ol,.md table{margin:0 0 10px}.md h3,.md h4{margin:12px 0 6px;color:var(--green)}.md h3{font-size:1.1rem}.md h4{font-size:1rem}.md ul,.md ol{padding-left:22px}.md li{margin:3px 0}.md table{border-collapse:collapse;width:100%;font-size:.95rem}.md th,.md td{border:1px solid var(--line);padding:6px 10px;text-align:left}.md th{background:var(--soft)}.md code{display:inline;background:#f1f5f2;padding:1px 6px;border-radius:6px;font-size:.92em;letter-spacing:0}
.upload-choice{display:flex;gap:12px;flex-wrap:wrap;margin:12px 0}.button.big{font-size:1.15rem;min-height:64px}.label-text{display:block;font-weight:700;margin:14px 0 6px;font-size:.95rem}.upload-choice .button{flex-grow:1;text-align:center;cursor:pointer}
.calendar-head{display:flex;gap:10px;align-items:center;justify-content:space-between;margin-bottom:12px}.calendar-head strong{text-transform:capitalize}.calendar{display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px}.calendar .weekday{text-align:center;font-size:.7rem;color:var(--muted)}
.day{position:relative;min-height:58px;padding:6px 2px;border:1px solid var(--line);background:white;color:#203b34;border-radius:9px;display:flex;flex-direction:column;gap:0;font-weight:600;min-height:58px}.day.selected{background:var(--green);color:white}.day.today{border:2px solid var(--green)}.day small{font-size:.58rem;color:inherit;line-height:1.2}.calendar-blank{min-height:58px}
.entry.diary{display:flex;gap:12px;align-items:flex-start}.datebox{flex-shrink:0;background:var(--soft);border-radius:12px;width:54px;height:60px;text-align:center;display:flex;flex-direction:column;justify-content:center;font-size:.7rem;line-height:1.3;color:var(--green)}.datebox b{font-size:1.3rem}.badge.verifica,.badge.interrogazione{background:#fbf0cf;color:#755614}.badge.compito{background:#eaf0fb;color:#365784}.badge.done{background:#edf0eb;color:#596753}
.led{display:inline-block;width:18px;height:18px;border-radius:50%;background:#c8402f;box-shadow:0 0 0 4px #f8d9d3;flex-shrink:0}.led.on{background:#2f9e5a;box-shadow:0 0 0 4px #cdebd6;animation:ledpulse 1.8s ease-in-out infinite}@keyframes ledpulse{0%,100%{box-shadow:0 0 0 4px #cdebd6}50%{box-shadow:0 0 0 9px #cdebd680}}
.now{display:flex;gap:14px;align-items:center;padding:12px 14px;border-radius:14px;background:#fbeeec;margin:8px 0}.now.on{background:#e8f5ec}.now strong{display:block}.now small{margin-top:2px}
.daynav{display:flex;gap:8px;align-items:center;flex-wrap:wrap;margin:8px 0 12px}.daynav input{width:auto;flex:1;min-width:150px}
.timeline .entry strong{display:block}.conv{border-bottom:1px solid #e5ebe1;padding:8px 0}.conv summary{font-weight:700}.conv .chat-log{max-height:60vh;margin-top:8px}.msg .md p{margin:0 0 6px}
#release{max-width:1100px;margin:0 auto;padding:0 16px 24px;font-size:.85rem;color:var(--muted)}
@media(max-width:550px){main{padding:16px 12px 65px}.card{padding:16px}.actions button,.actions .button{flex-grow:1}h1{font-size:1.6rem}}
