
body{
  font-family:system-ui;
  background:#0f172a;
  color:white;
  margin:0;
  padding:20px;
}
h1{text-align:center;margin-bottom:20px;}
.container{max-width:1000px;margin:auto;}
.card{background:#1e293b;padding:20px;border-radius:14px;margin-bottom:20px;box-shadow:0 5px 20px rgba(0,0,0,0.3);}
.row{display:flex;gap:20px;flex-wrap:wrap;margin-bottom:15px;}
.field{flex:1;min-width:120px;display:flex;flex-direction:column;gap:5px;}
input,select{padding:10px;border-radius:8px;border:none;background:#0f172a;color:white;font-size:16px;}
.grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:10px;}
.stat{background:#0f172a;padding:15px;border-radius:10px;text-align:center;}
.stat h2{margin:0;color:#38bdf8;}
button{padding:10px;border:none;border-radius:8px;background:#38bdf8;color:black;font-weight:bold;cursor:pointer;}
.delete{background:#ef4444;color:white;}
canvas {
  margin-top: 20px;
  width: 100% !important;
display: block;

}
.chart {
  background: #334155;
  border-radius: 10px;
  padding: 16px;
  height: 320px;
}


.chart canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

#appContent {
  display: none;
}
.rosso {
  color: red;
  font-weight: bold;
}

.verde {
  color: lime;
  font-weight: bold;
}

.has-tooltip {
  position: relative;
  cursor: help;
  display: inline-block;
  padding: 2px 6px;
  border-radius: 8px;
  transition: background 0.2s ease, transform 0.15s ease;
  outline: none;
}

.has-tooltip:hover,
.has-tooltip:focus,
.has-tooltip.show-tooltip {
  background: rgba(255, 255, 255, 0.08);
  transform: translateY(-1px);
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translateX(-50%) translateY(6px) scale(0.96);
  background: linear-gradient(135deg, rgba(25,25,25,0.98), rgba(50,50,50,0.98));
  color: #fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 9999;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.has-tooltip::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: calc(100% + 4px);
  transform: translateX(-50%) translateY(6px);
  border-width: 6px;
  border-style: solid;
  border-color: rgba(35,35,35,0.98) transparent transparent transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  z-index: 9998;
}

.has-tooltip:hover::after,
.has-tooltip:hover::before,
.has-tooltip:focus::after,
.has-tooltip:focus::before,
.has-tooltip.show-tooltip::after,
.has-tooltip.show-tooltip::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}


.user-avatar {
  cursor: pointer;
  user-select: none;
  font-size: 28px;
  padding: 8px;
  border-radius: 50%;
  background: #38bdf8;
  color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-menu-box {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  margin: 0 0 10px 0;
  max-width: none;
  background: none;
  z-index: 10;
}

.user-menu-popup {
  display: none;
  position: fixed;
  background: #38bdf8;
  color: #111;
  border-radius: 11px;
  box-shadow: 0 4px 20px #1115;
  z-index: 10000;
  width: 220px;
  padding: 14px 0 6px 0;
}
.auth-card{
  max-width: 420px;
  margin: 60px auto;
  width: 100%;
  box-sizing: border-box;
}
/* =========================
   LOGIN COMPATIBILITY BOX
========================= */

.compatibility-box {
  text-align: center;
  margin: 20px 0 20px 0;
}

.compatibility-icons {
  margin-bottom: 8px;
  font-size: 1rem;
}

.compatibility-icons span {
  margin: 0 5px;
  display: inline-block;
}

.compatibility-text {
  font-size: 0.9rem;
  color: #6b7280; /* grigio elegante */
  display: block;
  margin-top: 5px;
}
.user-menu-title {
  padding: 8px 18px;
  font-weight: bold;
  border-bottom: 1px solid #eee;
}

.user-menu-popup button {
  display: block;
  width: 100%;
  padding: 12px 18px;
  background: none;
  border: none;
  text-align: left;
  font-size: 16px;
  cursor: pointer;
}
/* Riga notifiche dentro popup utente */

.user-menu-popup .notif-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
}
#notifLabel {
  font-weight: 700;
}

/* piccolo abbassamento ottico */
.user-menu-popup .switch {
  transform: translateY(2px);
}
.logout-btn {
  color: #ef4444;
}
/*info*/
.help-button {
  cursor: pointer;
  font-size: 1.5em;
  position: absolute;
  top: 12px;
  right: 12px;
  color: #ffffff;
  background: #4fa3ff;
  border-radius: 50%;
  width: 1.6em;
  height: 1.6em;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px 0 rgba(30,136,229,.15);
}

.help-button:hover {
  background: #2f8fff;
}
/* =========================
   TUTORIAL VIDEOS
========================= */

.tutorial-videos {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  margin: 20px 0;
  flex-wrap: nowrap; /* IMPORTANTISSIMO: non andare a capo su desktop */
}

/* Mobile piccolo */
.mobile-video {
  max-width: 120px;
  text-align: center;
}

/* Desktop un po' più grande */
.desktop-video {
  max-width: 320px;
  text-align: center;
}

.video-title {
  font-size: 0.85rem;
  margin-bottom: 6px;
  font-weight: 600;
}

.video-box video {
  width: 100%;
  border-radius: 10px;
  display: block;
}

/* Riduzione solo per lingua tedesca nei popup */
body.lang-de .popup .tab-btn {
  font-size: 12px;
  padding: 6px 4px;
}
body.lang-de .popup button {
  font-size: 10px;
}
body.lang-fr .popup .tab-btn {
  font-size: 15px;
  padding: 6px 4px;
}
body.lang-fr .popup button {
  font-size: 11px;
}

.help-modal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #6bbcff;
  color: #ffffff;
  border-radius: 10px;
  padding: 1.6em 1.8em 1.2em 1.8em;
  box-shadow: 0 4px 30px 0 rgba(30,80,130,.20);
  width: 90%;
  max-width: 500px;
  max-height: 85vh;
  overflow-y: auto;
  box-sizing: border-box;
}

.help-modal:focus {
  outline: 2px solid #ffffff;
}

.close-help {
  float: right;
  font-size: 1.9em;
  border: none;
  background: transparent;
  color: #ffffff;
  cursor: pointer;
  margin: -0.7em -0.5em 0 0;
}

.close-help:hover {
  color: #eaf6ff;
}

.help-content h2 {
  margin-top: 0;
  font-size: 1.2em;
  color: #ffffff;
}

.help-content ul {
  margin: 0 0 0.8em 1.3em;
  padding: 0;
  color: #ffffff;
}

.help-content li {
  color: #ffffff;
  margin-bottom: 0.4em;
}

.help-content hr {
  margin: 1em 0 0.5em 0;
  border: 0;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.help-support {
  font-size: 0.92em;
  color: #ffffff;
}

.help-support a {
  color: #ffffff;
  font-weight: bold;
  text-decoration: underline;
}

.openBtn{margin-bottom:15px;}
/* POPUP */
/* POPUP CENTRATO */
.popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.7);
  z-index: 999;
  justify-content: center;
  align-items: center; /* centro verticale */

  padding: 20px;
  box-sizing: border-box;
}
.charts-grid {
  display: grid ;
  grid-template-columns: 1fr 1fr;   /* 2 colonne */
  grid-template-rows: none;      /* 2 righe */
  gap: 20px;                               /* spazio tra i grafici */
  margin-bottom: 20px ;
}

