body {
    font-family: 'Segoe UI', sans-serif;
    background-color: #ffffff;
    margin: 0;
    padding: 2.5rem;
    padding-top: 72px; /* espacio para el navbar fixed */
}


.dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.kpi-card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    padding: 1.25rem;
}

.kpi-label {
    color: #6b7280;
    font-size: 0.875rem;
    margin-bottom: 5px;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
}

.kpi-sub {
    font-size: 0.875rem;
    font-weight: 500;
}

.card {
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.05);
    padding: 1.25rem;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 10px;
    color: #111827;
}

/* Define color primario (puedes ajustar el valor hex según tu marca) */
:root {
    --color-primary: #007bff; /* Azul Bootstrap por defecto */
}

/* Enlaces de navegación */
.nav-link {
    color: var(--color-primary) !important;
    font-weight: 500;
    text-decoration: none;
    font-size: medium;
}

.nav-link:hover {
    color: darken(var(--color-primary), 10%) !important;
    text-decoration: underline;
}

/* Color del texto para el nav-link activo (pill seleccionado) */
.nav-pills .nav-link.active {
    color: white !important;
}

/* Color del texto para los nav-links inactivos */
.nav-pills .nav-link {
    color: #0d6efd;  /* Bootstrap primary */
}

/* Color primario para el botón de menú en pantallas pequeñas */
.navbar-dark .navbar-toggler {
    border-color: #0d6efd;
}

.navbar-dark .navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%230d6efd' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.navbar-filters {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 0.75rem;
    min-width: 0;
}

.navbar-filters__summary {
    display: inline-flex;
    align-items: center;
    border: 0;
    border-radius: 999px;
    background: #0d6efd;
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    padding: 0.35rem 0.65rem;
    max-width: 280px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}

