/* === Inter (variable, romano 100-900) =====================================
   Font self-hosted, dichiarazione speculare a quella di app/css/theme/core.css
   (stessi src e descriptor). Il path relativo risale da assets/css/ alla copia
   canonica del woff2 in app/css/theme/fonts/inter/. DUE bust distinti: quello
   via assetV() in index.php copre SOLO questo CSS ospite; il `?v=20260822` sui
   woff2 è MANUALE, da incrementare a ogni cambio dei file font (in PROD
   l'.htaccess serve i font immutable per 1 anno) — come in core.css. */
@font-face {
    font-family: 'Inter';
    src: url('../../app/css/theme/fonts/inter/Inter-roman.woff2?v=20260822') format('woff2-variations'),
         url('../../app/css/theme/fonts/inter/Inter-roman.woff2?v=20260822') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
  --water-50: #F5FBFF;
  --water-100: #EAF7FF;
  --water-200: #CFEFFF;
  --water-300: #8ED8FF;
  --water-400: #34BEEF;
  --water-500: #0B8FD3;
  --water-700: #075B8A;
  --mido-red: #E72D3F;
  --mido-red-dark: #C91F31;
  --navy: #13233A;
  --text-main: #17243A;
  /* Muted scurito da #6B7C93 (misurato ~3.9:1 sulla card glass, ~4.2:1 sul fondo
     azzurrino = sotto AA) a #4E5C70 (~6.8:1 su bianco, ~5.3:1 sul fondo azzurrino):
     ben oltre WCAG AA 4.5:1 per il testo normale (subtitle sotto il titolo, label
     opzioni, divider), restando comunque "muted" rispetto ai titoli navy. */
  --text-muted: #4E5C70;
  --glass-white: rgba(255, 255, 255, 0.74);
  --glass-border: rgba(142, 216, 255, 0.45);

  /* Anello di focus: tinta PIENA (non rgba tenue) per garantire >=3:1 sul vetro
     chiaro — WCAG 2.2 §2.4.13. Il vecchio rgba(52,190,239,.34) misurava 1.3:1. */
  --focus-ring: #0B8FD3;

  /* Easing unificato Material-style: usato in tutte le micro-interazioni
     della login per coerenza di "feel". I valori cubic-bezier(0.4, 0, 0.2, 1)
     danno una decelerazione naturale (out-cubic-like) gradevole su elementi UI. */
  --ease-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.6, 1);

  /* Accenti semantici dei metric card (palette idro-coerente, tutti
     desaturati e armoniosi). Ogni card seleziona il proprio --metric-accent. */
  --accent-network:  rgba(11, 143, 211, 0.55);   /* teal --water-500 */
  --accent-water:    rgba(34, 184, 198, 0.55);   /* aqua-cyan */
  --accent-alerts:   rgba(212, 150, 40, 0.62);   /* muted amber */
  --accent-battery:  rgba(34, 160, 107, 0.55);   /* muted green */
  --accent-pressure: rgba(81, 101, 204, 0.55);   /* muted indigo */
  --accent-coverage: rgba(122, 85, 196, 0.55);   /* muted purple */
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--water-50);
}

body.login-body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text-main);
  font-family: Inter, system-ui, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
  /* Rendering tipografico crisp (raffinamento 2026-05-30): antialias coerente
     cross-OS + optical sizing di Inter variable + legibility. Senza, su Windows
     i pesi alti apparivano leggermente "impastati". */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  background-color: var(--water-50);
  background-image:
    linear-gradient(112deg, rgba(245, 251, 255, 0.97) 0%, rgba(234, 247, 255, 0.9) 34%, rgba(207, 239, 255, 0.72) 100%),
    url("../img/login/login-bg-water-tech.png");
  background-image:
    linear-gradient(112deg, rgba(245, 251, 255, 0.97) 0%, rgba(234, 247, 255, 0.9) 34%, rgba(207, 239, 255, 0.72) 100%),
    image-set(
      url("../img/login/login-bg-water-tech.webp") type("image/webp"),
      url("../img/login/login-bg-water-tech.png") type("image/png")
    );
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
}

body.login-body::before,
body.login-body::after {
  position: fixed;
  z-index: -2;
  pointer-events: none;
  content: "";
}

body.login-body::before {
  /* Inset -120px dà spazio al transform: così il drift non espone i bordi
     del viewport. Il translate3d sotto resta una micro-deriva (max ±28px/±18px). */
  inset: -120px;
  background:
    radial-gradient(circle at 76% 18%, rgba(52, 190, 239, 0.28), transparent 30%),
    radial-gradient(circle at 6% 80%, rgba(142, 216, 255, 0.3), transparent 28%),
    radial-gradient(circle at 92% 86%, rgba(11, 143, 211, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.12));
  /* Aurora drift: i blob radial si spostano lentissimamente (90s) creando
     un fondo "vivo" senza essere percepibile a livello cosciente. */
  animation: auroraDrift 90s ease-in-out infinite;
}
/* will-change SOLO quando l'animazione gira davvero: il blocco globale
   prefers-reduced-motion più sotto congela animation-duration a 0.01ms ma
   NON rimuove will-change -- lasciato permanente terrebbe il layer promosso
   a compositing anche a movimento fermo, per chi ha chiesto di non vederlo. */
@media (prefers-reduced-motion: no-preference) {
  body.login-body::before {
    will-change: transform;
  }
}

body.login-body::after {
  inset: 0;
  opacity: 0.13;
  background-image:
    radial-gradient(circle, rgba(7, 91, 138, 0.42) 1px, transparent 1px),
    linear-gradient(120deg, transparent 0%, rgba(11, 143, 211, 0.08) 48%, transparent 49%);
  background-size: 30px 30px, 480px 480px;
  background-position: 0 0, 100% 0;
}


button,
input,
a {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 12px;
  color: #fff;
  background: var(--water-700);
  transform: translateY(-140%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
  outline: 3px solid rgba(52, 190, 239, 0.45);
}

/* Testo riservato agli screen reader: fuori dallo schermo ma NON nascosto
   all'albero di accessibilità (niente display:none / visibility:hidden, che
   toglierebbero anche l'annuncio). Usato dalla regione di stato del login. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  border: 0;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Il form è il bersaglio dello skip-link (tabindex="-1"): quando riceve il focus
   da tastiera deve rendersene conto anche chi vede (WCAG 2.4.7). Solo
   :focus-visible, così un click sul vetro della card non disegna l'anello. */
#loginForm:focus-visible {
  border-radius: 18px;
  outline: 3px solid var(--focus-ring);
  outline-offset: 10px;
}

.login-page {
  position: relative;
  display: grid;
  grid-template-columns: minmax(420px, 42%) minmax(0, 58%);
  /* Riga contenuto (1fr, riempie) + riga footer (auto, ancorata in basso).
     Le 2 colonne stanno in riga 1; il footer (grid-column 1/-1) va in riga 2. */
  grid-template-rows: 1fr auto;
  min-height: 100vh;
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  padding: 22px 0 24px;
  isolation: isolate;
}

