/* ✅ NUEVO: Sistema fluido "como el agua" para bloques */
.omega-component-focus {
  outline: 3px solid #0f62fe !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 5px rgba(15, 98, 254, 0.24) !important;
  animation: omega-component-focus-pulse 1.25s ease-in-out infinite;
  position: relative;
  z-index: 2;
}
.omega-component-focus-host {
  outline: 3px solid #0f62fe !important;
  outline-offset: 5px !important;
  box-shadow: 0 0 0 6px rgba(15, 98, 254, 0.2), 0 0 18px rgba(15, 98, 254, 0.32) !important;
  animation: omega-component-focus-pulse 1.25s ease-in-out infinite;
  position: relative;
  z-index: 1;
}
@keyframes omega-component-focus-pulse {
  0%, 100% { outline-color: rgba(15, 98, 254, 0.5) !important; filter: brightness(1) !important; }
  50% { outline-color: #0f62fe !important; filter: brightness(1.08) !important; }
}
@media (prefers-reduced-motion: reduce) {
  .omega-component-focus,
  .omega-component-focus-host { animation: none; }
}
#creditNoteForm:target,
#newCreditNote:target,
#productsTable:target,
#creditSearchForm:target,
#creditResultsTable:target {
  outline: 2px solid #0f62fe !important;
  outline-offset: 4px !important;
  animation: omega-component-focus-pulse 1.25s ease-in-out infinite;
}
/* Cards que ocupan altura flexible basada en viewport */
.card-fluid-height {
  /* Altura mínima */
  min-height: 300px;
  /* Altura máxima flexible basada en viewport height */
  max-height: calc(100vh - 120px); /* Resta header + padding */
  height: auto;
  display: flex;
  flex-direction: column;
}

.card-fluid-height .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Permitir que flex funcione */
  overflow: hidden;
}

/* Para layouts de 2 columnas fluidos */
.columns-container-fluid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px; /* ✅ CANON v265: Espaciado entre bloques */
  /* Altura flexible basada en viewport */
  min-height: calc(100vh - 25px); /* ✅ CANON v265: 5px top + 20px bottom = 25px */
  max-height: calc(100vh - 25px); /* ✅ CANON v265: Ajustado */
  height: auto;
}

/* Columnas individuales */
.columns-container-fluid .column {
  display: flex;
  flex-direction: column;
  gap: 5px; /* ✅ CANON v265: Espaciado entre bloques */
  min-height: 0;
}

/* Cards dentro de columnas fluidas crecen proporcionalmente */
.columns-container-fluid .card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.columns-container-fluid .card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

/* Patrón reutilizable: encabezado integrado solo en el panel primario. */
.card-split-header-layout { min-width: 0; min-height: 0; }
.card-full-height.card-split-header-layout > .card-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  min-width: 0;
  min-height: 0;
  padding: 0;
}
.card-split-header-primary,
.card-split-header-secondary { display: flex; min-width: 0; min-height: 0; flex-direction: column; }
.card-split-header-primary > .card-header { flex: 0 0 auto; }
.card-split-header-primary > .card-body,
.card-split-header-secondary > .card-body { flex: 1 1 auto; min-width: 0; min-height: 0; }
@media (max-width: 767px) {
  .card-full-height.card-split-header-layout > .card-body { grid-template-columns: minmax(0, 1fr); }
}

/* ==================== SEARCH FORM ==================== */
/* CANON: 10px de padding inferior para separar formulario de tabla */

.search-form {
  padding-bottom: 0; /* ✅ ELIMINADO: El gap del card-body ya maneja los 10px */
}

/* ✅ EXCEPCIÓN: Cards SIN card-full-height necesitan padding-bottom porque no tienen gap */
.card:not(.card-full-height) .search-form {
  padding-bottom: 10px;
}

/* ==================== FORM GRID ==================== */
/* Grid 3 columnas con proporciones variables según el contenido */

.form-grid {
  display: grid;
  grid-template-columns: 0.6fr 1.2fr 1.2fr; /* 🔧 CORREGIDO: Primera columna más compacta (0.6fr), las otras dos más grandes (1.2fr) */
  gap: var(--omega-form-grid-gap); /* ✅ CANON GLOBAL */
  align-items: end; /* Alinear todos los elementos al final para consistencia */
  width: 100%; /* Ocupar el 100% del ancho para alineación perfecta con botones y tabla */
}

/* 🔧 CRÍTICO: Asegurar que todos los campos ocupen el 100% del espacio del grid */
.form-grid .form-field {
  width: 100%;
  min-width: 0; /* ✅ CRÍTICO: Permitir que los campos se adapten al ancho disponible */
  max-width: 100%;
}

/* Grid específico para formulario RMA (5 columnas) */
.form-grid-rma {
  grid-template-columns: 0.8fr 1.2fr 1.2fr 1fr 1fr; /* 🔧 CORREGIDO: Más espacio a fechas (1.2fr), menos a Serial/Categoría (1fr) */
  gap: var(--omega-form-grid-gap); /* ✅ CANON GLOBAL */
}

/* 🔧 CRÍTICO: Asegurar que todos los campos ocupen el 100% del espacio del grid */
.form-grid-rma .form-field {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}

/* Responsive: 1 columna en móvil */
@media (max-width: 640px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: var(--omega-form-grid-gap);
    width: 100%;
  }

  /* Grid RMA en mobile: layout especial según Figma */
  .form-grid-rma {
    grid-template-columns: 1fr 1fr; /* 2 columnas para pares de campos */
    gap: var(--omega-form-grid-gap);
  }

  /* Campos que ocupan toda la fila (2 columnas) */
  .form-grid-rma .form-field:has(#rmaNum),
  .form-grid-rma .form-field:has(#facturaNum2),
  .form-grid-rma #clienteField2,
  .form-grid-rma .form-field:has(#serial2),
  .form-grid-rma .form-field:has(#marca2),
  .form-grid-rma .form-field:has(#categoria2) {
    grid-column: 1 / -1; /* Ocupa todas las columnas */
  }

  .date-range-group,
  .category-brand-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 5px !important;
  }

  .date-range-group .form-field,
  .category-brand-group .form-field {
    width: 100% !important;
    margin-bottom: 0 !important;
  }

  /* Ocultar el icono de flecha en móvil */
  .icon-arrow,
  .date-range-arrow {
    display: none !important;
  }
}

/* Grupo de fechas con flecha (Columna 2, Fila 1) */
.date-range-group {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: end;
  gap: 20px;
  width: 100%;
}

/* Opt-in para formularios alojados en card-body con overflow recortado. */
.search-form--clip-safe {
  padding-top: 3px;
}

.date-range-group .form-field {
  flex: 1; /* Cada campo crece igualmente */
  min-width: 0;
}

.date-range-arrow {
  position: absolute;
  left: 50%;
  bottom: 3px; /* canon: el ícono entre campos se centra con el cuadro del campo (sin la etiqueta ni el margen inferior) */
  transform: translateX(-50%);
  width: 16px;
  height: 25px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* Con un mensaje de error en un lado, los dos cuadros se quedan arriba (alineados) y la flecha sigue al cuadro, no al borde inferior del grupo.
   CAUSA del desorden que había (captura de Mauricio, 16/11/2026): .date-range-group alinea sus dos campos al FONDO (align-items: end) y fija la flecha a 3 px del fondo (bottom: 3px).
   El mensaje de error solo se agrega a UN campo y lo hace más alto; el grupo crece, el otro campo (sin mensaje) baja hasta el fondo y la flecha baja con él, así que
   «Fecha desde» quedaba más abajo que «Fecha hasta» y la flecha bajo el mensaje. Alinear arriba y fijar la flecha a 6 px del borde superior lo evita. */
.date-range-group:has(.has-error) { align-items: start; }
.date-range-group:has(.has-error) .date-range-arrow { bottom: auto; top: 6px; }

.date-range-arrow img {
  display: block;
  width: 12px;
  height: 10px;
}

/* Grupo Categoría + Marca (Columna 3, Fila 1) */
.category-brand-group {
  display: flex;
  gap: 18px;
  width: 100%;
}

.category-brand-group .form-field {
  min-width: 0;
}

.category-brand-group
  .form-field:not(.width-100):not(.width-full) {
  flex: 1;
  max-width: calc(50% - 9px);
}

/* ========================================
   SPACING ESTÁNDAR - Formulario a Tabla
   ======================================== */

.tabla-contenedor {
  margin-top: 0; /* ✅ CANON: Sin margin-top, el gap entre elementos lo maneja flexbox */
  margin-bottom: 0; /* ✅ REVERTIDO: Sin margin extra (gap del card-body maneja el espacio) */
}

/* ========================================
   CAMPOS DE FORMULARIO (Input, Select, Date)
   Diseño desde Figma
   ======================================== */

.form-field {
  position: relative;
  padding-top: 6px;
  padding-bottom: 3px;
  width: 100%;
}

.form-field-label {
  position: absolute;
  left: var(--omega-field-label-left, 7px);
  top: var(--omega-field-label-top, 12px);
  transform: translateY(-100%);
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
  color: #0b0b0b;
  background-color: #ffffff;
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 18px);
  z-index: 1;
  height: 14px;
  display: flex;
  align-items: flex-end;
  transition: color 0.2s;
}

.form-field-input,
.form-field-select,
.form-field-date {
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: 0.32px;
  color: #0b0b0b;
  background-color: #ffffff;
  border: 1px solid #949494;
  border-radius: 2px;
  padding: 3px 16px 4px 8px;
  width: 100%;
  height: 25px; /* 34px total (25px + 6px + 1px + 2px border = 34px) */
  box-sizing: border-box;
  transition:
    border-color 0.2s,
    outline 0.2s;
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

/* FOCUS - Verde según sistema de diseño */
.form-field-input:focus,
.form-field-select:focus,
.form-field-date:focus {
  outline: none;
  border: 1px solid #077e38;
  border-radius: 2px;
  padding: 3px 16px 4px 8px;
}

.form-field-input:focus
  + .form-field-icon-outside
  + .form-field-label,
.form-field-select:focus
  + .form-field-icon-outside
  + .form-field-label,
.form-field-date:focus
  + .form-field-icon-outside
  + .form-field-label {
  color: #077e38;
}

/* Workaround para el label cuando el input tiene focus */
.form-field-input:focus ~ .form-field-label,
.form-field-select:focus ~ .form-field-label,
.form-field-date:focus ~ .form-field-label {
  color: #077e38;
}

.form-field-input::placeholder {
  color: transparent;
}

/* Gradiente interno para indicar overflow */
.form-field-input::after,
.form-field-date::after {
  content: "";
  position: absolute;
  right: 2px; /* ✅ RESTAURADO: Vuelve a 2px, ahora con z-index correcto */
  top: 0;
  bottom: 0;
  width: 24px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 1) 100%
  );
  pointer-events: none;
  z-index: 1; /* ✅ Capa 1: Debajo del icono (::before con z-index: 2) */
}

.form-field-input,
.form-field-date {
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Select específico */
.form-field-select {
  appearance: none;
  background-image:
    url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 11L3 6L3.7 5.3L8 9.6L12.3 5.3L13 6L8 11Z' fill='%23595D62'/%3E%3C/svg%3E"),
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0) 0%,
      rgba(255, 255, 255, 1) 100%
    );
  background-repeat: no-repeat;
  background-position:
    right 8px center,
    right 0 top 0;
  background-size:
    16px 16px,
    24px 100%;
}

/* Date input específico - Icono movido a ::before para control de z-index */
.form-field-date {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  /* ✅ Icono movido a ::before - ver más abajo */
}

/* Icono del calendario en ::before para tener z-index sobre el gradiente */
.form-field-date::before {
  content: "";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: var(--omega-checkbox-size) !important;
  height: var(--omega-checkbox-size) !important;
  min-width: var(--omega-checkbox-size) !important;
  max-width: var(--omega-checkbox-size) !important;
  min-height: var(--omega-checkbox-size) !important;
  max-height: var(--omega-checkbox-size) !important;
  aspect-ratio: 1 / 1;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2H11V1H10V2H6V1H5V2H3C2.45 2 2 2.45 2 3V13C2 13.55 2.45 14 3 14H13C13.55 14 14 13.55 14 13V3C14 2.45 13.55 2 13 2ZM13 13H3V6H13V13ZM13 5H3V3H5V4H6V3H10V4H11V3H13V5Z' fill='%23595D62'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
  pointer-events: none;
  z-index: 2; /* ✅ Capa 2: Por encima del gradiente */
}

/* Ocultar iconos nativos del navegador para date inputs */
.form-field-date::-webkit-calendar-picker-indicator {
  opacity: 0;
  position: absolute;
  right: 8px; /* canon: todos los íconos de la derecha de un campo (flecha, calendario, X) a 8 px del borde */
  width: var(--omega-checkbox-size) !important;
  height: var(--omega-checkbox-size) !important;
  min-width: var(--omega-checkbox-size) !important;
  max-width: var(--omega-checkbox-size) !important;
  min-height: var(--omega-checkbox-size) !important;
  max-height: var(--omega-checkbox-size) !important;
  aspect-ratio: 1 / 1;
  cursor: pointer;
}

.form-field-date::-webkit-inner-spin-button,
.form-field-date::-webkit-clear-button {
  display: none;
}

.form-field-date::-moz-calendar-picker-indicator {
  opacity: 0;
}

/* 🔧 CRÍTICO: Eliminar borde rojo del navegador cuando el campo date está inválido o vacío */
.form-field-date:invalid,
.form-field-date:out-of-range {
  border-color: #949494; /* Mantener borde gris, NO rojo */
  box-shadow: none; /* Eliminar cualquier sombra roja del navegador */
}

/* Asegurar que tampoco aparezca el borde rojo en focus cuando está inválido */
.form-field-date:focus:invalid,
.form-field-date:focus:out-of-range {
  border: 2px solid #077e38; /* Solo borde verde, NO rojo */
  border-color: #077e38 !important; /* Forzar verde */
  box-shadow: none; /* Eliminar cualquier sombra roja del navegador */
}

/* 🔧 MEGA CRÍTICO: Anular TODOS los estilos nativos del navegador para date inputs */
input[type="date"].form-field-date:invalid,
input[type="date"].form-field-date:out-of-range,
input[type="date"].form-field-date:-moz-ui-invalid,
input[type="date"].form-field-date:blank {
  border-color: #949494 !important;
  box-shadow: none !important;
  outline: none !important;
}

input[type="date"].form-field-date:focus:invalid,
input[type="date"].form-field-date:focus:out-of-range,
input[type="date"].form-field-date:focus:-moz-ui-invalid {
  border: 2px solid #077e38 !important;
  box-shadow: none !important;
  outline: none !important;
}

/* Anular estilos de validación del navegador */
input[type="date"].form-field-date {
  box-shadow: none !important;
}

input[type="date"].form-field-date:not(:focus):not(:disabled) {
  border-color: #949494 !important;
  box-shadow: none !important;
}

/* Mostrar ano en 2 digitos (visual) sin alterar valor real YYYY-MM-DD */
input[type="date"].form-field-date::-webkit-datetime-edit-year-field {
  width: 2.2ch;
  min-width: 2.2ch;
  max-width: 2.2ch;
  overflow: hidden;
  text-align: right;
}

/* Iconos externos (warning y locked) */
.form-field-icon-outside {
  position: absolute;
  right: -17.5px;
  top: 6px;
  height: 21px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
}

.form-field-icon-outside svg {
  display: none;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Canon table search field */
.omega-table-search-field {
  width: min(420px, 100%);
  margin-left: auto;
}

.omega-table-search-field--wide {
  width: min(560px, 100%);
}

/* Canon: búsqueda por alcance + término + acción explícita de búsqueda. */
.omega-table-search-scope {
  display: flex;
  width: 100%;
  min-width: 0;
  height: 35px;
  box-sizing: border-box;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--border-secondary);
  border-radius: 2px;
  background: var(--bg-secondary);
}

