/* =========================================================
   RESUMEN ÚLTIMOS 9 MESES
   Contenedores alineados visualmente con "Mes Actual"
   + loaders con la misma altura que los gráficos finales
   + grid de 9 meses ajustado para:
     - usar todo el ancho
     - celdas rellenas completas cuando hay valor
     - iconos reales desde assets/imagenes
   ========================================================= */

/* =========================================================
   CONTENEDOR GENERAL
   ========================================================= */

.costes-summary9{
  margin-top: 14px;
  border-radius: 16px;
  border: 1px solid rgba(130, 155, 178, 0.18);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0.008) 100%),
    #0d1318;
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  backdrop-filter: blur(10px);
  overflow: hidden;
  min-height: 0;
}

/* =========================================================
   HEADER
   ========================================================= */

.costes-summary9-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 10px 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0.00) 100%);
  border-bottom: 1px solid rgba(130, 155, 178, 0.18);
}

.costes-summary9-title{
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255,255,255,0.92);
  font-weight: 900;
  letter-spacing: 0.2px;
  font-size: 13px;
}

.costes-summary9-icon{
  height: 18px;
  width: 18px;
  opacity: 0.95;
  filter: none;
}

/* =========================================================
   BODY
   ========================================================= */

.costes-summary9-body{
  padding: 12px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* =========================================================
   WRAPS PRINCIPALES
   ========================================================= */

.costes-summary9-tablewrap{
  border-radius: 16px;
  border: 1px solid rgba(130, 155, 178, 0.18);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0.008) 100%),
    #101820;
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  overflow: hidden;
  min-height: 0;
  padding: 10px;
}

.costes-summary9-row{
  margin-top: 0 !important;
  --bs-gutter-y: 0;
}

/* =========================================================
   CAJAS DE GRÁFICOS
   ========================================================= */

.costes-summary9-graphbox{
  border-radius: 16px;
  border: 1px solid rgba(130, 155, 178, 0.18);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0.008) 100%),
    #101820;
  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  overflow: hidden;

  height: auto;
  min-height: 320px;

  padding: 10px;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   WRAP DEL GRID
   ========================================================= */

.costes-r9-grid-wrap{
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: hidden;
}

/* =========================================================
   LOADER
   ========================================================= */

.costes-summary9-loader{
  width: 100%;
  height: clamp(300px, 34vh, 420px);
  min-height: 300px;
  max-height: 420px;

  display: flex;
  align-items: center;
  justify-content: center;

  overflow: hidden;
}

.costes-summary9-loaderimg{
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  opacity: 0.8;
}

/* =========================================================
   PLOTS PLOTLY
   ========================================================= */

.costes-summary9-plot{
  width: 100% !important;
  height: clamp(300px, 34vh, 420px) !important;
  min-height: 300px !important;
  max-height: 420px !important;
}

@media (max-width: 992px){
  .costes-summary9-loader{
    height: clamp(280px, 32vh, 360px);
    min-height: 280px;
    max-height: 360px;
  }

  .costes-summary9-plot{
    height: clamp(280px, 32vh, 360px) !important;
    min-height: 280px !important;
    max-height: 360px !important;
  }
}

/* =========================================================
   EMPTY GENÉRICO
   ========================================================= */

.hdg-empty{
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: rgba(255,255,255,0.58);
  font-weight: 700;
  font-size: 12px;
  border-radius: 12px;
  border: 1px solid rgba(130, 155, 178, 0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.010) 0%, rgba(255,255,255,0.004) 100%),
    #101820;
}

/* =========================================================
   GRID RESUMEN 9 MESES
   ========================================================= */