.chart {
  background: #334155;
  border-radius: 10px;
  padding: 16px;
  min-height: 200px;       /* opzionale, regola in base alla grandezza desiderata */
  /* Puoi aggiungere altro stile qui */
}
.popup-content {
  background: #1e293b;
  padding: 20px;
  border-radius: 14px;
  width: 100%;
  max-width: 1500px;     /* ↑ da 600px a 900px (o di più se serve) */
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
}
.popup-content1 {
  background: #1e293b;
  padding: 20px;
  border-radius: 14px;
  width: 100%;
  max-width: 600px;     /* ↑ da 600px a 900px (o di più se serve) */
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
}
.popup-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:10px;
padding-left: 18px;
padding-right: 18px;
  /* NUOVO: la header resta in alto quando scorri dentro il popup */
  position: sticky;
  top: 0;
  z-index: 10;
  background: #1e293b; /* stesso colore del popup */
  padding-bottom: 5px;
  border-radius: 12px 12px 12px 12px; /* solo sopra stondato */
}
.closeBtn {
  background: #ef4444;
  color: white;
  border: none;
  width: 32px;       /* larghezza fissa */
  height: 32px;      /* altezza fissa → quadrato */
  border-radius: 8px; /* angoli arrotondati */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;   /* dimensione della X */
  padding: 0;        /* rimuove padding interno */
}
.popup-buttons {
  display: flex;
  justify-content: center; /* centrarli orizzontalmente */
  gap: 10px;
}

.popup-buttons button {
  width: auto;   /* su desktop dimensione naturale */
}

