html {
  box-sizing: border-box;
  font-size: 18px;
  line-height: normal;
  --color1: #e5231b;
  --color2: #ff4000;

  --colorPositive: #1be568;
  --colorNegative: #e5231b;
  --colorMiddle: #e5c01b;
}

*,
*:before,
*:after {
  box-sizing: inherit;
}

body {
  font-family: "Arboria", sans-serif;
  padding: 0;
  margin: 0;
  color: #333;
  background: #f5f5f7;
  background: linear-gradient(0deg, rgba(34, 193, 195, 0.1) 0%, rgb(255 64 0 / 10%) 100%);
  background-attachment: fixed;
  /* overflow-x: hidden; */
  padding-top: 3em;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* COMMON */

.wrap h1:first-child {
  margin-top: 0;
}

h1,
h2 {
  color: var(--color2);
}

.wrap {
  padding: 1em;
}

.dataGrid {
  margin: 2em auto;
  display: grid;
  grid-gap: 0.1em;
  white-space: nowrap;
}

.dataGrid div {
  background: #fff;
  padding: 0.4em;
}

table {
  border-collapse: collapse;
  font-size: 14px;
  position: relative;
  background: #fff;
}

.transposedTable {
  margin: 2em 0;
}

table:not(.transposedTable) tr:nth-child(odd) {
  background: #fff;
}

table:not(.transposedTable) tr:nth-child(even) {
  background: #eee;
}

tr:first-child {
  background: transparent;
}

.transposedTable tr td.odd {
  background: #fff;
}

.transposedTable tr td.even {
  background: #eee;
}

tr:not(:first-child):hover {
  background: yellow;
}

th,
td {
  padding: 0.5em 1em;
  border: 1px solid #e3e3e3;
}

td {
  text-align: right;
}

th {
  font-family: "Roboto Condensed", sans-serif;
  background: var(--color1);
  background: #ccc;
  color: #666;
}

table:not(.transposedTable) th {
  position: sticky;
  top: calc(0 + 4em);
}

.transposedTable th {
  position: sticky;
  left: 0;
  z-index: 1;
}

/* tr:first-child th{
    background: #666;
    color: #ccc;
} */
table:not(.transposedTable) tr:nth-child(2) th {
  top: calc(30px + 4em);
  background: #666;
  color: #ccc;
  z-index: 1;
}

table:not(.transposedTable) tr:nth-child(3) th {
  top: 76px;
  top: calc(63px + 4em);
  z-index: 1;
}

th[merge-column][rowspan] {
  writing-mode: vertical-rl;
  text-orientation: sideways;
  transform: scale(-1);
}

.transposedTable th:nth-child(2),
.transposedTable th[merge-column="2"] {
  left: 70px;
  left: 43px;
  background: #666;
  color: #ccc;
}

.transposedTable th:nth-child(3),
.transposedTable th[merge-column="3"] {
  left: 165px;
  left: 108px;
}

th:empty {
  background-color: #f1f4f2 !important;
  border: 0;
}

th.selected,
td.selected {
  background-color: yellow !important;
}

th.ricaviHeader {
  background-color: #016401 !important;
}

th.costiHeader {
  background-color: #790101 !important;
}

.cell_data {
  text-align: center;
  white-space: nowrap;
  font-weight: bold;
}

.transposedTable .cell_data {
  position: sticky;
  top: 0;
  top: 4em;
}

table:not(.transposedTable) .cell_data {
  position: sticky;
  left: 0;
  background-color: inherit;
}

td .neg {
  color: #f44336;
}

/* HEADER */

.header {
  padding: 1em 2em;
  background-color: #fff;
  background-image: url(../../images/logo.svg);
  background-position: 1em 0.5em;
  background-size: 1.5em;
  background-repeat: no-repeat;
  padding-left: 4em;
  display: grid;
  grid-template-columns: 1fr min-content min-content;
  grid-gap: 2em;
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  z-index: 20;
  box-shadow: 0 3px 1px -2px rgb(0 0 0 / 14%), 0 2px 2px 0 rgb(0 0 0 / 10%),
    0 1px 5px 0 rgb(0 0 0 / 8%);
}

.headerNav {
  display: inline-grid;
  grid-auto-flow: column;
  width: min-content;
  grid-gap: 1em;
}

.headerNavItem {
  white-space: nowrap;
}

.headerNavItem.selected {
  color: var(--color2);
  font-weight: bold;
}

.headerGroup {
  white-space: nowrap;
}

.headerUser {
  white-space: nowrap;
}

.headerBtn {
  transform: scale(1.5);
  display: none;
  cursor: pointer;
  user-select: none;
}

/* LOGIN */

.loginPage {
  display: grid;
  align-items: center;
  min-height: 100vh;
}

.loginPage form {
  max-width: 20em;
  margin: 0 auto;
  padding: 2em;
  background-color: #fff;
  box-shadow: 0 3px 1px -2px rgb(0 0 0 / 14%), 0 2px 2px 0 rgb(0 0 0 / 10%),
    0 1px 5px 0 rgb(0 0 0 / 8%);
}

.loginPage img {
  display: block;
  max-width: 100%;
}

.loginPage input {
  display: block;
  width: 100%;
  margin: 1em auto !important;
  max-width: none !important;
  text-align: center;
}

/* INPUT */

.defaultForm {
  background-color: #fff;
}

.settingsForm {
  background: #fff;
  padding: 1em;
  margin: 1em auto;
}

.settingsForm h2 {
  margin-top: 0;
}

.defaultForm h3 {
  padding: 1em;
  margin: 0;
  margin-top: 1em;
}

.defaultInput {
  background-color: #f8f8f8;
  border: 1px solid #0001 !important;
  width: 100%;
  max-width: none !important;
}

.formLine {
  display: grid;
  grid-template-columns: 20em 1fr;
  grid-gap: 1em;
  padding: 2em 1em;
  border-bottom: 1px solid #0001;
}

.settingsForm .formLine {
  padding: 0.5em 0;
  margin: 0.5em auto;
}

.formLineMultiInputContainer {
  display: grid;
  grid-auto-flow: column;
  grid-gap: 2em;
}

.formLineMultiInputLabel {
  font-size: 0.8em;
  margin-bottom: 0.5em;
}

.formLineInput.withSymbol {
  position: relative;
}

.formLineInput.withSymbol {
  display: grid;
  grid-template-columns: min-content 1fr;
  align-items: center;
  grid-gap: 1em;
}

.formLineSymbol {
  font-size: 1.5em;
  line-height: 1em;
}

.formLineSublabel {
  font-size: 0.8em;
}

.defaultFormButtons {
  text-align: right;
  padding: 1em;
}

.formTable {
  width: 100%;
  margin: 2em auto;
  font-size: 16px;
  line-height: normal;
  padding: 1em;
  background: #fff;
}

.formTable th,
.formTable td {
  padding: 1em;
}

.formRow {
  display: flex;
  gap: 1rem;
  /* Adjust the spacing between fields */
  margin-bottom: 1rem;
  /* Add spacing between rows */
}

.formRow .formLine {
  flex: 1;
  /* Make each field take up equal space */
  min-width: 200px;
  /* Optional: Set a minimum width */
}

.periodo-container {
  display: flex;
  gap: 250px;
  margin-top: 1rem;
  padding: 0;
}

input:not([type="checkbox"]),
input[type="text"],
input[type="password"],
input[type="number"],
select {
  appearance: none;
  -webkit-appearance: none;
  font-family: "Arboria", sans-serif;
  padding: 0.5em;
  font-size: 1rem;
  line-height: 1em;
  border: 0;
}

.defaultBtn {
  display: inline-block;
  appearance: none;
  -webkit-appearance: none;
  font-family: "Arboria", sans-serif;
  padding: 0.5em 1em;
  font-size: 1rem;
  line-height: 1em;
  font-weight: 500;
  background: var(--color1);
  color: #fff;
  border: 2px solid var(--color1);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  max-width: none;
}

.defaultBtn:hover {
  color: var(--color1) !important;
  border-color: var(--color1) !important;
  background-color: #fff !important;
  /* outline: 2px solid; */
}

button#scaricaCSV:disabled,
button#scaricaTuttoCSV:disabled {
  background-color: grey;
  border-color: grey;
  cursor: not-allowed;
}