/* Canon multi-select scope variant, reusable with OmegaTableSearchScope. */
.omega-table-search-scope--multi { overflow: visible; }
.omega-table-search-scope__trigger {
  display: inline-flex;
  box-sizing: border-box;
  width: auto;
  min-width: 78px;
  max-width: 126px;
  height: 25px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  margin: 4px;
  padding: 2px 7px;
  border: 0;
  border-radius: 2px;
  background: var(--main-bgs-paginas, #e3e6e8);
  color: var(--text-primary, #111);
  font: 400 12px/16px 'Atkinson Hyperlegible', 'IBM Plex Sans', sans-serif;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}
.omega-table-search-scope__trigger > span { overflow: hidden; text-overflow: ellipsis; }
.omega-table-search-scope__trigger > svg { width: 16px; height: 16px; flex: 0 0 16px; margin-left: auto; }
.omega-table-search-scope__menu {
  position: fixed;
  z-index: 2000;
  box-sizing: border-box;
  min-width: 190px;
  max-height: min(280px, calc(100vh - 8px));
  overflow: auto;
  padding: 4px;
  border: 1px solid var(--border-secondary, #949494);
  border-radius: 2px;
  background: var(--bg-secondary, #fff);
  color: var(--text-primary, #111);
  box-shadow: 0 4px 10px rgba(0,0,0,.18);
}
.omega-table-search-scope__menu[hidden] { display: none; }
.omega-table-search-scope__option {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 2px;
  color: var(--text-primary, #111);
  font: 400 13px/18px 'IBM Plex Sans', sans-serif;
  cursor: pointer;
}
.omega-table-search-scope__option:hover { background: var(--omega-neutral-5, #f1f2f3); }
.omega-table-search-scope__option .maestro-checkbox-input { flex: 0 0 auto; }

html.dark .omega-table-search-scope__trigger { background: var(--omega-neutral-20, #454a4f); color: var(--text-primary, #fff); }
html.dark .omega-table-search-scope__menu { background: var(--bg-secondary, #262626); }
html.dark .omega-table-search-scope__option:hover { background: var(--omega-neutral-20, #454a4f); }

.omega-table-search-scope > select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  width: max-content;
  min-width: 0;
  max-width: 45%;
  height: 100%;
  flex: 0 1 auto;
  padding: 0 18px 0 8px;
  border: 0;
  border-right: 1px solid var(--border-secondary);
  border-radius: 0;
  background-color: var(--omega-neutral-5);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 11L3 5.99999L3.7 5.29999L8 9.59999L12.3 5.29999L13 5.99999L8 11Z' fill='black'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 16px 16px;
  color: var(--text-primary);
  font: 400 12px/16px 'IBM Plex Sans', sans-serif;
}

.omega-table-search-scope > .omega-table-search-scope__input {
  width: 1%;
  min-width: 40px;
  height: 100%;
  flex: 1 1 auto;
  padding: 0 8px;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary);
  font: 400 12px/16px 'IBM Plex Sans', sans-serif;
  box-shadow: none;
}

.omega-table-search-scope > .omega-table-search-scope__input:focus {
  outline: 0;
  box-shadow: none;
}

.omega-table-search-scope > .omega-table-search-scope__input::placeholder {
  color: var(--text-secondary);
  opacity: 1;
}

.omega-table-search-scope > .omega-table-search-scope__submit {
  display: inline-flex;
  min-width: 112px;
  height: 29px;
  min-height: 29px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-inline: 2px;
  padding: 4px 6px;
  border-radius: 2px;
  font: 700 11px/16px 'DM Sans', sans-serif;
  white-space: nowrap;
}

/* Keep the wider action on every search-scope variant, including module-specific submit classes. */
.omega-table-search-scope > button.btn-success[type="submit"] {
  min-width: 112px;
}

.omega-table-search-scope__submit .btn-text { flex: 0 0 auto; }
.omega-table-search-scope__submit .btn-icon { position: static; width: 16px; height: 16px; flex: 0 0 16px; transform: none; }
.omega-table-search-scope__submit .btn-icon svg { display: block; width: 16px; height: 16px; }

@media (max-width: 480px) {
  .omega-table-search-scope > select { max-width: 42%; }
  .omega-table-search-scope > .omega-table-search-scope__submit { min-width: 88px; }
  .omega-table-search-scope > button.btn-success[type="submit"] { min-width: 88px; }
}

.omega-table-search-field .form-field-input {
  padding-right: 34px !important;
}

.omega-table-search-field .form-field-icon-outside,
.omega-table-search-field .search-icon,
.omega-table-search-field .omega-table-search-icon-slot {
  position: absolute;
  right: 8px;
  top: calc(50% + 2px);
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 17px;
  padding: 0;
}

.omega-table-search-field .form-field-icon-outside svg,
.omega-table-search-field .search-icon svg,
.omega-table-search-field .omega-table-search-icon-slot svg {
  display: block;
  width: 16px;
  height: 17px;
  flex-shrink: 0;
}

.omega-table-search-icon path {
  fill: currentColor !important;
  stroke: none !important;
}

.omega-table-search-field .omega-table-search-icon-slot {
  color: #595d62;
}

html.dark .omega-table-search-field .omega-table-search-icon-slot {
  color: #c6c6c6;
}

.omega-table-search-icon.is-hidden {
  display: none !important;
}

/* Canon opt-in: campo con icono textual o SVG al final. */
.form-field--trailing-icon .form-field-input {
  padding-right: 28px !important;
  text-align: left;
  font-variant-numeric: tabular-nums;
}

.form-field-trailing-icon {
  position: absolute;
  right: 2px;
  top: calc(50% + 2px);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 20px;
  pointer-events: none;
}

.form-field-trailing-icon img {
  display: block;
  width: 22px;
  height: 20px;
}

.form-field--end-icon :is(.form-field-input, .form-field-select, .form-field-date) {
  padding-right: 25px !important;
}

.form-field-end-icon {
  position: absolute;
  right: 3px;
  top: calc(50% + 2px);
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 2;
}

.form-field-end-icon img {
  display: block;
  max-width: 16px;
  max-height: 16px;
}

.omega-table-search-clear {
  position: absolute;
  right: 8px;
  top: calc(50% + 2px);
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #595d62;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 0;
}

.omega-table-search-clear[hidden] {
  display: none !important;
}

.omega-table-search-clear svg {
  display: block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.omega-table-search-clear:hover {
  color: #161616;
}

.omega-table-search-clear:focus-visible {
  outline: 2px solid #0f62fe;
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .omega-table-search-field {
    width: 100%;
    margin-left: 0;
  }
}

/* Icono de candado - Centralizado desde Figma (filled) */
.icon-locked {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: none; /* Oculto por defecto */
}

/* Mostrar candado SOLO cuando el padre tiene la clase is-disabled */
.form-field.is-disabled .icon-locked,
.notas-field.is-disabled .icon-locked {
  display: block;
  background-image: url('data:image/svg+xml;utf8,<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 7H11V4C11 3.20435 10.6839 2.44129 10.1213 1.87868C9.55871 1.31607 8.79565 1 8 1C7.20435 1 6.44129 1.31607 5.87868 1.87868C5.31607 2.44129 5 3.20435 5 4V7H4C3.73478 7 3.48043 7.10536 3.29289 7.29289C3.10536 7.48043 3 7.73478 3 8V14C3 14.2652 3.10536 14.5196 3.29289 14.7071C3.48043 14.8946 3.73478 15 4 15H12C12.2652 15 12.5196 14.8946 12.7071 14.7071C12.8946 14.5196 13 14.2652 13 14V8C13 7.73478 12.8946 7.48043 12.7071 7.29289C12.5196 7.10536 12.2652 7 12 7ZM6 4C6 3.46957 6.21071 2.96086 6.58579 2.58579C6.96086 2.21071 7.46957 2 8 2C8.53043 2 9.03914 2.21071 9.41421 2.58579C9.78929 2.96086 10 3.46957 10 4V7H6V4ZM12 14H4V8H12V14Z" fill="%23000000"/></svg>');
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

/* Ocultar SVG inline de candado - usar solo el background de CSS */
svg.icon-locked {
  display: none !important;
  width: 0 !important;
  height: 0 !important;
  position: absolute !important;
  visibility: hidden !important;
}

/* Icono de flecha siempre visible en el campo DESDE */
.form-field-icon-outside .icon-arrow {
  display: block;
}

/* Estado de error */
.form-field.has-error .form-field-input,
.form-field.has-error .form-field-select,
.form-field.has-error .form-field-date {
  border-color: #da1e28;
  outline: 2px solid #da1e28;
  outline-offset: -2px;
}

.form-field.has-error .form-field-label {
  color: #da1e28;
}

.form-field.has-error .icon-warning {
  display: block;
}

/* Estado de error para textarea */
.form-field.has-error .form-textarea,
.form-textarea.has-error {
  border-color: #da1e28;
  outline: 2px solid #da1e28;
  outline-offset: -2px;
}

.form-field.has-error .form-textarea-label {
  color: #da1e28;
}

/* Estado disabled - Según Figma - MISMO GRIS PARA TODOS */
.form-field.is-disabled .form-field-input,
.form-field.is-disabled .form-field-select,
.form-field.is-disabled .form-field-date,
.form-field-input:disabled,
.form-field-select:disabled,
.form-field-date:disabled {
  background-color: #e3e6e8 !important; /* Forzar el gris correcto de Figma */
  color: #acb4b9 !important;
  cursor: not-allowed;
  border-color: #949494;
  -webkit-text-fill-color: #acb4b9; /* Para navegadores webkit */
  opacity: 1; /* Sobrescribir la opacidad por defecto del navegador */
}

.form-field.is-disabled .form-field-label {
  color: #595d62;
}

.form-field.is-disabled .icon-locked {
  display: block;
}

/* Ocultar icono del calendario cuando está disabled (se muestra icon-locked) */
.form-field.is-disabled .form-field-date::before,
.form-field-date:disabled::before {
  display: none; /* ✅ Ocultar el icono del calendario en disabled */
}

/* Ajustar gradiente para disabled */
.form-field.is-disabled .form-field-input::after,
.form-field.is-disabled .form-field-date::after,
.form-field-input:disabled::after,
.form-field-date:disabled::after {
  right: 2px; /* ✅ RESTAURADO: Vuelve a 2px con z-index correcto */
  background: linear-gradient(
    90deg,
    rgba(227, 230, 232, 0) 0%,
    rgba(227, 230, 232, 1) 100%
  );
  z-index: 1; /* ✅ Capa 1: Debajo del icono */
}

/* Select disabled: fade adaptado al gris de fondo (light mode) */
.form-field.is-disabled .form-field-select,
.form-field-select:disabled {
  background-image:
    url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 11L3 6L3.7 5.3L8 9.6L12.3 5.3L13 6L8 11Z' fill='%23595D62'/%3E%3C/svg%3E"),
    linear-gradient(
      90deg,
      rgba(227, 230, 232, 0) 0%,
      rgba(227, 230, 232, 1) 100%
    ) !important;
  background-repeat: no-repeat;
  background-position:
    right 8px center,
    right 0 top 0;
  background-size:
    16px 16px,
    24px 100%;
}

/* ========================================
   BADGE DE ESTATUS - Registro de movimiento
   Diseño desde Figma
   ======================================== */

.badge-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  width: 120px;
  min-width: 120px;
  max-width: 100%;
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 2px;
  border: 1px dashed transparent;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  white-space: nowrap;
  box-sizing: border-box;
}

/* Badge: Registro nuevo - Verde */
.badge-status-nuevo {
  background-color: rgba(46, 125, 50, 0.12);
  color: #077e38;
  border-color: #077e38;
}

/* Paleta compartida para estado "cargado / facturado" */
:root {
  --status-cargado-bg: rgba(255, 232, 163, 0.5);
  --status-cargado-fg: #ffb319;
}

/* Badge: Registro cargado - Amarillo claro (Figma 2026-02-10) */
.badge-status-cargado {
  background-color: var(--status-cargado-bg); /* Amarillo claro 50% opacidad */
  color: #ed4e0a; /* Amarillo/naranja para texto */
  border-color: #ed4e0a;
}

/* Badge: Registro no cargado - Azul */
.badge-status-no-cargado {
  background-color: rgba(24, 107, 233, 0.12);
  color: #186be9;
  border-color: #186be9;
}

/* Badge: Error - Rojo */
.badge-status-error {
  background-color: rgba(211, 45, 34, 0.12);
  color: #a40f16;
  border-color: #a40f16;
}

.badge-status-text {
  display: block;
  white-space: nowrap;
}

/* Mobile canon: badge autoajustable al contenido en todos los módulos */
@media (max-width: 899px) {
  .card-header-actions .badge-status {
    display: inline-flex !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    min-height: 30px;
    padding: 4px 8px;
    flex: 0 0 auto;
  }

  .badge-status {
    width: auto !important;
    min-width: 0 !important;
  }

  .card-header-actions .badge-status .badge-status-text {
    white-space: nowrap !important;
    line-height: 1.1 !important;
  }
}

/* Dark mode: Registro nuevo debe usar el verde canonico de dark */
.dark .badge-status-nuevo {
  background-color: rgba(10, 191, 91, 0.16);
  color: var(--green-status);
  border-color: var(--green-status);
}

.dark .badge-status-cargado {
  background-color: rgba(237, 78, 10, 0.2);
  color: #ffb86b;
  border-color: #ff9a4d;
}

.dark .badge-status-no-cargado {
  background-color: rgba(24, 107, 233, 0.22);
  color: #7eb0ff;
  border-color: #4f94ff;
}

.dark .badge-status-error {
  background-color: rgba(211, 45, 34, 0.22);
  color: #ff9aa2;
  border-color: #ff7278;
}

/* ========================================
   CANON GLOBAL: Pointer de fila seleccionada
   ======================================== */
.canon-row-pointer {
  position: fixed;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 8px solid #077e38;
  pointer-events: none;
  opacity: 0;
  transform: translate(-6px, -50%);
}

.canon-row-pointer.is-visible {
  animation: canon-row-pointer-bounce 3s ease-out forwards;
}

@keyframes canon-row-pointer-bounce {
  0% { opacity: 0; transform: translate(-12px, -50%) scale(0.92); }
  12% { opacity: 1; transform: translate(2px, -50%) scale(1); }
  20% { transform: translate(-3px, -50%) scale(0.995); }
  28% { transform: translate(2px, -50%) scale(1); }
  36% { transform: translate(-2px, -50%) scale(0.998); }
  44% { transform: translate(1.5px, -50%) scale(1); }
  52% { transform: translate(-1.5px, -50%) scale(0.999); }
  60% { transform: translate(1px, -50%) scale(1); }
  68% { transform: translate(-1px, -50%) scale(0.999); }
  76% { transform: translate(0.8px, -50%) scale(1); }
  84% { transform: translate(-0.6px, -50%) scale(1); }
  92% { opacity: 1; transform: translate(0.3px, -50%) scale(1); }
  100% { opacity: 1; transform: translate(0, -50%) scale(1); }
}

/* ========================================
   CHECKBOXES PERSONALIZADOS
   Diseño consistente en todo el sistema
   Diseño desde Figma - 16x16px
   ======================================== */

:root {
  --omega-checkbox-size: 12px;
  --omega-checkbox-radius: 2px;
  --omega-checkbox-border: #8d8d8d;
  --omega-checkbox-bg: #ffffff;
  --omega-checkbox-checked-bg: #161616;
  --omega-checkbox-checked-border: #161616;
  --omega-checkbox-focus-ring: rgba(15, 98, 254, 0.25);
}

input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: var(--omega-checkbox-size) !important;
  height: var(--omega-checkbox-size) !important;
  min-width: var(--omega-checkbox-size) !important;
  max-width: var(--omega-checkbox-size) !important;
  min-height: var(--omega-checkbox-size) !important;
  max-height: var(--omega-checkbox-size) !important;
  aspect-ratio: 1 / 1;
  box-sizing: border-box;
  margin: 0;
  border: 1px solid var(--omega-checkbox-border);
  border-radius: var(--omega-checkbox-radius);
  background: var(--omega-checkbox-bg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

input[type="checkbox"][hidden] {
  display: none !important;
}

input[type="checkbox"]::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8.91 1.63L3.75 6.79 1.09 4.14l-.7.7 3.36 3.36 5.86-5.86-.7-.71Z' fill='white'/%3E%3C/svg%3E");
}

input[type="checkbox"]:checked {
  border-color: var(--omega-checkbox-checked-border);
  background: var(--omega-checkbox-checked-bg);
}

input[type="checkbox"]:checked::after {
  opacity: 1;
  transform: scale(1);
}

input[type="checkbox"]:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--omega-checkbox-focus-ring);
}

input[type="checkbox"]:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

/* Checkboxes en headers de tabla: estilo negativo (12x12) */
th input[type="checkbox"],
.no-sort input[type="checkbox"] {
  border-color: #f4f4f4 !important;
  background: transparent !important;
}

th input[type="checkbox"]:checked,
.no-sort input[type="checkbox"]:checked {
  border-color: #f4f4f4 !important;
  background: #f4f4f4 !important;
}

th input[type="checkbox"]:checked::after,
.no-sort input[type="checkbox"]:checked::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8.91 1.63L3.75 6.79 1.09 4.14l-.7.7 3.36 3.36 5.86-5.86-.7-.71Z' fill='%23161616'/%3E%3C/svg%3E") !important;
}

.maestro-checkbox-input {
  width: var(--omega-checkbox-size) !important;
  height: var(--omega-checkbox-size) !important;
  min-width: var(--omega-checkbox-size) !important;
  max-width: var(--omega-checkbox-size) !important;
  min-height: var(--omega-checkbox-size) !important;
  max-height: var(--omega-checkbox-size) !important;
  aspect-ratio: 1 / 1 !important;
  box-sizing: border-box !important;
}

/* Etiqueta compartida para checkbox de formulario; el tamaño del control sigue
   siendo contextual (compacto en tablas, mayor en opciones de formulario). */
.maestro-checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary, #0b0b0b);
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.16px;
  cursor: pointer;
}

/* Base para checkbox custom */
.checkbox-custom {
  display: flex; /* ✅ CAMBIO CRÍTICO: flex en lugar de inline-flex para evitar bullets */
  align-items: center;
  justify-content: center;
  width: var(--omega-checkbox-size) !important;
  height: var(--omega-checkbox-size) !important;
  min-width: var(--omega-checkbox-size) !important;
  max-width: var(--omega-checkbox-size) !important;
  min-height: var(--omega-checkbox-size) !important;
  max-height: var(--omega-checkbox-size) !important;
  aspect-ratio: 1 / 1;
  flex-shrink: 0;
  cursor: pointer;
  user-select: none;
  border: 1px solid var(--omega-checkbox-border);
  border-radius: var(--omega-checkbox-radius);
  background: var(--omega-checkbox-bg);
  list-style: none !important;
  list-style-type: none !important;
  list-style-image: none !important;
  position: relative;
  overflow: hidden;
}

.checkbox-custom::before,
.checkbox-custom::marker {
  display: none !important;
  content: none !important;
}

/* Check interno para checkbox custom legacy (mismo canon que nativo) */
.checkbox-custom::after {
  content: "";
  display: block !important;
  width: 8px;
  height: 8px;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.15s ease, transform 0.15s ease;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8.91 1.63L3.75 6.79 1.09 4.14l-.7.7 3.36 3.36 5.86-5.86-.7-.71Z' fill='white'/%3E%3C/svg%3E");
}

/* Checkbox desmarcado */
.checkbox-custom.unchecked {
  border-color: var(--omega-checkbox-border) !important;
  background: var(--omega-checkbox-bg) !important;
}

/* Checkbox marcado */
.checkbox-custom.checked {
  border-color: var(--omega-checkbox-checked-border) !important;
  background: var(--omega-checkbox-checked-bg) !important;
}

.checkbox-custom.checked::after {
  opacity: 1;
  transform: scale(1);
}

/* ✅ VARIANTE BLANCA - Para headers con fondo gris */
.checkbox-custom.checkbox-white.unchecked {
  border-color: #ffffff !important;
  background: transparent !important;
}

.checkbox-custom.checkbox-white.checked {
  border-color: #ffffff !important;
  background: #ffffff !important;
}

.checkbox-custom.checkbox-white.checked::after {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='M8.91 1.63L3.75 6.79 1.09 4.14l-.7.7 3.36 3.36 5.86-5.86-.7-.71Z' fill='%23161616'/%3E%3C/svg%3E");
}

/* Hover states - Opcional: agregar opacidad o cambio de color */
.checkbox-custom:hover {
  opacity: 0.8;
}

/* ========================================
   BOTONES - Diseño desde Figma
   ======================================== */

:root {
  --omega-action-button-height: 30px;
  --omega-floating-button-height: 30px;
  --omega-floating-button-collapsed-height: 32px;
}

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 140px;
  /* max-width eliminado para permitir que los botones crezcan según su contenido */
  height: var(--omega-action-button-height);
  min-height: var(--omega-action-button-height);
  padding: 4px 12px;
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  background-color: #ffffff;
  color: #0b0b0b;
  border: 1px solid #595d62;
  border-radius: 2px;
  cursor: pointer;
  transition:
    background-color 0.15s,
    border-color 0.15s,
    box-shadow 0.15s;
  white-space: nowrap;
  box-sizing: border-box;
  flex-shrink: 0; /* CRÍTICO: No permitir que se achiquen */
}

.btn-text {
  flex: 1;
  text-align: center;
  min-width: 0;
}

.btn-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.btn-icon--mask {
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
}

.btn:hover {
  background-color: #f4f4f4;
  border-color: #0b0b0b;
}

.btn:active {
  background-color: #c6c6c6;
}

/* Focus VERDE según sistema de diseño */
.btn:focus {
  outline: 2px solid #077e38;
  outline-offset: -2px;
}

.btn:disabled {
  background-color: #ffffff;
  color: #c6c6c6;
  border-color: #c6c6c6;
  cursor: not-allowed;
}

/* Botón Success - Verde según Figma */
.btn-success {
  background-color: #077e38;
  color: #ffffff;
  border-color: #077e38;
}

.btn-success:hover {
  background-color: #065e2c;
}

.btn-success:active {
  background-color: #054520;
}

/* Focus VERDE */
.btn-success:focus {
  outline: 2px solid #077e38;
  outline-offset: -2px;
}

.btn-success .btn-icon svg path {
  fill: #ffffff;
}

.btn-success:disabled {
  background-color: #c6c6c6;
  border-color: #c6c6c6;
  color: #8d8d8d;
}

/* Botón Danger - Rojo según Figma */
.btn-danger {
  background-color: #a40f16;
  color: #ffffff;
  border-color: #a40f16;
}

.btn-danger:hover {
  background-color: #8a0c12;
}

.btn-danger:active {
  background-color: #70090e;
}

/* Focus ROJO */
.btn-danger:focus {
  outline: 2px solid #a40f16;
  outline-offset: -2px;
}

.btn-danger .btn-icon svg path {
  fill: #ffffff;
}

.btn-danger:disabled {
  background-color: #c6c6c6;
  border-color: #c6c6c6;
  color: #8d8d8d;
}

/* Botón negro sólido reutilizable (acciones primarias oscuras) */
.btn-black {
  background-color: #000000;
  color: #ffffff;
  border-color: #000000;
}

.btn-black:hover {
  background-color: #262626;
  border-color: #262626;
}

.btn-black:active {
  background-color: #404040;
  border-color: #404040;
}

.btn-black:focus {
  outline: 2px solid #077e38;
  outline-offset: -2px;
}

.btn-black:disabled {
  background-color: #c6c6c6;
  border-color: #c6c6c6;
  color: #8d8d8d;
}

/* Botón Outline Verde */
.btn-outline-green {
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.16px;
  min-width: 160px;
  max-width: 220px; /* Limitar expansión excesiva */
  flex: 1; /* Permitir que el botón expanda */
  height: var(--omega-action-button-height);
  min-height: var(--omega-action-button-height);
  padding: 0 16px; /* ✅ Padding SIMÉTRICO para centrado perfecto */
  background-color: rgba(255, 255, 255, 0.01);
  color: #077e38;
  border: 2px solid #077e38;
  border-radius: 0;
  display: inline-flex; /* ✅ Flex para centrar contenido */
  align-items: center;
  justify-content: center; /* ✅ Centrar texto horizontalmente */
  position: relative; /* ✅ Para posicionar icono absolute */
  text-align: center;
  box-sizing: border-box;
}

.btn-outline-green:hover {
  background-color: #f0f7f4;
  border-color: #077e38;
}

.btn-outline-green:active {
  background-color: #d9ede3;
}

.btn-outline-green:focus {
  outline: 2px solid #077e38;
  outline-offset: -2px;
}

.btn-outline-green .btn-icon {
  position: absolute; /* ✅ Icono posicionado absolute */
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.btn-outline-green .btn-icon svg path {
  fill: #077e38;
}

/* Modificador opt-in para acciones cuyo ancho lo determina su contenido. */
.btn-compact {
  flex: 0 0 auto;
  width: 115px;
  min-width: 115px;
  max-width: 115px;
}

/* Composición opt-in para botones con texto e icono en flujo, sin solapamiento. */
.btn-content-spaced {
  gap: 8px;
  padding-left: 8px;
  padding-right: 8px;
}

.btn-content-spaced .btn-text {
  flex: 0 1 auto;
}

.btn-content-spaced .btn-icon {
  position: static;
  transform: none;
}

/* Botón Outline Rojo */
.btn-outline-red {
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.16px;
  min-width: 160px;
  max-width: 220px; /* Limitar expansión excesiva */
  flex: 1; /* Permitir que el botón expanda */
  height: var(--omega-action-button-height);
  min-height: var(--omega-action-button-height);
  padding: 0 16px; /* ✅ Padding SIMÉTRICO para centrado perfecto */
  background-color: rgba(255, 255, 255, 0.01);
  color: #a40f16;
  border: 2px solid #a40f16;
  border-radius: 0;
  display: inline-flex; /* ✅ Flex para centrar contenido */
  align-items: center;
  justify-content: center; /* ✅ Centrar texto horizontalmente */
  position: relative; /* ✅ Para posicionar icono absolute */
  text-align: center;
  box-sizing: border-box;
}

.btn-outline-red:hover {
  background-color: #fef2f3;
  border-color: #a40f16;
}

.btn-outline-red:active {
  background-color: #fcd9db;
}

.btn-outline-red:focus {
  outline: 2px solid #a40f16;
  outline-offset: -2px;
}

.btn-outline-red .btn-icon {
  position: absolute; /* ✅ Icono posicionado absolute */
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.btn-outline-red .btn-icon svg path {
  fill: #a40f16;
}

/* Botón outline negro */
.btn-outline-black {
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  letter-spacing: 0.16px;
  min-width: 160px;
  max-width: 220px;
  flex: 1;
  height: var(--omega-action-button-height);
  min-height: var(--omega-action-button-height);
  padding: 0 16px;
  background-color: rgba(255, 255, 255, 0.01);
  color: #161616;
  border: 1px solid #161616;
  border-radius: 0;
  cursor: pointer;
  box-sizing: border-box;
  transition: background-color 0.14s ease, border-color 0.14s ease, color 0.14s ease;
}

.btn-outline-black:hover {
  background-color: #f4f4f4;
  border-color: #161616;
}

.btn-outline-black:active {
  background-color: #e0e0e0;
}

.btn-outline-black:focus {
  outline: 2px solid #161616;
  outline-offset: -2px;
}

.btn-outline-black .btn-icon svg path {
  fill: #161616;
}

.btn-icon-right {
  right: 16px;
}

/* Pestañas internas de bloques reutilizables */
.block-tabs,
.consultar-more-tabs,
.tienda-language-tabs {
  position: relative;
  display: flex;
  align-items: end;
  gap: 5px;
  min-width: 0;
  width: 100%;
  flex-wrap: wrap;
  background: transparent;
  border-bottom: 1px solid #595d62;
}

.block-tab,
.consultar-more-tab,
.tienda-language-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  min-width: 100px;
  padding: 10px 20px;
  margin-left: 0;
  border: 0;
  border-top: 2px solid transparent;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: transparent;
  color: #161616;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: none;
}

.block-tab:first-child,
.consultar-more-tab:first-child,
.tienda-language-tab:first-child {
  margin-left: 0;
  border-left: 0;
}

.block-tab svg,
.consultar-more-tab svg,
.tienda-language-tab svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: block;
}

.block-tab svg path[fill="none"],
.block-tab svg circle[fill="none"],
.block-tab svg line,
.block-tab svg polyline,
.block-tab svg rect[fill="none"],
.consultar-more-tab svg path[fill="none"],
.consultar-more-tab svg circle[fill="none"],
.consultar-more-tab svg line,
.consultar-more-tab svg polyline,
.consultar-more-tab svg rect[fill="none"],
.tienda-language-tab svg path[fill="none"],
.tienda-language-tab svg circle[fill="none"],
.tienda-language-tab svg line,
.tienda-language-tab svg polyline,
.tienda-language-tab svg rect[fill="none"] {
  stroke: currentColor;
}

.block-tab svg path[fill]:not([fill="none"]),
.block-tab svg circle[fill]:not([fill="none"]),
.consultar-more-tab svg path[fill]:not([fill="none"]),
.consultar-more-tab svg circle[fill]:not([fill="none"]) {
  fill: currentColor;
}

.block-tab.is-active,
.consultar-more-tab.is-active,
.tienda-language-tab.is-active {
  position: relative;
  border-left: 1px solid #a40f16;
  border-right: 1px solid #a40f16;
  border-top: 3px solid #a40f16;
  border-bottom: 0;
  color: #a40f16;
  z-index: 5;
  border-radius: 3px 3px 2px 2px;
  background: #ffffff;
}

.block-tab.is-active::after,
.consultar-more-tab.is-active::after,
.tienda-language-tab.is-active::after {
  content: "";
  position: absolute;
  left: -1px;
  right: -1px;
  bottom: -1px;
  height: 2px;
  background: #ffffff;
  pointer-events: none;
  z-index: 6;
}

.block-tab:focus-visible,
.consultar-more-tab:focus-visible,
.tienda-language-tab:focus-visible {
  outline: 2px solid #0f62fe;
  outline-offset: 1px;
}

.block-tabs-extra,
.consultar-more-tabs-extra,
.tienda-language-tabs-extra {
  margin-left: 8px;
  margin-right: 0;
  margin-bottom: 4px;
  min-width: 116px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #595d62;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: #ffffff;
  color: #161616;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  white-space: nowrap;
}

.block-tabs-extra.is-hidden,
.consultar-more-tabs-extra.is-hidden,
.tienda-language-tabs-extra.is-hidden {
  display: none;
}

.block-tabs-extra strong,
.consultar-more-tabs-extra strong,
.tienda-language-tabs-extra strong {
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: 1;
  margin-left: 6px;
}

.block-tab-panel,
.consultar-more-panel,
.tienda-language-panel {
  display: none;
  min-height: 0;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 160ms ease, transform 160ms ease;
  will-change: opacity, transform;
}

.block-tab-panel.is-active,
.consultar-more-panel.is-active,
.tienda-language-panel.is-active {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  height: auto;
}

.block-tab-panel.is-active.is-ready,
.consultar-more-panel.is-active.is-ready,
.tienda-language-panel.is-active.is-ready {
  opacity: 1;
  transform: translateY(0);
}

/* Dual panel blocks */
.dual-panel-block {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  align-items: stretch;
  width: 100%;
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
}

.dual-panel-block__pane {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
}

.dual-panel-block__pane--pad {
  padding: 12px 20px 20px;
}

.dual-panel-block__title {
  margin: 0 0 12px;
  color: var(--text-primary);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}

/* Preserve the dual-panel title scale when the page is hosted in the main layout. */
.main-content .dual-panel-block__title {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0;
}

@media (max-width: 1023px) {
  .dual-panel-block--stack-tablet {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 639px) {
  .block-tabs,
  .consultar-more-tabs,
  .tienda-language-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .block-tab,
  .consultar-more-tab,
  .tienda-language-tab {
    min-width: 0;
    flex: none;
    white-space: normal;
    text-align: center;
  }

  .block-tabs-extra,
  .consultar-more-tabs-extra,
  .tienda-language-tabs-extra {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin: 8px 0 4px;
  }

  .block-tab-panel,
  .consultar-more-panel,
  .tienda-language-panel {
    min-width: 0;
  }
}

@media (min-width: 640px) and (max-width: 1399px) {
  .block-tabs,
  .consultar-more-tabs,
  .tienda-language-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .block-tab,
  .consultar-more-tab,
  .tienda-language-tab {
    min-width: 0;
    flex: none;
  }

  .block-tabs-extra,
  .consultar-more-tabs-extra,
  .tienda-language-tabs-extra {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    margin: 8px 0 4px;
  }
}

.tienda-language-fade {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 150ms ease, transform 150ms ease;
  will-change: opacity, transform;
}

.tienda-language-fade.is-ready {
  opacity: 1;
  transform: translateY(0);
}

.dark .block-tab,
.dark .consultar-more-tab,
.dark .tienda-language-tab {
  background: var(--card-background);
  color: var(--text-primary);
  border-right-color: var(--card-border);
  box-shadow: none;
  border-bottom-color: transparent;
}

.dark .block-tab.is-active,
.dark .consultar-more-tab.is-active,
.dark .tienda-language-tab.is-active {
  position: relative;
  border-left: 1px solid var(--red-status);
  border-right: 1px solid var(--red-status);
  color: var(--red-status);
  border-top: 3px solid var(--red-status);
  border-bottom: 0;
  z-index: 5;
  border-radius: 2px 2px 2px 2px;
}

.dark .block-tab.is-active::after,
.dark .consultar-more-tab.is-active::after,
.dark .tienda-language-tab.is-active::after {
  background: var(--card-background);
}

.dark .block-tabs-extra,
.dark .consultar-more-tabs-extra,
.dark .tienda-language-tabs-extra {
  background: var(--background);
  border-color: var(--card-border);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.32), inset 0 0 12px rgba(0, 0, 0, 0.24);
  color: var(--text-primary);
}

/* ========================================
   NOTICE BANNER (REUTILIZABLE)
   Avisos dismissibles por página (sin persistencia)
   ======================================== */

.notice-banner {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid;
  border-radius: 2px;
  margin: 0;
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
}

.notice-banner__icon {
  width: 14px;
  height: 14px;
  flex: 0 0 16px;
  margin-top: 1px;
  color: inherit;
}

.notice-banner__content {
  flex: 1;
  min-width: 0;
}

.notice-banner__text {
  margin: 0;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.16px;
  color: inherit;
}

.notice-banner__title {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.16px;
  color: inherit;
}

.notice-banner__description {
  margin: 2px 0 0 0;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: 0.16px;
  color: inherit;
  opacity: 0.95;
}

.notice-banner__dismiss {
  width: 20px;
  height: 20px;
  min-width: 20px;
  min-height: 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  background: transparent;
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.notice-banner__dismiss:hover {
  background: rgba(0, 0, 0, 0.06);
}

.notice-banner__dismiss:focus-visible {
  outline: none;
  border-color: currentColor;
}

.notice-banner__dismiss svg {
  width: 14px;
  height: 14px;
}

/* Botones de acción dentro del cintillo (OmegaNoticeBanner con actions) */
.notice-banner__actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 4px 0 auto;
  align-self: center;
}

.notice-banner__action {
  min-height: 28px;
  padding: 4px 14px;
  border: 1px solid currentColor;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.6);
  color: #161616;
  font: 500 12px/18px "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0.16px;
  white-space: nowrap;
  cursor: pointer;
}

.notice-banner__action:hover {
  background: rgba(22, 22, 22, 0.08);
}

.notice-banner__action--primary {
  border-color: #161616;
  background: #161616;
  color: #fff;
}

.notice-banner__action--primary:hover {
  background: #393939;
}

.notice-banner__action:focus-visible {
  outline: 2px solid #3e66f4;
  outline-offset: 2px;
}

html.dark .notice-banner__action {
  background: rgba(255, 255, 255, 0.06);
  color: #f4f4f4;
}

html.dark .notice-banner__action--primary {
  border-color: #f4f4f4;
  background: #f4f4f4;
  color: #161616;
}

html.dark .notice-banner__action--primary:hover {
  background: #e0e0e0;
}

.notice-banner:has(> .notice-banner__actions) {
  flex-wrap: wrap;
  align-items: center;
}

.notice-banner:has(> .notice-banner__actions) > .notice-banner__content {
  flex: 1 1 260px;
}

@media (max-width: 760px) {
  .notice-banner__actions {
    order: 3;
    flex: 1 1 100%;
    margin: 4px 0 0;
  }

  .notice-banner:has(> .notice-banner__actions) > .notice-banner__content {
    flex: 1 1 0;
  }

  .notice-banner:has(> .notice-banner__actions) > .notice-banner__dismiss {
    order: 2;
    align-self: flex-start;
  }
}

.notice-banner--neutral {
  background: #f4f4f4;
  border-color: #a8a8a8;
  color: #393939;
}

.notice-banner--success {
  background: #e8f5ee;
  border-color: #8ad7a8;
  color: #0e6a34;
}

.notice-banner--warning {
  background: #fff4db;
  border-color: #d89b00;
  color: #8a5a00;
}

.notice-banner--danger {
  background: #fdebec;
  border-color: #f1a6aa;
  color: #a40f16;
}

html.dark .notice-banner--neutral {
  background: #262626;
  border-color: #6f6f6f;
  color: #e0e0e0;
}

html.dark .notice-banner--success {
  background: #1b3a2a;
  border-color: #2b6a44;
  color: #86efac;
}

html.dark .notice-banner--warning {
  background: #3a2b13;
  border-color: #8f691f;
  color: #ffd166;
}

html.dark .notice-banner--danger {
  background: #3a1f22;
  border-color: #7a2f35;
  color: #ff9aa2;
}

/* ========================================
   MOBILE INPUT ZOOM FIX (GLOBAL)
   Evita auto-zoom en iOS al enfocar campos (<16px)
   Mantiene pinch-to-zoom disponible (no toca viewport)
   ======================================== */
@media (max-width: 768px) {
  :root {
    --mobile-input-font-size: 13px;
  }

  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="button"]):not([type="submit"]):not([type="reset"]):not([type="color"]),
  select,
  textarea,
  .form-field-input,
  .form-field-select,
  .form-field-date,
  .form-textarea,
  .search-modal-input {
    font-size: var(--mobile-input-font-size, 13px) !important;
  }
}

/* Responsive: Botones en móviles */
@media (max-width: 640px) {
  .btn {
    min-width: 90px;
    max-width: 100px;
    font-size: 11px;
    padding: 4px 6px;
  }

  .btn-icon {
    right: 6px;
  }

  /* Asegurar que el texto de los botones no se corte */
  .card-header-actions {
    flex-shrink: 0;
    min-width: max-content;
  }
}

/* Botones responsivos - solo icono en espacios reducidos */
.btn-responsive {
  min-width: 140px;
  flex-shrink: 0;
}

/* Primero achicamos un poco (pantallas medianas-grandes) */
@media (max-width: 800px) {
  .btn-responsive {
    min-width: 120px;
    padding: 4px 10px;
    font-size: 11px;
  }

  .btn-responsive .btn-icon {
    right: 10px;
  }
}

/* Luego achicamos más (pantallas medianas) */
@media (max-width: 700px) {
  .btn-responsive {
    min-width: 100px;
    padding: 4px 8px;
    font-size: 11px;
  }

  .btn-responsive .btn-icon {
    right: 8px;
  }
}

/* CRÍTICO: Pasar a solo icono ANTES para priorizar el título */
/* En pantallas de 650px o menos: solo icono (30x30px) */
@media (max-width: 650px) {
  .btn-responsive {
    min-width: 30px;
    width: 30px;
    padding: 4px;
  }

  .btn-responsive .btn-text {
    display: none;
  }

  .btn-responsive .btn-icon {
    position: static;
    transform: none;
  }
}

/* ========================================
   ANCHOS ESPECÍFICOS PARA CAMPOS DE FORMULARIO
   ======================================== */

/* Campos con ancho fijo de 100px (Devolución, Factura, Sucursal, Marca) */
.form-field.width-100 {
  width: 100px;
  min-width: 100px;
  max-width: 100px;
}

/* Campos libres al 100% (Serial, Categoría) */
.form-field.width-full {
  flex: 1;
  min-width: 0;
}

/* ========================================
   ANCHOS DE COLUMNAS DE TABLA
   Estilos reutilizables para colgroup
   ======================================== */

/* Tabla de facturas/devoluciones estándar (4 columnas) */
.col-numero {
  width: 80px;
}

.col-fecha {
  width: 100px;
}

.col-cliente {
  width: auto;
}

.col-monto {
  width: 90px;
}

.col-total {
  width: 90px;
}

/* Tabla de detalle de factura (5 columnas) */
/* Las columnas deben abrazar su contenido, excepto Descripción que toma el espacio restante */
.col-codigo {
  width: 72px;
}

.col-descripcion {
  width: auto; /* Toma el espacio restante disponible */
  min-width: 100px !important; /* ✅ Evitar compresión excesiva - permite scroll horizontal */
}

.col-precio {
  width: 72px;
}

.col-cantidad {
  width: 72px;
}

.col-devolucion {
  width: 72px;
}

/* Utilidades generales */
.tabla-contenedor-no-margin {
  margin-top: 0;
}

/* ========================================
   EMPTY STATE DE TABLAS
   Estilos para cuando la tabla no tiene datos
   ======================================== */

/* Fila de empty state */
.empty-state {
  background-color: transparent !important;
  cursor: default !important; /* ✅ CRÍTICO: Sin cursor pointer */
}

.empty-state:hover {
  background-color: transparent !important;
  cursor: default !important; /* ✅ CRÍTICO: Sin cursor pointer en hover */
}

.empty-state td {
  padding: 20px 24px !important; /* ✅ REDUCIDO de 40px a 20px vertical */
  text-align: center;
  border: none !important;
  cursor: default !important; /* ✅ CRÍTICO: Sin cursor pointer en celdas */
}

.empty-state td:hover {
  cursor: default !important; /* ✅ CRÍTICO: Sin cursor pointer en hover de celdas */
}

/* Contenedor del empty state */
.empty-state-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px; /* ✅ REDUCIDO de 16px a 12px */
  padding: 10px; /* ✅ REDUCIDO de 20px a 10px */
  /* SIN min-height para que se adapte al espacio disponible */
}

/* Icono del empty state */
.empty-state-content svg {
  width: 48px; /* ✅ REVERTIDO: Tamaño original */
  height: 48px;
  opacity: 0.6;
}

/* Icono por defecto del empty state de tabla. Se usa el glyph compartido
   carbon:search--locate; un SVG explícito en el contenido tiene precedencia. */
.tabla-maestro tbody tr.empty-state .empty-state-content:not(:has(svg))::before {
  content: "";
  display: block;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
    opacity: 0.6;
    background: center / contain no-repeat url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSIjODg4ZDkyIiBhcmlhLWhpZGRlbj0idHJ1ZSI+PHBhdGggZD0iTTMwLDI4LjU4NTlsLTQuNjg4NS00LjY4ODRhOC4wMjgsOC4wMjgsMCwxLDAtMS40MTQsMS40MTRMMjguNTg1OSwzMFpNMTksMjVhNiw2LDAsMSwxLDYtNkE2LjAwNjYsNi4wMDY2LDAsMCwxLDE5LDI1WiIvPjxwYXRoIGQ9Ik0yIDEySDEwVjE0SDJ6Ii8+PHBhdGggZD0iTTIgMkgxOFY0SDJ6Ii8+PHBhdGggZD0iTTIgN0gxOFY5SDJ6Ii8+PC9zdmc+");
}

/* Texto principal */
.empty-state-text {
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 0.16px;
  color: #595d62;
  margin: 0;
}

/* Subtexto */
.empty-state-subtext {
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: 0.16px;
  color: #949494;
  margin: 0;
}

/* ========================================
   EMPTY STATE DE SERIALES
   Estilos específicos para el empty state de seriales
   Tarea #26-03-12-A: Empty state mejorado siguiendo CANON Omega
   v297.19: Diseño minimalista - solo icono y texto, sin borde ni background
   ======================================== */

.seriales-empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(140px, 30vh, 220px);
  padding: 16px 10px;
}

.seriales-empty-state .empty-state-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 190px;
  padding: 6px 4px;
}

.seriales-empty-state svg {
  width: 34px;
  height: 34px;
  opacity: 0.52;
  transition: opacity 0.2s ease;
}

.seriales-empty-state:hover svg {
  opacity: 0.65;
}

.seriales-empty-state .empty-state-text {
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.16px;
  color: #525252;
  margin: 0;
  text-align: center;
}

.seriales-empty-state .empty-state-subtext {
  font-size: 12px;
  line-height: 1.35;
  color: #6f6f6f;
  text-align: center;
  text-wrap: balance;
}

/* ========================================
   MODAL EMAIL - Envío de correos
   Tarea #26-03-12-C: Modal de correo para RMA y Devoluciones
   v297.20: Diseño siguiendo CANON con chips de emails y tabla histórico
   ======================================== */

/* Contenedor específico para modal de email (más ancho) */
#email-modal .modal-container {
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

#email-modal .modal-body {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* Info fija (solo lectura) */
.email-info-fija {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.32px;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.email-info-fija p {
  margin: 0 0 10px 0;
}

.email-info-fija p:last-child {
  margin-bottom: 0;
}

.email-info-fija strong {
  font-weight: 600;
}

/* Contenedor de chips de email - Siguiendo CANON de form-field */
.email-chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 2px;
  align-items: center;
  padding: 6px 8px 1px 8px;
  min-height: 25px;
  height: auto;
  background: var(--input-background);
  border: 1px solid #949494;
  border-radius: 2px;
  box-sizing: border-box;
  transition: border-color 0.2s, outline 0.2s;
  cursor: text; /* Indicar que es clickeable para escribir */
}

.email-chips-container:focus-within {
  outline: none;
  border: 2px solid #077e38;
  padding: 5px 7px 0px 7px;
}

body.dark-mode .email-chips-container:focus-within {
  border-color: #077e38; /* Evitar doble borde en dark mode */
}

.email-chips-container:focus-within ~ .form-field-label {
  color: #077e38;
}

/* ✅ ESTADO DE ERROR para campo de emails - CANON */
.form-field.has-error .email-chips-container {
  border-color: #a40f16;
}

.form-field.has-error .form-field-label {
  color: #a40f16;
}

/* ✅ Asterisco ELIMINADO - No se usa en campo de emails */
.form-field.has-error .field-required-indicator {
  display: none; /* Asterisco desactivado */
}

/* Mensaje de error debajo del campo */
.form-field-error-message {
  display: none;
  font-family: "Roboto", sans-serif;
  font-size: 11px;
  line-height: normal;
  color: #a40f16;
  margin-top: 6px;
  margin-bottom: 0;
}

.form-field.has-error .form-field-error-message {
  display: block;
}

/* Chip individual de email - Estilo Figma */
.email-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 2px 2px 4px;
  background: #e3e6e8;
  border: 1px solid var(--input-background);
  border-radius: 2px;
  font-family: "Roboto", sans-serif;
  font-size: 10px;
  line-height: 1;
  color: var(--foreground);
  box-shadow: 0px 2px 2px 0px rgba(51, 51, 51, 0.08);
  position: relative;
}

/* Chip manual (agregado a mano) - Verde según Figma */
.email-chip-manual {
  background: rgba(46, 125, 50, 0.12);
  border-color: var(--input-background);
}

.email-chip-manual .email-chip-text {
  color: #077e38;
}

.email-chip-manual .email-chip-remove {
  color: #077e38;
}

/* Chip inválido - Rojo para emails mal escritos */
.email-chip-invalid {
  background: rgba(164, 15, 22, 0.12);
  border-color: var(--input-background);
}

.email-chip-invalid .email-chip-text {
  color: #a40f16;
}

.email-chip-invalid .email-chip-remove {
  color: #a40f16;
}

.email-chip-text {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-chip-remove {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--foreground);
  transition: opacity 0.2s ease;
  flex-shrink: 0;
}

.email-chip-remove:hover {
  opacity: 0.7;
}

.email-chip-remove svg {
  width: 8px;
  height: 8px;
}

/* Input de email dentro del contenedor de chips */
.email-input-inline {
  flex: 1 1 auto;
  min-width: 120px;
  padding: 0;
  border: none !important; /* Forzar sin borde */
  background: transparent;
  font-family: "Roboto", sans-serif;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.32px;
  color: var(--foreground);
  outline: none !important; /* Forzar sin outline */
  display: inline-block;
  white-space: nowrap;
}

/* ✅ Asegurar que NO haya borde en ningún estado */
.email-input-inline:focus,
.email-input-inline:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

/* ✅ Dark mode - Sin borde en el input */
body.dark-mode .email-input-inline,
body.dark-mode .email-input-inline:focus,
body.dark-mode .email-input-inline:focus-visible {
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
}

.email-input-inline::placeholder {
  color: #595d62;
  opacity: 0.6;
}

/* Evitar que el botón "+" cause salto de línea dentro del contenteditable */
.email-input-inline > * {
  display: inline-block;
  vertical-align: middle;
}

/* ✅ OCULTAR botón "+" cuando el input tiene foco (mientras el usuario escribe) */
.email-input-inline:focus .email-chip-add {
  display: none !important;
}

/* Botón + para agregar emails */
.email-chip-add {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  padding: 2px;
  background: #e3e6e8;
  border: 1px solid var(--input-background);
  border-radius: 2px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  box-shadow: 0px 2px 2px 0px rgba(51, 51, 51, 0.08);
  flex-shrink: 0;
  vertical-align: middle;
  margin-left: 2px;
}

.email-chip-add:hover {
  opacity: 0.8;
}

.email-chip-add svg {
  width: 16px;
  height: 16px;
}

.email-chip-add svg path {
  stroke: var(--foreground);
}

/* Dark mode - Mejor contraste para chips y botón */
.dark .email-chip {
  background: #3a3a3a;
  color: #ffffff;
}

.dark .email-chip-manual {
  background: rgba(46, 125, 50, 0.35);
  border-color: #3a3a3a;
}

.dark .email-chip-manual .email-chip-text {
  color: #4caf50;
}

.dark .email-chip-manual .email-chip-remove {
  color: #4caf50;
}

.dark .email-chip-invalid {
  background: rgba(164, 15, 22, 0.35);
  border-color: #3a3a3a;
}

.dark .email-chip-invalid .email-chip-text {
  color: #ff6b6b;
}

.dark .email-chip-invalid .email-chip-remove {
  color: #ff6b6b;
}

.dark .email-chip-add {
  background: #3a3a3a;
}

/* Campo de Mensaje opcional - EXACTO al diseño de Figma */
.mensaje-field {
  position: relative;
  width: 100%;
  min-height: 34px; /* Altura inicial como en Figma, permite crecer */
  padding-top: 6px;
  padding-bottom: 3px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
}

.mensaje-field .form-textarea {
  width: 100%;
  height: 25px; /* Altura inicial */
  min-height: 25px !important;
  max-height: none; /* ✅ SIN LÍMITE - Se expande automáticamente */
  font-family: "Roboto", sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 16px;
  color: var(--foreground);
  background-color: var(--input-background);
  border: 1px solid #949494;
  border-radius: 2px;
  padding: 3px 5px 2px 8px; /* top: 3px, right: 5px, bottom: 2px, left: 8px como Figma */
  box-sizing: border-box;
  resize: none; /* ✅ Desactivar resize manual - Solo auto-expansión */
  transition: border-color 0.2s, outline 0.2s;
  overflow-y: hidden; /* ✅ Ocultar scroll - El textarea crece automáticamente */
}

.mensaje-field .form-textarea:focus {
  outline: none;
  border: 2px solid #077e38;
  padding: 2px 4px 1px 7px; /* Reducir 1px por el border de 2px */
}

.mensaje-field .form-textarea:focus ~ .form-textarea-label {
  color: #077e38;
}

/* Icono de resize específico para mensaje opcional - DENTRO del campo */
.mensaje-field .textarea-resize-icon {
  position: absolute;
  bottom: 6px; /* 3px del borde del textarea + 3px del padding-bottom */
  right: 5px; /* 3px del borde del textarea + 2px extra */
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 2;
}

/* Sección de histórico */
.email-historico-section {
  margin-top: 15px;
}

.email-historico-title {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  color: var(--text-primary);
  margin: 0 0 10px 0;
}

/* Footer del modal de email */
#email-modal .modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 15px 20px;
  border-top: 1px solid var(--border-primary);
}