.tab-nav {
  display: flex;
  border-bottom: none;
  margin-bottom: 10px;
  justify-content: center;
}
.tab-btn {
  background:	#4169e1;
  border: none;
  padding: 12px 18px;
  cursor: pointer;
  font-size: 1.1em;
  border-bottom: 2px solid transparent;
  outline: none;
 margin-right:5px;
   
}
.tab-btn.active {
  border-bottom: 2px solid #0f172a;
  font-weight: bold;
  background: #38bdf8;
}

.tab-content {
  visibility: hidden;
  opacity: 0;
  height: 0;
  overflow: hidden;
}

.tab-content.active {
  visibility: visible;
  opacity: 1;
  height: auto;
  overflow: visible;
}


/* MOBILE POPUP - due input per riga */

.header-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 15px;
}
/* CSS per copyright centrato in basso */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh; /* la pagina occupa tutta l'altezza */
}

.copyright {
  text-align: center;
  padding: 10px 0;
  background: none;
  font-size: 0.9em;
  margin-top: auto;
}
.lang-switcher {
  position: absolute;
  top: 24px;
  left: 24px;
  display: flex;
  gap: 12px;
  z-index: 100;
}

.lang-btn {
  background: none;
  border: 2px solid transparent;
  padding: 2px;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
  height: 32px;
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lang-btn:focus, .lang-btn.selected, .lang-btn:hover {
  border-color: #009246;
  box-shadow: 0 0 0 2px #81c78440;
}

/* ---- LOGIN EXTRA ---- */
.login-extra {
  justify-content: center;
  margin-top: 10px;
}

/* Bottone stile link moderno */
.link-btn {
  background: none;
  border: none;
  color: #38bdf8; /* azzurro coerente con dashboard */
  font-size: 0.9rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.2s ease;
}

.link-btn:hover {
  background-color: rgba(56, 189, 248, 0.1);
  color: #0ea5e9;
}

.link-btn:active {
  transform: scale(0.97);
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-greeting {
  font-size: 0.95rem;
  font-weight: 500;
  color: #e2e8f0;
  white-space: nowrap;
}

/* Effetto hover coerente col tuo stile */
.user-info:hover .user-avatar {
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.3);
  transition: box-shadow 0.2s ease;
}




.lang-menu {
  display: none; /* nascosto di default */
  margin-top: 10px;
  background: #1e293b;
  border-radius: 12px;
  padding: 10px;
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);

  display: none;
  flex-direction: row;   /* ✅ tutte in fila */
  gap: 5px;
  align-items: center;
  white-space: nowrap;   /* ✅ evita andare a capo */
}

.lang-menu.show {
  display: flex;  /* ✅ appare in riga */
}
.lang-toggle {
  background: #38bdf8;
  border: none;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 18px;
  width: auto;      /* ✅ non si deforma */
  height: 40px;
}

.help-guide {
  margin-top: 18px;
  text-align: center;
}

.guide-btn {
  display: inline-block;
  padding: 10px 18px;
  background: #1e293b;          /* stesso sfondo card */
  color: #38bdf8;               /* colore primario dashboard */
  border: 1px solid #334155;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.2s ease;
}

.guide-btn:hover {
  background: #38bdf8;
  color: #0f172a;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(56,189,248,0.3);
}



.menu-item {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 16px;
  color: inherit;
  transition: background 0.2s ease;
}

.menu-item:hover {
  background: rgba(0,0,0,0.06);
}

.menu-item.secondary {
  opacity: 0.9;
  padding-left: 18px;
  font-weight: 700;
}
/* === VARIABILI COLORE (adatta ai tuoi valori se ne hai già) === */
:root {
  --monbill-primary: #3b82f6;      /* azzurro principale */
  --monbill-primary-dark: #2563eb; /* variante più scura */
  --monbill-bg: #f3f4f6;
  --monbill-text: #0f172a;
}

/* Pulsante "i" flottante */
.info-button {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--monbill-primary), var(--monbill-primary-dark));
  color: #ffffff;
  font-weight: 600;
  font-size: 18px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37, 99, 235, 0.45);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  z-index: 999;
}

.info-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(37, 99, 235, 0.55);
}

/* Sfondo popup */
.modal {
  display: none;
  position: fixed;
  z-index: 998;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.55);
  align-items: center;
  justify-content: center;
  padding: 16px; /* funziona sia desktop che mobile */
}

.modal.active {
  display: flex;
}

/* Contenuto popup */
.modal-content {
background-color: #87c8ff;
  color: var(--monbill-text);
  margin: 5% auto;
  padding: 20px 18px 24px;
  width: 90%;
  max-width: 560px;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.4);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  max-height: 80vh;
  overflow-y: auto;
  box-sizing: border-box;
}

