/* ===========================
   Variables de color (tema)
   =========================== */
/* Estilos globales compartidos por todos los paneles. */
:root{
  --primary-500: #2aa5a1; /* base */
  --primary-600: #21827f; /* AA con texto blanco */
  --primary-700: #196361; /* AAA con texto blanco */
  --primary-100: #e7f6f5; /* fondos suaves */
  --ink-900:   #0b1f1f;   /* texto sobre fondos claros */
  --ink-700:   #37474f;
  --line:      #e6ecef;   /* líneas suaves */
  --hover:     #eef7f6;   /* hover suave */
  --ring:      #a7ecea;   /* focus visible */
}

/* Tipografia global (igual que Movimientos). */
body {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
}

/* ===========================
   Layout responsive básico
   =========================== */
.filters {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: end;
}
.filter-item { display: flex; flex-direction: column; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 12px 0; }
.kpi { background: #f7f7f9; padding: 12px; border-radius: 10px; border: 1px solid #eee; }
.charts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

@media (max-width: 1100px) {
  .filters { grid-template-columns: 1fr 1fr; }
  .charts { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }
}

/* Barra de filtros pegajosa */
.filters-sticky {
  position: sticky;
  top: 0;
  z-index: 1020;
  background: #fff;
  padding-block: .5rem;
  border-bottom: 1px solid var(--line);
}

/* Botones */
.btn-gradient,
#btn-aplicar {
  background: linear-gradient(90deg, #32b4b0, #2f86a6);
  color: #fff;
  border: none;
}
.btn-gradient:hover,
#btn-aplicar:hover { filter: brightness(1.05); }

.btn-ghost {
  background: transparent;
  border: 1px solid #cfd8dc;
  color: var(--ink-700);
}
.btn-ghost:hover { background: #f5f7f8; }

/* Títulos */
.my-2 { text-align: center; padding: 10px 20px; }
.mt-2 { text-align: center; }

/* ===========================
   DataTable (Dash)
   =========================== */

/* Contenedor */
#tabla {
  border-radius: 8px;
  overflow: hidden;
  font-family: "Arial", system-ui, -apple-system, Segoe UI, Arial, sans-serif;
  font-size: 14px;
  text-align: center;
}

/* Cabecera sticky con buen contraste */
.dash-table-container .dash-spreadsheet-container th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--primary-600) !important; /* AA con blanco */
  color: #fff !important;
  font-weight: 700;
  text-align: left;
  border-bottom: 1px solid var(--primary-700) !important;
}

/* Celdas */
#tabla .dash-cell {
  background: #fff;
  color: var(--ink-900);
  padding: 8px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

/* Zebra clara (legible) */
#tabla .dash-cell.row-odd {
  background-color: #fafafa;
}

/* Hover de fila/celda sutil */
#tabla .dash-cell:hover {
  background-color: var(--hover);
}

/* Columna Estado resaltada (si añades className='column-estado' desde Python) */
#tabla .dash-cell.column-estado {
  background-color: var(--primary-100);
  font-weight: 600;
}


/* Botón Export a la derecha y estilizado */
.dash-table-container .export {
  float: right !important;
  display: inline-block !important;
  margin-bottom: 10px;
  padding: 6px 12px;
  background-color: var(--primary-600);
  color: #fff;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.dash-table-container .export:hover { background-color: var(--primary-700); }

/* Cambiar el texto del botón Export (si el botón interno expone .export) */
#tabla button.export { font-size: 0; position: relative; }
#tabla button.export::after { content: "Descargar"; font-size: 14px; }

/* ===========================
   Controles compactos
   =========================== */
.controls-compact .dash-dropdown,
.controls-compact .DateRangePicker,
.controls-compact .DateInput { font-size: 0.95rem; }

.controls-compact .Select-control,
.controls-compact .DateInput_input { padding: 6px 10px !important; }

/* Enfoque accesible */
a:focus, button:focus, .Select-control:focus-within {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}

/* ===========================
   Multiselect Comercializadora
   =========================== */
#f-comerz .Select-multi-value-wrapper {
  max-height: 56px; /* ~2 filas de chips */
  overflow-y: auto;
}
#f-comerz .Select--multi .Select-value {
  margin: 2px 4px;
  font-size: 12px;
  line-height: 20px;
  background: var(--primary-100);
  color: var(--ink-900);
  border: 1px solid var(--primary-500);
}
#f-comerz .Select--multi .Select-value-icon { padding: 0 6px; }
#f-comerz .Select--multi .Select-value-label { padding: 0 6px; }
#f-comerz .Select-menu-outer { max-height: 260px; overflow-y: auto; }

/* Navbar */
.app-navbar {
  background: linear-gradient(90deg, #32b4b0, #2f86a6);
  border-bottom: none;
}
.app-brand {
  font-weight: 700;
  letter-spacing: 0.4px;
  color: #e7f6f5 !important;
}
.app-logo {
  height: 60px;
  width: auto;
  display: block;
}
.app-navlink {
  color: #e7f6f5 !important;
  margin-left: 6px;
}
.app-navlink.active {
  color: #fff !important;
  border-bottom: 2px solid #2aa5a1;
}

/* Botones globales (mismo estilo que "Aplicar filtros") */
button,
.btn {
  background: linear-gradient(90deg, #32b4b0, #2f86a6);
  color: #fff !important;
  border: none !important;
}
button:hover,
.btn:hover {
  filter: brightness(1.05);
}
button:disabled,
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
