/* INFORRADIO Control Center — brand styles
   Palette da https://www.inforradio.com: giallo brand #ffed63 su #111111, pannelli #1c1c1c/#232323.
   Font: Barlow / Barlow Semi Condensed.
   Struttura del file: 1) token  2) base + accessibilita'  3) controlli (bottoni, campi)  4) login
   5) shell (topbar, tab)  6) dispositivi (toolbar, card, chip, drawer, manopola, comandi)
   7) pannelli admin (form, tabelle responsive)  8) modali, dialoghi, toast  9) utility e media.
   Regole di progetto: mobile-first friendly (nessuno scroll orizzontale di pagina), target touch
   >= 44px su puntatori "coarse", campi a 16px su mobile (niente zoom iOS), focus sempre visibile,
   contrasto AA, safe-area iOS, prefers-reduced-motion rispettato. */

/* ============ 1) TOKEN ============ */
:root {
  --yellow: #ffed63;
  --yellow-dim: #e4b902;
  --bg: #111111;
  --bg-deep: #0d0d0d;
  --panel: #1c1c1c;
  --panel-2: #232323;
  --border: #333333;
  --text: #ffffff;
  --muted: #a3a3a3;          /* AA su --panel (6.9:1) e su --bg */
  --green: #42c65c;
  --red: #fb3f3f;            /* testo/bordi */
  --red-solid: #d62d2d;      /* riempimenti con testo bianco (AA) */
  --orange: #ffad4f;
  --blue: #1f5eff;           /* blu elettrico: cliente assegnato */
  --radius: 10px;
  --radius-ctl: 8px;
  --font: 'Barlow', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-head: 'Barlow Semi Condensed', 'Barlow', sans-serif;
  --ctl-h: 40px;             /* altezza unica di bottoni, campi, select */
  --ctl-h-sm: 32px;          /* bottoni piccoli, chip cliccabili */
  --pad-x: clamp(14px, 3vw, 22px);
  --card-pad: clamp(12px, 2.2vw, 16px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --ease: cubic-bezier(.22, 1, .36, 1);
}
/* Dita, non mouse: target piu' grandi (iOS/Android/tablet). */
@media (pointer: coarse) {
  :root { --ctl-h: 44px; --ctl-h-sm: 40px; }
}

/* ============ 2) BASE + ACCESSIBILITA' ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; color-scheme: dark; scroll-padding-top: 120px; }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--font); background: var(--bg); color: var(--text);
  line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;             /* cintura di sicurezza: la pagina non scorre mai in orizzontale */
}
body.modal-open { overflow: hidden; }
a { color: var(--yellow); }
h1, h2, h3, .brandmark { font-family: var(--font-head); font-weight: 700; letter-spacing: .3px; }
img { max-width: 100%; }
code { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: .92em; overflow-wrap: anywhere; word-break: break-word; }
/* Scrollbar scure e sottili (pannelli, modali, log). */
* { scrollbar-width: thin; scrollbar-color: #4a4a4a transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #4a4a4a; border-radius: 8px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #6a6a6a; background-clip: padding-box; border: 2px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
button { font-family: var(--font); cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Focus da tastiera sempre visibile, uguale ovunque. */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip-link {
  position: fixed; left: 12px; top: -80px; z-index: 5000; padding: 10px 16px; border-radius: 8px;
  background: var(--yellow); color: #1a1a00; font-weight: 700; text-decoration: none; transition: top .15s ease;
}
.skip-link:focus { top: calc(12px + var(--safe-t)); }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.empty { text-align: center; color: var(--muted); padding: 60px 20px; }

/* ============ 3) CONTROLLI ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: var(--ctl-h); padding: 0 14px; font-size: 14px; line-height: 1.2; white-space: nowrap;
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-ctl);
  transition: background .15s, border-color .15s, transform .05s; text-decoration: none;
}
.btn:hover { border-color: var(--yellow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--border); }
.btn-primary { background: var(--yellow); color: #1a1a00; border-color: var(--yellow); font-weight: 700; }
.btn-primary:hover { background: #fff28a; }
.btn-danger { border-color: #6b2626; color: #ff9b9b; }
.btn-danger:hover { border-color: var(--red); }
.btn-danger-solid { background: var(--red-solid); border-color: var(--red-solid); color: #fff; font-weight: 600; }
.btn-danger-solid:hover { background: #e84444; border-color: #e84444; }
.btn-sm { min-height: var(--ctl-h-sm); padding: 0 10px; font-size: 13px; }
.btn-icon { width: var(--ctl-h-sm); padding: 0; }

input, select, textarea {
  font-family: var(--font); font-size: 14px; color: var(--text);
  width: 100%; min-height: var(--ctl-h); padding: 0 11px;
  background: #161616; border: 1px solid var(--border); border-radius: var(--radius-ctl);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--yellow); outline: 2px solid var(--yellow); outline-offset: 1px; border-radius: var(--radius-ctl); }
input::placeholder { color: #7d7d7d; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23ffed63' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
select option { background: #161616; color: var(--text); }
input[type="file"] { padding: 0; min-height: var(--ctl-h); line-height: calc(var(--ctl-h) - 2px); overflow: hidden; color: var(--muted); }
input[type="file"]::file-selector-button {
  height: calc(var(--ctl-h) - 2px); margin: 0 10px 0 0; padding: 0 14px; border: 0; border-right: 1px solid var(--border);
  background: var(--panel-2); color: var(--text); font-family: var(--font); font-size: 13px; cursor: pointer;
}
/* iOS ingrandisce la pagina se un campo ha testo < 16px: su touch e schermi stretti 16px. */
@media (pointer: coarse), (max-width: 760px) { input, select, textarea { font-size: 16px; } }

label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0 4px; }
/* Campo con etichetta associata (label che avvolge il controllo): usato in form, filtri, modali. */
label.field { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
label.field > span { font-size: 12px; line-height: 1.2; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }

/* ============ 4) LOGIN ============ */
.login-wrap {
  min-height: 100vh; min-height: 100dvh; display: grid; place-items: center;
  padding: calc(24px + var(--safe-t)) calc(16px + var(--safe-r)) calc(24px + var(--safe-b)) calc(16px + var(--safe-l));
  background: radial-gradient(1100px 600px at 70% -10%, rgba(255,237,99,.10), transparent 60%), var(--bg);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: clamp(22px, 5vw, 30px) clamp(18px, 5vw, 28px) clamp(20px, 5vw, 26px); box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.login-logo { display: block; height: 74px; margin: 0 auto 6px; }
.login-tag { text-align: center; font-family: var(--font-head); color: var(--yellow); font-weight: 700; letter-spacing: 1.5px; font-size: 14px; margin: 8px 0 2px; }
.login-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin-bottom: 18px; }
.login-card .btn-primary { width: 100%; margin-top: 8px; min-height: 46px; font-size: 15px; }
.login-mission { text-align: center; color: var(--muted); font-size: 12px; margin-top: 14px; }
.login-mission b { color: var(--yellow); font-weight: 600; }
.err { color: #ff8080; font-size: 13px; min-height: 18px; margin-top: 10px; text-align: center; }
.login-foot { text-align: center; margin-top: 18px; font-size: 11px; color: #8f8f8f; }
.login-lang { display: flex; align-items: center; gap: 8px; justify-content: center; margin-top: 14px; }
.login-lang label { margin: 0; }

/* ============ 5) SHELL: TOPBAR + TAB ============ */
header.topbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px 18px;
  padding: calc(10px + var(--safe-t)) calc(var(--pad-x) + var(--safe-r)) 10px calc(var(--pad-x) + var(--safe-l));
  background: var(--bg-deep); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .logo { height: 40px; width: auto; flex: 0 0 auto; display: block; }
.topbar .brand { flex: 0 1 auto; min-width: 0; }
.topbar .title { font-family: var(--font-head); font-size: 15px; letter-spacing: .5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title .accent { color: var(--yellow); }
.topbar .tag { color: var(--muted); font-size: clamp(11px, 1vw + 4px, 16.5px); letter-spacing: 1px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .spacer { flex: 1 1 0; min-width: 0; }
#app-identity { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
#app-identity:empty { display: none; }
.topbar .who { font-size: clamp(14px, 1vw + 8px, 19.5px); color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .who b { color: var(--yellow); font-weight: 600; }
.topbar .btn-sm { font-size: clamp(14px, 1vw + 8px, 19.5px); min-height: var(--ctl-h); padding: 0 14px; flex: 0 0 auto; }
.role-badge {
  display: inline-flex; align-items: center; min-height: 28px; flex: 0 0 auto;
  font-size: clamp(12px, .8vw + 6px, 16.5px); font-weight: 700; text-transform: uppercase; line-height: 1;
  padding: 0 10px; border-radius: 20px; letter-spacing: .5px;
  background: rgba(255,237,99,.15); color: var(--yellow); border: 1px solid rgba(255,237,99,.35);
}
.lang-select { width: auto; max-width: 100%; font-size: 13px; background-color: var(--panel-2); }
.topbar .lang-select { flex: 0 0 auto; font-size: clamp(15px, 1vw + 8px, 19.5px); }

.tabs {
  display: flex; gap: 4px; align-items: stretch;
  padding: 0 calc(var(--pad-x) + var(--safe-r)) 0 calc(var(--pad-x) + var(--safe-l));
  border-bottom: 1px solid var(--border); background: var(--bg-deep);
  overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; -webkit-overflow-scrolling: touch; scroll-snap-type: x proximity;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto; min-height: 48px; display: inline-flex; align-items: center; white-space: nowrap; scroll-snap-align: start;
  background: none; border: none; border-bottom: 3px solid transparent; margin-bottom: -1px; color: var(--muted);
  padding: 0 14px; font-size: clamp(16px, 1vw + 9px, 21px); transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--text); }
.tab.active, .tab[aria-selected="true"] { color: var(--yellow); border-bottom-color: var(--yellow); font-weight: 600; }
.tab:focus-visible { outline-offset: -3px; }

main {
  max-width: 1400px; margin: 0 auto;
  padding: clamp(14px, 2.4vw, 22px) calc(var(--pad-x) + var(--safe-r)) calc(28px + var(--safe-b)) calc(var(--pad-x) + var(--safe-l));
}

/* ============ 6) DISPOSITIVI ============ */
/* ---- Toolbar: filtri a sinistra, contatore + vista a destra, tutto sulla stessa linea di base ---- */
.devices-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.devices-filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; flex: 1 1 320px; min-width: 0; }
.devices-filters label.field { flex: 1 1 200px; max-width: 320px; }
.devices-tools { display: flex; align-items: center; gap: 12px; min-height: var(--ctl-h); margin-left: auto; }
.devices-count { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* ---- Intervallo di prima presentazione (DevicesPanel.tsx, 2026-10-06) ----
   Un `fieldset` perche' i due campi sono UN filtro con due estremi: la `legend` li lega e dice a
   voce cosa si sta filtrando. Su telefono i due campi vanno a capo uno sotto l'altro (mai scroll
   orizzontale a 360 px) e il bottone "Azzera" prende la riga intera. L'altezza dei campi resta
   quella unica del progetto (--ctl-h) e il font 16 px su mobile (niente zoom iOS): lo ereditano
   dalla regola globale di `input`, quindi qui non si ridefinisce nulla di tutto questo. */
.devices-range { flex: 1 1 420px; min-width: 0; max-width: 520px; margin: 0; padding: 0; border: 0; align-self: flex-end; }
.devices-range > legend { padding: 0; margin: 0 0 4px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.devices-range-row { display: flex; align-items: flex-end; gap: 8px; flex-wrap: wrap; min-width: 0; }
.devices-range-row label.field { flex: 1 1 150px; min-width: 0; max-width: 190px; }
.devices-range-clear { flex: 0 0 auto; }
/* Nota ed errore: riga propria della barra, cosi' non alzano la riga dei campi. */
.devices-range-note, .devices-range-err { flex: 1 1 100%; margin: 2px 0 0; max-width: 92ch; }
/* Errore di intervallo: testo + ruolo alert, non il solo colore. */
.devices-range-err { font-size: 12.5px; line-height: 1.35; color: #ffb3b3; }
/* Prima presentazione nel pannello laterale: la data puo' andare a capo sotto l'etichetta. */
.side-model.side-firstseen { align-items: baseline; font-variant-numeric: tabular-nums; }
.view-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-ctl); overflow: hidden; }
.view-toggle .vt-btn {
  display: inline-flex; align-items: center; justify-content: center; width: max(var(--ctl-h), 44px); height: var(--ctl-h);
  background: var(--panel); color: var(--muted); border: none; font-size: 17px; line-height: 1; padding: 0;
}
.view-toggle .vt-btn + .vt-btn { border-left: 1px solid var(--border); }
.view-toggle .vt-btn.active, .view-toggle .vt-btn[aria-pressed="true"] { background: var(--yellow); color: #111; }
.view-toggle .vt-btn:focus-visible { outline-offset: -3px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); gap: 16px; align-items: start; }
.list { display: flex; flex-direction: column; gap: 10px; }

/* ---- Card ---- */
.card-wrap {
  --side-w: 360px; --tab-w: 44px; --tab-h: 148px;
  --panel-top: #1d1d1d; --panel-bottom: #121212; --panel-edge: #0b0b0c; --accent-glow: rgba(255, 237, 99, .5);
  position: relative; min-width: 0; width: 100%;
}
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: var(--card-pad); min-width: 0; }
.card.offline .card-body, .card.offline .card-chips { opacity: .78; }

/* Testata: [pallino][nome + id][chip][freccia]; sotto i 760px i chip scendono su una riga propria. */
.card-head {
  display: grid; grid-template-columns: auto minmax(min(260px, 45%), 1fr) minmax(0, max-content) auto; grid-template-areas: "dot title chips chev";
  align-items: center; column-gap: 12px; row-gap: 10px;
}
.list .card.collapsible .card-head { cursor: pointer; }
.card-head .status-dot { grid-area: dot; }
.card-title { grid-area: title; min-width: 0; }
.card-chips { grid-area: chips; display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; min-width: 0; }
.card-head .chev-btn { grid-area: chev; }
.card-head .name { display: flex; align-items: center; gap: 4px; min-width: 0; font-family: var(--font-head); font-size: 17px; font-weight: 700; line-height: 1.25; }
.card-head .name-text { min-width: 0; overflow-wrap: break-word; word-break: normal; }
.card-head .id { font-size: clamp(13px, .6vw + 9px, 16.5px); color: var(--muted); line-height: 1.3; overflow-wrap: break-word; font-variant-numeric: tabular-nums; }
.status-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 3px rgba(251,63,63,.18); transition: background .12s ease, box-shadow .12s ease; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(66,198,92,.20); }
/* Lampo "smeraldo" all'arrivo di un aggiornamento dal device (~200ms). */
.status-dot.on.flash { background: #34f5a5; box-shadow: 0 0 0 5px rgba(52,245,165,.55); }
.rename-btn {   /* matita "rinomina": area cliccabile grande, icona 20px */
  flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center;
  width: max(var(--ctl-h-sm), 36px); height: max(var(--ctl-h-sm), 36px); padding: 0; line-height: 1; font-size: 20px;
  background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted);
  transition: color .12s ease, border-color .12s ease, background .12s ease;
}
.rename-btn:hover { color: var(--yellow); border-color: var(--border); background: rgba(255,255,255,.04); }
.chev-btn {
  display: inline-flex; align-items: center; justify-content: center; width: max(var(--ctl-h-sm), 36px); height: max(var(--ctl-h-sm), 36px);
  padding: 0; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-size: 18px; line-height: 1;
}
.chev-btn:hover { color: var(--yellow); border-color: var(--border); }
.chev-btn .chev { display: inline-block; transition: transform .15s ease; }
.chev-btn[aria-expanded="true"] .chev { transform: rotate(90deg); }
.list .card.collapsed .card-body { display: none; }

/* ---- Chip: stessa altezza, testo centrato; le varianti bottone hanno target touch adeguato ---- */
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; padding: 0 11px;
  font-size: clamp(13px, .5vw + 9px, 16.5px); line-height: 1; white-space: nowrap; max-width: 100%;
  color: var(--muted); border: 1px solid var(--border); border-radius: 20px; background: transparent;
}
.chip-src { color: var(--yellow); border-color: var(--yellow); font-weight: 600; }
.chip-fw { color: var(--green); border-color: var(--green); font-weight: 600; }
.chip-up { width: 30px; padding: 0; color: var(--bg); background: var(--yellow); border-color: var(--yellow); font-weight: 700; cursor: help; }   /* fw aggiornabile: solo icona */
.chip-wait { color: #fff; background: var(--red-solid); border-color: var(--red-solid); font-weight: 700; }   /* waitlist: rosso */
.chip-client { color: #fff; background: var(--blue); border-color: var(--blue); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }   /* assegnato: blu elettrico */
.chip-btn { cursor: pointer; font-family: inherit; min-height: max(30px, var(--ctl-h-sm)); transition: background .12s ease, color .12s ease, border-color .12s ease, box-shadow .12s ease; }
.chip-btn.chip-wait:hover { background: #e84444; border-color: #e84444; }
.chip-btn.chip-client:hover { background: #3d78ff; border-color: #3d78ff; box-shadow: 0 0 0 3px rgba(31,94,255,.25); }
.chip-danger { color: #ff9b9b; border-color: #6b2626; }
.chip-danger:hover { background: var(--red-solid); border-color: var(--red-solid); color: #fff; }
/* Emergenza "solo SD" (fw >= 3.19.0): badge rosso pieno con alone pulsante + chip sorgente in rosso.
   Lo stato NON e' mai solo colore: il badge porta l'icona e il testo "SOLO SD — EMERGENZA". */
.chip-emerg { color: #fff; background: var(--red-solid); border-color: var(--red-solid); font-weight: 700; letter-spacing: .02em; animation: ir-emerg 1.8s ease-in-out infinite; }
.chip-src.chip-src-emerg { color: #ff9b9b; border-color: var(--red); background: rgba(251,63,63,.1); }
/* Scheda SD (fw >= 3.20.0): chip presente SOLO quando c'e' qualcosa da dire. Icona + testo (mai il
   solo colore). `warn` = da sistemare ma la radio suona (piena / assente / da formattare): ambra,
   non rosso, perche' la SD e' un accessorio e un allarme rosso sarebbe una bugia. `bad` = guasto
   dichiarato: rosso pieno, come merita, ma senza lampeggiare (quello resta all'emergenza). */
.chip-sd { gap: 5px; font-weight: 600; }
.chip-sd svg { flex: 0 0 13px; }
.chip-sd-warn { color: #ffd08a; border-color: rgba(255,173,79,.6); background: rgba(255,173,79,.13); }
.chip-sd-bad { color: #fff; background: var(--red-solid); border-color: var(--red-solid); font-weight: 700; }
/* Tipo di apparecchio (`hwType`, insieme chiuso UNKNOWN|RP4|ESP-P4|EMU). Neutro per i tipi noti:
   e' un dato di inventario, non un allarme, e non deve competere con i chip di stato. `UNKNOWN`
   invece E' una notizia (quell'apparecchio non riceve aggiornamenti): ambra tenue + il punto di
   domanda nel testo, mai il solo colore, e il motivo nel titolo/aria-label. */
.chip-hw { gap: 5px; font-weight: 600; letter-spacing: .01em; }
.chip-hw-unknown { color: #ffd08a; border-color: rgba(255,173,79,.6); background: rgba(255,173,79,.10); cursor: help; }
/* Motivo per cui una versione non e' inviabile, sotto il nome nella modale OTA. */
.fb-row .fb-deny { display: block; margin-top: 3px; font-size: 11.5px; line-height: 1.35; }
/* Riga "Aggiornamento: <motivo>" nel pannello laterale: il motivo e' una frase, non un chip. */
.side-model.side-hw-note { align-items: flex-start; font-size: 12px; line-height: 1.4; }
.side-model.side-hw-note > span:last-child { color: #ffd08a; }
@keyframes ir-emerg {
  0%, 100% { box-shadow: 0 0 0 0 rgba(251,63,63,.55); }
  50%      { box-shadow: 0 0 0 5px rgba(251,63,63,0); }
}
@media (prefers-reduced-motion: reduce) {
  .chip-emerg { animation: none; box-shadow: 0 0 0 2px rgba(251,63,63,.45); }
}

/* ---- Corpo della card ---- */
.card-body { margin-top: 10px; }
/* La linguetta del pannello opzioni sta sul bordo destro: il corpo le lascia spazio (fisso: aprire il pannello non sposta nulla). */
.card-wrap:not(.wrap-collapsed) .card-body { padding-right: calc(var(--tab-w) - var(--card-pad) + 10px); }
.nowplaying { padding: 10px 12px; background: #151515; border-radius: 8px; border: 1px solid #262626; min-width: 0; }
.nowplaying .station { color: var(--yellow); font-weight: 600; font-size: 15px; overflow-wrap: anywhere; }
.nowplaying .title { font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.nowplaying .meta { font-size: 12px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }

/* Riga comandi: manopola a sinistra, tre righe di pulsanti a destra incolonnati sulla stessa griglia. */
.ctl-row { display: flex; align-items: flex-start; gap: 18px; margin-top: 14px; }
.knob-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 0 0 auto; }
.knob-cap { display: flex; align-items: baseline; gap: 6px; font-size: 12px; }
.controls { display: flex; flex-direction: column; gap: 8px; flex: 1; min-width: 0; }
.ctl-line { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; align-items: center; }
.controls-danger { margin-top: 2px; }
/* Manopola volume — port del CodePen "Javascript draggable volume knob"
   (https://codepen.io/kevin-lam-the-scripter/pen/QWNeNvo, Kevin Lam; markup/CSS forkati da
   Ed Hicks, grafica di Ricardo Salazar). Strati, dall'esterno all'interno:
     .vol-knob          riquadro 128x128 (faccia 96 px + anello di 16 px per le tacche)
     .vol-knob-tick     28 barrette a 10° l'una da -135° a +135°, spente (bianco 20%) o accese
                        (giallo brand con alone) fino all'indice
     .vol-knob-surround ghiera fissa: bordo quasi nero, gradiente verticale scuro, luce
                        interna in alto, ombra interna in basso, ombra portata
     .vol-knob-face     faccia rotante 0..270° con grana (SVG feTurbulence inline al posto
                        del PNG del pen) e puntino luminoso giallo in basso a sinistra
     .vol-knob-min/max  etichette "0" e valore massimo ai piedi della corona
   Tutto in CSS puro: nessuna immagine esterna. Guida completa: VOLUME_KNOB.md (root). */
.vol-knob {
  --kn-face: 96px;          /* diametro della ghiera */
  --kn-ring: 16px;          /* anello esterno per le tacche */
  --kn-glow: rgba(255, 237, 99, .75);
  position: relative; flex: 0 0 auto;
  width: calc(var(--kn-face) + 2 * var(--kn-ring));
  height: calc(var(--kn-face) + 2 * var(--kn-ring));
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none;
}
.vol-knob:active { cursor: grabbing; }
.vol-knob.off { cursor: default; opacity: .55; }
.vol-knob-ticks { position: absolute; inset: 0; pointer-events: none; }
.vol-knob-tick { position: absolute; inset: 0; transform: rotate(var(--a, 0deg)); }
.vol-knob-tick::after {
  content: ""; position: absolute; top: 3px; left: 50%; width: 2px; height: 7px; margin-left: -1px;
  border-radius: 1px; background: rgba(255, 255, 255, .2);
  transition: background .18s ease-out, box-shadow .18s ease-out;
}
.vol-knob-tick.lit::after {
  background: var(--yellow);
  box-shadow: 0 0 5px 1.5px var(--kn-glow);
  transition: background .05s ease-in, box-shadow .05s ease-in;
}
.vol-knob-surround {
  position: absolute; inset: var(--kn-ring); border-radius: 50%;
  border: 2px solid #0e0e0e;
  background: linear-gradient(180deg, #131313 0%, #1d1d1d 100%);
  box-shadow:
    inset 0 3px 2px 1px rgba(255, 255, 255, .10),
    inset 0 -3px 2px 1px rgba(0, 0, 0, .5),
    0 6px 8px 0 rgba(0, 0, 0, .35);
}
.vol-knob-face {
  position: absolute; inset: 0; border-radius: 50%;
  /* grana: rumore frattale SVG (bianco, alpha .18) sopra la ghiera trasparente */
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .18 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  transform: rotate(var(--rot, 0deg));
  transition: transform .08s linear;
  will-change: transform;
}
.vol-knob-face::before {
  /* indice: puntino a -135° (in basso a sinistra) che ruota con la faccia */
  content: ""; position: absolute; left: 17%; bottom: 17%; width: 7px; height: 7px; border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 6px 1px var(--kn-glow);
}
.vol-knob.off .vol-knob-face::before { background: #555; box-shadow: none; }
.vol-knob.off .vol-knob-tick::after { background: rgba(255, 255, 255, .1); box-shadow: none; }
.vol-knob-min, .vol-knob-max {
  position: absolute; bottom: 2px; font-family: var(--font-head); font-size: 10px; line-height: 1;
  color: rgba(255, 255, 255, .62); pointer-events: none;
}
.vol-knob-min { left: 8px; }
.vol-knob-max { right: 8px; }
.vol-knob:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 50%; }
.vol-val { font-family: var(--font-head); font-weight: 700; color: var(--yellow); min-width: 42px; text-align: right; font-variant-numeric: tabular-nums; }

/* ---- Liquid-metal buttons (comandi player nella card) ---------------------------------
   Port in CSS/JS puro del componente React "liquid-metal-button" (@paper-design/shaders): il
   portale non usa React ne' Tailwind e non carica shader WebGL. L'anello metallico e' un
   gradiente conico su un elemento quadrato (3x il bottone) ruotato attorno al centro: alla
   PRESSIONE ruota di +32 gradi (il riflesso "scivola" lungo il bordo) e al RILASCIO torna alla
   posizione iniziale -> effetto riflesso metallo, nessuna animazione continua.
   Struttura: <button class="lmb lmb-<variante>"><span class="lmb-ring"><span class="lmb-metal">
   </span></span><span class="lmb-face"></span><span class="lmb-label">Testo</span></button>
   Stati: :hover (ombra ravvicinata, label piu' chiara), .pressed (JS su pointerdown), ripple
   (span.lmb-ripple aggiunto dal JS al click), :disabled. */
.lmb {
  --lmb-rot: 0deg; --lmb-fg: #8f8f8f; --lmb-fg-hover: #cfcfcf;
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  height: var(--ctl-h); width: 100%; min-width: 0; padding: 0 14px; margin: 0; border: 0; background: transparent;
  border-radius: 100px; cursor: pointer; overflow: hidden; isolation: isolate;
  font-family: var(--font-head); font-size: 12px; font-weight: 700; line-height: 1;
  letter-spacing: .06em; text-transform: uppercase; color: var(--lmb-fg);
  box-shadow: 0 0 0 1px rgba(0,0,0,.3), 0 20px 12px rgba(0,0,0,.08), 0 9px 9px rgba(0,0,0,.12), 0 2px 5px rgba(0,0,0,.15);
  transition: box-shadow .15s cubic-bezier(.4,0,.2,1), transform .15s cubic-bezier(.4,0,.2,1);
}
.lmb:hover { box-shadow: 0 0 0 1px rgba(0,0,0,.4), 0 12px 6px rgba(0,0,0,.05), 0 8px 5px rgba(0,0,0,.1), 0 4px 4px rgba(0,0,0,.15), 0 1px 2px rgba(0,0,0,.2); }
.lmb.pressed { transform: translateY(1px) scale(.98); box-shadow: 0 0 0 1px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.3); }
.lmb-ring { position: absolute; inset: 0; border-radius: 100px; overflow: hidden; z-index: 0; }
.lmb-metal {
  position: absolute; inset: -100%;
  background: conic-gradient(from 0deg at 50% 50%,
    #3a3a3a 0deg, #d9d9d9 40deg, #6b6b6b 80deg, #ffffff 120deg, #4a4a4a 170deg,
    #c8c8c8 220deg, #5c5c5c 260deg, #ececec 310deg, #3a3a3a 360deg);
  transform: rotate(var(--lmb-rot));
  transition: transform .5s cubic-bezier(.2,.8,.3,1);   /* rilascio: torna indietro morbido */
}
.lmb.pressed { --lmb-rot: 32deg; }
.lmb.pressed .lmb-metal { transition: transform .22s cubic-bezier(.2,.8,.3,1); }   /* pressione: scatto avanti */
.lmb-face {
  position: absolute; inset: 2px; border-radius: 100px; z-index: 1;
  background: linear-gradient(180deg, #202020 0%, #000000 100%);
  transition: box-shadow .15s cubic-bezier(.4,0,.2,1);
}
.lmb.pressed .lmb-face { box-shadow: inset 0 2px 4px rgba(0,0,0,.4), inset 0 1px 2px rgba(0,0,0,.3); }
.lmb-label { position: relative; z-index: 2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.5); transition: color .2s; }
.lmb:hover .lmb-label { color: var(--lmb-fg-hover); }
.lmb-ripple {
  position: absolute; z-index: 3; width: 20px; height: 20px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(255,255,255,.4) 0%, rgba(255,255,255,0) 70%);
  transform: translate(-50%, -50%) scale(0); animation: lmb-ripple .6s ease-out forwards;
}
@keyframes lmb-ripple { 0% { transform: translate(-50%,-50%) scale(0); opacity: .6; } 100% { transform: translate(-50%,-50%) scale(4); opacity: 0; } }
.lmb:disabled { opacity: .45; cursor: not-allowed; }
.lmb:disabled:hover .lmb-label { color: var(--lmb-fg); }
.lmb:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 100px; }
/* Varianti: solo il colore dell'etichetta (l'anello metallico e' comune) */
.lmb-yellow { --lmb-fg: var(--yellow); --lmb-fg-hover: #fff7b0; }   /* stato attivo (play), OTA disponibile */
.lmb-orange { --lmb-fg: #ff8a3c; --lmb-fg-hover: #fdba74; }         /* stazione, sorgente */
.lmb-red    { --lmb-fg: #ff7b7b; --lmb-fg-hover: #ffa3a3; }         /* riavvio, formatta SD */
/* Stato acceso non ripetibile (Play mentre suona, Pausa mentre e' in pausa): aria-disabled, resta
   focusabile e pieno (non l'opacita' di :disabled); il colore non e' l'unico segnale (etichetta/aria). */
.lmb.lmb-on { cursor: default; }
.lmb.lmb-on .lmb-face { box-shadow: inset 0 0 0 1px rgba(255,237,99,.35), inset 0 2px 4px rgba(0,0,0,.4); }
.lmb.lmb-on:hover .lmb-label { color: var(--lmb-fg); }
/* Pausa in corso: lampeggio lento (~1 Hz) dell'etichetta e di un alone giallo brand. */
.lmb.lmb-blink .lmb-label { animation: lmb-blink 1s ease-in-out infinite; }
.lmb.lmb-blink .lmb-face { animation: lmb-blink-glow 1s ease-in-out infinite; }
@keyframes lmb-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes lmb-blink-glow {
  0%, 100% { box-shadow: inset 0 0 0 1px rgba(255,237,99,.7), inset 0 0 10px rgba(255,237,99,.28); }
  50%      { box-shadow: inset 0 0 0 1px rgba(255,237,99,.2), inset 0 0 0 rgba(255,237,99,0); }
}
@media (prefers-reduced-motion: reduce) {
  /* Niente movimento: evidenziazione fissa al posto del lampeggio. */
  .lmb.lmb-blink .lmb-label, .lmb.lmb-blink .lmb-face { animation: none !important; }
  .lmb.lmb-blink .lmb-face { box-shadow: inset 0 0 0 2px rgba(255,237,99,.75), inset 0 0 10px rgba(255,237,99,.3); }
}
/* Comando BLOCCATO dalla radio ma forzabile da un admin (emergenza "solo SD", fw >= 3.19.0):
   lucchetto nell'etichetta (il colore non e' mai l'unico segnale) + alone rosso; il pulsante
   resta attivo e apre la modale di forzatura. */
.lmb.lmb-locked { --lmb-fg: #ff9b9b; --lmb-fg-hover: #ffc0c0; }
.lmb.lmb-locked .lmb-face { box-shadow: inset 0 0 0 1px rgba(251,63,63,.5), inset 0 2px 4px rgba(0,0,0,.4); }

/* ---- Pannello opzioni a DESTRA della card (rete / file di fallback / log) ----
   Stile "pannello a manopola" (riferimento utente 2026-09-20), specchiato: la linguetta e' allineata
   al bordo destro della card; il pannello entra da destra IN SOVRAPPOSIZIONE (overlay): aprirlo non
   sposta i comandi della radio. Alto quanto la card, scorre al suo interno.
   Larghezza (2026-09-22): default = 2 x --side-w, ridimensionabile dalla maniglia sul bordo sinistro
   (.side-resize); DrawerResizer.tsx scrive la larghezza effettiva, gia' limitata al layout, in
   --drawer-w (px) sul .card-wrap. Il min() qui e' la seconda rete: mai oltre card - linguetta. */
.side-layer {
  --drawer-cur: min(var(--drawer-w, calc(var(--side-w) * 2)), calc(100% - var(--tab-w)));
  position: absolute; inset: 0; overflow: hidden; pointer-events: none; border-radius: var(--radius); z-index: 5;
}
.side-drawer {
  position: absolute; top: 0; bottom: 0; right: 0; width: var(--drawer-cur);
  overflow-y: auto; overscroll-behavior: contain; padding: 14px 16px; pointer-events: auto;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  border: 1px solid var(--panel-edge); border-left-color: #2c2c2c; border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: inset 1px 0 0 rgba(255,255,255,.04), -10px 0 28px -10px rgba(0,0,0,.75);
  transform: translateX(100%); visibility: hidden;
  transition: transform 420ms var(--ease), visibility 0s linear 420ms;
}
.card-wrap.side-open .side-drawer { transform: translateX(0); visibility: visible; transition: transform 420ms var(--ease), width 420ms var(--ease), visibility 0s; }
.side-head { display: flex; align-items: center; gap: .6em; margin-bottom: 14px; }
.side-head h3 { margin: 0; font-family: var(--font-head); font-weight: 600; font-size: 15px; letter-spacing: .04em; color: var(--text); }
.side-led { width: 8px; height: 8px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 .5em .1em var(--accent-glow); flex-shrink: 0; }
.side-sec + .side-sec { margin-top: 12px; padding-top: 10px; border-top: 1px solid rgba(255,255,255,.06); }
.side-sec h4 { margin: 0 0 8px; font-family: var(--font-head); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.side-drawer .log-list { max-height: none; }
/* Pannello allargato: le righe chiave/valore non si stirano oltre una lunghezza leggibile. */
.side-drawer .net-grid, .side-drawer .modal-note, .side-drawer .log-levels { max-width: 680px; }

/* Maniglia di ridimensionamento: separator verticale sul bordo sinistro del pannello aperto.
   Striscia sottile (target 14px col mouse, 44px col touch) + filetto e grip che si accendono al
   passaggio / focus. Durante il drag (.side-resizing) niente transizioni: segue il puntatore. */
.side-resize {
  position: absolute; top: 0; bottom: 0; right: calc(var(--drawer-cur) - 7px); width: 14px; z-index: 1;
  pointer-events: auto; cursor: col-resize; touch-action: none; visibility: hidden; opacity: 0;
  transition: right 420ms var(--ease), opacity 200ms ease, visibility 0s linear 200ms;
}
.card-wrap.side-open .side-resize { visibility: visible; opacity: 1; transition: right 420ms var(--ease), opacity 200ms ease 300ms, visibility 0s; }
.side-resize::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; transform: translateX(-50%); background: transparent; transition: background 150ms ease; }
.side-grip {
  position: absolute; top: 18px; left: 50%; width: 6px; height: 34px; transform: translateX(-50%); border-radius: 3px;
  background: radial-gradient(circle, #8a8a8a 1.2px, transparent 1.6px) center / 6px 7px repeat-y, #202020;
  box-shadow: 0 0 0 1px #3a3a3a; transition: box-shadow 150ms ease;
}
.side-resize:hover::before, .side-resize:focus-visible::before, .card-wrap.side-resizing .side-resize::before { background: var(--yellow); }
.side-resize:hover .side-grip, .side-resize:focus-visible .side-grip, .card-wrap.side-resizing .side-grip { box-shadow: 0 0 0 1px var(--yellow), 0 0 .5em var(--accent-glow); }
.side-resize:focus-visible { outline: 2px solid var(--yellow); outline-offset: -2px; border-radius: 4px; }
.card-wrap.side-resizing { cursor: col-resize; user-select: none; -webkit-user-select: none; }
.card-wrap.side-resizing .side-drawer, .card-wrap.side-resizing .side-tab, .card-wrap.side-resizing .side-resize { transition: none; }
@media (pointer: coarse) {
  .side-resize { width: 44px; right: calc(var(--drawer-cur) - 22px); }
  .side-grip { width: 8px; height: 44px; }
}

.side-tab {
  position: absolute; top: 50%; right: 0; width: var(--tab-w); height: var(--tab-h); transform: translateY(-50%);
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: .9em 0;
  pointer-events: auto; cursor: pointer; color: inherit;
  border: 1px solid var(--panel-edge); border-right: none; border-radius: 12px 0 0 12px;
  background: linear-gradient(180deg, var(--panel-top), var(--panel-bottom));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -10px 18px -14px rgba(0,0,0,.7), -2px 0 14px -6px rgba(0,0,0,.55);
  transition: right 420ms var(--ease);
}
.side-tab { z-index: 2; }   /* sopra la maniglia dove si toccano */
.card-wrap.side-open .side-tab { right: var(--drawer-cur); }
.side-tab:focus-visible { outline: 2px solid var(--yellow); outline-offset: -2px; border-radius: 12px 0 0 12px; }
.tab-ticks { display: flex; flex-direction: column; gap: 5px; }
.tab-ticks span { width: 10px; height: 2px; border-radius: 1px; background: rgba(255,255,255,.14); transition: background 300ms ease, box-shadow 300ms ease; }
.side-tab:hover .tab-ticks span, .card-wrap.side-open .tab-ticks span { background: var(--yellow); box-shadow: 0 0 .35em var(--accent-glow); }
.side-tab:hover .tab-ticks span:nth-child(2), .card-wrap.side-open .tab-ticks span:nth-child(2) { transition-delay: 40ms; }
.side-tab:hover .tab-ticks span:nth-child(3), .card-wrap.side-open .tab-ticks span:nth-child(3) { transition-delay: 80ms; }
.tab-led {
  position: relative; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 35% 30%, #2a2a2c, #0f0f10 70%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06), inset 0 2px 3px rgba(0,0,0,.6);
}
.tab-led::after { content: ''; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 .5em .05em var(--accent-glow); opacity: .35; transition: opacity 300ms ease; }
.side-tab:hover .tab-led::after, .card-wrap.side-open .tab-led::after { opacity: 1; }
/* Freccia: chiuso punta a sinistra (il pannello si apre verso sinistra), aperto ruota e punta a destra. */
.tab-led svg { width: 11px; height: 11px; stroke: #b5b5ba; position: relative; z-index: 1; transform: rotate(180deg); transition: transform 420ms var(--ease), stroke 300ms ease; }
.card-wrap.side-open .tab-led svg { transform: rotate(0deg); stroke: var(--yellow); }
.tab-label { font-family: var(--font-head); text-transform: uppercase; letter-spacing: .18em; font-size: 10.5px; color: var(--muted); writing-mode: vertical-rl; transform: rotate(180deg); }

/* ---- Progress (OTA / formattazione / upload) ---- */
.ota-progress, .up-progress { margin: 10px 0 4px; }
.ota-bar { height: 8px; background: #262626; border-radius: 6px; overflow: hidden; border: 1px solid #333; }
.ota-bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--yellow-dim), var(--yellow)); transition: width .25s ease; }
.ota-text { font-size: 12px; color: var(--yellow); margin-top: 4px; font-family: var(--font-head); letter-spacing: .3px; overflow-wrap: anywhere; }
.up-progress .ota-text { color: var(--muted); }
.ota-progress.done .ota-bar > span, .up-progress.done .ota-bar > span { background: var(--green); }
.ota-progress.done .ota-text { color: var(--green); }
.ota-progress.error .ota-bar > span, .up-progress.error .ota-bar > span { background: var(--red); }
.ota-progress.error .ota-text { color: #ff8080; }

/* ---- Rete / file / log (nel pannello opzioni e nei modali) ---- */
.net-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 12px; font-size: 12.5px; }
.net-grid > span:nth-child(odd) { color: var(--muted); }
.net-grid > span:nth-child(even) { color: var(--text); overflow-wrap: anywhere; }
.net-st { font-weight: 600; }
/* Un badge di stato puo' portare un'icona (scheda SD): allineata al testo, mai da sola. */
.net-st svg { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }
.net-st.ok { color: var(--green); }
.net-st.nok { color: #ff8080; }
.net-st.conn { color: var(--orange); }
/* Qualita' dei link Ethernet/WiFi (fw >= 3.15.0): valore di una riga di .net-grid = stato + punteggio
   + meter (riusa .ota-bar) + numeri. Lo stato e' sempre scritto, il colore e' solo un rinforzo. */
.linkq-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.linkq-score { color: var(--muted); font-variant-numeric: tabular-nums; }
.linkq-use { display: inline-flex; align-items: center; gap: 4px; padding: 1px 7px; border: 1px solid var(--yellow); border-radius: 10px; color: var(--yellow); font-size: 11.5px; font-weight: 600; line-height: 1.4; overflow-wrap: normal; }
.linkq-meter { display: block; height: 6px; max-width: 240px; margin: 5px 0 4px; }
.linkq-meter.ok > span { background: var(--green); }
.linkq-meter.bad > span { background: var(--orange); }
.linkq-nums > span > span { white-space: nowrap; }   /* si va a capo tra un dato e l'altro, mai tra numero e unita' */
.linkq-nums { display: block; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; overflow-wrap: normal; }
/* "?" che apre la spiegazione del punteggio (LinkQualityModal). Sta nella testata della riga, sopra
   la barra: non la sposta e non la restringe. Il cerchio e' piccolo (18px) ma l'area di tocco e'
   portata a --ctl-h (44px su schermi tattili) da uno pseudo-elemento, che non occupa spazio. */
.linkq-help {
  position: relative; flex: 0 0 auto; width: 18px; height: 18px; padding: 0; margin: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 50%; background: transparent;
  color: var(--muted); font-family: var(--font-head); font-size: 12px; font-weight: 700; line-height: 1; cursor: pointer;
  transition: color .12s ease, border-color .12s ease;
}
.linkq-help::after { content: ''; position: absolute; left: 50%; top: 50%; width: var(--ctl-h); height: var(--ctl-h); transform: translate(-50%, -50%); }
.linkq-help:hover { color: var(--yellow); border-color: var(--yellow); }
.linkq-help:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; border-radius: 50%; }

/* ---- Spiegazione del punteggio di qualita' di un link (LinkQualityModal) ---- */
.lqx-lead { margin: 0 0 6px; font-size: 14.5px; line-height: 1.55; }
.lqx-use { margin: 0 0 4px; font-size: 12.5px; color: var(--muted); }
.lqx-h { margin: 18px 0 6px; font-family: var(--font-head); font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.lqx-p { margin: 0 0 8px; font-size: 13px; line-height: 1.55; }
.lqx-small { font-size: 12.5px; color: var(--muted); }
.lqx-table { width: 100%; border-collapse: collapse; font-size: 13px; }
/* Reset delle regole globali di tabella (`th` e' MAIUSCOLO e `white-space: nowrap`): qui il titolo
   di riga e' testo normale e DEVE andare a capo, altrimenti la tabella non si stringe e il corpo
   della modale scorre in orizzontale a 360/390 px. */
.lqx-table th, .lqx-table td { text-align: left; padding: 7px 0; border-bottom: 1px solid var(--border); vertical-align: baseline; }
.lqx-table th { text-transform: none; white-space: normal; letter-spacing: 0; font-size: inherit; color: inherit; }
.lqx-table thead th { padding-bottom: 4px; font-family: var(--font-head); font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.lqx-table thead th:last-child, .lqx-table td { text-align: right; }
.lqx-table th[scope="row"] { font-weight: 400; padding-right: 12px; }
.lqx-name { display: block; color: var(--text); }
.lqx-meas { display: block; margin-top: 1px; color: var(--yellow); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lqx-rule { display: block; margin-top: 2px; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.lqx-num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.lqx-unk { color: var(--muted); font-style: italic; }
.lqx-table .lqx-sum th, .lqx-table .lqx-sum td { border-top: 1px solid #3a3a3a; font-weight: 600; }
.lqx-table .lqx-rep td { color: var(--yellow); font-weight: 700; }
.lqx-table tbody tr:last-child th, .lqx-table tbody tr:last-child td { border-bottom: 0; }
.lqx-out {
  display: flex; gap: 10px; align-items: flex-start; margin: 10px 0 0;
  padding: 10px 12px; border: 1px solid rgba(255,237,99,.4); border-radius: 8px;
  background: rgba(255,237,99,.07); font-size: 13px; line-height: 1.55;
}
.lqx-out.lqx-out-ok { border-color: rgba(63,201,120,.4); background: rgba(63,201,120,.07); }
.lqx-out p { margin: 0; }
.lqx-out-ico { flex: 0 0 auto; font-family: var(--font-head); font-size: 16px; line-height: 1.35; color: var(--yellow); }
.lqx-out.lqx-out-ok .lqx-out-ico { color: var(--green); }
.lqx-list { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; }
.lqx-list li { margin: 5px 0; }
.lqx-cloud { margin: 10px 0 0; padding: 9px 12px; border-left: 3px solid var(--yellow); background: rgba(255,255,255,.03); font-size: 13px; line-height: 1.55; }
/* Telefono: la penalita' passa sotto alla voce invece di stringere la colonna del testo. */
@media (max-width: 560px) {
  .lqx-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .lqx-table, .lqx-table tbody, .lqx-table tr, .lqx-table th, .lqx-table td { display: block; }
  .lqx-table tr { padding: 7px 0; border-bottom: 1px solid var(--border); }
  .lqx-table th, .lqx-table td { padding: 0; border-bottom: 0; }
  .lqx-table td { text-align: left; margin-top: 3px; white-space: normal; }
  .lqx-table tbody tr:last-child { border-bottom: 0; }
  .lqx-table .lqx-sum { border-top: 1px solid #3a3a3a; }
  .lqx-table .lqx-sum th, .lqx-table .lqx-sum td { border-top: 0; }
}
.fb-list { display: flex; flex-direction: column; gap: 6px; }
.fb-row { display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); min-width: 0; }
.fb-row .fb-name { flex: 1 1 140px; min-width: 0; font-size: 13px; overflow-wrap: anywhere; }
.fb-row .fb-size { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fb-playdot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; background: var(--yellow); box-shadow: 0 0 0 2px rgba(255,237,99,.25); display: inline-block; }
.fb-playdot.off { background: transparent; box-shadow: none; }
.log-list { display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12px; }
.log-row { padding: 2px 4px; border-radius: 4px; overflow-wrap: anywhere; }
.log-row .log-t { color: var(--muted); margin-right: 6px; }
.log-row.log-warn { color: var(--orange); }
.log-row.log-error { color: #ff8080; }
.log-row.log-debug { color: #8f8f8f; }
.log-levels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 10px; }

/* ---- Registro attivita' (ActivityLog) — riferimento grafico: log_example.png ----
   Stessa struttura e stesse classi nel portale (ActivityLog.tsx) e nel configuratore (app.js); l'app
   Flutter la replica in IrActivityLog. Testata (icona + titolo) -> filtri a chip LIVELLO / SORGENTE ->
   riquadro "Eventi recenti" con righe a 4 colonne: ora (mono) · badge livello PIENO · badge sorgente
   a CONTORNO (tag del firmware, colore = gruppo) · messaggio (mono). Le colonne hanno larghezza FISSA
   (--alog-c-*): restano allineate anche quando un filtro cambia l'insieme delle righe. Sotto i 520px
   di contenitore (drawer della card, telefono) il messaggio va a capo sotto le tre colonne.
   Il giallo brand marca SOLO il filtro attivo; il livello e' sempre scritto nel badge (mai solo colore). */
.alog { --alog-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Cascadia Mono', 'DejaVu Sans Mono', monospace; --alog-line: rgba(255,255,255,.07);
  --alog-c-time: 60px; --alog-c-lvl: 70px; --alog-c-src: 92px; --alog-gap: 10px; --alog-pad-x: 12px; min-width: 0; }
.alog-head { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding-bottom: 10px; border-bottom: 1px solid var(--alog-line); }
.alog-head h4, .alog-head h2 { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 13.5px; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.alog-ico { width: 16px; height: 16px; flex: 0 0 16px; stroke: var(--yellow); }
.alog-phead .alog-ico { width: 15px; height: 15px; flex-basis: 15px; stroke: var(--text); }
.alog-filters { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.alog-fgroup { min-width: 0; }
.alog-flabel { display: block; margin-bottom: 6px; font-family: var(--font-head); font-weight: 600; font-size: 10.5px; line-height: 1.2; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.alog-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.alog-chip {
  display: inline-flex; align-items: center; justify-content: center; min-height: 28px; min-width: 44px; padding: 0 10px;
  font-family: var(--font-head); font-weight: 700; font-size: 11.5px; line-height: 1; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
  color: #c4c4c4; background: #191919; border: 1px solid var(--border); border-radius: 5px; transition: color .15s, border-color .15s, background .15s;
}
.alog-chip:hover { color: var(--text); border-color: #5a5a5a; }
.alog-chip.active, .alog-chip[aria-pressed="true"] { color: var(--yellow); border-color: var(--yellow); background: rgba(255,237,99,.12); }
@media (pointer: coarse) { .alog-chip { min-height: 44px; padding: 0 14px; font-size: 13px; } .alog-chips { gap: 8px; } }

.alog-panel { container: alog / inline-size; border: 1px solid var(--border); border-radius: 8px; background: #141414; overflow: hidden; min-width: 0; }
.alog-phead { display: flex; align-items: center; gap: 8px; padding: 10px var(--alog-pad-x); border-bottom: 1px solid var(--border); background: rgba(255,255,255,.02); }
.alog-phead h5, .alog-phead h3 { margin: 0; font-family: var(--font-head); font-weight: 700; font-size: 12.5px; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.alog-count { margin-left: auto; font-family: var(--alog-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alog-list { max-height: 420px; overflow-y: auto; overscroll-behavior: contain; font-family: var(--alog-mono); font-size: 12px; line-height: 1.45; }
.alog-list:focus-visible { outline-offset: -2px; border-radius: 0 0 7px 7px; }
.side-drawer .alog-list { max-height: none; }          /* nel drawer scorre il drawer, non la lista */
.alog-item + .alog-item, .alog-day + .alog-row { border-top: 1px solid var(--alog-line); }   /* filetti tra le righe */
.alog-row {
  display: grid; grid-template-columns: var(--alog-c-time) var(--alog-c-lvl) var(--alog-c-src) minmax(0, 1fr);
  column-gap: var(--alog-gap); align-items: baseline; padding: 9px var(--alog-pad-x);
}
.alog-row:hover { background: rgba(255,255,255,.025); }
.alog-time { color: #8f8f8f; white-space: nowrap; font-variant-numeric: tabular-nums; }
.alog-lvl, .alog-src { justify-self: start; max-width: 100%; padding: 2px 7px; border: 1px solid transparent; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.alog-lvl { font-family: var(--font-head); font-weight: 700; font-size: 10.5px; line-height: 1.45; letter-spacing: .06em; text-transform: uppercase; }
.alog-lvl.lv-error { background: var(--red-solid); color: #fff; }
.alog-lvl.lv-warn  { background: var(--orange); color: #1f1300; }
.alog-lvl.lv-info  { background: #666666; color: #fff; }
.alog-lvl.lv-debug { background: transparent; border-color: #4a4a4a; color: var(--muted); }
.alog-src { font-family: var(--alog-mono); font-size: 11px; line-height: 1.4; text-transform: lowercase; background: transparent; }
.alog-src.src-network { color: #8ab4ff; border-color: rgba(138,180,255,.55); }
.alog-src.src-audio   { color: #5fd678; border-color: rgba(66,198,92,.6); }
.alog-src.src-system  { color: #b4b4b4; border-color: #555555; }
.alog-src.src-user    { color: var(--yellow); border-color: rgba(255,237,99,.55); }
.alog-src.src-raw     { color: #8f8f8f; border-color: #3d3d3d; border-style: dashed; }
.alog-msg { min-width: 0; color: #ececec; overflow-wrap: anywhere; white-space: pre-wrap; }
.alog-row.lv-debug .alog-msg, .alog-row.is-raw .alog-msg { color: var(--muted); }
.alog-day { padding: 6px var(--alog-pad-x); font-family: var(--font-head); font-weight: 600; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); background: rgba(255,255,255,.03); }
.alog-empty { padding: 16px var(--alog-pad-x); font-family: var(--font); font-size: 13px; color: var(--muted); }
/* Contenitore stretto: tre colonne allineate + messaggio a tutta larghezza sulla riga sotto. */
@container alog (max-width: 519.98px) {
  .alog-row { grid-template-columns: var(--alog-c-time) var(--alog-c-lvl) minmax(0, 1fr); row-gap: 5px; }
  .alog-msg { grid-column: 1 / -1; }
}
/* Contenitore molto stretto (drawer su telefoni da 360px): margini ridotti, piu' spazio al badge sorgente. */
@container alog (max-width: 279.98px) {
  .alog-row, .alog-phead, .alog-day, .alog-empty { --alog-pad-x: 8px; --alog-gap: 8px; }
  .alog-row { --alog-c-time: 58px; --alog-c-lvl: 66px; }
}
/* Contenitore largo: respiro del riferimento (colonne piu' larghe, corpo 13px). */
@container alog (min-width: 720px) {
  .alog-list { font-size: 13px; }
  .alog-row { --alog-c-time: 84px; --alog-c-lvl: 84px; --alog-c-src: 112px; --alog-gap: 14px; padding: 11px 16px; }
  .alog-phead, .alog-day, .alog-empty { padding-left: 16px; padding-right: 16px; }
  .alog-src { font-size: 11.5px; }
}
.side-model { display: flex; align-items: center; gap: 8px; margin: -4px 0 12px; font-size: 12.5px; }
.side-model .chip { min-height: 24px; padding: 0 9px; font-size: 12.5px; font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }

/* ============ 7) PANNELLI ADMIN ============ */
.panel-section { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: clamp(14px, 2.4vw, 18px); margin-bottom: 18px; min-width: 0; }
.panel-section h2 { margin: 0 0 14px; font-size: 16px; color: var(--yellow); }
.panel-note { margin: -6px 0 14px; font-size: 13px; color: var(--muted); }
.form-inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); gap: 12px; align-items: end; }
.form-inline .btn { width: 100%; }
.panel-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
tbody tr:hover td { background: #171717; }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
.row-actions { display: inline-flex; gap: 8px; align-items: center; justify-content: flex-end; }
td .chip { margin-left: 8px; vertical-align: middle; min-height: 24px; padding: 0 9px; font-size: 12.5px; }
/* Sotto i 720px ogni riga diventa una scheda: etichetta a sinistra (data-label), valore a destra, azioni in fondo. */
@media (max-width: 720px) {
  .rtable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); }
  .rtable, .rtable tbody { display: block; }
  .rtable tr { display: grid; gap: 8px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg); }
  .rtable tbody tr:hover td { background: transparent; }
  .rtable td { display: grid; grid-template-columns: minmax(92px, 36%) minmax(0, 1fr); gap: 10px; align-items: center; padding: 0; border: 0; overflow-wrap: anywhere; width: auto; white-space: normal; text-align: left; }
  .rtable td::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
  .rtable td.actions { display: block; margin-top: 2px; padding-top: 10px; border-top: 1px solid var(--border); }
  .rtable td.actions::before { content: none; }
  .rtable .row-actions { display: flex; }
  .rtable .row-actions .btn { flex: 1 1 0; }
}

/* ============ 8) MODALI, DIALOGHI, TOAST ============ */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: rgba(0,0,0,.66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: dlg-fade .16s ease-out;
}
.modal {
  width: 100%; max-width: 640px; max-height: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--panel); border: 1px solid #3a3a3a; border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.7), inset 0 1px 0 rgba(255,255,255,.05); animation: dlg-pop .18s cubic-bezier(.2,.9,.3,1.2);
}
.modal-head { display: flex; align-items: center; gap: 12px; padding: 14px 12px 14px 20px; border-bottom: 1px solid var(--border); }
.modal-head .modal-titles { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.modal-head h3 { margin: 0; font-family: var(--font-head); font-size: 18px; letter-spacing: .4px; }
.modal-head .muted { font-size: 13px; overflow-wrap: anywhere; }
.modal-close { flex: 0 0 auto; width: max(var(--ctl-h), 40px); height: max(var(--ctl-h), 40px); display: inline-flex; align-items: center; justify-content: center; padding: 0; font-size: 22px; line-height: 1; background: none; border: 1px solid transparent; border-radius: 8px; color: var(--muted); }
.modal-close:hover { color: var(--yellow); border-color: var(--border); }
.modal-body { padding: 16px 20px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); background: rgba(0,0,0,.18); }
.modal-foot .btn { min-width: 104px; }
.modal-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.modal-note { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }
/* ---- Emergenza "solo SD": avviso rosso e modale di forzatura (SdOnlyForceModal) ---- */
.emerg-note {
  display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px;
  padding: 10px 12px; border: 1px solid rgba(251,63,63,.45); border-radius: 8px;
  background: rgba(251,63,63,.09); color: #ffc9c9; font-size: 13px; line-height: 1.5;
}
.emerg-ico { flex: 0 0 auto; font-size: 15px; line-height: 1.4; }
.emerg-note strong { display: block; color: #fff; font-size: 13px; }
.sdforce-lead { margin: 0 0 12px; font-size: 14px; line-height: 1.55; }
.sdforce-list { margin: 6px 0 0; padding-left: 18px; }
.sdforce-list li { margin: 4px 0; }
.sdforce-cmd { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin: 12px 0 0; font-size: 13px; }
.sdforce-cmd .muted { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.sdforce-cmd-val { font-family: ui-monospace, 'Cascadia Mono', 'Consolas', monospace; color: var(--yellow); overflow-wrap: anywhere; }
.st-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: center; margin-top: 10px; }
.upload-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 10px; align-items: center; margin-top: 14px; }
.upload-row label { margin: 0; }
/* ---- Configurazione di rete (NetConfigModal) ---- */
.side-actions { margin: 10px 0 0; }
.netcfg { display: flex; flex-direction: column; gap: 14px; }
.netcfg-warn { margin: 0; padding: 10px 12px; border: 1px solid rgba(255,173,79,.4); border-radius: 8px; background: rgba(255,173,79,.08); color: #ffd199; }
.netcfg-trial { margin: 0; color: var(--orange); }
.netcfg-box { margin: 0; padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.netcfg-box legend { padding: 0 8px; font-family: var(--font-head); font-weight: 700; font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--yellow); }
.netcfg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 138px), 1fr)); gap: 12px; align-items: start; }
.netcfg-wifi { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 12px; align-items: start; }
.netcfg .modal-toolbar { margin-top: 0; }
input:disabled, select:disabled { opacity: .5; cursor: not-allowed; }
input[aria-invalid="true"] { border-color: var(--red); }
.field-err { font-style: normal; font-size: 12px; color: #ff8080; margin: 0; }
.pass-wrap { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px; align-items: center; }
.pass-wrap .btn-icon { width: var(--ctl-h); min-height: var(--ctl-h); }
.check { display: inline-flex; align-items: center; gap: 10px; margin: 0; min-height: var(--ctl-h-sm); font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--yellow); flex: 0 0 auto; }
/* Selettore a due stati (DHCP / statico) */
.seg { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--border); border-radius: var(--radius-ctl); overflow: hidden; align-self: start; }
.seg-3 { grid-template-columns: repeat(3, 1fr); display: grid; }
.seg-btn { min-height: var(--ctl-h-sm); padding: 0 16px; background: var(--panel); color: var(--muted); border: 0; font-size: 13.5px; font-weight: 600; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn.active { background: var(--yellow); color: #1a1a00; }
.seg-btn:focus-visible { outline-offset: -3px; }
/* Risultati dello scan WiFi: barre di potenza + nome + cifratura + dBm (mai solo colore) */
.wifi-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.wifi-row { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 10px; align-items: center; min-height: var(--ctl-h); padding: 4px 10px; text-align: left; background: var(--bg); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; }
.wifi-row:hover:not(:disabled) { border-color: var(--yellow); }
.wifi-row.active { border-color: var(--yellow); box-shadow: inset 3px 0 0 var(--yellow); }
.wifi-row:disabled { opacity: .55; cursor: not-allowed; }
.wifi-ssid { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wifi-enc, .wifi-rssi { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.sig { display: inline-flex; align-items: flex-end; gap: 2px; height: 16px; }
.sig i { width: 4px; border-radius: 1px; background: #3a3a3a; }
.sig i:nth-child(1) { height: 4px; } .sig i:nth-child(2) { height: 8px; } .sig i:nth-child(3) { height: 12px; } .sig i:nth-child(4) { height: 16px; }
.sig-1 i:nth-child(-n+1), .sig-2 i:nth-child(-n+2), .sig-3 i:nth-child(-n+3), .sig-4 i:nth-child(-n+4) { background: var(--yellow); }
@media (max-width: 520px) { .wifi-row { grid-template-columns: auto minmax(0, 1fr) auto; } .wifi-rssi { grid-column: 2 / -1; } }
.assign-current { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.assign-hint { font-size: 12.5px; margin: 12px 0 0; }

/* Dialoghi executive (DialogHost: confirm / prompt / alert) */
.dlg-overlay {
  position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: rgba(0,0,0,.66); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); animation: dlg-fade .16s ease-out;
}
.dlg {
  position: relative; width: 100%; max-width: 500px; max-height: 100%; overflow: hidden auto;
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid #3a3a3a; border-radius: 14px;
  box-shadow: 0 30px 80px rgba(0,0,0,.7), 0 0 0 1px rgba(255,237,99,.06), inset 0 1px 0 rgba(255,255,255,.05);
  animation: dlg-pop .18s cubic-bezier(.2,.9,.3,1.2);
}
.dlg::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 3px; background: linear-gradient(90deg, var(--yellow), var(--yellow-dim)); }
.dlg-danger::before { background: linear-gradient(90deg, var(--red), #a41c1c); }
/* Lo shake si aggiunge al pop (stessa lista, pop in prima posizione): togliendo l'attributo il pop non riparte. */
.dlg[data-shake] { animation: dlg-pop .18s cubic-bezier(.2,.9,.3,1.2), dlg-shake .36s ease-in-out; }
.dlg-head { display: flex; align-items: center; gap: 14px; padding: 20px 22px 8px; }
.dlg-head h3 { margin: 0; font-family: var(--font-head); font-size: 19px; letter-spacing: .6px; text-transform: uppercase; color: var(--text); line-height: 1.2; }
.dlg-icon { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-head); font-weight: 700; font-size: 19px; color: #111; background: var(--yellow); box-shadow: 0 0 0 5px rgba(255,237,99,.12); }
.dlg-danger .dlg-icon { background: var(--red-solid); color: #fff; box-shadow: 0 0 0 5px rgba(251,63,63,.14); }
.dlg-body { padding: 6px 22px 18px; }
.dlg-msg { margin: 0; font-size: 15.5px; line-height: 1.45; color: var(--text); white-space: pre-line; overflow-wrap: anywhere; }
.dlg-detail { margin: 12px 0 0; padding: 10px 14px; list-style: none; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); font-size: 13px; color: var(--muted); max-height: 220px; overflow-y: auto; }
.dlg-detail li { padding: 2px 0; overflow-wrap: anywhere; }
.dlg-detail li::before { content: '\2022  '; color: var(--yellow); }
.dlg-field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0 0; }
.dlg-field span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.dlg-field input { min-height: 44px; font-size: 16px; }
.dlg-foot { display: flex; justify-content: flex-end; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--border); background: rgba(0,0,0,.18); }
.dlg-foot .btn { min-width: 104px; font-weight: 600; }
.dlg-discard { background: rgba(251,63,63,.08); border-top-color: rgba(251,63,63,.35); }
.dlg-discard-msg { flex: 1 1 180px; font-size: 13.5px; color: #ffb1b1; }
@keyframes dlg-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dlg-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dlg-sheet { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
@keyframes dlg-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(3px); } }

.toast {
  position: fixed; left: 50%; bottom: calc(20px + var(--safe-b)); transform: translateX(-50%); z-index: 3000;
  max-width: calc(100vw - 32px); padding: 11px 18px; text-align: center; font-size: 14px; line-height: 1.35;
  background: var(--panel-2); border: 1px solid var(--yellow); color: var(--text); border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.5);
  opacity: 0; transition: opacity .2s; pointer-events: none;
}
.toast.show { opacity: 1; }
.toast.err { border-color: var(--red); }

/* ============ 9) RESPONSIVE ============ */
/* Tablet verticale e telefoni: i chip della card scendono sotto il titolo, allineati a sinistra. */
@media (max-width: 900px) {
  #app-identity { margin-left: auto; }   /* se va a capo resta allineata a destra, sotto il selettore lingua */
}
@media (max-width: 760px) {
  .card-wrap { --side-w: 320px; }
  .card-head { grid-template-columns: auto minmax(0, 1fr) auto; grid-template-areas: "dot title chev" "chips chips chips"; }
  .card-chips { justify-content: flex-start; }
}
/* Telefoni. */
@media (max-width: 640px) {
  header.topbar { position: static; gap: 8px 12px; }
  .topbar .logo { height: 32px; }
  .topbar .tag { display: none; }
  .topbar .brand { flex: 1 1 0; }
  .topbar .spacer { display: none; }
  #app-identity { flex: 1 1 100%; justify-content: space-between; }
  .topbar .who { flex: 1 1 auto; }
  .tabs { position: sticky; top: 0; z-index: 20; padding-top: var(--safe-t); -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
  .tab { padding: 0 12px; }
  .devices-filters { flex: 1 1 100%; }
  .devices-filters label.field { flex: 1 1 100%; max-width: none; }
  .devices-range { flex: 1 1 100%; }
  .devices-range-row label.field { flex: 1 1 140px; max-width: none; }
  .devices-range-clear { flex: 1 1 100%; }
  .devices-tools { flex: 1 1 100%; justify-content: space-between; margin-left: 0; }
  .card-wrap { --tab-w: 38px; --tab-h: 132px; }
  .ctl-row { flex-direction: column; align-items: stretch; gap: 12px; }
  .knob-col { align-self: center; }
  .ctl-line { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .lmb { font-size: 11.5px; padding: 0 10px; }
  .st-row { grid-template-columns: 1fr; }
  .upload-row { grid-template-columns: 1fr; }
  /* Modali e dialoghi diventano "bottom sheet": a tutta larghezza, ancorati in basso, pulsanti larghi. */
  .modal-overlay, .dlg-overlay { align-items: flex-end; padding: calc(12px + var(--safe-t)) 0 0; }
  .modal, .dlg { max-width: none; border-radius: 18px 18px 0 0; border-bottom: 0; animation-name: dlg-sheet; }
  .dlg[data-shake] { animation: dlg-shake .36s ease-in-out; }
  .modal-foot, .dlg-foot { padding-bottom: calc(14px + var(--safe-b)); padding-left: calc(16px + var(--safe-l)); padding-right: calc(16px + var(--safe-r)); }
  .modal-foot .btn, .dlg-foot .btn { flex: 1 1 0; min-width: 0; min-height: 46px; }
  /* Azione con etichetta lunga (forzatura "solo SD"): riga intera, altrimenti il testo viene tagliato. */
  .modal-foot .btn.sdforce-go { flex: 1 1 100%; }
  .modal-body { padding: 14px 16px; }
  .modal-head { padding-left: 16px; }
  .dlg-head { padding: 22px 18px 8px; }
  .dlg-body { padding: 6px 18px 16px; }
}
@media (max-width: 380px) {
  .topbar .role-badge { display: none; }
  .ctl-line { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
/* Telefoni in orizzontale: poca altezza, niente barre fisse che rubano spazio. */
@media (max-height: 480px) and (orientation: landscape) {
  header.topbar, .tabs { position: static; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media (forced-colors: active) {
  .btn, .chip, .card, .panel-section, input, select { border: 1px solid CanvasText; }
  .status-dot { forced-color-adjust: none; }
}

/* ============ 10) FORM EXECUTIVE, ACCOUNT, UTENTI, ALBERO CLIENTI (2026-09-22) ============
   Regole dei popup in MODAL-POPUPS.md (root del workspace). Campi: div.field > label.field-label +
   controllo + em.field-err / .field-warn / .field-hint (fuori dalla label: il nome accessibile resta
   l'etichetta). Checklist password .pwc condivisa da React (PasswordFields.tsx) e vanilla
   (/js/pwcheck.js). Albero clienti .ctree = WAI-ARIA tree a fisarmonica (ClientTree.tsx). */
[hidden] { display: none !important; }
div.field { display: flex; flex-direction: column; gap: 5px; margin: 0; min-width: 0; }
/* Cella di form con label.field + errore/aiuto FUORI dalla label (il nome accessibile resta
   l'etichetta): usata nelle griglie di campi, es. "Ritorno allo streaming" in NetConfigModal. */
.field-block { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-label { display: block; margin: 0; font-size: 12px; line-height: 1.2; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.field-hint { font-style: normal; font-size: 12px; line-height: 1.4; color: var(--muted); margin: 0; }
.field-warn { font-style: normal; font-size: 12px; color: var(--orange); margin: 0; }
.req { font-style: normal; color: var(--yellow); }
.form-stack { display: flex; flex-direction: column; gap: 16px; }
.fset { margin: 0; padding: 12px 14px 14px; border: 1px solid var(--border); border-radius: var(--radius); min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.fset legend { padding: 0 8px; font-family: var(--font-head); font-weight: 700; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--yellow); }
.small { font-size: 12px; }
.form-alert { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; margin: 0 0 14px; border: 1px solid rgba(251,63,63,.45); background: rgba(251,63,63,.09); border-radius: 10px; color: #ffc2c2; font-size: 13.5px; line-height: 1.4; }
.form-alert p { margin: 0; }
.form-alert ul { margin: 6px 0 0; padding-left: 18px; }
.form-alert-ico { flex: 0 0 22px; height: 22px; border-radius: 50%; background: var(--red-solid); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.notice { margin: 0; padding: 10px 12px; border-radius: 8px; font-size: 13.5px; line-height: 1.45; }
.notice-warn { border: 1px solid rgba(255,173,79,.4); background: rgba(255,173,79,.08); color: #ffd199; }
.notice-danger { border: 1px solid rgba(251,63,63,.4); background: rgba(251,63,63,.08); color: #ffb1b1; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; vertical-align: -2px; animation: ir-spin .7s linear infinite; }
@keyframes ir-spin { to { transform: rotate(360deg); } }
.link-btn { background: none; border: 0; padding: 4px 2px; min-height: 32px; color: var(--yellow); font-size: 13.5px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.link-btn:hover { color: #fff28a; }

/* Modale executive: filetto d'accento in alto, variante larga, pericolo, scossa se bloccata. */
.modal { position: relative; }
.modal::before { content: ''; flex: 0 0 3px; background: linear-gradient(90deg, var(--yellow), var(--yellow-dim)); }
.modal-danger::before { background: linear-gradient(90deg, var(--red), #a41c1c); }
.modal-lg { max-width: 820px; }
.modal[data-shake] { animation: dlg-pop .18s cubic-bezier(.2,.9,.3,1.2), dlg-shake .36s ease-in-out; }
.modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; overflow: hidden; }
.modal-close[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }

/* Testata dei pannelli admin: titolo + riepilogo a sinistra, azioni (un solo "Nuovo …") a destra. */
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.panel-head-titles { min-width: 0; }
.panel-section .panel-head h2 { margin: 0 0 4px; }
.panel-head .panel-note { margin: 0; }
.panel-head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---- Password: mostra/nascondi, robustezza, checklist ---- */
.pw-eye .slash { display: none; }
.pw-eye.on .slash, .pw-eye[aria-pressed="true"] .slash { display: inline; }
.pw-block { display: flex; flex-direction: column; gap: 10px; }
.pw-strength { display: flex; align-items: center; gap: 10px; }
.pw-meter { flex: 1 1 auto; display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.pw-meter span { height: 5px; border-radius: 3px; background: #2e2e2e; transition: background .2s ease; }
.pw-strength[data-level="1"] .pw-meter span:nth-child(-n+1) { background: var(--red); }
.pw-strength[data-level="2"] .pw-meter span:nth-child(-n+2) { background: var(--orange); }
.pw-strength[data-level="3"] .pw-meter span:nth-child(-n+3) { background: var(--yellow); }
.pw-strength[data-level="4"] .pw-meter span { background: var(--green); }
.pw-strength-label { flex: 0 0 auto; min-width: 110px; text-align: right; font-size: 12px; color: var(--muted); }
.pwc { list-style: none; margin: 0; padding: 10px 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 5px 14px; border: 1px solid var(--border); border-radius: 8px; background: #151515; font-size: 13px; line-height: 1.35; }
.pwc:empty { display: none; }
.pwc-item { display: flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; }
.pwc-ico { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%; border: 1px solid #555; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; line-height: 1; }
.pwc-item.ok { color: #cfe9d4; }
.pwc-item.ok .pwc-ico { background: var(--green); border-color: var(--green); color: #0b1f10; }
.pwc-item.bad { color: #ffb1b1; }
.pwc-item.bad .pwc-ico { border-color: var(--red); color: #ff8080; }
.pw-match { margin: 0; min-height: 18px; font-size: 12.5px; color: var(--muted); }
.pw-match.ok { color: #9fe3ae; }
.pw-match.bad { color: #ff8080; }
.otp-input { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 22px !important; letter-spacing: .45em; text-align: center; max-width: 240px; min-height: 48px; }

/* ---- Login a passi / reset ---- */
.login-step { display: flex; flex-direction: column; gap: 12px; }
.login-h { margin: 0; font-size: 18px; text-align: center; letter-spacing: .4px; }
.login-p { margin: 0; font-size: 13.5px; color: var(--muted); text-align: center; }
.login-p.notice { text-align: left; }
.login-p b { color: var(--text); }
.login-link { align-self: center; }
.login-card .otp-input { max-width: none; }
.login-card .login-step .btn-primary { margin-top: 4px; }
.login-card .err { margin-top: 0; }
.login-card .err:empty { min-height: 0; }

/* ---- Topbar: badge utente = pulsante "Il mio account" ---- */
.who-btn { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; min-height: var(--ctl-h); padding: 0 12px 0 8px; background: none; color: inherit; border: 1px solid var(--border); border-radius: 22px; transition: border-color .15s ease, background .15s ease; }
.who-btn:hover { border-color: var(--yellow); background: rgba(255,237,99,.05); }
.who-ico { flex: 0 0 26px; width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--yellow); background: rgba(255,237,99,.12); }
.who-warn { flex: 0 0 18px; width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--orange); color: #1f1300; font-weight: 700; font-size: 12px; }

/* ---- Chip piccoli di stato (tabella utenti, account) ---- */
.chip-xs { min-height: 24px; padding: 0 9px; font-size: 12.5px; }
.chip-ok { color: #bff0c9; border-color: rgba(66,198,92,.6); background: rgba(66,198,92,.12); font-weight: 600; }
.chip-off { color: var(--muted); }
.chip-warn { color: #ffd199; border-color: rgba(255,173,79,.6); background: rgba(255,173,79,.1); font-weight: 600; }
.chip-bad { color: #fff; background: var(--red-solid); border-color: var(--red-solid); font-weight: 700; }
.chip-role-admin { color: var(--yellow); border-color: rgba(255,237,99,.5); background: rgba(255,237,99,.1); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.chip-role-client { color: #8ab4ff; border-color: rgba(138,180,255,.5); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.chip-self { color: var(--yellow); border-color: rgba(255,237,99,.55); border-style: dashed; }
.chip-list { display: flex; flex-wrap: wrap; gap: 4px; }
.users-table td .chip { margin-left: 0; }
.users-table .u-email { font-weight: 600; }
.users-table .u-email-text { overflow-wrap: anywhere; margin-right: 8px; }
.users-table .u-when { white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 13px; }
.users-table .row-actions { gap: 6px; }

/* ---- Selettori nella modale utente ---- */
.seg-radio .seg-btn { display: inline-flex; align-items: center; justify-content: center; margin: 0; cursor: pointer; color: var(--muted); }
.seg-radio .seg-btn.active { color: #1a1a00; }
.seg-radio .seg-btn:has(input:focus-visible) { outline: 2px solid var(--yellow); outline-offset: -3px; }
.seg-radio .seg-btn:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 10px; }
.radio-card { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: #151515; cursor: pointer; color: var(--text); font-size: 14px; }
.radio-card input { flex: 0 0 auto; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 2px 0 0; accent-color: var(--yellow); }
.radio-card > span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.radio-card small { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.radio-card.active { border-color: var(--yellow); box-shadow: inset 3px 0 0 var(--yellow); }
.radio-card:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.sel-summary { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; font-size: 13px; }
.ctree-box { max-height: 340px; overflow: auto; overscroll-behavior: contain; padding: 8px; border: 1px solid var(--border); border-radius: 10px; background: #151515; }
.ctree-box:has(.ctree.invalid) { border-color: var(--red); }

/* ---- Albero clienti a fisarmonica ---- */
.ctree, .ctree-sub { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.ctree { gap: 8px; }
.ctree-sub { gap: 4px; margin-left: 22px; padding: 6px 3px 3px 14px; border-left: 1px solid rgba(255,237,99,.18); }
.ctree-item { position: relative; min-width: 0; }
.ctree-item:focus, .ctree-item:focus-visible { outline: none; }
.ctree-row { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 8px 6px 10px; border: 1px solid transparent; border-radius: 10px; cursor: pointer; transition: background .15s ease, border-color .15s ease; min-width: 0; }
.ctree > .ctree-item > .ctree-row { background: var(--panel-2); border-color: var(--border); }
.ctree-sub > .ctree-item > .ctree-row::before { content: ''; position: absolute; left: -15px; top: 23px; width: 13px; border-top: 1px solid rgba(255,237,99,.18); }   /* ramo orizzontale della guida */
.ctree-row:hover { background: rgba(255,255,255,.04); border-color: #444; }
.ctree-item:focus-visible > .ctree-row { outline: 2px solid var(--yellow); outline-offset: 1px; }
.ctree-item.open > .ctree-row { border-color: rgba(255,237,99,.4); }
.ctree-chev { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--yellow); background: rgba(255,237,99,.08); transition: transform .3s var(--ease), background .2s ease; }
.ctree-item.open > .ctree-row .ctree-chev { transform: rotate(90deg); background: rgba(255,237,99,.2); }
.ctree-leaf { flex: 0 0 28px; width: 28px; height: 28px; position: relative; }
.ctree-leaf::before { content: ''; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: #5a5a5a; }
.ctree-name { flex: 1 1 0; min-width: 0; font-weight: 600; font-size: 14.5px; overflow-wrap: break-word; }
.ctree > .ctree-item > .ctree-row .ctree-name { font-family: var(--font-head); font-size: 16px; letter-spacing: .2px; }
.ctree-meta { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; align-items: center; }
.ctree-chip { display: inline-flex; align-items: center; min-height: 24px; padding: 0 9px; border: 1px solid var(--border); border-radius: 20px; font-size: 12px; line-height: 1; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ctree-chip-dev { color: #8ab4ff; border-color: rgba(138,180,255,.45); }
.ctree-chip-dev.zero { color: var(--muted); border-color: var(--border); }
.ctree-chip-inc { color: var(--yellow); border-color: rgba(255,237,99,.45); }
.ctree-actions { flex: 0 0 auto; display: inline-flex; gap: 6px; }
.ctree-actions .btn-icon { width: var(--ctl-h-sm); }
/* Apertura: altezza animata 0fr -> 1fr + dissolvenza; il gruppo chiuso e' inert (vedi ClientTree.tsx). */
.ctree-group { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .32s var(--ease), opacity .22s ease; }
.ctree-group.open { grid-template-rows: 1fr; opacity: 1; }
.ctree-group > .ctree-sub { min-height: 0; overflow: hidden; transition: padding .32s var(--ease); }
.ctree-group:not(.open) > .ctree-sub { padding-top: 0; padding-bottom: 0; }   /* chiuso: altezza davvero 0 (il padding non si comprime con 0fr) */
/* Selezione multipla (modale utente) */
.ctree-select .ctree-row { min-height: 44px; }
.ctree-check { flex: 0 0 20px; width: 20px; height: 20px; border: 2px solid #6a6a6a; border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; line-height: 1; color: #111; }
.ctree-check.on { background: var(--yellow); border-color: var(--yellow); }
.ctree-check.inc { border-style: dashed; border-color: rgba(255,237,99,.6); color: var(--yellow); }
.ctree-select .ctree-item.checked > .ctree-row { background: rgba(255,237,99,.08); border-color: rgba(255,237,99,.45); }
.ctree-select > .ctree-item > .ctree-row { background: var(--panel); }
.ctree-help { margin: 14px 0 0; }

/* ---- Il mio account ---- */
.acct { display: flex; flex-direction: column; gap: 14px; }
.acct-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 18px; margin: 0; font-size: 14px; align-items: center; }
.acct-grid dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.acct-grid dd { margin: 0; overflow-wrap: anywhere; }
.acct-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.acct-card.on { border-color: rgba(66,198,92,.45); }
.acct-card-ico { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--yellow); background: rgba(255,237,99,.1); }
.acct-card-ico svg { width: 20px; height: 20px; }
.acct-card.on .acct-card-ico { color: var(--green); background: rgba(66,198,92,.14); }
.acct-card-body { min-width: 0; }
.acct-card-body h4 { margin: 0 0 2px; font-family: var(--font-head); font-size: 15px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.acct-card-body p { margin: 0; font-size: 13px; }
.steps { list-style: none; counter-reset: st; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.steps > li { counter-increment: st; position: relative; padding-left: 40px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.steps > li::before { content: counter(st); position: absolute; left: 0; top: -3px; width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--yellow); color: #111; font-family: var(--font-head); font-weight: 700; }
.steps > li > .muted { font-size: 13px; }
.qr-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 16px; align-items: start; }
.qr-box { width: 200px; height: 200px; padding: 8px; border-radius: 12px; background: #fff; display: flex; align-items: center; justify-content: center; }
.qr-box img { width: 184px; height: 184px; image-rendering: pixelated; }
.qr-box .muted { color: #555; font-size: 13px; text-align: center; }
.secret-box { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.secret { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: #151515; color: var(--yellow); font-size: 16px; letter-spacing: .08em; word-spacing: .25em; user-select: all; overflow-wrap: anywhere; }
.secret-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rcodes { list-style: none; counter-reset: rc; margin: 12px 0 0; padding: 12px 14px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 18px; border: 1px solid var(--border); border-radius: 10px; background: #151515; }
.rcodes li { counter-increment: rc; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.rcodes li::before { content: counter(rc) '.'; flex: 0 0 22px; text-align: right; color: var(--muted); font-size: 12px; }
.rcodes code { font-size: 15px; letter-spacing: .06em; color: var(--text); overflow-wrap: anywhere; }
.codes-ack { margin-top: 14px; }

@media (max-width: 640px) {
  .modal[data-shake] { animation: dlg-shake .36s ease-in-out; }
  #app-identity .who-btn { flex: 1 1 auto; justify-content: flex-start; }
  .panel-head-actions { width: 100%; }
  .panel-head-actions .btn-primary { flex: 1 1 100%; }
  /* Telefono: riga 1 = freccia + nome a tutta larghezza; riga 2 = chip a sinistra, azioni a destra. */
  .ctree-row { flex-wrap: wrap; row-gap: 6px; padding-right: 6px; }
  .ctree-name { flex: 1 1 calc(100% - 44px); }
  .ctree-select .ctree-name { flex-basis: calc(100% - 76px); }
  .ctree-meta { order: 2; flex: 1 1 auto; justify-content: flex-start; padding-left: 38px; }
  .ctree-actions { order: 3; margin-left: auto; }
  .ctree-select .ctree-meta { padding-left: 68px; }
  .ctree-sub { margin-left: 10px; padding-left: 8px; }
  .ctree-sub > .ctree-item > .ctree-row::before { left: -9px; width: 7px; }
  .qr-row { grid-template-columns: 1fr; justify-items: center; }
  .secret-box { width: 100%; }
  .acct-card { grid-template-columns: auto minmax(0, 1fr); }
  .acct-card > .btn { grid-column: 1 / -1; }
  .pw-strength-label { min-width: 0; }
}
@media (max-width: 380px) { .rcodes { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) {
  .ctree-group, .ctree-chev { transition: none !important; }
}

/* ---- Tab Configurazione (SettingsPanel.tsx): sezioni come card, form a 2 colonne ---- */
.settings-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin: 0 0 14px; }
.settings-head h2 { margin: 0 0 2px; font-size: 20px; color: var(--yellow); }
.settings-head .panel-note { margin: 0; }
.settings-upd { margin: 0; font-size: 12.5px; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 18px; align-items: start; }
.settings-grid .panel-section { margin: 0; }
.settings-card-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: start; margin-bottom: 16px; }
.settings-ico { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--yellow); background: rgba(255,237,99,.1); }
.settings-ico svg { width: 18px; height: 18px; }
.settings-card-titles h3 { margin: 0 0 2px; font-size: 16px; color: var(--text); }
.settings-card-titles p { margin: 0; font-size: 13px; }
.settings-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; align-items: start; }
.settings-form .span-2 { grid-column: 1 / -1; }
/* Sotto-titolo di un gruppo di campi dentro una card (es. "Server SMTP" / "Resend"). */
.settings-sub { grid-column: 1 / -1; margin: 6px 0 -4px; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* Avviso su piu' righe (spiegazione del provider): paragrafi senza margini di default. */
.notice-lines p { margin: 0; }
.notice-lines p + p { margin-top: 6px; }
.settings-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); }
.settings-foot-sp { flex: 1 1 auto; }
.settings-foot .btn-primary { min-width: 120px; }
.settings-eff { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.settings-link { align-self: flex-start; }
/* Scorciatoie delle porte tipiche: applicano un valore solo se l'utente le clicca. */
.port-quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.port-quick .btn { font-variant-numeric: tabular-nums; }
/* Esito dell'email di prova: fase + tempo, motivo, consiglio della fase. */
.test-res { display: block; }
.test-res p { margin: 0; }
.test-res p + p { margin-top: 6px; }
.test-res-head { font-weight: 600; }
.test-res-ms { font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.test-res-line { font-size: 13px; overflow-wrap: anywhere; }
.test-res-hint { font-size: 12.5px; line-height: 1.45; }
.set-src.src-db { color: #bff0c9; border-color: rgba(66,198,92,.6); background: rgba(66,198,92,.12); }
.set-src.src-env { color: #8ab4ff; border-color: rgba(138,180,255,.55); background: rgba(138,180,255,.08); }
.set-src.src-unset { color: var(--muted); border-style: dashed; }
.pass-set { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-height: var(--ctl-h); }
/* La riga "segreto gia' impostato": con etichette lunghe (de) i bottoni vanno a capo invece di
   schiacciare la casella, che altrimenti taglia la parola ("festgel" al posto di "hinterlegt"). */
.pass-dots { flex: 1 1 150px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 11px; min-height: var(--ctl-h); display: inline-flex; align-items: center; gap: 8px; border: 1px dashed var(--border); border-radius: var(--radius-ctl); background: #161616; letter-spacing: .12em; }
.pass-dots .muted { letter-spacing: normal; font-size: 12.5px; }
.notice-info { border: 1px solid rgba(138,180,255,.4); background: rgba(138,180,255,.07); color: #c9dcff; margin-bottom: 14px; }
.notice-ok { border: 1px solid rgba(66,198,92,.45); background: rgba(66,198,92,.1); color: #bff0c9; }
.row-inactive td { opacity: .62; }
.row-inactive td.actions, .row-inactive td.u-email { opacity: 1; }
/* Manopola: dopo la finestra ottimistica va al valore della radio UNA volta, con transizione morbida. */
.vol-knob.settle .vol-knob-face { transition: transform .42s var(--ease); }
@media (max-width: 640px) {
  .settings-form { grid-template-columns: 1fr; }
  .settings-card-head { grid-template-columns: auto minmax(0, 1fr); }
  .settings-card-head .set-src { grid-column: 2; justify-self: start; }
  .settings-foot .btn { flex: 1 1 auto; }
  .settings-foot-sp { display: none; }
}
.users-table .u-email-wrap { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; min-width: 0; }
.users-table .u-email-text { margin-right: 0; }

/* ============ 11) DISPLAY LCD "NOW PLAYING" DELLA CARD (2026-09-24) ============
   Componente: web/src/components/NowPlayingLcd.tsx. Primo elemento del corpo della card:
   stazione + traccia in riproduzione, spie SD / STREAMING, stato, bitrate, formato, server.
   Estetica vetro (glassmorphism "bubble"): riflesso in alto, alone giallo, griglia di pixel,
   testo a spaziatura fissa. REGOLE rispettate: il fondo e' scuro e di opacita' NOTA (il genitore
   .card e' un colore pieno), quindi il contrasto del testo e' calcolabile e resta AA; lo stato non
   e' mai veicolato dal solo colore (led pieno/vuoto + testo + nome accessibile); lo scorrimento
   del testo (marquee) parte solo quando il testo non entra ed e' fermato dalla regola globale
   prefers-reduced-motion della sezione 9; nessuno scroll orizzontale a 360 px.
   Il file viene COPIATO in emulator/renderer/style.css e configurator/renderer/style.css. */
.lcd {
  --lcd-mono: ui-monospace, 'SF Mono', Menlo, Consolas, 'Cascadia Mono', 'DejaVu Sans Mono', monospace;
  position: relative; isolation: isolate; overflow: hidden; min-width: 0;
  display: grid; gap: 8px; padding: 11px 13px; border-radius: 16px;
  background-color: rgba(8, 9, 6, .86);
  background-image:
    radial-gradient(120% 130% at 10% -20%, rgba(255, 237, 99, .10), transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .012) 42%, rgba(0, 0, 0, .34));
  border: 1px solid rgba(255, 237, 99, .20);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .08) inset, 0 -22px 34px -26px rgba(255, 237, 99, .45) inset, 0 10px 26px -16px rgba(0, 0, 0, .9);
  backdrop-filter: blur(10px) saturate(1.15);
  -webkit-backdrop-filter: blur(10px) saturate(1.15);
}
/* Bolla di luce del vetro e griglia di pixel: decorative, SOTTO il testo (z-index negativo nel
   contesto isolato della .lcd), quindi non abbassano il contrasto di nessuna riga. */
.lcd::before {
  content: ''; position: absolute; z-index: -1; inset: -45% -12% auto -12%; height: 85%; pointer-events: none;
  background: radial-gradient(58% 100% at 28% 0%, rgba(255, 255, 255, .16), transparent 72%);
}
.lcd::after {
  content: ''; position: absolute; z-index: -1; inset: 0; pointer-events: none; opacity: .30;
  background-image: repeating-linear-gradient(0deg, rgba(0, 0, 0, .45) 0 1px, transparent 1px 3px);
}

/* ---- Testata: spie di sorgente a sinistra, stato a destra ---- */
.lcd-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.lcd-lamps { display: inline-flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.lcd-lamp {
  display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 9px 0 7px;
  border: 1px solid rgba(255, 255, 255, .12); border-radius: 999px; background: rgba(255, 255, 255, .03);
  font-family: var(--lcd-mono); font-size: 11px; line-height: 1; letter-spacing: .10em; text-transform: uppercase;
  color: #9aa08f; white-space: nowrap;   /* spia spenta: 5.4:1 sul fondo piu' chiaro del vetro (AA) */
}
.lcd-lamp svg { width: 13px; height: 13px; flex: 0 0 13px; }
.lcd-led { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 50%; border: 1.5px solid currentColor; background: transparent; }
/* Spia ACCESA: led pieno + alone + testo in grassetto giallo (forma e peso, non solo colore). */
.lcd-lamp.on {
  color: var(--yellow); font-weight: 700; border-color: rgba(255, 237, 99, .55); background: rgba(255, 237, 99, .11);
  box-shadow: 0 0 13px -3px rgba(255, 237, 99, .5); text-shadow: 0 0 10px rgba(255, 237, 99, .45);
}
.lcd-lamp.on .lcd-led { background: currentColor; box-shadow: 0 0 8px 1px rgba(255, 237, 99, .75); }

.lcd-state {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 999px; background: rgba(255, 255, 255, .03);
  font-family: var(--lcd-mono); font-size: 11px; line-height: 1; letter-spacing: .09em; text-transform: uppercase;
  font-weight: 700; color: var(--muted); white-space: nowrap;
}
.lcd-state.s-play { color: #8ef0a6; border-color: rgba(66, 198, 92, .5); background: rgba(66, 198, 92, .12); }
.lcd-state.s-paused { color: #ffd08a; border-color: rgba(255, 173, 79, .55); background: rgba(255, 173, 79, .13); }
.lcd-state.s-off { color: #ffb3b3; border-color: rgba(251, 63, 63, .5); background: rgba(251, 63, 63, .12); }
/* Stati di `playState` (2026-10-06). «In attesa di audio» / «Riavvio» NON sono «Ferma»: colore
   freddo proprio, distinto dal verde di «in riproduzione» e dall'ambra della pausa. «Stato non
   noto» e «Ferma» restano attenuati (var(--muted), 4.9:1 sul fondo del display: AA). Lo stato e'
   SEMPRE scritto a parole accanto al glifo, quindi nessuno di questi e' dato dal solo colore. */
.lcd-state.s-waiting { color: #a8d4ff; border-color: rgba(120, 180, 255, .5); background: rgba(120, 180, 255, .12); }
.lcd-state.s-restarting { color: #a8d4ff; border-color: rgba(120, 180, 255, .5); background: rgba(120, 180, 255, .12); }
.lcd-state.s-unknown { color: #c9ccbe; border-color: rgba(255, 255, 255, .22); background: rgba(255, 255, 255, .05); }
/* I tre punti dell'attesa pulsano piano (la regola globale prefers-reduced-motion li ferma, e il
   testo «In attesa di audio» resta comunque). */
.lcd-state.s-waiting .lcd-sico { animation: lcd-wait 1.4s ease-in-out infinite alternate; }
@keyframes lcd-wait { from { opacity: .45; } to { opacity: 1; } }
.lcd-sico { font-size: 10px; line-height: 1; letter-spacing: .06em; }
/* Equalizzatore: tre barre con altezze DIVERSE anche da ferme, cosi' resta leggibile quando
   l'animazione e' disattivata (prefers-reduced-motion, sezione 9). */
.lcd-eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.lcd-eq span { width: 3px; height: 4px; border-radius: 1px; background: currentColor; transform-origin: bottom; animation: lcd-eq .9s ease-in-out infinite alternate; }
.lcd-eq span:nth-child(2) { height: 10px; animation-delay: .3s; }
.lcd-eq span:nth-child(3) { height: 6px; animation-delay: .6s; }
@keyframes lcd-eq { from { transform: scaleY(.38); } to { transform: scaleY(1); } }

/* ---- Righe del display ---- */
.lcd-rows { display: grid; gap: 4px; min-width: 0; }
.lcd-row { display: grid; grid-template-columns: 72px minmax(0, 1fr); align-items: baseline; gap: 4px 8px; min-width: 0; }
.lcd-label { font-family: var(--lcd-mono); font-size: 10.5px; line-height: 1.5; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.lcd-station { font-family: var(--lcd-mono); font-size: 16px; font-weight: 700; color: var(--yellow); text-shadow: 0 0 14px rgba(255, 237, 99, .32); }
.lcd-track { font-family: var(--lcd-mono); font-size: 13.5px; color: #eef0e8; }
/* Dato non disponibile: testo esplicito, corsivo, font di testo (non LCD) e MAI un display vuoto. */
.lcd-empty { font-family: var(--font); font-style: italic; font-weight: 400; font-size: 13.5px; color: #bcbfb2; text-shadow: none; letter-spacing: 0; overflow-wrap: break-word; }

/* ---- Scorrimento del testo troppo lungo ---- */
.lcd-mq { display: block; min-width: 0; overflow: hidden; white-space: nowrap; }
.lcd-mq.scroll { -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 15px), transparent); mask-image: linear-gradient(90deg, #000 calc(100% - 15px), transparent); }
.lcd-mq-in { display: inline-block; white-space: nowrap; }
.lcd-mq.scroll .lcd-mq-in { animation: lcd-mq var(--mq-dur, 14s) ease-in-out infinite alternate; }
@keyframes lcd-mq {
  0%, 9% { transform: translateX(0); }
  91%, 100% { transform: translateX(calc(-1 * var(--mq-shift, 0px))); }
}

/* ---- Piede: bitrate, formato, server, spiegazioni ---- */
.lcd-foot { display: flex; align-items: center; flex-wrap: wrap; gap: 5px 8px; min-width: 0; padding-top: 7px; border-top: 1px solid rgba(255, 255, 255, .08); }
.lcd-tag { font-family: var(--lcd-mono); font-size: 11px; line-height: 1.5; color: #d7d9cd; border: 1px solid rgba(255, 255, 255, .15); border-radius: 6px; padding: 1px 7px; background: rgba(255, 255, 255, .04); white-space: nowrap; }
.lcd-host { font-family: var(--lcd-mono); font-size: 11px; color: var(--muted); min-width: 0; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Spiegazione sulla STAZIONE (titolo non pubblicato / in attesa / metadati spenti) oppure nota
   offline: riga intera. Con `meta` assente il display tace e questa riga non esiste. (2026-09-25:
   la riga tecnica secondaria per soli admin e' stata rimossa insieme alle sue stringhe.) */
.lcd-why { flex: 1 1 100%; font-size: 12px; line-height: 1.35; color: var(--muted); overflow-wrap: break-word; }

/* ---- Silenzio DICHIARATO (`noSource`, fw >= 3.20.0): rete giu' E scheda inutilizzabile ----
   Deve distinguersi dalla radio OFFLINE (st-off): la radio c'e' e risponde, semplicemente non ha
   nulla da suonare. Ambra/rosso caldo + parole proprie + riga che dice il perche'. */
.lcd-state.s-silence { color: #ffc27a; border-color: rgba(255,150,60,.6); background: rgba(255,150,60,.15); }
.lcd.st-silence { border-color: rgba(255,150,60,.34); }
.lcd.st-silence .lcd-station { color: #f0dfc2; text-shadow: none; }

/* ---- Radio offline: niente giallo acceso, cosi' non somiglia a "sta suonando in silenzio" ---- */
.lcd.st-off { border-color: rgba(251, 63, 63, .26); background-color: rgba(6, 6, 6, .9); }
.lcd.st-off .lcd-station { color: #d2d3ca; text-shadow: none; }
.lcd.st-off::before { opacity: .4; }

@media (max-width: 640px) {
  .lcd { padding: 10px 11px; border-radius: 14px; }
  .lcd-row { grid-template-columns: 62px minmax(0, 1fr); }
  .lcd-station { font-size: 15px; }
  .lcd-track, .lcd-empty { font-size: 13px; }
}
/* Telefoni stretti (fino a 400 px): etichetta sopra il valore, altrimenti al valore resta troppo poco. */
@media (max-width: 400px) {
  .lcd-row { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lcd-state { margin-left: 0; }
}
@media (forced-colors: active) {
  .lcd, .lcd-lamp, .lcd-state, .lcd-tag { border: 1px solid CanvasText; }
  .lcd::after, .lcd::before { display: none; }
}

/* ============ 12) SCHEDA SD: SEZIONE DI DIAGNOSI DEL PANNELLO LATERALE (2026-09-25) ============
   Componente: web/src/components/DeviceCard.tsx -> SdSection (+ chip .chip-sd in testata, sopra).
   La sezione e' visibile a TUTTI i ruoli (lo stato della scheda e' un'informazione del negozio);
   i bottoni di sblocco e formattazione esistono solo per gli amministratori e il hub rifiuta
   comunque `sdreset`/`sdformat` a chiunque non lo sia.
   Il file viene COPIATO in emulator/renderer/style.css e configurator/renderer/style.css. */
.sd-state-cell { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
/* Dato che la radio NON conosce piu' (il firmware azzera i numeri quando la scheda non e' `ok`):
   si scrive a parole, in corsivo e attenuato, come per il display LCD. Mai uno 0 travestito da
   misura — e' la stessa classe di difetto che e' costata tre sessioni di banco al firmware. */
/* Il valore non si spezza fra numero e unita' (in tedesco la colonna e' stretta: "30250" andava a
   capo separato da "MB"); l'etichetta "ultimo dato noto" va a capo per conto suo. */
.sd-val { white-space: nowrap; }
.sd-unknown { font-style: italic; color: var(--muted); }
.sd-last { margin-left: 5px; font-size: 11px; color: var(--muted); white-space: nowrap; }
/* Guasto appiccicoso: lucchetto + parola, cosi' si capisce che serve un'azione umana (sblocco o
   formattazione) e non basta aspettare. */
.sd-lock {
  display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #ffd08a;
  border: 1px solid rgba(255,173,79,.55); border-radius: 999px; padding: 1px 8px; background: rgba(255,173,79,.12);
}
/* Due azioni affiancate (sblocca / formatta) dentro una sezione del pannello. */
.side-sec .side-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (forced-colors: active) {
  .chip-sd, .sd-lock, .chip-hw { border: 1px solid CanvasText; }
}

/* ============ 13) LIBRERIA STAZIONI (tab admin, StationLibraryPanel) ============
   Un URL di stream puo' arrivare a 300 caratteri: senza queste regole la colonna allargava la
   tabella e `.table-wrap` finiva per scorrere in orizzontale gia' a 820 px. L'URL va a capo
   dentro la sua cella (su mobile ci pensa gia' `.rtable td { overflow-wrap: anywhere }`). */
/* Solo dove la tabella E' una tabella: sotto i 721 px ogni riga diventa una scheda e un tetto in
   ch sulla cella strozzerebbe il valore dentro la scheda (visto negli screenshot a 390 px: il nome
   andava a capo in una colonnina mentre l'URL accanto occupava tutta la larghezza). */
@media (min-width: 721px) {
  .stlib-tbl td.c-url { max-width: 60ch; }
  /* Il nome non si prende la larghezza che serve all'URL: a 820 px l'URL andava su 3 righe mentre
     accanto restavano 200 px vuoti. */
  .stlib-tbl td:first-child { max-width: 26ch; }
}
/* La data non si spezza mai fra giorno e ora (ne' in tabella ne' in scheda). */
.stlib-tbl td.c-date { white-space: nowrap; }
.stlib-url { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; font-size: 12.5px; color: var(--muted); overflow-wrap: anywhere; word-break: break-word; }
/* `.panel-note` nasce sotto un <h2> (margine superiore negativo): qui la nota sta IN FONDO. */
.stlib-note { margin: 14px 0 0; }
/* Campo URL in monospazio: un http:// si rilegge meglio. NESSUN font-size qui: su telefono deve
   vincere la regola globale a 16 px (`@media (pointer: coarse)`), o iOS fa lo zoom sul campo. */
.stlib-urlin { font-family: ui-monospace, 'Cascadia Mono', Consolas, monospace; }

/* ============ 13) LIBRERIA AUDIO: ZONA DI TRASCINAMENTO E GRUPPI (2026-10-06) ============
   Componenti: web/src/components/LibraryPanel.tsx e AudioGroupModal.tsx.
   Selettori aggiunti qui: .lib-upload .dropzone .dropzone.over .dz-ico .dz-tx .dz-sub
   .lib-queue .lib-rejects .lib-rejects-head .lib-empty .agrp-filters .agrp-list .agrp-card
   .agrp-top .agrp-name .agrp-files .agrp-clients .chip-more .agrp-picklist .agrp-pick
   .agrp-pick.on .agrp-pick-name .agrp-pick-size
   (lo stesso foglio e' copiato nell'emulatore e nel configuratore: ricopiarlo dopo questa modifica). */
.lib-upload { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
.lib-upload .form-inline { flex: 1 1 320px; min-width: 0; }
/* La zona e' un PULSANTE: si raggiunge con Tab e apre il dialogo di sistema (il trascinamento da
   tastiera non esiste). Lo stato "file sopra" non e' dato dal solo colore: cambiano il testo, il
   bordo (tratteggiato -> pieno) e il glifo. */
.dropzone {
  flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; min-height: 96px; padding: 14px 16px; text-align: center; cursor: pointer;
  color: var(--muted); background: rgba(255, 255, 255, .02);
  border: 2px dashed var(--border); border-radius: 14px;
  font: inherit; transition: border-color .15s ease, background-color .15s ease;
}
.dropzone:hover { border-color: var(--yellow); color: var(--fg); }
.dropzone.over { border-style: solid; border-color: var(--yellow); background: rgba(255, 237, 99, .09); color: var(--fg); }
.dropzone.over .dz-ico { transform: translateY(2px); }
.dz-ico { font-size: 20px; line-height: 1; color: var(--yellow); }
.dz-tx { font-size: 14px; font-weight: 600; color: var(--fg); }
.dz-sub { font-size: 12px; line-height: 1.35; max-width: 42ch; }
/* Su un dispositivo a puntamento grosso il trascinamento di file non esiste: la zona
   sparirebbe come spazio sprecato, e il selettore classico resta. */
@media (pointer: coarse), (max-width: 560px) { .dropzone { display: none; } }

.lib-queue { display: grid; gap: 6px; margin-top: 12px; }
.lib-rejects { margin-top: 12px; padding: 10px 12px; border: 1px solid rgba(251, 63, 63, .45); border-radius: 10px; background: rgba(251, 63, 63, .08); }
.lib-rejects-head { margin: 0 0 6px; font-size: 13px; font-weight: 600; color: #ffb3b3; }
.lib-rejects ul { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; color: var(--fg); }
.lib-empty { padding: 8px 2px; }

/* ---- Gruppi ---- */
.agrp-filters { margin: 0 0 14px; }
.agrp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.agrp-card { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: rgba(255, 255, 255, .02); min-width: 0; }
.agrp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.agrp-name { margin: 0; font-size: 16px; color: var(--yellow); overflow-wrap: break-word; min-width: 0; }
.agrp-files { margin: 6px 0 8px; font-size: 12.5px; color: var(--muted); }
.agrp-clients { gap: 5px; }
/* "+N altri" / "Mostra meno": e' un BOTTONE con aria-expanded, non un tooltip — i badge compressi
   devono restare raggiungibili da tastiera. */
.chip-more { cursor: pointer; border: 1px dashed var(--border); background: transparent; color: var(--fg); font: inherit; }
.chip-more:hover { border-color: var(--yellow); color: var(--yellow); }

/* ---- Scelta dei brani nel modale del gruppo ---- */
.agrp-picklist { max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; padding: 4px; display: grid; gap: 2px; }
.agrp-pick { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; min-height: var(--ctl-h); padding: 0 8px; border-radius: 8px; cursor: pointer; }
.agrp-pick:hover { background: rgba(255, 255, 255, .04); }
.agrp-pick.on { background: rgba(255, 237, 99, .10); }
.agrp-pick-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.agrp-pick-size { font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  .lib-upload { gap: 10px; }
  .agrp-picklist { max-height: 220px; }
}
@media (forced-colors: active) {
  .dropzone, .agrp-card, .agrp-picklist, .chip-more { border: 1px solid CanvasText; }
}

/* ============ 14) INVIO DI UN GRUPPO ALLA SD DELLA RADIO (GroupPushModal, 2026-10-06) ============
   Selettori aggiunti:
   .gp-intro .gp-sd .gp-sd.bad .gp-groups .gp-group .gp-group.on .gp-g-name .gp-g-meta
   .gp-plan .gp-plan-line .gp-fits .gp-offline .gp-run .gp-live .gp-why .gp-keeps
   .gp-list .gp-row .gp-row.st-sending .gp-row.st-ok .gp-row.st-failed .gp-row.st-skipped
   .gp-ico .gp-name .gp-size .gp-st .gp-reason .gp-card-note
   (lo stesso foglio e' copiato nell'emulatore e nel configuratore: ricopiarlo dopo questa modifica).

   ⚠️ LO STATO DI UNA RIGA NON E' MAI DATO DAL SOLO COLORE: l'icona (.gp-ico) e la parola (.gp-st)
   ci sono sempre, il colore e' il terzo segnale. A 520 px la riga si impila (container query) e il
   motivo va a capo sotto il nome, invece di stringere il nome del brano a due caratteri. */
/* Finestra BLOCCATA (MODAL-POPUPS.md §4): la X non chiude e la finestra "scuote". Senza questo la
   X aveva l'aria di funzionare, e un pulsante che sembra attivo e non fa niente e' peggio di un
   pulsante spento. Vale per ogni modale `locked`, non solo per questa. */
.modal-close[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.gp-intro { margin: 0 0 12px; }
.gp-sd { display: flex; gap: 8px; align-items: baseline; margin: 0 0 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: rgba(255, 255, 255, .02); font-size: 13px; line-height: 1.45; }
.gp-sd > span:first-child { color: var(--muted); }
.gp-sd.bad { border-color: rgba(255, 173, 79, .45); background: rgba(255, 173, 79, .08); color: #ffd199; }
.gp-sd.bad > span:first-child { color: var(--orange); font-weight: 700; }
.gp-groups { display: grid; gap: 4px; max-height: 240px; overflow: auto; overscroll-behavior: contain; padding: 4px; border: 1px solid var(--border); border-radius: 10px; }
.gp-group { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 10px; min-height: var(--ctl-h); padding: 6px 8px; border-radius: 8px; cursor: pointer; }
/* Il bottone radio eredita altrimenti la regola globale dei campi (min-height 40 px, larghezza
   piena): diventava un disco enorme al centro della riga, con il nome del gruppo spinto sotto.
   E' lo stesso rimedio di .radio-card input e .check input. */
.gp-group input[type="radio"] { flex: 0 0 auto; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; accent-color: var(--yellow); }
.gp-group .chip { grid-column: 2 / -1; justify-self: start; }
.gp-group:hover { background: rgba(255, 255, 255, .04); }
.gp-group.on { background: rgba(255, 237, 99, .10); }
.gp-group:focus-within { outline: 2px solid var(--yellow); outline-offset: -2px; }
.gp-g-name { flex: 1 1 160px; min-width: 0; font-size: 13.5px; overflow-wrap: anywhere; }
.gp-g-meta { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gp-plan { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.gp-plan-line { margin: 0 0 8px; font-size: 13.5px; line-height: 1.45; }
.gp-fits { margin: 0 0 10px; font-size: 12.5px; }
.gp-offline { margin: 12px 0 0; padding: 8px 10px; border: 1px solid rgba(255, 173, 79, .45); background: rgba(255, 173, 79, .08); border-radius: 8px; color: #ffd199; font-size: 13px; }
.gp-run { display: flex; flex-direction: column; gap: 10px; }
.gp-live { margin: 0; font-family: var(--font-head); font-size: 16px; letter-spacing: .02em; color: var(--yellow); overflow-wrap: anywhere; }
.gp-why { margin: 0; font-size: 13px; color: #ffc2c2; }
.gp-keeps { margin: 0; font-size: 12.5px; line-height: 1.45; }
.gp-list { list-style: none; margin: 0; padding: 4px; display: grid; gap: 2px; max-height: 300px; overflow: auto; overscroll-behavior: contain; border: 1px solid var(--border); border-radius: 10px; container-type: inline-size; }
.gp-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: baseline; gap: 4px 10px; padding: 6px 8px; border-radius: 8px; font-size: 13px; }
.gp-row + .gp-row { border-top: 1px solid rgba(255, 255, 255, .06); }
.gp-ico { width: 1em; text-align: center; color: var(--muted); }
.gp-name { min-width: 0; overflow-wrap: anywhere; }
.gp-size { font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.gp-st { font-size: 12px; color: var(--muted); white-space: nowrap; text-transform: lowercase; }
.gp-reason { grid-column: 2 / -1; font-size: 12px; color: #ffc2c2; line-height: 1.4; }
.gp-row.st-sending { background: rgba(255, 237, 99, .10); }
.gp-row.st-sending .gp-ico, .gp-row.st-sending .gp-st { color: var(--yellow); }
.gp-row.st-ok .gp-ico, .gp-row.st-ok .gp-st { color: var(--green); }
.gp-row.st-failed { background: rgba(251, 63, 63, .08); }
.gp-row.st-failed .gp-ico, .gp-row.st-failed .gp-st { color: #ff8080; }
.gp-row.st-skipped .gp-name { color: var(--muted); }
/* Nota sulla card quando la modale e' chiusa: il trasferimento continua, e si vede. */
.gp-card-note { margin: 6px 0 0; font-size: 12.5px; color: var(--yellow-dim); overflow-wrap: anywhere; }
@container (max-width: 520px) {
  .gp-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .gp-row .gp-st { grid-column: 2 / -1; white-space: normal; }
}
@media (max-width: 640px) {
  .gp-groups { max-height: 200px; }
  .gp-list { max-height: 240px; }
}
@media (forced-colors: active) {
  .gp-sd, .gp-groups, .gp-list, .gp-offline { border: 1px solid CanvasText; }
}
