/* =========================================================================
   TEMA "AS400" (aspetto 5250) per le videate ProfoundUI / ProfoundJS
   -------------------------------------------------------------------------
   Si attiva SOLO nelle videate (in esecuzione, NON nel Designer) che
   contengono un elemento con css class
   "as400" (basta un output field vuoto). Le altre videate non cambiano.

   Cosa fa da solo, senza toccare i campi:
     heading           -> titolo bianco
     label             -> etichetta verde
     outputField       -> valore bianco
     textbox/combo/text area -> campo azzurro sottolineato; con il focus
                          fondo azzurrato e cornice azzurra
     pulsanti          -> testo azzurro tipo "F3=Uscita"
     griglie           -> nere, senza bordi, intestazioni azzurre

   COLORI DAL DESIGNER: se su un campo imposti "color", "background color",
   "font family", "font size" o "font weight", vale quello che hai scelto.
   Se non imposti nulla valgono i colori standard del tema.

   Classi facoltative (css class 2 / 3 nel Designer):
     as-istr   testo verde (istruzioni: "Immettere le scelte e premere Invio")
     as-blu    testo azzurro (legende "1=Selezione", titoletti)
     as-bianco testo bianco      as-giallo testo giallo
     as-rosso  testo rosso (errori)   as-rev  campo in reverse
   I tasti funzione li gestisce custom/js/as400.js.

   ATTIVAZIONE (da novembre 2026):
   - programmi aperti dal desktop GA: decide GA (tema dell'azione, oppure "auto" =
     tema programmi dell'utente). custom/js/as400.js mette su <html> la classe
     ga-tema-fisso piu ga-tema-as400 / ga-tema-scuro; il campo marcatore nella
     videata allora NON conta.
   - programmi aperti fuori da GA: vale ancora il campo marcatore con css class
     "as400" nella videata.
   ========================================================================= */

:root {
  --as-sfondo: #000;
  --as-verde: #3fd33f;
  --as-blu: #7b8fe8;
  --as-ciano: #45d8e6;
  --as-campo: rgba(69, 216, 230, .14);      /* fondo dei campi di input */
  --as-campo-focus: rgba(69, 216, 230, .22);
  --as-bianco: #f2f2f2;
  --as-giallo: #ffff3c;
  --as-rosso: #ff5050;
  --as-font: Consolas, "Lucida Console", "Courier New", monospace;
  --as-size: 16px;
}

/* ---- pagina ---------------------------------------------------------- */
:is(html:not(.nel-designer):not(.ga-tema-fisso):has(.as400), html.ga-tema-as400:not(.nel-designer)), :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) {
  background: var(--as-sfondo) !important;
  color: var(--as-bianco);
  scrollbar-color: #444 #000;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as400 { color: transparent !important; background: transparent !important; }

/* ---- testi ----------------------------------------------------------
   Colori, font e dimensioni SENZA !important: se nel Designer imposti
   color / background color / font, vale il valore del Designer.        */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .heading,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .label,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .outputField,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .office-copy-label,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .office-copy-output-field,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-istr, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-blu, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-bianco,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-giallo, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-rosso {
  font-family: var(--as-font);
  font-size: var(--as-size);
  font-weight: normal;
  background-color: transparent;
  border: 0 !important;
  box-shadow: none !important;
  letter-spacing: .5px;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .heading     { color: var(--as-bianco); }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .label,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .office-copy-label { color: var(--as-verde); text-align: left; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .outputField,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .office-copy-output-field { color: var(--as-bianco); }

:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-istr   { color: var(--as-verde); }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-blu    { color: var(--as-blu); }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-bianco { color: var(--as-bianco); }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-giallo { color: var(--as-giallo); }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-rosso  { color: var(--as-rosso); }

/* ---- campi di input --------------------------------------------------
   senza focus: solo la sottolineatura continua (colore del testo);
   con il focus: fondo azzurrato e cornice azzurra.
   Colore e colore di sfondo si possono cambiare dal Designer.          */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="text"],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="password"],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="number"],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input:not([type]),
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) textarea,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) select {
  font-family: var(--as-font);
  font-size: var(--as-size);
  color: var(--as-ciano);
  background-color: transparent;          /* senza focus: solo la sottolineatura */
  background-image: linear-gradient(currentColor, currentColor) !important;
  background-size: 100% 2px !important;
  background-position: 0 100% !important;
  background-repeat: no-repeat !important;
  border: 0 !important;
  border-radius: 2px 2px 0 0 !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 3px 2px 3px !important;
  caret-color: currentColor;
  letter-spacing: .5px;
  transition: box-shadow .12s, background-color .12s;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) select option { background: #000; color: var(--as-ciano); }

/* campo con il focus: cornice azzurra con un leggero alone */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="text"]:focus,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="password"]:focus,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="number"]:focus,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input:not([type]):focus,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) textarea:focus,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) select:focus {
  background-color: var(--as-campo-focus);
  box-shadow: 0 0 0 1px var(--as-ciano), 0 0 7px 1px rgba(69, 216, 230, .45) !important;
  border-radius: 2px !important;
}