/* Responsive para modal email */
@media (max-width: 640px) {
  #email-modal .modal-container {
    max-width: 100%;
    max-height: 95vh;
  }

  .email-chip-text {
    max-width: 120px;
  }

  .email-historico-table-wrapper {
    max-height: 120px;
  }
}

/* ========================================
   TOTALES Y NOTAS
   Sección debajo de la tabla de detalle
   ======================================== */

.totales-notas-container {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: center;
  justify-content: center;
  margin-top: 20px; /* ✅ REVERTIDO: Separación estándar */
  width: 100%;
}

/* Campo de Notas (Textarea) */
.notas-field {
  position: relative;
  flex: 1 1 250px;
  min-width: 250px;
  min-height: 142px; /* Cambiado de height fijo a min-height */
  padding-top: 6px;
  padding-bottom: 3px;
  display: flex; /* Para que crezca con el contenido */
}

.form-textarea {
  width: 100%;
  min-height: 133px; /* Altura inicial calculada: 142px - 6px (padding-top) - 3px (padding-bottom) */
  max-height: 300px; /* Evitar que se solape con otros elementos */
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 16px;
  color: var(--foreground);
  background-color: var(--input-background);
  border: 1px solid #949494;
  border-radius: 2px;
  padding: 4px 5px 4px 8px;
  box-sizing: border-box;
  resize: vertical; /* Solo permite resize vertical */
  transition:
    border-color 0.2s,
    outline 0.2s;
}