button#scaricaCSV:disabled:hover,
button#scaricaTuttoCSV:disabled:hover {
  background-color: grey !important;
  border-color: grey !important;
  color: white !important;
}

input::placeholder {
  color: #ccc;
}

input[type="submit"] {
  background: var(--color1);
  color: #fff;
}

label:not(:first-child) {
  margin-left: 2em;
}

/* FORM */

.editableTable {
  overflow-x: scroll;
}

.editableRow {
  padding: 1em;
  background: #fff;
  box-shadow: 0 3px 1px -2px rgb(0 0 0 / 14%), 0 2px 2px 0 rgb(0 0 0 / 10%),
    0 1px 5px 0 rgb(0 0 0 / 8%);
}

.editableRow:not(:first-child) {
  margin-top: 1em;
}

.editableRowInputs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-gap: 1em;
}

.editableRowBtns {
  margin-top: 1em;
  margin-left: auto;
  margin-right: 0;
  width: fit-content;
}

.test_formLineLabel {
  text-transform: uppercase;
  font-size: 0.8em;
  line-height: 1em;
  margin-bottom: 0.5em;
}

.test_formLineInput input,
.test_formLineInput select {
  width: 100%;
  min-width: unset;
  max-width: none;
  display: block;
  background: #f6f6f6;
}

.test_formButtons {
  width: fit-content;
  display: grid;
  grid-auto-flow: column;
  grid-gap: 1em;
  margin: 1em auto;
  margin-left: 0;
}

/* WIDGET */

.main-container {
  display: flex;
}

.first-row {
  display: flex;
  gap: 10px;
}

/*.widgetsContainer {
  /* margin: 2em auto; */
/*}*/

.widgetsRows {
  display: grid;
  grid-auto-flow: row;
  grid-gap: 2em;
}

.widgetsColumns {
  display: grid;
  grid-auto-flow: column;
  grid-gap: 2em;
}

/* .widget {
  background: #fff;
  padding: 1em;
  width: 100%;
  box-shadow: 0 3px 1px -2px rgb(0 0 0 / 14%), 0 2px 2px 0 rgb(0 0 0 / 10%),
    0 1px 5px 0 rgb(0 0 0 / 8%);
  margin: auto 20px;
  /* transition: opacity .5s;
} */
.widget {
  background-color: #ffffff;
  border-radius: 15px;
  padding: 1em;
  margin: 10px 10px;
  flex: 1 1 calc(50% - 20px);
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.widget::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, #ff704d, #ff4000);
}

.widget.loading {
  opacity: 0.5;
  pointer-events: none;
}

.widgetTitle {
  margin-top: 0;
  margin-bottom: 20px;
}

.widgetSubtitle {
  opacity: 0.8;
  font-size: 0.8em;
  line-height: 1em;
  font-style: italic;
}

.widgetContent {
  margin: 1em auto;
}

.widgetTableRow {
  padding: 0.5em;
}

.widgetTableRow:nth-child(odd) {
  background-color: #eee;
}

.widgetTableRow:after {
  clear: both;
  content: " ";
  display: block;
}

.widget .defaultBtn {
  margin-right: 0.2em;
  margin-bottom: 0.5em;
}

.widget .defaultBtn:not(.selected) {
  background-color: #ccc;
  border-color: #ccc;
}

.widgetFilter {
  border: 1px solid var(--color1);
  margin: 1em auto;
  padding: 1em;
  width: 100%;
  max-width: none;
}

.widgetFilter:first-child {
  margin-top: 0;
}

.widgetTableRow span:last-child {
  float: right;
}

.widgetStatus {
  float: right;
  display: block;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background-color: #eee;
  box-shadow: 0 3px 1px -2px rgb(0 0 0 / 14%), 0 2px 2px 0 rgb(0 0 0 / 10%),
    0 1px 5px 0 rgb(0 0 0 / 8%);
}

.widgetStatus.ok {
  background-color: var(--colorPositive);
}

.widgetStatus.ko {
  background-color: var(--colorNegative);
}

.widgetNumber {
  text-align: center;
  padding: 1em;
  border: 2px solid;
  border-radius: 1em;
}

.widgetNumberValue {
  font-size: 2em;
}

.bigNumber {
  font-size: 2em;
}

.widget-gruppo {
  max-width: 100vw;

  margin: 10px 10px;
  padding: 1em;
}

/* NOTIFICATIONS */

.notification {
  padding: 1em;
  padding-left: 1.7em;
  margin: 1em auto;
  border-left: 0.5em solid;
  background: #fff;
}

.notification h3 {
  margin-top: 0;
}

/* CMS */

.tablePaging {
  margin: 2em auto;
}

.tablePaging a {
  display: inline-block;
  padding: 1em;
  color: #000;
  background: #fff;
}

.tablePaging a.selected {
  color: #fff;
  background: var(--color1);
}