.ambient-layer {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient-grid {
  position: absolute;
  right: 3%;
  top: 10%;
  width: 290px;
  height: 290px;
  opacity: 0.22;
  background-image: radial-gradient(circle, rgba(7, 91, 138, 0.42) 1.5px, transparent 2px);
  background-size: 18px 18px;
  mask-image: linear-gradient(120deg, transparent, #000 20%, #000 80%, transparent);
}

/* SVG vettoriale animato: 3 curve dashed sottili attraversano la pagina,
   piccoli alone luminosi viaggiano lungo le curve via <animateMotion>.
   Sostituisce i vecchi decoratori (.ambient-line / .data-path con dot rossi
   terminali) con qualcosa di più coerente alla metafora flusso-dati NB-IoT. */
.ambient-flow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.95;
  /* Leggera saturazione per portare i blu in primo piano senza colori "stridenti" */
  filter: saturate(1.08);
}

/* Le curve "scorrono": stroke-dashoffset animato -> i trattini viaggiano lungo
   il path, trasformando le linee in TUBAZIONI / FLUSSI-DATI vivi. E' la metafora
   centrale del portale (acqua che scorre nei tubi = dati nella rete NB-IoT):
   prima la traccia era fissa, ora la rete "respira" il flusso. Direzione = quella
   del path (coerente coi dot viaggianti). Period = 14 (dasharray 4+10) per loop
   seamless. linear + GPU-friendly (repaint vettoriale minimo su poche path). */
.ambient-flow .flow-line {
  animation: flowDash 2.1s linear infinite;
}

@keyframes flowDash {
  to { stroke-dashoffset: -14; }
}

/* Le thin hanno period 10 (dasharray 2+8) e scorrono più lente (depth). */
@keyframes flowDashThin {
  to { stroke-dashoffset: -10; }
}

/* Alone luminosi che viaggiano lungo i path: aggiungiamo una pulsazione di
   opacità molto lenta per simulare il respiro di un nodo connesso. */
.ambient-flow .flow-glow {
  animation: flowPulse 6.4s ease-in-out infinite;
  filter: drop-shadow(0 0 6px rgba(52, 190, 239, 0.55));
}

.ambient-flow .flow-glow:nth-of-type(2) { animation-delay: -2.1s; }
.ambient-flow .flow-glow:nth-of-type(3) { animation-delay: -4.3s; }

/* Alone "small": versione ridotta per il secondo layer (path opposite-dir).
   Stesso tipo di animazione ma più rapida + meno brillante. */
.ambient-flow .flow-glow-sm {
  animation: flowPulse 4.8s ease-in-out infinite;
  filter: drop-shadow(0 0 4px rgba(52, 190, 239, 0.45));
  opacity: 0.78;
}

/* Path "thin" del secondo layer: più tenui per non rubare scena al primo */
.ambient-flow .flow-line-thin {
  opacity: 0.68;
  /* Override del flowDash di .flow-line (stessa specificità, questa regola viene
     dopo): period 10 + durata maggiore = flusso più lento sul layer di fondo. */
  animation: flowDashThin 2.7s linear infinite;
}

/* Ping nodes: stazioni di rete che pulsano. Il core è un punto fisso,
   l'anello si espande + svanisce in 4.5-5.2s (gestito via SMIL inline). */
.ambient-flow .ping-core {
  filter: drop-shadow(0 0 6px rgba(52, 190, 239, 0.7));
}

.ambient-flow .ping-ring {
  /* Solo la geometria - l'animazione è SMIL inline nel markup */
}

/* Gocce d'acqua che salgono: alone tenue acqua. Moto/opacità via SMIL inline. */
.ambient-flow .flow-droplet {
  filter: drop-shadow(0 0 5px rgba(142, 216, 255, 0.6));
}

.ambient-waves {
  position: absolute;
  left: 50%;
  bottom: -68px;
  width: 112%;
  min-width: 1080px;
  max-width: none;
  opacity: 0.58;
  transform: translateX(-50%);
  animation: waveDrift 18s ease-in-out infinite alternate;
}

.login-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  max-width: 560px;
  padding: 16px 0 16px 8px;
}

.brand-header {
  position: absolute;
  top: 0;
  left: 8px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  width: 184px;
  min-height: 54px;
  text-decoration: none;
}

.brand-logo img {
  width: 184px;
  height: auto;
  transition: transform 0.3s var(--ease-out), filter 0.3s var(--ease-out);
}

/* Hover sul logo: micro scale + drop-shadow brand. Subtle invito a click. */
.brand-logo:hover img {
  transform: scale(1.02);
  filter: drop-shadow(0 4px 14px rgba(231, 45, 63, 0.22));
}

.hero-copy {
  margin-top: 50px;
  margin-bottom: 20px;
  animation: contentIn 0.72s ease both;
}

/* Pill chip "status badge": glass background + hairline + uppercase mono-ish.
   Da' all'eyebrow il peso di un "tag operativo" invece che testo orfano. */
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px;
  margin: 0 0 18px;
  border: 1px solid rgba(142, 216, 255, 0.45);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(234, 247, 255, 0.5));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 4px 12px -2px rgba(7, 91, 138, 0.08);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--water-700);
  font-size: 12px;
  font-weight: 700;
  /* Tracking ampio sull'uppercase piccolo: le maiuscole strette hanno bisogno
     di respiro per leggersi "premium" (0.09em vs 0.04em). */
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.eyebrow img {
  width: 16px;
  height: 16px;
}

.hero-copy h1 {
  max-width: 540px;
  margin: 0;
  color: var(--navy);
  font-size: 52px;
  font-weight: 800;
  line-height: 1.02;
  /* Tracking negativo sul display grande: a 52px le lettere a tracking 0
     sembrano "sciolte"; -0.022em le compatta dando un'aria editoriale. */
  letter-spacing: -0.022em;
}

.hero-copy h1 span {
  display: block;
  /* Effetto "carattere": riempimento a gradiente verticale rosso brand ->
     rosso scuro (depth sottile sulla parola accento). color = fallback per
     browser senza background-clip:text. */
  color: var(--mido-red);
  background: linear-gradient(180deg, var(--mido-red) 0%, var(--mido-red-dark) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Underline "calligrafico" sotto l'accento rosso. Si traccia da sx all'entry
   (1.2s con delay 0.6s), poi resta. Largo 84px sotto la prima riga visibile. */
.hero-copy h1 .hero-accent {
  position: relative;
  display: inline-block;
}

.hero-copy h1 .hero-accent::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -10px;
  width: 84px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mido-red) 0%, var(--mido-red-dark) 65%, rgba(231, 45, 63, 0) 100%);
  box-shadow: 0 4px 10px rgba(231, 45, 63, 0.32);
  /* Ancoraggio a SINISTRA sulla regola dell'elemento (non solo nel keyframe): così
     l'underline si traccia da sx anche quando l'animazione è disabilitata/instant. */
  transform-origin: left center;
  animation: accentDraw 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.6s both;
}

.hero-subtitle {
  max-width: 510px;
  margin: 14px 0 0;
  color: var(--text-muted);
  font-size: 17px;
  line-height: 1.5;
}

