:root {
  --page:#f2f2f2; --panel:#fff; --header:#2f3b32; --text:#1d251f; --border:#737b74;
  --gold:#a38642; --invalid:#b3261e; --bw:1px;
  --deg-time:#ecefec; --deg-over1:#f6f6f4; --deg-over12:#f6f6f4; --deg-over14:#f6f6f4; --deg-over18:#f6f6f4; --deg-pan:#f6f6f4;
  --deg-above-half:#f0f2ef; --deg-above-quarter:#f0f2ef; --deg-above-eighth:#f0f2ef; --deg-obj:#f4f1ed; --deg-stem:#efeee9;
  --moisture-time:#f4f1e9; --moisture-brabender:#fff; --moisture-mettler:#f3f3f3;
  --moisture-raff:#fbf3db; --moisture-vcol:#f5f5f2; --moisture-vcok:#f5f5f2;
  color-scheme:light;
}
*{box-sizing:border-box}
html,body{height:100%;margin:0}
body{font-family:Tahoma,Arial,sans-serif;background:var(--page);color:var(--text);font-size:14px;overflow:hidden}
button,input{font:inherit}
button{border:1px solid #667069;background:#e8ebe8;color:#172019;border-radius:3px;padding:8px 12px;font-weight:700;cursor:pointer}
button:active{transform:translateY(1px)}
[hidden]{display:none!important}
.login-view{height:100%;display:grid;place-items:center;padding:20px;background:#e8eae8}
.login-card{width:min(390px,100%);background:#fff;border:1px solid #a8ada9;border-radius:5px;padding:28px;display:grid;gap:13px;box-shadow:0 7px 22px #0002}
.login-card img{margin:auto;object-fit:contain}.login-card h1{font-size:22px;text-align:center;margin:0 0 8px}.login-card label{font-weight:700}.login-card input{width:100%;padding:12px;border:1px solid #777;border-radius:3px}.login-card button{background:var(--header);color:#fff;padding:12px}.error{min-height:18px;color:var(--invalid);margin:0;text-align:center}
.app{height:100%;display:grid;grid-template-rows:auto auto minmax(0,1fr)}
.topbar{min-height:49px;background:var(--header);color:#fff;display:flex;align-items:center;gap:16px;padding:5px 10px;border-bottom:2px solid #1b241d}
.brand{display:flex;align-items:center;gap:7px;white-space:nowrap}.brand img{width:30px;height:30px;object-fit:contain;background:#fff;border-radius:2px}.brand strong{font-size:16px}
.live-meta{flex:1;min-width:0;display:flex;gap:7px;overflow:auto;scrollbar-width:thin}.live-meta span{white-space:nowrap;border-left:1px solid #ffffff52;padding-left:8px;font-size:12px}
.header-actions{display:flex;align-items:center;gap:6px}.icon-button,.small-button{background:#ffffff18;color:#fff;border-color:#ffffff55;padding:6px 8px}.connection{font-size:18px;color:#9bd19f}.connection.offline{color:#ee7670}
.tabs{display:grid;grid-template-columns:repeat(4,1fr);background:#d8dcd9;border-bottom:1px solid var(--border)}.tabs button{border:0;border-right:1px solid #b2b8b3;border-radius:0;padding:9px 5px;font-size:12px}.tabs button.active{background:#fff;border-bottom:3px solid var(--header)}
.panel{min-height:0;height:100%;background:var(--panel)}.live-panel{overflow:hidden}.table-scroll{width:100%;height:100%;overflow:auto;scrollbar-gutter:stable both-edges;overscroll-behavior:contain}
.result-table{width:max-content;min-width:100%;border-collapse:separate;border-spacing:0;table-layout:fixed}.result-table th,.result-table td{border-right:var(--bw) solid var(--border);border-bottom:var(--bw) solid var(--border);padding:7px 9px;text-align:center;white-space:nowrap;min-width:82px}.result-table th:first-child,.result-table td:first-child{border-left:var(--bw) solid var(--border)}
.result-table thead{position:sticky;top:0;z-index:3}.result-table thead th{background:#dfe3df;border-top:var(--bw) solid var(--border);font-size:12px;text-transform:uppercase}.result-table tfoot{position:sticky;bottom:0;z-index:2}.result-table tfoot td{background:#e1e5e2;font-weight:700;border-top:2px solid var(--header)}
.result-table tr.grade-row td{position:sticky;left:0;text-align:left;background:#cfd5d0;color:#172019;font-weight:700;z-index:1;border-top:2px solid #59645c}.result-table tr.invalid td{color:var(--invalid)!important;font-weight:700}.result-table tbody tr[data-single-report]{cursor:pointer}.result-table tbody tr[data-single-report]:active td{filter:brightness(.94)}
.time-cell{background:var(--deg-time);min-width:106px!important}.time-main{display:block;font-size:12px}.box-sub{display:block;font-style:italic;font-weight:400;margin-top:2px}.deg-over1{background:var(--deg-over1)}.deg-over12{background:var(--deg-over12)}.deg-over14{background:var(--deg-over14)}.deg-over18{background:var(--deg-over18)}.deg-pan{background:var(--deg-pan)}.deg-above-half{background:var(--deg-above-half)}.deg-above-quarter{background:var(--deg-above-quarter)}.deg-above-eighth{background:var(--deg-above-eighth)}.deg-obj{background:var(--deg-obj)}.deg-stem{background:var(--deg-stem)}
.moisture-table .time-cell{background:var(--moisture-time)}.moisture-table .time-main{color:var(--gold);font-size:11px}.moisture-table .box-sub{color:var(--text)}.moisture-brabender{background:var(--moisture-brabender);font-weight:700;font-size:16px}.moisture-mettler{background:var(--moisture-mettler);color:#777}.moisture-raff{background:var(--moisture-raff);color:var(--gold);font-weight:700}.moisture-vcol{background:var(--moisture-vcol);font-style:italic}.moisture-vcok{background:var(--moisture-vcok);font-style:italic}
.empty-cell{padding:35px!important;color:#707770;font-style:italic}
.report-panel{overflow:auto;padding:10px}.report-toolbar{position:sticky;top:-10px;z-index:2;background:var(--panel);display:flex;align-items:center;justify-content:space-between;padding:6px 0 10px;border-bottom:1px solid #bbb}.report-list{display:grid;gap:7px;padding:9px 0}.report-item{display:grid;grid-template-columns:minmax(0,1fr) auto auto;gap:8px;align-items:center;border:1px solid #aeb4af;background:#fff;padding:9px}.report-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.report-meta{font-size:11px;color:#6a716c}.report-item.daily-moisture .report-name{font-weight:700;text-decoration:underline}.report-item.boxes .report-name{color:var(--invalid);font-weight:700}.report-item a{color:#1d4930;font-weight:700}
dialog{border:1px solid #656c66;border-radius:4px;padding:0;color:var(--text);background:var(--panel)}dialog::backdrop{background:#111a}.settings-dialog{width:min(760px,96vw);max-height:94vh}.settings-dialog form{display:grid;grid-template-rows:auto minmax(0,1fr) auto;max-height:94vh}.dialog-head,.dialog-actions,.pdf-head{display:flex;align-items:center;gap:10px;padding:10px;background:#e1e5e2;border-bottom:1px solid #a5aaa6}.dialog-head strong,.pdf-head strong{flex:1}.settings-body{overflow:auto;padding:10px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.settings-body fieldset{margin:0;border:1px solid #a9aea9;display:grid;gap:8px;align-content:start}.settings-body legend{font-weight:700}.settings-body label{display:flex;align-items:center;justify-content:space-between;gap:10px}.settings-body input[type=color]{width:44px;height:28px;padding:1px}.color-grid{display:grid;grid-template-columns:1fr 1fr;gap:6px}.checks{display:grid;grid-template-columns:1fr 1fr;gap:4px;border-top:1px solid #ddd;padding-top:7px}.checks label{justify-content:flex-start}.dialog-actions{justify-content:flex-end;border-top:1px solid #a5aaa6;border-bottom:0}.dialog-actions .primary{background:var(--header);color:#fff}.pdf-dialog{width:98vw;height:96vh;max-width:none;max-height:none}.pdf-dialog[open]{display:grid;grid-template-rows:auto minmax(0,1fr)}.pdf-head a{font-weight:700;color:#1d4930}.pdf-dialog iframe{width:100%;height:100%;border:0;background:#777}
.toast{position:fixed;left:50%;bottom:16px;transform:translate(-50%,120px);background:#202822;color:#fff;padding:10px 16px;border-radius:3px;box-shadow:0 4px 18px #0005;transition:transform .2s;z-index:50}.toast.show{transform:translate(-50%,0)}
@media(max-width:720px){.topbar{gap:7px}.brand strong{display:none}.settings-body{grid-template-columns:1fr}.tabs button{font-size:10px;padding:8px 2px}.small-button{font-size:10px}.report-item{grid-template-columns:minmax(0,1fr) auto}.report-meta{display:none}}
@media(orientation:portrait) and (max-width:720px){.app::after{content:'Ruota il telefono in orizzontale per visualizzare meglio le tabelle';position:fixed;right:9px;bottom:8px;background:#202822;color:#fff;padding:5px 7px;font-size:10px;opacity:.86;pointer-events:none}}