.navbar-filters__summary:hover,
.navbar-filters__summary:focus {
    background: #0b5ed7;
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.navbar-filters__collapse {
    position: absolute;
    left: 0;
    top: calc(100% + 0.35rem);
    width: min(92vw, 760px);
    z-index: 1101;
}

.navbar-filters__card {
    border: 1px solid #dbe3ef;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.navbar-filters__detalle {
    max-height: 240px;
    overflow-y: auto;
}

.navbar-filters__badge {
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
}

.waiting-cursor {
    cursor: wait !important;
}

/* Estilo general para todas las tabs */
.tab-container {
    display: flex;
    width: 100%;
    gap: 5px;
}

.tab {
    background-color: white;
    color: #0d6efd;  /* Bootstrap primary */
    border: 1px solid #0d6efd;
    padding: 0.625rem 1.25rem;
    margin-right: 0;
    font-weight: 500;
    border-radius: 1rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-decoration: none;
    flex: 1 1 0;
    text-align: center;
    min-width: 0;
}

/* Hover sobre tabs inactivas */
.tab:hover {
    text-decoration: underline;
    background-color: white; /* No cambia el fondo */
    color: #0a58ca; /* Azul más oscuro (opcional) */
}

/* Tab seleccionada */
.tab--selected {
    background-color: #0d6efd;
    color: white;
    text-decoration: none;
    font-weight: bold;
}

.Select-menu-outer {
    font-size: 0.875rem;
}

.Select-value-label {
    font-size: 0.875rem;
}

.Select-placeholder {
    font-size: 0.875rem;
}

.label-sm {
    font-size: 0.875rem;
}

.label-lg {
    font-size: 1.25rem;
}

/* assets/styles.css */

.date-picker-elegante {
    border: 1px solid #ced4da;
    border-radius: 12px;
    padding: 0.25rem 0.3125rem;
    background-color: #228be675;
    font-family: 'Segoe UI', sans-serif;
    font-size: 1rem;
    color: #333;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease-in-out;
}

.date-picker-elegante:hover,
.date-picker-elegante:focus-within {
    border-color: #228be6;
    box-shadow: 0 0 0 3px rgba(34, 139, 230, 0.2);
    background-color: #ffffff;
}

/* assets/custom.css */
.VirtualizedSelectOption {
    white-space: normal !important;
    word-wrap: break-word;
    max-width: 300px;
}

/* Estilo personalizado para tooltips de Dash DataTable */
.dash-table-tooltip {
    font-size: 0.6875rem;
    max-width: 300px;
    white-space: normal;
    color: black;
    padding: 0.375rem 0.625rem;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

.btn-open-filters-fixed {
    position: fixed;
    right: 1rem;
    top: 50%;
    writing-mode: vertical-rl;
    transform: translateY(-50%) rotate(180deg);
    z-index: 1050;
    text-orientation: upright;
    white-space: nowrap;
}

/* 1) Forzar wrap en la lista de opciones */
.Select-menu-outer,
[class$="-menu-list"],
[class*="MenuList"] {
  white-space: normal !important;
  word-break: break-word !important;
  word-wrap: break-word !important;
  line-height: 1.3 !important;
  overflow: hidden !important;          /* oculta el desbordamiento */
  text-overflow: ellipsis !important;   /* muestra “…” */
}

/* 2) Cada opción dentro del menú */
.Select-menu-outer .select-option,
[class$="-option"],
[class*="Option"] {
  display: flex !important;
  align-items: center !important;
  height: auto !important;
  padding: 0.25rem 0.5rem !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow: hidden !important;          /* oculta el desbordamiento */
  text-overflow: ellipsis !important;   /* muestra “…” */
}

/* 3) Wrap también en las "píldoras" multiselección */
.Select-value-label,
.css-1rhbuit-MultiValue,     /* clase genérica Dash vX */
[class*="multi-value__label"] {
  white-space: normal !important;
  word-break: break-word !important;
  max-width: 100% !important;
  overflow: hidden !important;          /* oculta el desbordamiento */
  text-overflow: ellipsis !important;   /* muestra “…” */
}

/* 4) Asegura que el menú esté por encima */
.Select-menu-outer,
[class*="menu-outer"] {
  z-index: 1000 !important;
  overflow-y: auto !important;          /* permite ver todas las opciones */
  overflow-x: hidden !important;
  text-overflow: ellipsis !important;   /* muestra “…” */
}

/* Opciones del menú: corte con puntos suspensivos */
.dropdown-fix .Select-menu-outer .select-option {
  white-space: nowrap !important;       /* sin wrap */
  overflow: hidden !important;          /* oculta el desbordamiento */
  text-overflow: ellipsis !important;   /* muestra “…” */
}

/* Etiquetas multiselección (“píldoras”) */
.dropdown-fix .Select-value-label,
.dropdown-fix .css-1rhbuit-MultiValue {
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: 100%;      /* para que reserve todo el ancho posible */
}

/* Override de etiquetas largas para dropdowns del panel de filtros */
.dropdown-fix .Select-menu-outer .VirtualizedSelectOption,
.dropdown-fix .Select-menu-outer .Select-option,
.dropdown-fix .Select-menu-outer .select-option {
  display: block !important;
  height: 35px !important;
  line-height: 27px !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
  overflow: hidden !important;
}

.dropdown-fix .Select--multi .Select-value,
.dropdown-fix .Select-value-label,
.dropdown-fix .css-1rhbuit-MultiValue,
.dropdown-fix .css-12jo7m5 {
  max-width: 100% !important;
}

.dropdown-fix .Select--multi .Select-value-label,
.dropdown-fix .Select-value-label {
  display: inline-block !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow-wrap: anywhere !important;
  line-height: 1.2 !important;
}

.dropdown-fix .Select-placeholder,
.dropdown-fix .Select-input,
.dropdown-fix .Select-control,
.dropdown-fix .Select-multi-value-wrapper {
  max-width: 100% !important;
}

@media (max-width: 1024px) {
  body {
    padding: 2rem;
  }
  .card {
    margin-bottom: 1rem;
  }
  .kpi-value {
    font-size: 1.25rem;
  }
}

@media (max-width: 768px) {
  .tab-container {
    flex-wrap: wrap;
  }

  .tab {
    flex: 1 1 calc(50% - 5px);
  }

  body {
    padding: 1rem;
  }
  .card {
    margin-bottom: 0.75rem;
  }
  .kpi-value {
    font-size: 1rem;
  }
  .kpi-label,
  .kpi-sub,
  .card-title {
    font-size: 0.75rem;
  }

  .navbar-filters {
    width: 100%;
    margin: 0.5rem 0 0 0;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .navbar-filters__summary {
    max-width: calc(100vw - 8.5rem);
  }

  .navbar-filters__collapse {
    position: static;
    width: 100%;
    margin-top: 0.35rem;
  }
}

.print-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0;
}

.print-header__logo {
  max-height: 64px;
}

.print-header__text {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
}

.print-header__title {
  margin: 0;
  font-size: 1.75rem;
  color: #1f2a44;
}

.print-header__subtitle {
  margin: 0;
  font-size: 1.125rem;
  color: #4a5568;
}

.print-section {
  width: 100%;
}

#financial-print-selection-controls,
#commercial-print-selection-controls {
  border-top: 1px solid #e2e8f0;
  margin-top: 1.5rem;
  padding-top: 1rem;
}

#financial-print-selection-controls .print-selection-options,
#commercial-print-selection-controls .print-selection-options {
  margin-top: 0.75rem;
}

