:root{color-scheme:dark;--bg:#0b1120;--surface:#111b2e;--surface2:#16233a;--line:#27364f;--text:#edf3ff;--muted:#99a9c2;--accent:#64d6bc;--accent2:#9de8d7;--danger:#ff9c9c;--shadow:0 18px 50px #02061766;font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif}*{box-sizing:border-box}body{margin:0;background:radial-gradient(ellipse at top right,#183052 0,transparent 38%),var(--bg);color:var(--text);min-height:100vh}.topbar{height:76px;display:flex;align-items:center;justify-content:space-between;padding:0 clamp(16px,4vw,56px);border-bottom:1px solid #26364d;background:#0b1120d9;position:sticky;top:0;z-index:5;backdrop-filter:blur(16px)}.brand,.top-actions{display:flex;align-items:center;gap:13px}.brand strong,.brand small{display:block}.brand strong{font-size:15px;letter-spacing:.1px}.brand small{font-size:11px;color:var(--muted);margin-top:4px}.logo{width:42px;height:42px;border-radius:13px;display:grid;place-items:center;background:linear-gradient(140deg,#9de8d7,#45a99c);color:#0b1b28;font-weight:900;letter-spacing:-1px}.pill{font-size:12px;border:1px solid var(--line);padding:7px 11px;border-radius:100px}.pill:before{content:"";display:inline-block;width:7px;height:7px;border-radius:100%;margin-right:7px;background:#7b8ba2}.pill.good{color:var(--accent2);border-color:#2c6e65}.pill.good:before{background:var(--accent)}main{max-width:1400px;margin:auto;padding:32px clamp(16px,4vw,56px) 60px}h1,h2,p{margin-top:0}h1{font-size:clamp(28px,4vw,38px);letter-spacing:-1.2px;margin-bottom:9px}h2{font-size:18px;letter-spacing:-.3px;margin-bottom:5px}p{color:var(--muted);line-height:1.55;margin-bottom:0}.eyebrow{color:var(--accent);font-weight:750;font-size:10px;letter-spacing:1.7px;margin-bottom:12px}.hidden{display:none!important}button,input{font:inherit}button{cursor:pointer;border:0;border-radius:10px;padding:11px 15px;font-weight:650;transition:transform .15s,background .15s}button:active{transform:scale(.98)}button:disabled{opacity:.5;cursor:not-allowed}.primary{background:var(--accent);color:#06211d;width:100%;margin-top:5px}.primary:hover{background:var(--accent2)}.secondary{background:var(--surface2);border:1px solid var(--line);color:var(--text)}.secondary:hover{border-color:#4c6a8d}.login-wrap{min-height:calc(100vh - 200px);display:grid;place-items:center}.login-card{width:min(100%,440px);padding:clamp(24px,5vw,42px);border:1px solid var(--line);background:linear-gradient(155deg,#17243a,#101a2b);border-radius:22px;box-shadow:var(--shadow)}.login-card h1{font-size:30px}.login-card>p{font-size:13px;margin-bottom:26px}.login-card label{display:block;font-size:12px;color:#c5d2e5;margin-bottom:17px}.login-card input,.search{width:100%;margin-top:8px;padding:12px 13px;border-radius:10px;border:1px solid var(--line);background:#0b1424;color:var(--text);outline:none}.login-card input:focus,.search:focus{border-color:var(--accent)}.fineprint{font-size:11px!important;margin:17px 0 0!important}.error{color:var(--danger);font-size:12px;margin-top:12px;min-height:18px}.welcome,.section-head,.panel-head{display:flex;align-items:center;justify-content:space-between;gap:20px}.welcome{margin:4px 0 28px}.welcome p,.section-head p,.panel-head p{font-size:12px}.stats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;margin-bottom:38px}.stat{border:1px solid var(--line);border-radius:15px;padding:20px;background:linear-gradient(145deg,#142137,#101a2b)}.stat span,.stat small{display:block;color:var(--muted);font-size:12px}.stat strong{display:block;font-size:32px;letter-spacing:-1px;margin:10px 0 4px}.section-head{margin-bottom:15px}.search{width:min(100%,250px);margin:0}.camera-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:14px;margin-bottom:36px}.camera-card{border:1px solid var(--line);background:var(--surface);border-radius:15px;padding:17px;min-width:0;transition:border-color .2s}.camera-card:hover{border-color:#4b6b87}.camera-top{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:19px}.camera-icon{width:38px;height:38px;border-radius:12px;background:#1c354a;display:grid;place-items:center;font-size:19px}.status-dot{width:8px;height:8px;border-radius:50%;background:var(--accent);display:inline-block;margin-right:5px}.camera-card h3{font-size:14px;margin:0 0 8px;overflow-wrap:anywhere}.camera-card .sub{font-size:11px;color:var(--muted);line-height:1.5}.camera-card .meta{display:flex;gap:8px;flex-wrap:wrap;margin-top:15px}.tag{font-size:10px;border:1px solid #2c4a61;border-radius:6px;padding:5px 7px;color:#b4d6e6}.lower-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}.panel{border:1px solid var(--line);background:var(--surface);border-radius:16px;padding:20px;min-width:0}.panel-head{margin-bottom:14px}.text-btn{background:transparent;color:var(--accent);padding:7px;font-size:12px}.list{display:flex;flex-direction:column}.list-row{display:flex;align-items:flex-start;gap:11px;padding:13px 0;border-top:1px solid #25344a}.list-row:first-child{border-top:0}.list-mark{flex:0 0 8px;width:8px;height:8px;border-radius:50%;background:var(--accent);margin-top:6px}.list-content{min-width:0;flex:1}.list-content strong{font-size:12px;display:block;overflow-wrap:anywhere}.list-content small{font-size:10px;color:var(--muted);display:block;margin-top:5px;line-height:1.45;overflow-wrap:anywhere}.empty{font-size:12px;color:var(--muted);padding:18px 0}.notice{margin-top:20px;border:1px solid #315b59;background:#102a2c;border-radius:14px;padding:17px 19px}.notice strong{font-size:13px;color:var(--accent2)}.notice p{font-size:12px;margin-top:6px}/* Notifiche centrali: visibili anche quando la pagina è molto lunga. */
.toast-overlay{position:fixed;inset:0;z-index:1000;display:grid;place-items:center;padding:20px;background:#020617b8;backdrop-filter:blur(5px);opacity:0;visibility:hidden;pointer-events:none;transition:opacity .18s,visibility .18s}
.toast-overlay.show{opacity:1;visibility:visible;pointer-events:auto}
.toast-dialog{position:relative;display:grid;grid-template-columns:48px minmax(0,1fr) auto;align-items:center;gap:16px;width:min(520px,100%);padding:24px;border:1px solid #3a526e;border-radius:18px;background:linear-gradient(155deg,#192943,#101a2b);box-shadow:0 24px 90px #0009;transform:translateY(10px) scale(.98);transition:transform .18s}
.toast-overlay.show .toast-dialog{transform:translateY(0) scale(1)}
.toast-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:50%;font-size:24px;font-weight:850;color:#09231f;background:var(--accent)}
.toast-dialog h2{margin:0 0 7px;font-size:17px}
.toast-dialog p{font-size:14px;line-height:1.55;overflow-wrap:anywhere;color:#e4edf9}
.toast-close{align-self:start;padding:8px 10px;font-size:13px}
.toast-overlay.is-error .toast-icon{background:#ffb1b1;color:#351010}
.toast-overlay.is-error .toast-dialog{border-color:#9b515b}
.toast-overlay.is-success .toast-icon{background:var(--accent);color:#09231f}
@media(max-width:480px){.toast-overlay{padding:14px}.toast-dialog{grid-template-columns:38px minmax(0,1fr) auto;gap:11px;padding:18px}.toast-icon{width:36px;height:36px;font-size:20px}.toast-dialog h2{font-size:15px}.toast-dialog p{font-size:13px}.toast-close{padding:7px}}footer{text-align:center;padding:22px;color:#71839d;font-size:10px;border-top:1px solid #1c2a40}@media(max-width:1050px){.camera-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}@media(max-width:680px){.topbar{height:68px;padding:0 14px}.brand{gap:9px}.logo{width:36px;height:36px}.brand strong{font-size:12px}.brand small{font-size:10px}.top-actions{gap:7px}.top-actions .pill{font-size:10px;padding:6px 8px}.top-actions button{font-size:11px;padding:9px}.stats{gap:8px}.stat{padding:13px 11px}.stat span,.stat small{font-size:10px}.stat strong{font-size:25px}.lower-grid{grid-template-columns:1fr}.welcome{align-items:flex-start}.welcome .secondary{white-space:nowrap}.section-head{align-items:flex-start;flex-direction:column}.search{width:100%}.camera-grid{gap:9px}.camera-card{padding:13px}.camera-card h3{font-size:12px}.camera-card .sub{font-size:10px}.camera-top{margin-bottom:14px}.panel{padding:15px}main{padding-top:24px}}@media(max-width:390px){.brand small{display:none}.camera-grid{grid-template-columns:1fr}.stats{grid-template-columns:1fr}.stat{display:grid;grid-template-columns:1fr auto;align-items:center}.stat strong{grid-column:2;grid-row:1/3;margin:0}.stat small{grid-column:1}}

/* Camera detail view */
.camera-card-button{display:block;text-align:left;color:inherit;width:100%;appearance:none;cursor:pointer}.camera-card-button:focus-visible{outline:2px solid var(--accent);outline-offset:3px}.camera-open{display:inline-block;margin-top:14px;color:var(--accent);font-size:11px;font-weight:700}.detail-overlay{position:fixed;inset:0;z-index:30;display:grid;place-items:center;padding:20px}.detail-backdrop{position:absolute;inset:0;background:#020617c9;backdrop-filter:blur(5px)}.detail-card{position:relative;width:min(760px,100%);max-height:min(88vh,850px);overflow:auto;border:1px solid #344863;border-radius:20px;background:linear-gradient(155deg,#17243a,#0f192a);box-shadow:var(--shadow);padding:clamp(20px,4vw,30px)}.detail-head{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;padding-bottom:20px;border-bottom:1px solid var(--line)}.detail-head h2{font-size:24px;overflow-wrap:anywhere}.detail-head p{font-size:12px}.detail-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px;margin:20px 0}.detail-field{min-width:0;padding:13px;border:1px solid var(--line);border-radius:11px;background:#0c1627}.detail-field span,.detail-field strong{display:block;overflow-wrap:anywhere}.detail-field span{font-size:10px;color:var(--muted);margin-bottom:7px}.detail-field strong{font-size:12px}.detail-section{border-top:1px solid var(--line);padding-top:18px}.detail-section h3{font-size:15px;margin:0 0 8px}.detail-alarm{display:flex;gap:10px;align-items:flex-start;padding:12px 0;border-top:1px solid #25344a}.detail-alarm:first-of-type{border-top:0}.detail-alarm>div{min-width:0}.detail-alarm strong,.detail-alarm small{display:block;overflow-wrap:anywhere}.detail-alarm strong{font-size:12px}.detail-alarm small,.detail-empty,.detail-note{font-size:11px;color:var(--muted);line-height:1.5}.detail-alarm small{margin-top:4px}.detail-note{margin-top:18px}.modal-open{overflow:hidden}@media(max-width:620px){.detail-overlay{padding:10px}.detail-card{max-height:92vh;padding:18px}.detail-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.detail-head h2{font-size:20px}.detail-head .secondary{padding:9px 10px;white-space:nowrap}}

.live-actions{display:flex;justify-content:flex-start;margin-top:16px}.live-panel{margin-top:18px;padding:16px;border:1px solid var(--line);border-radius:14px;background:#0b1525}.live-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.live-head h3{margin:0;font-size:15px}.live-head p{margin:5px 0 0;font-size:11px;color:var(--muted)}.live-panel video{display:block;width:100%;max-height:60vh;aspect-ratio:16/9;background:#020617;border-radius:10px;object-fit:contain}.live-panel .error{margin-top:8px}.live-panel.hidden{display:none}

.live-diagnostics{margin-top:10px;font-size:12px;color:var(--muted)}.live-diagnostics summary{cursor:pointer;user-select:none}.live-diagnostics pre{max-height:260px;overflow:auto;white-space:pre-wrap;overflow-wrap:anywhere;padding:10px;background:#060d18;border:1px solid var(--line);border-radius:8px;color:#dbeafe;font:11px/1.5 ui-monospace,SFMono-Regular,Consolas,monospace}

.stream-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.stream-toolbar .detail-note{margin:0}.stream-config{display:grid;gap:10px}.stream-config>label,.stream-id-fields label{display:grid;gap:6px;font-size:12px;color:var(--muted)}.stream-config select,.stream-config input{width:100%;min-width:0;border:1px solid var(--line);border-radius:9px;padding:10px;background:#0f1b2e;color:var(--text);font:inherit}.stream-id-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}@media(max-width:560px){.stream-id-fields{grid-template-columns:1fr}}


/* Viste live 2x2 / 3x3 */
.views-panel{margin:8px 0 36px;padding:20px}.views-panel-heading{align-items:flex-start}.views-panel-heading>div{min-width:0}.views-panel-heading .pill{white-space:nowrap;font-size:11px}.views-toolbar{display:grid;grid-template-columns:minmax(160px,1.15fr) minmax(180px,1.3fr) minmax(145px,.8fr) auto;gap:12px;align-items:end;padding:16px 0;border-top:1px solid var(--line)}.views-toolbar label,.tile-select-label{display:grid;gap:6px;color:var(--muted);font-size:11px;min-width:0}.views-toolbar input,.views-toolbar select,.tile-select-label select{width:100%;min-width:0;border:1px solid var(--line);border-radius:9px;padding:10px;background:#0f1b2e;color:var(--text);font:inherit}.views-actions{display:flex;gap:7px;flex-wrap:wrap}.views-actions button{white-space:nowrap;padding:10px 12px;font-size:11px}.views-actions button:disabled{display:none}.view-run-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:0 0 16px}.view-run-toolbar p{font-size:11px;max-width:620px}.view-run-toolbar>div{display:flex;gap:8px;flex-shrink:0}.view-run-toolbar button{margin:0;width:auto;font-size:11px;padding:10px 13px}.live-views-grid{display:grid;gap:12px;align-items:stretch}.live-views-grid.layout-2{grid-template-columns:repeat(2,minmax(0,1fr))}.live-views-grid.layout-3{grid-template-columns:repeat(3,minmax(0,1fr))}.live-tile{min-width:0;border:1px solid #2a3e57;border-radius:12px;background:#081220;overflow:hidden;padding:10px}.live-tile-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:10px}.live-tile-head strong{font-size:11px}.live-tile-status{font-size:10px;color:var(--accent2);text-align:right}.tile-select-label{margin-bottom:8px}.tile-select-label select{padding:7px 8px;font-size:11px}.live-tile video{display:block;width:100%;aspect-ratio:16/9;max-height:42vh;object-fit:contain;background:#020617;border-radius:7px}.tile-actions{display:flex;align-items:center;gap:5px;flex-wrap:wrap;margin-top:8px}.tile-actions button{padding:7px 9px;font-size:10px}.tile-actions .text-btn{margin-left:auto}.tile-error{min-height:0;margin:6px 0 0;color:var(--danger);font-size:10px;line-height:1.4;overflow-wrap:anywhere}.tile-error:empty{display:none}
@media(max-width:1060px){.views-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}.views-actions{align-items:center}.live-views-grid.layout-3{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:680px){.views-panel{padding:14px}.views-panel-heading{flex-direction:column}.views-toolbar{grid-template-columns:1fr}.views-actions button{flex:1}.view-run-toolbar{align-items:stretch;flex-direction:column}.view-run-toolbar>div{display:grid;grid-template-columns:1fr 1fr}.live-views-grid.layout-2,.live-views-grid.layout-3{grid-template-columns:1fr}.live-tile video{max-height:50vh}}

/* Modalità operatore: mantiene il video in primo piano e nasconde gli strumenti amministrativi. */
#modeToggleBtn{white-space:nowrap}
#dashboard.operator-mode .welcome,
#dashboard.operator-mode .stats,
#dashboard.operator-mode > .section-head,
#dashboard.operator-mode > #cameraGrid,
#dashboard.operator-mode > .notice{display:none!important}
#dashboard.operator-mode > .lower-grid{display:none!important}
#dashboard.operator-mode #alarmDefinitionsPanel{display:none!important}
#dashboard.operator-mode #recentEventsPanel{margin:0;background:#07111e;border-color:#263a51}
#dashboard.operator-mode #recentEventsPanel .panel-head h2{font-size:20px}
#dashboard.operator-mode #recentEventsPanel .panel-head p{font-size:12px}
#dashboard.operator-mode .views-panel{margin-top:0;padding:clamp(14px,2vw,28px);background:#07111e;border-color:#263a51;}
#dashboard.operator-mode .views-panel-heading{align-items:center;margin-bottom:18px}
#dashboard.operator-mode .views-panel-heading h2{font-size:clamp(22px,2vw,30px);letter-spacing:-.5px}
#dashboard.operator-mode .views-panel-heading p{font-size:13px;max-width:780px;margin-top:7px}
#dashboard.operator-mode .views-toolbar{grid-template-columns:minmax(220px,360px) auto;align-items:end;padding:15px 0 20px}
#dashboard.operator-mode .views-toolbar label:nth-child(2),
#dashboard.operator-mode .views-toolbar label:nth-child(3),
#dashboard.operator-mode .views-toolbar .views-actions{display:none!important}
#dashboard.operator-mode .views-toolbar label:first-child{font-size:12px}
#dashboard.operator-mode .views-toolbar select{font-size:14px;padding:12px 13px}
#dashboard.operator-mode .view-run-toolbar{align-items:center;padding:0 0 18px}
#dashboard.operator-mode .view-run-toolbar p{font-size:12px;max-width:600px}
#dashboard.operator-mode .view-run-toolbar button{font-size:12px;padding:12px 16px}
#dashboard.operator-mode .live-views-grid{gap:14px}
#dashboard.operator-mode .live-tile{padding:10px;background:#030914;border-color:#263a51}
#dashboard.operator-mode .live-tile-head strong{font-size:12px}
#dashboard.operator-mode .live-tile-status{font-size:11px}
#dashboard.operator-mode .tile-select-label{display:none!important}
#dashboard.operator-mode .live-tile video{max-height:calc(100vh - 240px);min-height:120px;border-radius:8px}
#dashboard.operator-mode .tile-actions{justify-content:flex-end}
#dashboard.operator-mode .tile-actions [data-tile-play],
#dashboard.operator-mode .tile-actions [data-tile-stop]{display:none!important}
#dashboard.operator-mode .tile-actions [data-tile-main]{font-size:11px;padding:8px 12px}
#dashboard.operator-mode .tile-error{font-size:11px}
@media(max-width:680px){#dashboard.operator-mode .views-toolbar{grid-template-columns:1fr}#dashboard.operator-mode .view-run-toolbar>div{display:grid;grid-template-columns:1fr 1fr}#dashboard.operator-mode .live-tile video{max-height:46vh}}

/* Playback registrazioni 0.3.34 */
.playback-panel{margin:8px 0 36px;padding:20px}.playback-panel .panel-head{align-items:flex-start}.playback-toolbar{display:grid;grid-template-columns:minmax(180px,1.25fr) minmax(210px,1.2fr) minmax(110px,.55fr) minmax(190px,1fr) auto;gap:12px;align-items:end;padding:16px 0;border-top:1px solid var(--line)}.playback-toolbar label{display:grid;gap:6px;color:var(--muted);font-size:11px;min-width:0}.playback-toolbar select,.playback-toolbar input[type=datetime-local]{width:100%;min-width:0;border:1px solid var(--line);border-radius:9px;padding:10px;background:#0f1b2e;color:var(--text);font:inherit}.playback-toolbar .playback-check{display:flex;align-items:center;gap:8px;min-height:38px}.playback-check input{accent-color:var(--accent);width:16px;height:16px}.playback-actions{display:flex;gap:8px}.playback-actions button{white-space:nowrap;padding:10px 13px;font-size:11px}.playback-player-wrap{margin-top:12px;padding:14px;border:1px solid #2a3e57;border-radius:12px;background:#081220}.playback-player-head{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:10px;font-size:12px}.playback-player-head span{font-size:11px;color:var(--muted)}.playback-player-wrap video{display:block;width:100%;max-height:65vh;aspect-ratio:16/9;object-fit:contain;background:#020617;border-radius:8px}.playback-help{font-size:11px;color:var(--muted);line-height:1.5}.playback-player-wrap .error{margin-top:8px}.playback-player-wrap.hidden{display:none}@media(max-width:1150px){.playback-toolbar{grid-template-columns:repeat(2,minmax(0,1fr))}.playback-actions{grid-column:1/-1}}@media(max-width:680px){.playback-panel{padding:14px}.playback-toolbar{grid-template-columns:1fr}.playback-actions{grid-column:auto}.playback-actions button{flex:1}.playback-player-head{align-items:flex-start;flex-direction:column}}

.recording-search{margin:14px 0 18px;padding:14px;border:1px solid var(--line);border-radius:12px;background:rgba(15,27,46,.45)}
.recording-search-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
.recording-search-head strong{font-size:13px}.recording-search-head p{margin:4px 0 0;color:var(--muted);font-size:11px}
.recording-range{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}
.recording-range label{display:grid;gap:6px;color:var(--muted);font-size:11px}
.recording-range input{width:100%;min-width:0;border:1px solid var(--line);border-radius:9px;padding:10px;background:#0f1b2e;color:var(--text);font:inherit}
.recording-periods-status{font-size:11px;color:var(--muted);margin:12px 0}
.recording-timeline{padding:10px 0 4px}
.recording-timeline-axis{display:flex;justify-content:space-between;color:var(--muted);font-size:10px;margin-bottom:7px}
.recording-timeline-track{height:30px;position:relative;border-radius:6px;background:repeating-linear-gradient(90deg,#25344a 0,#25344a 1px,transparent 1px,transparent 10%);border:1px solid var(--line);overflow:hidden}
.recording-timeline-legend{display:flex;flex-wrap:wrap;gap:8px 14px;margin:0 0 8px;color:var(--muted);font-size:10px}
.recording-timeline-legend-item{display:inline-flex;align-items:center;gap:5px}
.recording-legend-swatch{display:inline-block;width:14px;height:8px;border-radius:2px;border:1px solid rgba(255,255,255,.3)}
.recording-legend-swatch--recording{background:#16c784}
.recording-legend-swatch--motion{background:repeating-linear-gradient(135deg,#ffb020 0,#ffb020 4px,#ffe39a 4px,#ffe39a 7px)}
.recording-legend-swatch--event{background:#d58bff}
.recording-legend-swatch--other{background:#60b6ff}
.recording-segment{position:absolute;top:3px;bottom:3px;min-width:3px;padding:0;border:0;border-radius:3px;background:#16c784;cursor:pointer;box-shadow:0 0 0 1px rgba(4,13,24,.25)}
.recording-segment--recording{background:#16c784}
.recording-segment--motion{background:repeating-linear-gradient(135deg,#ffb020 0,#ffb020 5px,#ffe39a 5px,#ffe39a 8px);border:1px solid #fff0bd}
.recording-segment--event{background:#d58bff;border:1px solid #f3d8ff}
.recording-segment--other{background:#60b6ff}
.recording-segment:hover,.recording-segment:focus-visible{filter:brightness(1.22);outline:2px solid #fff;outline-offset:1px}
.recording-periods-list{display:grid;gap:5px;max-height:230px;overflow:auto}
.recording-period-row{display:flex;align-items:center;gap:10px;text-align:left;width:100%;padding:9px 10px;border:1px solid var(--line);border-radius:8px;background:#101d30;color:var(--text);cursor:pointer}
.recording-period-row:hover{border-color:var(--accent)}
.recording-period-row>span:nth-child(2){display:grid;gap:3px;flex:1;min-width:0}.recording-period-row strong{font-size:11px}.recording-period-row small{font-size:10px;color:var(--muted)}
.recording-period-dot{width:8px;height:8px;border-radius:50%;background:#32c48d;flex:none}.recording-period-play{font-size:12px;color:var(--accent)}
.recording-timeline.hidden{display:none}
@media(max-width:680px){.recording-search-head{align-items:flex-start;flex-direction:column}.recording-range{grid-template-columns:1fr}}
.playback-seek-toolbar{display:flex;align-items:center;gap:8px;flex-wrap:wrap;padding:0 0 14px;border-bottom:1px solid var(--line);margin-bottom:14px}
.playback-seek-label{font-size:11px;color:var(--muted);font-weight:700;margin-right:4px}
.playback-seek-toolbar button{padding:8px 12px;font-size:11px;white-space:nowrap}
@media(max-width:680px){.recording-search{margin:14px 0 18px;padding:14px;border:1px solid var(--line);border-radius:12px;background:rgba(15,27,46,.45)}
.recording-search-head{display:flex;justify-content:space-between;align-items:center;gap:12px}
.recording-search-head strong{font-size:13px}.recording-search-head p{margin:4px 0 0;color:var(--muted);font-size:11px}
.recording-range{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}
.recording-range label{display:grid;gap:6px;color:var(--muted);font-size:11px}
.recording-range input{width:100%;min-width:0;border:1px solid var(--line);border-radius:9px;padding:10px;background:#0f1b2e;color:var(--text);font:inherit}
.recording-periods-status{font-size:11px;color:var(--muted);margin:12px 0}
.recording-timeline{padding:10px 0 4px}
.recording-timeline-axis{display:flex;justify-content:space-between;color:var(--muted);font-size:10px;margin-bottom:7px}
.recording-timeline-track{height:30px;position:relative;border-radius:6px;background:repeating-linear-gradient(90deg,#25344a 0,#25344a 1px,transparent 1px,transparent 10%);border:1px solid var(--line);overflow:hidden}
.recording-timeline-legend{display:flex;flex-wrap:wrap;gap:8px 14px;margin:0 0 8px;color:var(--muted);font-size:10px}
.recording-timeline-legend-item{display:inline-flex;align-items:center;gap:5px}
.recording-legend-swatch{display:inline-block;width:14px;height:8px;border-radius:2px;border:1px solid rgba(255,255,255,.3)}
.recording-legend-swatch--recording{background:#16c784}
.recording-legend-swatch--motion{background:repeating-linear-gradient(135deg,#ffb020 0,#ffb020 4px,#ffe39a 4px,#ffe39a 7px)}
.recording-legend-swatch--event{background:#d58bff}
.recording-legend-swatch--other{background:#60b6ff}
.recording-segment{position:absolute;top:3px;bottom:3px;min-width:3px;padding:0;border:0;border-radius:3px;background:#16c784;cursor:pointer;box-shadow:0 0 0 1px rgba(4,13,24,.25)}
.recording-segment--recording{background:#16c784}
.recording-segment--motion{background:repeating-linear-gradient(135deg,#ffb020 0,#ffb020 5px,#ffe39a 5px,#ffe39a 8px);border:1px solid #fff0bd}
.recording-segment--event{background:#d58bff;border:1px solid #f3d8ff}
.recording-segment--other{background:#60b6ff}
.recording-segment:hover,.recording-segment:focus-visible{filter:brightness(1.22);outline:2px solid #fff;outline-offset:1px}
.recording-periods-list{display:grid;gap:5px;max-height:230px;overflow:auto}
.recording-period-row{display:flex;align-items:center;gap:10px;text-align:left;width:100%;padding:9px 10px;border:1px solid var(--line);border-radius:8px;background:#101d30;color:var(--text);cursor:pointer}
.recording-period-row:hover{border-color:var(--accent)}
.recording-period-row>span:nth-child(2){display:grid;gap:3px;flex:1;min-width:0}.recording-period-row strong{font-size:11px}.recording-period-row small{font-size:10px;color:var(--muted)}
.recording-period-dot{width:8px;height:8px;border-radius:50%;background:#32c48d;flex:none}.recording-period-play{font-size:12px;color:var(--accent)}
.recording-timeline.hidden{display:none}
@media(max-width:680px){.recording-search-head{align-items:flex-start;flex-direction:column}.recording-range{grid-template-columns:1fr}}
.playback-seek-toolbar{gap:6px}.playback-seek-label{width:100%}.playback-seek-toolbar button{flex:1;min-width:70px}}

.playback-stream-control{display:flex;align-items:center;gap:10px;flex-wrap:wrap;align-self:end;padding-bottom:2px}
.playback-stream-label{font-size:11px;color:var(--muted);font-weight:700}
.playback-stream-control button{padding:9px 12px;font-size:11px;white-space:nowrap}
@media(max-width:680px){.playback-stream-control{align-items:stretch}.playback-stream-control button{flex:1}}

/* Eventi cliccabili e scelta delle telecamere correlate. */
.event-row-button{width:100%;text-align:left;color:inherit;background:transparent;border:0;border-radius:8px;padding:13px 8px;display:flex;align-items:flex-start;gap:11px;border-top:1px solid #25344a}.event-row-button:hover,.event-row-button:focus-visible{background:#1a2940;outline:1px solid #3e6276}.event-row-button .list-mark{margin-left:2px}.event-camera-hint{color:var(--accent)!important}.event-open-mark{color:var(--accent);font-size:24px;line-height:1;padding:0 5px}.event-camera-card{width:min(680px,100%)}.event-camera-list{display:flex;flex-direction:column;margin-top:12px}.event-camera-item{display:flex;align-items:center;gap:12px;padding:14px 0;border-top:1px solid var(--line)}.event-camera-name{flex:1;min-width:0}.event-camera-name strong,.event-camera-name small{display:block;overflow-wrap:anywhere}.event-camera-name strong{font-size:13px}.event-camera-name small{font-size:11px;color:var(--muted);margin-top:5px}.event-camera-open{width:auto;white-space:nowrap;margin:0;padding:10px 13px}@media(max-width:520px){.event-camera-item{align-items:flex-start;flex-wrap:wrap}.event-camera-name{min-width:calc(100% - 55px)}.event-camera-open{margin-left:50px}}


/* Interfaccia operatore a sezioni - versione 0.3.45 */
.brand-logo{width:58px;height:58px;object-fit:contain;border-radius:9px;background:#fff;padding:3px;flex-shrink:0}
.operator-nav{display:flex;gap:8px;align-items:stretch;margin:0 0 20px;padding:8px;border:1px solid var(--line);border-radius:14px;background:#07111e;overflow-x:auto;scrollbar-width:thin}
.operator-nav-item{display:flex;align-items:center;justify-content:center;gap:9px;min-width:max-content;flex:1;border:1px solid transparent;border-radius:10px;padding:13px 17px;background:transparent;color:var(--muted);font:inherit;font-size:13px;font-weight:650;cursor:pointer;transition:background .15s,border-color .15s,color .15s}
.operator-nav-item:hover{background:#13233a;color:var(--text)}.operator-nav-item.active{background:var(--accent);color:#fff;border-color:rgba(255,255,255,.18);box-shadow:0 4px 16px rgba(0,0,0,.18)}
.nav-symbol{font-size:18px;line-height:1}.operator-section-active{display:block!important}.operator-mode [data-operator-panel]:not(.operator-section-active){display:none!important}
#dashboard.operator-mode .operator-nav{position:sticky;top:8px;z-index:20;box-shadow:0 8px 24px rgba(0,0,0,.18)}
#dashboard.operator-mode #operatorViewsSection,#dashboard.operator-mode #operatorRecordingsSection,#dashboard.operator-mode #recentEventsPanel,#dashboard.operator-mode .operator-placeholder{margin-top:0;margin-bottom:18px}
#dashboard.operator-mode .lower-grid{display:contents!important}#dashboard.operator-mode #recentEventsPanel{grid-column:1/-1}
.operator-placeholder{min-height:280px;padding:20px}.operator-placeholder-body{min-height:200px;display:flex;flex-direction:column;align-items:center;justify-content:center;text-align:center;gap:10px;color:var(--muted);padding:25px}.operator-placeholder-body strong{font-size:17px;color:var(--text)}.operator-placeholder-body p{max-width:540px;font-size:13px;line-height:1.6}.placeholder-icon{display:grid;place-items:center;width:58px;height:58px;border-radius:16px;background:#13233a;color:var(--accent);font-size:28px}
@media(max-width:760px){.operator-nav{gap:5px;padding:5px}.operator-nav-item{flex:0 0 auto;padding:11px 13px;font-size:12px}.operator-nav-item .nav-symbol{font-size:16px}.brand-logo{width:44px;height:44px}}

/* Eventi: video correlato incorporato nella sezione, non nel menu Registrazioni. */
.event-playback-host{display:grid;gap:12px;margin:14px 0 18px}.event-playback-empty{border:1px dashed var(--line);border-radius:12px;padding:22px;color:var(--muted);font-size:12px;text-align:center;background:#0b1424}.event-playback-host .playback-player-wrap{display:block!important;margin:0}.event-playback-host video{width:100%;max-height:min(62vh,680px);background:#02060c;object-fit:contain;border-radius:10px}.event-camera-inline-list{display:flex;flex-direction:column;gap:8px;margin:12px 0 18px}.event-camera-inline-heading{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:10px 0;color:var(--text);font-size:12px}.event-camera-inline-heading span{color:var(--muted);font-size:11px}.event-camera-inline-list .event-camera-item{display:flex;align-items:center;gap:12px;border:1px solid var(--line);background:#0d1727;border-radius:12px;padding:12px}.event-camera-inline-list .event-camera-name{flex:1;min-width:0}.event-camera-inline-list .event-camera-name strong{display:block;font-size:12px}.event-camera-inline-list .event-camera-name small{display:block;color:var(--muted);font-size:10px;margin-top:4px}.event-camera-inline-list .event-camera-open{width:auto;white-space:nowrap;margin:0;font-size:11px;padding:9px 12px}.event-row-button{width:100%;background:transparent;color:var(--text);text-align:left;border-radius:0}.event-row-button:hover{background:#132139}.operator-mode #recentEventsPanel{display:none!important}.operator-mode #recentEventsPanel.operator-section-active{display:block!important}

/* TecnoAlarm EV 10-50 - step 0.3.49 */
.tecno-panel{margin-top:18px}.tecno-connection-box{border:1px solid var(--line);background:#0d1727;border-radius:14px;padding:16px;margin:16px 0 22px}.tecno-connect-grid{display:grid;grid-template-columns:minmax(160px,.8fr) minmax(220px,1.2fr) auto;gap:13px;align-items:end}.tecno-connect-grid label{display:block;color:#c5d2e5;font-size:12px}.tecno-connect-grid input{display:block;width:100%;margin-top:7px;padding:12px;border:1px solid var(--line);border-radius:9px;background:#080f1c;color:var(--text);outline:none}.tecno-connect-grid input:focus{border-color:var(--accent)}.tecno-connect-actions{display:flex;gap:8px;align-items:center}.tecno-connect-actions button{white-space:nowrap;width:auto;margin:0}.tecno-help{font-size:11px;line-height:1.55;margin-top:12px}.tecno-help strong{color:var(--text)}.tecno-toolbar{display:flex;justify-content:space-between;align-items:center;gap:16px;padding:5px 0 18px;border-bottom:1px solid var(--line);margin-bottom:19px}.tecno-toolbar>div>strong{font-size:13px}.tecno-toolbar p{font-size:11px;margin-top:5px}.tecno-toolbar button{white-space:nowrap}.tecno-message{padding:12px 14px;border-radius:10px;margin:0 0 18px;font-size:12px;line-height:1.55}.tecno-message.is-success{color:#b4f4df;background:#0e302d;border:1px solid #28675d}.tecno-message.is-error{color:#ffd0d0;background:#351b24;border:1px solid #7d3945}.tecno-section-head{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;margin:18px 0 12px}.tecno-section-head h3{margin:0 0 5px;font-size:17px}.tecno-section-head p{font-size:11px}.tecno-program-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.tecno-item-card,.tecno-zone-card{min-width:0;border:1px solid var(--line);border-radius:13px;padding:14px;background:linear-gradient(145deg,#122037,#0d1727)}.tecno-item-top{display:flex;justify-content:space-between;align-items:flex-start;gap:12px}.tecno-item-top h4{font-size:14px;margin:5px 0 0;overflow-wrap:anywhere}.tecno-item-number{font-size:9px;font-weight:800;letter-spacing:1px;color:var(--accent)}.tecno-state-indicator,.tecno-zone-number{display:inline-flex;align-items:center;justify-content:center;font-size:10px;border:1px solid var(--line);border-radius:100px;padding:6px 9px;white-space:nowrap}.tecno-state-indicator.is-alarm{border-color:#8a3e4b;background:#371922;color:#ffc1c1}.tecno-state-indicator.is-unknown{color:#c5d2e5;background:#101b2d}.tecno-state-indicator.is-armed{border-color:#9a742e;background:#302719;color:#ffe0a2}.tecno-state-indicator.is-disarmed{border-color:#28675d;background:#0e302d;color:#b4f4df}.tecno-chip-row{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:12px 0}.tecno-chip{display:inline-flex;align-items:center;border:1px solid var(--line);border-radius:6px;padding:5px 7px;font-size:9px;font-weight:750;letter-spacing:.2px}.tecno-chip.good{color:#b4f4df;border-color:#28675d;background:#0e302d}.tecno-chip.alarm{color:#ffc1c1;border-color:#8a3e4b;background:#371922}.tecno-chip.warning{color:#ffe0a2;border-color:#755825;background:#332814}.tecno-chip.neutral{color:#b6c4d9;background:#101b2d}.tecno-item-actions{display:flex;flex-wrap:wrap;gap:7px;margin-top:13px}.tecno-item-actions button{width:auto;margin:0;padding:9px 11px;font-size:10px}.danger-btn{background:#8f2f40;border:1px solid #c34c5e;color:white}.tecno-zones-head{margin-top:27px}.tecno-zones-head .search{width:min(100%,260px)}.tecno-zones-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}.tecno-zone-card h4{font-size:12px}.tecno-zone-number{min-width:32px;padding:6px;background:#102e35;color:#b9f1e4;border-color:#27665e}.tecno-zone-bottom{display:flex;align-items:center;justify-content:space-between;gap:9px;border-top:1px solid #25344a;padding-top:10px;margin-top:10px}.tecno-zone-bottom small{font-size:9px;color:var(--muted)}.tecno-zone-bottom button{white-space:nowrap;width:auto;margin:0;padding:8px 10px;font-size:10px}.tecno-decode-note{border-top:1px solid var(--line);padding-top:13px;margin:20px 0 4px}.tecno-force-banner{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center;gap:20px;padding:17px;border-radius:13px;border:1px solid #a65b39;background:#3a241b;margin:0 0 20px}.tecno-force-banner strong{font-size:13px;color:#ffcfaa}.tecno-force-banner p{font-size:11px;line-height:1.6;margin-top:6px;color:#ffe3d0}.tecno-force-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.tecno-force-actions button{white-space:nowrap;width:auto;margin:0;font-size:11px}
#dashboard.operator-mode #operatorIntrusionSection{margin-top:0}#dashboard.operator-mode #operatorIntrusionSection .tecno-program-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
@media(max-width:850px){.tecno-connect-grid{grid-template-columns:1fr 1fr}.tecno-connect-actions{grid-column:1/-1}.tecno-zones-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.tecno-force-banner{grid-template-columns:1fr}}
@media(max-width:560px){.tecno-connect-grid,.tecno-program-grid,.tecno-zones-grid,#dashboard.operator-mode #operatorIntrusionSection .tecno-program-grid{grid-template-columns:1fr}.tecno-connect-actions{display:grid;grid-template-columns:1fr 1fr}.tecno-toolbar,.tecno-section-head{align-items:flex-start;flex-direction:column}.tecno-toolbar button,.tecno-zones-head .search{width:100%}.tecno-item-actions button{flex:1 1 auto}.tecno-force-actions{display:grid;grid-template-columns:1fr 1fr}.tecno-zone-bottom{align-items:flex-start;flex-direction:column}.tecno-zone-bottom button{width:100%}}


/* TecnoAlarm: conferme integrate, gruppi zone per programma e aggiornamento incrementale. */
.tecno-program-zone-group{margin-top:14px;padding:12px;border:1px solid #2b425b;border-radius:11px;background:#0a1422}
.tecno-program-zone-group-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:11px}
.tecno-program-zone-group-head strong{font-size:12px;display:block}
.tecno-program-zone-group-head p{font-size:10px;margin-top:4px;line-height:1.45}
.tecno-program-zone-group-head button{width:auto;margin:0;white-space:nowrap;font-size:10px;padding:8px 10px}
.tecno-program-zone-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px}
.tecno-program-zone-list>.empty{grid-column:1/-1}
.tecno-program-zone-list .tecno-zone-card{padding:11px;background:#101d30}
.tecno-program-zone-list .tecno-zone-bottom{align-items:flex-start}
.tecno-program-zone-list .tecno-zone-bottom small{overflow-wrap:anywhere}
.tecno-program-zone-list .tecno-zone-bottom button{font-size:10px}
.tecno-program-zones-toggle{border-color:#34566a}
#dashboard.operator-mode #operatorIntrusionSection .tecno-zones-head,
#dashboard.operator-mode #operatorIntrusionSection #tecnoZonesList{display:none!important}
.tecno-confirm-overlay{position:fixed;inset:0;z-index:1200;display:grid;place-items:center;padding:20px}
.tecno-confirm-backdrop{position:absolute;inset:0;background:#020617d9;backdrop-filter:blur(5px)}
.tecno-confirm-card{position:relative;display:grid;grid-template-columns:42px minmax(0,1fr);gap:15px;width:min(520px,100%);max-height:88vh;overflow:auto;padding:23px;border:1px solid #3a526e;border-radius:17px;background:linear-gradient(155deg,#192943,#101a2b);box-shadow:0 24px 90px #000a}
.tecno-confirm-icon{width:40px;height:40px;display:grid;place-items:center;border-radius:50%;background:#3a2a18;border:1px solid #87642d;color:#ffdf9c;font-size:22px;font-weight:850}
.tecno-confirm-copy h3{font-size:17px;margin:1px 0 10px}
.tecno-confirm-copy p{font-size:14px;line-height:1.55;color:#e4edf9;overflow-wrap:anywhere}
.tecno-confirm-copy small{display:block;margin-top:9px;color:var(--muted);font-size:11px;line-height:1.55}
.tecno-confirm-actions{grid-column:1/-1;display:flex;justify-content:flex-end;gap:9px;margin-top:4px}
.tecno-confirm-actions button{width:auto;margin:0;min-width:105px}
@media(max-width:650px){.tecno-program-zone-list{grid-template-columns:1fr}.tecno-program-zone-group-head{align-items:flex-start;flex-direction:column}.tecno-program-zone-group-head button{width:100%}.tecno-confirm-card{grid-template-columns:34px minmax(0,1fr);padding:17px;gap:11px}.tecno-confirm-icon{width:32px;height:32px;font-size:18px}.tecno-confirm-actions{display:grid;grid-template-columns:1fr 1fr}.tecno-confirm-actions button{min-width:0;width:100%}}

/* Friendly event camera/rule metadata (0.3.52). */
.event-camera-description{display:block;color:#b6e3ff!important;font-weight:600;margin-top:3px}
.event-rule-description{display:block;color:#ffc76b!important;margin-top:2px}

/* Automazioni TecnoAlarm: telecomandi */
.automation-toolbar{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:12px 0 18px;border-bottom:1px solid var(--line);margin-bottom:16px}.automation-toolbar strong{font-size:14px}.automation-toolbar p{font-size:11px;margin-top:5px}.automation-toolbar button{width:auto;margin:0;white-space:nowrap}.tecno-remote-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.tecno-remote-card{min-width:0}.tecno-remote-bottom{display:flex;align-items:center;justify-content:space-between;gap:10px;border-top:1px solid #25344a;padding-top:10px;margin-top:12px}.tecno-remote-bottom small{font-size:10px;color:var(--muted);line-height:1.45}.tecno-remote-bottom button{width:auto;min-width:100px;white-space:nowrap;margin:0}.automation-state-note{margin-top:16px;padding:11px 13px;border:1px solid var(--line);border-radius:9px;background:#0d1727}.operator-mode #operatorAutomationSection .operator-placeholder-body{display:none}
@media(max-width:700px){.tecno-remote-grid{grid-template-columns:1fr}.automation-toolbar{align-items:flex-start;flex-direction:column}.automation-toolbar button{width:100%}.tecno-remote-bottom{align-items:flex-start;flex-direction:column}.tecno-remote-bottom button{width:100%}}

.automation-remote-updated{display:block;margin-top:6px;font-size:10px;color:var(--muted);line-height:1.4}.automation-remote-updated.is-error{color:var(--danger,#ff7777)}

/* 0.3.55 - Eventi definiti di Milestone nell'area Automazioni */
.automation-subsection-head{display:flex;align-items:flex-end;justify-content:space-between;gap:14px;padding:22px 0 14px;margin-top:20px;border-top:1px solid var(--line)}
.automation-subsection-head h3{font-size:16px;margin:0 0 5px}.automation-subsection-head p{font-size:11px;line-height:1.5;margin:0 0 5px;max-width:740px}.automation-subsection-head button{width:auto;margin:0;white-space:nowrap}
.milestone-user-event-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
.milestone-user-event-card{min-width:0;border:1px solid var(--line);border-radius:13px;padding:14px;background:linear-gradient(145deg,#122037,#0d1727)}
.milestone-user-event-card h4{margin:5px 0 0;font-size:13px;overflow-wrap:anywhere}.milestone-user-event-card p{font-size:11px;line-height:1.5;color:#c5d2e5;margin:10px 0 0;white-space:pre-wrap;overflow-wrap:anywhere}
.milestone-user-event-meta{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-top:12px}.milestone-user-event-meta small{font-size:10px;color:var(--muted)}
.milestone-user-event-actions{display:flex;align-items:center;justify-content:space-between;gap:10px;border-top:1px solid #25344a;margin-top:12px;padding-top:11px}.milestone-user-event-actions button{width:auto;margin:0;white-space:nowrap}.milestone-user-event-last{font-size:10px;color:var(--muted);line-height:1.4}
.milestone-user-event-card.is-sending{opacity:.72}.milestone-user-event-card.is-sending button{pointer-events:none}
@media(max-width:700px){.milestone-user-event-grid{grid-template-columns:1fr}.automation-subsection-head{align-items:flex-start;flex-direction:column}.automation-subsection-head button{width:100%}.milestone-user-event-actions{align-items:flex-start;flex-direction:column}.milestone-user-event-actions button{width:100%}}

/* Milestone I/O in Automazioni */
.milestone-io-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin:10px 0 22px}
.milestone-io-columns>div>h4{margin:0 0 10px}
.milestone-io-columns .milestone-user-event-grid{grid-template-columns:1fr}
@media(max-width:850px){.milestone-io-columns{grid-template-columns:1fr}}

/* ADAM MQTT test panel */
.panel-subtle{padding:14px;border:1px solid var(--line);border-radius:12px;background:rgba(12,20,34,.42);margin:8px 0 16px}.adam-mqtt-config-grid{display:grid;grid-template-columns:minmax(0,2fr) minmax(100px,1fr);gap:12px}.adam-mqtt-module-config-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:12px}.adam-mqtt-module-config-grid fieldset{border:1px solid var(--line);border-radius:10px;padding:12px;display:grid;gap:10px;min-width:0}.adam-mqtt-module-config-grid legend{padding:0 6px;color:var(--text);font-weight:700}.adam-mqtt-config-actions{display:flex;align-items:center;gap:12px;margin-top:12px}.adam-mqtt-config-actions button{width:auto;margin:0}.adam-mqtt-modules{display:grid;grid-template-columns:1fr;gap:14px}.adam-module-card{border:1px solid var(--line);border-radius:12px;padding:14px;min-width:0}.adam-module-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.adam-module-head h4{margin:0 0 4px}.adam-module-head small,.adam-module-meta{font-size:11px;color:var(--muted);overflow-wrap:anywhere}.adam-module-meta{margin:10px 0 14px}.adam-channel-columns{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.adam-channel-columns h5{margin:0 0 8px;font-size:12px}.adam-channel-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:7px}.adam-channel{display:flex;align-items:center;justify-content:space-between;gap:6px;border:1px solid var(--line);border-radius:8px;padding:8px;min-width:0}.adam-channel strong{display:block;font-size:12px}.adam-channel small{display:block;font-size:10px;color:var(--muted)}.adam-channel .tecno-chip{white-space:nowrap;font-size:9px;padding:4px 6px}@media(max-width:700px){.adam-mqtt-config-grid,.adam-mqtt-module-config-grid,.adam-channel-columns{grid-template-columns:1fr}.adam-mqtt-config-actions{align-items:stretch;flex-direction:column}.adam-mqtt-config-actions button{width:100%}.adam-channel-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.adam-module-head{align-items:flex-start;flex-direction:column}}

/* 0.3.67: stati degli I/O Milestone derivati dall'ADAM, non da Events & State */
.adam-milestone-state{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-top:12px}
.adam-status-led{display:inline-block;width:13px;height:13px;min-width:13px;border-radius:50%;border:1px solid #64748b;background:#475569;box-shadow:inset 0 0 0 2px rgba(255,255,255,.08)}
.adam-status-led.is-on{background:#22c55e;border-color:#86efac;box-shadow:0 0 9px rgba(34,197,94,.65)}
.adam-status-led.is-off{background:#475569;border-color:#94a3b8;box-shadow:none}
.adam-status-led.is-unknown{background:#f59e0b;border-color:#fcd34d;box-shadow:0 0 7px rgba(245,158,11,.35)}
.adam-io-map-label{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:12px;color:var(--muted);font-size:11px}
.adam-io-map-label select{max-width:145px;min-width:120px;padding:7px 9px;border:1px solid var(--line);border-radius:8px;background:var(--panel);color:var(--text)}

/* 0.3.68: operator view streamlined; ADAM configuration is administrative only. */
#dashboard.operator-mode #operatorAutomationSection .automation-subsection-head:has(#adamMqttUpdated),
#dashboard.operator-mode #operatorAutomationSection .adam-mqtt-config,
#dashboard.operator-mode #operatorAutomationSection #adamMqttModules,
#dashboard.operator-mode #operatorAutomationSection #adamMqttUpdated {display:none!important}
.adam-status-led{width:24px;height:24px;min-width:24px;border-width:2px;box-shadow:inset 0 0 0 3px rgba(255,255,255,.10)}
.adam-status-led.is-on{box-shadow:0 0 14px rgba(34,197,94,.8)}
.adam-io-map-label select{max-width:min(360px,65%);min-width:200px}
.adam-milestone-state .tecno-chip{font-size:11px;padding:5px 8px}


/* 0.3.68.3: improve contrast in ADAM association dropdowns */
.adam-io-map-label{color:var(--text)}
.adam-io-map-label select{background-color:#111b2e!important;color:#edf3ff!important;border-color:#45607f!important;color-scheme:dark;box-shadow:0 0 0 1px rgba(100,214,188,.08)}
.adam-io-map-label select:focus{outline:2px solid #64d6bc;outline-offset:2px}
.adam-io-map-label select option{background-color:#111b2e!important;color:#edf3ff!important}
.adam-io-map-label select optgroup{background-color:#111b2e!important;color:#9de8d7!important}


/* 0.3.69 experimental: compact operator events panel */
.events-collapse-btn{width:auto;white-space:nowrap;min-width:126px;margin:0}.events-detail-heading{margin:6px 0 0;padding-top:12px;border-top:1px solid var(--line)}.events-detail-heading h3{margin:0;font-size:14px}.events-detail-heading p{margin-top:4px;font-size:11px}.operator-mode #recentEventsPanel .events-panel-heading{align-items:center}.operator-mode #recentEventsPanel .events-panel-heading p{margin-top:4px}.operator-mode #recentEventsPanel .events-collapse-btn{min-height:42px}.operator-mode #operatorEventsContent.hidden{display:none!important}.operator-mode #operatorEventsContent:not(.hidden){display:block}.operator-mode .milestone-user-event-meta{display:none!important}.operator-mode .milestone-user-event-card p{font-size:12px}.operator-mode .milestone-user-event-last{font-size:12px}

/* 0.3.70: eventi compatti SOLO nella gestione; operatore sempre espanso. Le associazioni ADAM/I-O si configurano solo in gestione. */
#dashboard:not(.operator-mode) #operatorEventsContent.hidden{display:none!important}
#dashboard:not(.operator-mode) #toggleOperatorEventsBtn{display:inline-flex!important}
#dashboard.operator-mode #toggleOperatorEventsBtn{display:none!important}
#dashboard.operator-mode .adam-io-map-label{display:none!important}


/* 0.3.72: real management navigation and section switching */
.management-nav{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:7px;margin:0 0 8px;padding:9px;border:1px solid var(--line);border-radius:14px;background:#07111e;box-shadow:0 8px 24px rgba(0,0,0,.14)}
.management-nav-item{display:flex;align-items:center;justify-content:center;gap:8px;min-width:0;min-height:46px;padding:10px 9px;border:1px solid transparent;border-radius:10px;background:transparent;color:var(--muted);font:inherit;font-size:12px;font-weight:700;cursor:pointer;transition:background .15s,border-color .15s,color .15s}
.management-nav-item:hover{background:#13233a;color:var(--text)}.management-nav-item.active{background:var(--accent);color:#fff;border-color:rgba(255,255,255,.18);box-shadow:0 4px 16px rgba(0,0,0,.18)}.management-nav-item .nav-symbol{font-size:17px;flex:0 0 auto}
.management-subnav{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:0 0 18px;padding:0 2px 9px;border-bottom:1px solid var(--line)}
.management-subnav-item{border:1px solid var(--line);border-radius:999px;background:#0d1727;color:var(--muted);font:inherit;font-size:11px;font-weight:650;padding:8px 13px;cursor:pointer}.management-subnav-item:hover,.management-subnav-item.active{background:#172a43;color:var(--text);border-color:#34506f}
#dashboard:not(.operator-mode) [data-management-content].management-section-hidden{display:none!important}
#dashboard.operator-mode #managementNav,#dashboard.operator-mode #managementSubnav,#dashboard.operator-mode #managementAdminWorkspace{display:none!important}
.management-admin-workspace{min-height:270px;margin:0 0 20px}.management-admin-workspace .panel-head{margin-bottom:20px}.management-workspace-subgroups{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px;margin:18px 0}.management-subgroup-card{display:flex;flex-direction:column;align-items:flex-start;gap:8px;min-height:86px;text-align:left;border:1px solid var(--line);border-radius:12px;padding:15px;background:#0d1727;color:var(--text);cursor:pointer;font:inherit}.management-subgroup-card span{font-size:11px;color:var(--muted)}.management-subgroup-card:hover,.management-subgroup-card.active{border-color:#42658c;background:#13233a}.management-workspace-detail{border:1px solid var(--line);border-radius:12px;background:#0b1424;padding:15px;color:var(--muted);font-size:12px;line-height:1.65}
.management-target-highlight{outline:2px solid var(--accent);outline-offset:3px;transition:outline-color .2s}
@media(max-width:1000px){.management-nav{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:580px){.management-nav{grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;padding:7px}.management-nav-item{justify-content:flex-start;min-height:42px;padding:10px;font-size:12px}.management-subnav{gap:6px}.management-subnav-item{font-size:10px;padding:8px 10px}}


/* 0.3.73: make the Management area unmistakable and resilient to stale hidden classes. */
.build-version-tag{color:#64d6bc!important;font-weight:700;letter-spacing:.2px}
.management-menu-header{display:flex;align-items:center;justify-content:space-between;gap:18px;margin:2px 0 14px;padding:0 2px 4px}
.management-menu-header h1{font-size:clamp(25px,3vw,34px);margin:0 0 5px;letter-spacing:-.7px}
.management-menu-header p{font-size:12px;max-width:760px}
.management-version-chip{flex:0 0 auto;border:1px solid #2c6e65;background:#102a2c;color:#9de8d7;border-radius:999px;padding:8px 12px;font-size:10px;font-weight:800;letter-spacing:.7px}
#dashboard:not(.operator-mode) #managementMenuHeader{display:flex!important;visibility:visible!important}
#dashboard:not(.operator-mode) #managementNav{display:grid!important;visibility:visible!important;opacity:1!important}
#dashboard:not(.operator-mode) #managementSubnav{display:flex!important;visibility:visible!important;opacity:1!important}
#dashboard.operator-mode #managementMenuHeader{display:none!important}
.management-nav{position:relative;z-index:4}
.management-subnav{position:relative;z-index:3}
@media(max-width:650px){.management-menu-header{align-items:flex-start;flex-direction:column;gap:10px}.management-version-chip{align-self:flex-start}}


/* 0.3.74: connection settings grouped in the Connections section */
.connections-live-config{display:grid;grid-template-columns:1fr;gap:14px;margin:0 0 20px}
.connections-live-config .panel{margin:0;min-width:0}
.connections-live-config .tecno-connection-box{margin-top:4px}
.connections-info-note{padding:13px 15px;border:1px solid var(--line);border-radius:10px;background:#0d1727;color:var(--muted);font-size:12px;line-height:1.65}
#dashboard:not(.operator-mode) [data-management-content="connections"].management-section-hidden{display:none!important}
#dashboard.operator-mode #connectionsLiveConfig{display:none!important}


/* 0.3.75: autenticazione locale e gestione account */
.local-users-admin{margin-top:22px;padding-top:20px;border-top:1px solid var(--line)}
.local-users-intro h3,.local-users-list-head h3{font-size:15px;margin:0 0 6px}.local-users-intro p{font-size:12px;margin-bottom:16px}
.local-user-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;padding:16px;border:1px solid var(--line);border-radius:13px;background:#0d1727}
.local-user-form label{display:block;color:#c5d2e5;font-size:12px}.local-user-form input,.local-user-form select{display:block;width:100%;margin-top:7px;padding:11px 12px;border-radius:9px;border:1px solid var(--line);background:#0b1424;color:var(--text);min-width:0}
.local-user-submit{align-self:end;width:auto;margin-top:0}.local-user-form .error{grid-column:1/-1;margin:0;min-height:0}
.local-users-list-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin:23px 0 10px}.local-users-list{display:grid;gap:8px}.local-user-row{display:flex;align-items:center;gap:12px;padding:12px;border:1px solid var(--line);border-radius:11px;background:#0d1727;min-width:0}.local-user-avatar{display:grid;place-items:center;flex:0 0 36px;width:36px;height:36px;border-radius:50%;background:#1a354a;color:var(--accent2);font-weight:800}.local-user-meta{flex:1;min-width:0}.local-user-meta strong{display:block;font-size:13px;overflow-wrap:anywhere}.local-user-meta small{display:block;margin-top:4px;font-size:11px;color:var(--muted);overflow-wrap:anywhere}.local-role-pill{font-size:10px;padding:5px 8px;border-radius:99px;border:1px solid #36516a;color:#c4d5e9;white-space:nowrap}.local-role-pill.admin{border-color:#38766b;color:var(--accent2)}.local-user-delete{padding:7px 9px;font-size:11px}.build-version-tag{color:var(--accent)!important}
@media(max-width:700px){.local-user-form{grid-template-columns:1fr}.local-user-row{flex-wrap:wrap}.local-user-meta{flex-basis:calc(100% - 60px)}.local-user-delete{margin-left:auto}}


/* 0.3.76: profili locali e autorizzazioni per sezione */
.local-profile-form{display:grid;grid-template-columns:minmax(220px,.75fr) minmax(0,1.5fr);gap:14px;padding:16px;border:1px solid var(--line);border-radius:13px;background:#0d1727}
.local-profile-form .profile-name-label{display:block;color:#c5d2e5;font-size:12px}
.local-profile-form .profile-name-label input{display:block;width:100%;margin-top:7px;padding:11px 12px;border-radius:9px;border:1px solid var(--line);background:#0b1424;color:var(--text)}
.profile-permissions{margin:0;border:1px solid var(--line);border-radius:10px;padding:12px;display:flex;flex-wrap:wrap;gap:10px 16px;align-content:flex-start}
.profile-permissions legend{padding:0 6px;color:var(--muted);font-size:11px}
.profile-permissions label{display:flex;align-items:center;gap:7px;color:var(--text);font-size:12px;white-space:nowrap}
.profile-permissions input{accent-color:var(--accent);width:16px;height:16px}
.profile-form-actions{grid-column:1/-1;display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.local-profile-form .error{grid-column:1/-1;margin:0;min-height:0}
.local-user-actions{display:flex;align-items:center;justify-content:flex-end;gap:7px;flex-wrap:wrap;margin-left:auto}
.inline-user-profile-label{display:flex;align-items:center;gap:7px;color:var(--muted);font-size:11px}
.inline-user-profile-label select{max-width:190px;padding:8px 9px;border:1px solid var(--line);border-radius:8px;background:#0b1424;color:var(--text);font:inherit;font-size:11px}
.local-user-row .local-user-meta small+small{margin-top:5px}
.local-profiles-admin .local-user-row{align-items:center}
@media(max-width:800px){.local-profile-form{grid-template-columns:1fr}.profile-form-actions{grid-column:auto}.local-user-actions{width:100%;justify-content:flex-start;margin-left:48px}.inline-user-profile-label{flex:1}.inline-user-profile-label select{max-width:none;width:100%}}


/* 0.3.77: permessi per singola risorsa e riordino del profilo operatore */
.profile-resource-permissions{display:grid;gap:12px;margin:16px 0;padding:15px;border:1px solid var(--line);border-radius:13px;background:#0a1423}
.profile-resource-heading{display:flex;align-items:flex-start;justify-content:space-between;gap:14px}.profile-resource-heading h3{font-size:14px;margin:0 0 5px}.profile-resource-heading p{max-width:850px;font-size:11px;line-height:1.55;color:var(--muted);margin:0}
.profile-resource-legend{display:flex;flex-wrap:wrap;gap:8px 16px;padding:9px 0;border-top:1px solid var(--line);border-bottom:1px solid var(--line);font-size:10px;color:var(--muted)}.profile-resource-legend span{display:inline-flex;align-items:center;gap:6px}.resource-dot{display:inline-block;width:8px;height:8px;border-radius:50%}.resource-dot-operate{background:#31c48d}.resource-dot-view{background:#60a5fa}.resource-dot-none{background:#7b8798}
.profile-resource-groups{display:grid;gap:11px}.profile-resource-group{border:1px solid var(--line);border-radius:10px;overflow:hidden;background:#0d192b}.profile-resource-group-head{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:11px 13px;background:#132139;border-bottom:1px solid var(--line)}.profile-resource-group-head h4{margin:0;font-size:12px}.profile-resource-group-head span{font-size:10px;color:var(--muted)}.profile-resource-rows{display:grid}.profile-resource-row{display:grid;grid-template-columns:minmax(120px,1fr) minmax(190px,270px) auto;align-items:center;gap:12px;padding:10px 12px;border-bottom:1px solid rgba(42,62,87,.65)}.profile-resource-row:last-child{border-bottom:0}.profile-resource-name{display:grid;gap:3px;min-width:0}.profile-resource-name strong{font-size:11px;overflow-wrap:anywhere}.profile-resource-name small{font-size:9px;color:var(--muted)}.profile-resource-grant-label{display:grid;gap:4px;color:var(--muted);font-size:9px}.profile-resource-grant-label select{width:100%;min-width:0;padding:8px 9px;border:1px solid var(--line);border-radius:8px;background:#0f1b2e;color:var(--text);font:inherit;font-size:10px}.profile-resource-order{display:flex;gap:5px}.profile-resource-order button{padding:7px 10px;min-width:32px;font-size:12px}.profile-resource-order button:disabled{opacity:.35;cursor:not-allowed}.profile-resource-status{margin:0;color:var(--muted);font-size:10px;line-height:1.45}.profile-resource-grant-label select:has(option[value="none"]:checked){border-color:#526175}
@media(max-width:760px){.profile-resource-heading{flex-direction:column}.profile-resource-row{grid-template-columns:minmax(0,1fr) auto;gap:8px}.profile-resource-name{grid-column:1/-1}.profile-resource-grant-label{grid-column:1}.profile-resource-order{grid-column:2;grid-row:2}.profile-resource-grant-label select{font-size:11px}}


/* 0.3.78: section-by-section profile editor, responsive containment, global alarm permissions. */
#dashboard,#localProfilesAdmin,.local-profile-form,.profile-resource-permissions,.profile-resource-groups,.profile-section-pane{min-width:0;max-width:100%;box-sizing:border-box}
.local-profile-form{grid-template-columns:minmax(0,1fr);width:100%;overflow:hidden}
.local-profile-form .profile-name-label,.local-profile-form .profile-name-label input{min-width:0;max-width:100%;box-sizing:border-box}
.profile-resource-heading{min-width:0;flex-wrap:wrap}
.profile-resource-legend{max-width:100%;box-sizing:border-box}
.profile-section-tabs{display:grid;grid-template-columns:repeat(auto-fit,minmax(145px,1fr));gap:8px;margin:2px 0 14px;min-width:0}
.profile-section-tab{display:flex;align-items:center;justify-content:space-between;gap:8px;min-width:0;padding:10px 11px;border:1px solid var(--line);border-radius:9px;background:#0d192b;color:var(--text);font:inherit;text-align:left;cursor:pointer}
.profile-section-tab.active{border-color:#467c9c;background:#172a43;box-shadow:inset 0 0 0 1px rgba(100,214,188,.12)}
.profile-section-tab span{font-size:12px;font-weight:750;overflow-wrap:anywhere}.profile-section-tab small{flex:0 0 auto;font-size:9px;border-radius:20px;padding:4px 6px}.profile-section-tab small.enabled{color:#9de8d7;background:#12342e}.profile-section-tab small.disabled{color:#9baac0;background:#1b2738}
.profile-section-pane{border:1px solid var(--line);border-radius:12px;background:#0b1424;padding:13px;overflow:hidden}
.profile-section-pane-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:14px;padding-bottom:10px;border-bottom:1px solid var(--line)}.profile-section-pane-title h3{margin:0;font-size:14px}.profile-section-pane-title span{font-size:10px;color:var(--muted)}
.profile-section-settings{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;flex-wrap:wrap;margin-bottom:14px;padding:12px;border:1px solid var(--line);border-radius:10px;background:#0d192b;min-width:0}
.profile-section-settings h4{font-size:12px;margin:0 0 5px}.profile-section-settings p{font-size:11px;line-height:1.6;max-width:650px;margin:0;color:var(--muted)}
.profile-section-enable,.profile-section-general-grant{display:flex;align-items:center;gap:8px;color:var(--text);font-size:11px;flex:0 0 auto}.profile-section-enable input{accent-color:var(--accent);width:17px;height:17px}.profile-section-general-grant{display:grid;gap:5px;min-width:min(260px,100%)}.profile-section-general-grant span{color:var(--muted);font-size:10px}.profile-section-general-grant select{width:100%;max-width:100%;padding:9px;border:1px solid var(--line);border-radius:8px;background:#0f1b2e;color:var(--text);font:inherit;font-size:11px;box-sizing:border-box}
.profile-alarm-definitions{border:1px solid var(--line);border-radius:10px;overflow:hidden;min-width:0}.profile-alarm-definition-list{display:grid}.profile-alarm-definition-row{display:flex;align-items:center;gap:10px;padding:11px 13px;border-bottom:1px solid rgba(42,62,87,.65);min-width:0}.profile-alarm-definition-row:last-child{border-bottom:0}.profile-alarm-definition-row .list-mark{width:8px;height:8px;border-radius:50%;background:var(--accent);flex:0 0 8px}.profile-alarm-definition-row .list-mark.muted{background:#71839d}.profile-alarm-definition-row div{min-width:0}.profile-alarm-definition-row strong{display:block;font-size:11px;overflow-wrap:anywhere}.profile-alarm-definition-row small{display:block;color:var(--muted);font-size:10px;margin-top:4px;overflow-wrap:anywhere}
.profile-resource-group{min-width:0;max-width:100%;overflow:hidden}.profile-resource-rows,.profile-resource-row{min-width:0;max-width:100%}.profile-resource-row{grid-template-columns:minmax(0,1fr) minmax(180px,260px) auto}.profile-resource-name strong{overflow-wrap:anywhere;word-break:normal}.profile-resource-grant-label select{max-width:100%;box-sizing:border-box}
@media(max-width:680px){.profile-section-tabs{grid-template-columns:repeat(2,minmax(0,1fr))}.profile-section-settings{align-items:stretch}.profile-section-general-grant{width:100%;min-width:0}.profile-resource-row{grid-template-columns:minmax(0,1fr) auto}.profile-resource-name{grid-column:1/-1}.profile-resource-grant-label{grid-column:1}.profile-resource-order{grid-column:2;grid-row:2}.profile-section-pane{padding:9px}.profile-resource-permissions{padding:9px}}

/* 0.3.81: sottosezioni Automazioni nel solo editor Utenti > Profili; la vista Automazioni operativa resta invariata. */
.profile-subsection-tabs{display:flex;flex-wrap:wrap;gap:8px;margin:0 0 12px;min-width:0}
.profile-subsection-tab{display:flex;align-items:center;justify-content:space-between;gap:12px;flex:1 1 155px;min-width:0;padding:10px 12px;border:1px solid var(--line);border-radius:9px;background:#0d192b;color:var(--text);font:inherit;text-align:left;cursor:pointer}
.profile-subsection-tab.active{border-color:#467c9c;background:#172a43;box-shadow:inset 0 0 0 1px rgba(100,214,188,.12)}
.profile-subsection-tab span{font-size:11px;font-weight:750;overflow-wrap:anywhere}.profile-subsection-tab small{flex:0 0 auto;color:var(--muted);font-size:9px;border-radius:20px;padding:4px 6px;background:#1b2738}
.profile-subsection-description{margin:0;padding:9px 12px;color:var(--muted);font-size:10px;line-height:1.5;border-bottom:1px solid var(--line);background:#0d1927}
@media(max-width:680px){.profile-subsection-tab{flex:1 1 100%}}

/* 0.3.82: la navigazione Automazioni resta nella pagina operativa originale; gruppi solo nell'editor dei profili. */
#dashboard:not(.operator-mode) #managementSubnav.automation-subnav-hidden{display:none!important;visibility:hidden!important;height:0!important;min-height:0!important;margin:0!important;padding:0!important;border:0!important}

/* 0.3.86: clearer alarm rule hierarchy and correlated cameras */
.event-rule-title{display:block;font-size:13px;color:#f3f7ff;letter-spacing:.1px}
.event-camera-description{font-size:11px;color:#a9c5df!important;margin-top:5px}
.event-related-camera-list{display:flex;flex-wrap:wrap;align-items:center;gap:6px;margin:8px 0 2px}
.event-related-camera-heading{font-size:10px;font-weight:750;text-transform:uppercase;letter-spacing:.45px;color:#8ba4c1;margin-right:2px}
.event-related-camera-chip{display:inline-flex;align-items:center;gap:5px;padding:4px 7px;border:1px solid #31506c;border-radius:6px;background:#12263b;color:#d6eaff;font-size:10px;font-weight:650;line-height:1.3}
.event-related-camera-chip.muted{color:#98a5b8;border-style:dashed}
.event-origin-badge{display:inline-block;vertical-align:middle;margin-left:6px;padding:2px 5px;border-radius:4px;background:#174f4b;color:#72e0c9;font-size:9px;font-weight:750}
.event-row-button .list-content{min-width:0}
.event-row-button .event-camera-hint{display:block;margin-top:7px}

/* 0.3.87 persistent audit log */
.audit-toolbar{display:grid;gap:10px;margin:12px 0}.audit-filters{display:flex;flex-wrap:wrap;align-items:end;gap:10px}.audit-filters label{display:grid;gap:5px;min-width:150px;font-size:12px;color:var(--muted)}.audit-filters input,.audit-filters select{min-height:38px;max-width:220px}.audit-table-wrap{width:100%;overflow:auto;border:1px solid var(--line);border-radius:12px}.audit-table{width:100%;border-collapse:collapse;font-size:12px;min-width:900px}.audit-table th,.audit-table td{padding:10px 12px;text-align:left;vertical-align:top;border-bottom:1px solid var(--line)}.audit-table th{background:#142239;position:sticky;top:0}.audit-table td{color:var(--text);max-width:360px;overflow-wrap:anywhere}.audit-paging{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px 0}.audit-paging button:disabled{opacity:.4;cursor:not-allowed}@media(max-width:760px){.audit-filters{display:grid;grid-template-columns:1fr 1fr}.audit-filters label{min-width:0}.audit-filters input,.audit-filters select{max-width:100%;width:100%}}

/* Connessione Milestone XProtect: configurazione endpoint amministrativa. */
.milestone-connection-panel .panel-head{align-items:flex-start}.milestone-connection-form{display:grid;gap:14px}.milestone-connection-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.milestone-connection-grid label{display:grid;gap:7px;color:#c5d2e5;font-size:12px;min-width:0}.milestone-connection-grid input{width:100%;min-width:0;padding:11px 12px;border-radius:9px;border:1px solid var(--line);background:#0b1424;color:var(--text);outline:none;font-size:12px}.milestone-connection-grid input:focus{border-color:var(--accent)}.milestone-connection-actions{display:flex;gap:10px;align-items:center;flex-wrap:wrap}.milestone-connection-actions button{width:auto;min-width:160px;margin:0}.milestone-connection-form .connections-info-note{margin:2px 0;padding:12px 14px}.profile-resource-status.success{color:var(--accent2)}@media(max-width:700px){.milestone-connection-grid{grid-template-columns:1fr}.milestone-connection-actions{flex-direction:column;align-items:stretch}.milestone-connection-actions button{width:100%}}

/* 0.3.92: correzione accessibilità DTO connessioni modulari e credenziali di riconnessione */
/* 0.3.94: recupero password locale via SMTP */
.system-module-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px;margin:14px 0}
.system-module-option{display:flex;align-items:flex-start;gap:10px;padding:14px;border:1px solid var(--border,#d1d5db);border-radius:12px;background:var(--panel,#fff);cursor:pointer}
.system-module-option input,.remember-credentials-row input{width:auto;min-width:16px;margin-top:3px}
.system-module-option span{display:flex;flex-direction:column;gap:4px}.system-module-option small{color:var(--muted,#64748b);line-height:1.35}
.connections-module-actions{display:flex;align-items:center;gap:14px;flex-wrap:wrap}.remember-credentials-row{display:flex;align-items:center;gap:8px;font-size:.88rem;margin-top:4px;color:var(--muted,#64748b)}
@media(max-width:760px){.system-module-grid{grid-template-columns:1fr}}

/* 0.3.94: recupero password e configurazione SMTP */
.text-link-button{border:0;background:transparent;color:var(--accent2);padding:6px 0;cursor:pointer;font:inherit;text-decoration:underline;text-underline-offset:3px}.recovery-form{display:grid;gap:12px;margin-top:14px;padding-top:14px;border-top:1px solid var(--line)}.recovery-form h2{font-size:18px;margin:0}.recovery-form p{margin:0;color:var(--muted);font-size:12px;line-height:1.6}.recovery-form label{display:grid;gap:7px;color:#c5d2e5;font-size:12px}.recovery-form input{width:100%;min-width:0;padding:11px 12px;border-radius:9px;border:1px solid var(--line);background:#0b1424;color:var(--text);font-size:13px}.recovery-form button{width:100%;margin:0}.smtp-connection-panel{margin-top:16px}.smtp-ssl-option{display:flex;align-items:center;gap:9px;color:#c5d2e5;font-size:12px}.smtp-ssl-option input{width:auto}

.tecno-status-actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;flex-wrap:wrap}.tecno-status-actions button{white-space:nowrap}

.adam-module-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.adam-module-actions button{padding:.35rem .6rem;font-size:.82em}.adam-module-actions .danger{border-color:#a84a58;color:#ffd9de;background:rgba(168,74,88,.12)}

.adam-admin-management{margin-top:16px;padding-top:14px;border-top:1px solid var(--border,#26364f)}.adam-admin-management h3{margin:0 0 6px}.adam-admin-management p{margin:0 0 12px;color:var(--muted,#9aa9c2);font-size:.9em}.adam-admin-module-row{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:12px;padding:10px 12px;border:1px solid var(--border,#26364f);border-radius:10px;margin-top:8px}.adam-admin-module-row small{display:block;color:var(--muted,#9aa9c2);margin-top:4px}.adam-module-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap}.adam-module-actions button{padding:.35rem .6rem;font-size:.82em}.adam-module-actions .danger{border-color:#a84a58;color:#ffd9de;background:rgba(168,74,88,.12)}@media(max-width:680px){.adam-admin-module-row{grid-template-columns:1fr;align-items:start}}

/* Tema chiaro selezionabile per account; il tema scuro resta il default. */
:root[data-theme="light"]{
 color-scheme:light;
 --bg:#f2f5fa;--surface:#ffffff;--surface2:#e8eef6;--line:#cbd5e1;
 --text:#172338;--muted:#5d6b80;--accent:#159b83;--accent2:#087b69;
 --danger:#b42332;--shadow:0 18px 50px #3341551a;
}
:root[data-theme="light"] body{background:radial-gradient(ellipse at top right,#dce9f8 0,transparent 38%),var(--bg);color:var(--text)}
:root[data-theme="light"] .topbar{background:#ffffffed;border-bottom-color:var(--line)}
:root[data-theme="light"] .panel,
:root[data-theme="light"] .management-admin-workspace,
:root[data-theme="light"] .login-card,
:root[data-theme="light"] .modal-card,
:root[data-theme="light"] .camera-card,
:root[data-theme="light"] .adam-module-card,
:root[data-theme="light"] .adam-admin-module-row{background:var(--surface);color:var(--text);border-color:var(--line)}
:root[data-theme="light"] .secondary{background:var(--surface2);border-color:var(--line);color:var(--text)}
:root[data-theme="light"] input,
:root[data-theme="light"] select,
:root[data-theme="light"] textarea{background:#fff;color:var(--text);border-color:var(--line)}
:root[data-theme="light"] .management-nav,
:root[data-theme="light"] .management-subnav,
:root[data-theme="light"] .management-nav-item{background:#e8eef6;color:var(--text);border-color:var(--line)}
:root[data-theme="light"] .management-nav-item.active{background:var(--accent);color:#fff}
:root[data-theme="light"] .pill{background:#f8fafc}
:root[data-theme="light"] .empty{background:#f8fafc;color:var(--muted)}
:root[data-theme="light"] .login-card{background:linear-gradient(155deg,#fff,#f4f7fb)}

/* Contrast pass for the light theme: cover nested operational panels and tables too. */
:root[data-theme="light"] .panel-subtle,
:root[data-theme="light"] .connections-live-config .panel-subtle,
:root[data-theme="light"] .milestone-connection-form,
:root[data-theme="light"] .adam-mqtt-config,
:root[data-theme="light"] .adam-module-card,
:root[data-theme="light"] .camera-tile,
:root[data-theme="light"] .camera-grid,
:root[data-theme="light"] .recordings-panel,
:root[data-theme="light"] .events-panel,
:root[data-theme="light"] .logs-panel,
:root[data-theme="light"] .table-wrap,
:root[data-theme="light"] .audit-table-wrap,
:root[data-theme="light"] .management-workspace-detail,
:root[data-theme="light"] .management-workspace-subgroups,
:root[data-theme="light"] .local-users-list,
:root[data-theme="light"] .profile-editor,
:root[data-theme="light"] .settings-card,
:root[data-theme="light"] .form-card,
:root[data-theme="light"] .connection-config-tools{background:#fff!important;color:#172338;border-color:#cbd5e1}
:root[data-theme="light"] .panel-subtle p,
:root[data-theme="light"] .panel-subtle small,
:root[data-theme="light"] .panel-subtle label,
:root[data-theme="light"] .adam-admin-module-row small{color:#5d6b80}
:root[data-theme="light"] table{background:#fff;color:#172338;border-color:#cbd5e1}
:root[data-theme="light"] th{background:#e8eef6;color:#26364f}
:root[data-theme="light"] td{background:#fff;color:#334155;border-color:#cbd5e1}
:root[data-theme="light"] .modal,
:root[data-theme="light"] .modal-backdrop{color:#172338}
:root[data-theme="light"] .error{color:#b42332}
:root[data-theme="light"] .success{color:#087b69}
.connection-config-tools{display:flex;align-items:center;justify-content:space-between;gap:18px;flex-wrap:wrap;margin-bottom:14px;padding:16px}
.connection-config-tools h3{margin:0 0 5px;font-size:16px}
.connection-config-tools p{font-size:12px;max-width:760px}
.connection-config-actions{display:flex;gap:8px;flex-wrap:wrap}
#configTransferMessage{width:100%;margin:0}

/* Tema chiaro completo: le superfici scure dell'interfaccia diventano grigio chiaro.
   I video/riquadri di streaming restano scuri perché rappresentano il contenuto video. */
:root[data-theme="light"] .notice,
:root[data-theme="light"] .detail-field,
:root[data-theme="light"] .live-panel,
:root[data-theme="light"] .live-diagnostics pre,
:root[data-theme="light"] .stream-config,
:root[data-theme="light"] .views-toolbar,
:root[data-theme="light"] .playback-toolbar,
:root[data-theme="light"] .playback-player-wrap,
:root[data-theme="light"] .recording-period-row,
:root[data-theme="light"] .event-playback-empty,
:root[data-theme="light"] .event-camera-inline-list .event-camera-item,
:root[data-theme="light"] .tecno-connection-box,
:root[data-theme="light"] .tecno-connect-grid,
:root[data-theme="light"] .adam-mqtt-config,
:root[data-theme="light"] .system-module-option,
:root[data-theme="light"] .local-user-row,
:root[data-theme="light"] .local-users-list .user-row,
:root[data-theme="light"] .profile-row,
:root[data-theme="light"] .management-subnav-item,
:root[data-theme="light"] .management-workspace-card,
:root[data-theme="light"] .management-workspace-tile,
:root[data-theme="light"] .event-row,
:root[data-theme="light"] .event-list,
:root[data-theme="light"] .event-list-item,
:root[data-theme="light"] .alarm-definition-card,
:root[data-theme="light"] .playback-controls,
:root[data-theme="light"] .recording-range,
:root[data-theme="light"] .recording-periods,
:root[data-theme="light"] .smtp-settings-form,
:root[data-theme="light"] .milestone-connection-grid,
:root[data-theme="light"] .adam-module-card,
:root[data-theme="light"] .adam-admin-module-row,
:root[data-theme="light"] .connection-config-tools,
:root[data-theme="light"] .connections-module-actions,
:root[data-theme="light"] .local-users-form,
:root[data-theme="light"] .profile-permissions,
:root[data-theme="light"] .security-sessions,
:root[data-theme="light"] .management-section-content{
 background:#e9edf3!important;color:#26364b;border-color:#cbd5e1!important;
}
:root[data-theme="light"] .topbar,
:root[data-theme="light"] .operator-nav,
:root[data-theme="light"] .management-nav,
:root[data-theme="light"] .management-subnav,
:root[data-theme="light"] .management-tabs,
:root[data-theme="light"] .views-panel,
:root[data-theme="light"] #dashboard.operator-mode .views-panel,
:root[data-theme="light"] #dashboard.operator-mode #recentEventsPanel{
 background:#e9edf3!important;color:#26364b;border-color:#cbd5e1!important;
}
:root[data-theme="light"] .live-tile,
:root[data-theme="light"] #dashboard.operator-mode .live-tile,
:root[data-theme="light"] .playback-player-wrap,
:root[data-theme="light"] .event-playback-host{
 background:#e2e7ee!important;color:#26364b;border-color:#cbd5e1!important;
}
:root[data-theme="light"] .live-tile video,
:root[data-theme="light"] .playback-player-wrap video,
:root[data-theme="light"] .event-playback-host video,
:root[data-theme="light"] .live-panel video{
 background:#111827!important;
}
:root[data-theme="light"] .login-card input,
:root[data-theme="light"] .search,
:root[data-theme="light"] .stream-config select,
:root[data-theme="light"] .stream-config input,
:root[data-theme="light"] .views-toolbar input,
:root[data-theme="light"] .views-toolbar select,
:root[data-theme="light"] .tile-select-label select,
:root[data-theme="light"] .playback-toolbar select,
:root[data-theme="light"] .playback-toolbar input[type="datetime-local"],
:root[data-theme="light"] .recording-range input,
:root[data-theme="light"] .tecno-connect-grid input{
 background:#fff!important;color:#172338!important;border-color:#cbd5e1!important;
}
:root[data-theme="light"] .notice,
:root[data-theme="light"] .notice p,
:root[data-theme="light"] .detail-field,
:root[data-theme="light"] .live-panel,
:root[data-theme="light"] .live-diagnostics pre,
:root[data-theme="light"] .event-row-button,
:root[data-theme="light"] .event-camera-inline-list .event-camera-item,
:root[data-theme="light"] .tecno-connection-box,
:root[data-theme="light"] .tecno-connect-grid,
:root[data-theme="light"] .operator-nav-item{
 color:#26364b;
}
:root[data-theme="light"] .tecno-message.is-success,
:root[data-theme="light"] .tecno-state-indicator.is-disarmed,
:root[data-theme="light"] .tecno-chip.good{
 color:#086b58;background:#d8f3e9;border-color:#a8dfce;
}
:root[data-theme="light"] .tecno-state-indicator.is-unknown,
:root[data-theme="light"] .tecno-chip.neutral{
 color:#4b5d73;background:#e2e8f0;border-color:#cbd5e1;
}
:root[data-theme="light"] .event-row-button:hover,
:root[data-theme="light"] .event-row-button:focus-visible,
:root[data-theme="light"] .operator-nav-item:hover{
 background:#dbe3ed;color:#172338;
}
:root[data-theme="light"] .operator-nav-item.active,
:root[data-theme="light"] .management-nav-item.active{background:var(--accent)!important;color:#fff!important}
:root[data-theme="light"] .management-subnav button{background:#e2e8f0!important;color:#334155!important;border-color:#cbd5e1!important}
:root[data-theme="light"] .management-subnav button.active{background:#d4e8e2!important;color:#075b4c!important;border-color:#8bc9b9!important}

/* 0.3.110: final pass on residual dark cards in light theme, including operator UI. */
:root[data-theme="light"] .tecno,
:root[data-theme="light"] .tecno-item-card,
:root[data-theme="light"] .tecno-zone-card,
:root[data-theme="light"] .tecno-program-zone-group,
:root[data-theme="light"] .tecno-program-zone-list .tecno-zone-card,
:root[data-theme="light"] .tecno-program-card,
:root[data-theme="light"] .tecno-zone-group,
:root[data-theme="light"] .milestone-user-event-card,
:root[data-theme="light"] .adam-module-card,
:root[data-theme="light"] .adam-io-card,
:root[data-theme="light"] .adam-io-channel,
:root[data-theme="light"] .adam-channel-card,
:root[data-theme="light"] .adam-io-map-card,
:root[data-theme="light"] .event-related-camera-chip,
:root[data-theme="light"] .event-origin-badge,
:root[data-theme="light"] .event-camera-inline-list .event-camera-item,
:root[data-theme="light"] .event-playback-empty,
:root[data-theme="light"] .event-playback-host,
:root[data-theme="light"] .event-list,
:root[data-theme="light"] .event-list-item,
:root[data-theme="light"] .event-row-button,
:root[data-theme="light"] .playback-controls,
:root[data-theme="light"] .playback-toolbar,
:root[data-theme="light"] .recording-periods,
:root[data-theme="light"] .recording-range,
:root[data-theme="light"] .views-toolbar,
:root[data-theme="light"] .camera-card,
:root[data-theme="light"] .camera-details,
:root[data-theme="light"] .dashboard-stat,
:root[data-theme="light"] .stat-card,
:root[data-theme="light"] .summary-card,
:root[data-theme="light"] .telecommand-card,
:root[data-theme="light"] .automation-card,
:root[data-theme="light"] .io-card,
:root[data-theme="light"] .input-card,
:root[data-theme="light"] .output-card,
:root[data-theme="light"] .local-user-row,
:root[data-theme="light"] .local-users-list .user-row,
:root[data-theme="light"] .profile-row,
:root[data-theme="light"] .profile-permissions,
:root[data-theme="light"] .security-sessions,
:root[data-theme="light"] .smtp-settings-form,
:root[data-theme="light"] .milestone-connection-grid,
:root[data-theme="light"] .tecno-connection-box,
:root[data-theme="light"] .tecno-connect-grid,
:root[data-theme="light"] .adam-mqtt-config,
:root[data-theme="light"] .panel-subtle {
 background:#e5eaf1!important;
 color:#243449!important;
 border-color:#c5d0df!important;
}
:root[data-theme="light"] .tecno-item-card *,
:root[data-theme="light"] .tecno-zone-card *,
:root[data-theme="light"] .tecno-program-zone-group *,
:root[data-theme="light"] .milestone-user-event-card *,
:root[data-theme="light"] .adam-module-card *,
:root[data-theme="light"] .adam-io-card *,
:root[data-theme="light"] .adam-io-channel *,
:root[data-theme="light"] .telecommand-card *,
:root[data-theme="light"] .automation-card *,
:root[data-theme="light"] .io-card *,
:root[data-theme="light"] .input-card *,
:root[data-theme="light"] .output-card * {
 color:inherit;
}
:root[data-theme="light"] .tecno-item-card small,
:root[data-theme="light"] .tecno-zone-card small,
:root[data-theme="light"] .tecno-program-zone-group small,
:root[data-theme="light"] .milestone-user-event-card small,
:root[data-theme="light"] .adam-module-card small,
:root[data-theme="light"] .adam-io-card small,
:root[data-theme="light"] .adam-io-channel small,
:root[data-theme="light"] .telecommand-card small,
:root[data-theme="light"] .automation-card small,
:root[data-theme="light"] .io-card small,
:root[data-theme="light"] .input-card small,
:root[data-theme="light"] .output-card small {
 color:#52647b!important;
}
:root[data-theme="light"] .tecno-item-card .tecno-program-title,
:root[data-theme="light"] .tecno-zone-card .tecno-zone-title,
:root[data-theme="light"] .adam-module-card h4,
:root[data-theme="light"] .event-row-button strong {
 color:#172338!important;
}
:root[data-theme="light"] .adam-io-map-label select,
:root[data-theme="light"] .adam-io-map-label select option,
:root[data-theme="light"] .adam-io-map-label select optgroup {
 background:#fff!important;color:#172338!important;
}
:root[data-theme="light"] .event-row-button:hover,
:root[data-theme="light"] .event-row-button:focus-visible {
 background:#d6e0eb!important;color:#172338!important;
}
/* Keep actual video content black; only the surrounding frame becomes grey. */
:root[data-theme="light"] .live-tile video,
:root[data-theme="light"] .playback-player-wrap video,
:root[data-theme="light"] .event-playback-host video,
:root[data-theme="light"] .live-panel video {
 background:#050b14!important;
}

/* 0.3.118: riquadri live compatti e controllo fullscreen anche su touch */
.live-views-grid{gap:8px}
.live-tile{padding:6px;border:1px solid #27364f;border-radius:7px}
.live-tile-head{margin-bottom:5px;min-height:16px}
.live-tile-head strong{font-size:10px;font-weight:600}
.live-tile-status{font-size:9px}
.tile-select-label{margin-bottom:4px;gap:3px;font-size:10px}
.tile-select-label select{padding:5px 7px;font-size:10px;border-radius:6px}
.live-tile video{border-radius:3px;max-height:38vh;cursor:zoom-in}
.tile-actions{gap:4px;margin-top:5px}
.tile-actions button{padding:5px 7px;font-size:10px;border-radius:6px}
.tile-actions .tile-fullscreen-btn{min-width:30px;font-size:15px;padding:3px 7px}
.live-tile:fullscreen{background:#020617;border:0;border-radius:0;padding:10px;display:flex;flex-direction:column;justify-content:center}
.live-tile:fullscreen video{width:100%;height:calc(100vh - 125px);max-height:none;aspect-ratio:auto;object-fit:contain;cursor:zoom-out}
.live-tile:fullscreen .live-tile-head strong{font-size:13px}
@media(max-width:680px){.live-views-grid.layout-2,.live-views-grid.layout-3{grid-template-columns:repeat(2,minmax(0,1fr))}.live-tile{padding:5px}.live-tile video{max-height:none;aspect-ratio:16/9}.tile-actions{flex-wrap:wrap}.tile-actions button{padding:5px 6px;font-size:9px}.live-tile:fullscreen video{height:calc(100vh - 115px)}}
@media(max-width:390px){.live-views-grid.layout-2,.live-views-grid.layout-3{grid-template-columns:repeat(2,minmax(0,1fr))}.tile-select-label span{font-size:9px}.live-tile-head strong{font-size:9px}}
