/* Verdex — Sfondo dell'area di lavoro (shield-theme.js): Chiaro (predefinito), Sabbia Calda, Notte.
 * Attivo con l'attributo data-ws-theme su <html> (impostato nell'<head> dalla preferenza salvata). Cambiano solo colori di
 * sfondo, testi e bordi: dimensioni, spaziature, layout del computer e proporzioni dello smartphone restano invariati.
 * - Chiaro: azzurro-ghiaccio fresco #EAF0F7, card bianche #FFFFFF, bordi azzurro-grigio #CBD5E1, badge rossi / blu / oro invariati.
 * - Sabbia Calda: crema / sabbia calda #EDE5D5, card avorio caldo #FAF6EE, bordi sabbia #DDD0B8.
 * - Notte: blu-ardesia profondo #070D19, card #111C33, bordi sottili nitidi, testi chiari ad alto contrasto.
 * Le tinte di card e bordi per i tre temi sono in shield-theme-tones.css (caricato per ultimo).
 * Il riquadro del logo Verdex resta sempre bianco puro #FFFFFF. Con «Alto Contrasto» attivo prevale l'alto contrasto. */

:root {
  --ws-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ws-fade-ms: 2200ms;   /* smartphone / PWA: cambio di sfondo lento e vellutato */
  --ws-page: #EAF0F7;
}
/* Computer (classe «pace-desk», <head> di index.html): cambio di sfondo rapido, 320 ms (FADE_MS in shield-theme.js). */
html.pace-desk { --ws-fade-ms: 320ms; }
html[data-ws-theme="sand"] { --ws-page: #EDE5D5; }
html[data-ws-theme="night"] { --ws-page: #070D19; }

/* ---------- Sfondo della pagina ---------- */
html[data-ws-theme]:not(.high-contrast):not(.printing-report) body { background-color: var(--ws-page); }
/* Schermata d'ingresso: il fondo blu notte resta quello di <html>, come prima (body trasparente). */
html[data-ws-theme].gate-on:not(.gate-leaving):not(.gate-prep) body { background-color: transparent; }
body { transition: background-color var(--ws-fade-ms) var(--ws-ease), color var(--ws-fade-ms) var(--ws-ease), font-size 0.2s ease; }

/* ---------- Cambio lento e vellutato (2200 ms su smartphone / PWA, 320 ms sul computer) ----------
   Solo durante il passaggio (classe «ws-theming», circa 2,4 s): ogni superficie sfuma colore di sfondo, testo, bordi e ombre
   insieme alla pagina. Prevale sul ritmo generale di 1800 ms di shield-calm.css; restano fuori la splash, la schermata
   d'accesso, il velo di «Esci» e il logo che vola, che hanno tempi propri. */
html.ws-theming:root body,
html.ws-theming:root body :not(:where(#app-splash, #app-splash *, #boot-splash, #boot-splash *, #entry-gate, #entry-gate *, #calm-veil, #toast, .logo-fly, .logo-fly-clone)),
html.ws-theming:root body :not(:where(#app-splash, #app-splash *, #boot-splash, #boot-splash *, #entry-gate, #entry-gate *, #calm-veil, .logo-fly, .logo-fly-clone))::before,
html.ws-theming:root body :not(:where(#app-splash, #app-splash *, #boot-splash, #boot-splash *, #entry-gate, #entry-gate *, #calm-veil, .logo-fly, .logo-fly-clone))::after {
  transition-property: background-color, color, border-color, box-shadow, fill, stroke, outline-color, text-decoration-color !important;
  transition-duration: var(--ws-fade-ms), var(--ws-fade-ms), var(--ws-fade-ms), var(--ws-fade-ms), var(--ws-fade-ms), var(--ws-fade-ms), var(--ws-fade-ms), var(--ws-fade-ms) !important;
  transition-timing-function: var(--ws-ease) !important;
  transition-delay: 0s !important;
}

/* ---------- Logo sempre su bianco puro ---------- */
html[data-ws-theme] #app-header .hdr-logo,
html[data-ws-theme] .hdr-logo,
html[data-ws-theme] .install-logo { background-color: #FFFFFF !important; }

/* =====================================================================
   SELETTORE (pannello «Aa» e Il mio Account → Impostazioni e Privacy)
   ===================================================================== */
.ws-block-pop { margin-top: .1rem; padding: .55rem .1rem .1rem; border-top: 1px solid #E2E8F0; }
.ws-h {
  margin: 0 .2rem .45rem; font-size: .74rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: #475569;
}
.ws-picker { display: grid; gap: .45rem; }
.ws-picker-pop { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ws-opt {
  position: relative; display: flex; align-items: center; gap: .6rem; min-width: 0; margin: 0; cursor: pointer;
  font: inherit; text-align: left; color: #0F172A; background: #F8FAFC; border: 1.5px solid #E2E8F0; border-radius: .85rem;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .9s var(--ws-ease), border-color .9s var(--ws-ease), box-shadow .9s var(--ws-ease), color .9s ease;
}
.ws-picker-pop .ws-opt { flex-direction: column; justify-content: flex-start; gap: .38rem; padding: .4rem .35rem .45rem; text-align: center; }
.ws-opt:hover { border-color: #94A3B8; }
.ws-opt[aria-checked="true"] { background: #EFF6FF; border-color: #1E3A8A; box-shadow: 0 0 0 3px rgba(30, 58, 138, .12); }
.ws-opt-main { display: flex; flex-direction: column; min-width: 0; flex: 1 1 auto; }
.ws-opt-name { font-size: .95rem; font-weight: 800; line-height: 1.2; }
.ws-picker-pop .ws-opt-name { font-size: .8rem; line-height: 1.15; overflow-wrap: anywhere; }
.ws-opt-sub { font-size: .8rem; font-weight: 400; line-height: 1.3; color: #475569; }

/* Anteprima: pagina con una piccola card e una riga di testo nei colori del tema */
.ws-swatch {
  position: relative; display: block; flex-shrink: 0; overflow: hidden; border-radius: .6rem;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .14);
}
.ws-picker-pop .ws-swatch { width: 100%; height: 2.15rem; }
.ws-picker-acct .ws-swatch { width: 3.4rem; height: 2.5rem; }
.ws-swatch-card {
  position: absolute; left: 16%; right: 16%; top: 24%; bottom: 22%; border-radius: .32rem;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .18);
}
.ws-swatch-line { position: absolute; left: 26%; width: 34%; top: 42%; height: .2rem; border-radius: 999px; }
.ws-swatch-light { background: #EAF0F7; box-shadow: inset 0 0 0 1px #CBD5E1; }
.ws-swatch-light .ws-swatch-card { background: #FFFFFF; box-shadow: 0 1px 2px rgba(15, 23, 42, .14), inset 0 0 0 1px #CBD5E1; }
.ws-swatch-light .ws-swatch-line { background: #1E3A8A; }
.ws-swatch-sand { background: #EDE5D5; box-shadow: inset 0 0 0 1.5px #C9AE82; }
.ws-swatch-sand .ws-swatch-card { background: #FAF6EE; box-shadow: 0 1px 2px rgba(120, 83, 30, .2), inset 0 0 0 1px #DDD0B8; }
.ws-swatch-sand .ws-swatch-line { background: #B45309; }
.ws-swatch-night { background: #070D19; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .35); }
.ws-swatch-night .ws-swatch-card { background: #111C33; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, .28); }
.ws-swatch-night .ws-swatch-line { background: #E2E8F0; }

/* Spunta della scelta attiva */
.ws-opt-check {
  flex-shrink: 0; width: 1.3rem; height: 1.3rem; border-radius: 999px; border: 2px solid #CBD5E1; background: #FFFFFF;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .9s var(--ws-ease), border-color .9s var(--ws-ease);
}
.ws-opt-check::after {
  content: ''; width: .34rem; height: .62rem; margin-top: -.12rem; border: solid #FFFFFF; border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg); opacity: 0; transition: opacity .9s var(--ws-ease);
}
.ws-opt[aria-checked="true"] .ws-opt-check { background: #1E3A8A; border-color: #1E3A8A; }
.ws-opt[aria-checked="true"] .ws-opt-check::after { opacity: 1; }
.ws-picker-pop .ws-opt-check { position: absolute; top: .22rem; right: .22rem; width: 1.05rem; height: 1.05rem; border-width: 0; background: transparent; }
.ws-picker-pop .ws-opt-check::after { width: .26rem; height: .5rem; border-width: 0 2px 2px 0; }

/* Account: tre righe ampie, facili da toccare */
.ws-desc { margin: -.15rem 0 .65rem; font-size: .9rem; line-height: 1.4; color: #475569; }
.ws-picker-acct { grid-template-columns: 1fr; }
.ws-picker-acct .ws-opt { min-height: 3.6rem; padding: .55rem .75rem .55rem .6rem; }
@media (min-width: 640px) {
  .ws-picker-acct { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ws-picker-acct .ws-opt { flex-wrap: nowrap; }
}

/* Alto contrasto: selettore in bianco e nero */
html.high-contrast .ws-opt { background: #FFFFFF; color: #000000; border-color: #000000; }
html.high-contrast .ws-opt[aria-checked="true"] { box-shadow: 0 0 0 3px #FDE047; }
html.high-contrast .ws-opt-sub, html.high-contrast .ws-h, html.high-contrast .ws-desc { color: #000000; }
html.high-contrast .ws-block-pop { border-top-color: #000000; }

/* =====================================================================
   NOTTE — superfici scure, bordi sottili, testi chiari ad alto contrasto
   Palette: pagina #070D19 · card #111C33 · rilievo #1A2748 · campi #0E1833 · bordo #26355E
            testo #EAF0FA · testo secondario #C3CDE0 · tenue #9AA8C4 · blu chiaro #9DB8FF
   ===================================================================== */
html[data-ws-theme="night"]:not(.high-contrast) { color-scheme: dark; }
html[data-ws-theme="night"]:not(.high-contrast) body { color: #EAF0FA; }
