/* =========================================================
   COSTES · TAB TICKETS
   Alineada con TAB KILÓMETROS y TAB MI MES
   - mismo arranque vertical efectivo
   - mismos bloques base
   - grid ocupando el alto real
   - timeline limpio
   ========================================================= */

:root{
  --ctkt-bg-1: #0d1318;
  --ctkt-bg-2: #101820;
  --ctkt-bg-3: #151f28;

  --ctkt-line: rgba(130,155,178,0.18);
  --ctkt-line-soft: rgba(130,155,178,0.10);

  --ctkt-text: rgba(255,255,255,0.92);
  --ctkt-text-soft: rgba(255,255,255,0.74);
  --ctkt-text-dim: rgba(255,255,255,0.58);

  --ctkt-green: #37f2a6;
  --ctkt-hover: rgba(55,242,166,0.05);

  --ctkt-radius-xl: 18px;
  --ctkt-radius-lg: 14px;
  --ctkt-radius-md: 12px;

  --ctkt-shadow-block: 0 12px 28px rgba(0,0,0,0.22);
  --ctkt-scrollbar-w: 10px;
}

/* =========================================================
   WRAPPER ANTIGUO OPCIONAL
   ========================================================= */

.costes-tickets{
  margin-top: 0;
  border-radius: var(--ctkt-radius-xl);
  border: 1px solid var(--ctkt-line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0.008) 100%),
    var(--ctkt-bg-1);
  box-shadow: var(--ctkt-shadow-block);
  overflow: hidden;
  position: relative;
}

.costes-tickets-head{
  padding: 12px 14px;
  border-bottom: 1px solid var(--ctkt-line);
  background: linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0.00) 100%);
}

.costes-tickets-title{
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ctkt-text);
  font-weight: 800;
  letter-spacing: 0.1px;
  font-size: 12px;
}

.costes-tickets-icon{
  height: 15px;
  width: 15px;
  opacity: 0.92;
  filter: none;
}

/* =========================================================
   BODY GENERAL
   CLAVE: top real = 20px, como en km / mi mes
   ========================================================= */

.costes-tickets-body{
  padding: 20px 10px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  min-width: 0;
  position: relative;
  z-index: 1;
}

/* =========================================================
   BLOQUES
   ========================================================= */

.costes-tickets-block{
  border-radius: var(--ctkt-radius-xl);
  border: 1px solid var(--ctkt-line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0.008) 100%),
    var(--ctkt-bg-1);
  box-shadow: var(--ctkt-shadow-block);
  overflow: hidden;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.costes-tickets-blockhead{
  padding: 12px 14px;
  border-bottom: 1px solid var(--ctkt-line);
  background: linear-gradient(180deg, rgba(255,255,255,0.018) 0%, rgba(255,255,255,0.00) 100%);
}

.costes-tickets-blockhead-row{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.costes-tickets-blocktitle{
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ctkt-text);
  font-weight: 800;
  letter-spacing: 0.1px;
  font-size: 12px;
}

.costes-tickets-blockicon{
  height: 15px;
  width: 15px;
  opacity: 0.92;
  filter: none;
}

/* =========================================================
   BODY DE BLOQUES
   ========================================================= */

.costes-tickets-blockbody{
  padding: 10px;
  min-height: 0;
  min-width: 0;
  position: relative;
}

.costes-tickets-blockbody--grid{
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.costes-tickets-blockbody--timeline{
  min-height: 0;
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.costes-tickets-empty{
  min-height: clamp(280px, 35vh, 520px);
  border-radius: var(--ctkt-radius-lg);
  border: 1px solid var(--ctkt-line);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.015) 0%, rgba(255,255,255,0.008) 100%),
    var(--ctkt-bg-2);
  box-shadow: none;

  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
}

.costes-tickets-emptyimg{
  max-height: 100%;
  max-width: 100%;
  opacity: 0.82;
}

/* =========================================================
   TABLA DASH OCULTA
   ========================================================= */