.form-textarea:focus {
  outline: none;
  border: 2px solid #077e38;
  padding: 3px 4px 3px 7px;
}

.form-textarea:disabled {
  background-color: #e3e6e8; /* Solo gris cuando disabled */
  color: #acb4b9;
  cursor: not-allowed;
}

/* Estado disabled para el campo de notas - mostrar candadito */
.notas-field.is-disabled .icon-locked {
  display: block;
}

/* ========================================
   UNIFORMIDAD GLOBAL DISABLED (CANON)
   Objetivo: un solo comportamiento para todos los modulos.
   ======================================== */

/* Quitar candados globalmente en campos bloqueados */
.form-field.is-disabled .icon-locked,
.notas-field.is-disabled .icon-locked,
.buscar-tag-lock {
  display: none !important;
}

/* Quitar pseudo-candados dibujados por ::after en modulos especificos */
.form-field.is-disabled::after,
.mensaje-field.is-disabled::after,
.notas-field.is-disabled::after {
  content: none !important;
  display: none !important;
}

/* Skin disabled global (light) */
.form-field.is-disabled .form-field-input,
.form-field.is-disabled .form-field-select,
.form-field.is-disabled .form-field-date,
.form-field.is-disabled .form-textarea,
.form-field-input:disabled,
.form-field-select:disabled,
.form-field-date:disabled,
.form-textarea:disabled,
textarea.form-field-input:disabled {
  background-color: #e3e6e8 !important;
  color: #acb4b9 !important;
  border-color: #949494 !important;
  -webkit-text-fill-color: #acb4b9 !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}

.form-field.is-disabled .form-field-label,
.form-field.is-disabled .form-textarea-label,
.notas-field.is-disabled .form-textarea-label {
  color: #595d62 !important;
}

/* Ocultar el indicador nativo de resize del navegador */
.form-textarea::-webkit-resizer {
  display: none;
}

.form-textarea::-moz-resizer {
  display: none;
}

.form-textarea-label {
  position: absolute;
  left: 8px;
  top: 10px;
  transform: translateY(-100%);
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 11px;
  font-weight: 400;
  line-height: 14px;
  color: var(--foreground);
  background-color: var(--input-background);
  padding: 0 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: calc(100% - 18px);
  z-index: 1;
  height: 14px;
  display: flex;
  align-items: flex-end;
}

.form-textarea:focus ~ .form-textarea-label {
  color: #077e38;
}

.textarea-resize-icon {
  position: absolute;
  bottom: 2px; /* 2px de separación del borde inferior */
  right: 2px; /* 2px de separación del borde derecho */
  width: 16px;
  height: 16px;
  pointer-events: none;
  z-index: 2; /* Asegurar que esté por encima del textarea */
}

.textarea-resize-icon svg {
  width: 16px;
  height: 16px;
  display: block;
  position: absolute;
  bottom: 0;
  right: 0;
}

/* ===== TABLA HISTÓRICO DE CORREOS ===== */
.email-historico-section {
  margin-top: 15px;
}

.email-historico-title {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  letter-spacing: 0.16px;
  color: var(--foreground);
  margin: 0 0 10px 0;
}

.email-historico-table-wrapper {
  max-height: 200px;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid #a8a8a8;
  border-radius: 2px;
  position: relative;
  /* ✅ Scrollbar más delgada - CANON */
  scrollbar-width: thin;
  scrollbar-color: #8d8d8d transparent;
}

/* ✅ Scrollbar personalizada para navegadores Webkit (Chrome, Edge, Safari) */
.email-historico-table-wrapper::-webkit-scrollbar {
  width: 6px;
}

.email-historico-table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.email-historico-table-wrapper::-webkit-scrollbar-thumb {
  background: #8d8d8d;
  border-radius: 3px;
}

.email-historico-table-wrapper::-webkit-scrollbar-thumb:hover {
  background: #6f6f6f;
}

#email-historico-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  display: table;
  /* CRÍTICO: Eliminar cualquier scroll de la tabla */
  overflow: visible;
}

#email-historico-table thead {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #a8a8a8;
}

#email-historico-table tbody,
#email-historico-table thead {
  display: table-header-group;
  overflow: visible;
}

#email-historico-table tbody {
  display: table-row-group;
}

#email-historico-table tbody:has(tr.empty-state) {
  display: block;
  min-height: 120px;
  height: 120px;
  overflow: hidden;
}

#email-historico-table tbody tr.empty-state {
  display: block;
  width: 100%;
  height: 100%;
}

#email-historico-table tbody tr.empty-state td {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: 100%;
  padding: 12px;
  border: none;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

#email-historico-table tbody tr.empty-state .empty-state-content {
  width: min(280px, calc(100% - 24px));
  margin: 0 auto;
  text-align: center;
}

#email-historico-table tbody tr.empty-state .empty-state-content svg {
  display: block;
  width: 48px;
  height: 48px;
  opacity: 0.6;
  margin: 0 auto 8px;
}

#email-historico-table thead th {
  padding: 5px;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: 0.32px;
  color: #ffffff;
  text-align: left;
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* CRÍTICO: Fuerza que las celdas respeten el ancho de table-layout:fixed */
}

#email-historico-table tbody td {
  padding: 5px;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 0.32px;
  color: var(--foreground);
  border-bottom: 0.5px solid rgba(0, 0, 0, 0.04);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 0; /* CRÍTICO: Fuerza que las celdas respeten el ancho de table-layout:fixed */
}



#email-historico-table tbody tr:last-child td {
  border-bottom: none;
}

#email-historico-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Columna de fecha */
#email-historico-table th:nth-child(2),
#email-historico-table td:nth-child(2) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
}

/* Columna de correo - Ancho flexible */
#email-historico-table th:nth-child(3),
#email-historico-table td:nth-child(3) {
  width: auto;
  min-width: 0;
}

/* Columna de usuario - Ancho fijo */
#email-historico-table th:nth-child(4),
#email-historico-table td:nth-child(4) {
  width: 80px;
  min-width: 80px;
  max-width: 80px;
}

/* Columnas de checkbox y botón - Ancho fijo 36px según CANON */
.email-historico-checkbox-col {
  width: 36px !important;
  min-width: 36px !important;
  max-width: 36px !important;
  padding: 0 !important;
  text-align: center !important;
  white-space: normal !important;
  overflow: visible !important;
}

.email-historico-delete-col {
  width: var(--table-action-cell-size, 28px) !important;
  min-width: var(--table-action-cell-size, 28px) !important;
  max-width: var(--table-action-cell-size, 28px) !important;
  padding: 3px !important;
  text-align: center !important;
  white-space: normal !important;
  overflow: visible !important;
}

/* Centrado horizontal de checkboxes en tabla histórico */
.email-historico-checkbox-col .checkbox-custom,
.email-historico-checkbox-col .checkbox-header-all {
  margin: 0 auto;
  display: block;
}

/* Columnas con texto que pueden truncarse - Sistema CANON de tooltips */
#email-historico-table tbody td:not(.email-historico-checkbox-col):not(.email-historico-delete-col) {
  cursor: default;
  position: relative;
}

/* Botón de eliminar en histórico de correos - 29x18px según Figma */
.btn-delete-email-historico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  width: var(--table-action-button-size, 21px) !important;
  height: var(--table-action-button-size, 21px) !important;
  padding: 0;
  background: var(--table-action-delete-bg);
  color: var(--table-action-delete-fg);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 90ms ease, box-shadow 90ms ease;
  flex-shrink: 0;
  vertical-align: middle;
}

.btn-delete-email-historico:hover {
  background: var(--table-action-delete-hover-bg);
  color: var(--table-action-delete-hover-fg);
}

