/* =========================================================
   COSTES - Información General
   Tonos alineados con los contenedores de detalle
   ========================================================= */

.costes-info-general{
  margin-top: 12px;

  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;

  padding: 12px;
}

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

.costes-info-hr{
  margin: 10px 0 12px 0;
  border: 0;
  border-top: 1px solid rgba(130, 155, 178, 0.18);
  opacity: 1;
}

.costes-info-row{
  flex-wrap: nowrap;
  gap: 12px;
  align-items: stretch !important;
}

.costes-info-left{
  flex: 0 0 auto;
  padding: 0 !important;
  display: flex;
  align-items: stretch;
}

.costes-info-right{
  flex: 1 1 auto;
  min-width: 0;
  padding: 0 !important;
  display: flex;
  align-items: stretch;
}

.costes-cards-container{
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.costes-cardswrap{
  min-width: 0;
}

/* =========================================================
   PERFIL (izquierda)
   ========================================================= */

.costes-userchip{
  display: inline-flex;
  align-items: stretch;
  justify-content: center;

  padding: 12px;
  border-radius: 16px;

  background:
    linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0.008) 100%),
    #101820;

  border: 1px solid rgba(130, 155, 178, 0.18);

  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  backdrop-filter: blur(10px);
  overflow: hidden;

  max-width: 190px;
  align-self: stretch;
}

.costes-userchip-inner{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
}

.costes-userchip-avatar{
  width: 64px;
  height: 64px;
  border-radius: 999px;
  object-fit: cover;

  box-shadow:
    0 10px 24px rgba(0,0,0,0.40),
    0 0 0 2px rgba(130, 155, 178, 0.18);

  flex: 0 0 auto;
}