.tickets-hidden-table{
  height: 0;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.tickets-hidden-table .dash-table-container,
.tickets-hidden-table .dash-spreadsheet-container{
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
}

.tickets-hidden-table .dash-table-container *,
.tickets-hidden-table .dash-spreadsheet-container *{
  height: 0 !important;
  max-height: 0 !important;
  overflow: hidden !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}

/* =========================================================
   CONTENEDOR GRID
   ========================================================= */

#detalle-tickets-grid-container.tickets-grid-scope--costes{
  width: 100%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* =========================================================
   GRID DETALLE
   ========================================================= */

.tickets-grid-scope--costes .ctkt-table{
  width: 100%;
  min-width: 0;

  height: clamp(280px, 35vh, 520px);
  min-height: clamp(280px, 35vh, 520px);
  max-height: clamp(280px, 35vh, 520px);

  border-radius: var(--ctkt-radius-lg);
  overflow: hidden;

  background: var(--ctkt-bg-2);
  border: 1px solid var(--ctkt-line);
  box-shadow: none;

  display: flex;
  flex-direction: column;
}

.tickets-grid-scope--costes .ctkt-head,
.tickets-grid-scope--costes .ctkt-row{
  box-sizing: border-box;
  display: grid;
  align-items: center;
  column-gap: 12px;
  width: 100%;
  min-width: 0;
}

.tickets-grid-scope--costes .ctkt-head > *,
.tickets-grid-scope--costes .ctkt-row > *{
  min-width: 0;
  max-width: 100%;
}

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

.tickets-grid-scope--costes .ctkt-head{
  grid-template-columns: 86px minmax(240px, 1fr) 120px 90px 160px 130px;
  flex: 0 0 auto;
  min-height: 44px;
  padding: 10px 12px;
  padding-right: calc(12px + var(--ctkt-scrollbar-w));
  background: #15202a;
  border-bottom: 1px solid var(--ctkt-line);
  position: relative;
  z-index: 2;
}

.tickets-grid-scope--costes .ctkt-hcell{
  min-width: 0;
  max-width: 100%;
  font-weight: 800;
  font-size: 10.5px;
  letter-spacing: 0.45px;
  color: var(--ctkt-text-dim);
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1;
}

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

.tickets-grid-scope--costes .ctkt-body,
.tickets-grid-scope--costes .ctkt-body--scroll{
  flex: 1 1 auto;
  min-height: 0;
  height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  background: transparent;
  scrollbar-gutter: stable;

  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.16) transparent;
}

.tickets-grid-scope--costes .ctkt-body::-webkit-scrollbar,
.tickets-grid-scope--costes .ctkt-body--scroll::-webkit-scrollbar{
  width: var(--ctkt-scrollbar-w);
  height: var(--ctkt-scrollbar-w);
}

.tickets-grid-scope--costes .ctkt-body::-webkit-scrollbar-track,
.tickets-grid-scope--costes .ctkt-body--scroll::-webkit-scrollbar-track{
  background: transparent;
}

.tickets-grid-scope--costes .ctkt-body::-webkit-scrollbar-thumb,
.tickets-grid-scope--costes .ctkt-body--scroll::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.16);
  border-radius: 999px;
}

.tickets-grid-scope--costes .ctkt-body::-webkit-scrollbar-thumb:hover,
.tickets-grid-scope--costes .ctkt-body--scroll::-webkit-scrollbar-thumb:hover{
  background: rgba(255,255,255,0.24);
}

/* =========================================================
   FILAS GRID
   ========================================================= */

.tickets-grid-scope--costes .ctkt-row{
  grid-template-columns: 86px minmax(240px, 1fr) 120px 90px 160px 130px;
  min-height: 44px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--ctkt-line-soft);
  transition: background 120ms ease;
}

.tickets-grid-scope--costes .ctkt-row:last-child{
  border-bottom: none;
}

.tickets-grid-scope--costes .ctkt-row:nth-child(odd){
  background: rgba(255,255,255,0.012);
}

.tickets-grid-scope--costes .ctkt-row:hover{
  background: var(--ctkt-hover);
}