#financial-print-selection-controls .print-selection-options label,
#commercial-print-selection-controls .print-selection-options label {
  font-weight: 500;
  cursor: pointer;
}

@page {
  size: A4 portrait;
  margin: 1.5cm;
}

@media print {
  body {
    background: #ffffff !important;
    color: #000000 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-header {
    display: flex !important;
    border-bottom: 2px solid #1f2a44;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
  }

  .btn-open-filters-fixed,
  [data-action="print-dashboard"],
  #drawer-filtros,
  .mantine-Drawer-root,
  .mantine-Drawer-overlay,
  .mantine-Drawer-content {
    display: none !important;
  }

  body.printing-dashboard #drawer-filtros {
    display: none !important;
  }

  body.printing-dashboard .mantine-Drawer-root,
  body.printing-dashboard .mantine-Drawer-overlay,
  body.printing-dashboard .mantine-Drawer-content {
    display: none !important;
  }

  .dash-graph,
  .js-plotly-plot,
  .plotly {
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
  }

  .js-plotly-plot,
  .js-plotly-plot .plot-container,
  .js-plotly-plot .svg-container {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    overflow: visible !important;
  }

  .js-plotly-plot .main-svg {
    width: 100% !important;
  }

  .js-plotly-plot .modebar-container {
    display: none !important;
  }

  body.printing-dashboard .print-hidden,
  .print-hidden {
    display: none !important;
  }

  .container,
  .container-fluid,
  .dbc-container,
  .dbc,
  .print-section {
    max-width: 100% !important;
    width: 100% !important;
  }

  .print-section .dash-graph {
    min-height: 420px !important;
    height: auto !important;
  }

  [data-print-section="third-parties"],
  [data-print-section="third-parties"] .dash-graph,
  [data-print-section="third-parties"] .js-plotly-plot,
  [data-print-section="third-parties"] .plotly,
  [data-print-section="cost-centers"],
  [data-print-section="cost-centers"] .dash-graph,
  [data-print-section="cost-centers"] .js-plotly-plot,
  [data-print-section="cost-centers"] .plotly {
    max-height: none !important;
    height: auto !important;
    overflow: visible !important;
  }

  .card,
  .dbc,
  .row,
  .col,
  .dash-table-container,
  .dash-table {
    page-break-inside: avoid;
    break-inside: avoid;
  }

  .mantine-Drawer-root,
.mantine-Modal-root,
.modal {
  display: none !important;
}
}

/* Chatbot launcher */
.chatbot-launcher {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  z-index: 1100;
  pointer-events: none;
}

.chatbot-launcher__container {
  display: flex;
  justify-content: flex-end;
  pointer-events: all;
}

.chatbot-launcher__button {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 8px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.chatbot-launcher__button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chatbot-launcher__logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chatbot-launcher__panel {
  max-width: 520px;
}

.chatbot-launcher__panel .offcanvas-header {
  display: none;
}

.alerts-popover-no-arrow .popover-arrow {
  display: none !important;
}

.alerts-panel-card {
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.05);
}

.alerts-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.alerts-subsection-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.alerts-helper-copy {
  color: #64748b;
  font-size: 0.9rem;
}

.alerts-kpi__label {
  color: #64748b;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.alerts-kpi__value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  margin-top: 0.3rem;
}

.alerts-kpi__helper {
  color: #64748b;
  font-size: 0.85rem;
  margin-top: 0.3rem;
}

.alerts-main-tabs .tab {
  padding: 0.8rem 1rem;
  font-weight: 600;
}

.alerts-timeline {
  display: grid;
  gap: 0.75rem;
}