.costes-r9-grid-shell{
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.costes-r9-grid-head,
.costes-r9-grid-row{
  display: grid;
  column-gap: 8px;
  align-items: stretch;
  width: 100%;
  min-width: 0;
}

.costes-r9-grid-head{
  padding: 0;
}

.costes-r9-grid-body{
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* =========================================================
   HEADER GRID
   ========================================================= */

.costes-r9-hcell{
  min-width: 0;
  min-height: 30px;
  padding: 9px 10px;
  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 10px;
  border: 1px solid rgba(130, 155, 178, 0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0.006) 100%),
    #15202a;

  color: rgba(255,255,255,0.62);
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.costes-r9-col-cat{
  justify-content: flex-start;
}

.costes-r9-col-month.is-current{
  border-color: rgba(255,255,255,0.12);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.015) 100%),
    #1b2732;
  color: rgba(255,255,255,0.92);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

/* =========================================================
   CELDAS GRID
   ========================================================= */

.costes-r9-cell{
  position: relative;
  min-width: 0;
}

.costes-r9-cell-cat{
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(130, 155, 178, 0.16);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.012) 0%, rgba(255,255,255,0.006) 100%),
    #13202a;

  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.costes-r9-cat-img{
  width: 15px;
  height: 15px;
  object-fit: contain;
  opacity: 0.95;
  flex: 0 0 auto;
}

.costes-r9-cat-text{
  min-width: 0;
  color: rgba(255,255,255,0.92);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   CELDAS DE VALOR
   ========================================================= */

.costes-r9-cell-val{
  min-height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(130, 155, 178, 0.14);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.012) 0%, rgba(255,255,255,0.005) 100%),
    #13202a;
  overflow: hidden;
  position: relative;

  display: flex;
  align-items: stretch;
  justify-content: stretch;
}

.costes-r9-cell-bg{
  position: absolute;
  inset: 0;
  border-radius: 10px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
}

.costes-r9-cell-inner{
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.costes-r9-cell-num{
  color: rgba(255,255,255,0.96);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.costes-r9-cell-val.is-current{
  border-color: rgba(255,255,255,0.12);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

/* =========================================================
   COLOREADO COMPLETO DE CELDA
   ========================================================= */

.costes-r9-grid-row.row-kms .costes-r9-cell-val.is-filled .costes-r9-cell-bg{
  opacity: 1;
  background: linear-gradient(90deg, rgba(0,153,255,0.38) 0%, rgba(0,153,255,0.20) 100%);
}

.costes-r9-grid-row.row-tickets .costes-r9-cell-val.is-filled .costes-r9-cell-bg{
  opacity: 1;
  background: linear-gradient(90deg, rgba(55,242,166,0.38) 0%, rgba(55,242,166,0.20) 100%);
}

.costes-r9-grid-row.row-total .costes-r9-cell-val.is-filled .costes-r9-cell-bg{
  opacity: 1;
  background: linear-gradient(90deg, rgba(255,215,74,0.38) 0%, rgba(255,215,74,0.20) 100%);
}

.costes-r9-grid-row.row-generic .costes-r9-cell-val.is-filled .costes-r9-cell-bg{
  opacity: 1;
  background: linear-gradient(90deg, rgba(255,255,255,0.22) 0%, rgba(255,255,255,0.12) 100%);
}

.costes-r9-grid-row.row-kms .costes-r9-cell-cat{
  border-color: rgba(0,153,255,0.28);
}

.costes-r9-grid-row.row-tickets .costes-r9-cell-cat{
  border-color: rgba(55,242,166,0.24);
}

.costes-r9-grid-row.row-total .costes-r9-cell-cat{
  border-color: rgba(255,215,74,0.24);
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1200px){
  .costes-r9-grid-head,
  .costes-r9-grid-row{
    column-gap: 6px;
  }

  .costes-r9-hcell,
  .costes-r9-cell-inner,
  .costes-r9-cell-cat{
    padding-left: 10px;
    padding-right: 10px;
  }

  .costes-r9-hcell{
    font-size: 10px;
  }

  .costes-r9-cell-num,
  .costes-r9-cat-text{
    font-size: 11px;
  }
}

@media (max-width: 992px){
  .costes-summary9-body{
    gap: 10px;
    padding: 10px;
  }

  .costes-summary9-tablewrap,
  .costes-summary9-graphbox{
    padding: 10px;
  }

  .costes-summary9-row{
    --bs-gutter-y: 12px;
  }

  .costes-summary9-graphbox{
    min-height: 300px;
  }

  .costes-summary9-plot{
    height: clamp(280px, 32vh, 360px) !important;
    min-height: 280px !important;
    max-height: 360px !important;
  }

  .costes-summary9-loader{
    min-height: 280px;
  }
}