.tickets-grid-scope--costes .ctkt-cell{
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ctkt-text);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =========================================================
   ÍNDICE
   ========================================================= */

.tickets-grid-scope--costes .ctkt-cell--idx{
  justify-content: flex-start;
}

.tickets-grid-scope--costes .ctkt-index{
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  color: rgba(255,255,255,0.96);
  background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0.03) 100%);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow:
    0 0 0 1px rgba(255,255,255,0.03) inset,
    0 4px 12px rgba(0,0,0,0.18);
  flex: 0 0 auto;
}

/* =========================================================
   BLOQUE PRINCIPAL IMAGEN + TEXTO
   ========================================================= */

.tickets-grid-scope--costes .ctkt-local{
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.tickets-grid-scope--costes .ctkt-thumbwrap{
  position: relative;
  flex: 0 0 auto;
}

.tickets-grid-scope--costes .ctkt-thumbwrap--empty{
  opacity: 0.65;
}

.tickets-grid-scope--costes .ctkt-thumb{
  width: 34px;
  height: 34px;
  border-radius: 10px;
  overflow: hidden;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(130,155,178,0.14);
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.tickets-grid-scope--costes .ctkt-thumb-bg{
  width: 100%;
  height: 100%;
  display: block;
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
}

.tickets-grid-scope--costes .ctkt-maintext{
  min-width: 0;
  flex: 1 1 auto;
}

.tickets-grid-scope--costes .ctkt-cell--main{
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
  white-space: normal;
}

.tickets-grid-scope--costes .ctkt-estab{
  width: 100%;
  font-weight: 900;
  font-size: 11.5px;
  color: rgba(255,255,255,0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.05;
}

.tickets-grid-scope--costes .ctkt-desc{
  width: 100%;
  font-size: 10.5px;
  color: rgba(255,255,255,0.62);
  line-height: 1.1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: normal;
}

/* =========================================================
   PREVIEW INTERNO DESACTIVADO
   ========================================================= */

.tickets-grid-scope--costes .ctkt-preview,
.tickets-grid-scope--costes .ctkt-preview-img{
  display: none !important;
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* =========================================================
   FECHA / HORA
   ========================================================= */

.tickets-grid-scope--costes .ctkt-cell--date,
.tickets-grid-scope--costes .ctkt-cell--time{
  color: rgba(255,255,255,0.78);
  font-weight: 800;
}

/* =========================================================
   CHIP CATEGORÍA
   ========================================================= */

.tickets-grid-scope--costes .ctkt-chip{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.90);
}

/* =========================================================
   DINERO
   ========================================================= */

.tickets-grid-scope--costes .ctkt-cell--money{
  justify-content: flex-end;
}

.tickets-grid-scope--costes .ctkt-money{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: rgba(55,242,166,0.12);
  border: 1px solid rgba(55,242,166,0.28);
  color: var(--ctkt-green);
  box-shadow:
    inset 0 0 0 1px rgba(55,242,166,0.05),
    0 0 14px rgba(55,242,166,0.10);
}

/* =========================================================
   EMPTY DEL BODY
   ========================================================= */

.tickets-grid-scope--costes .ctkt-empty{
  color: var(--ctkt-text-dim);
  font-weight: 700;
  font-size: 12px;
  padding: 16px 0;
}

.tickets-grid-scope--costes .ctkt-body--empty{
  display: flex;
  align-items: center;
  justify-content: center;
}

/* =========================================================
   TIMELINE
   ========================================================= */

.timeline-tickets-mensual{
  width: 100%;
  min-height: 120px;
  border-radius: 12px;
  border: 1px solid var(--ctkt-line);
  background: var(--ctkt-bg-2);
  box-shadow: none;
  padding: 10px;
  overflow: visible;
  position: relative;
  z-index: 3;
}

.timeline-tickets-mensual *{
  min-width: 0;
}

.timeline-tickets-mensual .tl-timeline-abs{
  overflow: visible;
  position: relative;
  z-index: 3;
}

/* =========================================================
   BOTONES GRID / TABLA
   ========================================================= */

.ctkt-viewbar{
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.ctkt-viewbtn{
  border-radius: 999px !important;
  font-weight: 800 !important;
  letter-spacing: 0.15px;
  padding: 6px 12px !important;
  border: 1px solid rgba(255,255,255,0.14) !important;
  background: rgba(255,255,255,0.05) !important;
  color: rgba(255,255,255,0.80) !important;
  line-height: 1;
  box-shadow: none !important;
  font-size: 11px !important;
}

.ctkt-viewbtn--active{
  border-color: rgba(0,231,255,0.35) !important;
  background: rgba(0,231,255,0.12) !important;
  color: rgba(255,255,255,0.94) !important;
}

/* =========================================================
   WRAPPER TABLA DASH
   ========================================================= */

.ctkt-dt-wrap{
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.ctkt-dt-wrap .dash-table-container,
.ctkt-dt-wrap .dash-spreadsheet-container{
  flex: 1 1 auto;
  min-height: 0;
  height: 100% !important;
  max-height: 100% !important;
  overflow: auto !important;
}

/* =========================================================
   PORTAL HOVER GRANDE
   ========================================================= */

.ctkt-preview-portal{
  position: fixed;
  inset: 0;
  z-index: 2147483646;
  pointer-events: none;
}

.ctkt-preview-portal-box{
  position: fixed;
  z-index: 2147483647;
  width: 360px;
  height: 460px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(8,10,14,0.92);
  border: 1px solid rgba(255,255,255,0.14);
  box-shadow: 0 22px 60px rgba(0,0,0,0.65);
  opacity: 0;
  transform: translate3d(0, 8px, 0) scale(0.98);
  transition: opacity 140ms ease, transform 140ms ease;
  left: 0;
  top: 0;
  pointer-events: none;
}

.ctkt-preview-portal-box.is-open{
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.ctkt-preview-portal-img{
  width: 100%;
  height: 100%;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  background-color: #0b0f14;
}

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

@media (max-width: 1250px){
  .tickets-grid-scope--costes .ctkt-head{
    grid-template-columns: 78px minmax(210px, 1fr) 110px 80px 140px 120px;
    padding-left: 10px;
    padding-right: calc(10px + var(--ctkt-scrollbar-w));
    column-gap: 10px;
  }

  .tickets-grid-scope--costes .ctkt-row{
    grid-template-columns: 78px minmax(210px, 1fr) 110px 80px 140px 120px;
    padding-left: 10px;
    padding-right: 10px;
    column-gap: 10px;
  }

  .tickets-grid-scope--costes .ctkt-estab{ font-size: 11px; }
  .tickets-grid-scope--costes .ctkt-desc{ font-size: 10px; }
  .tickets-grid-scope--costes .ctkt-chip{ font-size: 10px; }
  .tickets-grid-scope--costes .ctkt-money{ font-size: 10.5px; }
  .tickets-grid-scope--costes .ctkt-index{ width: 22px; height: 22px; font-size: 10px; }
}

@media (max-width: 1100px){
  .tickets-grid-scope--costes .ctkt-head{
    grid-template-columns: 78px minmax(220px, 1fr) 110px 80px 120px;
  }

  .tickets-grid-scope--costes .ctkt-row{
    grid-template-columns: 78px minmax(220px, 1fr) 110px 80px 120px;
  }

  .tickets-grid-scope--costes .ctkt-hcell--cat,
  .tickets-grid-scope--costes .ctkt-cell--cat{
    display: none;
  }
}

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

  .tickets-grid-scope--costes .ctkt-table{
    height: clamp(260px, 32vh, 460px);
    min-height: clamp(260px, 32vh, 460px);
    max-height: clamp(260px, 32vh, 460px);
  }

  .tickets-grid-scope--costes .ctkt-head,
  .tickets-grid-scope--costes .ctkt-row{
    padding-left: 10px;
    padding-right: 10px;
    column-gap: 10px;
  }

  .tickets-grid-scope--costes .ctkt-head{
    padding-right: calc(10px + var(--ctkt-scrollbar-w));
  }
}