.tablePaging a:hover {
  background: #ddd;
}

/* HELPERS */

.loadingIcon {
  display: inline-block;
  background-image: url(../../images/icons/loading.svg);
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  width: 1em;
  height: 1em;
  animation: spin 4s linear infinite;
}

@keyframes spin {
  100% {
    -webkit-transform: rotate(360deg);
    transform: rotate(360deg);
  }
}

/* TABULATOR */

button {
  margin: 0;
}

input[name="tableFilter"] {
  float: right;
  margin-bottom: 1em;
}

.tabulator .tabulator-tableholder {
  height: auto !important;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content {
  padding: 0;
}

.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title-holder {
  padding: 0.5em;
}

.tabulator .tabulator-header .tabulator-col .tabulator-header-filter {
  background: #fff;
  border: 1px solid #eee;
}

/* Tabella compatta */
.tabulator .tabulator-cell {
  padding: 4px 6px !important;
  font-size: 11px !important;
  line-height: 1.3 !important;
}
.tabulator .tabulator-header .tabulator-col .tabulator-col-content .tabulator-col-title {
  padding: 4px 6px !important;
  font-size: 11px !important;
}
.tabulator .tabulator-row {
  min-height: 26px !important;
}
.tabulator .tabulator-cell .defaultBtn {
  padding: 4px 8px !important;
  font-size: 10px !important;
}

/* modifica mirko */

/* Contenitore dei Widget */
.contenitoreWidget {
  max-width: 100%;
  margin: 0 auto;
}

.contenutoWidget {
  max-width: 100%;
  gap: 40px;
}

.widgetNumero {
  background-color: #ffffff;
  border-radius: 15px;
  padding: 15px;
  margin: 25px auto;
  flex: 1 1 calc(50% - 20px);
  max-width: 100%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.widgetNumero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(90deg, #ff704d, #ff4000);
}

/* Sezione Intestazione */
.intestazioneWidget {
  display: flex;
  align-items: center;
  justify-content: left;
  margin-bottom: 10px;
  position: relative;
  height: 70px;
}

.etichettaWidgetNumero {
  font-weight: 600;
  color: #ff4000;
  font-size: 1.4em;
  margin-bottom: 5px;
}

/* Posizionamento del menu a tendina accanto all'etichetta */
.intestazioneWidget select {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Intestazioni delle Sezioni */
.intestazioneSezione {
  font-weight: 600;
  color: #4d1f00;
  font-size: 1.1em;
  margin: 15px 0 15px;
  border-bottom: 2px solid #ff4000;
  padding-bottom: 3px;
}

.headerSection {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 20px;
  flex-wrap: wrap;
  border: 2px solid #ff4000;
  border-radius: 20px;
  margin: 0 10px 20px 10px;
}

.tabsRoleSelection {
  padding: 20px;
  border: 2px solid #ff4000;
  border-radius: 20px;
  margin: 0 10px 20px 10px;
}

/* --- Tabs container --- */
.tabs {
  position: relative;
  display: inline-flex;
  justify-content: space-around;
  background: linear-gradient(180deg, #ffffffaa, #ffffff80);
  border: 2px solid #ff4000;
  border-radius: 20px;
  padding: 10px;
  /*box-shadow:var(--shadow);*/
  /*backdrop-filter:saturate(1.2) blur(6px);*/
  /*isolation:isolate; /* per lo slider */
  width: 100%;
}

.tabButton.tab {
  position: relative;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.2px;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  z-index: 1;
  width: 40%;
  border: 2px solid #ff4000;
}

.tabButton.tab.active {
  background-color: #ff4000;
  border-color: #ff4000;
  color: #fff;
}

.tabsRoleSelection {
  padding: 20px;
  border: 2px solid #ff4000;
  border-radius: 20px;
  margin: 0 10px 20px 10px;
  display: flex;
  justify-content: space-around;
}

.tabsInfo {
  background: #ff4000;
  justify-content: flex-start;
  padding: 10px 20px;
  margin: 0 10px 20px 10px;
  display: flex;
  border-radius: 20px;
}

.tabsInfo h1 {
  color: #fff;
  margin-bottom: 10px;
}

.tabsInfo p {
  color: #fff;
  margin: 5px 0;
}

.headerLeft {
  flex: 1;
}

.headerRight {
  display: block;
}

.headerIntervallo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0;
  margin-right: auto;
}

.headerIntervallo > label {
  font-weight: 600;
  /*color: #4d1f00;*/
  padding: 0 0 0 8px;
  line-height: 1.5;
}

.utenzaIntestazione {
  display: flex;
  justify-content: space-between;
  height: 70px;
}

/* Layout Griglia */
.grigliaWidget {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 10px;
}

.elementoGriglia {
  position: relative;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.elementoGriglia::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background-color: #ccc;
  border-top-left-radius: 10px;
  border-bottom-left-radius: 10px;
}

/* Colori specifici per le sezioni energetiche */
.prodotta::before {
  background-color: #ffd700;
}

.immessa::before {
  background-color: #28a745;
}

.consumata::before {
  background-color: #007bff;
}

.condivisa::before {
  background-color: #ff7f50;
}

/* Colori specifici per le sezioni economiche */
.autoconsumo::before {
  background-color: #6f42c1;
}

.incentivazione::before {
  background-color: #20c997;
}

.valorizzazione::before {
  background-color: #ff1493;
}

.vendita::before {
  background-color: #ff8c00;
}

.etichettaElementoGriglia {
  display: flex;
  align-items: center;
  font-weight: 600;
  color: #4d1f00;
  font-size: 1em;
  margin-bottom: 4px;
}

.etichettaElementoGriglia i {
  margin-right: 6px;
  font-size: 1em;
  color: #4d1f00;
}

.valoreElementoGriglia {
  font-size: 1.3em;
  font-weight: 500;
  color: #ff4000;
  margin-bottom: 6px;
  margin-left: 12px;
}

.sottoElemento {
  margin-left: 15px;
  font-size: 0.85em;
  color: #4d1f00;
  margin-bottom: 3px;
}

/* Stili dei Menu a Tendina */
#menuUtenze,
#globalTimespan {
  padding: 5px 20px;
  border-radius: 25px;
  border: 1px solid #ccc;
  width: 200px;
  /*color: #4d1f00;*/
  background-color: #fff;
  appearance: none;
  background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="https://www.w3.org/2000/svg" width="10" height="6"><path fill="%234d1f00" d="M5 6L0 0h10z"/></svg>');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 8px;
}

.custom-dropdown {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  line-height: 1.5;
  height: auto;
  display: inline-block;
  vertical-align: middle;
  background-position-y: center;
}

.utenzaMenu {
  text-align: center;
  padding: 20px;
}

/* Tab container styles */
.tabsContainer {
  display: flex;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
}

.tabsHeader {
  display: flex;
  justify-content: flex-end;
  margin-top: 5px;
  margin-right: auto;
  gap: 10px;
}

.tabButton {
  padding: 5px 10px;
  cursor: pointer;
  background: none;
  border: none;
  outline: none;
  border-bottom: 2px solid transparent;
  font-size: 16px;
  transition: border-color 0.3s, font-weight 0.3s;
}

.tabButton.active {
  border-bottom: 2px solid #1f1f1f;
  /* Active tab indicator */
  font-weight: bold;
  color: #1f1f1f;
}

.tabContent {
  display: none;
}

.tabContent.active {
  display: block;
}

.tabsValues {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.etichettaGruppo {
  text-align: left;
}

/*
.graficoRealtime {
  flex: 0 0 55%;
  max-width: 55%;
}
*/

.graficoRealtime {
  flex: 0 0 100%;
  max-width: 100%;
}

.valoriRealtime {
  max-width: 100%;
  min-height: 560px;
}

/* New widget-specific styles */

/* Custom container for the header row */
.widget-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  /* Space between the title and subtitle */
}

/* Custom style for the title inside the header */
.widget-header-title {
  flex: 1;
  font-weight: bold;
  font-size: 1.2em;
  color: var(--color2);
  text-align: left;
}

/* Custom style for the subtitle inside the header */
.widget-header-subtitle {
  font-size: 0.9em;
  font-style: italic;
  color: #666;
  text-align: right;
}

/* Tooltip infos */

.tooltip-container {
  position: relative;
  display: inline-block;
  cursor: pointer;
  margin-left: 8px;
  /* Space between value and icon */
  color: #ff5722;
  /* Info icon color */
}

.tooltip-container .tooltip {
  visibility: hidden;
  width: 250px;
  background-color: #333;
  color: #fff;
  text-align: center;
  padding: 5px;
  border-radius: 5px;
  position: fixed;
  /* Make it fixed to the viewport */
  z-index: 1000;
  /* Ensure it stays on top of all elements */
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.3);
}

.tooltip-container:hover .tooltip {
  visibility: visible;
  opacity: 1;
}

.tooltip-container .tooltip::after {
  content: "";
  position: absolute;
  top: var(--arrow-position, 100%);
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.tooltip-container .tooltip[data-arrow-position="top"]::after {
  top: 100%;
  /* Move arrow to the top of the tooltip */
  border-color: transparent transparent #333 transparent;
}

.formLine .tooltip-container .tooltip {
  position: absolute;
  top: 130%;
  left: 500%;
  transform: translateX(-50%);
  padding: 10px 14px;
  /* margini   */
  text-align: left;
  /* testo  */
}

/* Eye icon toggle password */

.password-container {
  position: relative;
  width: 100%;
}

.defaultInput {
  width: 100%;
  padding-right: 30px;
  /* Make space for the icon */
}


.defaultInput:has(option:checked[value=""]) {
  color: #ccc;
}

.toggle-password {
  position: absolute;
  right: 10px;
  /* Position the icon inside the input */
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  font-size: 18px;
  color: #666;
}

.toggle-password i {
  pointer-events: none;
  /* Prevent icon from interfering with input focus */
}

.toggle-password:hover i {
  color: #333;
}

/* ======================================================
   NEW  — Dashboard layout uniforme (3 colonne)
   ====================================================== */

/* ---------- titolo “Gruppo” ---------- */
.intestazioneWidget {
  margin-bottom: 25px;
}

/* ---------- griglia principale ---------- */
.dashboardGrid {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.dashboardGrid > div {
  flex: 1 1 420px;
}

@media (max-width: 900px) {
  .dashboardGrid > div {
    flex: 1 1 100%;
  }
}

/* ---------- struttura card ---------- */
.elementoGriglia {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

/* card a 2 righe (110 px) e card economiche: stessa min-height */
.elementoGriglia.prodotta,
.elementoGriglia.immessa,
.elementoGriglia.consumata,
.elementoGriglia.condivisa,
.elementoGriglia.autoconsumo,
.elementoGriglia.vendita,
.elementoGriglia.incentivazione,
.elementoGriglia.valorizzazione {
  min-height: 110px;
}

/* ---------- TERZA COLONNA : Costi / Ricavi ---------- */
/* Griglia 3 colonne */
.wrapper_scadenze {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: start;
}

/* IMPORTANT: consenti alla cella di restringersi senza overflow */
.wrapper_scadenze .formLine {
  min-width: 0;
  /* FIX overflow in grid */
  display: block !important;
  /* forza layout verticale (label sopra input) */
  margin: 0;
  /* evita margini che allargano la cella */
  overflow: hidden;
  /* ulteriore safety */
}

/* Stack e compattazione interna */
.wrapper_scadenze .formLineLabel {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  white-space: normal;
  /* evita label su una sola riga lunga */
}

.wrapper_scadenze .formLineInput {
  display: block;
  width: 100%;
}

/* L’input non deve avere larghezze rigide */
.wrapper_scadenze .defaultInput,
.wrapper_scadenze .formLineInput .defaultInput {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* (se usate .withSymbol che crea padding/icone a sinistra, lo neutralizziamo qui) */
.wrapper_scadenze .formLineInput.withSymbol .formLineSymbol {
  display: none;
}

.wrapper_scadenze .formLineInput.withSymbol {
  padding-left: 0;
}

/* Responsivo (opzionale) */
@media (max-width: 900px) {
  .wrapper_scadenze {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .wrapper_scadenze {
    grid-template-columns: 1fr;
  }
}

/* FINE TABELLA SCADENZA COSTI */
/* (fine blocco) */

:root {
  --bg: #f1f5f9;
  /* slate-100 */
  --card: #ffffff;
  --bd: #e2e8f0;
  /* slate-200 */
  --txt: #0f172a;
  /* slate-900 */
  --muted: #64748b;
  /* slate-500 */
  --muted2: #94a3b8;
  /* slate-400 */
  --green: #16a34a;
  --sky: #0ea5e9;
  --teal: #16a34a;
  --orange: #ff4000;
  --rose: #e11d48;
  --yellow: #fcc30b;
  --roseSoft: #ffe4e6;
  --emerald: #10b981;
  --emeraldSoft: #ecfdf5;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.05);
  --prodotta: var(--yellow);
  --autoconsumata: var(--green);
  --immessa: var(--sky);
  --condivisa: var(--green);
  --eccesso: var(--orange);
  --consumata: var(--yellow);
  --prelevata: var(--sky);
  --nocondivisa: var(--orange);
  --indicatori: var(--orange);
  --componentiCER: var(--orange);
  --barEntrate: var(--green);
  --barCosti: var(--orange);
  --homeCardAlpha: 0.2;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 14px/1.45 system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans,
    sans-serif;
}

.wrap {
  max-width: 1400px;
  margin: 24px auto;
  padding: 0 16px;
}

header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

h1 {
  font-size: 24px;
  margin: 0;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.toggle {
  display: flex;
  gap: 6px;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--bd);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.toggle button {
  border: 0;
  background: transparent;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.toggle button.active {
  background: #0f172a;
  color: #fff;
}

.grid {
  display: grid;
  gap: 12px;
}

@media (min-width: 1024px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }

  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

.badge {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--bd);
  border-radius: 16px;
  background: var(--card);
  /*box-shadow:var(--shadow);min-height:64px;*/
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.badge::before,
.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: #ff4000;
}

/* Fieldset card: legend inline con barra rossa */
fieldset.card::before { display: none; }
fieldset.card > legend {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  padding: 0;
  margin: 0 0 4px;
}
fieldset.card > legend::after {
  content: "";
  flex: 1;
  height: 5px;
  background: #ff4000;
  border-radius: 2px;
}

/* Sottotitoli sezione dentro fieldset */
.section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color1);
  margin: 0 0 0.2rem 0;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid #ddd;
}
.cardBody > .section-title:first-child {
  margin-top: -4px;
}

.badge .dot {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #0f172a;
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
}

.badge .lbl {
  font-size: 12px;
  color: #64748b;
}

.badge .val {
  font-size: 18px;
  font-weight: 700;
}

.card {
  border: 1px solid var(--bd);
  background: var(--card);
  border-radius: 16px;
  padding: 26px;
  /*box-shadow:var(--shadow)*/
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.card h3 {
  margin: 0 0 8px;
  font-size: 16px;
}

.row {
  margin-bottom: 12px;
}

.eq {
  display: flex;
  gap: 8px;
  align-items: center;
  color: #475569;
  font-size: 13px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}

.eq .sum {
  background: #f8fafc;
  border: 1px solid var(--bd);
  border-radius: 8px;
  padding: 2px 8px;
  color: #475569;
}

.legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  color: #475569;
  font-size: 12px;
}

.legend .i {
  display: flex;
  gap: 6px;
  align-items: center;
}

.legend .sw {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ECON grafico: classi rinominate per evitare collisioni */
.water .econWrap {
  height: 24px;
  background: #f1f5f9;
  display: flex;
  overflow: hidden;
  flex: 1;
  min-width: 120px;
  border-radius: 10px;
}

.water .econBar {
  height: 24px;
  display: block;
  background: rgb(from var(--barEntrate) r g b / var(--homeCardAlpha));
  border-radius: 10px 0 0 10px;
}

.water .econBar.-cost {
  background: rgb(from var(--barCosti) r g b / var(--homeCardAlpha));
}

.water .row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.water .label {
  width: 240px;
  color: #475569;
  font-size: 13px;
}

.muted2 {
  color: #475569;
  font-size: 12px;
}

footer {
  color: #94a3b8;
  text-align: center;
  font-size: 11px;
  padding: 12px 0 28px;
}

.status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.ok {
  background: #dcfce7;
  color: #166534;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
}

.optionWrap {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}

#customDateRange label:not(:first-child) {
  margin-left: 1em;
}

.headerIntervallo select,
#customDataRange input {
  border-radius: 16px !important;
}

.groupInfo {
  width: 100%;
}

.groupLeft {
  display: flex;
  align-items: flex-end;
}

.cerName h2 {
  margin: 0;
}

.cerSede {
  margin-left: 20px;
}

.headerSection.badge {
  margin: 0 0 20px 0;
}

.cerInfoContent > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

button#btn-cer,
button#btn-utente,
.headerIntervallo label,
.optionWrap select {
  font-family: "Arboria", sans-serif !important;
  font-size: 14px;
}

.headerIntervallo #customDateRange .form-control.input {
  border-radius: 16px;
  padding-left: 20px;
  border: 1px solid #ccc;
}

#globalTimespan:focus-visible {
  border-color: red;
}

/* ===========================
   EQ CARDS (label sopra + valore sotto)
   =========================== */
.eq-cards {
  display: flex;
  align-items: stretch;
  gap: 8px;
  flex-wrap: wrap;
  margin: 6px 0 8px;
}

.eq-card {
  background: #f8fafc;
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 6px 10px;
  min-width: 120px;
  text-align: center;
}

.eq-card .k {
  font-size: 14px;
  font-weight: 700;
}

.eq-card .v {
  font-size: 14px;
  font-weight: 800;
}

.eq-op {
  align-self: center;
  padding: 0 4px;
  color: #64748b;
  font-weight: 700;
}

/* BARRE: solo colore, niente testo interno; cursore con tooltip nativo */
.stack {
  height: 32px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--bd);
  border-radius: 10px;
}

.seg {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 0;
  /* niente padding, niente testo */
  white-space: nowrap;
  cursor: help;
  /* suggerisce il tooltip on-hover */
}

/* ===== Tooltip custom per le barre ===== */
.stack {
  overflow: visible;
}

/* serve per non tagliare il tooltip */

.seg[data-tip] {
  position: relative;
}

/* Bolla */
.seg[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, -8px);
  background: var(--tt-bg, rgba(15, 23, 42, 0.92));
  /* colore bolla */
  color: var(--tt-color, #fff);
  /* colore testo */
  font-weight: 700;
  font-size: var(--tt-fs, 12px);
  /* dimensione font */
  line-height: 1;
  padding: var(--tt-pad, 6px 10px);
  /* padding */
  border-radius: var(--tt-radius, 999px);
  /* forma/angoli */
  white-space: nowrap;
  box-shadow: var(--tt-shadow, 0 8px 24px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0.15s;
  z-index: 20;
}

/* Freccia */
.seg[data-tip]::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translate(-50%, 0);
  border: 6px solid transparent;
  border-top-color: var(--tt-bg, rgba(15, 23, 42, 0.92));
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s 0.15s;
  z-index: 20;
}

/* Stato hover/attivo */
.seg[data-tip]:hover::after,
.seg[data-tip]:hover::before {
  opacity: 1;
  visibility: visible;
  transition-delay: 0s;
}

.seg[data-tip]:hover::after {
  transform: translate(-50%, -12px);
}

.stack .seg:nth-child(1) {
  border-radius: 10px 0 0 10px;
}

.stack .seg:nth-child(2) {
  border-radius: 0 10px 10px 0;
}

/* — Esempi di colori specifici per segmento (facoltativi) — */
#prod-main .seg:nth-child(1) {
  --tt-bg: var(--green);
}