/* campi protetti / disabilitati: come un output */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[readonly],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input:disabled,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) textarea[readonly] {
  color: var(--as-bianco);
  background-color: transparent;
  background-image: none !important;
  box-shadow: none !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .as-rev {
  background-color: var(--as-ciano) !important;
  color: #000 !important;
}

/* ---- pulsanti: testo azzurro "F3=Uscita" -----------------------------
   colore, sfondo e font si possono cambiare dal Designer               */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="button"],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="submit"],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) button {
  font-family: var(--as-font);
  font-size: var(--as-size);
  font-weight: normal;
  color: var(--as-blu);
  background-color: transparent;
  background-image: none !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  min-height: 0 !important;
  text-align: left !important;
  cursor: pointer;
  letter-spacing: .5px;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) input[type="button"]:hover,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) button:hover { text-decoration: underline; }

/* ---- griglie --------------------------------------------------------- */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) div:has(> .cell) {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cell,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cell.odd,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cell.even {
  background: transparent !important;
  background-image: none !important;
  border: 0 !important;
  color: var(--as-bianco);
  font-family: var(--as-font);
  font-size: var(--as-size);
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cell.header-cell {
  color: var(--as-blu);
  font-weight: normal;
  text-align: left !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cell.header-cell * { color: var(--as-blu); font-weight: normal; }

/* linee tra le colonne / righe disegnate da ProfoundUI */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .grid-vline,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .grid-hline { display: none !important; }

/* ---- widget coddec (custom/widgets/pui-coddec-widget.js) -------------
   Il widget ha colori scritti nello stile dei suoi elementi (riquadri
   bianchi, testo che eredita il colore della pagina): qui diventa come
   un campo 5250 (sottolineato, azzurro) e la ricerca come una finestra
   del terminale.                                                       */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap > div:has(> input) {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap input { color: var(--as-ciano) !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap input[readonly],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap input:disabled { color: var(--as-bianco) !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap input::placeholder { color: #5b7f84 !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-float { color: #5b7f84 !important; background: #000 !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap > div:focus-within .cdw-float { color: var(--as-ciano) !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap button {
  width: 22px !important;
  background: transparent !important;
  color: var(--as-blu) !important;
  border: 0 !important;
  text-align: center !important;
  justify-content: center;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-wrap button:hover { color: var(--as-bianco) !important; }
/* finestra di ricerca */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop {
  background: #000 !important;
  color: var(--as-bianco) !important;
  border: 2px solid var(--as-blu) !important;
  border-radius: 0 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .7) !important;
  font-family: var(--as-font) !important;
  font-size: 14px !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop > div:first-child {
  background: #000 !important;
  color: var(--as-bianco) !important;
  border-bottom: 1px solid var(--as-blu) !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop > div:first-child button {
  background: transparent !important;
  color: var(--as-blu) !important;
  padding: 0 6px !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop > div:first-child button[style*="bold"] { color: var(--as-bianco) !important; text-decoration: underline; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop > div:first-child > div:nth-child(2) { border-color: var(--as-blu) !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop > div:nth-child(2) { border-bottom: 1px solid #333 !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop tr { background: transparent !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop tr[style*="233, 226, 245"] { background: var(--as-ciano) !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop td { border-bottom: 0 !important; color: var(--as-bianco) !important; font-weight: normal !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop td:first-child:not([colspan]) { color: var(--as-verde) !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop tr[style*="233, 226, 245"] td,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop tr[style*="233, 226, 245"] td:first-child:not([colspan]) { color: #000 !important; }
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .cdw-pop > div:last-child {
  background: #000 !important;
  color: var(--as-blu) !important;
  border-top: 1px solid #333 !important;
}

/* ---- pannelli con modello (layout "css panel", es. "Reso scontrini" nelle videate in finestra) ----
   corpo e intestazione hanno le classi dei temi ProfoundUI (ui-btn-up-office-copy-white-body / -header,
   ui-body-x / ui-bar-x): senza queste regole restano bianchi */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) [class*="ui-btn-up-"][class*="-body"],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-body-a, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-body-b, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-body-c, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-body-d, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-body-e {
  background: var(--as-sfondo) !important; background-image: none !important; border-color: var(--as-blu) !important; color: var(--as-bianco) !important; text-shadow: none !important;
}
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) [class*="ui-btn-up-"][class*="-header"],
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-bar-a, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-bar-b, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-bar-c, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-bar-d, :is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) .ui-bar-e {
  background: var(--as-sfondo) !important; background-image: none !important; border-color: var(--as-blu) !important; color: var(--as-bianco) !important; text-shadow: none !important;
}

/* ---- maschera dietro le videate in finestra ("show as window") ----
   ProfoundUI la mette grigio chiaro semitrasparente (stile in linea): sul tema la pagina sotto diventerebbe chiara.
   Quando la videata sotto viene "congelata" ProfoundUI toglie l'id ai suoi div, maschera compresa:
   per questo la si riconosce anche dallo stile (#CCCCCC al 50%, in alto a sinistra) */
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) #pui-screen-mask,
:is(html:not(.nel-designer):not(.ga-tema-fisso) body:has(.as400), html.ga-tema-as400:not(.nel-designer) body) div[style*="background-color: rgb(204, 204, 204)"][style*="opacity: 0.5"][style*="left: 0px; top: 0px"] {
  background-color: #000 !important;
  opacity: .6 !important;
}
