:root {
  /* Palette e font presi dal CSS della dashboard Arduino (shared/device-ui/styles.css) */
  /* 1.31.2 (tema chiaro/scuro, PARTI-TEMA): le variabili di EK Smart sono i token comuni --ekt-* di EK Shared (ek-theme.css);
     nello scuro i valori sono quelli di sempre, il secondo valore e' il ripiego se ek-theme.css non arriva. */
  --bg: var(--ekt-inner, #0d1527);            /* campi e fondi interni */
  --bg-elevated: var(--ekt-card, rgba(19, 29, 52, 0.92));
  --bg-card: var(--ekt-card, rgba(19, 29, 52, 0.92));
  --border: var(--ekt-border, rgba(255, 255, 255, 0.08));
  --border-hover: var(--ekt-border-hover, rgba(255, 255, 255, 0.16));
  --text: var(--ekt-text, #f8fafc);
  --text-dim: var(--ekt-dim, #94a3b8);
  --accent: var(--ekt-accent, #38bdf8);
  --accent-dim: var(--ekt-accent-dim, #0284c7);
  --accent-glow: var(--ekt-glow, rgba(56, 189, 248, 0.22));
  --ok: var(--ekt-ok, #10b981);
  --warn: var(--ekt-warn, #f59e0b);
  --danger: var(--ekt-danger, #ef4444);
  /* 1.31.2: rosso pieno sotto il testo bianco (contatore degli avvisi, «Elimina»): #ef4444 col bianco fa 3,76:1, #dc2626 4,8:1 */
  --danger-pieno: #dc2626;
  --on-accent: var(--ekt-on-accent, #041226);
  --page: #090e1a;
  --danger-tx: #f87171;                    /* testo rosso scritto dal codice (diagnostica) */
  --danger-bg: rgba(239, 68, 68, 0.15);    /* fondo rosso tenue scritto dal codice (consegne non riuscite) */
  --radius: 18px;
  --font-display: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* Senza questa regola l'attributo "hidden" viene ignorato su qualunque
   elemento a cui diamo anche un "display" via classe (es. .session-info,
   .nav, .login-btn sono tutti "display: flex"): la regola più specifica
   della nostra classe vince su quella (debole) del browser per [hidden],
   e l'elemento resta visibile anche quando JS lo marca come nascosto. */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--page);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .btn, .login-btn, .brand { font-family: var(--font-display); }

.topbar {
  display: flex;
  align-items: center;
  padding: 0.9rem 1.5rem;
  background: var(--bg-elevated);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 1rem;
}

/* Le tre zone dell'header: logo a sinistra, menu centrato, login/sessione a destra */
.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex: 0 0 auto;
}
.topbar-center {
  flex: 1 1 auto;
  display: flex;
  justify-content: center;
  min-width: 0;
}

.brand { font-size: 1.2rem; font-weight: 800; letter-spacing: 0.01em; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }
/* Il logo si adatta al contesto: intestazione, piede, anteprima; e allo schermo (telefono). */
.brand-logo { display: block; width: auto; height: auto; object-fit: contain; }
.topbar .brand-logo { height: 32.4px; max-width: min(216px, 48vw); }
.home-footer .brand-logo { height: 27px; max-width: min(162px, 60vw); }
.logo-prev { display: flex; align-items: center; min-height: 56px; padding: .6rem .9rem; margin: .5rem 0 .8rem; border: 1px dashed var(--border-hover); border-radius: 10px; }
.logo-prev .brand-logo { height: 50.4px; max-width: min(252px, 100%); }
@media (max-width: 600px) {
  .topbar .brand-logo { height: 25.2px; max-width: 46vw; }
  .home-footer .brand-logo { height: 23.4px; }
}

.login-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}
.login-btn:hover { border-color: var(--accent); color: var(--accent); }

.session-info { display: flex; align-items: center; gap: 0.8rem; color: var(--text-dim); font-size: 0.9rem; }

.nav {
  display: flex;
  gap: 0.3rem;
}

.nav a {
  padding: 0.7rem 0.9rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  border-bottom: 2px solid transparent;
}
.nav a.active, .nav a:hover { color: var(--text); border-bottom-color: var(--accent); }

.app { max-width: var(--ekt-col, 1360px); margin: 0 auto; padding: 1.8rem 1.5rem 4rem; }

h1 { font-size: 1.4rem; margin: 0 0 0.3rem; }
h2 { font-size: 1.1rem; margin: 1.6rem 0 0.8rem; color: var(--text); }
.subtitle { color: var(--text-dim); margin: 0 0 1.5rem; font-size: 0.92rem; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  margin-bottom: 1rem;
  box-shadow: var(--ekt-card-shadow, 0 12px 36px -8px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03));
}

.card-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

.device-card { cursor: pointer; transition: border-color 0.15s; }
.device-card:hover { border-color: var(--accent-dim); }
.device-title { font-weight: 600; font-size: 1.02rem; }
.device-sub { color: var(--text-dim); font-size: 0.85rem; margin-top: 0.15rem; }

.badge {
  white-space: nowrap; /* 1.30.3: i distintivi stanno sempre su una riga */
  display: inline-block;
  padding: 0.18rem 0.55rem;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-online { background: rgba(16,185,129,0.15); color: var(--ok); }
.badge-offline { background: rgba(147,163,168,0.15); color: var(--text-dim); }
.badge-read_write { background: rgba(16,185,129,0.15); color: var(--ok); }
.badge-read { background: rgba(245,158,11,0.15); color: var(--warn); }
.badge-pending { background: rgba(245,158,11,0.15); color: var(--warn); }

form { display: flex; flex-direction: column; gap: 0.7rem; }
label { font-size: 0.85rem; color: var(--text-dim); display: flex; flex-direction: column; gap: 0.3rem; }
input, select {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: 10px;
  font-size: 0.92rem;
  font-family: inherit;
  transition: all 0.2s ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
textarea {
  background: var(--bg); border: 1px solid var(--border); color: var(--text);
  padding: 0.5rem 0.75rem; border-radius: 10px; font-size: 0.92rem; font-family: inherit;
}

/* Chrome (e altri Webkit/Blink) forzano uno sfondo bianco sui campi
   compilati con l'autocompletamento salvato, ignorando il nostro tema
   scuro: sembra un blocco/crash ma è solo questo stile forzato dal
   browser. "-webkit-text-fill-color" + un'ombra interna enorme dello
   stesso colore dello sfondo sono l'unico modo per sovrascriverlo (il
   semplice "background" su questa pseudo-classe viene ignorato da Chrome). */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0px 1000px var(--bg) inset;
  box-shadow: 0 0 0px 1000px var(--bg) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-in-out 0s; /* evita il flash bianco prima che lo shadow venga applicato */
}

.btn {
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  padding: 0.55rem 1rem;
  border-radius: 11px;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-glow);
  transition: all 0.2s ease;
}
.btn:hover { opacity: 0.94; transform: translateY(-1px); }
.btn-ghost { background: transparent; border: 1px solid var(--border); color: var(--text); box-shadow: none; }
.btn-ghost:hover { border-color: var(--accent); background: transparent; opacity: 1; }
.btn-small { padding: 0.35rem 0.7rem; font-size: 0.8rem; }
.btn-danger { background: var(--danger-pieno); color: #fff; box-shadow: 0 4px 14px rgba(239,68,68,0.22); }

.error-msg { color: var(--danger); font-size: 0.85rem; min-height: 1.1em; }

.param-group { margin-bottom: 1.2rem; }
.param-group h3 { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin: 0 0 0.5rem; }
.param-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}
.param-row:last-child { border-bottom: none; }
.param-label { font-size: 0.92rem; }
.param-meta { color: var(--text-dim); font-size: 0.78rem; }

table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th, td { text-align: left; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--border); }
th { color: var(--text-dim); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
td.mono { font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; color: var(--text-dim); }

/* 1.17.0: secondo menu e briciole del tema comune: lo spazio sopra lo da' il sito (16 px) */
.app:has(> .ek-pagebar) { padding-top: 16px; }

.empty-state { color: var(--text-dim); font-size: 0.9rem; padding: 1.2rem 0; }

.toast {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-elevated);
  border: 1px solid var(--accent-dim);
  color: var(--text);
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.toast.err { border-color: var(--danger); }

.note {
  font-size: 0.8rem;
  color: var(--text-dim);
  background: rgba(56,189,248,0.08);
  border: 1px solid rgba(56,189,248,0.22);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1rem;
}

.link-box {
  font-family: ui-monospace, Menlo, monospace;
  font-size: 0.8rem;
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 0.5rem 0.7rem;
  border-radius: 6px;
  word-break: break-all;
  color: var(--accent);
}

.auth-switch { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.8rem; }
.auth-switch a { color: var(--accent); cursor: pointer; }
.auth-shell { max-width: 440px; margin: 3rem auto 0; }

.auth-register-row {
  margin-top: 1.4rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.auth-register-row .btn-outline { width: 100%; text-align: center; }

/* =================================================================
   Sito pubblico (homepage prima del login)
   ================================================================= */

.home-subnav {
  display: flex;
  gap: 1.6rem;
  overflow-x: auto;
}
.home-subnav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  white-space: nowrap;
}
.home-subnav a:hover { color: var(--accent); }

.home-hero {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 4rem;
  align-items: center;
  max-width: 1360px;
  margin: 0 auto;
  padding: 5.5rem 2.5rem 6rem;
}
.home-hero h1 {
  font-size: 3.1rem;
  line-height: 1.1;
  font-weight: 600;
  margin: 0 0 1.2rem;
  letter-spacing: -0.015em;
}
.home-hero .lead {
  font-size: 1.08rem;
  color: var(--text-dim);
  line-height: 1.55;
  max-width: 34rem;
  margin: 0 0 2.2rem;
}
.btn-outline {
  display: inline-block;
  background: transparent;
  border: 1px solid var(--accent-dim);
  color: var(--accent);
  padding: 0.65rem 1.25rem;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  font-family: var(--font-display);
  text-decoration: none;
}
.btn-outline:hover { background: rgba(56,189,248,0.1); }

/* Schema cisterna: il "disegno" caratteristico del prodotto nell'hero */
.tank-schema { width: 100%; max-width: 360px; margin: 0 auto; display: block; }
.tank-reading {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 600;
}
.tank-reading-label { font-size: 0.72rem; color: var(--text-dim); letter-spacing: 0.02em; }

/* Ogni sezione è a tutta larghezza (sfondo alternato per dare ritmo alla
   pagina su schermi larghi, invece di un contenuto stretto che galleggia
   in mezzo al nero), con il contenuto vero centrato dentro a .home-section-inner. */
.home-section { border-top: 1px solid var(--border); }
.home-section:nth-of-type(odd) { background: rgba(19, 29, 52, 0.55); }
.home-section:first-of-type { border-top: none; }
.home-section-inner { max-width: 1360px; margin: 0 auto; padding: 4.5rem 2.5rem; }
.home-section-head { max-width: 42rem; margin-bottom: 2.4rem; }
.home-section h2 { font-size: 1.7rem; margin: 0 0 0.6rem; font-weight: 600; }
.home-section-head p { color: var(--text-dim); font-size: 1rem; line-height: 1.55; margin: 0; }

.home-about-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 3rem; }
.home-about-grid p { color: var(--text-dim); line-height: 1.65; font-size: 0.97rem; }
.about-facts { display: flex; flex-direction: column; gap: 1.4rem; }
.about-fact-value { font-family: var(--font-display); font-size: 1.9rem; font-weight: 600; color: var(--accent); }
.about-fact-label { font-size: 0.85rem; color: var(--text-dim); margin-top: 0.15rem; }

.home-product { display: grid; grid-template-columns: 1fr 1.15fr; gap: 3rem; align-items: start; }
.home-product .tank-schema { max-width: 280px; margin: 0; }
.product-name { font-family: var(--font-display); font-size: 1.3rem; font-weight: 600; margin: 0 0 0.5rem; }
.product-desc { color: var(--text-dim); line-height: 1.6; font-size: 0.96rem; margin: 0 0 1.6rem; }
.spec-table { font-size: 0.9rem; }
.spec-table td:first-child { color: var(--text-dim); width: 40%; }

.manual-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.manual-icon { color: var(--accent); flex-shrink: 0; }
.manual-info { flex: 1; }
.manual-title { font-weight: 600; font-size: 0.98rem; }
.manual-meta { color: var(--text-dim); font-size: 0.82rem; margin-top: 0.15rem; }
.manual-item .btn-outline { padding: 0.5rem 1rem; font-size: 0.85rem; white-space: nowrap; }

.home-contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.contact-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.contact-list li { display: flex; gap: 0.8rem; align-items: flex-start; color: var(--text-dim); font-size: 0.95rem; line-height: 1.5; }
.contact-list svg { color: var(--accent); flex-shrink: 0; margin-top: 0.15rem; }
.contact-list strong { color: var(--text); display: block; font-size: 0.85rem; margin-bottom: 0.1rem; }
.contact-placeholder-note {
  font-size: 0.8rem;
  color: var(--warn);
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: 6px;
  padding: 0.7rem 0.9rem;
  margin-top: 1.4rem;
}

.home-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1360px;
  margin: 0 auto;
  color: var(--text-dim);
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 1rem;
}
.home-footer a { color: var(--text-dim); text-decoration: none; }
.home-footer a:hover { color: var(--accent); }
.home-footer-links { display: flex; gap: 1.4rem; }

/* "Come funziona": qui i numeri hanno senso, è davvero una sequenza. */
.steps-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
.step-num {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent);
  width: 3rem;
  height: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-dim);
  border-radius: 50%;
  margin-bottom: 1.1rem;
}
.step-title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; margin: 0 0 0.5rem; }

@media (max-width: 860px) {
  .home-hero { grid-template-columns: 1fr; padding: 3rem 1.5rem 3.5rem; text-align: left; }
  .home-hero .tank-schema { max-width: 220px; }
  .home-hero h1 { font-size: 2rem; }
  .home-section-inner { padding: 3rem 1.5rem; }
  .home-about-grid, .home-product, .home-contact-grid { grid-template-columns: 1fr; gap: 2rem; }
  .home-product .tank-schema { display: none; }
  .steps-row { grid-template-columns: 1fr; gap: 2rem; }
  .topbar { flex-wrap: wrap; row-gap: 0.6rem; }
  .topbar-center { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; }
}

/* =================================================================
   Dialogo di conferma con captcha matematico (vedi confirmWithCaptcha
   in app.js) — usato prima di ogni modifica/eliminazione sensibile.
   ================================================================= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(5,9,18,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; padding: 1rem;
}
.modal-card { max-width: 420px; width: 100%; }
.modal-card .captcha-question { font-family: var(--font-display); font-size: 1.15rem; margin: 0.8rem 0; }
.modal-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; }

/* Campi anagrafici nei form di registrazione: due colonne da tablet in su. */
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.field-grid label { grid-column: span 1; }
.field-grid .span-2 { grid-column: span 2; }
@media (max-width: 560px) {
  .field-grid { grid-template-columns: 1fr; }
  .field-grid .span-2 { grid-column: span 1; }
}
.cap-hint { font-size: 0.8rem; color: var(--text-dim); margin-top: -0.4rem; margin-bottom: 0.6rem; }
.file-note { font-size: 0.8rem; color: var(--text-dim); }

/* Tabelle admin (installatori, clienti, dipendenti, seriali) */
.admin-table-wrap { overflow-x: auto; }
.admin-table-wrap table { margin-top: 0.5rem; }
.admin-table-wrap td, .admin-table-wrap th { vertical-align: top; }
.tag-list { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.tag { background: rgba(56,189,248,0.15); color: var(--accent); border-radius: 4px; padding: 0.15rem 0.5rem; font-size: 0.75rem; }
.perm-category { margin-bottom: 1rem; }
.perm-category h4 { margin: 0 0 0.4rem; font-size: 0.9rem; color: var(--accent); }
.perm-option { display: flex; flex-direction: row; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.88rem; }
.perm-option input { margin-top: 0.2rem; width: auto; flex: none; }

/* Dispositivi: filtri, scheda informazioni, barra dashboard */
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0.6rem 1rem; margin-bottom: 0.4rem; }
.info-table td { border-bottom: 1px solid var(--border); padding: 0.55rem 0.4rem; vertical-align: top; }
.info-table tr:last-child td { border-bottom: none; }
.info-table .info-k { color: var(--text-dim); width: 11rem; font-size: 0.85rem; }
.info-table .mono { font-family: ui-monospace, Menlo, monospace; }
.dash-bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 1rem 0; }
.remote-ro-notice {
  color: var(--warn); font-weight: 700; font-size: 0.85rem;
  animation: roBlink 1.4s ease-in-out infinite;
}
@keyframes roBlink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
.dash-frame { width: 100%; border: 0; background: transparent; display: block; min-height: 300px; }
/* 1.32.2 (difetto segnalato da Natale il 29/11): la pagina della scheda dentro l'iframe non dichiara color-scheme (= chiaro).
   Con il sito in scuro (color-scheme: dark, dalla 1.31.2) gli schemi erano diversi e il browser dipingeva lo sfondo
   dell'iframe BIANCO e opaco intorno alla pagina. Stesso schema della pagina dentro = sfondo trasparente come prima.
   Vale per ogni pagina della scheda (dashboard, automazione, altri parametri, diagnostica: e' sempre questo iframe). */
.dash-frame { color-scheme: light; }

/* Barra superiore con molte voci: niente sovrapposizioni */
.nav a { white-space: nowrap; padding: 0.7rem 0.6rem; font-size: 0.86rem; }
.session-info #sessionUser { white-space: nowrap; max-width: 14rem; overflow: hidden; text-overflow: ellipsis; }

/* Installatori / Clienti */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat-row .stat-card { margin: 0; text-align: center; padding: 0.9rem; }
.stat-num { font-size: 1.8rem; font-weight: 800; color: var(--accent); line-height: 1.1; }
.stat-label { font-size: 0.78rem; color: var(--text-dim); margin-top: 0.2rem; }
.sect { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin: 1.4rem 0 0.6rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 700px) { .two-col { grid-template-columns: 1fr; } }
/* 1.28.2: a 320 px «Nuova comunicazione» usciva di 40 px a destra (una colonna della griglia non scende sotto il suo contenuto) */
.two-col > * { min-width: 0; }
.row-selected td { background: rgba(56, 189, 248, 0.08); }
.dev-line { padding: 0.35rem 0; border-bottom: 1px solid var(--border); }
.dev-line:last-child { border-bottom: none; }

/* Form di registrazione: campi dentro la scheda, senza sbordare */
.auth-shell { max-width: 640px; }
.field-grid input, .field-grid select { width: 100%; min-width: 0; }
.field-grid label { min-width: 0; }

/* Comunicazioni */
.comm-layout { align-items: start; }
.channel-pick { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; }
.connector-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0.9rem; }
.connector-card h3 { font-size: 1rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.connector-card form { margin-top: 0.8rem; }
/* 1.28.2: canale Email come Impostazioni › Posta in uscita di EK Admin (Preimposta, Invia prova, esito) */
.connector-card select { width: 100%; }
.smtp-preset { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0 0 .7rem; }
.smtp-chip { border: 1px solid var(--border); background: rgba(56,189,248,.08); color: var(--text); border-radius: 999px; padding: .28rem .75rem; font-size: .82rem; cursor: pointer; }
.smtp-chip:hover { border-color: var(--accent); background: rgba(56,189,248,.18); }
.smtp-prova { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-top: .8rem; }
.smtp-prova input { flex: 1 1 14rem; min-width: 0; margin: 0; }
.smtp-prova select { flex: 1 1 100%; margin: 0; }
.smtp-esito { margin-top: .7rem; padding: .7rem .85rem; border-radius: 10px; border: 1px solid var(--border); background: rgba(148,163,184,.06); font-size: .88rem; line-height: 1.5; overflow-wrap: anywhere; }
.smtp-esito.ok { border-color: rgba(16,185,129,.45); background: rgba(16,185,129,.07); }
.smtp-esito.ko { border-color: rgba(239,68,68,.45); background: rgba(239,68,68,.07); }
.smtp-esito code { white-space: normal; word-break: break-word; }
.smtp-ok { color: #6cc79a; } .smtp-ko { color: #f87171; } .smtp-warn { color: #f59e0b; }
.perm-option input[type=checkbox] { width: auto; }

/* Badge cliccabile "Online" che lampeggia e apre la dashboard */
.badge-btn { border: 0; cursor: pointer; font: inherit; font-weight: 700; }
.badge-blink { animation: roBlink 1.4s ease-in-out infinite; }
.badge-btn:hover { filter: brightness(1.2); animation-play-state: paused; }
.info-actions { margin-top: 0.8rem; padding-top: 0.8rem; border-top: 1px solid var(--border); }

/* Registrazione: consensi, codice di verifica */
.field-grid .check { display: flex; flex-direction: row; gap: 0.6rem; align-items: flex-start; font-size: 0.86rem; color: var(--text-dim); }
.field-grid .check input { width: auto !important; margin-top: 0.2rem; flex: none; }
.field-grid .check a { color: var(--accent, #4aa3ff); }
.code-send { display: flex; flex-direction: column; gap: 0.3rem; justify-content: flex-end; align-items: flex-start; }
.field-spacer { display: block; }



.app-dl { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1rem 0 0; }
.app-dl a { text-decoration: none; display: inline-block; }
textarea { background: var(--bg); border: 1px solid var(--border); color: var(--text); padding: .5rem .75rem; border-radius: 10px; font: inherit; width: 100%; resize: vertical; }


/* ============ Menù superiore: centrato e raggruppato ============ */
.topbar { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.topbar-left { justify-self: start; }
.topbar-right { justify-self: end; }
.topbar-center { overflow: visible; justify-content: center; flex: none; }
.nav { gap: .2rem; align-items: center; padding: .25rem; border: 1px solid var(--border); border-radius: 999px; background: rgba(15,23,42,.55); }
.nav a, .nav-group-btn {
  padding: .5rem .95rem; border-radius: 999px; border: 0; background: transparent; font: inherit; font-size: .88rem;
  color: var(--text-dim); text-decoration: none; white-space: nowrap; cursor: pointer; border-bottom: 0;
  display: inline-flex; align-items: center; gap: .35rem; transition: background .15s, color .15s;
}
.nav a:hover, .nav-group-btn:hover, .nav-group:hover > .nav-group-btn, .nav-group.open > .nav-group-btn { color: var(--text); background: rgba(56,189,248,.10); border-bottom: 0; }
.nav a.active, .nav-group.active > .nav-group-btn { color: #fff; background: rgba(56,189,248,.20); box-shadow: inset 0 0 0 1px rgba(56,189,248,.45); border-bottom: 0; }
.nav-group { position: relative; }
.nav-group-btn svg { opacity: .7; transition: transform .15s; }
.nav-group:hover .nav-group-btn svg, .nav-group.open .nav-group-btn svg { transform: rotate(180deg); }
.nav-menu {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%) translateY(6px); min-width: 12rem; padding: .4rem; margin-top: .35rem;
  display: none; flex-direction: column; gap: .1rem;
  background: rgba(13,21,38,.97); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 18px 40px -10px rgba(0,0,0,.7);
}
.nav-menu::before { content: ""; position: absolute; left: 0; right: 0; top: -.5rem; height: .5rem; }
.nav-group:hover > .nav-menu, .nav-group.open > .nav-menu, .nav-group:focus-within > .nav-menu { display: flex; }
.nav-menu a { border-radius: 10px; padding: .55rem .8rem; }
@media (max-width: 1280px) {
  .topbar { grid-template-columns: 1fr auto; row-gap: .8rem; padding-bottom: .9rem; }
  .topbar-center { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .nav { flex-wrap: wrap; justify-content: center; border-radius: 18px; }
  .nav-menu { left: 0; transform: none; }
}

/* Pad prodotti nella home di cliente/installatore */
.pad-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.pad {
  position: relative; display: flex; flex-direction: column; gap: .25rem; cursor: pointer; outline: none;
  padding: 1.1rem 1.2rem 1rem; border-radius: var(--radius); background: var(--bg-card); border: 1px solid var(--border);
  box-shadow: 0 12px 36px -8px rgba(0,0,0,.55); transition: transform .18s, border-color .18s, box-shadow .18s;
}
.pad:hover, .pad:focus-visible { transform: translateY(-3px); border-color: rgba(56,189,248,.55); box-shadow: 0 18px 44px -10px rgba(56,189,248,.28); }
.pad-on { border-top: 3px solid #22c55e; }
.pad-off { border-top: 3px solid #64748b; }
.pad-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: .5rem; }
.pad-ico { width: 2.6rem; height: 2.6rem; border-radius: 12px; display: grid; place-items: center; background: rgba(56,189,248,.12); color: var(--accent); }
.pad-ico svg { width: 1.5rem; height: 1.5rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.pad-title { font-weight: 700; font-size: 1.05rem; }
.pad-serial { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; color: var(--text-dim); margin-bottom: .5rem; }
.pad-meta { margin: 0 0 .7rem; display: grid; gap: .25rem; font-size: .82rem; }
.pad-meta div { display: flex; justify-content: space-between; gap: .8rem; }
.pad-meta dt { color: var(--text-dim); } .pad-meta dd { margin: 0; text-align: right; }
.pad-foot { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.pad-open { margin-top: .6rem; font-size: .82rem; color: var(--accent); font-weight: 600; }

/* Pagina dashboard dispositivo */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.dash-title { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; } .dash-title h1 { margin: 0; }

/* Utenti demo */
.inline-row { display: flex; gap: .5rem; align-items: center; }
.inline-row input, .inline-row select { flex: 1; min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: .4rem; padding: .2rem .3rem .2rem .6rem; border-radius: 999px; background: rgba(56,189,248,.1); border: 1px solid var(--border); font-size: .8rem; font-family: ui-monospace, Menlo, monospace; }
.chip .dot { width: .5rem; height: .5rem; border-radius: 50%; background: #64748b; } .chip .dot.on { background: #22c55e; }
.chip-x { border: 0; background: transparent; color: var(--text-dim); cursor: pointer; width: 1.4rem; height: 1.4rem; border-radius: 50%; }
.chip-x:hover { background: rgba(239,68,68,.25); color: #fff; }
.demo-created { margin-top: 1rem; padding: .8rem 1rem; border-radius: 12px; background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.4); font-size: .9rem; }
.demo-created code { background: rgba(0,0,0,.35); padding: .1rem .4rem; border-radius: 6px; user-select: all; }

a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* ============ Menu account ============ */
.acct { position: relative; }
.acct-btn {
  display: flex; align-items: center; gap: .5rem; max-width: 20rem;
  background: rgba(15,23,42,.55); border: 1px solid var(--border); color: var(--text);
  padding: .45rem .85rem; border-radius: 999px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.acct-btn:hover, .acct.open .acct-btn { border-color: var(--accent); color: var(--accent); }
.acct-btn #sessionUser { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 15rem; }
.acct-btn .chev { transition: transform .15s; flex: none; }
.acct.open .chev { transform: rotate(180deg); }
.acct-menu {
  display: none; position: absolute; right: 0; top: calc(100% + .5rem); min-width: 19.5rem; z-index: 60;
  background: #0f172a; border: 1px solid var(--border); border-radius: 12px; padding: .4rem;
  box-shadow: 0 14px 40px rgba(0,0,0,.5);
}
.acct.open .acct-menu { display: block; }
.acct-head { display: flex; flex-direction: column; padding: .55rem .7rem .6rem; border-bottom: 1px solid var(--border); margin-bottom: .3rem; }
.acct-head span { color: var(--text-dim); font-size: .8rem; }
.acct-menu a, .acct-menu button {
  display: block; width: 100%; text-align: left; padding: .55rem .7rem; border-radius: 8px; border: 0; background: transparent;
  color: var(--text); font: inherit; font-size: .88rem; text-decoration: none; cursor: pointer;
}
.acct-menu a:hover, .acct-menu button:hover { background: rgba(148,163,184,.12); color: var(--accent); }
.acct-menu a[hidden] { display: none; }
.acct-menu hr { border: 0; border-top: 1px solid var(--border); margin: .3rem 0; }
.account-page { max-width: 760px; margin: 0 auto; display: grid; gap: 1.1rem; }
.account-page .card { margin: 0; }
.account-page [hidden] { display: none !important; }
.danger-card { border-color: rgba(239,68,68,.45); }
@media (max-width: 700px) { .acct-btn #sessionUser { max-width: 8rem; } }

/* Dashboard remota: dispositivo non raggiungibile / connessione persa */
.dash-lost { max-width: 780px; margin: 1.2rem auto; padding: 1.1rem 1.3rem; border: 1px solid rgba(248,113,113,.5); background: rgba(239,68,68,.08); border-radius: 14px; display: grid; gap: .35rem; }
.dash-lost strong { color: #f87171; font-size: 1.05rem; }
.dash-lost span { color: var(--text-dim); font-size: .92rem; }
.dash-lost[hidden] { display: none; }
.dash-dim { opacity: .35; filter: grayscale(.8); pointer-events: none; transition: opacity .3s; }
/* 1.28.0: con la dashboard aperta l'avviso sta fisso in basso, sopra la pagina: non sposta la dashboard. */
.dash-lost.dash-lost-fissa { position: fixed; z-index: 70; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); margin: 0 auto; background: rgba(40, 14, 18, .96); box-shadow: 0 8px 28px rgba(0,0,0,.45); backdrop-filter: blur(8px); }
body.has-tabs .dash-lost.dash-lost-fissa { bottom: calc(68px + env(safe-area-inset-bottom)); }

/* Dashboard dispositivo su telefono: margini laterali minimi */
/* 1.30.3: solo la pagina della dashboard (#remoteDash figlio diretto); prima valeva anche per la Scheda, che contiene un
   #remoteDash vuoto, e la Scheda stava a 4 px dal bordo invece di 16 */
@media (max-width: 600px) { .app:has(> #remoteDash) { padding: 1rem 4px 3rem; } .app:has(> #remoteDash) .dash-head { padding: 0 6px; } }

/* Riquadro dispositivo compatto: titolo e seriale accanto alla goccia */
.pad { padding: .7rem .85rem .65rem; gap: .15rem; }
.pad-top { gap: .6rem; justify-content: flex-start; margin-bottom: .35rem; }
.pad-top .badge { margin-left: auto; }
.pad-ico { width: 2.2rem; height: 2.2rem; flex: 0 0 auto; }
.pad-ico svg { width: 1.3rem; height: 1.3rem; }
.pad-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.pad-title { font-size: 1rem; }
.pad-serial { margin-bottom: 0; font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 1.21.1: riga 2 sempre "<Prodotto> · <seriale>": se non ci sta va a capo invece di tagliare il seriale */
.pad-serial { white-space: normal; text-overflow: clip; overflow-wrap: anywhere; }
.pad-meta { margin: 0 0 .4rem; gap: .12rem; font-size: .78rem; }

html { background: #070c18; }
/* il body resta trasparente: così disegno di sfondo e sfumature (z-index -1) restano visibili sopra l'html */
body { background: transparent; }
.home-footer-addr { font-size: .8rem; opacity: .8; }

/* ============ Piede della pagina: minimale ============ */
.home-footer { display: block; padding: 2.6rem 1.5rem 1.6rem; font-size: .88rem; }
.hf-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.3fr; gap: 2rem; }
.hf-brand .brand { margin-bottom: .7rem; }
.hf-tag { margin: 0 0 .9rem; color: var(--text-dim); max-width: 18rem; line-height: 1.5; }
.hf-socials { display: flex; gap: .5rem; flex-wrap: wrap; }
.hf-social { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); border-radius: 50%; transition: color .15s, border-color .15s, transform .15s; }
.hf-social:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.hf-col { display: flex; flex-direction: column; gap: .5rem; align-items: flex-start; }
.hf-col h4 { margin: 0 0 .3rem; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--text); opacity: .7; font-weight: 600; }
.hf-col a { cursor: pointer; }
.hf-col span { line-height: 1.45; }
.hf-bottom { margin-top: 2rem; padding-top: 1.1rem; border-top: 1px solid var(--border); text-align: center; font-size: .8rem; opacity: .8; }
@media (max-width: 900px) { .hf-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .hf-grid { grid-template-columns: 1fr; gap: 1.5rem; } .hf-bottom { text-align: left; } }

/* Home: icona nel menù, immagine principale, pilastri, galleria */
.nav-home { display: inline-flex !important; align-items: center; justify-content: center; padding: .5rem .7rem !important; }
.hero-img { width: 100%; max-height: 420px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: 0 18px 50px -12px rgba(0,0,0,.6); }
.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.2rem; }
.pillar { padding: 1.2rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.pillar-ico { font-size: 1.6rem; margin-bottom: .4rem; }
.home-gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .8rem; margin-top: 1.6rem; }
.home-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); }
/* Sito web (area produttore) */
.img-grid { display: flex; flex-wrap: wrap; gap: .8rem; margin: .6rem 0 1rem; }
.img-tile { margin: 0; display: flex; flex-direction: column; gap: .4rem; width: 170px; }
.img-tile img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--border); }

/* Menù pubblico (da sloggati): stesso aspetto del menù dell'area riservata */
.home-subnav { gap: .2rem; align-items: center; padding: .25rem; border: 1px solid var(--border); border-radius: 999px; background: rgba(15,23,42,.55); overflow: visible; }
.home-subnav a {
  padding: .5rem .95rem; border-radius: 999px; border: 0; background: transparent; font: inherit; font-size: .88rem;
  color: var(--text-dim); cursor: pointer; display: inline-flex; align-items: center; gap: .35rem; transition: background .15s, color .15s;
}
.home-subnav a:hover { color: var(--text); background: rgba(56,189,248,.10); }
.home-subnav a.nav-home { padding: .5rem .7rem !important; }
@media (max-width: 760px) { .home-subnav { max-width: 100%; overflow-x: auto; } }

/* Popup di accesso. 1.21.0: dentro c'e' la stessa finestra della pagina (.ek-auth > .ek-card di EK Shared);
   qui solo la posizione nel popup e la X, nessuna regola sulla scheda. */
.modal-overlay > .ek-auth.login-modal { position: relative; margin: auto; max-height: calc(100vh - 2rem); overflow-y: auto; }
/* 1.23.0: tolta la regola html.ek-acct-aperto #topbar della 1.21.0: dalla 0.1.20 definitiva il componente di EK Shared
   porta il menu aperto sotto <body> sul telefono. */

/* 1.23.0: riquadro «EK Admin» della Scheda del dispositivo (fase D2; anteprima dispositivi-D2\anteprima-collega-ekadmin.html) */
.ekadm-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ekadm-head h3 { margin: 0; }
.ekadm-text { color: var(--text-dim); margin: .45rem 0 .8rem; line-height: 1.45; }
.ekadm-code { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: center; margin-top: .6rem; }
.ekadm-qr { background: #fff; border-radius: 12px; padding: 10px; width: 196px; height: 196px; box-sizing: border-box; }
.ekadm-qr svg, .ekadm-qr img { display: block; width: 100%; height: 100%; }
.ekadm-noqr { color: #333; font-size: .8rem; padding: 1rem; text-align: center; }
.ekadm-steps { margin: 0 0 .7rem; padding-left: 1.2rem; color: var(--text-dim); line-height: 1.5; }
.ekadm-k { font-size: .78rem; color: var(--text-dim); margin-top: .5rem; }
.ekadm-v { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; }
.ekadm-big { font-size: 1.9rem; font-weight: 700; letter-spacing: .14em; line-height: 1.15; }
.ekadm-ser { font-size: 1.12rem; font-weight: 600; letter-spacing: .04em; }
.ekadm-timer { display: inline-flex; align-items: center; gap: 6px; margin-top: .7rem; font-variant-numeric: tabular-nums; }
.ekadm-timer.low { color: var(--warn); }
.ekadm-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: .9rem; }
.ekadm-wait { display: inline-flex; align-items: center; gap: 8px; color: var(--text-dim); font-size: .85rem; margin-top: .6rem; }
.ekadm-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); animation: ekadm-pulse 1.4s ease-in-out infinite; }
@keyframes ekadm-pulse { 50% { opacity: .25; } }
.ekadm-linked { display: flex; gap: 12px; align-items: flex-start; margin-top: .5rem; }
.ekadm-linked svg { flex: 0 0 auto; color: var(--ok); margin-top: 2px; }
.ekadm-linked strong { overflow-wrap: anywhere; }
.ekadm-meta { color: var(--text-dim); font-size: .85rem; margin-top: .25rem; line-height: 1.45; overflow-wrap: anywhere; }
.ekadm-block { border-left: 3px solid var(--warn); padding: .4rem .8rem; margin: .5rem 0 .2rem; }
.ekadm-alert { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; border-left: 3px solid var(--warn); }
.ekadm-alert span { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.ekadm-req { border: 1px solid rgba(245,158,11,.45); border-radius: 12px; padding: .8rem 1rem; margin-top: .6rem; background: rgba(245,158,11,.06); }
.ekadm-req dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .3rem .9rem; margin: .6rem 0 0; }
.ekadm-req dt { color: var(--text-dim); font-size: .85rem; }
.ekadm-req dd { margin: 0; overflow-wrap: anywhere; }
.ekadm-link { background: none; border: 0; padding: 0; color: var(--text-dim); text-decoration: underline; cursor: pointer; font: inherit; font-size: .85rem; min-height: 0; }
@media (max-width: 420px) { .ekadm-req dl { grid-template-columns: minmax(0, 1fr); gap: .1rem; } .ekadm-req dd { margin-bottom: .35rem; } }
@media (max-width: 560px) {
  .ekadm-code { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; }
  .ekadm-steps { text-align: left; }
  .ekadm-actions { justify-content: center; }
  .ekadm-actions .btn { flex: 1 1 140px; }
}
@media (max-width: 360px) {
  .ekadm-qr { width: 176px; height: 176px; }
  .ekadm-big { font-size: 1.6rem; }
}
#ek-account[hidden] { display: none; }
/* Riserva senza EK Shared (ek-theme.css non caricato): :where() non pesa, quindi il tema comune vince sempre. */
:where(.ek-auth) { width: min(380px, 100%); margin: 3rem auto 2rem; box-sizing: border-box; }
:where(.ek-auth .ek-card) { background: var(--bg-card); border: 1px solid var(--border); border-radius: 16px; padding: 1.6rem 1.6rem 1.4rem; }
:where(.ek-auth-brand) { display: flex; justify-content: center; margin: 0 0 1.1rem; font-weight: 800; font-size: 1.2rem; }
:where(.ek-auth-brand span) { color: var(--accent); }
:where(.ek-sub) { color: var(--text-dim); margin: 0 0 1.5rem; font-size: .92rem; }
:where(.ek-auth-err) { color: var(--danger); font-size: .85rem; }
:where(.ek-auth-err:empty) { display: none; }
:where(.ek-auth .ek-btn) { width: 100%; min-height: 2.6rem; border-radius: 11px; border: 1px solid transparent; background: var(--accent); color: var(--on-accent); font-weight: 700; cursor: pointer; }
:where(.ek-auth .ek-btn.ek-ghost) { background: transparent; color: var(--text); border-color: var(--border); }
:where(.ek-auth-links) { margin: 1rem 0 0; text-align: center; font-size: .88rem; }
:where(.ek-auth-links a) { color: var(--accent); }
:where(.ek-auth-more) { margin-top: 1.3rem; padding-top: 1.1rem; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: .55rem; }
:where(.ek-auth-more .ek-sub) { margin: 0 0 .2rem; text-align: center; }
.login-modal-x { position: absolute; top: .5rem; right: .6rem; width: 2rem; height: 2rem; border: 0; border-radius: 50%; background: transparent; color: var(--text-dim); font-size: 1.5rem; line-height: 1; cursor: pointer; }
.login-modal-x:hover { background: rgba(148,163,184,.15); color: var(--text); }

.brand-pending{visibility:hidden}

/* ---- Allineamenti e simmetria (campi, tasti, tabelle) ---- */
/* stessa altezza per campi di testo e menu a tendina */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]), select {
  height: 2.4rem; box-sizing: border-box; line-height: 1.2;
}
select { padding-right: 0.5rem; }
/* spazio verticale uniforme tra le righe di una griglia di campi */
.field-grid { gap: 0.7rem 1rem; }
.filter-grid { gap: 0.7rem 1rem; }
/* l'avviso d'errore vuoto non lascia uno spazio morto sopra i tasti */
.error-msg:empty { display: none; }
/* tasti dentro i moduli: larghezza naturale, allineati a sinistra (tranne accesso/registrazione) */
form > .btn, form > .btn-outline, form > button { align-self: flex-start; }
.auth-shell form > .btn, .auth-shell form > button, .login-modal form > .btn, .login-modal form > button { align-self: stretch; }
/* il tasto con contorno nei moduli ha la stessa forma e dimensione del tasto pieno */
form .btn-outline { padding: 0.55rem 1rem; border-radius: 11px; font-size: 0.88rem; line-height: inherit; }
/* riga di campi e tasti sulla stessa linea */
form.row-form { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 0.6rem 0.8rem; }
form.row-form > label { flex: 1 1 12rem; }
form.row-form > input { flex: 1 1 14rem; }
form.row-form > .btn, form.row-form > button { align-self: flex-end; height: 2.4rem; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; margin-top: 0.4rem; }
/* tabelle informative: etichette e valori sulla stessa linea, bordo allineato ai campi */
.info-table td { vertical-align: middle; }
.info-table td:first-child { padding-left: 0; }
.info-table td:last-child { padding-right: 0; }
.card table th:first-child, .card table td:first-child { padding-left: 0; }
.card table th:last-child, .card table td:last-child { padding-right: 0; }
select { padding-left: 0.6rem; }

/* Righe di filtri/campi con pulsante: tutto allineato sul fondo, stessa altezza dei campi */
.filter-grid { align-items: end; }
.filter-grid > label { margin: 0; }
.filter-grid > .btn, .filter-grid > .btn-outline, .filter-grid > .btn-small {
  align-self: end; height: 2.4rem; padding-top: 0; padding-bottom: 0;
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; width: auto; justify-self: start;
}
.filter-grid.inline-actions { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.filter-grid input[type="search"], .filter-grid input[type="date"] { height: 2.4rem; }
.admin-table-wrap th select { font-weight: 400; margin-top: .3rem; font-size: .8rem; }

/* Caselle di spunta con testo: riga unica, casella a sinistra */
label.check { display: flex; flex-direction: row; align-items: center; gap: .6rem; }
label.check input[type="checkbox"] { width: auto !important; height: auto; flex: none; margin: 0; }

/* ===== Telefono: barra inferiore, "Altro", avvisi (stesso stile dei mockup) ===== */
.mobtabs { display: none; }
.mobtabs a { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 56px; color: var(--text-dim); font-size: 12px; font-weight: 600; text-decoration: none; }
.mobtabs a.on { color: var(--accent); font-weight: 700; }
.mt-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger-pieno); color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
@media (max-width: 700px), (hover: none) and (max-width: 900px) {
  body.has-tabs .mobtabs { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; padding-bottom: env(safe-area-inset-bottom); background: rgba(13, 21, 39, 0.98); border-top: 1px solid var(--border); backdrop-filter: blur(12px); }
  body.has-tabs #mainNav { display: none; }
  body.has-tabs .app { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  body.has-tabs .site-footer, body.has-tabs .home-footer { display: none; }
  /* 1.21.0: non nella finestra di accesso, che ha campi e pulsanti di EK Shared (42 px a ogni larghezza) */
  .btn, .btn-outline, button:not(.ek-auth *), select, input:not([type=checkbox]):not([type=radio]):not(.ek-auth *) { min-height: 44px; }
  .app table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
}
.more-user { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: 18px; background: var(--bg-card); border: 1px solid var(--border); margin-bottom: 14px; }
.more-user div:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.more-user span { color: var(--text-dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } /* 1.30.3: email su una riga (prima si spezzava al trattino) */
.more-user em { font-style: normal; padding: 5px 10px; border-radius: 999px; background: rgba(56, 189, 248, 0.14); color: #7dd3fc; font-size: 12px; font-weight: 700; }
.more-avatar { width: 52px; height: 52px; flex: none; border-radius: 50%; background: rgba(56, 189, 248, 0.18); color: #7dd3fc; font-size: 20px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.more-h { margin: 18px 0 8px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text-dim); }
.more-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.more-tile { height: 84px; padding: 0 6px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-card); color: #e2e8f0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; text-align: center; text-decoration: none; }
.more-tile svg { color: var(--accent); }
.more-list { border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border); overflow: hidden; }
.more-row { display: flex; align-items: center; gap: 14px; height: 56px; padding: 0 16px; color: var(--text); font-size: 15px; text-decoration: none; }
.more-row + .more-row { border-top: 1px solid rgba(255, 255, 255, .06); }
.more-row span { flex: 1; }
.more-row svg { color: var(--text-dim); }
.more-logout { width: 100%; margin-top: 16px; height: 48px; border-color: rgba(239, 68, 68, .5); color: #fca5a5; font-weight: 700; }
.alerts-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.alerts-actions { display: flex; gap: 8px; }
.alert-item { display: flex; gap: 12px; padding: 14px 16px; margin-bottom: 8px; border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
.alert-item.unread { border-color: var(--lv); }
.alert-dot { width: 10px; height: 10px; margin-top: 6px; flex: none; border-radius: 50%; background: var(--lv); opacity: .35; }
.alert-item.unread .alert-dot { opacity: 1; box-shadow: 0 0 8px var(--lv); }
.alert-item p { margin: 4px 0 0; color: var(--text-dim); font-size: 13px; }
.alert-item small { display: block; margin-top: 6px; color: var(--text-dim); }
.alert-lv { color: var(--lv); font-weight: 700; }
.back-link { color: var(--accent); text-decoration: none; }
.pref-top { padding: 0; }
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; }
.pref-row + .pref-row { border-top: 1px solid rgba(255, 255, 255, .06); }
.pref-row small { display: block; color: var(--text-dim); font-size: 12px; margin-top: 2px; }
.pref-time { display: flex; gap: 8px; } /* 1.30.3 */
.pref-time input { width: 110px; }
.sw { position: relative; width: 52px; height: 30px; flex: none; }
.sw input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.sw span { position: absolute; inset: 0; border-radius: 15px; background: #334155; transition: background .15s; }
.sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #04121f; transition: left .15s; }
.sw input:checked + span { background: var(--accent); }
.sw input:checked + span::after { left: 25px; }
/* 1.30.3: colonna dei nomi che si restringe (minmax), intestazioni allineate alle spunte (stesso margine delle righe), colonne piu' larghe al computer, icone al telefono */
.pref-grid-head, .pref-line { display: grid; grid-template-columns: minmax(0, 1fr) repeat(4, 76px); align-items: center; }
.pref-grid-head { padding: 0 0 6px 16px; font-size: 12px; font-weight: 700; color: var(--text-dim); text-align: center; }
.pref-grid-head > span { display: flex; align-items: center; justify-content: center; }
.pref-grid-head svg { display: none; }
.pref-grid-head b { font-weight: 700; }
@media (max-width: 600px) {
  .pref-grid-head, .pref-line { grid-template-columns: minmax(0, 1fr) repeat(4, 42px); }
  .pref-grid-head svg { display: block; } .pref-grid-head b { display: none; }
  .pref-row-time { flex-wrap: wrap; } .pref-row-time .pref-time { flex: 1 1 100%; } .pref-row-time .pref-time input { flex: 1 1 0; width: auto; min-width: 0; }
}
.pref-group { padding: 0; overflow: hidden; margin-bottom: 8px; }
.pref-title { padding: 8px 16px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.lv-critical { background: rgba(239, 68, 68, .16); color: #fca5a5; }
.lv-important { background: rgba(245, 158, 11, .16); color: #fcd34d; }
.lv-info { background: rgba(56, 189, 248, .14); color: #7dd3fc; }
.pref-line { padding: 0 0 0 16px; border-top: 1px solid rgba(255, 255, 255, .06); font-size: 14px; }
.pref-line > span { padding: 6px 8px 6px 0; line-height: 1.25; overflow-wrap: break-word; }
.pcheck { position: relative; display: flex; align-items: center; justify-content: center; height: 44px; }
.pcheck input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.pcheck i { width: 22px; height: 22px; box-sizing: border-box; border-radius: 7px; border: 2px solid #475569; display: block; }
.pcheck input:checked + i { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2304121f' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12 5 5L20 7'/%3E%3C/svg%3E") center/14px no-repeat; border-color: var(--accent); }
html.is-app .app-download, html.is-app #appDownloadLink { display: none; }

.forgot-row { margin: .9rem 0 0; text-align: center; font-size: .9rem; }
.forgot-row a { color: var(--accent); }
/* Dentro l'app: niente effetti di sfondo né animazioni, per risparmiare batteria */
html.is-app *, html.is-app *::before, html.is-app *::after { animation: none !important; transition: none !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; }
html.is-app .topbar { position: sticky; }

/* Menù a riquadri a comparsa (sito): stesso aspetto della pagina "Altro" dell'app */
.mega-btn { display: inline-flex; align-items: center; gap: .45rem; height: 38px; padding: 0 .9rem; border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); font-size: .88rem; font-weight: 600; cursor: pointer; }
.mega-btn:hover, .mega-btn[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
.mega { position: fixed; top: 64px; left: 12px; z-index: 70; width: min(560px, calc(100vw - 16px)); max-height: calc(100vh - 90px); overflow-y: auto; padding: 18px; border-radius: 20px; background: rgba(13, 21, 39, .98); border: 1px solid var(--border-hover); box-shadow: 0 24px 48px rgba(0, 0, 0, .5); animation: megaIn .16s ease-out; }
@keyframes megaIn { from { opacity: 0; transform: translateY(-8px); } }
.mega .more-h:first-child { margin-top: 0; }
.mega-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mega .more-tile { transition: border-color .12s, transform .12s; }
.mega .more-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.mega .more-row:hover { background: rgba(255, 255, 255, .04); }
@media (max-width: 700px) { .mega-btn, .mega { display: none !important; } }

/* Menù in alto a riquadri (come "Altro" dell'app): i gruppi si aprono in verticale passandoci sopra */
.nav.nav-tiles { gap: .5rem; padding: .35rem; border-radius: 18px; align-items: flex-start; }
.nav-tiles .nt { position: relative; box-sizing: border-box; flex: none; width: 92px; height: 62px; padding: 0 .2rem; border-radius: 14px; border: 1px solid var(--border); background: var(--bg-card); color: #e2e8f0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font: inherit; font-size: .74rem; font-weight: 600; line-height: 1.1; text-align: center; white-space: normal; text-decoration: none; box-shadow: none; cursor: pointer; transition: border-color .12s, background .12s, transform .12s; }
.nav-tiles .nt svg { color: var(--accent); flex: none; }
.nav-tiles .nt:hover, .nav-tiles .nav-group:hover > .nt, .nav-tiles .nav-group.open > .nt { background: rgba(56,189,248,.10); border-color: var(--accent); color: #fff; }
.nav-tiles .nt.active, .nav-tiles .nav-group.active > .nt { background: rgba(56,189,248,.20); border-color: rgba(56,189,248,.6); color: #fff; box-shadow: none; }
.nav-tiles .nt-chev { position: absolute; right: 7px; top: 7px; color: var(--text-dim); opacity: .9; transition: transform .15s; }
.nav-tiles .nav-group:hover .nt-chev, .nav-tiles .nav-group.open .nt-chev { transform: rotate(180deg); }
.nav-tiles .nt-badge { top: 4px; right: 6px; left: auto; }
.nav-tiles .nav-menu { left: 0; transform: none; min-width: 0; width: 100%; padding: .5rem 0 0; margin-top: 0; gap: .5rem; background: transparent; border: 0; box-shadow: none; z-index: 80; }
.nav-tiles .nav-menu::before { top: -.2rem; height: .7rem; }
.nav-tiles .nav-menu .nt { width: 100%; background: rgba(13,21,39,.98); box-shadow: 0 10px 26px -8px rgba(0,0,0,.7); }
.nav-tiles .nav-menu { width: 92px; }
.nav-tiles .nav-group { display: block; }
@media (max-width: 1280px) { .nav.nav-tiles { flex-wrap: wrap; } }

.nav-tiles .nt span { overflow-wrap: anywhere; }

/* Utente collegato (in alto a destra): stesso aspetto della scheda utente dell'app */
.acct-btn { gap: .6rem; padding: .3rem .8rem .3rem .35rem; border-radius: 999px; }
.acct-avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; background: rgba(56,189,248,.18); color: #7dd3fc; font-size: .8rem; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.acct-text { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; min-width: 0; text-align: left; }
.acct-text #sessionUser { font-size: .88rem; font-weight: 700; color: var(--text); max-width: 11rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-text small { font-size: .7rem; font-weight: 700; color: #7dd3fc; }
@media (max-width: 700px) { .acct-text small { display: none; } .acct-btn #sessionUser { max-width: 6rem; } }

/* ===== Riquadri uniformi in tutta la barra in alto (menù pubblico, Accedi, utente e sotto-menù) ===== */
/* La cornice azzurra al passaggio mostra sempre tutti e 4 i lati (prima il bordo inferiore veniva azzerato da ".nav a:hover") */
.nav-tiles .nt, .nav-tiles .nt:hover, .nav-tiles .nt.active, .nav-tiles .nav-group:hover > .nt { border-width: 1px; border-style: solid; }
.nav-tiles .nt[hidden] { display: none; }
.nav-tiles .nt:hover, .nav-tiles .acct.open > .nt { background: rgba(56,189,248,.10); border-color: var(--accent); color: #fff; }
.nav-tiles .nt svg { color: var(--accent); }
.nav-tiles .nt-chev { color: var(--text-dim); }
.home-subnav.nav-tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; padding: .35rem; border-radius: 18px; align-items: flex-start; overflow: visible; max-width: none; }
.home-subnav.nav-tiles a.nt { padding: 0 .2rem; border-radius: 14px; font-size: .74rem; font-weight: 600; color: #e2e8f0; }
.home-subnav.nav-tiles a.nt:hover { color: #fff; }
.topbar-right.nav-tiles { align-items: flex-start; }
.topbar-right .acct { position: relative; }
.topbar-right .acct-btn.nt { max-width: none; gap: 3px; padding: 0 .2rem; border-radius: 14px; }
.acct-btn.nt .acct-avatar { width: 28px; height: 28px; font-size: .72rem; }
.acct-btn.nt .acct-text { align-items: center; max-width: 100%; }
.acct-btn.nt .acct-text #sessionUser { max-width: 82px; font-size: .74rem; font-weight: 600; text-align: center; }
.acct-btn.nt .acct-text small { display: none; }
.acct-btn.nt .nt-chev { top: 5px; right: 6px; }
.acct.open .nt-chev { transform: rotate(180deg); }
.topbar-right .acct-menu { display: none; flex-direction: column; gap: .5rem; position: absolute; right: 0; left: auto; top: 100%; min-width: 0; width: 92px; padding: .5rem 0 0; background: transparent; border: 0; box-shadow: none; z-index: 80; }
.topbar-right .acct.open .acct-menu { display: flex; }
.topbar-right .acct-menu .acct-head { display: none; }
.topbar-right .acct-menu .nt { width: 92px; background: rgba(13,21,39,.98); box-shadow: 0 10px 26px -8px rgba(0,0,0,.7); color: #e2e8f0; text-align: center; }
.topbar-right .acct-menu .nt:hover { background: rgba(13,40,60,.98); color: #fff; }
.topbar-right .acct-menu .nt[hidden] { display: none; }
.topbar-right .login-btn.nt { padding: 0 .2rem; border-radius: 14px; font-family: inherit; }
html.is-app #homeSubnav { display: none !important; }

/* ===== Ottimizzazione per telefono e tablet ===== */
/* Tablet (fino a 1024px): riquadri del menù un po' più piccoli perché ne stiano 8 in una riga */
@media (max-width: 1024px) {
  .nav-tiles .nt, .topbar-right .acct-menu .nt, .topbar-right .acct-menu { width: 80px; }
  .nav-tiles .nt { height: 58px; font-size: .7rem; }
  .nav-tiles .nav-menu { width: 80px; }
  .topbar { padding-left: 1rem; padding-right: 1rem; }
  .app { padding-left: 1rem; padding-right: 1rem; }
}
/* Telefono */
@media (max-width: 700px) {
  .topbar { padding: .7rem 1rem; }
  /* menù pubblico: una sola riga scorrevole, riquadri compatti */
  .home-subnav.nav-tiles { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; gap: .4rem; padding: .3rem; border-radius: 16px; scrollbar-width: none; }
  .home-subnav.nav-tiles::-webkit-scrollbar { display: none; }
  .home-subnav.nav-tiles a.nt { width: 74px; height: 54px; flex: none; font-size: .68rem; }
  .topbar-right .login-btn.nt, .topbar-right .acct-btn.nt { width: 74px; height: 54px; font-size: .68rem; }
  .topbar-right .acct-menu, .topbar-right .acct-menu .nt { width: 74px; }
  /* filtri: due colonne invece di una lunga colonna */
  .filter-grid, .filter-grid.inline-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem .6rem; }
  .filter-grid > .btn, .filter-grid > .btn-outline, .filter-grid > .btn-small { grid-column: 1 / -1; }
  .filter-grid input, .filter-grid select { min-height: 40px; font-size: 14px; padding-left: .6rem; padding-right: .6rem; }
  .card { padding: 1rem; }
  h1 { font-size: 1.5rem; }
  /* tabelle -> schede */
  .app table.rt { display: block; overflow: visible; }
  .app table.rt thead { display: none; }
  .app table.rt tbody { display: block; }
  .app table.rt tr { display: block; margin: 0 0 .6rem; padding: .35rem .8rem; border: 1px solid var(--border); border-radius: 14px; background: rgba(15,23,42,.55); }
  /* 1.30.3: etichetta a sinistra mai spezzata a meta' parola, valore (un solo blocco .rt-v) a destra che va a capo
     solo fra le parole; i seriali lunghi possono andare a capo solo se proprio non ci stanno */
  .app table.rt td { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .45rem 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.05); text-align: right; word-break: normal; overflow-wrap: normal; }
  .app table.rt td:last-child { border-bottom: 0; }
  .app table.rt td::before { content: attr(data-label); flex: 0 0 auto; max-width: 46%; white-space: normal; word-break: normal; overflow-wrap: normal; hyphens: none; color: var(--text-dim); font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; text-align: left; line-height: 1.3; }
  .app table.rt td > .rt-v { display: block; flex: 1 1 auto; min-width: 0; text-align: right; overflow-wrap: anywhere; word-break: normal; }
  .app table.rt td > .rt-v .param-meta { margin-top: .15rem; }
  .app table.rt td:not([data-label]) .btn-small { min-height: 38px; padding-left: 1rem; padding-right: 1rem; }
  .app table.rt td[data-label=""]::before, .app table.rt td:not([data-label])::before { content: none; }
  .app table.rt td:not([data-label]) { justify-content: flex-end; }
  .app table.rt td:empty { display: none; }
  .admin-table-wrap { overflow: visible; }
  .modal, .login-modal { max-width: 100%; }
}

/* Diagnostica dispositivo (produttore) */
.diag-list { display: flex; flex-direction: column; }
.diag-row { display: grid; grid-template-columns: 9.5rem 4.2rem 1fr; gap: .6rem; padding: .45rem 0; border-top: 1px solid rgba(255,255,255,.06); font-size: .86rem; align-items: baseline; }
.diag-row:first-child { border-top: 0; }
.diag-t { color: var(--text-dim); font-size: .78rem; }
.diag-l { font-weight: 700; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
.diag-row.lv2 .diag-l { color: #f87171; }
.diag-row.lv1 .diag-l { color: #fbbf24; }
.diag-row.lv0 .diag-l { color: var(--text-dim); }
.diag-m { word-break: break-word; }
.diag-m em { color: var(--text-dim); font-style: normal; }
@media (max-width: 700px) { .diag-row { grid-template-columns: 1fr auto; } .diag-t { grid-column: 1; } .diag-l { grid-column: 2; grid-row: 1; } .diag-m { grid-column: 1 / -1; } }

/* Versione del software: piè di pagina in basso a destra, su tutte le pagine */
@media (max-width: 700px) {
  body.has-tabs .app { padding-bottom: 12px; }
  body.has-tabs .ek-foot { margin-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.has-tabs .ekc:not(.ekc-pos-alto) { bottom: calc(64px + env(safe-area-inset-bottom)); }
}

/* Pagina di una sezione del menù (Persone, Catalogo, Sistema, Sito) */
.sec-head { margin-bottom: 1.2rem; }
.sec-head h1 { margin-bottom: .3rem; }
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.sec-card { display: flex; align-items: center; gap: 14px; padding: 18px; border-radius: 16px; border: 1px solid var(--border); background: var(--bg-card); color: var(--text); text-decoration: none; transition: border-color .12s, transform .12s; }
.sec-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.sec-card > svg:first-child { color: var(--accent); flex: none; }
.sec-card > div { flex: 1; min-width: 0; }
.sec-card strong { display: block; font-size: 1rem; }
.sec-card span { display: block; margin-top: 2px; color: var(--text-dim); font-size: .85rem; line-height: 1.35; }
.sec-card > svg:last-child { color: var(--text-dim); flex: none; }

/* Icone dei menù statiche: nessuna rotazione, sollevamento o transizione al passaggio del mouse */
.nav-group-btn svg, .nav-tiles .nt svg, .nav-tiles .nt-chev, .acct-btn .chev, .acct-btn .nt-chev, .more-tile svg, .more-row svg, .sec-card svg { transition: none !important; animation: none !important; }
.nav-group:hover .nav-group-btn svg, .nav-group.open .nav-group-btn svg,
.nav-tiles .nav-group:hover .nt-chev, .nav-tiles .nav-group.open .nt-chev,
.acct.open .chev, .acct.open .nt-chev, .acct:hover .nt-chev { transform: none !important; }
.nav-tiles .nt:hover, .mega .more-tile:hover, .more-tile:hover, .sec-card:hover { transform: none !important; }
.mega .more-tile, .sec-card, .nav-tiles .nt { transition: none !important; }

/* Piè di pagina sempre in fondo: la pagina riempie almeno tutta l'altezza dello schermo */
html, body { min-height: 100%; }
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > .app { flex: 1 0 auto; width: 100%; box-sizing: border-box; }
body > .ek-foot, body > #ek-footer { flex: none; margin-top: auto; }
/* 1.15.0: footer comune e banner cookie di EK Shared dentro le regole generali dei campi */
body > #ek-footer { width: 100%; }
.ekc-prefs label { flex-direction: row; align-items: center; text-align: left; }
.ekc-prefs input[type="checkbox"] { width: auto; height: auto; min-height: 0; flex: none; margin: 0; padding: 0; }

/* Piè di pagina compatto (stesso di EK Admin): una riga con marchio, collegamenti, privacy/cookie e versione */
.ek-foot { display: block; width: 100%; max-width: 1360px; margin: auto auto 0; box-sizing: border-box; padding: .55rem 1.5rem .6rem; border-top: 1px solid var(--border); color: var(--text-dim); font-size: .78rem; text-align: center; }
.ek-foot a { color: var(--text-dim); text-decoration: none; }
.ek-foot a:hover { color: var(--accent); }
.ek-foot .hf-line { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; text-align: center; gap: .3rem 1.1rem; }
.ek-foot .hf-brand { display: flex; align-items: center; color: var(--text); font-weight: 800; font-size: .95rem; letter-spacing: .01em; margin-right: .2rem; }
.ek-foot .hf-brand .brand span { color: var(--accent); }
.ek-foot .hf-brand img, .ek-foot .hf-brand .brand-logo { height: 20px; width: auto; max-width: 120px; object-fit: contain; display: block; }
.ek-foot .hf-links, .ek-foot .hf-legal { display: flex; flex-wrap: wrap; gap: .1rem .9rem; align-items: center; justify-content: center; }
.ek-foot .hf-legal { padding-left: .9rem; border-left: 1px solid var(--border); }
.ek-foot .hf-legal:empty { display: none; }
.ek-foot .hf-soc, .ek-foot .hf-meta { margin-top: 2px; line-height: 1.4; opacity: .8; text-align: center; }
.ek-foot .hf-soc[hidden] { display: none; }
.ek-foot .hf-soc { margin-top: .35rem; }
@media (max-width: 700px) { .ek-foot { padding: .5rem 1rem; } .ek-foot .hf-links { display: none; } .ek-foot .hf-legal { border-left: 0; padding-left: 0; }  }
.ek-foot .hf-brand .brand { margin-bottom: 0; }

/* 1.9.0: manutenzione (fase 2). Fascia per chi lavora durante la manutenzione
   e messaggio al posto delle pagine per tutti gli altri (stesso aspetto della
   pagina di manutenzione di EK Shared). */
.maint-bar { background: rgba(245, 158, 11, 0.16); border-bottom: 1px solid rgba(245, 158, 11, 0.45); color: #fde68a; text-align: center; font-size: 0.88rem; padding: 0.45rem 16px; }
.maint-bar strong { color: var(--warn); }
.maint-bar a { color: #fde68a; text-decoration: underline; }
.maint-view { min-height: 62vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 3rem 16px; }
.maint-view p { color: var(--text-dim); margin: 0.2em 0; }
.maint-view .maint-brand { font-size: 1.9rem; margin: 0 0 1rem; }
.maint-view .maint-brand .brand-logo { max-height: 56px; }
.maint-dots { display: flex; gap: 10px; margin-bottom: 1.2rem; }
.maint-dots span { width: 12px; height: 12px; border-radius: 50%; opacity: 0.2; animation: maint-blink 1.8s infinite; }
.maint-dots span:nth-child(1) { background: #e03020; }
.maint-dots span:nth-child(2) { background: #f0f0f0; animation-delay: 0.3s; }
.maint-dots span:nth-child(3) { background: var(--accent); animation-delay: 0.6s; }
@keyframes maint-blink { 0%, 60%, 100% { opacity: 0.2; } 20%, 40% { opacity: 1; } }
.maint-view .maint-more { margin-top: 0.8rem; }
.maint-cd { margin-top: 1.6rem; }
.maint-cd-box { display: flex; gap: 10px; justify-content: center; margin-top: 0.4rem; }
.maint-cd-box div { min-width: 3.6rem; padding: 0.5rem 0.3rem; border: 1px solid #1e2b45; border-radius: 12px; background: rgba(15, 23, 42, 0.6); }
.maint-cd-box b { display: block; font-size: 1.6rem; font-variant-numeric: tabular-nums; color: var(--text); }
.maint-cd-box span { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; }
.maint-view .maint-small { font-size: 0.85rem; margin-top: 0.6rem; }
.maint-view .maint-sign { margin-top: 1.6rem; }
.maint-view .maint-staff { margin-top: 2.2rem; font-size: 0.85rem; }
.maint-view .maint-staff a { color: var(--text-dim); }
/* Accesso nascosto dello staff (tenere premuto 2 s sulla versione): nessun segno visibile, niente selezione
   del testo ne' menu del telefono; il puntatore resta quello del testo accanto. */
#verFoot .ek-ver, #verFoot > span, #ek-footer .ek-ver { cursor: text; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: none; white-space: nowrap; } /* 1.37.0: la versione su una riga (a 320 px andava a capo a meta' e la pressione di 3 s poteva cadere fuori) */
@media (prefers-reduced-motion: reduce) { .maint-dots span { animation: none; opacity: 1; } }
/* 1.9.1: nome del prodotto (LIQUIDlevel, HACCPstamp, ...) davanti al seriale nelle etichette dei dispositivi */
.chip .chip-prod { font-weight: 700; color: var(--accent); margin-right: 0.35rem; }

/* 1.13.0: archivio delle stampe di HACCPstamp */
.print-modal { position: relative; margin: 0; width: min(760px, 100%); max-height: calc(100vh - 2rem); overflow-y: auto; }
.print-text { margin: 0; padding: .8rem 1rem; background: var(--bg); border: 1px solid var(--border); border-radius: 10px; font: .85rem/1.45 ui-monospace, Consolas, "Courier New", monospace; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow-y: auto; color: var(--text); }
.print-table td { vertical-align: middle; }
.print-preview { max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, Consolas, monospace; font-size: .82rem; color: var(--text-dim); }
@media (max-width: 700px) { .print-preview { max-width: 10rem; } }
/* 1.29.0: assistenza remota, sola lettura, richieste di accesso, Attivita' */
.ass-durate { display: flex; flex-wrap: wrap; gap: .5rem; margin: .7rem 0 .3rem; }
.ass-chi { margin: .3rem 0 0; padding-left: 1.1rem; color: var(--text-dim); font-size: .85rem; }
.ass-chi li { margin: .15rem 0; }
.ro-fascia { display: flex; align-items: center; gap: .8rem; flex-wrap: wrap; border: 1px solid rgba(245,158,11,.35); background: rgba(245,158,11,.08); border-radius: 12px; padding: .7rem .9rem; margin: 1rem 0; }
.ro-fascia-ok { border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.08); }
.ro-fascia p { margin: 0; flex: 1 1 18rem; font-size: .88rem; }
.att-riga td { font-size: .85rem; }
.att-quando { white-space: nowrap; color: var(--text-dim); width: 7.5rem; }
.interruttore { display: flex; gap: .6rem; align-items: flex-start; margin-top: .8rem; font-size: .88rem; }
.interruttore input { width: auto; margin-top: .2rem; flex: none; }
.pallino { display: inline-block; min-width: 1.2rem; padding: 0 .35rem; border-radius: 999px; background: var(--warn); color: #111; font-size: .72rem; font-weight: 700; text-align: center; margin-left: .4rem; vertical-align: middle; }
@media (max-width: 600px) { .att-quando { width: auto; } }
/* 1.29.1: credenziali cloud nella scheda del produttore */
.cred-stato { font-weight: 700; }
.cred-attesa { color: var(--warn); }
.cred-uso { color: #34d399; }
/* 1.30.0: inviti con l'account EK */
.invito-scelta { display: grid; gap: .3rem; margin-bottom: .6rem; }
.invito-form .row-form { display: flex; gap: .5rem; flex-wrap: wrap; align-items: stretch; }
/* pulsante alto come il campo email accanto (segnalazione della regia, 28/11) */
.invito-form .row-form > .btn { height: auto; min-height: 2.6rem; display: inline-flex; align-items: center; justify-content: center; }
.invito-form .row-form input[type=email] { flex: 1 1 16rem; min-width: 0; width: auto; max-width: none; }

/* 1.30.3 (controllo grafico): tabelle a schede, blocco del valore; testo sotto il distintivo; Rinomina staccato dal titolo */
table.rt td > .rt-v { display: contents; }
.riga-sotto { margin-top: .3rem; }
#devTitle .btn { margin-left: .5rem; vertical-align: middle; }
/* 1.30.3: il campo del file prende tutta la riga (prima «Nessun fi…lezionato»); testi lunghi (indirizzi, titoli) vanno a capo
   invece di allargare la pagina (Comunicazioni del produttore scorreva di lato in produzione) */
.card input[type=file] { display: block; width: 100%; max-width: 100%; box-sizing: border-box; }
#commListWrap, .comm-layout, #commListWrap .card { min-width: 0; overflow-wrap: anywhere; }
.comm-layout > * { min-width: 0; }
/* 1.30.3: «Segna letti» alto come una riga del titolo e allineato (Avvisi) */
.alerts-head h1 { margin-bottom: 0; }
.alerts-head { margin-bottom: 1rem; }
.alerts-actions .btn-outline { padding: .45rem .9rem; font-size: .85rem; line-height: 1.2; }
/* 1.30.3: i riquadri delle impostazioni avvisi non hanno margine interno (le righe hanno il loro): al telefono la regola
   generale «.card { padding: 1rem }» lo rimetteva e la colonna dei nomi restava troppo stretta */
.card.pref-top, .card.pref-group { padding: 0; }
@media (max-width: 360px) { .pref-grid-head, .pref-line { grid-template-columns: minmax(0, 1fr) repeat(4, 38px); } }

/* =================================================================
   1.31.2: TEMA CHIARO / SCURO (PARTI-TEMA di EK Shared, anteprima approvata da Natale il 29/11/2026).
   <html data-theme="light|dark"> lo mette la riga nel <head> (copia locale «ek-tema») e lo cambia il menu dell'account.
   Le variabili di base (--bg, --text, --accent, ...) sono i token comuni --ekt-*: cambiano da sole. Qui sotto solo cio'
   che nello scuro e' scritto a mano: nel chiaro prende i token della palette misurata di EK Shared (testo #0f172a,
   secondario #475569, azzurro #0369a1 col bianco, ok #047857, attenzione #b45309 / #92400e, guasto #b91c1c).
   Misura dei contrasti: 3_test-e-script\tema-1.31 (anteprima) e prova della 1.31.2.
   ================================================================= */
/* segnaposto dei campi in tutti e due i temi (scuro: il grigio del browser faceva 3,95:1) */
::placeholder { color: var(--ekt-placeholder, #94a3b8); opacity: 1; }

:root[data-theme="light"] { --page: var(--ekt-page, #f4f6fa); --danger-pieno: var(--ekt-danger, #b91c1c); --danger-tx: var(--ekt-danger-tx, #b91c1c); --danger-bg: var(--ekt-danger-bg, #fee2e2); }
/* 1.37.0: ripieghi CHIARI di tutte le variabili, per quando ek-theme.css di EK Shared non arriva (EK Shared fermo): prima nel chiaro
   restavano i ripieghi scuri (testo bianco su fondo chiaro, «EK» invisibile nella pagina di manutenzione). Con ek-theme.css
   valgono i suoi --ekt-* (stessi valori del chiaro comune). */
:root[data-theme="light"] { color-scheme: light; --bg: var(--ekt-inner, #f1f5f9); --bg-elevated: var(--ekt-card, #ffffff); --bg-card: var(--ekt-card, #ffffff); --border: var(--ekt-border, rgba(15, 23, 42, 0.12)); --border-hover: var(--ekt-border-hover, rgba(15, 23, 42, 0.24)); --text: var(--ekt-text, #0f172a); --text-dim: var(--ekt-dim, #475569); --accent: var(--ekt-accent, #0369a1); --accent-dim: var(--ekt-accent-dim, #0369a1); --accent-glow: var(--ekt-glow, rgba(3, 105, 161, 0.16)); --ok: var(--ekt-ok, #047857); --warn: var(--ekt-warn, #b45309); --danger: var(--ekt-danger, #b91c1c); --on-accent: var(--ekt-on-accent, #ffffff); }
:root[data-theme="light"] .maint-dots span:nth-child(2) { background: #94a3b8; }
:root[data-theme="light"] .maint-bar, :root[data-theme="light"] .maint-bar a { color: #92400e; }
:root[data-theme="light"] html, html[data-theme="light"] { background: var(--ekt-page, #f4f6fa); }
html[data-theme="light"] body { background: radial-gradient(1200px 500px at 50% -10%, rgba(3, 105, 161, .07), transparent 60%), var(--ekt-page, #f4f6fa); }

/* superfici */
:root[data-theme="light"] .topbar { background: rgba(255, 255, 255, .94); border-bottom: 1px solid var(--border); box-shadow: none; }
:root[data-theme="light"] .pad { box-shadow: var(--ekt-card-shadow); }
:root[data-theme="light"] .pad:hover, :root[data-theme="light"] .pad:focus-visible { border-color: rgba(3, 105, 161, .45); box-shadow: 0 14px 30px -12px rgba(3, 105, 161, .3); }
:root[data-theme="light"] .pad-ico { background: var(--ekt-info-bg); color: var(--ekt-info-tx); }
:root[data-theme="light"] .pad-on { border-top-color: var(--ekt-ok); }
:root[data-theme="light"] .pad-off { border-top-color: var(--ekt-control-off); }
:root[data-theme="light"] input:not([type=checkbox]):not([type=radio]):not([type=range]), :root[data-theme="light"] select, :root[data-theme="light"] textarea { background: #ffffff; color: var(--ekt-text); border-color: rgba(15, 23, 42, .2); }
:root[data-theme="light"] .modal-overlay, :root[data-theme="light"] .login-modal-wrap { background: var(--ekt-veil); }
:root[data-theme="light"] .toast { box-shadow: var(--ekt-shadow); }
:root[data-theme="light"] .home-section:nth-of-type(odd) { background: var(--ekt-surface-2); }
:root[data-theme="light"] .hero-img { box-shadow: var(--ekt-card-shadow); }
:root[data-theme="light"] .demo-created code { background: var(--ekt-surface-2); }

/* pulsanti: testo bianco sull'azzurro scuro (5,9:1) */
:root[data-theme="light"] .btn { box-shadow: 0 4px 12px rgba(3, 105, 161, .22); }
:root[data-theme="light"] .btn-outline, :root[data-theme="light"] .btn-ghost { color: var(--ekt-accent); background: #ffffff; border-color: rgba(3, 105, 161, .45); }
:root[data-theme="light"] .btn-outline:hover { background: var(--ekt-hover); }
:root[data-theme="light"] .btn-danger { box-shadow: none; }

/* distintivi, chip, etichette */
:root[data-theme="light"] .badge-online, :root[data-theme="light"] .badge-read_write { background: var(--ekt-ok-bg); color: var(--ekt-ok-tx); }
:root[data-theme="light"] .badge-offline { background: #e2e8f0; color: #334155; }
:root[data-theme="light"] .badge-pending, :root[data-theme="light"] .badge-read { background: var(--ekt-warn-bg); color: var(--ekt-warn-tx); }
:root[data-theme="light"] .tag, :root[data-theme="light"] .chip { background: var(--ekt-info-bg); color: var(--ekt-info-tx); }
:root[data-theme="light"] .chip .dot { background: var(--ekt-control-off); }
:root[data-theme="light"] .chip .dot.on { background: var(--ekt-ok); }
:root[data-theme="light"] .chip-x:hover { background: var(--ekt-danger-bg); color: var(--ekt-danger-tx); }
:root[data-theme="light"] .pallino { background: var(--ekt-warn); color: #ffffff; }
:root[data-theme="light"] .smtp-chip { background: var(--ekt-info-bg); }
:root[data-theme="light"] .smtp-chip:hover { background: var(--ekt-hover); }
:root[data-theme="light"] .smtp-esito { background: var(--ekt-surface-2); }
:root[data-theme="light"] .smtp-esito.ok { background: #ecfdf5; border-color: rgba(4, 120, 87, .35); }
:root[data-theme="light"] .smtp-esito.ko { background: #fef2f2; border-color: rgba(185, 28, 28, .4); }
:root[data-theme="light"] .demo-created { background: #ecfdf5; border-color: rgba(4, 120, 87, .35); }

/* menu in alto (riquadri), menu dell'account del sito, sotto-menu, telefono */
:root[data-theme="light"] .nav, :root[data-theme="light"] .home-subnav { background: rgba(255, 255, 255, .9); }
:root[data-theme="light"] .nav a, :root[data-theme="light"] .nav-group-btn, :root[data-theme="light"] .nav-tiles .nt,
:root[data-theme="light"] .home-subnav.nav-tiles a.nt, :root[data-theme="light"] .topbar-right .acct-menu .nt { color: #334155; background-color: #ffffff; }
:root[data-theme="light"] .nav a:hover, :root[data-theme="light"] .nav-group-btn:hover, :root[data-theme="light"] .nav a.active,
:root[data-theme="light"] .nav-group.active > .nav-group-btn, :root[data-theme="light"] .nav-tiles .nt.active,
:root[data-theme="light"] .nav-tiles .nav-group.active > .nt, :root[data-theme="light"] .nav-tiles .nt:hover,
:root[data-theme="light"] .nav-tiles .nav-group:hover > .nt, :root[data-theme="light"] .nav-tiles .nav-group.open > .nt,
:root[data-theme="light"] .nav-tiles .acct.open > .nt, :root[data-theme="light"] .home-subnav a:hover,
:root[data-theme="light"] .home-subnav.nav-tiles a.nt:hover, :root[data-theme="light"] .topbar-right .acct-menu .nt:hover { color: var(--ekt-accent); background: var(--ekt-hover); border-color: rgba(3, 105, 161, .45); box-shadow: none; }
:root[data-theme="light"] .nav-menu, :root[data-theme="light"] .nav-tiles .nav-menu .nt, :root[data-theme="light"] .acct-menu,
:root[data-theme="light"] .mega { background: var(--ekt-menu-bg); box-shadow: var(--ekt-shadow); }
:root[data-theme="light"] .acct-btn { background: #ffffff; }
:root[data-theme="light"] .acct-menu a:hover, :root[data-theme="light"] .acct-menu button:hover { background: var(--ekt-hover); }
:root[data-theme="light"] .acct-avatar, :root[data-theme="light"] .more-avatar, :root[data-theme="light"] .more-user em { background: var(--ekt-info-bg); color: var(--ekt-info-tx); }
:root[data-theme="light"] .acct-text small { color: var(--ekt-info-tx); }
:root[data-theme="light"] .more-tile { color: var(--ekt-text); }
:root[data-theme="light"] .mega .more-row:hover { background: var(--ekt-hover); }
:root[data-theme="light"] .more-row + .more-row, :root[data-theme="light"] .pref-row + .pref-row, :root[data-theme="light"] .pref-line,
:root[data-theme="light"] .diag-row { border-top-color: rgba(15, 23, 42, .08); }
:root[data-theme="light"] .more-logout { color: var(--ekt-danger-tx); border-color: rgba(185, 28, 28, .45); }
:root[data-theme="light"] body.has-tabs .mobtabs { background: rgba(255, 255, 255, .97); border-top: 1px solid var(--border); }
:root[data-theme="light"] .mobtabs a { color: var(--ekt-dim); }
:root[data-theme="light"] .mobtabs a.on { color: var(--ekt-accent); }

/* tabelle a schede al telefono */
:root[data-theme="light"] .app table.rt tr { background: var(--ekt-surface-2); }
:root[data-theme="light"] .app table.rt td { border-bottom-color: rgba(15, 23, 42, .07); }
:root[data-theme="light"] .row-selected td { background: var(--ekt-info-bg); }

/* impostazioni degli avvisi */
:root[data-theme="light"] .lv-critical { background: var(--ekt-danger-bg); color: var(--ekt-danger-tx); }
:root[data-theme="light"] .lv-important { background: var(--ekt-warn-bg); color: var(--ekt-warn-tx); }
:root[data-theme="light"] .lv-info { background: var(--ekt-info-bg); color: var(--ekt-info-tx); }
:root[data-theme="light"] .pcheck i { border-color: var(--ekt-control-off); }
:root[data-theme="light"] .sw span { background: var(--ekt-control-off); }
:root[data-theme="light"] .sw span::after { background: #ffffff; box-shadow: 0 1px 3px rgba(15, 23, 42, .3); }
:root[data-theme="light"] .sw input:checked + span { background: var(--ekt-accent); }

/* fasce, avvisi, diagnostica, colori di stato scritti a mano */
:root[data-theme="light"] .maint-bar { background: var(--ekt-warn-bg); color: var(--ekt-warn-tx); border-bottom-color: rgba(180, 83, 9, .35); }
:root[data-theme="light"] .maint-bar strong, :root[data-theme="light"] .maint-bar a { color: var(--ekt-warn-tx); }
:root[data-theme="light"] .maint-dots span:nth-child(2) { background: #94a3b8; }
:root[data-theme="light"] .maint-cd-box div { background: #ffffff; border-color: var(--border); }
:root[data-theme="light"] .note { background: #fffbeb; border-color: rgba(180, 83, 9, .35); color: var(--ekt-text); }
:root[data-theme="light"] .contact-placeholder-note { background: #fffbeb; border-color: rgba(180, 83, 9, .35); color: var(--ekt-warn-tx); }
:root[data-theme="light"] .ekadm-req { background: #fffbeb; }
:root[data-theme="light"] .ro-fascia { background: #fffbeb; }
:root[data-theme="light"] .ro-fascia-ok { background: #ecfdf5; border-color: rgba(4, 120, 87, .35); }
:root[data-theme="light"] .dash-lost { background: #fef2f2; border-color: rgba(185, 28, 28, .4); }
:root[data-theme="light"] .dash-lost.dash-lost-fissa { background: rgba(254, 242, 242, .97); box-shadow: var(--ekt-shadow); }
:root[data-theme="light"] .dash-lost strong, :root[data-theme="light"] .diag-row.lv2 .diag-l, :root[data-theme="light"] .smtp-ko { color: var(--ekt-danger-tx); }
:root[data-theme="light"] .diag-row.lv1 .diag-l, :root[data-theme="light"] .smtp-warn { color: var(--ekt-warn); }
:root[data-theme="light"] .smtp-ok, :root[data-theme="light"] .cred-uso { color: var(--ekt-ok-tx); }
/* 1.35.1: selezione ed eliminazione di Messaggi e Avvisi (montaSelezione in app.js) */
.alerts-actions { flex-wrap: wrap; }
.btn-outline.btn-outline-danger { color: var(--danger-tx); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.sel-on [data-sel] { position: relative; padding-left: 52px !important; cursor: pointer; user-select: none; }
.sel-on [data-sel]::before {
  content: ""; position: absolute; left: 16px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%);
  border: 2px solid var(--text-dim); border-radius: 7px; background: transparent; box-sizing: border-box;
}
.sel-on [data-sel].sel { border-color: var(--accent); }
.sel-on [data-sel].sel::before {
  border-color: var(--accent); background: var(--accent) no-repeat center / 14px 14px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b1120' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}
.sel-on [data-sel]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sel-on .alert-item .alert-dot { display: none; }
.sel-bar {
  position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 70;
  display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100% - 24px); box-sizing: border-box;
  padding: 10px 12px; border-radius: 16px; background: var(--bg-card); border: 1px solid var(--border-hover);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35); backdrop-filter: blur(10px);
}
.sel-bar [data-n] { color: var(--text-dim); font-size: .88rem; white-space: nowrap; margin-right: 4px; }
.sel-bar .btn, .sel-bar .btn-outline { padding: .5rem .9rem; font-size: .88rem; white-space: nowrap; }
.sel-bar .btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
body.has-tabs .sel-bar { bottom: calc(68px + env(safe-area-inset-bottom)); }
@media (max-width: 380px) { .sel-bar { gap: 6px; padding: 8px; } .sel-bar [data-n] { font-size: .8rem; } .sel-bar .btn, .sel-bar .btn-outline { padding: .45rem .7rem; } }
:root[data-theme="light"] .sel-bar { box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18); }
:root[data-theme="light"] .btn-outline.btn-outline-danger { color: #b42318; }
:root[data-theme="light"] .sel-on [data-sel].sel::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
/* 1.37.0: «avviso a tutti» della pagina di emergenza: striscia in cima al sito */
.ek-avviso-tutti { position: sticky; top: 0; z-index: 1100; padding: 10px 16px; background: #b45309; color: #fff; font-weight: 600; font-size: 14px; line-height: 1.4; text-align: center; overflow-wrap: anywhere; }
/* 1.37.1: finestra separata della scheda (solo l'interfaccia) e avviso se il browser la blocca */
body.ek-finestra #topbar, body.ek-finestra #verFoot, body.ek-finestra #ek-footer, body.ek-finestra #mobTabs, body.ek-finestra .maint-bar { display: none !important; }
body.ek-finestra .app { padding-top: .6rem; }
.finestra-bar { position: sticky; top: 0; z-index: 1000; display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .55rem 16px; background: var(--bg-card); border-bottom: 1px solid var(--border); }
.finestra-bar .fb-nome { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.finestra-bar .fb-nome strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finestra-bloccata { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 2000; display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; max-width: 640px; margin: 0 auto; padding: .8rem 1rem; border-radius: 14px; background: var(--page); border: 1px solid var(--warn); color: var(--text); box-shadow: 0 12px 30px -10px rgba(0,0,0,.5); }
@media (max-width: 767px) { .finestra-bloccata { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); } } /* sopra la barra dei menu del telefono */
/* 1.38.0 (chiusura del pannello): striscia dello staff EK nell'area Dispositivi, con «Torna al pannello» */
.banda-staff { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem; max-width: 1200px; margin: .8rem auto 0; padding: .6rem 1rem; border-radius: 12px; background: var(--bg-card); border: 1px solid var(--border); border-left: 3px solid var(--accent); color: var(--text); font-size: .92rem; }
.banda-staff span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 767px) { .banda-staff { margin: .6rem 16px 0; } }
body.ek-finestra .banda-staff { display: none !important; }