#prod-main .seg:nth-child(2) {
  --tt-bg: var(--sky);
}

#prod-immessa .seg:nth-child(1) {
  --tt-bg: var(--teal);
}

#prod-immessa .seg:nth-child(2) {
  --tt-bg: var(--orange);
}

#cons-main .seg:nth-child(1) {
  --tt-bg: var(--green);
}

#cons-main .seg:nth-child(2) {
  --tt-bg: var(--sky);
}

#cons-prelevata .seg:nth-child(1) {
  --tt-bg: var(--teal);
}

#cons-prelevata .seg:nth-child(2) {
  --tt-bg: var(--orange);
}

.cerInfoContent .eq-card {
  /*background: #ff4000;*/
  background: rgb(from var(--componentiCER) r g b / var(--homeCardAlpha));
}

.eq-card.eq-prodotta {
  /*background: #FCC30B;*/
  background: rgb(from var(--prodotta) r g b / var(--homeCardAlpha));
}

.eq-card.eq-consumata {
  /*background: #FCC30B;*/
  background: rgb(from var(--consumata) r g b / var(--homeCardAlpha));
}

.eq-card.eq-autoconsumata {
  /*background: var(--teal);*/
  background: rgb(from var(--autoconsumata) r g b / var(--homeCardAlpha));
}

