/* work.css: WORK SERVICES (10 servizi di lavoro), caricato dopo style.css */

/* ---- intestazione: titolo + verdetto + 10 indicatori + ora controllo ---- */
.principal { --ps-plate: 54px; --ps-logo: 28px; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: 18px; row-gap: 10px; margin: 14px 0 8px; }
.principal > .p-grid { grid-column: 1 / -1; }
.principal .p-title { margin: 0; font-size: var(--h2); letter-spacing: 0.01em; }

.p-sum { display: flex; align-items: center; gap: 14px; min-width: 0; border-left: 1px solid var(--line); padding-left: 18px; }
.p-verdict { display: inline-flex; align-items: center; gap: 8px; font: 400 clamp(18px, 1.9vw, 26px)/1 var(--head); letter-spacing: 0.03em; color: var(--ok); white-space: nowrap; }
.p-verdict svg { width: 0.95em; height: 0.95em; flex: none; }
.p-sum.t-1 .p-verdict { color: #aab3bf; }
.p-sum.t1 .p-verdict { color: var(--sev1); }
.p-sum.t2 .p-verdict { color: #ff9a3d; }
.p-sum.t3 .p-verdict { color: #ff5a5f; }
.p-sum.t1 .p-verdict svg, .p-sum.t2 .p-verdict svg, .p-sum.t3 .p-verdict svg { --c: #000; }
.p-pips { display: flex; gap: 4px; flex: none; }
.pip { width: 14px; height: 14px; background: var(--sev0); opacity: 0.55; }
.pip.l-1 { background: var(--sevx); opacity: 1; }
.pip.l1 { background: var(--sev1); opacity: 1; }
.pip.l2 { background: var(--sev2); opacity: 1; }
.pip.l3 { background: var(--sev3); opacity: 1; }
.p-checked { margin-left: auto; font: 400 13px var(--mono); letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
.p-checked b { color: #e6e9ee; font-weight: 700; }
.p-checked em { font-style: normal; color: var(--yellow); }

/* ---- griglia ---- */
.principal .p-grid { gap: 10px; }

/* ---- scheda ---- */
.principal .ps {
  position: relative; display: flex; flex-direction: column; gap: 0; min-height: 0; padding: 0;
  text-decoration: none; color: var(--text); background: var(--ink); border: 1px solid var(--line); border-top: 0;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease, background-color 0.2s;
}
.principal .ps:hover, .principal .ps:focus-visible { background: var(--ink2); }
.principal .ps:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

/* targhetta bianca con il logo vero */
.ps-plate { display: flex; align-items: center; justify-content: center; gap: 8px; height: var(--ps-plate); padding: 0 12px; background: #fff; overflow: hidden; }
.ps-plate .wm { height: var(--ps-logo); width: auto; max-width: 100%; object-fit: contain; }
.ps-plate .ps-aws { height: calc(var(--ps-logo) * 1.2); margin-top: 4px; }
.ps-plate .wm-ico { height: calc(var(--ps-logo) * 0.95); width: auto; flex: none; }
.ps-plate .wm-text { font-size: calc(var(--ps-logo) * 0.95); }
.ps-plate .wm-suffix { font-size: calc(var(--ps-logo) * 0.92); margin-left: -2px; }
.ps-plate .inv { filter: none; }
.principal .ps.l0 .ps-plate { box-shadow: inset 0 -3px 0 var(--sev0); }

/* riga di stato in parole */
.principal .ps-st {
  display: flex; align-items: center; gap: 7px; align-self: stretch; margin: 0; padding: 7px 12px 6px;
  background: transparent; color: var(--ok); font: 700 clamp(14px, 1.15vw, 19px)/1 var(--cond); letter-spacing: 0.12em;
}
.ps-st svg { width: 1em; height: 1em; flex: none; }
.ps-st b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.principal .ps.l-1 .ps-st { color: #aab3bf; }
.principal .ps.l1 .ps-st { background: var(--sev1); color: #111; }
.principal .ps.l2 .ps-st { background: var(--sev2); color: #111; }
.principal .ps.l3 .ps-st { background: var(--sev3); color: #fff; }

/* incidente */
.ps-body { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; flex: 1 1 auto; }
.ps.hot .ps-body, .ps.l-1 .ps-body { padding-top: 7px; }
.ps-inc { font: 600 clamp(15px, 1.15vw, 19px)/1.18 var(--cond); color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ps-quiet { color: #aab3bf; font-weight: 500; }
.ps-calm { padding-top: 1px; font: 500 clamp(13px, 0.95vw, 16px)/1.2 var(--cond); letter-spacing: 0.02em; color: #8f99a8; }
.ps-since { font: 400 clamp(12px, 0.85vw, 14px)/1.25 var(--mono); color: #c3c9d3; }
.ps-since b { color: #fff; font-weight: 700; }
.ps-since .nw { white-space: nowrap; }

/* striscia delle ultime 12 ore */
.ps-hist { display: block; margin-top: auto; padding: 8px 12px 10px; }
.ps-strip { display: block; width: 100%; height: 9px; background: #151a22; }
.ps-strip.ps-empty { background: repeating-linear-gradient(90deg, #1b212b 0 6px, transparent 6px 9px); }
.ps-strip .sl0 { fill: #1a7f3f; opacity: 0.55; }
.ps-strip .sl1 { fill: #e0a915; }
.ps-strip .sl2 { fill: #ef8a22; }
.ps-strip .sl3 { fill: #e3242b; }
.ps-strip .stk { fill: var(--ink); }
.ps-strip .snow { fill: #fff; opacity: 0; }
.ps-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ps-at { margin-left: auto; padding-left: 8px; font: 400 0.78em/1 var(--mono); letter-spacing: 0.02em; white-space: nowrap; flex: none; }
.ps-at b { font-weight: 700; }
.p-legend b { color: #c3c9d3; font-weight: 400; }
/* "since" nella riga di stato se c'è spazio, altrimenti sotto il titolo */
.principal .ps { container-type: inline-size; }
.ps-at2 { display: none; }
@container (max-width: 330px) { .ps-at { display: none; } .ps-at2.nw { display: inline; } }

/* ---- servizio colpito: sollevato, bordo e alone del colore di gravità ---- */
.principal .ps.hot {
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 22%, var(--ink)) 0%, var(--ink) 75%);
  border-color: var(--c); box-shadow: 0 0 0 1px var(--c), 0 10px 28px -8px color-mix(in srgb, var(--c) 70%, transparent);
  transform: translateY(-3px); z-index: 1;
}
.principal .ps.l-1 { border-style: dashed; }

/* ---- movimento: solo quando qualcosa non va ---- */
/* battito lento e quasi invisibile sul segno di spunta: il sistema è vivo */
.principal .ps.l0 .ps-st svg { animation: psbeat 5s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 0.5s); }
@keyframes psbeat { 0%, 70%, 100% { opacity: 1; } 80% { opacity: 0.45; } }
/* guasto grave: alone che respira; il segmento "adesso" lampeggia */
.principal .ps.l3 { animation: pshot 2.4s ease-in-out infinite; }
@keyframes pshot { 50% { box-shadow: 0 0 0 2px var(--c), 0 10px 40px -4px color-mix(in srgb, var(--c) 95%, transparent); } }
.principal .ps.hot .snow { animation: psnow 1.6s steps(2, jump-none) infinite; }
@keyframes psnow { 0% { opacity: 0; } 100% { opacity: 0.85; } }
.p-sum.t3 .p-verdict svg, .p-sum.t2 .p-verdict svg { animation: psbeat 2.4s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .principal .ps, .principal .ps *, .p-sum * { animation: none !important; transition: none !important; }
}

/* ---- desktop largo ---- */
@media (min-width: 1300px) { .principal { --ps-plate: 58px; --ps-logo: 30px; } }

/* ---- TV in ufficio (?monitor, vista rete): più grande, leggibile da lontano ---- */
body.kiosk[data-view="network"] .principal { --ps-plate: clamp(46px, 4.8vh, 64px); --ps-logo: clamp(26px, 2.8vh, 36px); margin-top: 8px; column-gap: 24px; row-gap: 10px; }
body.kiosk[data-view="network"] .principal .p-title { font-size: clamp(30px, 3.4vh, 42px); }
body.kiosk[data-view="network"] .p-sum { gap: 22px; padding-left: 24px; }
body.kiosk[data-view="network"] .p-verdict { font-size: clamp(26px, 3vh, 36px); }
body.kiosk[data-view="network"] .pip { width: 20px; height: 20px; }
body.kiosk[data-view="network"] .p-checked { font-size: clamp(15px, 1.6vh, 19px); }
body.kiosk[data-view="network"] .principal .p-grid { gap: 14px; }
body.kiosk[data-view="network"] .principal .ps-st { font-size: clamp(18px, 2vh, 24px); padding: 7px 14px 6px; }
body.kiosk[data-view="network"] .ps-body { padding: 0 14px; }
body.kiosk[data-view="network"] .ps.hot .ps-body { padding-top: 7px; gap: 3px; }
body.kiosk[data-view="network"] .ps-inc { font-size: clamp(19px, 2.1vh, 25px); line-height: 1.12; }
body.kiosk[data-view="network"] .ps-since { font-size: clamp(14px, 1.5vh, 18px); }
body.kiosk[data-view="network"] .ps-calm { font-size: clamp(15px, 1.65vh, 20px); }
body.kiosk[data-view="network"] .ps-hist { padding: 8px 14px 10px; }
body.kiosk[data-view="network"] .ps-strip { height: 10px; }

/* ---- tablet / telefono: 2 colonne ---- */
@media (max-width: 760px) {
  .principal { --ps-plate: 44px; --ps-logo: 22px; grid-template-columns: minmax(0, 1fr); row-gap: 8px; }
  .p-sum { border-left: 0; padding-left: 0; flex-wrap: wrap; gap: 8px 12px; }
  .p-verdict { font-size: 20px; }
  .pip { width: 11px; height: 11px; }
  .p-checked { font-size: 12px; }
  .principal .p-grid { gap: 8px; }
  .principal .ps-st { font-size: 14px; padding: 6px 10px 5px; letter-spacing: 0.08em; gap: 6px; }
  .ps-plate { padding: 0 8px; }
  .ps-body { padding: 0 10px; }
  .ps-inc { font-size: 15px; }
  .ps-calm { font-size: 13px; }
  .ps-since { font-size: 11.5px; }
  .ps-hist { padding: 7px 10px 8px; }
  .ps-strip { height: 7px; }
  .principal .ps.hot { transform: none; box-shadow: 0 0 0 1px var(--c); }
  @keyframes pshot { 50% { box-shadow: 0 0 0 2px var(--c); } }
  .p-legend { display: none; }
}
@media (max-width: 380px) { .principal { --ps-logo: 19px; } .principal .ps-st { font-size: 13px; letter-spacing: 0.05em; } }