.login-card {
  width: min(100%, 532px);
  padding: 34px 40px 30px;
  animation: cardIn 0.76s 0.08s ease both;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

/* La card "ascolta" il focus dei campi: accento teal chiaramente percepibile
   mentre si scrive (anello ~16% su bianco + bordo più deciso). */
.login-card:focus-within {
  border-color: rgba(11, 143, 211, 0.55);
  box-shadow:
    0 18px 44px rgba(11, 143, 211, 0.16),
    0 0 0 4px rgba(11, 143, 211, 0.12);
}

/* Avviso BLOC MAIUSC sotto il campo password (mostrato da login-modern.js).
   Tonale warning, niente rosso: non è un errore, è un'avvertenza. */
/* L'attributo [hidden] da solo non basta: .caps-hint{display:flex} (regola autore)
   scavalca lo stile UA [hidden]{display:none} per origine, non per specificità.
   Serve il guard esplicito (come .login-error[hidden]); senza, l'avviso BLOC MAIUSC
   resterebbe sempre a schermo. */
.caps-hint[hidden] { display: none; }

.caps-hint {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 7px 2px 0;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: #9a6a00;
}
.caps-hint span {
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.16);
  border: 1px solid rgba(245, 158, 11, 0.45);
  font-size: 0.7rem;
}

/* LED verde "vivo" accanto a Connesso (Stato Rete): pulsazione SOLO opacity
   (niente box-shadow animata — regola LED del progetto). */
.metric-network strong::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: #22A06B;
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.16);
  vertical-align: 1px;
  animation: netLed 2.6s ease-in-out infinite;
}
@keyframes netLed {
  0%, 100% { opacity: 1; }
  55%      { opacity: 0.45; }
}
@media (prefers-reduced-motion: reduce) {
  .metric-network strong::before { animation: none; }
}
html.perf-lite .metric-network strong::before { animation: none; }

/* Tick dei valori dashboard: micro-fade quando il numero cambia (JS toggla
   .is-ticking per un attimo). */
#dashTotal, #dashFlow {
  display: inline-block;
  transition: opacity 0.35s ease;
}
#dashTotal.is-ticking, #dashFlow.is-ticking { opacity: 0.35; }

.login-card-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}

.login-card-icon {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 1px solid rgba(142, 216, 255, 0.8);
  border-radius: 50%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(207, 239, 255, 0.72));
  box-shadow:
    0 14px 30px rgba(11, 143, 211, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* Avatar online indicator: piccolo punto verde in basso-destra che pulsa
   come un LED di "sistema attivo". Brand-correct per un portale operator IoT. */
.login-card-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #22A06B;
  border: 2px solid #fff;
  /* Alone STATICO (regola LED del progetto: niente box-shadow animata = niente
     repaint per frame). La "vita" la dà il pulse di transform/opacity qui sotto. */
  box-shadow: 0 0 0 3px rgba(34, 160, 107, 0.16);
  animation: onlinePulse 2.6s var(--ease-in-out) infinite;
}

@keyframes onlinePulse {
  0%, 100% { transform: scale(1);    opacity: 1; }
  60%      { transform: scale(1.18); opacity: 0.72; }
}

.login-card-icon img {
  width: 24px;
  height: 24px;
}

.login-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 25px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.login-card-header p {
  margin: 5px 0 0;
  color: var(--text-muted);
  font-size: 15px;
}

.login-error {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(231, 45, 63, 0.24);
  border-radius: 14px;
  color: #8c1421;
  background: rgba(255, 240, 242, 0.86);
}

.login-error[hidden] {
  display: none;
}

.login-error-mark {
  display: grid;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  background: var(--mido-red);
}

.login-field {
  position: relative;
  margin-bottom: 14px;
}