.eq-card.eq-condivisa {
  /*background: var(--teal);*/
  background: rgb(from var(--condivisa) r g b / var(--homeCardAlpha));
}

.eq-card.eq-prelevata {
  /*background: var(--sky);*/
  background: rgb(from var(--prelevata) r g b / var(--homeCardAlpha));
}

.eq-card.eq-immessa {
  /*background: var(--sky);*/
  background: rgb(from var(--immessa) r g b / var(--homeCardAlpha));
}

.eq-card.eq-no-condivisa {
  /*background: var(--orange);*/
  background: rgb(from var(--nocondivisa) r g b / var(--homeCardAlpha));
}

.eq-card.eq-eccesso {
  /*background: var(--orange);*/
  background: rgb(from var(--eccesso) r g b / var(--homeCardAlpha));
}

/* ===== STACK A DUE LIVELLI (clip + overlay) ===== */
.stack {
  position: relative;
  height: var(--h, 32px);
  border-radius: 9999px;
  /* angoli esterni perfetti */
  border: 1px solid var(--bd);
}

/* LAYER VISIVO: arrotondato + clippato */
.stack__clip {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  /* il clipping avviene qui */
  display: flex;
}

.seg-bg {
  height: 100%;
  flex: 0 0 0%;
  /* verrà impostato in JS */
  background: #0ea5e9;
  /* colore di fallback */
}