.btn-delete-email-historico:active {
  background: var(--table-action-delete-active-bg);
  color: var(--table-action-delete-active-fg);
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.btn-delete-email-historico:focus {
  outline: none;
}

.btn-delete-email-historico svg {
  display: block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  overflow: visible;
  transform: none;
}

.btn-delete-email-historico svg path {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: var(--table-action-icon-stroke-width, 0.6);
}

/* Checkbox del header para seleccionar todos - Variante blanca para header gris */
.checkbox-header-all {
  width: 16px;
  height: 16px;
  border: none;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.2s ease;
}

/* Estado unchecked - Solo borde blanco */
.checkbox-header-all {
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2H3C2.73478 2 2.48043 2.10536 2.29289 2.29289C2.10536 2.48043 2 2.73478 2 3V13C2 13.2652 2.10536 13.5196 2.29289 13.7071C2.48043 13.8946 2.73478 14 3 14H13C13.2652 14 13.5196 13.8946 13.7071 13.7071C13.8946 13.5196 14 13.2652 14 13V3C14 2.73478 13.8946 2.48043 13.7071 2.29289C13.5196 2.10536 13.2652 2 13 2V2ZM3 13V3H13V13H3Z' fill='%23FFFFFF'/%3E%3C/svg%3E");
}

/* Estado checked - Borde blanco + checkmark */
.checkbox-header-all.checked {
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 2H3C2.73478 2 2.48043 2.10536 2.29289 2.29289C2.10536 2.48043 2 2.73478 2 3V13C2 13.2652 2.10536 13.5196 2.29289 13.7071C2.48043 13.8946 2.73478 14 3 14H13C13.2652 14 13.5196 13.8946 13.7071 13.7071C13.8946 13.5196 14 13.2652 14 13V3C14 2.73478 13.8946 2.48043 13.7071 2.29289C13.5196 2.10536 13.2652 2 13 2V2ZM7 10.75L4.5 8.27135L5.2954 7.5L7 9.1728L10.7044 5.5L11.5002 6.2886L7 10.75Z' fill='%23FFFFFF'/%3E%3C/svg%3E");
}

.checkbox-header-all:hover {
  opacity: 0.8;
}

/* Columna de Totales */
.totales-column {
  flex: 1 1 250px;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.total-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  border-bottom: 1px dashed #595d62;
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: 0.16px;
  color: #0b0b0b;
}

.total-label {
  font-weight: 400;
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.total-value {
  font-weight: 700;
  text-align: right;
  flex-shrink: 0; /* No permitir que los valores se encojan */
  margin-left: 10px; /* Separación mínima del label */
}

.total-final {
  border-bottom: 1px dashed #595d62;
}

.total-value-final {
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 28px;
  text-align: right;
  flex-shrink: 0; /* No permitir que el valor final se encojan */
  margin-left: 10px; /* Separación mínima del label */
}

/* Resumen compacto de datos: patrón usado por el diálogo de Despacho,
   disponible también en páginas del Page Builder. */
.dispatch-packages-summary.pbl-data-summary {
  display: grid;
  grid-template-columns: repeat(var(--pbl-summary-columns, 4), minmax(0, 1fr));
  gap: 8px;
  border: 1px solid #dfe3e8;
  border-radius: 0;
  padding: 10px;
  background: #ffffff;
}

.dispatch-packages-summary.pbl-data-summary .dispatch-packages-summary-item {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.dispatch-packages-summary.pbl-data-summary .dispatch-packages-summary-label {
  margin: 0;
  color: #52575d;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 11px;
  line-height: 14px;
}

.dispatch-packages-summary.pbl-data-summary .dispatch-packages-summary-value {
  margin: 4px 0 0;
  overflow: hidden;
  color: #161616;
  font-family: "Encode Sans Semi Condensed", "IBM Plex Sans", "Roboto Condensed", sans-serif;
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .dispatch-packages-summary.pbl-data-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .dispatch-packages-summary.pbl-data-summary {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Responsive: Mobile - Columna arriba, totales abajo */
@media (max-width: 768px) {
  .totales-notas-container {
    flex-direction: column;
    gap: 15px; /* Reducido de 20px */
    margin-top: 20px; /* ✅ REVERTIDO: Separación estándar */
    margin-bottom: 5px; /* Reducido más para menos espacio antes de controles */
  }

  .notas-field,
  .totales-column {
    width: 100%;
    min-width: 100%;
  }
}

/* ========================================
   BOTONES DE PAGINACIÓN
   Diseño desde Figma - Estilo CANON
   ======================================== */

.pagination-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  width: 32px;
  height: 32px;
  padding: 4px 12px;
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 16px;
  color: #0b0b0b;
  background-color: transparent;
  border: 1px solid #595d62;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
  box-sizing: border-box;
}

.pagination-btn:hover {
  background-color: #f4f4f4;
  border-color: #0b0b0b;
}

.pagination-btn:active {
  background-color: #c6c6c6;
}

/* Botón activo/seleccionado - Rojo según Figma */
.pagination-btn-active {
  background-color: #a40f16;
  color: #ffffff;
  border-color: #a40f16;
  font-weight: 700;
}

.pagination-btn-active:hover {
  background-color: #8a0d12;
  border-color: #8a0d12;
}

.pagination-btn-active:active {
  background-color: #6e0a0e;
}

/* Focus VERDE según sistema de diseño */
.pagination-btn:focus {
  outline: 2px solid #077e38;
  outline-offset: -2px;
}

/* Botones de navegación (anterior/siguiente) - Solo icono, 24x24px */
.pagination-btn svg {
  width: 24px;
  height: 24px;
  display: block;
}

.pagination-btn:disabled {
  background-color: transparent;
  color: #c6c6c6;
  border-color: #c6c6c6;
  cursor: not-allowed;
  opacity: 0.5;
}

.pagination-btn:disabled svg path {
  fill: #c6c6c6;
}

/* ========================================
   CONTROLES (Dropdown + Botones)
   Sección al final del bloque
   ======================================== */

.controles-container {
  display: flex;
  flex-wrap: wrap; /* Permitir wrap */
  gap: 18px; /* Gap de 18px como en Figma */
  align-items: center;
  justify-content: center; /* Centrar horizontalmente */
  padding: 10px 0;
  margin-top: 10px;
  width: 100%;
}

/* El dropdown - crece con min-width */
.controles-container .form-field {
  flex: 3 1 0; /* 30% del espacio - Cambiado de "1 1 0" */
  min-width: 150px; /* Ancho mínimo como en Figma */
  max-width: none;
}

.controles-botones {
  display: flex;
  flex-wrap: wrap; /* Permitir wrap de botones */
  gap: 10px;
  align-items: center;
  justify-content: flex-end; /* ✅ Alinear botones a la derecha */
  flex: 7 1 0; /* 70% del espacio - Cambiado de "1 1 0" */
  min-width: 170px; /* Ancho mínimo del contenedor */
  max-width: 600px; /* Ancho máximo como en Figma */
}

/* Los botones se distribuyen equitativamente */
.controles-botones .btn {
  flex: 1 1 0; /* Crecen proporcionalmente */
  min-width: 180px; /* Ancho mínimo de cada botón como en Figma */
  white-space: nowrap;
}

/* Responsive: Mobile - Todo apilado verticalmente al 100% */
@media (max-width: 1500px) {
  .controles-container {
    flex-direction: column;
    align-items: stretch; /* Los elementos ocupan 100% del ancho */
    gap: 18px;
    padding: 10px 0;
  }

  .controles-container .form-field {
    width: 100%;
    max-width: 100%;
    min-width: auto;
    flex: 0 0 auto;
  }

  .controles-botones {
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    align-items: stretch; /* Los botones ocupan 100% */
    gap: 10px;
    min-width: auto;
    flex: 0 0 auto;
  }

  /* MOSTRAR TEXTO en botones de reimpresión en mobile */
  .controles-botones .btn {
    width: 100%;
    max-width: 100%;
    min-width: auto;
    padding: 8px 40px 8px 16px; /* Mantener espacio para ícono */
    flex: 0 0 auto;
    font-size: 14px; /* Aumentado de 12px a 14px para mejor legibilidad en mobile */
  }

  .controles-botones .btn .btn-text {
    display: inline !important;
  }

  .controles-botones .btn .btn-icon {
    position: absolute !important;
    right: 16px !important;
    transform: translateY(-50%) !important;
    margin-left: 0 !important;
  }
}

/* ========================================
   CARD CON ALTURA COMPLETA
   Para bloques que ocupan 100% vertical
   ======================================== */

.card-full-height {
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0; /* CRÍTICO: Permitir que flex funcione */
}

/* ✅ V262: FIX DESBORDAMIENTO - Contener contenido dentro del card */
.card-full-height .card-body {
  flex: 1; /* Crecer para ocupar espacio disponible */
  display: flex;
  flex-direction: column;
  min-height: 0; /* ✅ CAMBIADO: De 100% a 0 - Evitar crecimiento excesivo */
  max-height: 100%; /* ✅ AGREGADO: Límite superior - No crecer más allá del card */
  overflow: hidden; /* ✅ CRÍTICO: Evitar que el contenido desborde */
  gap: 10px; /* ✅ CANON FIJO: 10px entre formulario y tabla SIEMPRE */
  padding: 0 20px 20px 20px; /* ✅ CANON: SIEMPRE 20px de padding en el fondo, SIN padding-top */
}

/* ✅ v289: FIX CRÍTICO - Card-body scrollable en detalle de factura cuando contenido no cabe */
.card-detail-invoice .card-body {
  overflow-y: auto !important; /* ✅ Permitir scroll vertical cuando contenido excede altura */
  overflow-x: hidden !important; /* Ocultar scroll horizontal */
}

/* ✅ CRÍTICO: La tabla dentro del card-body DEBE crecer también */
.card-full-height .card-body .tabla-contenedor {
  flex: 1; /* Ocupar el espacio restante después del formulario */
  display: flex;
  flex-direction: column;
  min-height: 0; /* Permitir que funcione el flex */
  overflow: hidden; /* ✅ V262: CAMBIADO de visible a hidden - Contener footer dentro del card */
  gap: 0; /* Sin gap entre tabla y footer */
}

/* ✅ v288b: FIX CRÍTICO - Tabla de detalle NO debe usar flex: 1, debe tener altura máxima fija */
.card-full-height .card-body .tabla-contenedor:has(#table-detail),
.card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) {
  flex: 0 0 auto !important; /* ✅ NO ocupar todo el espacio - altura basada en contenido */
  max-height: 540px !important; /* ✅ Limitar altura para dejar espacio a totales-notas */
  overflow: visible !important; /* ✅ Permitir que el scrollbar del tbody sea visible */
}

/* La tabla dentro de tabla-contenedor debe ocupar todo el espacio */
.card-full-height .card-body .tabla-contenedor .tabla-maestro {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%; /* ✅ CRÍTICO: No crecer más allá del contenedor */
}

/* El tbody dentro de la tabla crece para llenar el espacio */
.card-full-height .card-body .tabla-contenedor .tabla-maestro tbody {
  flex: 1;
  min-height: 189px; /* Mínimo: 7 filas */
  height: auto !important; /* Anular altura fija */
  overflow-y: auto;
  max-height: 100%; /* ✅ v281: RESTAURADO para tablas SIN paginación (Buscar RMA, Buscar Factura) */
}

/* ✅ v291: FIX RESPONSIVE - Tabla "Detalle de factura" con altura flexible según resolución */
.card-full-height .card-body .tabla-contenedor:has(#table-detail) .tabla-maestro tbody,
.card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) .tabla-maestro tbody {
  min-height: 100px !important; /* ✅ BASE: Altura mínima para mobile/tablet */
  max-height: 100px !important; /* ✅ BASE: Altura máxima para mobile/tablet - tbody con scroll */
  overflow-y: auto !important; /* ✅ Scroll vertical interno en el tbody */
  display: block; /* ✅ CRÍTICO: Necesario para que overflow-y funcione */
}

/* ✅ v294: Desktop normal (900px+) - Altura 150px */
@media (min-width: 900px) {
  .card-full-height .card-body .tabla-contenedor:has(#table-detail) .tabla-maestro tbody,
  .card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) .tabla-maestro tbody {
    min-height: 150px !important;
    max-height: 150px !important;
  }
}

/* ✅ v294: Desktop grande (1600px+) - Altura 200px NUEVO - Más conservador */
@media (min-width: 1600px) {
  .card-full-height .card-body .tabla-contenedor:has(#table-detail) .tabla-maestro tbody,
  .card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) .tabla-maestro tbody {
    min-height: 200px !important;
    max-height: 200px !important;
  }
}

/* ✅ v294: Desktop XL (1900px+) - Altura 280px REDUCIDO de 350px */
@media (min-width: 1900px) {
  .card-full-height .card-body .tabla-contenedor:has(#table-detail) .tabla-maestro tbody,
  .card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) .tabla-maestro tbody {
    min-height: 280px !important;
    max-height: 280px !important;
  }
}

/* ✅ v290: CRÍTICO - thead y tr deben ajustarse al ancho cuando tbody es display: block */
.card-full-height .card-body .tabla-contenedor:has(#table-detail) .tabla-maestro thead,
.card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) .tabla-maestro thead,
.card-full-height .card-body .tabla-contenedor:has(#table-detail) .tabla-maestro thead tr,
.card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) .tabla-maestro thead tr,
.card-full-height .card-body .tabla-contenedor:has(#table-detail) .tabla-maestro tbody tr,
.card-full-height .card-body .tabla-contenedor:has(#RMAProductsTable) .tabla-maestro tbody tr {
  display: table; /* ✅ Mantener comportamiento de tabla */
  width: 100%; /* ✅ Ocupar todo el ancho disponible */
  table-layout: fixed; /* ✅ Respetar anchos de colgroup */
}

/* ✅ v281: OVERRIDE para tablas CON DataTables - NO limitar altura para mostrar paginación */
.card-full-height .card-body .tabla-contenedor.has-datatables .tabla-maestro tbody {
  max-height: none; /* ✅ Sin límite para que la paginación sea visible */
}

/* ✅ v286: FIX CANÓNICO - En resoluciones bajas, limitar altura y ajustar tabla */
@media (max-width: 900px) {
  /* Limitar altura del card-body al viewport en mobile */
  .card-detail-invoice .card-body {
    max-height: calc(100vh - 200px) !important; /* ✅ Limitar altura al viewport */
  }
  
  /* La tabla NO debe usar flex: 1 en mobile - debe crecer naturalmente */
  .card-detail-invoice .card-body .tabla-contenedor {
    flex: 0 1 auto !important; /* ✅ NO ocupar todo el espacio - crecer según contenido */
    overflow: visible !important; /* ✅ Permitir que scrollbar sea visible */
    max-height: none !important; /* ✅ Sin límite - crecer naturalmente */
  }

  /* Devoluciones/RMA mobile: sin scroll interno en detalle de factura */
  body:has(.card-search-returns) .card-detail-invoice .card-body,
  body:has(.card-search-rma) .card-detail-invoice .card-body {
    max-height: none !important;
    overflow-y: visible !important;
  }

  body:has(.card-search-returns) #table-detail tbody,
  body:has(.card-search-rma) #RMAProductsTable tbody {
    display: table-row-group !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: visible !important;
  }
}

/* ✅ CRÍTICO: El footer NO debe crecer, debe ser de altura fija */
.card-full-height .card-body .tabla-contenedor .table-footer {
  flex: 0 0 auto; /* NO crecer, altura fija */
  flex-shrink: 0; /* NO encogerse nunca */
}

/* ========================================
   LISTA DE SERIALES
   Items con iconos de agregar/quitar
   ======================================== */

.seriales-list {
  display: flex;
  flex-direction: column;
  gap: 5px; /* ✅ Aumentado a 5px para mejor respiro */
  padding: 7px 0 0 0; /* ✅ Aumentado a 7px top */
  width: 100%;
  margin-left: -20px; /* ✅ Compensar padding-left del card-body para alinear iconos sobre margen */
  padding-left: 20px; /* ✅ Recrear espacio para los iconos en posición absoluta */
}

/* 📜 SCROLLBAR INTERNO: Para cuando hay muchos seriales (20+) */
.seriales-list-scrollable {
  overflow-x: hidden; /* Sin scroll horizontal en ningún caso */
}

/* ✅ v296: MOBILE - SIN scroll interno, crece libremente con el contenido */
@media (max-width: 899px) {
  .seriales-list-scrollable {
    min-height: auto !important; /* Sin mínimo forzado - altura natural */
    max-height: none !important; /* SIN límite - crece todo lo necesario */
    overflow-y: visible !important; /* Sin scroll interno */
    padding-right: 0; /* Sin espacio para scrollbar (no existe) */
  }
}

/* ✅ v296: DESKTOP - CON scroll interno controlado */
@media (min-width: 900px) {
  .seriales-list-scrollable {
    min-height: 180px; /* Mínimo para mostrar 4 seriales */
    max-height: 400px; /* Límite razonable - luego scroll */
    overflow-y: auto; /* Scroll interno cuando excede */
    padding-right: 5px; /* Espacio para el scrollbar */
  }

  .seriales-list-scrollable.seriales-list-empty {
    min-height: 0 !important;
    max-height: none !important;
    overflow-y: hidden !important;
    padding-right: 0 !important;
  }
}

/* 🎨 ESTILOS PERSONALIZADOS DE SCROLLBAR (SOLO DESKTOP) */
@media (min-width: 900px) {
  /* Webkit browsers */
  .seriales-list-scrollable::-webkit-scrollbar {
    width: 8px;
  }

  .seriales-list-scrollable::-webkit-scrollbar-track {
    background: #f4f4f4;
    border-radius: 4px;
  }

  .seriales-list-scrollable::-webkit-scrollbar-thumb {
    background: #c6c6c6;
    border-radius: 4px;
  }

  .seriales-list-scrollable::-webkit-scrollbar-thumb:hover {
    background: #8d8d8d;
  }

  /* Firefox */
  .seriales-list-scrollable {
    scrollbar-width: thin;
    scrollbar-color: #c6c6c6 #f4f4f4;
  }
}

.serial-item {
  display: flex;
  align-items: center;
  gap: 7px; /* ✅ Aumentado a 7px para separación icono-texto */
  padding: 0px 0px;
  border-radius: 4px;
  transition: background-color 150ms ease, transform 100ms ease;
  cursor: pointer;
  position: relative; /* ✅ Contexto para posición absoluta del icono */
  padding-left: 0px; /* ✅ Sin padding: texto alineado al borde izquierdo del contenido */
}

.serial-item:hover {
  background-color: #f4f4f4;
  transform: translateY(-1px);
}

/* Dark mode hover */
.dark .serial-item:hover {
  background-color: #262626;
}

.serial-icon {
  position: absolute; /* ✅ Posición absoluta sobre el margen */
  left: -17px; /* ✅ 17px a la izquierda del texto (sobre el padding del card-body) */
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 150ms ease;
}

.serial-icon:hover {
  transform: scale(1.15);
}

.serial-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.serial-text {
  font-family:
    "Roboto",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 12px; /* ✅ Aumentado a 12px para mejor legibilidad */
  font-weight: 400;
  line-height: normal;
  color: #0b0b0b;
  flex: 1;
  user-select: text;
}

/* Dark mode text */
.dark .serial-text {
  color: #f4f4f4;
}

/* Icono verde (agregar) */
.serial-icon-add {
  color: #077e38;
}

.serial-icon-add svg path {
  fill: #077e38;
}

/* Icono rojo (quitar) */
.serial-icon-remove {
  color: #a40f16;
}

.serial-icon-remove svg path {
  fill: #a40f16;
}

/* Sección de seriales */
.seriales-section {
  width: 100%;
  flex: 1 1 0; /* ✅ CRÍTICO: Distribuir espacio equitativamente entre secciones */
  min-height: 0; /* Permitir que flex funcione correctamente */
  overflow: visible; /* ✅ CAMBIADO: Permitir que iconos absolutos sean visibles */
  display: flex;
  flex-direction: column;
}

.seriales-section-title {
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: 0.16px;
  color: #0b0b0b;
  padding: 15px 0 5px 0; /* Más espacio arriba (15px) y menos abajo (5px) */
}

/* Lista canónica reutilizada como componente independiente en el Page Builder. */
.pbl-serial-list-component {
  flex: 0 1 auto;
}

.pbl-serial-list-component [hidden] {
  display: none !important;
}

.pbl-serial-list-component button.serial-icon {
  appearance: none;
  padding: 0;
  border: 0;
  margin: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 0;
}

.pbl-serial-list-component button.serial-icon:focus-visible {
  outline: 2px solid var(--green-primary, #077e38);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Campo de serial con icono de agregar */
.serial-input-container {
  padding: 0;
  width: 100%;
}

/* ========================================
   ICONO DENTRO DEL CAMPO DE SERIAL
   Icono + verde posicionado a la derecha
   ======================================== */

.form-field-icon-inside {
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 25px;
  height: 25px;
  pointer-events: auto;
  cursor: pointer;
  z-index: 2;
}

.form-field-icon-inside svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* Input con icono interno - reducir padding derecho */
.serial-input-with-icon {
  padding-right: 5px !important;
  text-transform: uppercase;
}

.serial-input-with-icon:focus {
  padding-right: 4px !important;
}

/* ========================================
   ICONO DENTRO DEL CAMPO DE SERIAL
   Icono + verde posicionado a la derecha
   ======================================== */

.serial-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: opacity 0.2s;
}

.serial-icon:hover {
  opacity: 0.8;
}

.serial-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

/* ========================================
   BOTÓN DE MINIMIZAR (Toggle Form)
   Para colapsar/expandir bloques en mobile
   ======================================== */

.toggle-form-btn,
.toggle-block-btn {
  display: none; /* Oculto por defecto en desktop */
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 4px;
  background-color: #ffffff;
  border: 1px solid #595d62;
  border-radius: 2px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 0.2s, border-color 0.2s;
}

.toggle-form-btn:hover,
.toggle-block-btn:hover {
  background-color: #f4f4f4;
  border-color: #0b0b0b;
}

.toggle-form-btn:active,
.toggle-block-btn:active {
  background-color: #e3e6e8;
}

.toggle-form-btn svg,
.toggle-block-btn svg {
  width: 16px;
  height: 16px;
  transition: transform 0.3s ease; /* ✅ Animación suave de rotación */
}

/* Efecto de rotación cuando está minimizado */
.toggle-form-btn.rotating svg,
.toggle-block-btn.rotating svg,
.card.minimized .toggle-block-btn svg {
  transform: rotate(180deg);
}

.toggle-form-btn svg path,
.toggle-block-btn svg path {
  fill: currentColor; /* ✅ Hereda color del botón para dark mode */
}

/* ✅ Color del botón (usado por currentColor) */
.toggle-form-btn,
.toggle-block-btn {
  color: #000000; /* Light mode */
}

/* Dark mode */
.dark .toggle-form-btn,
.dark .toggle-block-btn {
  color: #ffffff;
  background-color: #1a1a1a;
  border-color: #3a3a3a;
}

.dark .toggle-form-btn:hover,
.dark .toggle-block-btn:hover {
  background-color: #2a2a2a;
  border-color: #4a4a4a;
}

/* Mostrar SOLO en mobile */
@media (max-width: 899px) {
  /* ✅ v297.5: Cambiado de 767px a 899px para coincidir con breakpoint de minimizado */
  .toggle-form-btn,
  .toggle-block-btn {
    display: flex;
  }
}

/* ========================================
   BOTONES FLOTANTES
   Botonera fija en bottom-right (desktop) or bottom-center (mobile)
   Sistema de overflow con menú de elipsis para mobile
   ✅ CANON v297.6: 5px del borde (no más espacio innecesario)
   ======================================== */

.floating-buttons {
  position: fixed;
  bottom: 5px; /* ✅ CANON v297.6: 5px del borde inferior */
  right: 5px; /* ✅ CANON v297.6: 5px del borde derecho */
  z-index: 1000;
}

.floating-buttons-container {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #69757c;
  border-radius: 2px;
  box-shadow: 0 14px 36px rgba(17, 24, 39, 0.24), 0 6px 18px rgba(17, 24, 39, 0.16);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
}

.floating-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: var(--omega-floating-button-height);
  min-height: var(--omega-floating-button-height);
  padding: 0 12px;
  box-sizing: border-box;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  font-family:
    "IBM Plex Sans",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  letter-spacing: 0.16px;
  white-space: nowrap;
  transition: opacity 0.2s, background-color 0.2s;
}

.floating-btn:hover {
  opacity: 0.85;
}

.floating-btn:active {
  opacity: 0.7;
}

/* Estado colapsado - solo íconos */
.floating-buttons.collapsed .floating-btn {
  height: var(--omega-floating-button-collapsed-height);
  min-height: var(--omega-floating-button-collapsed-height);
  padding: 4px;
}

.floating-buttons.collapsed .floating-btn-text {
  display: none;
}

.floating-buttons.collapsed .floating-btn svg {
  width: 24px;
  height: 24px;
}

/* Estado expandido - con texto */
.floating-buttons:not(.collapsed) .floating-btn svg {
  width: 16px;
  height: 16px;
}

/* Botón verde */
.floating-btn-green {
  background-color: #077e38;
  color: #ffffff;
}

.floating-btn-green svg path {
  fill: #ffffff;
}

/* Botón negro */
.floating-btn-black {
  background-color: #000000;
  color: #ffffff;
}

.floating-btn-black svg path {
  fill: #ffffff;
}

/* Botón outline negro */
.floating-btn-outline-black {
  background-color: transparent;
  color: #000000;
  border: 1px solid #000000;
}

.floating-btn-outline-black svg path {
  fill: #000000;
}

/* Botón outline rojo */
.floating-btn-outline-red {
  background-color: transparent;
  color: #a40f16;
  border: 1px solid #a40f16;
}

.floating-btn-outline-red svg path {
  fill: #a40f16;
}

/* Botón rojo */
.floating-btn-red {
  background-color: #a40f16;
  color: #ffffff;
}

.floating-btn-red svg path {
  fill: #ffffff;
}

/* Botón toggle (flecha) */
.floating-toggle-btn {
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
  height: 24px;
  background-color: #ffffff;
  border: 1px solid #595d62;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.16), 0px 0px 1px 0px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s;
  padding: 0;
}

.floating-toggle-btn:hover {
  background-color: #f4f4f4;
}

/* Icono de flecha rota cuando está colapsado */
.floating-buttons.collapsed .floating-toggle-btn {
  transform: translateY(-50%) rotate(180deg);
}

/* ========================================
   SISTEMA DE OVERFLOW - BOTÓN DE ELIPSIS
   ======================================== */

/* Botón de overflow (tres puntos) - Oculto por defecto */
.floating-btn-overflow {
  position: relative;
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #595d62 !important;
  outline: 1px solid #595d62 !important;
  outline-offset: 0;
  width: var(--omega-floating-button-collapsed-height);
  height: var(--omega-floating-button-collapsed-height);
  min-width: var(--omega-floating-button-collapsed-height);
  min-height: var(--omega-floating-button-collapsed-height);
  padding: 4px;
  display: none; /* Oculto por defecto, se muestra con JS */
  box-sizing: border-box;
}

.floating-btn-overflow:hover {
  background-color: #f4f4f4;
  border-color: #595d62 !important;
  outline-color: #595d62 !important;
}

.floating-btn-overflow svg {
  width: 24px !important;
  height: 24px !important;
}

/* Menú desplegable de overflow */
.floating-overflow-menu {
  position: fixed; /* ✅ FIJO respecto al viewport, no al contenedor */
  bottom: auto; /* Se calculará con JS */
  left: 50%; /* ✅ Centro horizontal del viewport */
  transform: translateX(-50%); /* ✅ Centrado perfecto */
  background-color: #ffffff;
  border: 1px solid #69757c;
  border-radius: 2px;
  box-shadow: 0 14px 36px rgba(17, 24, 39, 0.24), 0 6px 18px rgba(17, 24, 39, 0.16);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  display: none; /* Oculto por defecto */
  flex-direction: column;
  gap: 0;
  padding: 4px;
  min-width: auto; /* ✅ Ancho automático según contenido */
  width: max-content; /* ✅ Ancho del texto más largo */
  max-width: calc(100vw - 40px); /* ✅ No exceder viewport */
  z-index: 10000; /* ✅ Por encima de todo */
}

/* Mostrar menú cuando está activo */
.floating-overflow-menu.active {
  display: flex;
}

/* Botones dentro del menú de overflow */
.floating-overflow-menu .floating-btn {
  width: 100%;
  justify-content: flex-start; /* ✅ Alineado a la izquierda */
  padding: 10px 12px;
  border-radius: 2px;
  gap: 8px;
  text-align: left; /* ✅ Texto alineado a la izquierda */
  white-space: nowrap; /* ✅ No romper el texto */
}

.floating-overflow-menu .floating-btn:hover {
  background-color: #f4f4f4;
  opacity: 1;
}

/* Mostrar texto en botones del menú */
.floating-overflow-menu .floating-btn .floating-btn-text {
  display: inline !important;
  text-align: left; /* ✅ Texto alineado a la izquierda */
  flex: 1; /* ✅ Tomar el espacio restante */
}

/* Iconos en botones del menú */
.floating-overflow-menu .floating-btn svg {
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
  margin-right: 0; /* ✅ Sin margen, el gap lo maneja */
}

/* Botones ocultos por overflow - se mueven al menú */
.floating-btn.overflow-hidden {
  display: none !important;
}

/* Responsive: Mobile */
@media (max-width: 768px) {
  .floating-buttons {
    bottom: 5px; /* ✅ CANON v297.6: 5px del borde inferior */
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    z-index: 9999;
    width: fit-content;
    max-width: calc(100vw - 10px); /* ✅ CANON v297.6: Margen 5px × 2 = 10px */
  }

  .floating-buttons-container {
    width: auto;
    max-width: calc(100vw - 10px);
    padding: 8px 10px;
    gap: 10px;
    justify-content: center;
  }

  .floating-buttons.floating,
  .floating-buttons.anchored {
    width: fit-content;
    max-width: calc(100vw - 10px);
  }

  /* Solo estado colapsado en mobile - Botones más grandes */
  .floating-buttons .floating-btn {
    height: var(--omega-floating-button-collapsed-height);
    min-height: var(--omega-floating-button-collapsed-height);
    padding: 4px;
    min-width: var(--omega-floating-button-collapsed-height);
    justify-content: center;
  }

  .floating-buttons .floating-btn-text {
    display: none !important;
  }

  .floating-buttons .floating-btn svg {
    width: 24px !important;
    height: 24px !important;
  }

  /* Ocultar botón toggle en mobile */
  .floating-toggle-btn {
    display: none !important;
  }
  
  /* Botón de overflow en mobile: visible solo cuando JS lo habilita */
  .floating-btn-overflow {
    display: none;
  }
  
  /* Menú de overflow en mobile - centrado respecto al viewport */
  .floating-overflow-menu {
    /* Ya está centrado globalmente con position: fixed */
    /* No necesita override adicional */
  }

}

/* ========================================
   BOTONES FLOTANTES INTELIGENTES v297.6
   ✅ NUEVO CANON: Animación basada en visibilidad 50/51%
   - Flota cuando <50% de la botonera es visible
   - Ancla cuando ≥51% de la botonera es visible
   - Animación simple y ligera (solo sombra)
   - 10px de margen derecho (respiro visual)
   ======================================== */

/* Modo FLOTANTE: Botones fijos con sombra pronunciada */
.floating-buttons.floating {
  position: fixed;
  bottom: 5px; /* ✅ CANON v297.6: 5px del borde inferior */
  right: 10px; /* ✅ 10px de respiro del borde derecho */
  z-index: 1000;
}

/* Contenedor en modo flotante: Solo sombra pronunciada (SIN escala) */
.floating-buttons.floating .floating-buttons-container {
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28), 0 8px 22px rgba(15, 23, 42, 0.2) !important;
  transition: box-shadow 0.25s ease-in-out; /* ✅ Solo transición de sombra */
}

/* Modo ANCLADO: Botones como contenido normal */
.floating-buttons.anchored {
  position: static;
  display: flex;
  justify-content: flex-end;
  margin: 5px 10px 5px 0; /* ✅ 5px arriba/abajo, 10px derecha (respiro) */
  width: 100%;
}

/* Contenedor en modo anclado: Sombra más sutil */
.floating-buttons.anchored .floating-buttons-container {
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28), 0 8px 22px rgba(15, 23, 42, 0.2) !important;
  transition: box-shadow 0.25s ease-in-out;
}

/* En modo anclado, NO centrar el contenedor (mantener alineado a la derecha) */
.floating-buttons.anchored .floating-buttons-container {
  margin: 0; /* ✅ Sin auto (no centrar) */
}

/* ANCLAJE CONTINUO (botonera estándar y barra adaptable en automático): la botonera va pegada abajo mientras queda contenido y
   se acomoda sola en su lugar al llegar al final de la página. Lo resuelve el navegador (position: sticky): no hay cambio de modo,
   ni espaciador, ni cálculo durante el scroll, así que no hay saltos ni «vibración». floating-buttons-smart.js activa este modo
   con data-float-dock="sticky" y conserva la heurística anterior solo como respaldo. */
html .floating-buttons[data-float-dock="sticky"] {
  position: sticky;
  bottom: var(--omega-floating-bottom, 5px);
  left: auto;
  right: auto;
  transform: none;
  display: block;
  width: fit-content;
  max-width: calc(100% - 20px);
  margin: 5px 10px var(--omega-floating-bottom, 5px) auto; /* mismo valor que bottom: la botonera se acomoda sin saltar */
  z-index: 1000;
}

html .floating-buttons[data-float-dock="sticky"] .floating-buttons-container {
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.28), 0 8px 22px rgba(15, 23, 42, 0.2) !important;
}

@media (max-width: 768px) {
  html .floating-buttons[data-float-dock="sticky"] {
    margin: 5px auto var(--omega-floating-bottom, 5px);
    max-width: calc(100vw - 10px);
    z-index: 9999;
  }
}

/* ========================================
   KEYFRAMES: Animaciones visuales para flotar/anclar
   ======================================== */

/* Animación FLOTAR: Slide up + bounce (efecto "pop") */
@keyframes floatUp {
  0% {
    transform: translateY(20px);
    opacity: 0.7;
  }
  60% {
    transform: translateY(-5px); /* Pequeño rebote hacia arriba */
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Animación ANCLAR: Settle down suave */
@keyframes anchorDown {
  0% {
    opacity: 0.8;
  }
  100% {
    opacity: 1;
  }
}

/* Mobile: Modo anclado también alineado a la derecha */
@media (max-width: 768px) {
  .floating-buttons.anchored {
    transform: none; /* Remover translateX del modo flotante */
    left: auto;
    right: auto;
    margin: 5px auto; /* ✅ CANON v297.6: centrado en mobile */
    justify-content: center; /* ✅ Mantener centrado en mobile */
  }
}

/* ========================================
   AJUSTES ESPECÍFICOS DE CAMPOS
   Reducir max-width de campos solicitados
   ======================================== */

/* Responsive: Mobile */
@media (max-width: 768px) {
  /* Ajustes específicos para campos en mobile si son necesarios */
}

/* ========================================
   BOTÓN DE ELIMINAR FILA (X) - Tablas
   Botón rectangular rojo 33x18px (mismo tamaño que botón +)
   ======================================== */

.btn-delete-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  width: var(--table-action-button-size, 21px) !important;
  height: var(--table-action-button-size, 21px) !important;
  padding: 0;
  background: var(--table-action-delete-bg);
  color: var(--table-action-delete-fg);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 90ms ease, box-shadow 90ms ease;
  flex-shrink: 0;
  vertical-align: middle; /* ✅ Centrado vertical */
  margin: 0; /* ✅ Sin margen que pueda desalinear */
}

.btn-delete-row:hover {
  background: var(--table-action-delete-hover-bg);
  color: var(--table-action-delete-hover-fg);
}

.btn-delete-row:active {
  background: var(--table-action-delete-active-bg);
  color: var(--table-action-delete-active-fg);
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.btn-delete-row:focus {
  outline: none; /* ✅ CORREGIDO: Eliminar borde verde innecesario */
}

.btn-delete-row svg {
  display: block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  overflow: visible;
  transform: none;
}

.btn-delete-row svg path {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: var(--table-action-icon-stroke-width, 0.6);
}

/* ========================================
   BOTÓN DE AGREGAR A DETALLE (+) - Tablas
   Botón rectangular verde 33x18px (mismo tamaño que botón X)
   ======================================== */

.btn-add-to-detail {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  width: var(--table-action-button-size, 21px) !important;
  height: var(--table-action-button-size, 21px) !important;
  padding: 0;
  background: var(--table-action-check-bg);
  color: var(--table-action-check-fg);
  border: none;
  border-radius: 2px;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, transform 90ms ease, box-shadow 90ms ease;
  flex-shrink: 0;
  vertical-align: middle; /*  Centrado vertical */
  margin: 0; /* ✅ Sin margen que pueda desalinear */
}

.btn-add-to-detail:hover {
  background: var(--table-action-check-hover-bg);
  color: var(--table-action-check-hover-fg);
}

.btn-add-to-detail:active {
  background: var(--table-action-check-active-bg);
  color: var(--table-action-check-active-fg);
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.btn-add-to-detail:focus {
  outline: none; /* Sin outline - ya tenemos highlights en las filas */
}

.btn-add-to-detail svg {
  display: block;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  overflow: visible;
  transform: none;
}

.btn-add-to-detail svg path {
  fill: currentColor;
  stroke: currentColor;
  stroke-width: var(--table-action-icon-stroke-width, 0.6);
}

/* ========================================
   BOTONES DE ACCIÓN EN TABLA DETALLE
   Botones canónicos de lápiz y check
   ======================================== */

.table-action-btn-check,
.table-action-btn-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--table-action-button-size, 21px) !important;
  height: var(--table-action-button-size, 21px) !important;
  border: none;
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
  margin: 0 auto;
  transition: background-color 140ms ease, color 140ms ease, transform 90ms ease, box-shadow 90ms ease, opacity 0.2s ease;
}

.table-action-btn-check {
  background: var(--table-action-check-bg) !important;
  color: var(--table-action-check-fg) !important;
}

.table-action-btn-edit {
  background: var(--table-action-edit-bg) !important;
  color: var(--table-action-edit-fg) !important;
}

.table-action-btn-check:hover {
  background: var(--table-action-check-hover-bg) !important;
  color: var(--table-action-check-hover-fg) !important;
}

.table-action-btn-edit:hover {
  background: var(--table-action-edit-hover-bg) !important;
  color: var(--table-action-edit-hover-fg) !important;
}

.table-action-btn-check:active {
  background: var(--table-action-check-active-bg) !important;
  color: var(--table-action-check-active-fg) !important;
}

.table-action-btn-edit:active {
  background: var(--table-action-edit-active-bg) !important;
  color: var(--table-action-edit-active-fg) !important;
}

.table-action-btn-check:active,
.table-action-btn-edit:active {
  transform: translateY(1px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.14);
}

.table-action-btn-check svg,
.table-action-btn-edit svg {
  display: block;
  width: 16px !important;
  height: 16px !important;
  overflow: visible;
}

.table-action-btn-check svg path {
  fill: currentColor !important;
  stroke: currentColor !important;
  stroke-width: var(--table-action-icon-stroke-width, 0.6) !important;
}

.table-action-btn-edit svg path {
  fill: currentColor !important;
  stroke: none !important;
}

.table-action-btn-check,
.table-action-btn-edit {
  list-style: none !important;
  list-style-type: none !important;
}

.tabla-maestro tbody tr td:has(> .btn-delete-row),
.tabla-maestro tbody tr td:has(> .btn-add-to-detail),
.tabla-maestro tbody tr td:has(> .table-action-btn-check),
.tabla-maestro tbody tr td:has(> .table-action-btn-edit),
.tabla-maestro tbody tr td:has(> .consultar-edit-btn) {
  width: var(--table-action-cell-size, 28px);
  min-width: var(--table-action-cell-size, 28px);
  max-width: var(--table-action-cell-size, 28px);
  padding: 3px !important;
  text-align: center !important;
  vertical-align: middle !important;
}

.btn-icon-right {
  right: 16px;
}

/* ========================================
   NORMALIZACION GLOBAL DE CAMPOS (CANON)
   Fuerza consistencia cross-modulo sin tocar HTML por pagina.
   ======================================== */

.form-field-input,
.form-field-select,
.form-field-date,
.form-textarea,
.mensaje-field .form-textarea {
  font-size: 13px !important;
  line-height: 16px !important;
}

.form-field-input {
  padding: 4px 8px 3px 8px !important;
}

.form-field-select,
.form-field-date {
  padding: 4px 16px 3px 8px !important;
}

.form-field-input:focus {
  padding: 4px 8px 3px 8px !important;
}

.form-field-select:focus,
.form-field-date:focus {
  padding: 4px 16px 3px 8px !important;
}

.form-textarea,
.mensaje-field .form-textarea {
  padding: 5px 5px 3px 8px !important;
}

.form-textarea:focus,
.mensaje-field .form-textarea:focus {
  padding: 4px 4px 2px 7px !important;
}

.form-field-label,
.form-textarea-label {
  top: var(--omega-field-label-top, 12px) !important;
  left: 7px !important;
}

/* Hover global de campos: borde negro con fade in/out */
.form-field-input,
.form-field-select,
.form-field-date,
.form-textarea,
.mensaje-field .form-textarea {
  transition:
    border-color 180ms ease-in-out,
    outline-color 180ms ease-in-out,
    box-shadow 180ms ease-in-out;
}

.form-field-input:hover:not(:focus):not(:disabled),
.form-field-select:hover:not(:focus):not(:disabled),
.form-field-date:hover:not(:focus):not(:disabled),
.form-textarea:hover:not(:focus):not(:disabled),
.mensaje-field .form-textarea:hover:not(:focus):not(:disabled) {
  border-color: #000000 !important;
}

/* No hover negro en estados bloqueados o con error */
.form-field.is-disabled .form-field-input:hover,
.form-field.is-disabled .form-field-select:hover,
.form-field.is-disabled .form-field-date:hover,
.form-field.is-disabled .form-textarea:hover,
.notas-field.is-disabled .form-textarea:hover,
.form-field.has-error .form-field-input:hover,
.form-field.has-error .form-field-select:hover,
.form-field.has-error .form-field-date:hover,
.form-field.has-error .form-textarea:hover {
  border-color: inherit !important;
}

/* Refuerzo global: ano visual en 2 digitos en todos los date WebKit/Blink */
input[type="date"]::-webkit-datetime-edit-year-field,
input.form-field-date::-webkit-datetime-edit-year-field {
  width: 2ch !important;
  min-width: 2ch !important;
  max-width: 2ch !important;
  padding: 0 !important;
  overflow: hidden !important;
  text-align: right !important;
}

/* Shared switch used by global controls and page-level settings. */
.canonical-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: var(--text-secondary);
  font: 400 12px/16px "IBM Plex Sans", sans-serif;
  cursor: pointer;
  user-select: none;
}
.canonical-toggle input {
  position: absolute;
  width: 1px !important;
  height: 1px !important;
  min-width: 1px !important;
  min-height: 1px !important;
  opacity: 0;
  pointer-events: none;
}
.canonical-toggle-track {
  position: relative;
  width: 36px;
  height: 18px;
  flex: 0 0 36px;
  border: 2px solid var(--border-secondary);
  border-radius: 2px;
  background: var(--bg-secondary);
  box-sizing: border-box;
  transition: background-color 160ms ease, border-color 160ms ease;
}
.canonical-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  border-radius: 1px;
  background: var(--text-secondary);
  transition: transform 160ms ease, background-color 160ms ease;
}
.canonical-toggle:hover .canonical-toggle-track {
  border-color: var(--text-secondary);
}
.canonical-toggle input:checked + .canonical-toggle-track {
  border-color: var(--green-status);
  background: var(--green-status);
}
.canonical-toggle input:checked + .canonical-toggle-track .canonical-toggle-thumb {
  background: var(--success-foreground);
  transform: translateX(18px);
}
.canonical-toggle input:focus-visible + .canonical-toggle-track {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}
.canonical-toggle:has(input:disabled) {
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: .64;
}