.login-field label {
  display: block;
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 14px;
  font-weight: 600;
  transition: color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

/* Label reagisce al focus dell'input: cambia colore al water-700 brand */
.login-field:focus-within label {
  color: var(--water-700);
}

.input-shell {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 56px;
  border: 1px solid #D7E8F5;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.78);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.input-shell:focus-within {
  border-color: var(--water-400);
  background: rgba(255, 255, 255, 0.96);
  /* Multi-layer focus: anello tight + glow esteso + hairline interno */
  box-shadow:
    0 0 0 4px rgba(52, 190, 239, 0.18),
    0 0 28px -6px rgba(52, 190, 239, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transform: translateY(-0.5px);
}

.field-icon {
  position: absolute;
  left: 18px;
  width: 18px;
  height: 18px;
  opacity: 0.78;
  transition: opacity 0.2s ease, filter 0.3s ease, transform 0.25s ease;
}

/* Icona reagisce al focus: più marcata + alone teal, e si sposta di 1px
   verso destra come per "consegnare" il fuoco all'input. */
.input-shell:focus-within .field-icon {
  opacity: 1;
  filter: drop-shadow(0 0 6px rgba(52, 190, 239, 0.5));
  transform: translateX(1px);
}

.input-shell input {
  width: 100%;
  height: 56px;
  border: 0;
  outline: none;
  padding: 0 18px 0 50px;
  color: var(--text-main);
  font-size: 16px;
  background: transparent;
}

.input-shell input::placeholder {
  /* Un filo più scuro del precedente rgba(107,124,147,.72): resta chiaramente
     "placeholder" ma più leggibile per ipovedenti. */
  color: rgba(90, 106, 128, 0.82);
}

.input-shell input[aria-invalid="true"] {
  color: #841321;
}

.password-toggle {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  margin-right: 7px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  color: var(--water-700);
  background: transparent;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: rgba(207, 239, 255, 0.64);
}

.password-toggle:focus-visible,
.login-submit:focus-visible,
.support-link:focus-visible,
.form-options a:focus-visible,
.forgot-link:focus-visible,
.dialog-btn:focus-visible,
.brand-logo:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.password-toggle img {
  width: 19px;
  height: 19px;
}

.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  color: var(--text-muted);
  font-size: 14px;
}

.remember-control {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  cursor: pointer;
  user-select: none;
}

.remember-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.remember-box {
  display: grid;
  width: 19px;
  height: 19px;
  place-items: center;
  border: 1px solid rgba(11, 143, 211, 0.32);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  transition: border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.remember-box::after {
  width: 9px;
  height: 5px;
  border-right: 2px solid #fff;
  border-bottom: 2px solid #fff;
  content: "";
  opacity: 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

.remember-control input:checked + .remember-box {
  border-color: var(--water-500);
  background: var(--water-500);
  box-shadow: 0 8px 16px rgba(11, 143, 211, 0.22);
}

.remember-control input:checked + .remember-box::after {
  opacity: 1;
}

.remember-control input:focus-visible + .remember-box {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

.form-options a {
  color: var(--water-700);
  font-weight: 600;
  text-decoration: none;
}

.form-options a:hover {
  text-decoration: underline;
}

/* "Password dimenticata?" è un <button> (apre il dialog di recupero): lo vestiamo
   come il link ma con area di tocco >=24px (WCAG 2.2 §2.5.8) — da <a> alto 17px a
   ~30px col padding verticale, senza spostare il layout (la riga è alta 34px). */
.forgot-link {
  padding: 6px 0;
  border: 0;
  background: transparent;
  color: var(--water-700);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

.forgot-link:hover {
  text-decoration: underline;
}

/* Placeholder link disabilitato: stato grafico onesto + niente effetto hover
   (il click viene già bloccato lato JS, qui togliamo l'affordance) */
.form-options a[aria-disabled="true"],
.support-link[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.62;
}

.form-options a[aria-disabled="true"]:hover {
  text-decoration: none;
}

.support-link[aria-disabled="true"]:hover {
  border-color: var(--water-300);
  background: rgba(255, 255, 255, 0.35);
  transform: none;
}

/* Contrasto WCAG 2.2 SC 1.4.3 (2026-08-10): testo bianco sul RIEMPIMENTO del
   bottone "Accedi" (gradiente 135deg `--mido-red` -> `--mido-red-dark`,
   dichiarato in `.mido-primary-btn` di login-modern-assets.css) misurava
   4.33:1 nel punto più chiaro del gradiente (var(--mido-red) puro, #E72D3F)
   — sotto soglia: 17px/700 non raggiunge la soglia "large text" di WCAG
   (serve >=18.66px bold), quindi vale 4.5:1 pieno, non 3:1.
   Calcolo (luminanza relativa, sRGB->lineare, formula WCAG 1.4.3):
     #E72D3F -> R_lin .7995  G_lin .0262  B_lin .0498 -> L = .1923
     contrasto = (1.00+.05)/(.1923+.05) = 4.33:1   (< 4.5 -> FALLISCE)
   Fix, stessa logica del token `--primary-fill` del theme MiDo: l'ACCENTO
   `--mido-red` resta l'accento ovunque nella pagina (icona hero, sottolineatura
   editoriale, badge numerati — nessuno di questi è dentro questo bottone), e
   solo il RIEMPIMENTO del bottone si scurisce. Le custom property CSS si
   risolvono per cascata sull'ELEMENTO che le consuma, non per foglio di
   provenienza: qui si ridichiara localmente la stessa var che il gradiente di
   `.mido-primary-btn` legge (login-modern-assets.css, file diverso) — il fill
   scurisce senza toccare né l'accento globale né quel file.
     #DC192D -> R_lin .7157  G_lin .0097  B_lin .0262 -> L = .1610
     contrasto = 1.05/.2110 = 4.98:1   (>= 4.6 richiesto, margine incluso)
   Lo stop scuro (`--mido-red-dark` #C91F31, INVARIATO) è già a 5.64:1: non
   serve toccarlo. Ed è anche perché l'hover resta a norma senza altre
   modifiche — `.mido-primary-btn:hover` (login-modern-assets.css) cambia solo
   `box-shadow`/`transform`, mai il `background`. */
.login-submit.mido-primary-btn {
  --mido-red: #DC192D;
}

.login-submit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  min-height: 58px;
  border: 0;
  cursor: pointer;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow: hidden;
  isolation: isolate;
}

/* Shimmer band: scivola da sinistra a destra al passaggio del mouse,
   evocando un "tasto premium" di un'app desktop. */
.login-submit::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg,
    transparent 25%,
    rgba(255, 255, 255, 0.22) 50%,
    transparent 75%);
  transform: translateX(-100%);
  transition: transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
}

.login-submit:hover::before {
  transform: translateX(100%);
}

.login-submit img {
  width: 18px;
  height: 18px;
  filter: brightness(0) invert(1);
  transition: transform 0.2s ease;
  position: relative;
  z-index: 1;
}

.login-submit span {
  position: relative;
  z-index: 1;
}

.login-submit:hover img {
  transform: translateX(3px);
}

/* Micro-press: feedback "premuto" oltre al translateY -2px già dato dal hover */
.login-submit:active:not(:disabled) {
  transform: translateY(0) scale(0.99);
}

.login-submit:disabled {
  cursor: progress;
  opacity: 0.78;
  transform: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner[hidden] {
  display: none;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0 14px;
  color: var(--text-muted);
  font-size: 13px;
}

.login-divider::before,
.login-divider::after {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(142, 216, 255, 0.86), transparent);
  content: "";
}

.login-divider span {
  flex: 0 0 auto;
}

.support-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid var(--water-300);
  border-radius: 16px;
  color: var(--water-700);
  font-weight: 600;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.35);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.support-link:hover {
  border-color: var(--water-400);
  background: linear-gradient(180deg, rgba(234, 247, 255, 0.82), rgba(207, 239, 255, 0.55));
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px rgba(11, 143, 211, 0.25);
}

.support-link:hover img {
  transform: translateX(-2px);
  transition: transform 0.3s var(--ease-out);
}

.support-link img {
  width: 19px;
  height: 19px;
}

.login-visual {
  position: relative;
  min-height: 640px;
  overflow: visible;
}

.visual-stage {
  --parallax-x: 0;
  --parallax-y: 0;
  position: absolute;
  inset: 3% 0 3% -3%;
  min-height: 630px;
  transform: translate3d(calc(var(--parallax-x) * 1px), calc(var(--parallax-y) * 1px), 0);
  transition: transform 0.28s ease-out;
}

.hero-main-device {
  position: absolute;
  display: block;
  right: 0;
  bottom: 2%;
  z-index: 2;
  width: min(760px, 88%);
  border: 0;
  border-radius: 32px;
  overflow: hidden;
  /* Ombra stratificata, raffinata 2026-05-30: ridotta da 6 a 4 layer e resa più
     contenuta (i blur enormi 90/130px davano un alone "drammatico"). Hairline
     interno + halo teal hairline + 2 drop shadow morbidi e ravvicinati. */
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.78),
    0 0 0 1px rgba(142, 216, 255, 0.24),
    0 16px 38px -14px rgba(19, 35, 58, 0.16),
    0 40px 80px -34px rgba(7, 91, 138, 0.2);
}

.hero-main-device::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(245, 251, 255, 0.12), transparent 52%);
  content: "";
  pointer-events: none;
}

.hero-main-device img {
  width: 100%;
  height: auto;
}

.hero-family-device {
  position: absolute;
  display: block;
  top: 3%;
  right: 2%;
  z-index: 3;
  width: 292px;
  border: 1px solid rgba(255, 255, 255, 0.56);
  border-radius: 26px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 2px 6px rgba(7, 91, 138, 0.1),
    0 24px 62px -8px rgba(7, 91, 138, 0.22),
    0 50px 100px -28px rgba(11, 143, 211, 0.2);
}

/* Vignette interna per fondere il fondo bianco/granuloso della foto con il
   tono dell'ambient page. Senza questo, il rettangolo "galleggia stampato". */
.hero-family-device::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    /* Vignette bottom-left che si fonde col panel sottostante */
    radial-gradient(ellipse at 0% 100%, rgba(207, 239, 255, 0.45), transparent 55%),
    /* Vignette top-right per dare profondità */
    radial-gradient(ellipse at 100% 0%, rgba(11, 143, 211, 0.08), transparent 55%),
    /* Sheen diagonale soft */
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent 45%);
}