/* LAYER INTERATTIVO: nessun clipping, solo hit-area + tooltip */
.stack__overlay {
  position: absolute;
  inset: 0;
  display: flex;
  overflow: visible;
  /* i tooltip possono uscire */
}

.seg-hit {
  position: relative;
  flex: 0 0 0%;
  /* verrà impostato in JS */
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ingrandisce invisibilmente l'area di hover anche con width 0.5% */
.seg-hit::before {
  content: "";
  position: absolute;
  inset: -6px -8px;
}

/* tooltip puro CSS; il testo arriva da data-tip */
.seg-hit::after {
  content: attr(data-tip);
  position: absolute;
  left: calc(50% + var(--shift, 0px));
  top: -8px;
  transform: translate(-50%, -8px);
  background: #111;
  color: #fff;
  border-radius: 6px;
  padding: 4px 8px;
  white-space: nowrap;
  font: 12px/1 system-ui, sans-serif;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s, transform 0.15s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  z-index: 1000;
}

.seg-hit:hover::after {
  opacity: 1;
  transform: translate(-50%, -14px);
}

/* quando c’è un solo segmento visibile, arrotonda tutti gli angoli */
.stack .seg.-solo {
  border-radius: 10px !important;
}

/* Card del grafico (fondo pagina) */
.chartCard {
  width: 100%;
}

/* Wrapper per altezza fluida del canvas Chart.js */
.chartWrap {
  position: relative;
  width: 100%;
  height: 420px;
  /* puoi variare (360–520px) a gusto */
}

.chartWrap canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

/* KPI: anagrafica + performance mini */
.kpi-anagrafica .r {
  line-height: 1.25;
}

.kpi-anagrafica .den {
  font-weight: 700;
  font-size: 16px;
  margin-bottom: 2px;
}

.kpi-anagrafica .adr {
  color: #475569;
}

.kpi-anagrafica .cls {
  color: #0f172a;
  margin-top: 2px;
}

.perf-mini {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.perf-mini .p {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border: 1px solid var(--bd);
  border-radius: 10px;
  padding: 6px 10px;
}

.perf-mini .p span {
  color: #64748b;
  font-size: 12px;
}

.perf-mini .p strong {
  font-size: 16px;
}

#kpi-perf .eq-card {
  display: flex;
  flex-direction: column;
  /*background: #ff4000;*/
  background: rgb(from var(--indicatori) r g b / var(--homeCardAlpha));
  font-weight: 700;
}

#kpi .badge {
  display: flex;
  flex-direction: column;
  text-align: center;
}

.r.den {
  margin-bottom: 10px;
}

.r.cls {
  margin-top: 10px;
}

.r.cls strong {
  text-transform: uppercase;
}

/*stile pagine condensate*/
/* ============================
   FORMS COMPACT / GROUPED ROWS
   ============================ */

/* Attiva stile compatto solo dove serve */
.defaultForm.--condensed {
  background: transparent;
}