.costes-userchip-meta{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.costes-userchip-userrow{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.costes-userchip-ico{
  width: 16px;
  height: 16px;
  opacity: 0.95;
  flex: 0 0 auto;
}

.costes-userchip-username{
  color: rgba(255,255,255,0.95);
  font-weight: 900;
  letter-spacing: 0.2px;
  font-size: 13px;

  max-width: 160px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.costes-userchip-name{
  color: rgba(255,255,255,0.74);
  font-weight: 800;
  font-size: 12px;
  line-height: 1.1;

  max-width: 170px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.costes-userchip-empty{
  color: rgba(255,255,255,0.92);
  font-weight: 800;
  font-size: 13px;
}

/* =========================================================
   COSTES - Cards métricas
   ========================================================= */

.costes-cards-section{
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 12px;

  width: 100%;
  min-width: 0;
  flex-wrap: nowrap;

  align-self: stretch;
  flex: 1 1 auto;
}

.costes-cards-group{
  border-radius: 14px;
  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);
  padding: 10px 10px 8px 10px;

  min-width: 0;
  overflow: hidden;
}

/* Reparto por nº de tarjetas
   Desplazamientos = 6
   Compras = 2
   Total = 1
*/
.costes-cards-group.group-desp{
  flex: 6.2 1 0;
}

.costes-cards-group.group-compras{
  flex: 2 1 0;
}

.costes-cards-group.group-total{
  flex: 1 1 0;
  border-color: rgba(55,242,166,0.22);
  box-shadow:
    0 12px 28px rgba(0,0,0,0.22),
    0 0 0 1px rgba(55,242,166,0.08) inset;
}

.costes-cards-gtitle{
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: rgba(255,255,255,0.82);
  margin: 0 0 8px 0;
  white-space: nowrap;
}

/* =========================================================
   En la versión buena: una sola fila dentro de cada grupo
   ========================================================= */

.costes-cardswrap{
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  overflow: hidden;
  padding: 2px 0 0 0;
  min-width: 0;
  align-items: stretch;
}

/* =========================================================
   Tarjeta base
   ========================================================= */

.costes-metric-card{
  flex: 1 1 0;
  min-width: 0;
  width: auto;

  border-radius: 14px !important;
  border: 1px solid rgba(130, 155, 178, 0.18) !important;

  background:
    linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0.008) 100%),
    #101820 !important;

  box-shadow: 0 12px 28px rgba(0,0,0,0.22);
  backdrop-filter: blur(10px);
  overflow: hidden;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease, opacity .15s ease;
}

.costes-metric-card:hover{
  transform: translateY(-1px);
  border-color: rgba(130, 155, 178, 0.28) !important;
  box-shadow: 0 16px 34px rgba(0,0,0,0.28);
}

.costes-metric-body{
  padding: 10px 10px 9px 10px !important;
}

.costes-metric-inner{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  min-width: 0;
}

.costes-metric-title{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: rgba(255,255,255,0.74);
  font-weight: 900;
  font-size: 11px;
  letter-spacing: 0.2px;
  line-height: 1;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.costes-metric-ico{
  height: 14px;
  width: 14px;
  opacity: 0.95;
  flex: 0 0 auto;
}

.costes-metric-value{
  margin: 0 !important;
  color: rgba(255,255,255,0.95);
  font-weight: 900;
  font-size: 16px;
  line-height: 1.05;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

/* Estado: zero */
.costes-metric-card.is-zero{
  opacity: 0.62;
  border-color: rgba(130, 155, 178, 0.10) !important;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.010) 0%, rgba(255,255,255,0.004) 100%),
    #101820 !important;
}

/* Estado: nonzero */
.costes-metric-card.is-nonzero{
  opacity: 1;
  box-shadow:
    0 12px 28px rgba(0,0,0,0.22),
    0 0 0 1px rgba(55,242,166,0.06) inset;
}

/* =========================================================
   Accents (soft / strong)
   ========================================================= */

.costes-metric-card.accent-soft{
  border-color: rgba(55,242,166,0.22) !important;
  box-shadow:
    0 12px 28px rgba(0,0,0,0.22),
    0 0 0 1px rgba(55,242,166,0.08) inset,
    0 0 14px rgba(55,242,166,0.10);
}

.costes-metric-card.accent-strong{
  border-color: rgba(55,242,166,0.36) !important;
  background:
    linear-gradient(180deg, rgba(55,242,166,0.06) 0%, rgba(255,255,255,0.008) 100%),
    #101820 !important;

  box-shadow:
    0 16px 34px rgba(0,0,0,0.28),
    0 0 0 1px rgba(55,242,166,0.16) inset,
    0 0 22px rgba(55,242,166,0.16);
}

/* =========================================================
   FORMATO ALTERNATIVO
   ========================================================= */
@media (max-width: 1200px){

  .costes-info-general{
    padding: 10px;
  }

  .costes-info-row{
    gap: 10px;
  }

  .costes-userchip{
    max-width: 172px;
    padding: 10px;
  }

  .costes-userchip-avatar{
    width: 58px;
    height: 58px;
  }

  .costes-userchip-username{
    max-width: 145px;
    font-size: 12px;
  }

  .costes-userchip-name{
    max-width: 150px;
    font-size: 11px;
  }

  .costes-cards-section{
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    width: 100%;
    min-width: 0;
    overflow: hidden;
    align-items: stretch;
  }

  .costes-cards-group{
    min-width: 0;
    overflow: hidden;
    padding: 10px 10px 8px 10px;
  }

  .costes-cards-group.group-desp{
    flex: 0 0 auto;
  }

  .costes-cards-group.group-compras{
    flex: 1 1 0;
    container-type: inline-size;
  }

  .costes-cards-group.group-total{
    flex: 1 1 0;
  }

  .costes-cards-gtitle{
    font-size: 12px;
    margin: 0 0 8px 0;
  }

  .costes-cardswrap{
    display: grid;
    gap: 10px;
    overflow: hidden !important;
    min-width: 0;
    padding: 2px 0 0 0;
  }

  .group-desp .costes-cardswrap{
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-content: start;
  }

  .group-compras .costes-cardswrap{
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-content: start;
  }

  @container (max-width: 320px){
    .group-compras .costes-cardswrap{
      grid-template-columns: 1fr;
    }
  }

  .group-total .costes-cardswrap{
    grid-template-columns: 1fr;
    align-content: start;
  }

  .costes-metric-card{
    width: auto !important;
    min-width: 0;
    flex: initial;
  }

  .costes-metric-body{
    padding: 10px 12px !important;
  }

  .costes-metric-inner{
    display: flex;
    flex-direction: row !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left !important;
    min-width: 0;
  }

  .costes-metric-title{
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 6px;
    min-width: 0;
    max-width: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 11px;
  }

  .costes-metric-ico{
    width: 14px;
    height: 14px;
  }

  .costes-metric-value{
    margin: 0 !important;
    white-space: nowrap;
    font-size: 14px;
    line-height: 1;
    flex: 0 0 auto;
  }
}

/* =========================================================
   Más pequeño
   ========================================================= */
@media (max-width: 1100px){
  .costes-cards-section{
    display: grid;
    gap: 12px;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .group-desp .costes-cardswrap{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .group-compras .costes-cardswrap{
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* =========================================================
   Alineación de alturas
   ========================================================= */

.costes-info-left,
.costes-info-right{
  display: flex;
  align-items: stretch;
}

.costes-cards-container{
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: stretch;
}

.costes-userchip{
  align-self: stretch;
}

.costes-cards-section{
  align-self: stretch;
  width: 100%;
  flex: 1 1 auto;
  min-width: 0;
}

/* =========================================================
   MÓVIL
   ========================================================= */
@media (max-width: 992px){

  .costes-info-row{
    flex-wrap: wrap !important;
  }

  .costes-info-left{
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  .costes-userchip{
    display: flex;
    width: 100% !important;
    max-width: none !important;
    align-items: center;
  }

  .costes-userchip-inner{
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }

  .costes-userchip-meta{
    align-items: flex-start;
    text-align: left;
  }

  .costes-info-right{
    flex: 0 0 100% !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}