.hero-family-device img {
  width: 100%;
  height: auto;
}

/* Materiale glass delle card flottanti. Raffinato 2026-05-30: superficie un filo
   più lattea + hairline interno (luce dall'alto) + ombra più SOTTILE e ravvicinata
   (era 0 22px 52px .15 -> "galleggiamento" pesante). Aria più calma e premium. */
.glass-panel {
  border: 1px solid rgba(255, 255, 255, 0.62);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.58), rgba(234, 247, 255, 0.26));
  -webkit-backdrop-filter: blur(18px) saturate(1.05);
  backdrop-filter: blur(18px) saturate(1.05);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    0 8px 22px -10px rgba(7, 91, 138, 0.18),
    0 18px 40px -18px rgba(7, 91, 138, 0.14);
}

.metric-card {
  position: absolute;
  z-index: 4;
  display: grid;
  grid-template-columns: 32px auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  min-width: 162px;
  padding: 13px 15px 13px 17px;
  border-radius: 18px;
  color: var(--navy);
  /* Animazione bobbing rimossa (2026-05-27): le card sono "tile" statiche
     come in una dashboard reale. L'eleganza viene dall'allineamento, non dal moto. */
}

/* Accento semantico: strip di 2px sul lato sinistro nel colore della metrica.
   Differenziazione semantica subtile senza rompere la cohesion glass. */
.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 2px;
  border-radius: 0 2px 2px 0;
  background: var(--metric-accent, var(--accent-network));
  box-shadow: 0 0 8px -1px var(--metric-accent, var(--accent-network));
}

.metric-network   { --metric-accent: var(--accent-network); }
.metric-alerts    { --metric-accent: var(--accent-alerts); }
.metric-battery   { --metric-accent: var(--accent-battery); }
.metric-coverage  { --metric-accent: var(--accent-coverage); }