/* Titoli sezione del form */
.defaultForm.--condensed h3 {
  margin: 0;
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  color: #334155;
  border-top: 1px solid var(--bd);
  background: linear-gradient(180deg, #ffffffd0, #ffffffa0);
}

.defaultForm.--condensed h3:first-of-type {
  border-top: 0;
  border-radius: 16px 16px 0 0;
}

/* Riga form compatta */
.defaultForm.--condensed .formLine {
  padding: 8px 12px;
  border-bottom: 1px dashed #e2e8f0;
  grid-template-columns: 12em 1fr;
  /* label stretta + contenuto */
}

.defaultForm.--condensed .formLine:last-of-type {
  border-bottom: 0;
}

.defaultForm.--condensed .formLine[style*="display: none"],
.defaultForm.--condensed .formLine[style*="display:none"] {
  border-bottom: 0 !important;
}

/* Densità extra (su alcune righe) */
.formLine.--dense {
  padding: 6px 10px;
}

/* Contenitore multi-input dentro la stessa riga */
.defaultForm.--condensed .formLineMultiInputContainer {
  display: grid;
  gap: 8px 10px;
}

/* Varianti a colonne per la riga multi-campo */
.formLine.--cols-2 .formLineMultiInputContainer {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row;
}

.formLine.--cols-3 .formLineMultiInputContainer {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-flow: row;
}

.formLine.--cols-4 .formLineMultiInputContainer {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-flow: row;
}

.formLine.--cols-5 .formLineMultiInputContainer {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-auto-flow: row;
}

.formLine.--cols-6 .formLineMultiInputContainer {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-auto-flow: row;
}

.formLine.--cols-7 .formLineMultiInputContainer {
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-auto-flow: row;
}

.formLine.--cols-auto .formLineMultiInputContainer {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  grid-auto-flow: row;
}

/* Label e input compatti */
.defaultForm.--condensed label,
.defaultForm.--condensed .formLineMultiInputLabel {
  font-size: 12px;
  color: #475569;
  margin-bottom: 4px;
}

.defaultForm.--condensed .defaultInput,
.defaultForm.--condensed input[type="text"],
.defaultForm.--condensed input[type="number"],
.defaultForm.--condensed input[type="date"],
.defaultForm.--condensed select {
  height: 32px;
  font-size: 14px;
  line-height: 1;
  background: #f8fafc;
  border: 1px solid var(--bd) !important;
  border-radius: 8px;
  padding: 6px 8px;
}

.defaultForm.--condensed.--validated input:invalid:not(:focus) {
  border-color: #dc3545 !important;
  background-color: #fff5f5 !important;
}
.defaultForm.--condensed.--validated select:invalid:not(:focus) {
  border-color: #dc3545 !important;
  background-color: #fff5f5 !important;
}

/* Bottoni form */
.defaultForm.--condensed .defaultFormButtons {
  padding: 10px 12px;
  border-top: 1px solid var(--bd);
}

.defaultForm.--condensed .defaultBtn {
  border-radius: 10px;
}

/* Nasconde la colonna label e rende la riga a 1 colonna (solo contenuto) */
.defaultForm.--condensed .formLine.--nolabel {
  grid-template-columns: 1fr !important;
}

.defaultForm.--condensed .formLine.--nolabel .formLineLabel {
  display: none !important;
}

/* Box/card di sezione allineati allo stile globale */
.sectionCard {
  margin-top: 12px;
}

.sectionCard .card {
  padding: 0;
  overflow: hidden;
  margin-bottom: 10px;
}

.sectionCard .card .cardBody {
  padding: 5px 10px 10px;
}

/* Header compatto (breadcrumb + titolo) */
.backLink {
  font-size: 13px;
  color: #475569;
}

.backLink:hover {
  text-decoration: underline;
}

/* Responsive: a schermi stretti, le righe passano a 2 o 1 colonne */
@media (max-width: 900px) {
  .formLine.--cols-auto .formLineMultiInputContainer {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  }

  .formLine.--cols-7 .formLineMultiInputContainer,
  .formLine.--cols-6 .formLineMultiInputContainer,
  .formLine.--cols-5 .formLineMultiInputContainer,
  .formLine.--cols-4 .formLineMultiInputContainer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .formLine.--cols-3 .formLineMultiInputContainer {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .defaultForm.--condensed .formLine {
    grid-template-columns: 1fr;
  }

  .formLine.--cols-auto .formLineMultiInputContainer,
  .formLine.--cols-7 .formLineMultiInputContainer,
  .formLine.--cols-6 .formLineMultiInputContainer,
  .formLine.--cols-5 .formLineMultiInputContainer,
  .formLine.--cols-4 .formLineMultiInputContainer,
  .formLine.--cols-3 .formLineMultiInputContainer,
  .formLine.--cols-2 .formLineMultiInputContainer {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   === INLINE REMOVAL — REGOLE CHE SOSTITUISCONO GLI INLINE ===
   (Usano SOLO ID e gerarchia esistente. Nessuna nuova classe.)
   ========================================================= */

/* 1) Mostra/nascondi iniziali (prima erano inline) */

#utentePicker {
  display: none;
}

/* 2) Spaziature che erano in inline */
.energia-blocco {
  margin-top: 12px;
}

.economia-blocco {
  margin-top: 12px;
}

.chartCard {
  margin-top: 12px;
}

.widget-header-row {
  margin-bottom: 8px;
}

/* 3) Rientro col bordo verticale per le “sotto-equazioni” (immessa/prelevata) */
.card:not(.water) > .sub-equation {
  padding-left: 18px;
  border-left: 2px solid #e2e8f0;
  margin-top: 12px;
}

/* 4) Altezza canvas grafico (prima inline) */
.chartWrap {
  height: 420px;
}

/* 5) Colori segmenti delle barre (prima inline su .seg) */
#seg-autoconsumata {
  /*background: var(--green);*/
  background: rgb(from var(--autoconsumata) r g b / var(--homeCardAlpha));
}

#seg-immessa {
  /*background: var(--sky);*/
  background: rgb(from var(--immessa) r g b / var(--homeCardAlpha));
}

#seg-immessa-condivisa {
  /*background: var(--teal);*/
  background: rgb(from var(--condivisa) r g b / var(--homeCardAlpha));
}

#seg-immessa-eccesso {
  /*background: var(--orange);*/
  background: rgb(from var(--eccesso) r g b / var(--homeCardAlpha));
}

#seg-cons-autoconsumata {
  /*background: var(--green);*/
  background: rgb(from var(--autoconsumata) r g b / var(--homeCardAlpha));
}

#seg-prelevata {
  /*background: var(--sky);*/
  background: rgb(from var(--prelevata) r g b / var(--homeCardAlpha));
}

#seg-prelevata-condivisa {
  /*background: var(--teal);*/
  background: rgb(from var(--condivisa) r g b / var(--homeCardAlpha));
}

#seg-prelevata-non {
  /*background: var(--orange);*/
  background: rgb(from var(--nocondivisa) r g b / var(--homeCardAlpha));
}