/* ==================== FORMULARIOS DE REGISTRO (propuestos) ====================
   Patrones aprobados por Jeremy como estándar visual de Ventas > Cliente.
   Estado en el registro: propuesto hasta que una página real los use.
   Enlace de datos opcionales, lista de opciones, barra de estado del registro
   y fila de documento. Fuente: propuestas-ui/ (ronda 2 y 3). */

.disclosure-link { min-width: 0; }
.disclosure-link > summary {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  list-style: none;
  cursor: pointer;
  color: #0f62fe;
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
  white-space: nowrap;
}
.disclosure-link > summary::-webkit-details-marker { display: none; }
.disclosure-link > summary::before {
  content: "";
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px);
  transition: transform .15s ease;
}
.disclosure-link[open] > summary::before { transform: rotate(225deg) translate(-1px, -1px); }
.disclosure-link > summary:focus-visible { outline: 2px solid #0f62fe; outline-offset: 2px; }
.disclosure-link__hint { color: var(--text-secondary, #595d62); font-weight: 400; }
.disclosure-link__panel { padding-top: 8px; color: var(--text-primary, #161616); font-size: 13px; line-height: 18px; }

.option-list { display: flex; flex-direction: column; min-width: 0; }
.option-list__title {
  margin: 0 0 4px;
  color: var(--text-secondary, #595d62);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  line-height: 14px;
  text-transform: uppercase;
}
.option-list__item { padding: 7px 2px; border-bottom: 1px solid var(--omega-neutral-5, #eceef0); }
.option-list__item:last-child { border-bottom: 0; }

.record-status-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 20px;
  min-width: 0;
  padding: 7px 12px;
  border: 1px solid #c6cbce;
  border-radius: var(--card-radius, 2px);
  background: var(--bg-secondary, #fff);
  color: var(--text-secondary, #595d62);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 13px;
  line-height: 18px;
}
.record-status-bar__items { display: flex; flex-wrap: wrap; gap: 4px 20px; margin: 0; padding: 0; }
.record-status-bar__item { display: inline-flex; gap: 6px; margin: 0; }
.record-status-bar__item dt { margin: 0; font-weight: 400; }
.record-status-bar__item dd { margin: 0; color: var(--text-primary, #161616); font-weight: 600; }
.record-status-bar__options { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-left: auto; }

.document-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px dashed var(--card-border, #919ba1);
  border-radius: var(--card-radius, 2px);
  background: var(--card-background, #fcfcfc);
}
.document-row__file { display: flex; flex: 1 1 140px; align-items: center; gap: 10px; min-width: 0; }
.document-row__icon { display: inline-flex; flex: 0 0 24px; width: 24px; height: 24px; color: var(--text-secondary, #595d62); }
.document-row__icon svg { width: 100%; height: 100%; fill: currentColor; }
.document-row__text { display: flex; flex-direction: column; min-width: 0; font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
.document-row__name { overflow: hidden; color: var(--text-primary, #161616); font-size: 13px; font-weight: 600; line-height: 18px; text-overflow: ellipsis; white-space: nowrap; }
.document-row__help { color: var(--text-secondary, #595d62); font-size: 12px; line-height: 16px; }
.document-row__input { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); }
.document-row__input:focus-visible + .btn { outline: 2px solid #0f62fe; outline-offset: 2px; }
@media (max-width: 500px) {
  .document-row { flex-direction: column; align-items: stretch; }
  .record-status-bar__options { margin-left: 0; }
}

html.dark .record-status-bar { border-color: #4a4a4a; background: #262626; color: #c6c6c6; }
html.dark .record-status-bar__item dd { color: #f4f4f4; }
html.dark .document-row { border-color: #6f6f6f; background: #262626; }
html.dark .document-row__name { color: #f4f4f4; }
html.dark .option-list__item { border-bottom-color: #3d3d3d; }
html.dark .disclosure-link > summary { color: #78a9ff; }
html.dark .disclosure-link__panel { color: #f4f4f4; }

/* ==================== TARJETA DE REGISTRO Y CASILLA DE AGREGAR (propuestos) ====================
   Diseñados a partir de Ventas > Cliente > Dirección (maqueta y diseño de Figma).
   Cada tarjeta ocupa una celda de la cuadrícula; la casilla de agregar va después de la última. */

.record-card {
  min-width: 0;
  border: 1px solid #c6cbce;
  border-radius: var(--card-radius, 2px);
  background: var(--bg-secondary, #fff);
  color: var(--text-primary, #161616);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
.record-card__header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  min-height: 40px;
  border-bottom: 1px solid #c6cbce;
  background: #eceef0;
}
.record-card__icon { display: inline-flex; flex: 0 0 16px; width: 16px; height: 16px; color: var(--red-status, #a40f16); }
.record-card__icon svg { width: 100%; height: 100%; fill: currentColor; }
.record-card__title { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 600; line-height: 18px; }
.record-card__actions { display: inline-flex; align-items: center; gap: 2px; margin-left: auto; }
.record-card__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 2px;
  background: none;
  color: inherit;
  cursor: pointer;
}
.record-card__btn:hover { background: rgba(22, 22, 22, .08); }
.record-card__btn:focus-visible { outline: 2px solid #0f62fe; outline-offset: 1px; }
.record-card__btn svg { width: 16px; height: 16px; fill: currentColor; }
.record-card__btn--star[aria-pressed="true"] { color: var(--green-status, #077e38); }
.record-card__btn--delete { color: var(--red-status, #a40f16); }
.record-card__body { display: flex; flex-direction: column; padding: 12px; color: var(--text-secondary, #595d62); font-size: 13px; line-height: 20px; }
.record-card__body p { margin: 0; overflow-wrap: anywhere; }

.add-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-sizing: border-box;
  width: 100%;
  min-height: var(--add-tile-min-height, 170px);
  height: 100%;
  border: 2px dashed #8d8d8d;
  border-radius: var(--card-radius, 2px);
  background: transparent;
  color: var(--text-primary, #161616);
  font-family: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.add-tile:hover { border-color: #161616; background: rgba(22, 22, 22, .04); }
.add-tile:focus-visible { outline: 2px solid #0f62fe; outline-offset: 2px; }
.add-tile__icon { display: inline-flex; width: 18px; height: 18px; }
.add-tile__icon svg { width: 100%; height: 100%; fill: currentColor; }

html.dark .record-card { border-color: #4a4a4a; background: #262626; color: #f4f4f4; }
html.dark .record-card__header { border-bottom-color: #4a4a4a; background: #303030; }
html.dark .record-card__body { color: #c6c6c6; }
html.dark .record-card__btn:hover { background: rgba(255, 255, 255, .12); }
html.dark .add-tile { border-color: #6f6f6f; color: #f4f4f4; }
html.dark .add-tile:hover { border-color: var(--dark-outline-hover, #9a9a9a); background: rgba(255, 255, 255, .06); }

/* #267 · Modo oscuro de la tarjeta de registro (apariencias sección, fila y predeterminada), el encabezado de ficha y el menú de direcciones */
html.dark .record-card--section, html.dark .record-card--default { border-color: #8d8d8d; background: transparent; }
html.dark .record-card--section .record-card__title,
html.dark .record-card--section .record-card__body,
html.dark .record-card--section .record-card__body p,
html.dark .record-card--section .record-card__btn,
html.dark .record-card--default .record-card__title,
html.dark .record-card--default .record-card__body,
html.dark .record-card__name,
html.dark .record-card--row .record-card__eyebrow,
html.dark .record-card--row .record-card__title { color: #f4f4f4; }
html.dark .record-card--section .record-card__btn--delete { color: #ff8389; }
html.dark .record-card--row { border-bottom-color: #6f6f6f; }
html.dark .record-card--row .record-card__body,
html.dark .record-card__subtitle { color: #c6c6c6; }
html.dark .record-card__footer { border-top-color: #6f6f6f; }
html.dark .record-card__footer-link { color: #78a9ff; }
html.dark .record-card--default-receipt .record-card__tile { background: rgba(120, 169, 255, .18); color: #78a9ff; }
html.dark .record-card--default-delivery .record-card__tile { background: rgba(66, 190, 101, .18); color: #42be65; }
html.dark .pbl-address-menu { background: #262626; border-color: #6f6f6f; box-shadow: 0 4px 12px rgba(0, 0, 0, .5); }
html.dark .pbl-address-menu button { color: #f4f4f4; }
html.dark .pbl-address-menu button:hover { background: #393939; }
html.dark .pbl-page-header__title h1,
html.dark .pbl-page-header__saved { color: #f4f4f4; }
html.dark .pbl-page-header__saved.is-saving .pbl-page-header__saved-icon { color: #c6c6c6; }

/* ==================== PESTAÑAS EN PANTALLAS ANGOSTAS ====================
   En las páginas generadas por el Page Builder (.block-tabs[data-pbl-tabs]) las pestañas conservan
   una sola fila que se desplaza horizontalmente, en lugar de apilarse en 2 columnas. La línea inferior se dibuja como fondo para que la pestaña activa,
   que no tiene línea debajo, siga viéndose unida al contenido aunque haya desplazamiento. */
@media (max-width: 1399px) {
  .block-tabs[data-pbl-tabs] {
    display: flex;
    flex-wrap: nowrap;
    gap: 5px;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border-bottom: 0;
    background: linear-gradient(#595d62, #595d62) left bottom / 100% 1px no-repeat;
    scrollbar-width: thin;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }
  .block-tabs[data-pbl-tabs] > .block-tab {
    flex: 0 0 auto;
    min-width: 0;
    white-space: nowrap;
    scroll-snap-align: start;
  }
  .block-tabs[data-pbl-tabs] > .block-tabs-extra {
    flex: 0 0 auto;
    width: auto;
    margin: 0 0 4px 8px;
  }
}
@media (max-width: 639px) {
  .block-tabs[data-pbl-tabs] > .block-tab {
    height: 40px;
    padding: 8px 14px;
    font-size: 14px;
  }
}

/* #238 · Tarjeta de registro: apariencias «Sección compacta» y «Fila» (pantallas aprobadas de Ventas > Cliente) */
.record-card--section { border: 1px dotted #595d62; background: transparent; }
.record-card--section .record-card__header { min-height: 40px; padding: 10px 12px 0 16px; border-bottom: 0; background: transparent; }
.record-card--section .record-card__title { color: #0b0b0b; font-size: 16px; line-height: 22px; }
.record-card--section .record-card__body { padding: 2px 16px 14px; font-size: 14px; }
.record-card--row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border: 0; border-bottom: 1px dotted #8d8d8d; border-radius: 0; background: transparent; }
.record-card--row .record-card__text { display: flex; flex: 1 1 auto; flex-direction: column; min-width: 0; }
.record-card--row .record-card__eyebrow { margin: 0; color: var(--text-secondary, #595d62); font-size: 14px; font-weight: 600; line-height: 20px; }
.record-card--row .record-card__title { color: var(--text-primary, #161616); font-size: 16px; line-height: 22px; }
.record-card--row .record-card__body { padding: 0; font-size: 13px; line-height: 18px; }
.record-card--row .record-card__actions { gap: 6px; margin-left: 0; }
html.dark .record-card--section { border-color: #8d8d8d; }
html.dark .record-card--section .record-card__title { color: #f4f4f4; }
html.dark .record-card--row { border-bottom-color: #6f6f6f; }

/* #238 · La fila de documento envuelve el botón debajo en lugar de partir su texto en secciones angostas */
.document-row > .btn { flex: 0 0 auto; white-space: nowrap; }

/* Vista exportada del Builder: la imagen genérica es un marcador pequeño,
   y el texto enriquecido se muestra como contenido, sin herramientas de edición. */
.pbl-export-form-cell [data-pbl-single-image][data-has-image="false"] {
  display: grid;
  width: 96px;
  height: 82px;
  margin-inline: auto;
  place-items: center;
  cursor: default;
}
.pbl-export-form-cell [data-pbl-single-image][data-has-image="false"]::after { display: none; }
.pbl-export-form-cell [data-pbl-single-image][data-has-image="false"] .product-detail-image { object-fit: contain; cursor: default; }
.pbl-rich-preview { position: relative; min-width: 0; padding-block: 4px; color: var(--text-primary,#161616); }
.pbl-rich-preview--fill { display:flex; flex:1 1 auto; flex-direction:column; box-sizing:border-box; height:auto; min-height:260px; margin-top:14px; padding-bottom:30px; }
.pbl-rich-preview--fill > .pbl-rich-preview-content { flex:1 1 auto; min-height:0; overflow:auto; }
.pbl-rich-preview--fill > .pbl-rich-counter { position:absolute; left:10px; bottom:8px; margin:0; }
.pbl-rich-preview-content { min-width: 0; overflow-wrap: anywhere; }
.pbl-rich-preview-content > :first-child { margin-top: 0; }
.pbl-rich-preview-content > :last-child { margin-bottom: 0; }
.pbl-rich-preview .pbl-rich-counter { display: block; margin-top: 4px; color: var(--text-secondary,#656b72); font-size: 11px; text-align: right; }
.pbl-table-mock-quantity { font-variant-numeric: tabular-nums; }
html.dark .pbl-rich-preview,.dark .pbl-rich-preview { color: var(--text-primary,#f4f4f4); }
html.dark .pbl-export-form-grid .pbl-export-form-cell :is(input:not([type="checkbox"]),select,textarea),
.dark .pbl-export-form-grid .pbl-export-form-cell :is(input:not([type="checkbox"]),select,textarea) { border-color:var(--pbl-dark-strong-border,#6f6f6f)!important; color-scheme:dark; }
html.dark .pbl-export-form-grid .pbl-export-form-cell :is(input[type="date"],input[type="time"],input[type="datetime-local"])::-webkit-calendar-picker-indicator,
.dark .pbl-export-form-grid .pbl-export-form-cell :is(input[type="date"],input[type="time"],input[type="datetime-local"])::-webkit-calendar-picker-indicator { filter:invert(1); opacity:.9; }
html.dark .pbl-export-form-grid .pbl-export-form-cell textarea::-webkit-resizer,
.dark .pbl-export-form-grid .pbl-export-form-cell textarea::-webkit-resizer { filter:invert(1); }
html.dark .pbl-export-form-grid .pbl-export-form-cell .pbl-proposed-file-drop-target,
.dark .pbl-export-form-grid .pbl-export-form-cell .pbl-proposed-file-drop-target { border-color:var(--pbl-dark-strong-border,#6f6f6f); }
html.dark .pbl-export-form-grid .pbl-export-form-cell .pbl-proposed-file-drop-target>small,
html.dark .pbl-export-form-grid .pbl-export-form-cell .pbl-proposed-file-drop-status,
.dark .pbl-export-form-grid .pbl-export-form-cell .pbl-proposed-file-drop-target>small,
.dark .pbl-export-form-grid .pbl-export-form-cell .pbl-proposed-file-drop-status { color:#c6c6c6; }
html.dark .pbl-export-form-grid .pbl-export-form-cell :is(input[type="checkbox"],.maestro-checkbox-input),
.dark .pbl-export-form-grid .pbl-export-form-cell :is(input[type="checkbox"],.maestro-checkbox-input) { outline:1px solid var(--pbl-dark-strong-border,#6f6f6f); outline-offset:1px; }

/* #240 · Tarjeta de registro con roles (insignias del SIS) y sección más holgada; área de texto canónica del Lab */
.record-card__roles { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 22px; }
.record-card--section { padding-bottom: 6px; }
.record-card--section .record-card__header { min-height: 44px; padding: 14px 16px 0 22px; gap: 10px; }
.record-card--section .record-card__icon { flex-basis: 20px; width: 20px; height: 20px; }
.record-card--section .record-card__title { font-size: 18px; line-height: 26px; }
.record-card--section .record-card__roles { padding-top: 12px; }
.record-card--section .record-card__body { padding: 12px 22px 18px; font-size: 16px; line-height: 26px; color: #0b0b0b; }
.record-card--section .record-card__body p { color: #0b0b0b; }
.record-card--section .record-card__btn { color: #0b0b0b; }
.record-card--section .record-card__btn--delete { color: #a40f16; }
.pbl-textarea-field { position: relative; }
.pbl-textarea-field .form-textarea { min-height: 76px; resize: none; display: block; }
.record-card__roles .badge-status { width: auto; min-width: 0; height: 28px; padding: 2px 10px; font-size: 13px; white-space: nowrap; }

/* #241 · Dirección (ajustes de Jeremy): roles junto al título, 3 px de radio, texto mayor y centrado, más baja */
.record-card--section { min-height: 280px; display: flex; flex-direction: column; }
.record-card--section .record-card__header { flex-wrap: wrap; row-gap: 8px; }
.record-card--section .record-card__title { font-size: 19px; }
.record-card--section .record-card__header > .record-card__roles { padding: 0; margin-left: 4px; gap: 6px; flex-wrap: nowrap; }
.record-card--section .record-card__actions { margin-left: auto; }
.record-card--section .record-card__body { flex: 1 1 auto; display: flex; flex-direction: column; justify-content: center; font-size: 17px; line-height: 28px; padding: 0 22px 20px; }
.record-card--section .record-card__body p { margin: 0; }
/* Preserve readable record-card text and actions when the SIS page is in dark mode. */
html.dark .record-card--section .record-card__body p { color: #c6c6c6; }
html.dark .record-card--section .record-card__title { color: #f4f4f4; }
html.dark .record-card--section .record-card__btn { color: #f4f4f4; }
html.dark .record-card--section .record-card__btn--delete { color: #ff8389; }
.record-card__roles .badge-status { height: 24px; padding: 1px 9px; font-size: 12px; border-radius: 3px; }
/* #242 · Dirección: texto alineado arriba (decisión de Jeremy), con aire equilibrado */
.record-card--section { min-height: 250px; }
.record-card--section .record-card__body { justify-content: flex-start; padding: 8px 22px 22px; }
.record-card--section { min-height: 270px; }
.record-card--section .record-card__body { padding: 14px 22px 22px; line-height: 30px; }

/* #244 · Bloque o panel sin título: reservar 20 px arriba (como a los lados y abajo) para que el contenido no quede pegado al borde */
.pbl-page-block .card > .card-body:first-child:not(:has(> .pbl-page-tabs-block)),
.pbl-block .card > .card-body:first-child:not(:has(> .pbl-page-tabs-block)) { padding-top: 20px; }

/* #245 · Triángulo de redimensionar: el contenedor del textarea (.form-field) lleva 3 px de padding inferior, así que con el
   bottom:2px base el triángulo caía 1 px fuera del borde. Se usa el mismo inset que ya tenía .notas-field en forms-global-override.css. */
.form-field > .textarea-resize-icon { right: 3px; bottom: 4px; transform: translateY(-1px); }
.form-field > .textarea-resize-icon svg { bottom: 2px; right: 0; }

/* #246 · Campo de fecha del Page Builder: DD/MM/AAAA fijo (texto con máscara) y botón de calendario sobre el icono del canon */
.pbl-date-field { position: relative; }
.pbl-date-field .form-field-date { padding-right: 28px; }
.pbl-date-picker-btn { position: absolute; right: 4px; top: 7px; width: 20px; height: 20px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; background: transparent; cursor: pointer; z-index: 2; }
.pbl-date-picker-btn:disabled { cursor: not-allowed; opacity: .5; }
.pbl-date-native { position: absolute; right: 4px; top: 7px; width: 20px; height: 20px; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.pbl-date-field .form-field-date { padding-right: 26px; letter-spacing: 0; }

/* #247 · Texto legible (criterio de Jeremy): rótulos de grupo y filas de cuenta en negro suave, no en gris */
.pbl-simple-copy.pbl-simple-copy--group-label h3 { color: #161616; }
.record-card--row .record-card__eyebrow { color: #161616; }
.record-card--row .record-card__body { color: #393939; font-size: 14px; line-height: 20px; }

/* #249 · Tarjeta de registro «sección»: se ajusta a su contenido (Jeremy: que no sobre espacio al final de cada tarjeta) */
.record-card--section { min-height: 0; }
.record-card--section .record-card__body { padding-bottom: 16px; }

/* #251 · Encabezado de ficha sobre las pestañas de página: título, etiqueta de estado, guardado automático e interruptor */
.pbl-page-header { display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 16px; padding: 6px 4px 10px; }
/* Alto fijo (el del badge): al activar «Futuro» aparece el badge sin que el encabezado crezca ni empuje el contenido */
.pbl-page-header__title { display: flex; align-items: center; gap: 12px; min-width: 0; min-height: 24px; }
.pbl-page-header__title h1 { margin: 0; font: 600 16px/20px "IBM Plex Sans", sans-serif; letter-spacing: .16px; color: #0b0b0b; }
.pbl-page-header__badge[hidden] { display: none; }
.pbl-page-header__badge { width: auto; min-width: 0; height: 24px; padding: 1px 9px; font-size: 12px; border-radius: 3px; }
.pbl-page-header__badge:not([hidden]) { animation: pblHeaderBadgeIn .18s ease both; }
@keyframes pblHeaderBadgeIn { from { opacity: 0; transform: translateX(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .pbl-page-header__badge:not([hidden]) { animation: none; } }
.pbl-page-header__tools { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; justify-content: flex-end; }
.pbl-page-header__saved { display: inline-flex; align-items: center; gap: 6px; font: 400 13px/18px "IBM Plex Sans", sans-serif; color: #161616; }
.pbl-page-header__saved-icon { display: inline-flex; color: #077e38; }
.pbl-page-header__saved-icon svg { width: 16px; height: 16px; fill: currentColor; }
.pbl-page-header__saved.is-saving .pbl-page-header__saved-icon { color: #595d62; }
.pbl-page-header__toggle { font-weight: 600; font-size: 14px; }

/* Flechas flotantes de la barra de pestañas (canon de compras-maestro): solo en pantallas angostas y cuando hay pestañas fuera de vista.
   Viven dentro de la barra con position: sticky para quedar fijas a sus bordes mientras la barra se desplaza. */
.pbl-tabs-arrow-anchor, .pbl-tabs-end { display: none; }
@media (max-width: 639px) {
  .pbl-tabs-arrow-anchor { position: sticky; display: block; flex: 0 0 0; width: 0; min-width: 0; align-self: center; overflow: visible; z-index: 7; }
  /* el gap de 5 px de la barra no debe desplazar las pestañas por culpa de estos elementos de ancho cero */
  .pbl-tabs-arrow-anchor--left { left: 0; order: -1; margin-right: -5px; }
  .pbl-tabs-arrow-anchor--right { right: 0; margin-left: -5px; }
  .pbl-tabs-end { display: block; flex: 0 0 0; width: 0; height: 0; margin-left: -5px; }
  .pbl-tabs-arrow { position: absolute; top: 50%; transform: translateY(-50%); display: none; align-items: center; justify-content: center; box-sizing: border-box; width: 24px; min-width: 24px; max-width: none; height: 24px; padding: 0; border: 1px solid #595d62; border-radius: 50%; background: #ffffff; box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.16), 0px 0px 1px 0px rgba(0, 0, 0, 0.4); cursor: pointer; }
  .pbl-tabs-arrow-anchor--left .pbl-tabs-arrow { left: 0; }
  .pbl-tabs-arrow-anchor--right .pbl-tabs-arrow { right: 0; }
  .pbl-tabs-arrow.is-visible { display: flex; }
  .pbl-tabs-arrow svg { width: 16px; height: 16px; display: block; }
  .pbl-tabs-arrow:focus-visible { outline: 2px solid #0f62fe; outline-offset: 1px; }
}
html.dark .pbl-tabs-arrow { background: var(--card-background, #262626); border-color: var(--card-border, #6f6f6f); box-shadow: 0px 6px 6px -6px rgba(0, 0, 0, 0.4), 0px 0px 1px 0px rgba(255, 255, 255, 0.15); }
html.dark .pbl-tabs-arrow svg path { stroke: var(--text-primary, #f4f4f4); }
/* Encabezado de ficha en pantallas angostas: título arriba; «cambios guardados» y el interruptor en una fila debajo */
@media (max-width: 640px) {
  .pbl-page-header { flex-direction: column; align-items: stretch; gap: 4px; padding: 6px 4px 8px; }
  .pbl-page-header__tools { width: 100%; flex-wrap: nowrap; justify-content: space-between; gap: 12px; }
  .pbl-page-header__saved { min-width: 0; font-size: 12px; line-height: 16px; }
  .pbl-page-header__toggle { flex: 0 0 auto; white-space: nowrap; }
}

/* #252 · Dirección predeterminada («Cambiar», casilla «misma que…») y pie «Usar como predeterminada» en la libreta */
.record-card--default { display: flex; flex-direction: column; gap: 6px; padding: 18px 22px 20px; border: 1px dotted #595d62; border-radius: 2px; background: transparent; }
.record-card--default .record-card__header { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0; border: 0; background: transparent; flex-wrap: wrap; }
.record-card__tile { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 3px; flex: none; }
.record-card__tile svg { width: 20px; height: 20px; fill: currentColor; }
.record-card--default-receipt .record-card__tile { background: rgba(24, 107, 233, .12); color: #186be9; }
.record-card--default-delivery .record-card__tile { background: rgba(46, 125, 50, .12); color: #077e38; }
.record-card__heading { display: flex; flex-direction: column; min-width: 0; }
.record-card--default .record-card__title { margin: 0; font: 600 19px/24px "IBM Plex Sans", sans-serif; color: #0b0b0b; }
.record-card__subtitle { font: 400 13px/18px "IBM Plex Sans", sans-serif; color: #161616; }
.record-card__tools { position: relative; margin-left: auto; display: inline-flex; align-items: center; gap: 16px; flex: none; }
.record-card__same { white-space: nowrap; font-size: 14px; }
.record-card__change { min-width: 0; height: 34px; min-height: 34px; padding: 4px 40px 4px 16px; }
.record-card__change:disabled { opacity: .5; cursor: not-allowed; }
.record-card__name { margin-top: 6px; font: 600 17px/24px "IBM Plex Sans", sans-serif; color: #0b0b0b; }
.record-card--default .record-card__body { padding: 0; font: 400 17px/24px "IBM Plex Sans", sans-serif; color: #0b0b0b; }
.record-card--default .record-card__body p { margin: 0; }
.record-card__footer { position: relative; margin: auto 22px 14px; padding-top: 10px; border-top: 1px dotted #8d8d8d; }
.record-card__footer-link { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; border: 0; background: none; color: #186be9; font: 600 14px "IBM Plex Sans", sans-serif; cursor: pointer; }
.record-card__footer-link svg { width: 16px; height: 16px; fill: currentColor; }
.pbl-address-menu { position: absolute; right: 0; top: 100%; z-index: 20; min-width: 200px; display: flex; flex-direction: column; margin-top: 4px; background: #fff; border: 1px solid #8d8d8d; border-radius: 2px; box-shadow: 0 4px 12px rgba(0, 0, 0, .18); }
.record-card__footer .pbl-address-menu { right: auto; left: 0; }
.pbl-address-menu button { padding: 9px 14px; border: 0; background: none; text-align: left; font: 400 14px "IBM Plex Sans", sans-serif; color: #0b0b0b; cursor: pointer; }
.pbl-address-menu button:hover { background: #f1f2f3; }
.pbl-address-menu.pbl-address-menu--above { top: auto; bottom: 100%; margin: 0 0 4px; }

/* Escala tipográfica canónica de la tarjeta de registro (la versión anterior usaba 17-19 px y en pantalla real se veía enorme):
   título de tarjeta 16/20 como .card-header h1, datos 14/20, ayudas 12/16, etiquetas y enlaces 13 (como los campos). */
.record-card--default { padding: 14px 16px 16px; }
.record-card--default .record-card__title { font-size: 16px; line-height: 20px; }
.record-card--default .record-card__tile { width: 32px; height: 32px; }
.record-card--default .record-card__tile svg { width: 18px; height: 18px; }
.record-card__subtitle { font-size: 12px; line-height: 16px; }
.record-card__name { margin-top: 4px; font-size: 14px; line-height: 20px; }
.record-card--default .record-card__body { font-size: 14px; line-height: 20px; }
.record-card__same, .record-card__footer-link { font-size: 13px; }
.record-card__footer { margin: auto 16px 12px; }
.record-card--section .record-card__header { min-height: 36px; padding: 12px 16px 0; }
.record-card--section .record-card__title { font-size: 16px; line-height: 20px; }
.record-card--section .record-card__body { padding: 10px 16px 16px; font-size: 14px; line-height: 20px; }
.record-card--section .record-card__body p { line-height: 20px; }
.record-card--row .record-card__eyebrow { font-size: 13px; line-height: 18px; }
.record-card--row .record-card__title { font-size: 14px; line-height: 20px; }
.record-card--row .record-card__body { font-size: 13px; line-height: 18px; }

/* #255 · Tarjeta bloqueada (dirección que viene del perfil) y filas repetibles separadas */
.record-card__lock { display: inline-flex; align-items: center; color: #393939; }
.record-card__lock svg { width: 18px; height: 18px; fill: currentColor; }
.record-card__note { margin: 0; padding: 0 22px 16px; font: 400 13px/18px "IBM Plex Sans", sans-serif; color: #161616; }
.record-card--locked.is-empty .record-card__body p { color: #595d62; font-style: italic; font-size: 15px; }
.pbl-sub-block--repeatable .pbl-sub-block-row + .pbl-sub-block-row { margin-top: 16px; padding-top: 16px; border-top: 1px dotted #8d8d8d; }

/* #262 · Cintillo de revisión de la página: ocupa todo el ancho de la cuadrícula de página */
.pbl-page-review-banner { grid-column: 1 / -1; min-width: 0; }

/* Señal de «guardado»: verde muy tenue que se desvanece (tarjeta de registro editada o creada) */
@keyframes pblSavedFlash {
  0% { background-color: rgba(7, 126, 56, .16); box-shadow: 0 0 0 2px rgba(7, 126, 56, .28); }
}
@keyframes pblSavedFlashDark {
  0% { background-color: rgba(66, 190, 101, .2); box-shadow: 0 0 0 2px rgba(66, 190, 101, .35); }
}
.record-card.is-just-saved { animation: pblSavedFlash 2s ease-out; }
html.dark .record-card.is-just-saved { animation-name: pblSavedFlashDark; }
@media (prefers-reduced-motion: reduce) {
  .record-card.is-just-saved { animation: none; box-shadow: 0 0 0 2px rgba(7, 126, 56, .35); }
}

/* Etiqueta flotante que no cabe en su campo: se trunca con tres puntos (la marca la pone el runtime de ajuste de etiquetas) */
.form-field-label.is-truncated,
.form-textarea-label.is-truncated { display: block !important; overflow: hidden !important; text-overflow: ellipsis !important; white-space: nowrap !important; }

/* Tarjeta bloqueada (no editable desde esta pantalla, lleva candado): fondo gris, texto atenuado y marco verde oscuro */
.record-card:has(.record-card__lock) { background: #f4f4f4; border: 2px solid #0b5a2a; color: #6f6f6f; }
.record-card:has(.record-card__lock) .record-card__title,
.record-card:has(.record-card__lock) .record-card__name { color: #525252; }
.record-card:has(.record-card__lock) .record-card__body,
.record-card:has(.record-card__lock) .record-card__text,
.record-card:has(.record-card__lock) .record-card__note { color: #6f6f6f; }
html.dark .record-card:has(.record-card__lock) { border-color: #42be65; color: #a8a8a8; }
html.dark .record-card:has(.record-card__lock) .record-card__lock { color: #c6c6c6; }
html.dark .record-card:has(.record-card__lock) .record-card__title,
html.dark .record-card:has(.record-card__lock) .record-card__name { color: #c6c6c6; }

/* #275 · Confirmación de sobrescritura con el modal canónico y anuncio accesible de guardado */
.pbl-record-overwrite-overlay { z-index: 2000; }
.pbl-record-overwrite-modal { width: min(440px, 100%); max-width: 440px; }
.pbl-record-save-live { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Vistas por forma de acceso: ocultar lo que no corresponde y avisos del formulario */
[data-pbl-view-hidden] { display: none !important; }
.pbl-page-header__saved.is-warning { color: #8a3800; }
.pbl-page-header__saved.is-warning .pbl-page-header__saved-icon { color: #b28600; }
html.dark .pbl-page-header__saved.is-warning { color: #f1c21b; }
html.dark .pbl-page-header__saved.is-warning .pbl-page-header__saved-icon { color: #f1c21b; }
.pbl-form-toast { position: fixed; left: 50%; bottom: 72px; z-index: 2100; max-width: min(520px, calc(100vw - 32px)); padding: 10px 16px; transform: translateX(-50%); border-radius: 4px; background: #161616; color: #fff; font: 400 13px/18px "IBM Plex Sans", sans-serif; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); transition: opacity .3s; }
.pbl-form-toast.is-leaving { opacity: 0; }
.pbl-required-go { flex: 0 0 auto; align-self: center; margin-left: auto; white-space: nowrap; }
@media (max-width: 639px) { .pbl-page-review-banner .notice-banner:has(.pbl-required-go) { flex-wrap: wrap; } .pbl-required-go { width: 100%; margin: 8px 0 0; } }

/* Separador (componente propuesto): línea vertical u horizontal configurable dentro de la cuadrícula del bloque */
.pbl-export-form-cell[data-pbl-renderer-type="divider"], .pbl-element[data-element-type="divider"] { pointer-events: none; align-self: stretch; padding: 0; }
.pbl-divider { --pbl-divider-color: #525252; position: relative; display: block; box-sizing: border-box; pointer-events: none; }
.pbl-divider--subtle { --pbl-divider-color: #c6c6c6; }
.pbl-divider--success { --pbl-divider-color: #077e38; }
.pbl-divider--vertical { width: 0; height: calc(100% - 2 * var(--pbl-divider-inset, 0px)); margin: var(--pbl-divider-inset, 0px) 0 0 var(--pbl-divider-offset, -16px); border-left: var(--pbl-divider-thickness, 2px) var(--pbl-divider-style, dashed) var(--pbl-divider-color); }
.pbl-divider--horizontal { width: calc(100% - 2 * var(--pbl-divider-inset, 0px)); height: 0; margin: var(--pbl-divider-offset, 0px) 0 0 var(--pbl-divider-inset, 0px); border-top: var(--pbl-divider-thickness, 2px) var(--pbl-divider-style, dashed) var(--pbl-divider-color); }
/* Aire debajo de la línea horizontal (propiedad «Espacio debajo de la línea»): separa la línea de lo que viene después, p. ej. las etiquetas de la fila siguiente */
.pbl-divider--horizontal { margin-bottom: var(--pbl-divider-below, 0px); }
html.dark .pbl-divider--strong { --pbl-divider-color: #a8a8a8; }
html.dark .pbl-divider--subtle { --pbl-divider-color: #4a4a4a; }
html.dark .pbl-divider--success { --pbl-divider-color: #42be65; }
.pbl-element .pbl-divider { pointer-events: auto; cursor: pointer; }
.pbl-element .pbl-divider::after { content: ""; position: absolute; inset: 0 -8px; }
@media (max-width: 901px) { .pbl-divider--wide-only { display: none; } }

/* Encabezado de un registro existente: etiqueta con el número y el nombre destacado */
.pbl-page-header__title h1:has(.pbl-page-header__chip) { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 20px; line-height: 28px; letter-spacing: 0; }
.pbl-page-header__chip { flex: 0 0 auto; padding: 2px 10px; border-radius: 3px; background: #595d62; color: #ffffff; font: 500 12px/18px "IBM Plex Sans", sans-serif; letter-spacing: .32px; }
.pbl-page-header__name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html.dark .pbl-page-header__chip { background: #c6c6c6; color: #161616; }

/* Aviso de obligatorios bajo el encabezado, antes de las pestañas */
.pbl-required-slot { padding: 0 4px 10px; }
.pbl-required-slot > .notice-banner { margin: 0; }

/* Las tarjetas de registro se ajustan a su contenido (sin espacio sobrante); la casilla «Agregar» sigue la altura de la fila */
.pbl-export-form-cell.pbl-export-form-cell:has(.record-card) { align-self: start; }
.pbl-export-form-cell.pbl-export-form-cell:has(.add-tile) { align-self: start; }

/* Las casillas de las secciones no parten su texto en dos líneas */
.pbl-sub-block-child .maestro-checkbox-label { white-space: nowrap; }

/* El label flotante de la primera fila de un formulario no se corta (card-body tiene overflow:hidden) */
.card-body > .pbl-export-form-grid { padding-top: 6px; }

/* Cintillo de revisión: selector de versión de diseño y acceso a comentar */
.pbl-review-controls { display: flex; flex: 0 0 auto; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 4px 0 auto; align-self: center; }
.notice-banner:has(> .pbl-review-controls) { flex-wrap: wrap; align-items: center; }
.notice-banner:has(> .pbl-review-controls) > .notice-banner__content { flex: 1 1 260px; }
.pbl-review-mark--primary { background: #161616 !important; color: #fff !important; }
@media (max-width: 760px) {
  .pbl-review-controls { order: 3; flex: 1 1 100%; margin: 4px 0 0; }
  .notice-banner:has(> .pbl-review-controls) > .notice-banner__content { flex: 1 1 0; }
  .notice-banner:has(> .pbl-review-controls) > .notice-banner__dismiss { order: 2; align-self: flex-start; }
}
.pbl-review-versions { display: inline-flex; border: 1px solid #8a6d00; border-radius: 3px; overflow: hidden; background: rgba(255, 255, 255, .6); }
.pbl-review-version { min-height: 28px; padding: 4px 14px; border: 0; border-right: 1px solid #c9a400; background: transparent; color: #161616; font: 500 12px/18px "IBM Plex Sans", sans-serif; cursor: pointer; }
.pbl-review-version:last-child { border-right: 0; }
.dark .pbl-review-versions { background: rgba(255, 255, 255, .06); border-color: #8a6d00; }
.dark .pbl-review-version { color: #f4f4f4; }
.dark .pbl-review-version[aria-pressed="true"] { background: #f4f4f4; color: #161616; }
.pbl-review-version[aria-pressed="true"] { background: #161616; color: #fff; }
.pbl-review-mark { min-height: 28px; padding: 4px 14px; border: 1px solid #161616; border-radius: 3px; background: transparent; color: #161616; font: 500 12px/18px "IBM Plex Sans", sans-serif; cursor: pointer; }
.pbl-review-mark { display: inline-flex; align-items: center; gap: 6px; }
.pbl-review-mark__icon { flex: 0 0 auto; }
.pbl-review-mark:hover, .pbl-review-version:hover { background: rgba(22, 22, 22, .08); }
.pbl-review-version[aria-pressed="true"]:hover { background: #161616; }

/* Botón «Nuevo» del encabezado de ficha */
.pbl-page-header__new { flex: 0 0 auto; width: auto; min-width: 0; display: inline-flex; align-items: center; gap: 6px; min-height: 28px; height: 28px; padding: 0 12px; white-space: nowrap; font-size: 13px; }
.pbl-page-header__new svg { width: 16px; height: 16px; fill: currentColor; }
/* Encabezado de tarjeta con etiqueta de registro (por ejemplo Crédito del cliente): mismo estilo que el de la ficha */
.card-header h1:has(.pbl-page-header__chip) { display: flex; align-items: center; gap: 12px; min-width: 0; font-size: 20px; line-height: 28px; letter-spacing: 0; }

/* Botones en la rejilla de una página del Constructor (los marca pblButtonRowRuntime): quedan abajo, como los campos de su fila, y junto a un campo
   miden lo mismo que él. Varios botones de una fila se juntan por script (transform), sin cambiar la estructura. */
[data-pbl-button-cell] { display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start; }
/* el botón mide lo que pide su contenido aunque su celda sea más estrecha (el script lo coloca junto a su vecino) */
[data-pbl-button-cell] .btn:not(.pbl-btn-full) { width: max-content; max-width: none; flex: 0 0 auto; }
[data-pbl-field-row] .btn:not(.pbl-btn-full) { height: var(--pbl-field-h, 25px); min-height: var(--pbl-field-h, 25px); padding-top: 0; padding-bottom: 0; margin-bottom: var(--pbl-field-inset, 0px); }

/* Botón del Constructor ajustado a su contenido (sin el ancho mínimo canónico de 140 px): cabe en bloques estrechos, como en Figma. */
.btn.pbl-btn-compact { min-width: 0; }
.btn.pbl-btn-compact { gap: 8px; padding-left: 14px; padding-right: 14px; }
.btn.pbl-btn-compact .btn-icon { position: static; transform: none; flex: 0 0 16px; }

/* Fila elegida de una tabla del Constructor (prop «selectedRow»): fondo verde y marca ▶ en la primera celda, como la lista de Figma */
.pbl-table-component tbody tr.pbl-row-selected > td { background: rgba(7, 126, 56, 0.35) !important; }
:is(.pbl-export-form-cell, .pbl-sub-block-child):has(> .pbl-table-component) { position: relative; }
:is(.pbl-export-form-cell, .pbl-sub-block-child) > .pbl-row-marker { position: absolute; width: 0; height: 0; transform: translateY(-50%); border-left: 8px solid var(--btn-success-bg, #087b39); border-top: 6px solid transparent; border-bottom: 6px solid transparent; pointer-events: none; z-index: 3; }
.dark .pbl-table-component tbody tr.pbl-row-selected > td { background: rgba(7, 126, 56, 0.5) !important; }
/* Fila elegida con estado de color (p. ej. nota nula): bloque sólido del color del estado, texto y cuadrito de estado en blanco.
   Evita rojo sobre verde (daltonismo) y sube el contraste a ~7:1. */
.pbl-table-component tbody tr.pbl-status-row.pbl-row-selected > td { background: var(--pbl-status-color) !important; color: #fff !important; }
.pbl-table-component tbody tr.pbl-status-row.pbl-row-selected .status-indicator { background-color: #fff !important; }
.dark .pbl-table-component tbody tr.pbl-status-row.pbl-row-selected > td, html.dark .pbl-table-component tbody tr.pbl-status-row.pbl-row-selected > td { background: color-mix(in srgb, var(--pbl-status-color) 80%, #000) !important; color: #fff !important; }

/* Casilla junto a campos en la rejilla del Constructor (la marca pblButtonRowRuntime): centrada con el cuadro de escritura, no con la etiqueta */
[data-pbl-check-cell] { display: flex; flex-direction: column; justify-content: flex-end; }
[data-pbl-check-cell] > .pbl-checkbox-label { display: flex; align-items: center; height: var(--pbl-field-h, 25px); margin-bottom: var(--pbl-field-inset, 0); }

/* Columna de acciones de una tabla del Constructor: el botón (eliminar, editar…) queda centrado verticalmente en la fila */
.pbl-table-component td.col-acciones { display: flex; align-items: center; justify-content: center; padding-top: 0 !important; padding-bottom: 0 !important; box-sizing: border-box; }

/* Los rótulos no se parten en dos líneas: «Propuesta C» en el cintillo y «Uso único» junto a los campos */
.pbl-review-version { white-space: nowrap; }
.pbl-checkbox-label-text { white-space: nowrap; }

/* Título de una lista en la misma fila que su filtro: queda centrado con el cuadro de escritura (lo marca pblButtonRowRuntime) */
[data-pbl-title-cell] { display: flex; flex-direction: column; justify-content: flex-end; }
[data-pbl-title-cell] > * { display: flex; align-items: center; height: var(--pbl-field-h, 25px); margin-top: 0; margin-bottom: var(--pbl-field-inset, 0); }
/* En un bloque con paneles apilados, el panel de arriba no necesita el relleno inferior completo: el siguiente panel ya trae su propio encabezado. */
.pbl-unified-block-vertical > .column:not(:last-child) .card-body { padding-bottom: 6px; }
[data-pbl-title-cell] { align-self: end; }
/* Bloque con dos paneles apilados: el de arriba mide lo que necesita y el de abajo (la lista) ocupa el resto, en vez de repartir el sobrante entre los dos. */
.columns-container.pbl-unified-block-vertical:has(> .column:nth-child(2):last-child) { grid-template-rows: auto minmax(0, 1fr); }
[data-pbl-title-cell] > * > :is(h1, h2, h3, h4, p) { margin: 0; }
[data-pbl-title-cell] > * > p:empty { display: none; }
[data-pbl-title-cell] { align-self: end !important; }
[data-pbl-check-cell] { align-self: end !important; }

/* Botón de eliminar fila: la X siempre blanca sobre el rojo, también en modo oscuro (se perdía en negro). */
.dark .btn-delete-row.btn-delete-row:not(:hover):not(:disabled), html.dark .btn-delete-row.btn-delete-row:not(:hover):not(:disabled) { color: #ffffff !important; }

/* Modo oscuro: filas con el texto del color de su estado (p. ej. inactivas en rojo) en una versión más clara para que se lean sobre el fondo oscuro */
.dark .pbl-table-component .pbl-status-row:not(.empty-state) > td, html.dark .pbl-table-component .pbl-status-row:not(.empty-state) > td { color: color-mix(in srgb, var(--pbl-status-color) 40%, #ffffff) !important; }
/* Modo oscuro: los íconos de código (Cliente/Producto) son imágenes oscuras; se invierten para que se vean */
.dark .pbl-id-context__icon, html.dark .pbl-id-context__icon { filter: invert(1) brightness(1.1); }

/* Cintillo de revisión en pantallas angostas: las propuestas se acomodan en dos columnas en vez de cortarse */
@media (max-width: 520px) {
  .pbl-review-versions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 100%; }
  .pbl-review-version { border-bottom: 1px solid #c9a400; }
  .pbl-review-version:nth-child(2n) { border-right: 0; }
  .pbl-review-version:nth-last-child(-n+2) { border-bottom: 0; }
  /* Tres propuestas (A, B y C): una sola fila en vez de dos columnas con un hueco */
  .pbl-review-versions:has(> .pbl-review-version:nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pbl-review-versions:has(> .pbl-review-version:nth-child(3):last-child) .pbl-review-version { padding-inline: 4px; border-bottom: 0; border-right: 1px solid #c9a400; text-align: center; }
  .pbl-review-versions:has(> .pbl-review-version:nth-child(3):last-child) .pbl-review-version:last-child { border-right: 0; }
}

/* Encabezado de un bloque en pantallas angostas: el título conserva un mínimo legible y las acciones bajan a su propia línea (en vez de partir el título en tres) */
@media (max-width: 501px) {
  .pbl-page-block .card-header { flex-wrap: wrap; row-gap: 6px; }
  .pbl-page-block .card-header > h1 { flex: 1 1 9em; min-width: min(9em, 100%); }
  .pbl-page-block .card-header .card-header-actions { margin-left: auto; flex-wrap: wrap; justify-content: flex-end; }
}
@media (max-width: 501px) { .pbl-page-block .toggle-block-btn svg { width: 18px; height: 18px; } }
/* Título de lista centrado con su filtro: sin flex (más estable al dibujar la página como imagen) y sin partirse en dos líneas */
[data-pbl-title-cell] > * { display: block; line-height: var(--pbl-field-h, 25px); }
[data-pbl-title-cell] > * > :is(h1, h2, h3, h4) { white-space: nowrap; line-height: inherit; }

/* Íconos a la derecha de un campo (flecha de lista, calendario, X del autocompletar): siempre a 8 px del borde y con espacio para el texto */
.form-field-select, .form-field-date { padding-right: 32px; }

/* Selector de propuestas con tres versiones: en pantallas muy angostas se apila para que no se corte el texto */
@media (max-width: 480px) {
  .pbl-review-versions:has(> .pbl-review-version:nth-child(3):last-child) { grid-template-columns: minmax(0, 1fr); }
  .pbl-review-versions:has(> .pbl-review-version:nth-child(3):last-child) .pbl-review-version { border-right: 0; border-bottom: 1px solid #c9a400; padding-inline: 8px; }
  .pbl-review-versions:has(> .pbl-review-version:nth-child(3):last-child) .pbl-review-version:last-child { border-bottom: 0; }
}

/* Botón de ícono cuadrado canónico (acciones dentro de filas de tabla, ej. el botón de moneda para ver una factura). Siempre cuadrado; el ícono es Carbon, nunca un texto. */
.btn-icon-square { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 22px; height: 22px; min-width: 22px; padding: 0; border: 0; border-radius: 2px; background: var(--button-primary-bg, #4c1ed6); color: #ffffff; line-height: 0; cursor: pointer; text-decoration: none; }
.btn-icon-square svg { display: block; width: 14px; height: 14px; fill: currentColor; }
a.btn-icon-square, a.btn-icon-square:hover, a.btn-icon-square:focus, a.btn-icon-square:visited, a.btn-icon-square:active { color: #ffffff !important; text-decoration: none !important; }
.btn-icon-square:hover { filter: brightness(1.15); }
.btn-icon-square:focus-visible { outline: 2px solid var(--focus-color, #0f62fe); outline-offset: 2px; }

/* ===== Estado «solo lectura» (opt-in, 16/11/2026) =====
   Para un dato que se consulta pero no se edita (por ejemplo una nota ya guardada). NO reemplaza a .is-disabled (el gris apagado de Figma, que sigue igual):
   aquí el texto se lee con claridad (contraste ≥ 4,5:1), el campo se puede enfocar y copiar, y solo el fondo suave avisa que no se escribe.
   Se activa agregando la clase .is-readonly al .form-field (y el atributo readonly al campo). */
.form-field.is-readonly .form-field-input,
.form-field.is-readonly .form-field-select,
.form-field.is-readonly .form-field-date,
.form-field.is-readonly .form-textarea {
  background-color: #f4f4f4;
  color: var(--text-primary, #161616);
  -webkit-text-fill-color: var(--text-primary, #161616);
  border-color: #c6c6c6;
  cursor: default;
  opacity: 1;
}
.form-field.is-readonly .form-field-select { appearance: none; -webkit-appearance: none; background-image: none !important; }
.form-field.is-readonly .form-field-label,
.form-field.is-readonly .form-textarea-label { color: #525252; }
.form-field.is-readonly .pbl-date-picker-btn,
.form-field.is-readonly .autocomplete-clear { display: none; }
.dark .form-field.is-readonly .form-field-input,
.dark .form-field.is-readonly .form-field-select,
.dark .form-field.is-readonly .form-field-date,
.dark .form-field.is-readonly .form-textarea { background-color: #262626; color: #f4f4f4; -webkit-text-fill-color: #f4f4f4; border-color: #525252; }
.dark .form-field.is-readonly .form-field-label,
.dark .form-field.is-readonly .form-textarea-label { color: #c6c6c6; }

/* Campo de texto largo con mensaje de error: el icono de agrandar se queda en la esquina del cuadro, no baja a la línea del mensaje */
.form-field.has-error > .textarea-resize-icon { bottom: 24px; }
/* El icono de agrandar (◢, decorativo) no tapa el texto: el campo deja un margen a la derecha donde está el icono */
:is(.form-field, .mensaje-field):has(> .textarea-resize-icon) .form-textarea { padding-right: 22px !important; }
:is(.form-field, .mensaje-field):has(> .textarea-resize-icon) .form-textarea:focus { padding-right: 21px !important; }


/* Atajo «Saltar a la lista» (accesibilidad por teclado): invisible hasta que recibe el foco con Tab; entonces aparece arriba a la izquierda del bloque, sin mover el diseño.
   Lo crea omega-linked-form.js; sirve para cualquier bloque con una lista a la que se quiera llegar sin recorrer los filtros. */
.omega-has-skip-link { position: relative; }
.omega-skip-link { position: absolute; left: 8px; top: 6px; z-index: 6; padding: 0; border: 0; border-radius: 2px; background: var(--card-background, #ffffff); color: var(--text-primary, #161616); font-family: inherit; font-size: 13px; line-height: 16px; font-weight: 600; text-decoration: underline; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; white-space: nowrap; }
.omega-skip-link:focus, .omega-skip-link:focus-visible { clip-path: none; width: auto; height: auto; overflow: visible; outline: none; padding: 4px 10px; border: 2px solid #077e38; }
.dark .omega-skip-link { background: #262626; color: #f4f4f4; border-color: #42be65; }