.metric-card img {
  grid-row: 1 / span 2;
  width: 26px;
  height: 26px;
  align-self: center;
  padding: 5px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.metric-card span {
  color: rgba(19, 35, 58, 0.72);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.metric-card strong {
  color: var(--navy);
  font-size: 18px;
  line-height: 1.18;
}

.metric-card sup,
.dashboard-panel sup {
  font-size: 0.58em;
}

/* Cifre tabellari sui valori strumentali (347.18 / 92% / 2.45): larghezza
   fissa per cifra -> si allineano come un display di misura, non "ballano"
   come testo proporzionale. Raffinamento tipografico 2026-05-30. */
.dashboard-topline strong,
.dashboard-bottomline strong,
.metric-card strong {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

/* Posizioni delle 4 metric card superstiti (water/pressure rimosse 2026-05-30
   nel "raffina per sottrazione": invadevano la metà sinistra del form e
   affollavano la scena). Le 4 rimaste sono distribuite negli angoli della
   scena visual, ben dentro al pannello destro (niente sconfinamento). */
.metric-network {
  top: 20%;
  left: 19%;
}

.metric-alerts {
  right: 5%;
  top: 37%;
}

.metric-battery {
  right: 4%;
  bottom: 18%;
}

.metric-coverage {
  top: 2%;
  left: 34%;
}

.dashboard-panel {
  position: absolute;
  left: 16%;
  bottom: 3%;
  z-index: 4;
  width: 260px;
  padding: 18px;
  border-radius: 22px;
  color: var(--navy);
}

.dashboard-topline,
.dashboard-bottomline {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
}

.dashboard-topline span,
.dashboard-bottomline span {
  color: rgba(19, 35, 58, 0.68);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.dashboard-topline strong {
  font-size: 24px;
}

.dashboard-bottomline strong {
  font-size: 17px;
}

.dashboard-chart {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 7px;
  height: 88px;
  margin: 18px 0 14px;
  padding: 11px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
}

/* Ground line: hairline gradient orizzontale alla base del chart, sotto i
   bar. Da' al chart un "asse" come in una vera dashboard analytics. */
.dashboard-chart::after {
  content: "";
  position: absolute;
  left: 11px;
  right: 11px;
  bottom: 11px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent,
    rgba(11, 143, 211, 0.32) 18%,
    rgba(11, 143, 211, 0.32) 82%,
    transparent);
  pointer-events: none;
}

.dashboard-chart span {
  display: block;
  min-height: 16px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(180deg, var(--water-400), var(--water-700));
  box-shadow: 0 8px 16px rgba(11, 143, 211, 0.2);
  /* Respiro "dati vivi": solo transform (GPU), base in basso come un vero bar
     chart. Fasi diverse per barra (delay sotto) → onda lenta, mai sincrona. */
  transform-origin: bottom center;
  animation: barBreath 9s var(--ease-in-out) infinite;
}
.dashboard-chart span:nth-child(1) { animation-delay: 0s;     animation-duration: 10s; }
.dashboard-chart span:nth-child(2) { animation-delay: -2.4s;  animation-duration: 8.5s; }
.dashboard-chart span:nth-child(3) { animation-delay: -5.1s;  animation-duration: 11s; }
.dashboard-chart span:nth-child(4) { animation-delay: -1.2s;  animation-duration: 9.5s; }
.dashboard-chart span:nth-child(5) { animation-delay: -6.8s;  animation-duration: 8s; }
.dashboard-chart span:nth-child(6) { animation-delay: -3.6s;  animation-duration: 10.5s; }

@keyframes barBreath {
  0%, 100% { transform: scaleY(1); }
  50%      { transform: scaleY(0.93); }
}

@media (prefers-reduced-motion: reduce) {
  .dashboard-chart span { animation: none; }
}
html.perf-lite .dashboard-chart span { animation: none; }

/* Ultima barra (la "current" / più recente): evidenziata in brand-red.
   In una time-series il rightmost bar è il "now": qui diventa il focal point
   visivo del mini chart -- coerente col color brand della CTA. */
.dashboard-chart span:last-child {
  background: linear-gradient(180deg, var(--mido-red), var(--mido-red-dark));
  box-shadow: 0 8px 18px rgba(231, 45, 63, 0.32);
}

/* Live dot: punto verde pulsante prima di "Consumo Totale". Stesso pattern
   visivo dell'avatar online: il sistema sta loggando dati ORA. */
.dashboard-topline span::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #22A06B;
  vertical-align: 1px;
  /* Alone STATICO + pulse di sola opacity/transform (regola LED del progetto). */
  box-shadow: 0 0 0 2px rgba(34, 160, 107, 0.16);
  animation: livePulse 1.8s var(--ease-in-out) infinite;
}

@keyframes livePulse {
  0%, 100% { opacity: 1;    transform: scale(1); }
  60%      { opacity: 0.55; transform: scale(1.4); }
}

.wireless-arcs {
  position: absolute;
  top: 24%;
  right: 36%;
  z-index: 5;
  width: 108px;
  height: 108px;
  transform: rotate(-28deg);
}

.wireless-arcs i {
  position: absolute;
  right: 0;
  bottom: 0;
  display: block;
  border: 3px solid rgba(255, 255, 255, 0.88);
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 100% 0 0;
  filter: drop-shadow(0 0 10px rgba(52, 190, 239, 0.55));
}

.wireless-arcs i:nth-child(1) {
  width: 34px;
  height: 34px;
}

.wireless-arcs i:nth-child(2) {
  width: 62px;
  height: 62px;
  opacity: 0.76;
}

.wireless-arcs i:nth-child(3) {
  width: 90px;
  height: 90px;
  opacity: 0.54;
}

@keyframes auroraDrift {
  0%, 100% { transform: translate3d(0, 0, 0); }
  33%      { transform: translate3d(22px, -14px, 0); }
  66%      { transform: translate3d(-18px, 10px, 0); }
}

/* Underline draw sotto l'accento "portale MiDoMet": parte come scia rossa
   sottile e si estende lentamente al primo paint. Una volta tracciata,
   resta. Adds a refined "calligraphy" touch. */
@keyframes accentDraw {
  from { transform: scaleX(0); opacity: 0; }
  to   { transform: scaleX(1); opacity: 1; }
}

@keyframes contentIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Pulsazione molto lenta degli alone dot (in aggiunta al moto lungo i path).
   Da' al dot la "vita" di un nodo di rete che ping-a, senza farlo sbattere. */
@keyframes flowPulse {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}

@keyframes waveDrift {
  from {
    transform: translateX(-52%) translateY(0);
  }
  to {
    transform: translateX(-48%) translateY(-8px);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1280px) {
  .login-page {
    grid-template-columns: minmax(390px, 46%) minmax(0, 54%);
    width: min(1240px, calc(100% - 44px));
  }

  .hero-copy h1 {
    font-size: 50px;
  }

  .hero-main-device {
    width: min(720px, 96%);
  }

  .hero-family-device {
    width: 270px;
  }
}

/* Hide solo a <=1100: tra 1100-1280 i 6 metric card restano visibili
   (prima venivano nascosti già a 1280 lasciando un vuoto fastidioso). */
@media (max-width: 1100px) {
  .metric-coverage,
  .metric-alerts {
    display: none;
  }
}

@media (max-width: 1040px) {
  body.login-body {
    background-attachment: scroll;
  }

  .login-page {
    grid-template-columns: 1fr;
    /* In 1-col gli elementi si impilano naturalmente (form, visual, footer) */
    grid-template-rows: auto;
    width: min(720px, calc(100% - 36px));
    padding: 26px 0 42px;
  }

  .login-content {
    max-width: none;
    padding: 0;
  }

  .brand-header {
    position: static;
    display: flex;
    justify-content: center;
    margin-bottom: 28px;
  }

  .hero-copy {
    margin-top: 0;
    text-align: center;
  }

  .eyebrow {
    justify-content: center;
  }

  .hero-copy h1,
  .hero-subtitle {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-copy h1 {
    font-size: 44px;
  }

  .login-card {
    margin: 0 auto;
  }

  .login-visual {
    position: relative;
    min-height: 390px;
    margin-top: 36px;
    padding-top: 24px;
    opacity: 0.92;
  }

  /* Separator: hairline gradient orizzontale tra form e visual quando in 1-col.
     Da' un "passaggio" visivo gentile invece di un blocco impilato a freddo. */
  .login-visual::before {
    content: "";
    position: absolute;
    top: 0;
    left: 12%;
    right: 12%;
    height: 1px;
    background: linear-gradient(90deg,
      transparent,
      rgba(142, 216, 255, 0.55) 30%,
      rgba(142, 216, 255, 0.55) 70%,
      transparent);
  }

  .visual-stage {
    position: relative;
    inset: auto;
    min-height: 390px;
  }

  .hero-main-device {
    right: 50%;
    bottom: 0;
    width: min(620px, 100%);
    transform: translateX(50%);
  }

  /* A <=1040 (1-col) il device è centrato e largo: la card 'Stato Rete'
     (metric-network) gli finiva sopra coprendo il sensore. Nascosta insieme ad
     alerts/coverage: restano dashboard-panel + battery che incorniciano il
     device ai due lati (coerente col "raffina per sottrazione"). */
  .hero-family-device,
  .metric-network,
  .metric-alerts,
  .metric-coverage,
  .wireless-arcs {
    display: none;
  }

  .metric-battery {
    right: 18px;
    bottom: 38px;
  }

  .dashboard-panel {
    left: auto;
    right: 20px;
    bottom: 138px;
  }
}

@media (max-width: 680px) {
  .login-page {
    width: min(100% - 28px, 520px);
    padding: 16px 0 24px;
  }

  .brand-header {
    margin-bottom: 18px;
  }

  .brand-logo,
  .brand-logo img {
    width: 154px;
  }

  .hero-copy {
    margin-bottom: 16px;
  }

  .eyebrow {
    margin-bottom: 10px;
    font-size: 12px;
  }

  .hero-copy h1 {
    font-size: 36px;
    line-height: 1.08;
  }

  .hero-subtitle {
    margin-top: 10px;
    font-size: 16px;
    line-height: 1.42;
  }

  .login-card {
    padding: 24px 18px;
    border-radius: 26px;
  }

  .login-card-header {
    align-items: flex-start;
    gap: 13px;
    margin-bottom: 18px;
  }

  .login-card-icon {
    width: 46px;
    height: 46px;
  }

  .login-card h2 {
    font-size: 22px;
  }

  .form-options {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .input-shell,
  .input-shell input {
    min-height: 54px;
    height: 54px;
  }

  .login-submit {
    min-height: 56px;
  }

  .login-divider {
    margin: 14px 0 12px;
  }

  .support-link {
    min-height: 50px;
  }

  .login-visual {
    display: none;
  }

  .ambient-grid {
    display: none;
  }

  /* Su mobile NON nascondiamo l'intero .ambient-flow (la pagina sarebbe
     "piatta" — niente segnali di vita): teniamo solo i ping core statici
     come piccoli punti luminosi distribuiti, e nascondiamo le linee (che
     andrebbero sotto il subtitle) + i glow viaggianti. Decorazione minima. */
  .ambient-flow .flow-line,
  .ambient-flow .flow-line-thin,
  .ambient-flow .flow-glow,
  .ambient-flow .flow-glow-sm,
  .ambient-flow .flow-droplet {
    display: none;
  }

  /* I ping continuano a pulsare in modo silenzioso (forma di "rete attiva") */
  .ambient-flow {
    opacity: 0.7;
  }
}

@media (max-width: 390px) {
  .hero-copy h1 {
    font-size: 32px;
  }

  .login-card {
    padding: 22px 18px;
  }

  .support-link {
    min-height: 52px;
    padding: 0 12px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  /* SMIL <animateMotion> + <animate> non rispondono alle media query CSS:
     nascondiamo alone, anelli ping e gocce (i path + i core restano = "rete"
     silenziosa). Le curve flowDash sono CSS -> già congelate sopra dal blocco
     *{animation-duration:0.01ms} (restano trattini statici). */
  .ambient-flow .flow-glow,
  .ambient-flow .flow-glow-sm,
  .ambient-flow .ping-ring,
  .ambient-flow .flow-droplet {
    display: none;
  }
}

/* ============================================================================
   DIALOG DI RECUPERO PASSWORD (<dialog> nativo)
   Aperto da #forgotBtn. focus-trap, Esc e backdrop sono gestiti dal browser.
   ============================================================================ */
.login-dialog {
  width: min(92vw, 420px);
  padding: 0;
  border: 1px solid var(--glass-border);
  border-radius: 22px;
  color: var(--text-main);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(245, 251, 255, 0.95));
  box-shadow: 0 30px 80px -24px rgba(7, 91, 138, 0.42);
}

.login-dialog::backdrop {
  background: rgba(11, 34, 58, 0.42);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.login-dialog-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin: 0;
  padding: 26px 26px 22px;
}

.login-dialog-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(142, 216, 255, 0.7);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(207, 239, 255, 0.7));
  box-shadow: 0 8px 18px -8px rgba(11, 143, 211, 0.35);
}

.login-dialog-icon img {
  width: 22px;
  height: 22px;
}

.login-dialog h2 {
  margin: 0;
  color: var(--navy);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.login-dialog p {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.5;
}

.login-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}

.dialog-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 13px;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out), background 0.18s ease, border-color 0.18s ease;
}

.dialog-btn img {
  width: 18px;
  height: 18px;
}

/* Primario in TEAL (non rosso): il rosso resta riservato alla CTA di login,
   il dialog è un'azione di supporto -> gerarchia di brand coerente. */
.dialog-btn-primary {
  flex: 1 1 auto;
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, var(--water-500), var(--water-700));
  box-shadow: 0 10px 22px -8px rgba(11, 143, 211, 0.45);
}