/* 6) Swatch delle legend in base alla gerarchia (prima inline) */
#prod-main + .legend .i:nth-child(1) .sw {
  background: rgb(from var(--autoconsumata) r g b / var(--homeCardAlpha));
}

#prod-main + .legend .i:nth-child(2) .sw {
  background: rgb(from var(--immessa) r g b / var(--homeCardAlpha));
}

#prod-immessa + .legend .i:nth-child(1) .sw {
  background: rgb(from var(--condivisa) r g b / var(--homeCardAlpha));
}

#prod-immessa + .legend .i:nth-child(2) .sw {
  background: rgb(from var(--eccesso) r g b / var(--homeCardAlpha));
}

#cons-main + .legend .i:nth-child(1) .sw {
  background: rgb(from var(--autoconsumata) r g b / var(--homeCardAlpha));
}

#cons-main + .legend .i:nth-child(2) .sw {
  background: rgb(from var(--prelevata) r g b / var(--homeCardAlpha));
}

#cons-prelevata + .legend .i:nth-child(1) .sw {
  background: rgb(from var(--condivisa) r g b / var(--homeCardAlpha));
}

#cons-prelevata + .legend .i:nth-child(2) .sw {
  background: rgb(from var(--nocondivisa) r g b / var(--homeCardAlpha));
}

/* 7) Allineamento e larghezza delle etichette valore a destra (prima inline su #val-*) */
#val-auto,
#val-vendita,
#val-inc,
#val-val,
#val-tot,
#cval-com,
#cval-imp,
#cval-gse,
#cval-alt,
#cval-tot {
  width: 120px;
  text-align: right;
  font-weight: 400;
}

/* Totali in grassetto (prima inline) */
.row.row-totale #val-tot,
.row.row-totale #cval-tot {
  font-weight: 700;
}

/* 8) Barre economiche: l’involucro e le barre sono già definiti.
      Qui nessun cambiamento di classi, solo lasciamo che .-cost esista
      (già nel tuo CSS: background rosso per i costi). */

/* 9) Tooltip delle stack: i colori della bolla già definiti in base all’id
      delle stack sopra (regole esistenti nel tuo CSS rimangono valide). */

/* --- Toolbar sopra la tabella --- */
.tableToolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 8px 0 12px;
}

.tableCard {
  padding: 12px;
  margin-bottom: 30px;
}

/* Input ricerca compatto con bordi arrotondati */
.searchInput {
  min-width: 220px;
  border-radius: 12px;
}

/* Semaforo di stato (dot) */
.s-dot {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  vertical-align: middle;
}

.s-green {
  background: green;
}

.s-red {
  background: var(--colorNegative, #e5231b);
}

/* Bottone per azione distruttiva */
.defaultBtn.btnDanger {
  background: var(--colorNegative, #e5231b);
  border-color: var(--colorNegative, #e5231b);
}

.defaultBtn.btnDanger:hover {
  color: var(--colorNegative, #e5231b) !important;
  background: #fff !important;
  border-color: var(--colorNegative, #e5231b) !important;
}

.fileCSVTable h2 {
  margin: 0 0 10px 0;
}

/*AGGIUNTE PAGINA CASSA */
/* ===== KPI ===== */
.kpiGrid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0 20px;
}
@media (max-width: 900px) {
  .kpiGrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .kpiGrid {
    grid-template-columns: 1fr;
  }
}

.kpiCard {
  background: #fff;
  border: 1px solid var(--border, #e7e7ea);
  border-radius: 10px;
  padding: 12px 14px;
  box-shadow: var(--card-shadow, 0 1px 2px rgba(0, 0, 0, 0.04));
}
.kpiLabel {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 4px;
}
.kpiValue {
  font-size: 1.25rem;
  font-weight: 600;
}

/* ===== Toolbar tune ===== */
.tableToolbar .toolbarRow {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}
.tableToolbar .toolbarItem {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tableToolbar .toolbarItem.flex1 {
  flex: 1;
}

/* ===== Export block ===== */
.fileCSVTable {
  margin-top: 18px;
}
.fileCSVTable .exportBtns {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ===== Buttons (reuse) ===== */
.btnPrimary {
  background: #0d6efd;
  color: #fff;
}
.btnPrimary:hover {
  filter: brightness(0.95);
}

/* ===== Modal (lightweight) ===== */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1000;
}
.modal.open {
  display: flex;
}
.modalDialog {
  background: #fff;
  width: min(680px, 92vw);
  border-radius: 12px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}
.modalHeader,
.modalFooter {
  padding: 12px 14px;
  background: #fafafa;
  border-bottom: 1px solid #eee;
}
.modalFooter {
  border-top: 1px solid #eee;
  border-bottom: none;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.modalBody {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modalClose {
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  float: right;
  padding: 0 6px;
}
.formRow {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.formRow.twoCols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 700px) {
  .formRow.twoCols {
    grid-template-columns: 1fr;
  }
}

/* Minor text */
.muted {
  color: #6b7280;
  font-size: 0.9rem;
}

/* ====== AGGREGAZIONE — stile coerente con card/toggle ====== */
#aggControls.card {
  padding-top: 16px;
}

#aggControls .aggRow {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px 12px;
  align-items: start;
}

#aggControls .aggRowTitle {
  font-weight: 700;
  color: #64748b; /* come .badge .lbl */
  line-height: 32px;
}

/* Contenitore dei "pill" */
#aggControls .aggPills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Bottoni tipo "chip" in linea con .toggle button e palette del tema */
#aggControls .aggPills .pill {
  appearance: none;
  border: 1px solid var(--bd);
  background: #ffffff;
  color: #334155;
  padding: 8px 14px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}

/* hover/focus accessibile */
#aggControls .aggPills .pill:hover {
  background: #f8fafc;
}
#aggControls .aggPills .pill:focus-visible {
  outline: 2px solid #ff4000;
  outline-offset: 2px;
  border-color: #ff4000;
}

/* Stato attivo coerente con i toggle (sfondo scuro o arancione brand) */
#aggControls .aggPills .pill.active {
  background: #0f172a;
  color: #fff;
  border-color: #0f172a;
}

/* Variante “brand” (se preferisci l’arancione) — scommenta questa e commenta la precedente
#aggControls .aggPills .pill.active {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
*/

/* Micro-feedback al click */
#aggControls .aggPills .pill:active {
  transform: translateY(1px);
}

/* Compattezza su schermi stretti */
@media (max-width: 700px) {
  #aggControls .aggRow {
    grid-template-columns: 1fr;
  }
  #aggControls .aggRowTitle {
    line-height: 1.2;
  }
}