.alerts-timeline__item {
  padding: 0.75rem 0.9rem;
  border-radius: 14px;
  border: 1px solid #e2e8f0;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.chatbot-launcher__textarea {
  resize: vertical;
  border-radius: 16px;
  padding: 0.75rem 0.9rem;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.chatbot-launcher__textarea:focus {
  border-color: #0d6efd;
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.chatbot-launcher__panel .offcanvas-body {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: #f6f8fb;
  min-height: 0;
  height: 100%;
}

.chatbot-content {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.chatbot-history {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  padding: 0.75rem;
  border-radius: 16px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  min-height: 200px;
  margin-bottom: 0.5rem;
  overflow: visible;
  max-height: none;
}

.chatbot-history__empty {
  padding: 0.75rem;
}

.chatbot-message {
  display: flex;
  flex-direction: column;
  max-width: 88%;
}

.chatbot-message--user {
  align-self: flex-end;
  text-align: right;
}

.chatbot-message--assistant {
  align-self: flex-start;
}

.chatbot-message--embed {
  max-width: 100%;
}

.chatbot-message__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #64748b;
  margin-bottom: 0.25rem;
}

.chatbot-message__bubble {
  padding: 0.65rem 0.85rem;
  border-radius: 16px;
  font-size: 0.875rem;
  line-height: 1.4;
  background: #f1f5f9;
  color: #0f172a;
  border: 1px solid #e2e8f0;
  white-space: pre-wrap;
}

.chatbot-message--user .chatbot-message__bubble {
  background: linear-gradient(120deg, #0d6efd, #2563eb);
  color: #ffffff;
  border-color: transparent;
}

.chatbot-message__bubble--embed {
  background: #ffffff;
  border-color: #e2e8f0;
  padding: 0.5rem 0.75rem;
}

.chatbot-message__bubble--embed .table {
  margin-bottom: 0;
}

.chatbot-table {
  margin-top: 0.5rem;
}

.chatbot-table__summary {
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.chatbot-table__summary::-webkit-details-marker {
  display: none;
}

.chatbot-table__note {
  display: block;
  margin-top: 0.35rem;
}

.chatbot-artifact {
  margin-top: 0.75rem;
}

.chatbot-artifact__actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.45rem;
}

.chatbot-artifact__button {
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  color: #334155;
  background: #f8fafc;
  padding: 0.2rem 0.75rem;
}

.chatbot-artifact__button:hover,
.chatbot-artifact__button:focus {
  background: #e2e8f0;
  color: #0f172a;
}

.chatbot-message__bubble--embed .plotly,
.chatbot-message__bubble--embed .js-plotly-plot {
  width: 100% !important;
}

.chatbot-message__bubble--embed .dash-graph {
  width: 100%;
  min-width: 320px;
}

.chatbot-message__bubble--embed .js-plotly-plot,
.chatbot-message__bubble--embed .plotly {
  min-height: 320px;
}

.chatbot-composer {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-top: auto;
}

.chatbot-composer .btn {
  align-self: flex-end;
}

.chatbot-message--pending {
  opacity: 0.85;
}

.chatbot-message__bubble--pending {
  font-style: italic;
  color: #475569;
  background: #eef2ff;
  border-color: #e0e7ff;
}

.chatbot-inline-response {
  border-radius: 16px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #0f172a;
  padding: 0.75rem;
  margin: 0;
  align-self: flex-start;
  display: none;
}

.chatbot-inline-response .table {
  margin-bottom: 0;
}

.chatbot-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.chatbot-header__text {
  min-width: 0;
}

.chatbot-greeting {
  margin-bottom: 0.2rem;
}

.chatbot-subtitle {
  margin-bottom: 0;
  color: #475569;
}

.chatbot-new-conv {
  width: 100%;
  height: 36px;
  border-radius: 10px;
  font-size: 1rem;
  line-height: 1;
}

.chatbot-close {
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.chatbot-close:hover {
  color: #0f172a;
}

.chatbot-hidden-actions {
  display: none;
}

.chatbot-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chatbot-token-accordion {
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  overflow: hidden;
  display: block;
}

.chatbot-token-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chatbot-token-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  padding-right: 1.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #0f172a;
  background: #ffffff;
  border: none;
  position: relative;
}

.chatbot-token-toggle:hover,
.chatbot-token-toggle:focus {
  background: #f8fafc;
  box-shadow: none;
}

.chatbot-token-toggle::after {
  content: "▾";
  font-size: 0.85rem;
  color: #64748b;
}

.chatbot-token-toggle[aria-expanded="true"]::after {
  content: "▴";
}

.chatbot-token-body {
  padding: 0.5rem 0.75rem 0.75rem;
  border-top: 1px solid #e2e8f0;
  width: 100%;
}

.chatbot-token-accordion .collapse,
.chatbot-token-accordion .collapsing {
  width: 100%;
}

.chatbot-token-badge {
  font-size: 0.75rem;
  font-weight: 600;
  background: #e2e8f0;
  color: #0f172a;
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
  margin-left: auto;
}

.chatbot-token-badge--low {
  background: #dc3545 !important;
  color: #ffffff !important;
}

.chatbot-token-badge--ok {
  background: #198754 !important;
  color: #ffffff !important;
}

.chatbot-token-actions {
  display: flex;
  gap: 0.5rem;
}

.chatbot-token-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.chatbot-token-stat {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  color: #475569;
  font-size: 0.75rem;
}

.chatbot-token-metric {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}

.chatbot-message__markdown p {
  margin-bottom: 0.5rem;
}

.chatbot-message__markdown ul,
.chatbot-message__markdown ol {
  padding-left: 1.1rem;
  margin-bottom: 0.5rem;
}

.chatbot-message__markdown strong {
  font-weight: 600;
}

@media (max-width: 768px) {
  .chatbot-launcher {
    right: 1rem;
    bottom: 1rem;
  }

  .chatbot-launcher__button {
    width: 56px;
    height: 56px;
  }

  .chatbot-launcher__panel {
    max-width: 100%;
  }

  .chatbot-launcher__panel.offcanvas,
  .chatbot-launcher__panel .offcanvas {
    width: 100% !important;
  }

  .chatbot-launcher__panel .offcanvas-body {
    padding: 0.75rem;
  }

  .chatbot-content {
    padding-right: 0;
  }

  .chatbot-history {
    min-height: 180px;
  }

  .chatbot-message {
    max-width: 100%;
  }

  .chatbot-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .chatbot-toolbar .btn {
    width: 100%;
  }

  .chatbot-artifact__actions {
    justify-content: stretch;
  }

  .chatbot-artifact__button {
    width: 100%;
  }

  .chatbot-token-actions {
    width: 100%;
  }

  .chatbot-token-actions .btn {
    width: 100%;
  }

  .chatbot-composer .btn {
    width: 100%;
  }
}
/* Fin chatbot launcher */
/* PYME · dark executive workspace (Visión PYME) */
.pyme-page { --p-bg: #0b1a2b; --p-card: #10233a; --p-card-2: #132b45; --p-line: #1f3a55; --p-text: #e6eef6; --p-muted: #8ea3b8; --p-teal: #2dd4bf; --p-cyan: #38bdf8; --p-blue: #3b82c4; --p-coral: #fb7185; --p-amber: #fbbf24; padding-bottom: 32px; }
.pyme-shell { background: radial-gradient(1200px 500px at 10% -10%, #14304d 0%, transparent 60%), var(--p-bg); color: var(--p-text); border-radius: 20px; padding: 24px; margin-top: 16px; min-height: calc(100vh - 120px); }
.pyme-header { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 8px; }
.pyme-header-text { flex: 1 1 260px; min-width: 0; }
.pyme-title { font-size: clamp(1.4rem, 1.1rem + 1.2vw, 2rem); font-weight: 700; color: #fff; margin: 0; letter-spacing: -.01em; }
.pyme-subtitle { color: var(--p-muted); margin: 4px 0 0; font-size: .92rem; }
.pyme-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.pyme-control { display: flex; flex-direction: column; gap: 4px; min-width: 150px; }
.pyme-control--button { min-width: auto; }
.pyme-control-label { font-size: .72rem; color: var(--p-muted); margin: 0; font-weight: 600; }
.pyme-data-note { color: var(--p-muted); font-size: .8rem; margin-bottom: 10px; }
.pyme-muted { color: var(--p-muted); font-size: .875rem; margin: 0; }
/* Form controls on dark */
.pyme-shell .Select-control, .pyme-shell .form-control { background: var(--p-card) !important; border: 1px solid var(--p-line) !important; color: var(--p-text) !important; border-radius: 10px !important; min-height: 38px; }
.pyme-shell .Select-value-label, .pyme-shell .Select-placeholder, .pyme-shell .Select-input > input { color: var(--p-text) !important; }
.pyme-shell .Select-menu-outer { background: var(--p-card) !important; border: 1px solid var(--p-line) !important; color: var(--p-text); z-index: 1050; }
.pyme-shell .VirtualizedSelectOption, .pyme-shell .Select-option { background: var(--p-card) !important; color: var(--p-text) !important; }
.pyme-shell .VirtualizedSelectFocusedOption, .pyme-shell .Select-option.is-focused { background: var(--p-card-2) !important; }
.pyme-shell .Select-arrow { border-top-color: var(--p-muted) !important; }
.pyme-segmented { display: inline-flex; background: var(--p-card); border: 1px solid var(--p-line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: nowrap; }
.pyme-segmented .form-check { margin: 0; padding: 0; }
.pyme-segmented .btn { border: none; border-radius: 8px !important; color: var(--p-muted); font-size: .82rem; font-weight: 600; padding: 5px 14px; background: transparent; white-space: nowrap; }
.pyme-segmented .btn.active, .pyme-segmented .btn-check:checked + .btn { background: #7dd3fc; color: #0b1a2b; }
.pyme-btn-ghost { background: var(--p-card) !important; border: 1px solid var(--p-line) !important; color: var(--p-text) !important; border-radius: 10px; font-weight: 600; min-height: 38px; }
.pyme-btn-ghost:hover { border-color: var(--p-cyan) !important; }
.pyme-btn-primary { background: var(--p-teal) !important; border: none !important; color: #06201d !important; font-weight: 700; border-radius: 10px; min-width: 180px; }
.pyme-btn-primary:disabled { opacity: .45; }
.pyme-alert { border-radius: 12px; font-size: .875rem; border: 1px solid var(--p-line); background: var(--p-card) !important; color: var(--p-text) !important; }
.pyme-alert.alert-danger { border-color: var(--p-coral); }
.pyme-alert.alert-success { border-color: var(--p-teal); }
/* Tabs */
.pyme-tabs { display: flex !important; flex-wrap: nowrap; overflow-x: auto; gap: 4px; border-bottom: 1px solid var(--p-line) !important; scrollbar-width: none; }
.pyme-tabs::-webkit-scrollbar { display: none; }
.pyme-tabs .pyme-tab { flex: 0 0 auto !important; width: auto !important; background: transparent !important; border: none !important; border-bottom: 2px solid transparent !important; color: var(--p-muted) !important; font-weight: 600; font-size: .9rem; padding: 10px 16px !important; white-space: nowrap; }
.pyme-tabs .pyme-tab--selected { color: #fff !important; border-bottom-color: var(--p-cyan) !important; }
.pyme-tabs-content { padding-top: 16px; }
/* Cards */
.pyme-card { background: linear-gradient(180deg, var(--p-card) 0%, #0e2034 100%); border: 1px solid var(--p-line); border-radius: 16px; padding: 16px 18px; margin-bottom: 16px; min-width: 0; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.pyme-card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.pyme-card-heading { min-width: 0; }
.pyme-card-title-row { display: flex; align-items: center; gap: 10px; }
.pyme-card-title { font-size: 1rem; font-weight: 700; color: #fff; margin: 0; }
.pyme-card-subtitle { color: var(--p-muted); font-size: .8rem; margin-top: 2px; }
.pyme-icon { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: 0 0 32px; border-radius: 10px; font-size: 1rem; background: rgba(45, 212, 191, .14); color: var(--p-teal); }
.pyme-icon.blue { background: rgba(56, 189, 248, .14); color: var(--p-cyan); }
.pyme-icon.coral { background: rgba(251, 113, 133, .14); color: var(--p-coral); }
.pyme-icon.amber { background: rgba(251, 191, 36, .14); color: var(--p-amber); }
/* KPI tiles */
.pyme-kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.pyme-kpi { background: linear-gradient(180deg, var(--p-card) 0%, #0e2034 100%); border: 1px solid var(--p-line); border-radius: 14px; padding: 14px 16px; min-width: 0; }
.pyme-kpi-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pyme-kpi-label { color: var(--p-text); font-size: .88rem; font-weight: 600; line-height: 1.2; }
.pyme-kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.pyme-kpi-body { min-width: 0; flex: 0 1 auto; }
.pyme-kpi-value { color: #fff; font-size: clamp(1.05rem, .85rem + .6vw, 1.4rem); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.15; white-space: nowrap; }
.pyme-kpi-value.small { font-size: .95rem; font-weight: 600; white-space: normal; overflow-wrap: anywhere; }
.pyme-kpi-value.red { color: var(--p-coral); }
.pyme-kpi-caption { color: var(--p-muted); font-size: .75rem; margin-top: 3px; }
.pyme-spark { flex: 1 1 60px; min-width: 50px; max-width: 120px; }
.pyme-pos { color: var(--p-teal); }
.pyme-neg { color: var(--p-coral); }
/* Grids */
.pyme-grid { display: grid; gap: 0 16px; align-items: stretch; }
.pyme-grid--7-5 { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
.pyme-graph { width: 100%; min-width: 0; }
/* Decisions & signals */
.pyme-decisions { display: flex; flex-direction: column; gap: 10px; }
.pyme-decision { display: flex; gap: 12px; align-items: flex-start; background: var(--p-card-2); border: 1px solid var(--p-line); border-radius: 12px; padding: 12px 14px; }
.pyme-decision-title { font-weight: 700; font-size: .9rem; color: #fff; }
.pyme-decision-text { font-size: .85rem; color: var(--p-muted); margin-top: 2px; }
.pyme-signals { display: flex; flex-direction: column; gap: 10px; }
.pyme-signal { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--p-line); }
.pyme-signal:last-child { border-bottom: none; }
.pyme-signal-body { flex: 1 1 auto; min-width: 0; }
.pyme-signal-name { font-weight: 600; font-size: .9rem; }
.pyme-signal-value { font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.pyme-market-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 20px; margin-bottom: 14px; }
.pyme-market-title { font-size: 1.35rem; font-weight: 700; color: #fff; margin: 0; }
.pyme-market-head .pyme-control { min-width: 240px; }
.pyme-footnote { display: flex; flex-direction: column; gap: 6px; color: var(--p-muted); font-size: .78rem; padding: 4px 2px; }
/* Upload */
.pyme-upload-row { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px 16px; align-items: end; margin: 10px 0; }
.pyme-upload { min-height: 72px; border: 1px dashed #35597c; border-radius: 12px; display: flex; align-items: center; justify-content: center; padding: 12px; background: var(--p-card-2); color: var(--p-text); cursor: pointer; text-align: center; }
.pyme-upload a { color: var(--p-cyan); }
.pyme-upload:hover { border-color: var(--p-cyan); }
.pyme-actions { display: flex; justify-content: flex-end; margin-top: 12px; }
/* Data tables */
.pyme-shell .dash-table-container .previous-next-container, .pyme-shell .dash-table-container .page-number { color: var(--p-muted); }
.pyme-shell .dash-table-container .previous-next-container button { color: var(--p-text); background: transparent; border: none; }
.pyme-shell .dash-spreadsheet-container .dash-spreadsheet-inner td.focused { background-color: var(--p-card-2) !important; }
.pyme-shell .dash-table-container .current-page { background: var(--p-card) !important; color: var(--p-text) !important; }
/* Responsive */
@media (max-width: 1199.98px) {
  .pyme-controls { width: 100%; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .pyme-control--button .btn { width: 100%; }
}
@media (max-width: 991.98px) {
  .pyme-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pyme-grid--7-5, .pyme-upload-row { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 575.98px) {
  .pyme-page { padding-left: 8px; padding-right: 8px; }
  .pyme-shell { padding: 14px 12px; border-radius: 14px; margin-top: 10px; }
  .pyme-controls { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pyme-control { min-width: 0; }
  .pyme-segmented { width: 100%; }
  .pyme-segmented .form-check { flex: 1 1 0; }
  .pyme-segmented .btn { width: 100%; padding: 5px 8px; }
  .pyme-kpi-grid { gap: 10px; }
  .pyme-kpi { padding: 12px; }
  .pyme-kpi-row { flex-direction: column; align-items: stretch; }
  .pyme-spark { flex: 0 0 auto; width: 100%; max-width: none; }
  .pyme-kpi-value { font-size: 1.05rem; }
  .pyme-card { padding: 14px 12px; border-radius: 14px; }
  .pyme-card-head { align-items: flex-start; }
  .pyme-card-head .pyme-segmented { width: 100%; }
  .pyme-market-head .pyme-control { min-width: 0; width: 100%; }
  .pyme-actions .btn { width: 100%; }
}