.dialog-btn-primary img {
  filter: brightness(0) invert(1);
}

.dialog-btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px -8px rgba(11, 143, 211, 0.5);
}

.dialog-btn-ghost {
  border: 1px solid var(--water-300);
  color: var(--water-700);
  background: rgba(255, 255, 255, 0.6);
}

.dialog-btn-ghost:hover {
  border-color: var(--water-400);
  background: rgba(234, 247, 255, 0.82);
}

.login-dialog[open] {
  animation: dialogIn 0.24s var(--ease-out) both;
}

@keyframes dialogIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .login-dialog[open] { animation: none; }
}

html.perf-lite .login-dialog[open] { animation: none; }
html.perf-lite .login-dialog::backdrop {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* ============================================================================
   TRASPARENZA RIDOTTA (preferenza inclusiva): le superfici glass diventano OPACHE.
   Standard 2026 per il vetro accessibile — niente blur, fondo solido ad alto
   contrasto per chi disattiva la trasparenza a livello OS.
   ============================================================================ */
@media (prefers-reduced-transparency: reduce) {
  .mido-glass-card,
  .glass-panel,
  .eyebrow,
  .input-shell,
  .login-dialog {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
  .mido-glass-card { background: #ffffff; }
  .login-dialog    { background: #ffffff; }
  .glass-panel     { background: #f1f8ff; }
  .eyebrow         { background: #e9f6ff; }
  .input-shell     { background: #ffffff; }
  .login-dialog::backdrop {
    background: rgba(11, 34, 58, 0.6);
  }
}

/* ============================================================================
   DARK MODE — segue prefers-color-scheme (la login non ha toggle: è automatica).
   Coerente col resto del portale, dark-mode capace. Gli asset-icona sono SVG
   monocromatici currentColor caricati via <img>: in dark li schiariamo con
   filter (currentColor non eredita dal documento ospite).
   ============================================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --water-50:  #0B1A2A;
    --water-100: #0F2236;
    --water-200: #16314A;
    --navy:      #E9F3FF;   /* "navy" è usato come colore-testo forte -> chiaro in dark */
    --text-main: #E6F0FA;
    --text-muted:#A7BBD0;   /* muted chiaro: >=4.5:1 sul fondo navy scuro */
    --glass-border: rgba(120, 190, 240, 0.20);
    --focus-ring: #46C6F5;  /* teal più chiaro per stagliarsi sul dark */
  }

  html { background: #0B1A2A; }

  body.login-body {
    color: var(--text-main);
    background-color: #0B1A2A;
    /* niente foto di sfondo chiara in dark: aurora teal su navy profondo */
    background-image:
      radial-gradient(1200px 720px at 78% 10%, rgba(11, 143, 211, 0.20), transparent 60%),
      radial-gradient(900px 620px at 8% 92%, rgba(16, 60, 96, 0.55), transparent 60%),
      linear-gradient(150deg, #0B1A2A 0%, #0E2236 55%, #0A1828 100%);
  }

  /* Aurora drift: togliamo il velo bianco finale (schiariva il dark) */
  body.login-body::before {
    background:
      radial-gradient(circle at 76% 18%, rgba(52, 190, 239, 0.20), transparent 30%),
      radial-gradient(circle at 6% 80%, rgba(70, 150, 210, 0.18), transparent 28%),
      radial-gradient(circle at 92% 86%, rgba(11, 143, 211, 0.18), transparent 34%);
  }

  .ambient-waves { opacity: 0.28; }

  /* --- Superfici glass --- */
  .mido-glass-card {
    border-color: rgba(120, 190, 240, 0.18);
    background: linear-gradient(180deg, rgba(24, 44, 66, 0.78) 0%, rgba(16, 34, 54, 0.74) 100%);
    box-shadow:
      inset 0 1px 0 rgba(150, 205, 245, 0.10),
      0 0 0 1px rgba(120, 190, 240, 0.10),
      0 18px 44px -18px rgba(0, 0, 0, 0.6);
  }
  .mido-glass-card::before {
    background: linear-gradient(135deg, rgba(150, 205, 245, 0.30), rgba(70, 150, 210, 0.12) 40%, transparent 62%);
    opacity: 0.5;
  }

  .glass-panel {
    border-color: rgba(120, 190, 240, 0.16);
    background: linear-gradient(145deg, rgba(24, 44, 66, 0.72), rgba(16, 34, 54, 0.5));
    box-shadow:
      inset 0 1px 0 rgba(150, 205, 245, 0.10),
      0 10px 26px -12px rgba(0, 0, 0, 0.6);
  }

  .eyebrow {
    border-color: rgba(120, 190, 240, 0.28);
    background: linear-gradient(180deg, rgba(30, 52, 76, 0.7), rgba(18, 36, 56, 0.55));
    color: #9FD8F5;
    box-shadow:
      inset 0 1px 0 rgba(150, 205, 245, 0.12),
      0 4px 12px -2px rgba(0, 0, 0, 0.5);
  }

  .input-shell {
    border-color: rgba(120, 190, 240, 0.22);
    background: rgba(12, 28, 46, 0.66);
    box-shadow: inset 0 1px 0 rgba(150, 205, 245, 0.06);
  }
  .input-shell:focus-within {
    border-color: var(--water-400);
    background: rgba(14, 32, 52, 0.92);
    box-shadow:
      0 0 0 4px rgba(52, 190, 239, 0.22),
      0 0 28px -6px rgba(52, 190, 239, 0.45),
      inset 0 1px 0 rgba(150, 205, 245, 0.08);
  }
  .input-shell input { color: var(--text-main); }
  .input-shell input::placeholder { color: rgba(167, 187, 208, 0.7); }

  .login-card-icon {
    border-color: rgba(120, 190, 240, 0.4);
    background: linear-gradient(180deg, rgba(30, 54, 78, 0.95), rgba(18, 38, 58, 0.8));
    box-shadow:
      0 14px 30px rgba(0, 0, 0, 0.45),
      inset 0 1px 0 rgba(150, 205, 245, 0.12);
  }

  /* --- Testi che usavano literal navy/grigio scuro --- */
  .metric-card span,
  .dashboard-topline span,
  .dashboard-bottomline span { color: rgba(214, 230, 245, 0.78); }
  .metric-card,
  .metric-card strong,
  .dashboard-panel { color: var(--text-main); }

  /* --- Link/label teal: schiariti per leggibilità sul dark --- */
  .eyebrow,
  .login-field:focus-within label,
  .forgot-link,
  .support-link,
  .form-options a,
  .dialog-btn-ghost { color: #8FD3F5; }

  /* --- Casella Ricordami --- */
  .remember-box {
    border-color: rgba(120, 190, 240, 0.4);
    background: rgba(12, 28, 46, 0.66);
  }

  /* --- Bottone supporto outline --- */
  .support-link {
    border-color: rgba(120, 190, 240, 0.3);
    background: rgba(24, 44, 66, 0.45);
  }
  .support-link:hover {
    border-color: var(--water-400);
    background: linear-gradient(180deg, rgba(30, 54, 78, 0.7), rgba(20, 42, 64, 0.5));
  }
  .password-toggle:hover,
  .password-toggle:focus-visible {
    background: rgba(40, 70, 100, 0.5);
  }

  /* --- Banner errore --- */
  .login-error {
    border-color: rgba(231, 45, 63, 0.45);
    color: #FFB3BD;
    background: rgba(120, 20, 33, 0.42);
  }

  /* --- Avviso BLOC MAIUSC --- */
  .caps-hint { color: #F2C14E; }
  .caps-hint span {
    border-color: rgba(245, 158, 11, 0.5);
    background: rgba(245, 158, 11, 0.18);
  }

  /* --- Mini dashboard del visual --- */
  .dashboard-chart { background: rgba(10, 24, 40, 0.5); }
  .metric-card img { background: rgba(40, 64, 90, 0.7); }

  /* --- Dialog --- */
  .login-dialog {
    border-color: rgba(120, 190, 240, 0.18);
    background: linear-gradient(180deg, rgba(22, 42, 64, 0.98), rgba(14, 30, 48, 0.98));
  }
  .login-dialog-icon {
    border-color: rgba(120, 190, 240, 0.4);
    background: linear-gradient(180deg, rgba(30, 54, 78, 0.95), rgba(18, 38, 58, 0.8));
  }
  .login-dialog-icon img { filter: brightness(0) invert(0.92); }
  .dialog-btn-ghost {
    border-color: rgba(120, 190, 240, 0.32);
    background: rgba(24, 44, 66, 0.5);
  }
  .dialog-btn-ghost:hover { background: rgba(30, 54, 78, 0.7); }

  /* --- ICONE monocromatiche (currentColor via <img>): schiarite con filter.
         La freccia della CTA login resta esclusa (ha già il suo filter bianco). --- */
  .field-icon,
  .eyebrow img,
  .login-card-icon img,
  .support-link img,
  .metric-card img { filter: brightness(0) invert(0.92); }

  .input-shell:focus-within .field-icon {
    filter: brightness(0) invert(1) drop-shadow(0 0 6px rgba(70, 198, 245, 0.5));
  }

  /* --- Separatore "oppure": hairline più sobria sul dark --- */
  .login-divider::before,
  .login-divider::after {
    background: linear-gradient(90deg, transparent, rgba(120, 190, 240, 0.5), transparent);
  }

  /* --- Vignette del device family: meno bianco su dark --- */
  .hero-family-device { border-color: rgba(120, 190, 240, 0.3); }
}

/* ============================================================================
   NUOVI ELEMENTI VISUALI (2026-06-23): capability pills, illustrazione rete, footer
   ============================================================================ */

/* --- Capability pills: chip glass informativi sotto il sottotitolo. Statici
       (non cliccabili → niente hover-lift che simuli affordance). --- */
.capability-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: 20px 0 2px;
  padding: 0;
  list-style: none;
  animation: contentIn 0.72s 0.18s ease both;
}

.capability-pills li {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid rgba(142, 216, 255, 0.5);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(234, 247, 255, 0.42));
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    0 4px 12px -4px rgba(7, 91, 138, 0.1);
  color: var(--water-700);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.005em;
}

.capability-pills img {
  width: 16px;
  height: 16px;
  opacity: 0.85;
}

/* --- Illustrazione "rete idrica smart": backdrop tenue dietro lo stage visual.
       z-index 1 = sotto device (2) e card (4); object-fit contain la centra. --- */
.network-map {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.55;
  pointer-events: none;
}

/* --- Footer di brand: finitura a piena larghezza (riga 2 della grid). --- */
.login-footer {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 18px;
  margin-top: 26px;
  padding: 15px 8px 2px;
  border-top: 1px solid rgba(142, 216, 255, 0.42);
  color: var(--text-muted);
  font-size: 13px;
}

.login-footer .footer-brand {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
}

.login-footer .footer-brand strong {
  color: var(--navy);
  font-weight: 700;
}

.footer-sep { opacity: 0.5; }

.made-in-italy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tricolore {
  width: 18px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 2px;
  filter: drop-shadow(0 1px 2px rgba(7, 91, 138, 0.12));
}

.login-footer .footer-links {
  display: inline-flex;
  gap: 18px;
}

.login-footer a {
  padding: 6px 2px;
  border-radius: 6px;
  color: var(--water-700);
  font-weight: 600;
  text-decoration: none;
}

.login-footer a:hover { text-decoration: underline; }

.login-footer a:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

@media (max-width: 1040px) {
  /* hero centrato -> pills centrate */
  .capability-pills { justify-content: center; }
}

@media (max-width: 680px) {
  .login-footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .capability-pills li {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: #eef7ff;
  }
}

@media (prefers-color-scheme: dark) {
  .capability-pills li {
    border-color: rgba(120, 190, 240, 0.22);
    background: linear-gradient(180deg, rgba(30, 52, 76, 0.62), rgba(18, 36, 56, 0.46));
    color: #8FD3F5;
    box-shadow:
      inset 0 1px 0 rgba(150, 205, 245, 0.1),
      0 4px 12px -4px rgba(0, 0, 0, 0.45);
  }
  .capability-pills img { filter: brightness(0) invert(0.92); }

  .network-map { opacity: 0.72; }

  .login-footer { border-top-color: rgba(120, 190, 240, 0.18); }
  .login-footer a { color: #8FD3F5; }
  .tricolore { filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4)); }
}