/* Titoli / testi */
.modal-content h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 20px;
  font-weight: 700;
}

.modal-content h3 {
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
}

.modal-content p {
  margin-top: 0;
  margin-bottom: 8px;
  line-height: 1.5;
  font-size: 14px;
}

/* Bottone chiudi */
.close {
  border: none;
  background: transparent;
  font-size: 22px;
  float: right;
  cursor: pointer;
  color: #9ca3af;
}

.close:hover {
  color: var(--monbill-primary-dark);
}

/* ✅ MOBILE - mantiene effetto popup */
@media (max-width: 640px) {

  .modal {
    padding: 16px;
    align-items: center;
    justify-content: center;
  }

  .modal-content {
    width: 100%;
    max-width: 420px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 16px;
    padding: 18px;
  }

  .modal-content h2 {
    font-size: 18px;
  }

  .modal-content h3 {
    font-size: 14px;
  }

  .modal-content p {
    font-size: 13px;
  }

  .info-button {
    bottom: 14px;
    right: 14px;
  }
}

/* Responsive mobile */
@media (max-width: 600px) {
	body {
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;     /* IE */
  user-select: none;         /* Standard */
}
	.user-greeting {
    display: none;
  }
  .help-modal {
    width: 95%;
    max-width: none;
    padding: 1.1em 1em 1em 1em;
    border-radius: 8px;
    max-height: 80vh;
  }

  .help-button {
    top: 16px;
    right: 8px;
    font-size: 1.9em;
    width: 1.5em;
    height: 1.5em;
  }

  .close-help {
    font-size: 1.6em;
    margin: -0.5em -0.3em 0 0;
  }

  .help-content h2 {
    font-size: 1.05em;
  }

  .help-content ul {
    margin-left: 1.1em;
    font-size: 0.95em;
  }

  .help-support {
    font-size: 0.85em;
  }
  
    .row{
    flex-wrap: wrap;
    gap: 10px;
  }

  .grid{
    grid-template-columns: repeat(2, 1fr);
  }

  .grid .span-2-mobile{
    grid-column: 1 / -1;
  }

  .row .field{
    flex: 1 1 calc(50% - 10px);
    min-width: calc(50% - 10px);
  }

  .charts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .popup-content,
  .popup-content1{
    width:100%;
    max-width:100%;
    max-height:90vh;
    overflow-y:auto;
  }

  /* tutti i bottoni normali full width */
  button{
    width:100%;
  }

  /* righe pulsanti standard: 4 colonne */
  .popup-buttons{
    display:grid !important;
    grid-template-columns: repeat(4, 1fr);
    gap:10px;
    width:100%;
  }

  .popup-buttons button{
    width:100%;
  }

  /* fuel: 3 colonne reali */
  .popup-buttons.popup-buttons-fuel{
    display:grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap:10px;
    width:100%;
  }

  .popup-buttons.popup-buttons-fuel button{
    width:100%;
  }

  /* pulsante X cancella rifornimento: resta quadrato */
  #listaRifornimenti .delete{
    width:32px !important;
    min-width:32px;
    height:32px !important;
    padding:0 !important;
    display:flex !important;
    align-items:center;
    justify-content:center;
    flex:0 0 32px;
    border-radius:8px;
  }

  #popupGrafici .card{
    max-height: 260px;
    overflow: hidden;
  }

  #popupGrafici canvas{
    max-height: 220px;
  }
  
}

@media (max-width: 768px) {
  .has-tooltip::after {
    font-size: 11px;
    padding: 7px 10px;
    max-width: 180px;
    white-space: normal;
    text-align: center;
  }
}

/* container switch */
.switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 28px;
}

/* input nascosto */
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

/* slider */
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #ccc;
  transition: .3s;
  border-radius: 28px;
}

/* pallino */
.slider:before {
  position: absolute;
  content: "";
  height: 22px;
  width: 22px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

/* ON */
input:checked + .slider {
  background-color: #4CAF50;
}

input:checked + .slider:before {
  transform: translateX(22px);
}

/* ===== SETTINGS POPUP ===== */

.settings-popup {
  max-width: 400px;
  background: #1e293b;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.settings-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 10px;
  margin: 10px 0;
  background: #0f172a;
  border-radius: 12px;
  font-size: 15px;
  transition: 0.2s ease;
}

.settings-row:hover {
  background: #1e293b;
}

/* Switch migliorato */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #475569;
  transition: 0.3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.switch input:checked + .slider {
  background-color: #22c55e;
}

.switch input:checked + .slider:before {
  transform: translateX(22px);
}